diff --git a/.gitignore b/.gitignore
index 57cf324..1b4c4b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,11 +3,13 @@
################################################################################
/.vs
-/Release
/Debug
-/x64
+/Release
/Speedy E.e424a3cb
-/DATA
-/IMAGE*
-/MOVIE
+/x64
+/IMAGE08
+/IMAGE16
/SOUND
+/MOVIE
+/DATA
+Speedy Eggbert 2 Source.vcxproj.user
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
index bf35d7f..45e4195 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
[submodule "dxsdk3"]
path = dxsdk3
- url = https://github.com/masonmc/dxsdk3.git
+ url = https://github.com/jummy0/dxsdk3.git
diff --git a/README.md b/README.md
index d4a3b91..1204992 100644
--- a/README.md
+++ b/README.md
@@ -5,18 +5,18 @@
| CPP File | Progress |
| -------- | -------- |
- | blupi.cpp | 95% complete |
- | button.cpp | 98% complete |
- | decblupi.cpp | 1% complete |
- | decor.cpp | 8% complete |
- | event.cpp | 30% complete |
+ | blupi.cpp | 99% complete |
+ | button.cpp | 100% complete |
+ | decor.cpp | 80% complete |
+ | event.cpp | 70% complete |
| menu.cpp | 100% complete |
| misc.cpp | 100% complete |
| movie.cpp | 100% complete |
- | network.cpp | 2% complete |
- | pixmap.cpp | 80% complete |
- | sound.cpp | 90% complete |
- | text.cpp | 85% complete |
+ | network.cpp | 100% complete |
+ | pixmap.cpp | 99% complete |
+ | sound.cpp | 100% complete |
+ | text.cpp | 100% complete |
+ | wave.cpp | 100% complete |
Credit to jummy over at the Blupi Games Fan Server for doing the decompilation work on the game.
diff --git a/Speedy Eggbert 2 Source.vcxproj b/Speedy Eggbert 2 Source.vcxproj
index 7e373e2..63b06f5 100644
--- a/Speedy Eggbert 2 Source.vcxproj
+++ b/Speedy Eggbert 2 Source.vcxproj
@@ -23,34 +23,35 @@
Win32Proj
{e424a3cb-c8b8-447c-be63-41a57e65b449}
SpeedyEggbert2Source
- 10.0
+
+
Application
true
v140_xp
- Unicode
+ NotSet
Application
false
v140_xp
true
- Unicode
+ NotSet
Application
true
v140_xp
- Unicode
+ NotSet
Application
false
v140_xp
true
- Unicode
+ NotSet
@@ -70,19 +71,38 @@
+
+ $(ProjectName)_
+
+
+ $(ProjectName)_
+
+
+ $(ProjectName)_
+
+
+ $(ProjectName)_
+
Level3
false
- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ WINVER=0x400;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
- false
+ dxsdk3\sdk\inc
+ UNICODE;_UNICODE;_WIN32_WINNT;NTDDI_VERSION
+
Windows
true
- /FORCE:MULTIPLE /DYNAMICBASE "legacy_stdio_definitions.lib" %(AdditionalOptions)
- ./dxsdk3/sdk/lib;%(AdditionalLibraryDirectories)
+ /DYNAMICBASE "legacy_stdio_definitions.lib" %(AdditionalOptions) /VERBOSE
+ dxsdk3\sdk\lib;%(AdditionalLibraryDirectories)
+ false
+ dxsdk3/sdk/lib/*.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ Default
+ true
+ MultiplyDefinedSymbolOnly
@@ -91,28 +111,41 @@
true
true
true
- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ WINVER=0x400;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
+ dxsdk3\sdk\inc
+ UNICODE;_UNICODE;_WIN32_WINNT;NTDDI_VERSION
- Console
+ Windows
true
true
true
- ./dxsdk3/sdk/lib;%(AdditionalLibraryDirectories)
+ dxsdk3\sdk\lib;%(AdditionalLibraryDirectories)
+ MultiplyDefinedSymbolOnly
+ /DYNAMICBASE "legacy_stdio_definitions.lib" %(AdditionalOptions) /VERBOSE
+ Default
+ dxsdk3/sdk/lib/*.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
Level3
true
- _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ WINVER=0x400;WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
+ dxsdk3\sdk\inc
+ UNICODE;_UNICODE;_WIN32_WINNT;NTDDI_VERSION
- Console
+ Windows
true
- ./dxsdk3/sdk/lib;%(AdditionalLibraryDirectories)
+ dxsdk3\sdk\lib;%(AdditionalLibraryDirectories)
+ Default
+ true
+ MultiplyDefinedSymbolOnly
+ /DYNAMICBASE "legacy_stdio_definitions.lib" %(AdditionalOptions) /VERBOSE
+ dxsdk3/sdk/lib/*.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
@@ -121,81 +154,89 @@
true
true
true
- NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ WINVER=0x400;WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
+ dxsdk3\sdk\inc
+ UNICODE;_UNICODE;_WIN32_WINNT;NTDDI_VERSION
- Console
+ Windows
true
true
true
- ./dxsdk3/sdk/lib;%(AdditionalLibraryDirectories)
+ dxsdk3\sdk\lib;%(AdditionalLibraryDirectories)
+ MultiplyDefinedSymbolOnly
+ /DYNAMICBASE "legacy_stdio_definitions.lib" %(AdditionalOptions) /VERBOSE
+ Default
+ dxsdk3/sdk/lib/*.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
diff --git a/Speedy Eggbert 2 Source.vcxproj.filters b/Speedy Eggbert 2 Source.vcxproj.filters
index eed6312..682aa2e 100644
--- a/Speedy Eggbert 2 Source.vcxproj.filters
+++ b/Speedy Eggbert 2 Source.vcxproj.filters
@@ -13,174 +13,189 @@
{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+ {0ff9ef1b-78f1-41d7-9a2b-813cedd6907d}
+
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
-
-
- Resource Files
-
-
-
-
+
+ Data
+
+
Resource Files
-
+
Resource Files
-
+
Resource Files
-
+
Resource Files
-
+
Resource Files
-
+
Resource Files
-
+
Resource Files
-
+
Resource Files
-
+
Resource Files
-
+
Resource Files
-
+
Resource Files
-
+
Resource Files
-
+
Resource Files
-
- Resource Files
-
-
+
Resource Files
-
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+ Source Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+
+
Resource Files
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/Speedy Eggbert 2 Source.vcxproj.user b/Speedy Eggbert 2 Source.vcxproj.user
deleted file mode 100644
index 88a5509..0000000
--- a/Speedy Eggbert 2 Source.vcxproj.user
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/actions.h b/actions.h
deleted file mode 100644
index f877bfa..0000000
--- a/actions.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#define OPTERM 0
-#define OPLIST 1
-#define OPREPEAT 2
-#define OPSOUND 3
-
-typedef enum
-{
- obj_squaretech0,
- obj_squaretech1,
- obj_squaretech2,
- obj_triangulartech_left0,
-
-}
-Object;
\ No newline at end of file
diff --git a/button.cpp b/button.cpp
deleted file mode 100644
index 8492194..0000000
--- a/button.cpp
+++ /dev/null
@@ -1,449 +0,0 @@
-// Button.cpp
-//
-
-#include
-#include
-#include
-#include
-//#include
-#include
-#include "def.h"
-#include "pixmap.h"
-#include "sound.h"
-#include "decor.h"
-#include "button.h"
-#include "misc.h"
-
-using namespace std;
-
-//////////////////////////////////////////////////////////
-
-// Constructor
-
-CButton::CButton()
-{
- m_type = 0;
- m_bEnable = TRUE;
- m_bHide = FALSE;
- m_bSomething = FALSE;
- m_state = 0;
- m_mouseState = 0;
- m_nbMenu = 0;
- m_nbToolTips = 0;
- m_selMenu = 0;
- m_bMouseDown = FALSE;
- m_bMinimizeRedraw = FALSE;
- m_bRedraw = FALSE;
-}
-
-// Destructor
-
-CButton::~CButton()
-{
-}
-
-
-// Create a new Button
-
-BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
- POINT pos, int type, BOOL bMinimizeRedraw, int region, UINT message)
-{
- POINT iconDim;
- //int i, icon;
-
- static int ttypes[] =
- {
- DIMBUTTONX,DIMBUTTONY,
- };
-
- if ( type < 0 || type > 0 ) return FALSE;
-
- iconDim.x = ttypes[type*2+0];
- iconDim.y = ttypes[type*2+1];
-
- m_hWnd = hWnd;
- m_pPixmap = pPixmap;
- m_pSound = pSound;
- m_type = type;
- m_bMinimizeRedraw = bMinimizeRedraw;
- m_bEnable = TRUE;
- m_bHide = FALSE;
- m_bSomething = FALSE;
- m_message = message;
- m_pos.x = pos.x;
- m_pos.y = pos.y;
- m_dim.x = iconDim.x;
- m_dim.y = iconDim.y;
- m_nbMenu = 0;
- m_nbToolTips = 0;
- m_selMenu = 0;
- m_state = 0;
- m_mouseState = 0;
- m_bMouseDown = FALSE;
- m_bRedraw = TRUE;
-
-/* Do we need this yet?
- // No. 👍
-///////////////////////////////////////////////////
- for ( i=0 ; iDrawPart(-1, CHBACK, m_pos, { m_pos.x, m_pos.y, m_pos.x + m_dim.x, m_pos.y + m_dim.y }, 1); // draw the background
- return;
- }
-
- if( m_bEnable ) // is button active ?
- {
- m_pPixmap->DrawIcon(-1, CHBUTTON+m_type, m_mouseState, m_pos);
- }
- else
- {
- m_pPixmap->DrawIcon(-1, CHBUTTON+m_type, 4, m_pos);
- }
-
- if ( m_nbMenu == 0 ) return;
-
- pos = m_pos;
- if ( m_nbMenu > 0 )
- {
- m_pPixmap->DrawIcon(-1, CHBUTTON+m_type,
- m_iconMenu[m_selMenu]+6, pos);
- }
-
- if ( m_nbMenu == 1 || !m_bEnable || !m_bMouseDown ) return;
-
- pos = m_pos;
- pos.x += m_dim.x+2;
- for ( i=0 ; iDrawIcon(-1, CHBUTTON+m_type, i==m_selMenu?1:0, pos);
- m_pPixmap->DrawIcon(-1, CHBUTTON+m_type, m_iconMenu[i]+6, pos);
- pos.x += m_dim.x-1;
- }
-}
-
-/*
-/Needed Yet?
-//////////////////////////////////////////////
-void CButton::Redraw()
-{
- m_bRedraw = TRUE;
-}
-//////////////////////////////////////////////
-*/
-
-int CButton::GetState()
-{
- return m_state;
-}
-
-void CButton::SetState(int state)
-{
- if ( m_state != state ||
- m_mouseState != state )
- {
- m_bRedraw = TRUE;
- }
-
- m_state = state;
- m_mouseState = state;
-}
-
-int CButton::GetMenu()
-{
- return m_selMenu;
-}
-
-void CButton::SetMenu(int menu)
-{
- if ( m_selMenu != menu )
- {
- m_bRedraw = TRUE;
- }
-
- m_selMenu = menu;
-}
-
-void CButton::SetEnable(BOOL bEnable)
-{
- if ( m_bEnable != bEnable )
- {
- m_bRedraw = TRUE;
- }
-
- m_bEnable = bEnable;
-}
-
-void CButton::SetSomething(BOOL bSomething)
-{
- if (m_bSomething != bSomething)
- {
- m_bRedraw = TRUE;
- }
-
- m_bSomething = bSomething;
-}
-
-
-BOOL CButton::GetHide()
-{
- return m_bHide;
-}
-
-
-void CButton::SetHide(BOOL bHide)
-{
- if ( m_bHide != bHide )
- {
- m_bRedraw = TRUE;
- }
-
- m_bHide = bHide;
-}
-
-
-// Event handling.
-
-BOOL CButton::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam)
-{
- POINT pos;
-
- if ( m_bHide || !m_bEnable ) return FALSE;
-
- pos = ConvLongToPos(lParam);
-
- switch( message )
- {
- case WM_LBUTTONDOWN:
- case WM_RBUTTONDOWN:
- if ( MouseDown(pos) ) return TRUE;
- break;
-
- case WM_MOUSEMOVE:
- if ( MouseMove(pos) ) return TRUE;
- break;
-
- case WM_LBUTTONUP:
- case WM_RBUTTONUP:
- if ( MouseUp(pos) ) return FALSE; // (*)
- break;
- }
-
- return FALSE;
-}
-
-// (*) All buttons must receive the BUTTONUP event!
-
-
-// Indicates whether the mouse is over this button.
-
-BOOL CButton::MouseOnButton(POINT pos)
-{
- return Detect(pos);
-}
-
-// Return the tooltips for a button, depending
-// on mouse position.
-
-int CButton::GetToolTips(POINT pos)
-{
- int width = m_dim.x;
- int rank;
-
- if ( m_bHide || !m_bEnable ) return -1;
-
- if ( m_nbMenu > 1 && m_bMouseDown ) // submenu is open?
- {
- width += 2+(m_dim.x-1)*m_nbMenu;
- }
-
- if ( pos.x < m_pos.x ||
- pos.x > m_pos.x+width ||
- pos.y < m_pos.y ||
- pos.y > m_pos.y+m_dim.y ) return -1;
-
- rank = (pos.x=-(m_pos.x+2+1))/(m_dim.x-1);
- if ( rank < 0 ) rank = 0;
- if ( rank > m_nbToolTips ) return -1;
-
- if ( m_nbMenu > 1 )
- {
- if ( m_bMouseDown && rank > 0 )
- {
- rank --;
- }
- else
- {
- rank = m_selMenu;
- }
- }
-
- return m_toolTips[rank];
-}
-
-
-// Detect whether the mouse is on a button.
-
-BOOL CButton::Detect(POINT pos)
-{
- int width = m_dim.x;
-
- if ( m_bHide || !m_bEnable ) return FALSE;
-
- if ( m_nbMenu > 1 && m_bMouseDown ) // sub-menu is open?
- {
- width += 2+(m_dim.x-1)*m_nbMenu;
- }
-
- if ( pos.x < m_pos.x ||
- pos.x > m_pos.x+width ||
- pos.y < m_pos.y ||
- pos.y > m_pos.y+m_dim.y ) return FALSE;
-
- return TRUE;
-}
-
-// Mouse button pressed.
-
-BOOL CButton::MouseDown(POINT pos)
-{
- if ( !Detect(pos) ) return FALSE;
-
- m_mouseState = 1;
- m_bMouseDown = TRUE;
- m_bRedraw = TRUE;
- PostMessage(m_hWnd, WM_UPDATE, 0, 0);
-
- return TRUE;
-}
-
-// Mouse moved.
-
-BOOL CButton::MouseMove(POINT pos)
-{
- BOOL bDetect;
- int iState, iMenu;
-
- iState = m_mouseState;
- iMenu = m_selMenu;
-
- bDetect = Detect(pos);
-
- if ( m_bMouseDown )
- {
- if ( bDetect ) m_mouseState = 1; // pressed
- else m_mouseState = m_state;
- }
- else
- {
- if ( bDetect ) m_mouseState = m_state+2; // hover
- else m_mouseState = m_state;
- }
-
- if ( m_nbMenu > 1 &&
- m_bMouseDown &&
- pos.x > m_pos.x+m_dim.x+2 ) // is on sub-menu?
- {
- m_selMenu = (pos.x-(m_pos.x+m_dim.x+2))/(m_dim.x-1);
- if ( m_selMenu >= m_nbMenu )
- {
- m_selMenu = m_nbMenu-1;
- }
- }
-
- if ( iState != m_mouseState ||
- iMenu != m_selMenu )
- {
- m_bRedraw = TRUE;
- PostMessage(m_hWnd, WM_UPDATE, 0, 0);
- }
-
- return m_bMouseDown;
-}
-
-// Mouse button released.
-
-BOOL CButton::MouseUp(POINT pos)
-{
- BOOL bDetect;
-
- bDetect = Detect(pos);
-
- m_mouseState = m_state;
- m_bMouseDown = FALSE;
- m_bRedraw = TRUE;
-
- if ( !bDetect ) return FALSE;
-
- if ( m_message != -1 )
- {
- PostMessage(m_hWnd, m_message, 0, 0);
- }
-
- return TRUE;
-}
\ No newline at end of file
diff --git a/ddutil.cpp b/ddutil.cpp
deleted file mode 100644
index 25a7d03..0000000
--- a/ddutil.cpp
+++ /dev/null
@@ -1,417 +0,0 @@
-/*==========================================================================
- *
- * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved.
- *
- * File: ddutil.cpp
- * Content: Routines for loading bitmap and palettes from resources
- *
- ***************************************************************************/
-#undef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#include
-#include
-#include
-#include
-#include
-#include "ddutil.h"
-#include "misc.h"
-
-
-
-
-// Le message :
-// First-chance exception in Blupi.exe (GDI32.DLL): 0xC0000005: Access Violation.
-// apparaît au endroits marqués par (@) ...
-
-BOOL g_bDebug = TRUE;
-
-void DDSetDebug(BOOL bDebug)
-{
- g_bDebug = bDebug;
-}
-
-/*
- * DDConnectBitmap
- *
- * create a DirectDrawSurface from a bitmap resource.
- *
- */
-extern IDirectDrawSurface * DDConnectBitmap(IDirectDraw *pdd, HBITMAP hbm)
-{
- BITMAP bm;
- DDSURFACEDESC ddsd;
- IDirectDrawSurface *pdds;
- HRESULT ddrval;
-
- //
- // get size of the bitmap
- //
- GetObject(hbm, sizeof(bm), &bm); // get size of bitmap
-
- //
- // create a DirectDrawSurface for this bitmap
- //
- ZeroMemory(&ddsd, sizeof(ddsd));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH;
-//? ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
- ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
- ddsd.dwWidth = bm.bmWidth;
- ddsd.dwHeight = bm.bmHeight;
-
- ddrval = pdd->CreateSurface(&ddsd, &pdds, NULL);
- if ( ddrval != DD_OK )
- {
- TraceErrorDD(ddrval, "", 0);
- return NULL;
- }
-
- DDCopyBitmap(pdds, hbm, 0, 0, bm.bmWidth, bm.bmHeight);
-
- return pdds;
-}
-
-/*
- * DDLoadBitmap
- *
- * create a DirectDrawSurface from a bitmap resource.
- *
- */
-extern IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap, int dx, int dy)
-{
- HBITMAP hbm;
- BITMAP bm;
- DDSURFACEDESC ddsd;
- IDirectDrawSurface *pdds;
- HRESULT ddrval;
-
- if ( g_bDebug ) OutputDebug("DDLoadBitmap\n");
- //
- // try to load the bitmap as a resource, if that fails, try it as a file
- //
- hbm = (HBITMAP)LoadImageA(GetModuleHandle(NULL), szBitmap, IMAGE_BITMAP, dx, dy, LR_CREATEDIBSECTION);
-
- if ( g_bDebug ) OutputDebug("DDLoadBitmap\n");
- if (hbm == NULL)
- {
- hbm = (HBITMAP)LoadImageA(NULL, szBitmap, IMAGE_BITMAP, dx, dy, LR_LOADFROMFILE|LR_CREATEDIBSECTION); // (@)
- }
-
- if ( hbm == NULL ) return NULL;
-
- //
- // get size of the bitmap
- //
- if ( g_bDebug ) OutputDebug("DDLoadBitmap: GetObject\n");
- GetObject(hbm, sizeof(bm), &bm); // get size of bitmap
-
- //
- // create a DirectDrawSurface for this bitmap
- //
- ZeroMemory(&ddsd, sizeof(ddsd));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH;
-//? ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
- ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
- ddsd.dwWidth = bm.bmWidth;
- ddsd.dwHeight = bm.bmHeight;
-
- if ( g_bDebug ) OutputDebug("DDLoadBitmap: CreateSurface\n");
- ddrval = pdd->CreateSurface(&ddsd, &pdds, NULL);
- if ( ddrval != DD_OK )
- {
- TraceErrorDD(ddrval, "", 0);
- return NULL;
- }
-
- DDCopyBitmap(pdds, hbm, 0, 0, 0, 0);
- if ( g_bDebug ) OutputDebug("DDLoadBitmap: DeleteObject\n");
- DeleteObject(hbm); // (@)
-
- if ( g_bDebug ) OutputDebug("DDLoadBitmap: return\n");
- return pdds;
-}
-
-/*
- * DDReLoadBitmap
- *
- * load a bitmap from a file or resource into a directdraw surface.
- * normaly used to re-load a surface after a restore.
- *
- */
-HRESULT DDReLoadBitmap(IDirectDrawSurface *pdds, LPCSTR szBitmap)
-{
- HBITMAP hbm;
- HRESULT hr;
-
- //
- // try to load the bitmap as a resource, if that fails, try it as a file
- //
- hbm = (HBITMAP)LoadImageA(GetModuleHandle(NULL), szBitmap, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
-
- if (hbm == NULL)
- hbm = (HBITMAP)LoadImageA(NULL, szBitmap, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION);
-
- if (hbm == NULL)
- {
- if ( g_bDebug ) OutputDebug("handle is null\n");
- return E_FAIL;
- }
-
- hr = DDCopyBitmap(pdds, hbm, 0, 0, 0, 0);
- if (hr != DD_OK)
- {
- if ( g_bDebug ) OutputDebug("ddcopybitmap failed\n");
- }
-
-
- DeleteObject(hbm);
- return hr;
-}
-
-/*
- * DDCopyBitmap
- *
- * draw a bitmap into a DirectDrawSurface
- *
- */
-extern HRESULT DDCopyBitmap(IDirectDrawSurface *pdds, HBITMAP hbm, int x, int y, int dx, int dy)
-{
- HDC hdcImage;
- HDC hdc;
- BITMAP bm;
- DDSURFACEDESC ddsd;
- HRESULT hr;
-
- if ( g_bDebug ) OutputDebug("DDCopyBitmap\n");
- if (hbm == NULL || pdds == NULL)
- return E_FAIL;
-
- //
- // make sure this surface is restored.
- //
- if ( g_bDebug ) OutputDebug("DDCopyBitmap: Restore\n");
- pdds->Restore();
-
- //
- // select bitmap into a memoryDC so we can use it.
- //
- if ( g_bDebug ) OutputDebug("DDCopyBitmap: CreateCompatibleDC\n");
- hdcImage = CreateCompatibleDC(NULL);
- if (!hdcImage)
- OutputDebug("createcompatible dc failed\n");
- if ( g_bDebug ) OutputDebug("DDCopyBitmap: SelectObject\n");
- SelectObject(hdcImage, hbm);
-
- //
- // get size of the bitmap
- //
- if ( g_bDebug ) OutputDebug("DDCopyBitmap: GetObject\n");
- GetObject(hbm, sizeof(bm), &bm); // get size of bitmap
- dx = dx == 0 ? bm.bmWidth : dx; // use the passed size, unless zero
- dy = dy == 0 ? bm.bmHeight : dy;
-
- //
- // get size of surface.
- //
- if ( g_bDebug ) OutputDebug("DDCopyBitmap: GetSurfaceDesc\n");
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH;
- pdds->GetSurfaceDesc(&ddsd);
-
- if ( g_bDebug ) OutputDebug("DDCopyBitmap: StretchBlt\n");
- if ((hr = pdds->GetDC(&hdc)) == DD_OK)
- {
- if ( g_bDebug ) OutputDebug("DDCopyBitmap: StretchBlt-go\n");
- StretchBlt(hdc, 0, 0, ddsd.dwWidth, ddsd.dwHeight, hdcImage, x, y, dx, dy, SRCCOPY);
- if ( g_bDebug ) OutputDebug("DDCopyBitmap: ReleaseDC\n");
- pdds->ReleaseDC(hdc); // (@)
- }
-
- if ( g_bDebug ) OutputDebug("DDCopyBitmap: DeleteDC\n");
- DeleteDC(hdcImage);
-
- return hr;
-}
-
-//
-// DDLoadPalette
-//
-// Create a DirectDraw palette object from a bitmap resoure
-//
-// if the resource does not exist or NULL is passed create a
-// default 332 palette.
-//
-extern IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap)
-{
- IDirectDrawPalette* ddpal;
- int i;
- int n;
- int fh;
- HRSRC h;
- LPBITMAPINFOHEADER lpbi;
- PALETTEENTRY ape[256];
- RGBQUAD * prgb;
-
- //
- // build a 332 palette as the default.
- //
- for (i=0; i<256; i++)
- {
- ape[i].peRed = (BYTE)(((i >> 5) & 0x07) * 255 / 7);
- ape[i].peGreen = (BYTE)(((i >> 2) & 0x07) * 255 / 7);
- ape[i].peBlue = (BYTE)(((i >> 0) & 0x03) * 255 / 3);
- ape[i].peFlags = (BYTE)0;
- }
-
- //
- // get a pointer to the bitmap resource.
- //
- if (szBitmap && (h = FindResourceA(NULL, szBitmap, (LPCSTR)RT_BITMAP)))
- {
- if ( g_bDebug ) OutputDebug("DDLoadPalette -a\n");
- lpbi = (LPBITMAPINFOHEADER)LockResource(LoadResource(NULL, h));
- if (!lpbi)
- OutputDebug("lock resource failed\n");
- prgb = (RGBQUAD*)((BYTE*)lpbi + lpbi->biSize);
-
- if (lpbi == NULL || lpbi->biSize < sizeof(BITMAPINFOHEADER))
- n = 0;
- else if (lpbi->biBitCount > 8)
- n = 0;
- else if (lpbi->biClrUsed == 0)
- n = 1 << lpbi->biBitCount;
- else
- n = lpbi->biClrUsed;
-
- //
- // a DIB color table has its colors stored BGR not RGB
- // so flip them around.
- //
- for(i=0; i 8)
- n = 0;
- else if (bi.biClrUsed == 0)
- n = 1 << bi.biBitCount;
- else
- n = bi.biClrUsed;
-
- //
- // a DIB color table has its colors stored BGR not RGB
- // so flip them around.
- //
- //?
- char s[50];
- sprintf(s, "DDLoadPalette n=%d\n", n);
- if ( g_bDebug ) OutputDebug(s);
- //?
- for(i=0; iCreatePalette(DDPCAPS_8BIT, ape, &ddpal, NULL);
-
- return ddpal;
-}
-
-/*
- * DDColorMatch
- *
- * convert a RGB color to a pysical color.
- *
- * we do this by leting GDI SetPixel() do the color matching
- * then we lock the memory and see what it got mapped to.
- */
-extern DWORD DDColorMatch(IDirectDrawSurface *pdds, COLORREF rgb)
-{
- COLORREF rgbT;
- HDC hdc;
- DWORD dw = CLR_INVALID;
- DDSURFACEDESC ddsd;
- HRESULT hres;
-
- //
- // use GDI SetPixel to color match for us
- //
- if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK)
- {
- rgbT = GetPixel(hdc, 0, 0); // save current pixel value
- SetPixel(hdc, 0, 0, rgb); // set our value
- pdds->ReleaseDC(hdc);
- }
-
- //
- // now lock the surface so we can read back the converted color
- //
- ddsd.dwSize = sizeof(ddsd);
- while ((hres = pdds->Lock(NULL, &ddsd, 0, NULL)) == DDERR_WASSTILLDRAWING)
- ;
-
- if (hres == DD_OK)
- {
- dw = *(DWORD *)ddsd.lpSurface; // get DWORD
- dw &= (1 << ddsd.ddpfPixelFormat.dwRGBBitCount)-1; // mask it to bpp
- pdds->Unlock(NULL);
- }
-
- //
- // now put the color that was there back.
- //
- if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK)
- {
- SetPixel(hdc, 0, 0, rgbT);
- pdds->ReleaseDC(hdc);
- }
-
- return dw;
-}
-
-/*
- * DDSetColorKey
- *
- * set a color key for a surface, given a RGB.
- * if you pass CLR_INVALID as the color key, the pixel
- * in the upper-left corner will be used.
- */
-extern HRESULT DDSetColorKey(IDirectDrawSurface *pdds, COLORREF rgb)
-{
- DDCOLORKEY ddck;
-
- ddck.dwColorSpaceLowValue = DDColorMatch(pdds, rgb);
- ddck.dwColorSpaceHighValue = ddck.dwColorSpaceLowValue;
- return pdds->SetColorKey(DDCKEY_SRCBLT, &ddck);
-}
-
-extern HRESULT DDSetColorKey2(IDirectDrawSurface *pdds, COLORREF rgb1,
- COLORREF rgb2)
-{
- DDCOLORKEY ddck;
-
- ddck.dwColorSpaceLowValue = DDColorMatch(pdds, rgb1);
- ddck.dwColorSpaceHighValue = DDColorMatch(pdds, rgb2);
- return pdds->SetColorKey(DDCKEY_SRCBLT, &ddck);
-}
diff --git a/dectables.h b/dectables.h
deleted file mode 100644
index a301c49..0000000
--- a/dectables.h
+++ /dev/null
@@ -1,2225 +0,0 @@
-#pragma once
-#include "obstacle.h"
-
-extern int table_blitz[]
-{
- 0, 7, 15, 18, 26, 27, 32, 39, 45, 47,
- 50, 58, 60, 62, 64, 66, 68, 70, 71, 72,
- -1
-};
-
-extern int table_magicloop[]
-{
- 152, 153, 154, 155, 156
-};
-
-extern int table_magictrack[]
-{
- 152, 153, 154, 155, 156, 152, 153, 154, 155, 156,
- 157, 158, 159, 160, 157, 158, 159, 160, 161, 162,
- 163, 164, 165, 166
-};
-
-extern int table_shield[]
-{
- 144, 145, 146, 147, 148, 149, 150, 151, 266, 267,
- 268, 269, 270, 271, 272, 273
-};
-
-extern int table_shield_blupi[]
-{
- 144, 145, 146, 147, 148, 149, 150, 151, 266, 267,
- 268, 269, 270, 271, 272, 273
-};
-
-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,
- 279, 280, 281, 282, 283, 284, 285, 286, 287, 288
-};
-
-extern int table_vitesse_march[]
-{
- 2, 4, 6, 8
-};
-
-extern int table_vitesse_nage[]
-{
- 2, 1, 5, 10, 8, 6, 4
-};
-
-extern int table_vitesse_surf[]
-{
- 0, 2, 5, 8, 3, 0
-};
-
-extern int table_bulldozer_left[8]{ 66, 66, 67, 67, 66, 66, 65, 65 };
-
-extern int table_bulldozer_right[8]{ 58, 58, 57, 57, 58, 58, 59, 59 };
-
-extern int table_bulldozer_turn2l[22]
-{
- 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[22]
-{
- 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[8]{ 82, 82, 81, 81, 82, 82, 83, 83 };
-
-extern int table_poisson_right[8]{ 79, 79, 78, 78, 79, 79, 80, 80 };
-
-extern int table_poisson_turn2l[48]
-{
- 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[48]
-{
- 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[8]{ 98, 99, 100, 101, 102, 103, 104, 105 };
-
-extern int table_oiseau_right[8]{ 90, 91, 92, 93, 94, 95, 96, 97 };
-
-extern int table_oiseau_turn2l[10]{ 106, 107, 108, 109, 110, 111, 112, 113, 105, 105 };
-
-extern int table_oiseau_turn2r[10]{ 114, 115, 116, 117, 118, 119, 120, 121, 97, 97 };
-
-extern int table_guepe_left[6]{ 195, 196, 197, 198, 197, 196 };
-
-extern int table_guepe_right[6]{ 199, 200, 201, 202, 201, 200 };
-
-extern int table_guepe_turn2l[5]{ 207, 206, 205, 204, 203 };
-
-extern int table_guepe_turn2r[5]{ 203, 204, 205, 206, 207 };
-
-extern int table_creature_left[8]{ 247, 248, 249, 250, 251, 250, 249, 248 };
-
-extern int table_creature_right[8]{ 247, 248, 249, 250, 251, 250, 249, 248 };
-
-extern int table_creature_turn2[152]
-{
- 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[8]{ 66, 67, 68, 67, 66, 69, 70, 69 };
-
-extern int table_blupih_right[8]{ 61, 62, 63, 62, 61, 64, 65, 64 };
-
-extern int table_blupih_turn2l[26]
-{
- 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[26]
-{
- 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[8]{ 249, 249, 250, 250, 249, 249, 248, 248 };
-
-extern int table_blupit_right[8]{ 238, 238, 237, 237, 238, 238, 239, 239 };
-
-extern int table_blupit_turn2l[24]
-{
- 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[24]
-{
- 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_explo1[39]
-{
- 0, 0, 1, 1, 2, 2, 3, 3, 4, 3,
- 4, 4, 3, 4, 3, 3, 4, 4, 5, 5,
- 4, 5, 6, 5, 6, 6, 5, 5, 6, 7,
- 7, 8, 8, 9, 9, 10, 10, 11, 11
-};
-
-extern int table_explo2[20]
-{
- 12, -1, 13, 14, -1, 15, 13, -1, 14, 15,
- 12, -1, 13, 15, 14, 14, -1, 14, 15, 13
-};
-
-extern int table_explo3[20]
-{
- 32, 32, 34, 34, 32, 32, 34, 34, 32, 32,
- 34, 34, 32, 32, 35, 35, 32, 32, 35, 35
-};
-
-extern int table_explo4[9]{ 12, 13, 14, 15, 7, 8, 9, 10, 11 };
-
-extern int table_explo5[12]
-{
- 54, -1, 55, -1, 56, -1, 57, -1, 58, -1,
- 59, -1
-};
-
-extern int table_explo6[6]{ 54, 55, 56, 57, 58, 59 };
-
-extern int table_explo7[128]
-{
- 60, 61, -1, 63, 64, 65, 62, 64, 62, 60,
- 62, -1, 65, -1, 60, 65, 63, 61, 62, -1,
- 64, 65, -1, 62, 64, 61, 62, 63, -1, 65,
- 60, -1, 65, -1, 63, 65, -1, 61, 60, 65,
- 62, 63, 64, -1, 62, 63, -1, 62, 62, 60,
- 62, -1, 65, -1, 60, 65, 64, 61, 62, 63,
- -1, 65, 60, -1, 63, 61, 62, -1, 64, 65,
- -1, 62, 62, 60, 62, -1, 65, -1, 60, 65,
- 60, 61, -1, 63, 64, 65, 62, 64, 63, 61,
- 62, -1, 64, 65, -1, 62, 60, 61, -1, 63,
- 64, 65, 62, 64, -1, 60, -1, -1, 65, -1,
- 60, -1, 63, -1, 62, -1, -1, 65, -1, -1,
- -1, 61, -1, -1, -1, 60, -1, -1
-};
-
-extern int table_explo8[5]{ 7, 8, 9, 10, 11 };
-
-extern int table_sploutch1[10]{ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 };
-
-extern int table_sploutch2[13]
-{
- -1, -1, -1, 90, 91, 92, 93, 94, 95, 96,
- 97, 98, 99
-};
-
-extern int table_sploutch3[18]
-{
- -1, -1, -1, -1, -1, -1, -1, -1, 90, 91,
- 92, 93, 94, 95, 96, 97, 98, 99
-};
-
-extern int table_tentacule[45]
-{
- 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_bridge[157]
-{
- 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_pollution[8]{ 179, 180, 181, 182, 183, 184, 185, 186 };
-
-extern int table_invertstart[8]{ 179, 180, 181, 182, 183, 184, 185, 186 };
-
-extern int table_invertstop[8]{ 186, 185, 184, 183, 182, 181, 180, 179 };
-
-extern int table_invertpanel[8]{ 187, 188, 189, 190, 191, 192, 193, 194 };
-
-extern int table_plouf[7]{ 99, 100, 101, 102, 101, 100, 99 };
-
-extern int table_tiplouf[3]{ 244, 99, 244 };
-
-extern int table_blup[20]
-{
- 103, 104, 105, 106, 104, 103, 106, 105, 103, 104,
- 103, 105, 106, 103, 105, 106, 103, 104, 106, 105
-};
-
-extern int table_follow1[26]
-{
- 256, 256, 256, 257, 257, 258, 259, 260, 261, 262,
- 263, 264, 264, 265, 265, 265, 264, 264, 263, 262,
- 261, 260, 259, 258, 257, 257
-};
-
-extern int table_follow2[5]{ 256, 258, 260, 262, 264 };
-
-extern int table_cle[12]
-{
- 122, 123, 124, 125, 126, 127, 128, 127, 126, 125,
- 124, 123
-};
-
-extern int table_cle1[12]
-{
- 209, 210, 211, 212, 213, 214, 215, 214, 213, 212,
- 211, 210
-};
-
-extern int table_cle2[12]
-{
- 220, 221, 222, 221, 220, 219, 218, 217, 216, 217,
- 218, 219
-};
-
-extern int table_decor_action[]
-{
- 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]
-{
- 253, 252, 254, 252, 252, 255, 252, 254, 253, 252,
- 253, 254, 255, 252, 255, 253, 252, 254, 252, 255,
- 253, 254, 252, 253, 255, 254, 255, 252, 253, 254,
- 255, 252, 253, 254, 255, 254, 254, 253, 254, 255,
- 253, 252, 255, 254, 255, 253, 252, 254, 253, 255,
- 253, 254, 252, 253, 255, 254, 252, 255, 253, 254,
- 255, 253, 252, 254, 255, 254, 252, 253, 254, 255,
- 253, 254, 255, 254, 255, 253, 252, 254, 253, 255,
- 253, 254, 255, 253, 255, 254, 255, 252, 253, 254,
- 255, 253, 253, 254, 255, 254, 252, 253, 254, 255
-};
-
-extern int table_skate[34]
-{
- 129, 129, 129, 129, 130, 130, 130, 131, 131, 132,
- 132, 133, 133, 134, 134, 134, 135, 135, 135, 135,
- 134, 134, 134, 133, 133, 132, 132, 131, 131, 131,
- 130, 130, 130, 130
-};
-
-extern int table_glu[25]
-{
- 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[70]
-{
- 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[90]
-{
- 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
-};
-
-extern int table_chenille[6]{ 311, 312, 313, 314, 315, 316 };
-
-extern int table_chenillei[6]{ 316, 315, 314, 313, 312, 311 };
-
-extern int table_adapt_decor[144]
-{
- 153, 147, 148, 146, 40, 151, 150, 144, 39, 152,
- 149, 145, 38, 36, 37, 35, 153, 147, 148, 146,
- 40, 151, 150, 144, 39, 152, 149, 145, 38, 36,
- 37, 156, 75, 75, 155, 155, 75, 75, 155, 155,
- 74, 74, 154, 154, 75, 75, 155, 155, 157, 157,
- 157, 157, 109, 109, 109, 109, 108, 108, 108, 108,
- 107, 107, 107, 107, 202, 202, 138, 138, 202, 202,
- 138, 138, 202, 202, 138, 138, 202, 202, 138, 138,
- 283, 283, 283, 283, 262, 262, 262, 262, 263, 263,
- 263, 263, 261, 261, 261, 261, 361, 359, 360, 352,
- 357, 353, 355, 349, 358, 354, 356, 350, 351, 347,
- 348, 341, 387, 387, 386, 386, 394, 394, 392, 392,
- 395, 395, 393, 393, 397, 397, 396, 396, 251, 254,
- 254, 254, 251, 258, 260, 258, 251, 257, 259, 257,
- 251, 250, 256, 250
-};
-
-extern int table_adapt_fromage[32]
-{
- -1, 265, 264, 268, 267, 273, 271, 275, 266, 272,
- 270, 274, 269, 277, 276, 278, -1, 286, 285, 289,
- 288, 294, 292, 296, 287, 293, 291, 295, 290, 298,
- 297, 299
-};
-
-extern int table_shield[]
-{
- 16,
- 144, 145, 146, 147, 148, 149, 150, 151, 266, 267,
- 268, 269, 270, 271, 272, 273
-};
-
-extern int table_shield_blupi[]
-{
- 16,
- 144, 145, 146, 147, 148, 149, 150, 151, 266, 267,
- 268, 269, 270, 271, 272, 273
-};
-
-extern int table_power[]{ 8, 136, 137, 138, 139, 140, 141, 142, 143 };
-
-extern int table_invert[]
-{
- 20,
- 187, 187, 187, 188, 189, 190, 191, 192, 193, 194,
- 187, 187, 187, 194, 193, 192, 191, 190, 189, 188
-};
-
-extern int table_charge[]{ 6, 238, 239, 240, 241, 242, 243 };
-
-extern int table_magicloop[]{ 5, 152, 153, 154, 155, 156 };
-
-extern int table_magictrack[]
-{
- 24,
- 152, 153, 154, 155, 156, 152, 153, 154, 155, 156,
- 157, 158, 159, 160, 157, 158, 159, 160, 161, 162,
- 163, 164, 165, 166
-};
-
-extern int table_shieldloop[]{ 5, 274, 275, 276, 277, 278 };
-
-extern int table_shieldtrack[]
-{
- 20,
- 274, 275, 276, 277, 278, 274, 275, 276, 277, 278,
- 279, 280, 281, 282, 283, 284, 285, 286, 287, 288
-};
-
-extern int table_drinkeffect[]{ 5, 274, 275, 276, 277, 278 };
-
-extern int table_drinkoffset[]{ 3, 0, 7, 22 };
-
-extern int table_tresortrack[]
-{
- 11,
- 166, 165, 164, 163, 162, 161, 162, 163, 164, 165,
- 166
-};
-
-extern int table_decor_lave[]{ 8, 68, 69, 70, 71, 72, 71, 70, 69 };
-
-extern int table_decor_piege1[]
-{
- 16,
- 374, 374, 373, 347, 373, 374, 374, 374, 373, 347,
- 347, 373, 374, 374, 374, 374
-};
-
-extern int table_decor_piege2[]{ 4, 374, 373, 347, 373 };
-
-extern int table_decor_goutte[]
-{
- 48,
- 410, 409, 410, -1, -1, -1, -1, -1, -1, 410,
- 409, 408, 409, 410, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 410, 409, 408, 407, 406, 405,
- 404, 405, 406, 407, 408, 409, 410, -1, -1, -1,
- -1, 410, 409, 410, -1, -1, -1, -1
-};
-
-extern int table_decor_ecraseur[]{ 10, 317, 317, 318, 319, 320, 321, 322, 323, 323, 323 };
-
-extern int table_decor_scie[]{ 6, 378, 379, 380, 381, 382, 383 };
-
-extern int table_decor_temp[]
-{
- 20,
- 328, 328, 327, 327, 326, 326, 325, 325, 324, 324,
- 325, 325, 326, 326, 327, 329, 328, 328, -1, -1
-};
-
-extern int table_decor_eau1[]{ 6, 92, 93, 94, 95, 94, 93 };
-
-extern int table_decor_eau2[]{ 6, 91, 96, 97, 98, 97, 96 };
-
-extern int table_decor_ventillog[]{ 3, 126, 127, 128 };
-
-extern int table_decor_ventillod[]{ 3, 129, 130, 131 };
-
-extern int table_decor_ventilloh[]{ 3, 132, 133, 134 };
-
-extern int table_decor_ventillob[]{ 3, 135, 136, 137 };
-
-extern int table_decor_ventg[]{ 4, 110, 111, 112, 113 };
-
-extern int table_decor_ventd[]{ 4, 114, 115, 116, 117 };
-
-extern int table_decor_venth[]{ 4, 118, 119, 120, 121 };
-
-extern int table_decor_ventb[]{ 4, 122, 123, 124, 125 };
-
-extern int table_marine[]
-{
- 0,
- 2,
- 5,
- 8,
- 3,
- 0
-};
-
-extern int table_sploutch2[]
-{
- -1,
- -1,
- -1,
- 90,
- 91,
- 92,
- 93,
- 94,
- 95,
- 96,
- 97,
- 98,
- 99
-};
-
-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_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_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_pollution[]
-{
- 179,
- 180,
- 181,
- 182,
- 183,
- 184,
- 185,
- 186
-};
-
-extern int table_invertstart[]
-{
- 179,
- 180,
- 181,
- 182,
- 183,
- 184,
- 185,
- 186
-};
-
-extern int table_invertstop[]
-{
- 186,
- 185,
- 184,
- 183,
- 182,
- 181,
- 180,
- 179
-};
-
-extern int table_plouf[]
-{
- 99,
- 100,
- 101,
- 102,
- 101,
- 100,
- 99
-};
-
-extern int table_tiplouf[]
-{
- 244,
- 99,
- 244
-};
-
-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_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.cpp b/event.cpp
deleted file mode 100644
index dbf64e7..0000000
--- a/event.cpp
+++ /dev/null
@@ -1,3233 +0,0 @@
-// Event.cpp
-//
-
-#include
-#include
-#include
-#include
-#include "def.h"
-#include "resource.h"
-#include "pixmap.h"
-#include "sound.h"
-#include "decor.h"
-#include "movie.h"
-#include "button.h"
-#include "menu.h"
-#include "jauge.h"
-#include "event.h"
-#include "text.h"
-#include "misc.h"
-#include "network.h"
-
-
-#define DEF_TIME_HELP 10000
-#define DEF_TIME_DEMO 1000
-#define MAXDEMO 2000
-
-
-typedef struct
-{
- short majRev;
- short minRev;
- short reserve1[9];
- short exercice; // exercice en cours (0..n)
- short mission; // mission en cours (0..n)
- short multi;
- short lives;
- short bHiliInfoButton;
- short pPlayerName;
- short speed;
- short bMovie;
- short maxMission; // derni�re mission effectu�e (0..n)
- short scrollSpeed;
- short audioVolume;
- short midiVolume;
- short bAccessBuild;
- short prive;
- short skill;
- short reserve2[93];
-}
-DescInfo;
-
-
-
-
-
-// Toutes les premi�res lettres doivent
-// �tre diff�rentes !
-
-static char cheat_code[25][60] =
-{
- "XMISSION", // 0 (xnjttjpo)
- "OPENDOORS", // 1
- "CLEANALL", // 2
- "MEGABLUPI", // 3
- "LAYEGG", // 4
- "KILLEGG", // 5
- "FUNSKATE", // 6
- "GIVECOPTER", // 7
- "JEEPDRIVE", // 8
- "ALLTREASURE",
- "ENDGOAL",
- "SHOWSECRET",
- "ROUNDSHIELD",
- "QUICKLOLLIPOP",
- "TENBOMBS",
- "BIRDLIME",
- "DRIVETANK",
- "POWERCHARGE",
- "HIDEDRINK",
- "NETPACKED",
- "ZNETDEBUG",
- "YNOSMOOTH",
- "IOVERCRAFT",
- "UDYNAMITE",
- "WELLKEYS",
-};
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-
-static Phase table[] =
-{
- {
- WM_PHASE_TESTCD,
- "image16\\init.blp",
- FALSE,
- {
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_INIT,
- "image16\\init.blp",
- FALSE,
- {
- {
- WM_PHASE_DEMO,
- 0, {1,108},
- 16, 424-60-42*3-18,
- {1,TX_BUTTON_DEMO},
- },
- {
- WM_PHASE_SCHOOL,
- 0, {1,79},
- 16, 424-60-42*2,
- {1,TX_BUTTON_APPRENDRE},
- },
- {
- WM_PHASE_BYE,
-//? WM_CLOSE,
- 0, {1,36},
- 16, 424,
- {1,TX_BUTTON_QUITTER},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_HISTORY0,
- "image\\history0.blp",
- TRUE,
- {
- {
- WM_PHASE_INIT,
- 0, {1,50},
- 42+42*0, 433,
- {1,TX_BUTTON_PREVH},
- },
- {
- WM_PHASE_H1MOVIE,
- 0, {1,51},
- 558-42*0, 433,
- {1,TX_BUTTON_NEXTH},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_HISTORY1,
- "image\\history1.blp",
- TRUE,
- {
- {
- WM_PHASE_HISTORY0,
- 0, {1,50},
- 42+42*0, 433,
- {1,TX_BUTTON_PREVH},
- },
- {
- WM_PHASE_H2MOVIE,
- 0, {1,51},
- 558-42*0, 433,
- {1,TX_BUTTON_NEXTH},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_INFO,
- "image16\\info%.3d.blp",
- FALSE,
- {
- {
- WM_PREV,
- 0, {1,50},
- 558-42*2, 433,
- {1,TX_BUTTON_PREVP},
- },
- {
- WM_PHASE_PLAYMOVIE,
- 0, {1,48},
- 558-42*1, 433,
- {1,TX_BUTTON_PLAYP},
- },
- {
- WM_NEXT,
- 0, {1,51},
- 558-42*0, 433,
- {1,TX_BUTTON_NEXTP},
- },
- {
- WM_PHASE_READ,
- 0, {1,52},
- 42+42*4, 433,
- {1,TX_BUTTON_READP},
- },
- {
- WM_PHASE_SETUP,
- 0, {1,47},
- 42+42*7, 433,
- {1,TX_BUTTON_SETUP},
- },
-#if !_DEMO
- {
- WM_PHASE_BUILD,
- 0, {1,49},
- 42+42*8, 433,
- {1,TX_BUTTON_BUILDP},
- },
- {
- WM_PHASE_SKILL1,
- 0, {1,94},
- 150, 230,
- {1,TX_BUTTON_SKILL},
- },
- {
- WM_PHASE_SKILL2,
- 0, {1,95},
- 150, 230+42,
- {1,TX_BUTTON_SKILL},
- },
-#endif
- {
- WM_PHASE_INIT,
- 0, {1,40},
- 42+42*0, 433,
- {1,TX_BUTTON_TERM},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_PLAY,
- "image\\play.blp",
- FALSE,
- {
- {
- WM_PHASE_STOP,
- 0, {1,40},
- 10+42*0, 422,
- 0,
- },
- {
- WM_PHASE_SETUPp,
- 0, {1,47},
- 10+42*1, 422,
- 0,
- },
- {
- WM_PHASE_WRITEp,
- 0, {1,53},
- 10+42*2, 422,
- 0,
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_STOP,
- "image16\\stop%.3d.blp",
- FALSE,
- {
- {
- WM_PHASE_PLAY,
- 0, {1,77},
- 558-42*1, 433,
- {1,TX_BUTTON_CONTP},
- },
- {
- WM_PHASE_READ,
- 0, {1,52},
- 42+42*4, 433,
- {1,TX_BUTTON_READP},
- },
- {
- WM_PHASE_WRITE,
- 0, {1,53},
- 42+42*5, 433,
- {1,TX_BUTTON_WRITEP},
- },
- {
- WM_PHASE_SETUP,
- 0, {1,47},
- 42+42*7, 433,
- {1,TX_BUTTON_SETUP},
- },
- {
- WM_PHASE_INFO,
- 0, {1,78},
- 42+42*0, 433,
- {1,TX_BUTTON_CANCELP},
- },
-#if !_DEMO
- {
- WM_PHASE_HELP,
- 0, {1,86},
- 42+42*9, 433,
- {1,TX_BUTTON_HELP},
- },
-#endif
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_HELP,
- "image16\\help.blp",
- TRUE,
- {
- {
- WM_PHASE_PLAY,
- 0, {1,77},
- 558-42*1, 433,
- {1,TX_BUTTON_CONTP},
- },
- {
- WM_PHASE_READ,
- 0, {1,52},
- 42+42*4, 433,
- {1,TX_BUTTON_READP},
- },
- {
- WM_PHASE_WRITE,
- 0, {1,53},
- 42+42*5, 433,
- {1,TX_BUTTON_WRITEP},
- },
- {
- WM_PHASE_SETUP,
- 0, {1,47},
- 42+42*7, 433,
- {1,TX_BUTTON_SETUP},
- },
- {
- WM_PHASE_STOP,
- 0, {1,50},
- 42+42*0, 433,
- {1,TX_BUTTON_PREVH},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_SETUP,
- "image16\\setup.blp",
- FALSE,
- {
- {
- WM_BUTTON1,
- 0, {1,50},
- 54, 330,
- {1,TX_BUTTON_SETUP1},
- },
- {
- WM_BUTTON2,
- 0, {1,51},
- 54+40, 330,
- {1,TX_BUTTON_SETUP2},
- },
- {
- WM_BUTTON3,
- 0, {1,50},
- 284, 330,
- {1,TX_BUTTON_SETUP3},
- },
- {
- WM_BUTTON4,
- 0, {1,51},
- 284+40, 330,
- {1,TX_BUTTON_SETUP4},
- },
- {
- WM_BUTTON5,
- 0, {1,50},
- 399, 330,
- {1,TX_BUTTON_SETUP5},
- },
- {
- WM_BUTTON6,
- 0, {1,51},
- 399+40, 330,
- {1,TX_BUTTON_SETUP6},
- },
-#if !_EGAMES
- {
- WM_BUTTON7,
- 0, {1,50},
- 514, 330,
- {1,TX_BUTTON_SETUP7},
- },
- {
- WM_BUTTON8,
- 0, {1,51},
- 514+40, 330,
- {1,TX_BUTTON_SETUP8},
- },
-#endif
- {
- WM_BUTTON9,
- 0, {1,50},
- 169, 330,
- {1,TX_BUTTON_SETUP9},
- },
- {
- WM_BUTTON10,
- 0, {1,51},
- 169+40, 330,
- {1,TX_BUTTON_SETUP10},
- },
- {
- WM_PHASE_STOP,
- 0, {1,40},
- 11, 424,
- {1,TX_BUTTON_TERM},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_SETUPp,
- "image16\\setup.blp",
- FALSE,
- {
- {
- WM_BUTTON1,
- 0, {1,50},
- 54, 330,
- {1,TX_BUTTON_SETUP1},
- },
- {
- WM_BUTTON2,
- 0, {1,51},
- 54+40, 330,
- {1,TX_BUTTON_SETUP2},
- },
- {
- WM_BUTTON3,
- 0, {1,50},
- 284, 330,
- {1,TX_BUTTON_SETUP3},
- },
- {
- WM_BUTTON4,
- 0, {1,51},
- 284+40, 330,
- {1,TX_BUTTON_SETUP4},
- },
- {
- WM_BUTTON5,
- 0, {1,50},
- 399, 330,
- {1,TX_BUTTON_SETUP5},
- },
- {
- WM_BUTTON6,
- 0, {1,51},
- 399+40, 330,
- {1,TX_BUTTON_SETUP6},
- },
-#if !_EGAMES
- {
- WM_BUTTON7,
- 0, {1,50},
- 514, 330,
- {1,TX_BUTTON_SETUP7},
- },
- {
- WM_BUTTON8,
- 0, {1,51},
- 514+40, 330,
- {1,TX_BUTTON_SETUP8},
- },
-#endif
- {
- WM_BUTTON9,
- 0, {1,50},
- 169, 330,
- {1,TX_BUTTON_SETUP9},
- },
- {
- WM_BUTTON10,
- 0, {1,51},
- 169+40, 330,
- {1,TX_BUTTON_SETUP10},
- },
- {
- WM_PHASE_PLAY,
- 0, {1,77},
- 11, 424,
- {1,TX_BUTTON_CONTP},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_READ,
- "image16\\read.blp",
- FALSE,
- {
- {
- WM_READ0,
- 0, {0},
- 420, 30+42*0,
- 0,
- },
- {
- WM_READ1,
- 0, {0},
- 420, 30+42*1,
- 0,
- },
- {
- WM_READ2,
- 0, {0},
- 420, 30+42*2,
- 0,
- },
- {
- WM_READ3,
- 0, {0},
- 420, 30+42*3,
- 0,
- },
- {
- WM_READ4,
- 0, {0},
- 420, 30+42*4,
- 0,
- },
- {
- WM_READ5,
- 0, {0},
- 420, 30+42*5,
- 0,
- },
- {
- WM_READ6,
- 0, {0},
- 420, 30+42*6,
- 0,
- },
- {
- WM_READ7,
- 0, {0},
- 420, 30+42*7,
- 0,
- },
- {
- WM_READ8,
- 0, {0},
- 420, 30+42*8,
- 0,
- },
- {
- WM_READ9,
- 0, {0},
- 420, 30+42*9,
- 0,
- },
- {
- WM_PHASE_STOP,
- 0, {1,40},
- 16, 424,
- {1,TX_BUTTON_TERM},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_WRITE,
- "image16\\write.blp",
- FALSE,
- {
- {
- WM_WRITE0,
- 0, {0},
- 420, 30+42*0,
- 0,
- },
- {
- WM_WRITE1,
- 0, {0},
- 420, 30+42*1,
- 0,
- },
- {
- WM_WRITE2,
- 0, {0},
- 420, 30+42*2,
- 0,
- },
- {
- WM_WRITE3,
- 0, {0},
- 420, 30+42*3,
- 0,
- },
- {
- WM_WRITE4,
- 0, {0},
- 420, 30+42*4,
- 0,
- },
- {
- WM_WRITE5,
- 0, {0},
- 420, 30+42*5,
- 0,
- },
- {
- WM_WRITE6,
- 0, {0},
- 420, 30+42*6,
- 0,
- },
- {
- WM_WRITE7,
- 0, {0},
- 420, 30+42*7,
- 0,
- },
- {
- WM_WRITE8,
- 0, {0},
- 420, 30+42*8,
- 0,
- },
- {
- WM_WRITE9,
- 0, {0},
- 420, 30+42*9,
- 0,
- },
- {
- WM_PHASE_STOP,
- 0, {1,40},
- 16, 424,
- {1,TX_BUTTON_TERM},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_WRITEp,
- "image16\\write.blp",
- FALSE,
- {
- {
- WM_WRITE0,
- 0, {0},
- 420, 30+42*0,
- 0,
- },
- {
- WM_WRITE1,
- 0, {0},
- 420, 30+42*1,
- 0,
- },
- {
- WM_WRITE2,
- 0, {0},
- 420, 30+42*2,
- 0,
- },
- {
- WM_WRITE3,
- 0, {0},
- 420, 30+42*3,
- 0,
- },
- {
- WM_WRITE4,
- 0, {0},
- 420, 30+42*4,
- 0,
- },
- {
- WM_WRITE5,
- 0, {0},
- 420, 30+42*5,
- 0,
- },
- {
- WM_WRITE6,
- 0, {0},
- 420, 30+42*6,
- 0,
- },
- {
- WM_WRITE7,
- 0, {0},
- 420, 30+42*7,
- 0,
- },
- {
- WM_WRITE8,
- 0, {0},
- 420, 30+42*8,
- 0,
- },
- {
- WM_WRITE9,
- 0, {0},
- 420, 30+42*9,
- 0,
- },
- {
- WM_PHASE_PLAY,
- 0, {1,77},
- 16, 424,
- {1,TX_BUTTON_CONTP},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_LOST,
- "image16\\lost.blp",
- TRUE,
- {
- {
- WM_PHASE_INFO,
- 0, {1,50},
- 9, 431,
- {1,TX_BUTTON_REPEAT},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_WIN,
- "image16\\win.blp",
- TRUE,
- {
- {
- WM_NEXT,
- 0, {1,51},
- 9, 431,
- {1,TX_BUTTON_NEXTP},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_LASTWIN,
- "image\\last%.3d.blp",
- TRUE,
- {
- {
- WM_PHASE_INIT,
- 0, {1,51},
- 9, 431,
- {1,TX_BUTTON_NEXTP},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_BUILD,
- "image\\build.blp",
- TRUE,
- {
- {
- WM_DECOR1, // pose des sols
- 0, {6, 0,1,2,3,4,25},
- 11+42*2, 190+42*0,
- {6,TX_OBJ_HERBE,TX_OBJ_MOUSSE,TX_OBJ_TERRE,
- TX_OBJ_EAU,TX_OBJ_DALLESPEC,TX_OBJ_COUVTELE},
- },
- {
- WM_DECOR2, // pose des plantes
- 0, {4, 6,7,8,11},
- 11+42*2, 190+42*1,
- {4,TX_OBJ_DELOBJ,TX_OBJ_PLANTE,
- TX_OBJ_ARBRE,TX_OBJ_FLEUR1},
- },
- {
- WM_DECOR3, // pose des batiments
- 0, {11, 18,81,33,61,82,93,20,21,22,57,58},
- 11+42*2, 190+42*2,
- {11,TX_OBJ_DELOBJ,TX_OBJ_BATIMENT,TX_OBJ_TOUR,
- TX_OBJ_MINEFER,TX_OBJ_BATENNEMIS,TX_OBJ_BARENNEMIS,
- TX_OBJ_MURPAL,TX_OBJ_ROC,TX_OBJ_OBJET,
- TX_OBJ_ARME,TX_OBJ_VEHICULE},
- },
- {
- WM_DECOR4, // pose des blupi
- 0, {10, 12,13,14,85,15,16,17,38,75,56},
- 11+42*2, 190+42*3,
- {10,TX_OBJ_DELPERSO,TX_OBJ_BLUPIf,TX_OBJ_BLUPI,
- TX_OBJ_DISCIPLE,TX_OBJ_ARAIGNEE,TX_OBJ_VIRUS,
- TX_OBJ_TRACKS,TX_OBJ_BOMBE,TX_OBJ_ELECTRO,
- TX_OBJ_ROBOT},
- },
- {
- WM_DECOR5, // pose les catastrophes
- 0, {2, 36,37},
- 11+42*2, 190+42*4,
- {2,TX_OBJ_DELFEU,TX_OBJ_STARTFEU},
- },
- {
- WM_PHASE_REGION,
- 0, {1,5},
- 11+42*0, 190+42*1,
- {1,TX_BUTTON_REGION},
- },
- {
- WM_PHASE_MUSIC,
- 0, {1,44},
- 11+42*0, 190+42*2,
- {1,TX_BUTTON_MUSIC},
- },
- {
- WM_PHASE_BUTTON,
- 0, {1,46},
- 11+42*0, 190+42*3,
- {1,TX_BUTTON_BUTTON},
- },
- {
- WM_PHASE_TERM,
- 0, {1,45},
- 11+42*0, 190+42*4,
- {1,TX_BUTTON_CTERM},
- },
- {
- WM_PHASE_INFO,
- 0, {1,40},
- 11+42*0, 424,
- {1,TX_BUTTON_TERMC},
- },
- {
- WM_PHASE_UNDO,
- 0, {1,87},
- 11+42*2, 424,
- {1,TX_BUTTON_UNDO},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_BUTTON,
- "image16\\button00.blp",
- TRUE,
- {
- {
- WM_BUTTON1, // stop
- 0, {1,40},
- 170+42*0, 30+52*0,
- {1,TX_ACTION_STOP},
- },
- {
- WM_BUTTON0, // go
- 0, {1,24},
- 170+42*1, 30+52*0,
- {1,TX_ACTION_GO},
- },
- {
- WM_BUTTON3, // carry
- 0, {1,30},
- 170+42*3, 30+52*0,
- {1,TX_ACTION_CARRY},
- },
- {
- WM_BUTTON4, // depose
- 0, {1,31},
- 170+42*4, 30+52*0,
- {1,TX_ACTION_DEPOSE},
- },
- {
- WM_BUTTON32, // r�p�te
- 0, {1,100},
- 170+42*6, 30+52*0,
- {1,TX_ACTION_REPEAT},
- },
-
- {
- WM_BUTTON5, // abat
- 0, {1,22},
- 170+42*0, 30+52*1,
- {1,TX_ACTION_ABAT},
- },
- {
- WM_BUTTON16, // abat n
- 0, {1,42},
- 170+42*1, 30+52*1,
- {1,TX_ACTION_ABATn},
- },
- {
- WM_BUTTON6, // roc
- 0, {1,27},
- 170+42*3, 30+52*1,
- {1,TX_ACTION_ROC},
- },
- {
- WM_BUTTON17, // roc n
- 0, {1,43},
- 170+42*4, 30+52*1,
- {1,TX_ACTION_ROCn},
- },
- {
- WM_BUTTON22, // fleurs
- 0, {1,54},
- 170+42*6, 30+52*1,
- {1,TX_ACTION_FLEUR},
- },
- {
- WM_BUTTON23, // fleurs n
- 0, {1,55},
- 170+42*7, 30+52*1,
- {1,TX_ACTION_FLEURn},
- },
-
- {
- WM_BUTTON9, // build2 (couveuse)
- 0, {1,25},
- 170+42*0, 30+52*2,
- {1,TX_ACTION_BUILD2},
- },
- {
- WM_BUTTON15, // palis
- 0, {1,26},
- 170+42*1, 30+52*2,
- {1,TX_ACTION_PALIS},
- },
- {
- WM_BUTTON18, // pont
- 0, {1,23},
- 170+42*2, 30+52*2,
- {1,TX_ACTION_PONT},
- },
- {
- WM_BUTTON25, // bateau
- 0, {1,58},
- 170+42*3, 30+52*2,
- {1,TX_ACTION_BATEAU},
- },
- {
- WM_BUTTON13, // build6 (t�l�porteur)
- 0, {1,101},
- 170+42*4, 30+52*2,
- {1,TX_ACTION_BUILD6},
- },
- {
- WM_BUTTON14, // mur
- 0, {1,20},
- 170+42*6, 30+52*2,
- {1,TX_ACTION_MUR},
- },
- {
- WM_BUTTON19, // tour
- 0, {1,33},
- 170+42*7, 30+52*2,
- {1,TX_ACTION_TOUR},
- },
-
- {
- WM_BUTTON8, // build1 (cabane)
- 0, {1,19},
- 170+42*0, 30+52*3,
- {1,TX_ACTION_BUILD1},
- },
- {
- WM_BUTTON7, // cultive
- 0, {1,28},
- 170+42*1, 30+52*3,
- {1,TX_ACTION_CULTIVE},
- },
- {
- WM_BUTTON2, // mange
- 0, {1,32},
- 170+42*2, 30+52*3,
- {1,TX_ACTION_MANGE},
- },
-
- {
- WM_BUTTON10, // build3 (laboratoire)
- 0, {1,35},
- 170+42*0, 30+52*4,
- {1,TX_ACTION_BUILD3},
- },
- {
- WM_BUTTON21, // laboratoire
- 0, {1,39},
- 170+42*1, 30+52*4,
- {1,TX_ACTION_LABO},
- },
- {
- WM_BUTTON20, // boit
- 0, {1,34},
- 170+42*2, 30+52*4,
- {1,TX_ACTION_BOIT},
- },
- {
- WM_BUTTON24, // dynamite
- 0, {1,41},
- 170+42*3, 30+52*4,
- {1,TX_ACTION_DYNAMITE},
- },
-
- {
- WM_BUTTON27, // drapeau
- 0, {1,64},
- 170+42*0, 30+52*5,
- {1,TX_ACTION_DRAPEAU},
- },
- {
- WM_BUTTON11, // build4 (mine)
- 0, {1,61},
- 170+42*1, 30+52*5,
- {1,TX_ACTION_BUILD4},
- },
- {
- WM_BUTTON28, // extrait
- 0, {1,62},
- 170+42*2, 30+52*5,
- {1,TX_ACTION_EXTRAIT},
- },
- {
- WM_BUTTON12, // build5 (usine)
- 0, {1,59},
- 170+42*4, 30+52*5,
- {1,TX_ACTION_BUILD5},
- },
- {
- WM_BUTTON29, // fabrique jeep
- 0, {1,65},
- 170+42*5, 30+52*5,
- {1,TX_ACTION_FABJEEP},
- },
- {
- WM_BUTTON30, // fabrique mine
- 0, {1,63},
- 170+42*6, 30+52*5,
- {1,TX_ACTION_FABMINE},
- },
- {
- WM_BUTTON34, // fabrique armure
- 0, {1,106},
- 170+42*7, 30+52*5,
- {1,TX_ACTION_FABARMURE},
- },
- {
- WM_BUTTON31, // fabrique disciple
- 0, {1,83},
- 170+42*8, 30+52*5,
- {1,TX_ACTION_FABDISC},
- },
-
-// {
-// WM_BUTTON13, // build6
-// 0, {0},
-// 170+42*2, 30+52*5,
-// {1,TX_ACTION_BUILD6},
-// },
- {
- WM_PHASE_BUILD,
- 0, {1,50},
- 11, 424,
- {1,TX_BUTTON_TERM},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_TERM,
- "image\\term.blp",
- TRUE,
- {
- {
- WM_BUTTON8, // home blupi
- 0, {1,81},
- 170+42*0, 30+42*0,
- {1,TX_BUTTON_TERMMBLUPI},
- },
- {
- WM_BUTTON9, // kill robots
- 0, {1,57},
- 170+42*1, 30+42*0,
- {1,TX_BUTTON_TERMKILL},
- },
- {
- WM_BUTTON3, // stop fire
- 0, {1,37},
- 170+42*2, 30+42*0,
- {1,TX_BUTTON_TERMFIRE},
- },
- {
- WM_BUTTON1, // hach blupi
- 0, {1,14},
- 170+42*0, 30+42*2,
- {1,TX_BUTTON_TERMHBLUPI},
- },
- {
- WM_BUTTON2, // hach planche
- 0, {1,22},
- 170+42*1, 30+42*2,
- {1,TX_BUTTON_TERMHPLANCHE},
- },
- {
- WM_BUTTON10, // hach tomate
- 0, {1,28},
- 170+42*2, 30+42*2,
- {1,TX_BUTTON_TERMHTOMATE},
- },
- {
- WM_BUTTON11, // hach m�tal
- 0, {1,84},
- 170+42*3, 30+42*2,
- {1,TX_BUTTON_TERMHMETAL},
- },
- {
- WM_BUTTON12, // hach robot
- 0, {1,94},
- 170+42*4, 30+42*2,
- {1,TX_BUTTON_TERMHROBOT},
- },
- {
- WM_BUTTON4, // - min blupi
- 0, {1,50},
- 170+42*0, 30+42*4,
- {1,TX_BUTTON_TERMDEC},
- },
- {
- WM_BUTTON5, // + min blupi
- 0, {1,51},
- 170+42*1, 30+42*4,
- {1,TX_BUTTON_TERMINC},
- },
- {
- WM_BUTTON6, // - max blupi
- 0, {1,50},
- 170+42*0, 30+42*5,
- {1,TX_BUTTON_TERMDEC},
- },
- {
- WM_BUTTON7, // + max blupi
- 0, {1,51},
- 170+42*1, 30+42*5,
- {1,TX_BUTTON_TERMINC},
- },
- {
- WM_PHASE_BUILD,
- 0, {1,50},
- 11, 424,
- {1,TX_BUTTON_TERM},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_MUSIC,
- "image16\\music.blp",
- TRUE,
- {
- {
- WM_BUTTON1,
- 0, {1,40},
- 170+42*0, 30+42*0,
- {1,TX_BUTTON_MUSIC1},
- },
- {
- WM_BUTTON2,
- 0, {1,44},
- 170+42*0, 30+42*1,
- {1,TX_BUTTON_MUSIC2},
- },
- {
- WM_BUTTON3,
- 0, {1,44},
- 170+42*0, 30+42*2,
- {1,TX_BUTTON_MUSIC3},
- },
- {
- WM_BUTTON4,
- 0, {1,44},
- 170+42*0, 30+42*3,
- {1,TX_BUTTON_MUSIC4},
- },
- {
- WM_BUTTON5,
- 0, {1,44},
- 170+42*0, 30+42*4,
- {1,TX_BUTTON_MUSIC5},
- },
- {
- WM_BUTTON6,
- 0, {1,44},
- 170+42*0, 30+42*5,
- {1,TX_BUTTON_MUSIC6},
- },
- {
- WM_BUTTON7,
- 0, {1,44},
- 170+42*0, 30+42*6,
- {1,TX_BUTTON_MUSIC7},
- },
- {
- WM_BUTTON8,
- 0, {1,44},
- 170+42*0, 30+42*7,
- {1,TX_BUTTON_MUSIC8},
- },
- {
- WM_BUTTON9,
- 0, {1,44},
- 170+42*0, 30+42*8,
- {1,TX_BUTTON_MUSIC9},
- },
- {
- WM_BUTTON10,
- 0, {1,44},
- 170+42*0, 30+42*9,
- {1,TX_BUTTON_MUSIC10},
- },
- {
- WM_PHASE_BUILD,
- 0, {1,50},
- 11, 424,
- {1,TX_BUTTON_TERM},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_REGION,
- "image16\\region.blp",
- TRUE,
- {
- {
- WM_BUTTON1, // normal
- 0, {0},
- 220, 60,
- {1,TX_BUTTON_REGION1},
- },
- {
- WM_BUTTON4, // sapins
- 0, {0},
- 220, 170,
- {1,TX_BUTTON_REGION4},
- },
- {
- WM_BUTTON2, // palmiers
- 0, {0},
- 220, 280,
- {1,TX_BUTTON_REGION2},
- },
- {
- WM_BUTTON3, // hivers
- 0, {0},
- 220, 390,
- {1,TX_BUTTON_REGION3},
- },
- {
- WM_PHASE_BUILD,
- 0, {1,50},
- 11, 424,
- {1,TX_BUTTON_TERM},
- },
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_PLAYMOVIE,
- "image\\movie.blp",
- FALSE,
- {
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_WINMOVIE,
- "image\\movie.blp",
- FALSE,
- {
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_H0MOVIE,
- "image\\movie.blp",
- FALSE,
- {
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_H1MOVIE,
- "image\\movie.blp",
- FALSE,
- {
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_H2MOVIE,
- "image\\movie.blp",
- FALSE,
- {
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_BYE,
- "image16\\bye.blp",
- FALSE,
- {
- {
- 0
- },
- },
- },
-
- {
- WM_PHASE_INSERT,
- "image\\insert.blp",
- FALSE,
- {
-//? {
-//? WM_PHASE_INFO,
-//? 0, {1,48},
-//? 16, 424-42,
-//? {1,TX_BUTTON_PLAYP},
-//? },
- {
- WM_PHASE_INIT,
- 0, {1,40},
- 16, 424,
- {1,TX_BUTTON_QUITTER},
- },
- {
- 0
- },
- },
- },
-
- {
- 0
- }
-};
-
-// Constructor
-
-CEvent::CEvent()
-{
- int i;
-
-
-
- m_somethingJoystick = 0;
- m_bFullScreen = TRUE;
- m_mouseType = MOUSETYPEGRA;
- m_index = -1;
- m_exercice = 0;
- m_mission = 1;
- m_private = 1;
- m_maxMission = 0;
- m_phase = 0;
- m_bSchool = FALSE;
- m_bPrivate = FALSE;
- m_bAccessBuild = FALSE;
- m_bRunMovie = FALSE;
- m_bBuildModify = FALSE;
- m_bMousePress = FALSE;
- m_bMouseDown = FALSE;
- m_oldMousePos.x = 0;
- m_oldMousePos.y = 0;
- m_mouseSprite = 0;
- m_bFillMouse = FALSE;
- m_bWaitMouse = FALSE;
- m_bHideMouse = FALSE;
- m_bShowMouse = FALSE;
- m_tryPhase = 0;
- m_rankCheat = -1;
- m_posCheat = 0;
- m_speed = 1;
- m_bMovie = TRUE;
- m_bAllMissions = FALSE;
- m_bHiliInfoButton = TRUE;
- m_bSpeed = FALSE;
- m_bHelp = FALSE;
- m_bChangeCheat = FALSE;
- m_scrollSpeed = 1;
- m_bPause = FALSE;
- m_bShift = FALSE;
- m_shiftPhase = 0;
- m_movieToStart[0] = 0;
- m_bInfoHelp = FALSE;
- m_bDemoRec = FALSE;
- m_bDemoPlay = FALSE;
- m_pDemoBuffer = NULL;
- m_demoTime = 0;
- m_bCtrlDown = FALSE;
- m_input = 0;
-
- for (i != 0; i = 20; i++)
- {
- m_menuIndex = 0;
- m_menuIndex++;
- }
-
- m_menuDecor[10] = 1;
-
- return;
-}
-
-// Destructor
-
-CEvent::~CEvent()
-{
- WriteInfo(); // Read the file "info.blp"
-}
-
-void CEvent::Create(HINSTANCE hInstance, HWND hWnd, CPixmap *pPixmap, CDecor *pDecor,
- CSound *pSound, CNetwork *pNetwork, CMovie *pMovie)
-{
- HINSTANCE hInstance;
- POINT pos;
-
- m_hInstance = hInstance;
- m_hWnd = hWnd;
- m_pPixmap = pPixmap;
- m_pDecor = pDecor;
- m_pSound = pSound;
- m_pMovie = pMovie;
- m_pNetwork = pNetwork;
- m_gamer = 1;
-
- ReadInfo(1);
-}
-
-int CEvent::GetButtonIndex(int button)
-{
- int i=0;
-
- while ( table[m_index].buttons[i].message != 0 )
- {
- if ( (UINT)button == table[m_index].buttons[i].message )
- {
- return i;
- }
- i ++;
- }
-
- return -1;
-}
-
-int CEvent::GetState(int button)
-{
- int index;
-
- index = GetButtonIndex(button);
- if ( index < 0 ) return 0;
-
- return m_buttons[index].GetState();
-}
-
-/*
-void CEvent::OutputNetDebug(char* str)
-{
- char filename[MAX_PATH];
-
- if (m_pDecor->GetNetDebug() != 0)
- {
- if (fopen(filename, "debug.txt") != NULL)
- {
-
- }
- }
-}
-*/
-
-// Returns the mouse position
-
-POINT CEvent::GetMousePos()
-{
- POINT pos;
-
- GetCursorPos(&pos);
- ScreenToClient(m_hWnd, &pos);
-
- return pos;
-}
-
-void CEvent::SetFullScreen(BOOL bFullScreen)
-{
- m_bFullScreen = bFullScreen;
-}
-
-// Initializes the mouse type.
-
-void CEvent::SetMouseType(int mouseType)
-{
- m_mouseType = mouseType;
-}
-
-// Creates the event handler.
-
-
-
-// Returns the index of the button.
-
-
-
-void CEvent::SetState(int button, int state)
-{
- int index;
-
- index = GetButtonIndex(button);
- if ( index < 0 ) return;
-
- m_buttons[index].SetState(state);
-}
-
-BOOL CEvent::GetEnable(int button)
-{
- int index;
-
- index = GetButtonIndex(button);
- if ( index < 0 ) return 0;
-
- return m_buttons[index].GetEnable();
-}
-
-void CEvent::SetEnable(int button, BOOL bEnable)
-{
- int index;
-
- index = GetButtonIndex(button);
- if ( index < 0 ) return;
-
- m_buttons[index].SetEnable(bEnable);
-}
-
-void CEvent::SetSomething(int button, int bSomething)
-{
- int index;
-
- index = GetButtonIndex(button);
- if (index < 0) return;
-
- m_buttons[index].SetSomething(bSomething);
-}
-
-int CEvent::GetMenu(int button)
-{
- int index;
-
- index = GetButtonIndex(button);
- if ( index < 0 ) return 0;
-
- return m_buttons[index].GetMenu();
-}
-
-void CEvent::SetMenu(int button, int menu)
-{
- int index;
-
- index = GetButtonIndex(button);
- if ( index < 0 ) return;
-
- m_buttons[index].SetMenu(menu);
-}
-
-// Restore the game after activation in fullScreen mode.
-
-void CEvent::RestoreGame()
-{
- int i;
-
- if (m_phase == WM_PHASE_PLAY && m_phase == WM_PHASE_PLAYTEST)
- {
- HideMouse(FALSE);
- WaitMouse(TRUE);
- WaitMouse(FALSE);
- return;
- }
- FillMouse(TRUE);
- return;
-
-}
-
-void CEvent::FlushInput()
-{
- m_input = 0;
-
- m_pDecor->SetInput(KEY_NONE);
- return;
-
-}
-
-BOOL CEvent::CreateButtons()
-{
- int i = 0, message;
- POINT pos;
- BOOL bMinimizeRedraw = FALSE;
-
- if (m_phase == WM_PHASE_PLAY)
- {
- bMinimizeRedraw = TRUE;
- }
- while (table[m_index].buttons[i].message != 0)
- {
- pos.x = table[m_index].buttons[i].x;
- pos.y = table[m_index].buttons[i].y;
- message = table[m_index].buttons[i].message;
-
- if (m_bPrivate)
- {
- if (message == WM_PHASE_SKILL1)
- {
- pos.x = 117;
- pos.y = 115;
- }
- if (message == WM_PHASE_SKILL2)
- {
-
- }
- }
- }
-}
-
-void CEvent::ReadInput()
-{
- BOOL bCanCrouch;
- MMRESULT joyPos;
- int i;
- UINT keyInput;
- JOYINFOEX* joyInfo;
- BOOL bSkateboard;
- BOOL bHelicopter;
- BOOL bCar;
- BOOL bWater;
- JOYINFOEX joy;
- UINT bJoyID;
-
-
- if (m_bMulti)
- {
- m_pDecor->TreatNetData();
- }
-
- if (m_somethingJoystick == NULL || m_bDemoPlay)
- {
- m_pDecor->SetJoystickEnable(FALSE);
- }
- else
- {
- m_pDecor->GetBlupiInfo(&bHelicopter, &bCar, &bSkateboard, &bWater);
- bCanCrouch = TRUE;
-
- if (bHelicopter || bCar || bSkateboard)
- {
- bCanCrouch = FALSE;
- }
- bJoyID = m_joyID;
-
- ZeroMemory(&joy, sizeof(joy));
-
- joy.dwSize = sizeof(JOYINFOEX);
- joy.dwFlags = 255;
-
- joyPos = joyGetPosEx(bJoyID, &joy);
-
- if (joyPos == 0)
- {
- m_input = 0;
-
- if (joy.dwXpos < 16384)
- {
- m_input = KEY_LEFT;
- }
- if (m_input == KEY_NONE && joy.dwYpos < 16384)
- {
- m_input = KEY_UP;
- }
- if (m_input == KEY_NONE || joy.dwYpos > 49152)
- {
- m_input = m_input | KEY_DOWN;
- }
- if (joy.dwButtons & JOY_BUTTON1)
- {
- m_input = m_input & ~(KEY_DOWN | KEY_UP) | KEY_JUMP;
- }
- if (joy.dwButtons & JOY_BUTTON2)
- {
- if (bSkateboard) {
- keyInput = m_input & ~(KEY_DOWN | KEY_UP) | KEY_JUMP;
- }
- else {
- keyInput = m_input & ~KEY_DOWN | KEY_UP | KEY_JUMP;
- }
- m_input = keyInput;
- }
- if (joy.dwButtons & JOY_BUTTON3)
- {
- if (bHelicopter)
- {
- keyInput = m_input | KEY_DOWN;
- }
- else {
- if (bSkateboard) {
- keyInput = m_input & ~(KEY_DOWN | KEY_UP) | KEY_JUMP;
- }
- else {
- keyInput = m_input | KEY_DOWN | KEY_JUMP;
- }
- }
-
- m_input = keyInput;
- m_input = keyInput & ~KEY_UP;
- }
- if (joy.dwButtons & JOY_BUTTON4)
- {
- m_input = m_input & ~(KEY_DOWN | KEY_UP) | KEY_FIRE;
- }
- m_pDecor->SetInput(m_input);
- m_pDecor->SetJoystickEnable(TRUE);
- return;
- }
- }
- return;
-}
-
-
-// CNetwork function needs to be implemented
-
-void CEvent::NetSetPause(BOOL bPause, int players)
-{
- BOOL bPause_;
-
- bPause_ = bPause;
- m_pDecor->SetPause(bPause);
- if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST)
- {
- if (bPause_)
- m_pSound->SuspendMusic();
- else
- m_pSound->RestartMusic();
- }
- if (m_bMulti && players != 0)
- {
- m_pNetwork->Send(&bPause, 3, DPSEND_GUARANTEED);
- }
- return;
-}
-
-void CEvent::NetSendLobby()
-{
- NetPlayer* player;
- NetPlayer* playerPacket;
- UCHAR packet[132];
- CNetwork* pNetwork;
-
- packet[2] = *(short*)&m_multi;
- pNetwork = m_pNetwork;
- packet[0] = 132;
- packet[1] = MESS_LOBBY;
- player = pNetwork->m_players;
- playerPacket = (NetPlayer*)(packet + 4);
- for (int i = 0; i < sizeof(NetPlayer); i++)
- {
- playerPacket = (NetPlayer*)player;
- player = (NetPlayer*)&player->dpid;
- playerPacket++;
- }
- pNetwork->Send(packet, 132, DPSEND_GUARANTEED);
-}
-
-int CEvent::NetSearchPlayer(DPID dpid)
-{
- for (int i = 0; i < MAXNETPLAYER; i++)
- {
- if (m_pNetwork->m_players[i].bIsPresent && m_pNetwork->m_players[0].dpid == dpid) return i;
- }
-
- return -1;
-}
-
-void CEvent::NetStartPlay()
-{
- BOOL host;
- int i;
- DPID player;
- char message[2];
- char str[52];
- CNetwork* pNetwork;
-
- OutputNetDebug("CEvent::NetStartPlay");
-
- if (m_pNetwork->IsHost())
- {
- message[0] = 2;
- message[1] = MESS_START;
- m_pNetwork->Send(message, 2, DPSEND_GUARANTEED);
- OutputNetDebug("Sending MESS_START");
- }
- m_pDecor->SetTeam(0);
-
- for (int i = 0; i < MAXNETPLAYER; i++)
- {
- if (m_pNetwork->m_players[i].bIsPresent && m_pNetwork->m_players[0].dpid == m_pNetwork->m_dpid)
- {
- m_pDecor->SetTeam(pNetwork->m_players[i].team);
- sprintf(str, "color=%d", m_pNetwork->m_players[i].team);
- OutputNetDebug(str);
- return;
- }
- }
-
- m_bMulti = TRUE;
- m_bPrivate = FALSE;
- m_pDecor->SetMulti(TRUE);
-}
-
-void CEvent::NetFUN_1d6b0(UINT message, USHORT data)
-{
- UCHAR packet[4];
-
- packet[2] = '\0';
- packet[3] = '\0';
- packet[1] = message;
- packet[0] = 4;
- packet._2_2_ = data;
- m_pNetwork->Send(packet, 4, DPSEND_GUARANTEED);
- return;
-}
-
-void CEvent::NetDrawMap()
-{
- m_pDecor->DrawMap(TRUE, NetSearchPlayer(m_pNetwork->m_dpid));
-}
-
-void CEvent::ChatSend()
-{
- int netplay;
- UINT i;
- char* text;
- char end;
- DPID dpid;
- LPVOID data[25];
-
- text = m_textInput;
- if (m_textInput[0] != '\0')
- {
- netplay = NetSearchPlayer(m_pNetwork->m_dpid);
- i = 0xFFFFFFFF;
- end = &'<';
- }
-}
-
-void CEvent::OutputNetDebug(const char* str)
-{
- char* stream;
- FILE* streamf;
- UINT element;
-
- if (m_pDecor->GetNetDebug() != FALSE)
- {
- if (fopen("debug.txt", "ab") != (FILE*)0)
- {
- element = 0xFFFFFFFF;
- strcpy(stream, str);
- }
- fwrite(str, 1, (element - 1), streamf);
- fclose(streamf);
- }
- return;
-}
-
-void AddCheatCode(char *pDst, char *pSrc)
-{
- int i, j;
-
- if ( pDst[0] != 0 ) strcat(pDst, " / ");
-
- i = 0;
- j = strlen(pDst);
- while ( pSrc[i] != 0 )
- {
- pDst[j++] = tolower(pSrc[i++]);
- }
- pDst[j] = 0;
-}
-
-
-void CEvent::DrawTextCenter(int res, POINT pos, int font)
-{
- char text[100];
-
- LoadString(res, text, 100);
- ::DrawTextCenter(m_pPixmap, pos, text, font);
-}
-
-BOOL CEvent::AddPhaseText()
-{
- char text[100];
-
-
- if (m_phase != WM_PHASE_INSERT && m_phase != WM_PHASE_BYE)
- {
- text[0] = 0;
-
- if (m_bBuildOfficialMissions) AddCheatCode(text, cheat_code[0]);
- if (m_bAllMissions) AddCheatCode(text, cheat_code[1]);
- if (m_pDecor->GetSuperBlupi()) AddCheatCode(text, cheat_code[3]);
- if (m_pDecor->GetDrawSecret()) AddCheatCode(text, cheat_code[11]);
- if (m_pDecor->GetNetPacked()) AddCheatCode(text, cheat_code[19]);
- if (m_pDecor->GetNetMovePredict()) AddCheatCode(text, cheat_code[21]);
-
- m_pDecor->OutputNetDebug(text);
-
- if (m_phase != WM_PHASE_PLAY && m_phase != WM_PHASE_PLAYTEST && m_phase != WM_PHASE_BUILD)
- {
- m_pPixmap->DrawPart(-1, CHDECOR, { 2, 2 }, { 2, 2, 302, 14 }, 1, FALSE);
- }
- DrawTextLeft(m_pPixmap, { 2, 2 }, text, CHLITTLE);
- }
- if (m_phase == WM_PHASE_INIT)
- {
- DrawText(m_pPixmap, { 414, 446 }, "Version 2.2", FONTLITTLE);
- }
- if (m_phase == WM_PHASE_GAMER)
- {
- LoadString(TX_ChoosePlayer@2, text, 100);
- DrawTextLeft(m_pPixmap, { LXIMAGE / 2 - GetTextWidth(text, 0) / 2, 26 }, text, FONTRED);
-
- POINT pos { 110, 69 };
- for (int i = 0; i < MAXGAMER; i++)
- {
- DrawText(m_pPixmap, pos, m_gamerNameList[i], FONTWHITE);
- pos.y += DIMBUTTONY;
- }
-
- //SetEnable(WM_PHASE_CLEARGAMER); // TODO
- }
- if (m_phase == WM_PHASE_CREATE)
- {
- LoadString(0xFA, text, 100);
- // TODO
- }
-}
-
-BOOL CEvent::DrawButtons()
-{
- int i;
- int levels[2];
- int types[2];
- int world, time, lg, button, volume, pente, icon;
- char res[100];
- char text[100];
- POINT pos;
- RECT rect;
- BOOL bEnable;
-
- if ( (m_phase == WM_PHASE_INSERT && m_phase == WM_PHASE_BYE ))
- {
- m_bChangeCheat = FALSE;
-
- text[0] = 0;
- if (m_bAccessBuild != 0)
- {
- AddCheatCode(text, cheat_code[0]);
- }
- if (m_posHelpButton.y != 0)
- {
- AddCheatCode(text, cheat_code[1]);
- }
- if ( m_pDecor->GetInvincible() )
- {
- AddCheatCode(text, cheat_code[3]);
- }
- if ( m_pDecor->GetShowSecret() )
- {
- AddCheatCode(text, cheat_code[11]);
- }
- if ( m_pDecor->GetNetPacked() )
- {
- AddCheatCode(text, cheat_code[19]);
- }
- if (m_pDecor->GetNetMovePredict())
- {
- AddCheatCode(text, cheat_code[21]);
- }
- }
- m_pDecor->OutputNetDebug(text);
-
-
- if (m_phase == WM_PHASE_INIT)
- {
- DrawTextNew(m_pPixmap, pos, R"(Version 2.0)", FONTLITTLE);
- }
-
- if (m_phase == WM_PHASE_PLAY && m_phase == WM_PHASE_PLAYTEST && m_phase == WM_PHASE_BUILD)
- m_pPixmap->DrawPart(-1, 0, pos, rect, 1, 0);
- if (m_phase == WM_PHASE_CREATE)
- {
- LoadString(TX_MULTI_CREATE, res, 50);
- lg=GetTextWidth(res);
- pos.x = (320 - lg) / 2;
- pos.y = 103;
- DrawTextLeft(m_pPixmap, pos, res, FONTSLIM);
- LoadString(TX_MULTI_GNAME, res, 100);
- pos.x = (320 - lg) / 2;
- pos.y = 190;
- DrawTextLeft(m_pPixmap, pos, res, FONTSLIM);
- }
- if (m_phase == WM_PHASE_SETUP || m_phase == WM_PHASE_SETUPp)
- {
- SetState(WM_BUTTON5, (m_pPixmap->GetTrueColor() == 0));
- }
- if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST)
- {
- if (m_pDecor->GetPause() == 0)
- {
- if (m_bDemoRec != 0)
- {
- LoadString(TX_DEMOREC, res, 100);
- DrawTextLeft(m_pPixmap, pos, res, FONTRED);
- }
- if (m_bDemoPlay != 0)
- {
- LoadString(TX_DEMOPLAY, res, 100);
- DrawTextLeft(m_pPixmap, pos, res, FONTRED);
- }
- }
- else
- {
- if (m_pDecor->GetTime() % 20 < 15)
- {
- DrawTextCenter(TX_PAUSE, 320, 240, 0);
- }
- }
- if (m_speed > 1)
- {
- sprintf(res, "x%d", m_speed);
- DrawTextLeft(m_pPixmap, pos, res, FONTWHITE);
- }
- }
- if (m_phase == WM_PHASE_STOP)
- {
- LoadString(TX_GAMEPAUSE, res, 100);
- lg = GetTextWidth(res);
- pos.x = (319 - lg) / 2;
- pos.y = 103;
- DrawTextLeft(m_pPixmap, pos, res, FONTRED);
- }
- if (m_phase == WM_PHASE_MUSIC)
- {
- LoadString(TX_MUSIC, res, 100);
- lg=GetTextWidth(res);
- pos.x = (320 - lg) / 2;
- pos.y = 84;
- DrawTextLeft(m_pPixmap, pos, res, FONTRED);
- }
- if (m_phase == WM_PHASE_REGION)
- {
- LoadString(TX_REGION, res, 100);
- lg = GetTextWidth(res);
- pos.x = (320 - lg) / 2;
- pos.y = 26;
- DrawTextLeft(m_pPixmap, pos, res, FONTRED);
- }
- if (m_phase == WM_PHASE_LOST || m_phase == WM_PHASE_LOSTd || m_phase == WM_PHASE_WINm)
- {
- LoadString(TX_LOST1 + GetWorld() % 5, res, 50);
- DrawTextLeft(m_pPixmap, pos, res, FONTWHITE);
- }
- if (m_phase == WM_PHASE_WIN || m_phase == WM_PHASE_WINd || m_phase == WM_PHASE_LOSTm)
- {
- LoadString(TX_WIN1 + GetWorld() % 5, res, 50);
- DrawTextLeft(m_pPixmap, pos, res, FONTWHITE);
- }
- if (m_phase == WM_PHASE_READd)
- {
-
- }
- if (m_phase == WM_PHASE_GREAD || m_phase == WM_PHASE_GREADp || m_phase == WM_PHASE_GWRITE)
- {
- if (m_phase == WM_PHASE_GREAD)
- {
- LoadString(TX_SAVE_CGAME, res, 50);
- }
- else
- {
- LoadString(TX_LOAD_CGAME, res, 50);
- }
- }
- if (m_phase == WM_PHASE_BYE)
- {
- LoadString(TX_FULL_END1, res, 100);
- lg = GetTextWidth(res);
- pos.x = (320 - lg) / 2;
- pos.y = 20;
- DrawTextLeft(m_pPixmap, pos, res, FONTRED);
- LoadString(TX_FULL_END2, res, 100);
- lg = GetTextWidth(res);
- pos.x = (320 - lg) / 2;
- pos.y = 40;
- DrawTextLeft(m_pPixmap, pos, res, FONTRED);
- LoadString(TX_FULL_END3, res, 100);
- lg = GetTextWidth(res);
- pos.x = (320 - lg) / 2;
- pos.y = 430;
- DrawTextLeft(m_pPixmap, pos, res, FONTRED);
- LoadString(TX_FULL_END4, res, 100);
- lg = GetTextWidth(res);
- pos.x = (320 - lg) / 2;
- pos.y = 450;
- DrawTextLeft(m_pPixmap, pos, res, FONTRED);
- }
- if (m_phase == WM_PHASE_INSERT)
- {
- DrawTextCenter(TX_INSERT, LXIMAGE / 2, 20);
- }
- if (m_textToolTips[0] != '\0')
- {
- DrawTextLeft(m_pPixmap, m_posToolTips, m_textToolTips, FONTWHITE);
- }
-}
-
-BOOL CEvent::TextSomething()
-{
- int textHiliStart;
- char pText;
-
- m_textHiliStart = textHiliStart;
-
- if (m_textHiliEnd < textHiliStart)
- {
- return 0;
- }
-
- do {
- m_textInput[textHiliStart] =
- m_textHiliEnd + textHiliStart;
- pText = m_textInput + textHiliStart;
- textHiliStart = textHiliStart + 1;
- } while (pText != '\0');
- m_textHiliEnd = m_textHiliStart;
- return 1;
-}
-
-POINT CEvent::GetLastMousePos()
-{
- return m_oldMousePos;
-}
-
-BOOL CEvent::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam)
-{
- if (m_bDemoPlay)
- {
- if (message == WM_KEYDOWN ||
- message == WM_KEYUP ||
- message == WM_LBUTTONUP ||
- message == WM_RBUTTONUP)
- {
- DemoPlayStop();
- return TRUE;
- }
- if (message == WM_MOUSEMOVE)
- {
- return TRUE;
- }
- }
-
- return TreatEventBase(message, wParam, lParam);
-}
-
-BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam)
-{
- POINT pos;
- int fwKeys;
- int i, sound;
- char c;
- BOOL bEnable;
-
- pos = ConvLongToPos(lParam);
- fwKeys = wParam;
-
- switch (message)
- {
- case WM_KEYDOWN:
- if (wParam >= 'A' && wParam <= 'Z')
- {
- if (m_posCheat == 0)
- {
- m_rankCheat = -1;
-
- for (i = 0; i < 9; i++)
- {
- if ((char)wParam == cheat_code[i][0])
- {
- m_rankCheat = i;
- break;
- }
- }
- }
- if (m_rankCheat != -1)
- {
- c = cheat_code[m_rankCheat][m_posCheat];
- if (m_posCheat != 0 && m_rankCheat == 0) c++;
- if ((char)wParam == c)
- {
- m_posCheat++;
-
- }
- }
- }
- }
-
- if (m_phase != WM_PHASE_PLAY && m_phase != WM_PHASE_PLAYTEST)
- {
- return 0;
- }
- // Unknown Function
-
- switch (wParam)
- {
- case WM_RBUTTONDOWN:
- m_bMouseDown = TRUE;
- MouseSprite(pos);
- if (EventButtons(message, wParam, lParam)) return TRUE;
- if (m_phase == WM_PHASE_BUILD)
- {
- if (BuildDown(pos, fwKeys)) return TRUE;
- }
- if (m_phase == WM_PHASE_PLAY)
- {
- if (PlayDown(pos, fwKeys)) return TRUE;
- }
- break;
- }
-}
-
-
-
-int CEvent::MousePosToSprite(POINT pos)
-{
- int sprite;
-
- sprite = SPRITE_POINTER;
-
- if (m_phase == WM_PHASE_PLAY ||
- m_phase == WM_PHASE_PLAYTEST ||
- m_phase == WM_PHASE_BUILD ||
- m_phase == WM_PHASE_BYE ||
- !MouseOnButton(pos))
- {
- sprite = SPRITE_POINTER;
- }
- if (m_bWaitMouse)
- {
- sprite = SPRITE_WAIT;
- }
- if (m_bHideMouse)
- {
- sprite = SPRITE_EMPTY;
- }
- if (m_bFillMouse)
- {
- sprite = SPRITE_FILL;
- }
-
- return sprite;
-}
-
-void CEvent::MouseSprite(POINT pos)
-{
- m_mouseSprite = MousePosToSprite(pos);
-
- m_pPixmap->SetMousePosSprite(pos, m_mouseSprite, m_bDemoPlay);
- ChangeSprite(m_mouseSprite);
-}
-
-void CEvent::WaitMouse(BOOL bWait)
-{
- m_bWaitMouse = bWait;
-
- if ( bWait )
- {
- m_mouseSprite = SPRITE_WAIT;
- }
- else
- {
- m_mouseSprite = MousePosToSprite(GetMousePos());
- }
- m_pPixmap->SetMouseSprite(m_mouseSprite, m_bDemoPlay);
- ChangeSprite(m_mouseSprite);
-}
-
-void CEvent::HideMouse(BOOL bHide)
-{
- m_bWaitMouse = bHide;
-
- if ( bHide )
- {
- m_mouseSprite = SPRITE_EMPTY;
- }
- else
- {
- m_mouseSprite = MousePosToSprite(GetMousePos());
- }
- m_pPixmap->SetMouseSprite(m_mouseSprite, m_bDemoPlay);
- ChangeSprite(m_mouseSprite);
-}
-
-void CEvent::FillMouse(int bFill)
-{
- m_bFillMouse = bFill;
-
- if (bFill)
- {
- m_mouseSprite = SPRITE_FILL;
- }
- else
- {
- m_mouseSprite = MousePosToSprite(GetMousePos());
- }
- m_pPixmap->SetMouseSprite(m_mouseSprite, m_bDemoPlay);
- ChangeSprite(m_mouseSprite);
-}
-
-BOOL CEvent::EventButtons(UINT message, WPARAM wParam, LPARAM lParam)
-{
- POINT pos, test;
- int i, lg, oldx, sound, res;
-
- m_textToolTips[0] = 0;
- oldx = m_posToolTips.x;
- m_posToolTips.x = -1;
- if (m_phase != WM_PHASE_PLAY && m_phase != WM_PHASE_PLAYTEST)
- {
- for (i = 0; i < 2; i++)
- {
- if (!m_jauges[i].GetHide())
- {
- test = m_jauges[i].GetPos();
- if (pos.x >= test.x &&
- pos.x <= test.x + DIMJAUGEX &&
- pos.y >= test.y &&
- pos.y <= test.y + DIMJAUGEY)
- {
- LoadString(TX_JAUGE1 + i, m_textToolTips, 50);
- lg = GetTextWidth(m_textToolTips);
- test.x += (DIMJAUGEX - lg) / 2;
- test.y += 4;
- m_posToolTips = test;
- break;
- }
- }
- }
- if (oldx != m_posToolTips.x)
- {
- for (i = 0; i < 2; i++)
- {
- m_jauges[i].SetRedraw();
- }
- }
- }
- else
- {
- i = 0;
- while (table[m_index].buttons[i].message != 0)
- {
- res = m_buttons[i].GetToolTips(pos);
- if (res != -1)
- {
- LoadString(res, m_textToolTips, 50);
- lg = GetTextWidth(m_textToolTips);
- pos.x += 10;
- pos.y += 20;
- if (pos.x > LXIMAGE - lg) pos.x = LXIMAGE - lg;
- if (pos.y > LYIMAGE - 14) pos.y = LYIMAGE - 14;
- m_posToolTips = pos;
- break;
- }
- i++;
- }
- }
- i = 0;
- while (table[m_index].buttons[i].message != 0)
- {
- if (m_buttons[i].TreatEvent(message, wParam, lParam)) return TRUE;
- i++;
- }
- if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST)
- {
- if (m_menu.TreatEvent(message, wParam, lParam)) return TRUE;
- }
- return FALSE;
-}
-
-/*
-void CEvent::SomethingDecor()
-{
- m_input = 0;
- m_pDecor->TreatEvent();
-}
-*/
-
-BOOL CEvent::MouseOnButton(POINT pos)
-{
- int i;
-
- i = 0;
- while ( table[m_index].buttons[i].message != 0 )
- {
- if ( m_buttons[i].MouseOnButton(pos) ) return TRUE;
- i ++;
- }
-
- return FALSE;
-}
-
-int CEvent::SearchPhase(UINT phase)
-{
- int i = 0;
-
- while (table[i].phase != 0)
- {
- if (table[i].phase == phase) return i;
- i++;
- }
-
- return -1;
-}
-
-int CEvent::GetWorld()
-{
- //m_mission = mission;
- if (m_bPrivate) return m_bPrivate;
- if (m_bMulti) return m_multi+200;
- else return m_mission;
-}
-
-int CEvent::GetPhysicalWorld()
-{
- if ( m_bPrivate ) return m_bPrivate;
- if ( m_bMulti ) return m_multi+200;
- else return m_mission;
-}
-
-BOOL CEvent::IsPrivate()
-{
- return m_bPrivate;
-}
-
-BOOL CEvent::IsMulti()
-{
- return m_bMulti;
-}
-
-int CEvent::GetWorldGroup()
-{
- int mission;
- m_mission = mission;
-
- if (m_mission % 10 != 0 && m_mission != 99)
- {
- m_mission = (mission / 10) * 10;
- return -(m_mission >> 31);
- }
- m_mission = 1;
- return m_mission / 10;
-}
-
-void CEvent::SetMission(int index)
-{
- if (m_bPrivate)
- {
- m_private = index;
- return;
- }
- if (m_bMulti)
- {
- m_multi = index;
- return;
- }
- m_mission = index;
- return;
-}
-
-UINT CDecor::GetPhase()
-{
- return m_phase;
-}
-
-void CEvent::TryInsert()
-{
- if ( m_tryInsertCount == 0 )
- {
- ChangePhase(m_tryPhase);
- }
- else
- {
- m_tryInsertCount --;
- }
-}
-
-// Add SomethingHubWorld once figured out.
-
-// Very rough code, needs improvement
-
-BOOL CEvent::ChangePhase(UINT phase)
-{
- int index, world, time, total, music, i, max, mission;
- POINT totalDim, iconDim;
- char filename[MAX_PATH];
- char* pButtonExist;
- BOOL bEnable, bHide;
- Term* pTerm;
-
- if (phase == WM_PHASE_634)
- {
- PostMessageA(m_hWnd, 16, 0, 0);
- return TRUE;
- }
- m_pDecor->SetSpeedY(m_bDemoPlay);
- if (m_mouseType == MOUSETYPEGRA && m_bFullScreen != 0)
- {
- ShowCursor(FALSE);
- m_bShowMouse = FALSE;
- }
- if (phase == WM_PHASE_608)
- {
- m_pDecor->CurrentRead(999, 1, m_gamer);
- phase = WM_PHASE_BUILD;
- }
-
- if (m_movieToStart + 8 == 1 && m_movieToStart + 4 != 0)
- {
- m_bDemoRec = 0;
- }
-
- if (m_bDemoPlay == 0 &&
- phase == WM_PHASE_PLAY ||
- m_phase == WM_PHASE_PLAY ||
- phase == WM_PHASE_STOP ||
- phase == WM_PHASE_SETUP ||
- phase == WM_PHASE_HELP ||
- phase == WM_PHASE_GREAD ||
- phase == WM_PHASE_GREADp ||
- phase == WM_PHASE_GWRITE)
- {
- m_pSound->StopMusic();
- }
-
- m_textToolTips[0] = 0;
- m_posToolTips.x = -1;
- m_bPause = FALSE;
- m_bCtrlDown = FALSE;
- m_bMouseDown = FALSE;
- m_debugPos.x = 0;
- m_debugPos.y = 0;
-
- if (phase == WM_PHASE_INIT)
- {
- m_demoTime = 0;
- }
- if (phase == WM_PHASE_PLAY &&
- !m_bDemoPlay &&
- GetPhysicalWorld() >= 299 &&
- GetPhysicalWorld() < 320)
- {
- DemoRecStart();
- }
- if (phase != WM_PHASE_PLAY)
- {
- DemoRecStop();
- }
-
- m_mission = mission;
-
- if (phase == WM_PHASE_DOQUIT)
- {
- if (m_bPrivate == 0)
- {
- if (mission != 1)
- {
- if (mission == 99 || mission % 10 == 0)
- {
- mission = 1;
- }
- else
- {
- mission = (mission / 10) * 10;
- }
- GetWorld(m_mission);
- m_phase = WM_PHASE_PLAY;
-
- return ChangePhase(WM_PHASE_PLAY);
- }
- return ChangePhase(WM_PHASE_GAMER);
- }
- }
- else if (m_bMulti == 0)
- {
- return ChangePhase(WM_PHASE_INFO);
- }
-
- if (SearchPhase(phase) < 0)
- {
- return 0;
- }
- m_pPixmap->MouseInvalidate();
- HideMouse(FALSE);
- WaitMouse(TRUE);
-
- if (phase == WM_PHASE_GAMER || phase == WM_PHASE_PLAY)
- {
- OutputNetDebug();
- WriteInfo(m_gamer);
- }
-
-}
-
-WMessage CEvent::GetPhase()
-{
- return m_phase;
-}
-
-// Implement LoadLevel
-
-void CEvent::MovieToStart()
-{
- if (m_movieToStart[0] != 0)
- {
- HideMouse(TRUE);
-
- if (StartMovie(m_movieToStart))
- {
- m_phase = m_phaseAfterMovie;
- }
- else
- {
- ChangePhase(m_phaseAfterMovie);
- }
-
- m_movieToStart[0] = 0;
- }
-}
-
-BOOL CEvent::BuildDown(POINT pos, int fwKeys, BOOL bMix)
-{
- POINT cel;
- int menu, channel, icon;
-
- if (pos.x < POSDRAWX || pos.x > POSDRAWX + DIMDRAWX ||
- pos.y < POSDRAWY || pos.y > POSDRAWY + DIMDRAWY) return FALSE;
-
- if (GetState(WM_DECOR1) == 1)
- {
- cel = m_pDecor->ConvPosToCel2(pos);
- m_pDecor->BlupiDelete(pos);
- }
- if (GetState(WM_DECOR2) == 2)
- {
- cel = m_pDecor->ConvPosToCel2(pos);
- menu = GetMenu(WM_DECOR2);
- }
-}
-
-BOOL CEvent::BuildMove(POINT pos, int fwKeys)
-{
- if (fwKeys & MK_LBUTTON)
- {
- BuildDown(pos, fwKeys, FALSE);
- }
- m_pDecor->ConvPosToCel2(pos);
- return TRUE;
-}
-
-void CEvent::MouseRelease()
-{
- m_bMouseRelease = TRUE;
- ShowCursor(TRUE);
- return;
-}
-
-void CEvent::MouseCapture()
-{
- m_bMouseRelease = FALSE;
- ShowCursor(FALSE);
- return;
-}
-
-BOOL CEvent::NetCreate(int session)
-{
- BOOL created;
-
- MouseRelease();
- created = m_pNetwork->CreateProvider(session);
- MouseCapture();
- return created;
-}
-
-BOOL CEvent::NetEnumSessions()
-{
- BOOL enumSess;
-
- MouseRelease();
- enumSess = m_pNetwork->EnumProviders();
- MouseCapture();
- return enumSess;
-}
-
-BOOL CEvent::BuildUp(POINT pos, int fwKeys)
-{
- return TRUE;
-}
-
-void CEvent::TryPhase()
-{
- m_tryPhase = 1;
- ShowCursor(1);
-}
-
-void CEvent::UnTryPhase()
-{
- m_tryPhase = 0;
- ShowCursor(1);
-}
-
-int CEvent::GetTryPhase()
-{
- return m_tryPhase;
-}
-
-void CEvent::SomethingUserMissions(LPCSTR lpFileName, LPCSTR thing)
-{
-
-}
-
-void CEvent::GetDoors(int doors)
-{
- for (int i = 0; i < 200; i++)
- {
- doors[i] = (int)data[Gamer];
- }
-}
-
-void CEvent::TableSomething()
-{
- char filename[MAX_PATH];
-
- if (strstr(filename, table[m_index].backName))
- {
- AddCDPath(filename);
- }
- if (!m_pPixmap->CacheAll(CHBACK, filename, totalDim, iconDim, FALSE, GetRegion()))
- {
- return;
- }
-}
-
-
-
-BOOL CEvent::StartMovie(char* pFilename)
-{
- RECT rect;
- char filename[MAX_PATH];
-
- if (!m_pMovie->GetEnable()) return FALSE;
- if (!m_bMovie) return FALSE;
-
- if (!m_pMovie->IsExist(pFilename)) return FALSE;
-
- rect.left = 1;
- rect.top = 1;
- rect.right = LXIMAGE - 2;
- rect.bottom = LYIMAGE - 2;
-
- m_pSound->StopMusic();
- m_pPixmap->SavePalette();
-
- strcpy(filename, pFilename);
- strcpy(filename + strlen(filename) - 4, ".blp");
- m_pSound->Cache(SOUND_MOVIE, filename);
-
- if (m_pMovie->Play(m_hWnd, rect, pFilename)) return FALSE;
- m_bRunMovie = TRUE;
- m_pSound->Play(SOUND_MOVIE, 0, 0);
- return TRUE;
-}
-
-void CEvent::StopMovie()
-{
- m_pMovie->Stop(m_hWnd);
- m_pPixmap->RestorePalette();
- m_pPixmap->MouseInvalidate();
- m_pSound->Flush(SOUND_MOVIE);
- ChangePhase(m_phase);
- m_bRunMovie = FALSE;
-}
-
-BOOL CEvent::IsMovie()
-{
- return m_bRunMovie;
-}
-
-BOOL CEvent::ReadLibelle(int world, BOOL bSchool, BOOL bHelp)
-{
- FILE* file = NULL;
- char* pBuffer = NULL;
- char* pText;
- char* pDest;
- char indic;
- int nb, h1, h2;
-
- pBuffer = (char*)malloc(sizeof(char) * 2560);
- if (pBuffer == NULL) goto error;
- memset(pBuffer, 0, sizeof(char) * 2560);
-
- //file = fopen
-
-
-error:
- if (pBuffer != NULL) free(pBuffer);
- if (file != NULL) fclose(file);
- return FALSE;
-}
-
-void CEvent::SetLives(int lives)
-{
- m_lives = lives;
-}
-
-void CEvent::SetSpeed(int speed)
-{
- int max;
-
- if ( m_bSpeed ) max = 2;
-
- if ( speed > max ) speed = max;
-
- m_speed = speed;
-}
-
-int CEvent::GetSpeed()
-{
- return m_speed;
-}
-
-BOOL CEvent::GetPause()
-{
- return m_bPause;
-}
-
-int CEvent::MissionBack()
-{
- int num = m_mission;
-
- if (num % 10 == 0 ||
- num == 99)
- {
- m_mission = 1;
- return num / 10;
- }
- else
- {
- m_mission = num / 10 * 10;
- return (num < 0);
- }
-}
-
-void CEvent::DemoRecStart()
-{
- m_pDemoBuffer = (DemoEvent*)malloc(MAXDEMO*sizeof(DemoEvent));
- if ( m_pDemoBuffer == NULL ) return;
- memset(m_pDemoBuffer, 0, MAXDEMO*sizeof(DemoEvent));
-
- m_demoTime = 0;
- m_demoIndex = 0;
- m_bDemoRec = TRUE;
- m_bDemoPlay = FALSE;
-
- InitRandom();
- m_pDecor->SetTime(0);
- m_speed = 1;
-}
-
-void CEvent::DemoRecStop()
-{
- FILE* file = NULL;
- DemoHeader header;
-
- if ( m_bDemoPlay ) return;
-
- if ( m_pDemoBuffer != NULL )
- {
- DeleteFileA("data\\demo.3d.blp");
- file = fopen("data\\demo.3d.blp", "wb");
- if ( file != NULL )
- {
- memset(&header, 0, sizeof(DemoHeader));
- header.majRev = 1;
- header.minRev = 0;
- header.bSchool = m_bSchool;
- header.bPrivate = m_bPrivate;
- fwrite(&header, sizeof(DemoHeader), 1, file);
- fwrite(m_pDemoBuffer, sizeof(DemoEvent), m_demoIndex, file);
- fclose(file);
- }
- free(m_pDemoBuffer);
- m_pDemoBuffer = NULL;
- }
-
- m_bDemoRec = FALSE;
- m_demoTime = 0;
-}
-
-BOOL CEvent::DemoPlayStart()
-{
- char filename[MAX_PATH];
- FILE* file = NULL;
- DemoHeader header;
- int nb, world, time, total;
-
- m_pDemoBuffer = (DemoEvent*)malloc(MAXDEMO * sizeof(DemoEvent));
- if (m_pDemoBuffer == NULL) return FALSE;
- memset(m_pDemoBuffer, 0, MAXDEMO * sizeof(DemoEvent));
-
- sprintf(filename, "data\\demo%.3d.blp", m_demoNumber);
- AddCDPath(filename); // ajoute l'acc�s au CD-Rom
- file = fopen(filename, "rb");
- if (file == NULL)
- {
- DemoPlayStop();
- return FALSE;
- }
-
- nb = fread(&header, sizeof(DemoHeader), 1, file);
- if (nb < 1)
- {
- DemoPlayStop();
- return FALSE;
- }
- m_bSchool = header.bSchool;
- m_bPrivate = header.bPrivate;
- m_pDecor->SetSkill(header.skill);
-
- m_demoEnd = fread(m_pDemoBuffer, sizeof(DemoEvent), MAXDEMO, file);
- fclose(file);
-
- m_demoTime = 0;
- m_demoIndex = 0;
- m_bDemoPlay = TRUE;
- m_bDemoRec = FALSE;
-
- if (!m_pDecor->CurrentRead(header.world, FALSE, world, time, total))
- {
- DemoPlayStop();
- return FALSE;
- }
- ChangePhase(WM_PHASE_PLAY);
- InitRandom();
- m_pDecor->SetTime(0);
- m_speed = 1;
-
- return TRUE;
-}
-
-void CEvent::DemoPlayStop()
-{
- if (m_pDemoBuffer != NULL)
- {
- free(m_pDemoBuffer);
- m_pDemoBuffer = NULL;
- }
- m_bDemoPlay = FALSE;
- m_bDemoRec = FALSE;
- m_demoTime = 0;
- m_input = 0;
- m_pDecor->TreatEvent;
- m_private = 1;
- ChangePhase(WM_PHASE_INIT);
-}
-
-void CEvent::DemoStep()
-{
- int time;
- UINT message;
- WPARAM wParam;
- LPARAM lParam;
- POINT pos;
-
- if (m_phase == WM_PHASE_INIT)
- {
- if (m_demoTime > DEF_TIME_DEMO) // ~30 secondes �coul�es ?
- {
- m_demoNumber = 0;
- DemoPlayStart(); // d�marre une d�mo automatique
- }
- }
-
- if (m_bDemoPlay && // d�mo en lecture ?
- m_pDemoBuffer != NULL)
- {
- while (TRUE)
- {
- time = m_pDemoBuffer[m_demoIndex].time;
- if (time > m_demoTime) break;
-
- message = m_pDemoBuffer[m_demoIndex].message;
- wParam = m_pDemoBuffer[m_demoIndex].wParam;
- lParam = m_pDemoBuffer[m_demoIndex].lParam;
- m_demoIndex++;
-
- if (message == WM_MOUSEMOVE &&
- m_mouseType == MOUSETYPEWIN)
- {
- pos = ConvLongToPos(lParam);
- ClientToScreen(m_hWnd, &pos);
- SetCursorPos(pos.x, pos.y);
- }
-
- TreatEventBase(message, wParam, lParam);
-
- if (m_demoIndex >= m_demoEnd)
- {
- m_demoNumber++; // d�mo suivante
- if (!DemoPlayStart()) // d�marre la d�mo suivante
- {
- m_demoNumber = 0; // premi�re d�mo
- DemoPlayStart(); // d�marre la d�mo
- }
- return;
- }
- }
- }
-
- m_demoTime++;
-}
-
-void CEvent::DemoRecEvent(UINT message, UINT input, WPARAM wParam, LPARAM lParam)
-{
- if (m_demoIndex > 0 &&
- m_pDemoBuffer[m_demoIndex - 1].time == m_demoTime &&
- m_pDemoBuffer[m_demoIndex - 1].input == m_input)
-
- m_demoIndex++;
- if (m_demoIndex >= MAXDEMO)
- {
- DemoRecStop();
- }
-}
-
-BOOL CEvent::WriteInfo()
-{
- char filename[MAX_PATH];
- FILE* file = NULL;
- DescInfo info;
- int nb;
- int doors;
- GameData door[200];
-
- strcpy(filename, "data\\info%.blp");
- AddUserPath(filename);
-
- file = fopen(filename, "wb");
- if (file == NULL) goto error;
-
- info.majRev = 1;
- info.prive = m_private;
- info.mission = m_mission;
- info.multi = m_multi;
- info.lives = m_lives;
- info.speed = m_speed;
- info.bMovie = m_bMovie;
- info.bHiliInfoButton = m_bHiliInfoButton;
- info.bAccessBuild = m_bAccessBuild;
-
- m_pDecor->InitalizeDoors(door)
-
- info.audioVolume = m_pSound->GetAudioVolume();
- info.midiVolume = m_pSound->GetMidiVolume();
-
-
-
- nb = fwrite(&info, sizeof(DescInfo), 1, file);
- if (nb < 1) goto error;
-
- fclose(file);
- return TRUE;
-
-error:
- if (file != NULL) fclose(file);
- return FALSE;
-}
-
-BOOL CEvent::ReadInfo(int gamer)
-{
- char filename[MAX_PATH];
- FILE* file = NULL;
- DescInfo info;
- int nb;
- BYTE doors[200];
- char buffer[100];
-
-
- m_pDecor->InitGamer();
- m_lives = 3;
- m_mission = 1;
- m_private = 1;
- m_multi = 1;
-
- LoadString(TX_READINFO, buffer, 100);
- sprintf(m_gamerName, buffer, gamer);
- sprintf(filename, "data\\info%.3d.blp", gamer);
-
- strcpy(filename, "data\\info%.3d.blp");
- AddUserPath(filename);
-
- file = fopen(filename, "rb");
- if (file == NULL) goto error;
-
- nb = fread(&info, sizeof(DescInfo), 1, file);
- if (nb < 1) goto error;
-
-
- info.majRev = 1;
- info.prive = m_private;
- info.mission = m_mission;
- info.multi = m_multi;
- info.lives = m_lives;
- info.speed = m_speed;
- info.bMovie = m_bMovie;
- info.bHiliInfoButton = m_bHiliInfoButton;
- info.bAccessBuild = m_bAccessBuild;
-
- m_pDecor->SetAccessBuild(info.skill);
-
- m_pSound->SetAudioVolume(info.audioVolume);
- m_pSound->SetMidiVolume(info.midiVolume);
- m_pDecor->MemorizeDoors(doors);
-
- fclose(file);
- return TRUE;
-
-error:
- if (file != NULL) fclose(file);
- return FALSE;
-}
-
-BOOL CEvent::ReadPlayer()
-{
- char filename[MAX_PATH];
-
- m_playerIndex = 0;
-
- strcpy(filename, "data\\info%.3d.blp");
- AddUserPath(filename);
-}
\ No newline at end of file
diff --git a/network.cpp b/network.cpp
deleted file mode 100644
index 21134e5..0000000
--- a/network.cpp
+++ /dev/null
@@ -1,323 +0,0 @@
-// Network.cpp
-//
-
-#include
-#include
-#include "misc.h"
-#include "network.h"
-
-// a0f94abe-11c3-d111-be62-0040f6944838
-#define APP_GUID { 0xbe4af9a0, 0xc311, 0x11d1, { 0xbe, 0x62, 0x00, 0x40, 0xf6, 0x94, 0x48, 0x38 } };
-
-CNetwork::CNetwork()
-{
- m_pDP = NULL;
- m_dpid = 0;
- m_bHost = FALSE;
- m_providers.nb = 0;
- * m_providers.list = NULL;
- m_sessions.nb = 0;
- * m_sessions.list = NULL;
- m_unknown.nb = 0;
- * m_unknown.list = NULL;
-}
-
-CNetwork::~CNetwork()
-{
- FreeProviderList();
- FreeSessionList();
- FreeUnknownList();
- if (m_pDP) m_pDP->Release();
-}
-
-static BOOL EnumProvidersCallback(LPGUID lpguidSP, LPSTR lpSPName,
- DWORD dwMajorVersion, DWORD dwMinorVersion, NamedGUIDList * lpContext)
-{
- if (lpContext->nb < MAXSESSION)
- {
- lpContext->list[lpContext->nb]->guid = * lpguidSP;
- strcpy(lpContext->list[lpContext->nb]->name, lpSPName);
- lpContext->nb++;
- }
- return TRUE;
-}
-
-BOOL CNetwork::EnumProviders()
-{
- FreeProviderList();
- m_providers.nb = 0;
- * m_providers.list = (NamedGUID *) malloc(MAXSESSION * sizeof(NamedGUID));
-
- if (!m_providers.list) return FALSE;
-
- if (DirectPlayEnumerate((LPDPENUMDPCALLBACKA)EnumProvidersCallback, &m_providers) != DP_OK)
- {
- FreeProviderList();
- return FALSE;
- }
- return TRUE;
-}
-
-int CNetwork::GetNbProviders()
-{
- return m_providers.nb;
-}
-
-char * CNetwork::GetProviderName(int index)
-{
- if (index >= m_providers.nb) return NULL;
- return m_providers.list[index]->name;
-}
-
-BOOL CNetwork::CreateProvider(int index)
-{
- LPDIRECTPLAY lpDP;
- BOOL bOK = FALSE;
-
- if (index >= m_providers.nb) return FALSE;
-
- if (DirectPlayCreate(&m_providers.list[index]->guid, &lpDP, 0) == DP_OK)
- {
- if (lpDP->QueryInterface(IID_IDirectPlay2A, (LPVOID *) &m_pDP) == DP_OK)
- {
- return TRUE;
- }
- }
-
- if (lpDP != NULL) lpDP->Release();
- return FALSE;
-}
-
-void CNetwork::FreeProviderList()
-{
- if (m_providers.list) free(m_providers.list);
-
- m_providers.nb = 0;
- * m_providers.list = NULL;
-}
-
-static BOOL EnumSessionsCallback(LPDPSESSIONDESC2 lpThisSD,
- LPDWORD lpdwTimeOut, DWORD dwFlags, NamedGUIDList * lpContext)
-{
- if (dwFlags & DPESC_TIMEDOUT) return FALSE;
-
- if (lpContext->nb < MAXSESSION)
- {
- lpContext->list[lpContext->nb]->guid = lpThisSD->guidInstance;
- strcpy(lpContext->list[lpContext->nb]->name, lpThisSD->lpszSessionNameA);
- lpContext->nb++;
- }
- return TRUE;
-}
-
-BOOL CNetwork::EnumSessions()
-{
- DPSESSIONDESC2 desc;
-
- FreeSessionList();
- m_sessions.nb = 0;
- * m_sessions.list = (NamedGUID *) malloc(MAXSESSION * sizeof(NamedGUID));
-
- if (!m_sessions.list) return FALSE;
-
- ZeroMemory(&desc, sizeof(desc));
-
- desc.guidApplication = APP_GUID;
- desc.dwSize = sizeof(desc);
-
- if (m_pDP->EnumSessions(&desc, 0, (LPDPENUMSESSIONSCALLBACK2)EnumSessionsCallback, &m_sessions, DPENUMSESSIONS_AVAILABLE) != DP_OK)
- {
- FreeSessionList();
- return FALSE;
- }
-
- return TRUE;
-}
-
-char * CNetwork::GetSessionName(int index)
-{
- if (index >= m_sessions.nb) return NULL;
- return m_sessions.list[index]->name;
-}
-
-BOOL CNetwork::JoinSession(int index)
-{
- DPNAME name;
- DPSESSIONDESC2 desc;
- HRESULT hr;
-
- if (index > m_sessions.nb) return FALSE;
-
- ZeroMemory(&desc, sizeof(desc));
-
- desc.guidInstance = m_sessions.list[index]->guid;
-
- hr = m_pDP->Open(&desc, DPOPEN_OPENSESSION);
- if (hr != DP_OK)
- {
- TraceErrorDP(hr);
- return FALSE;
- }
-
- name.dwFlags = 0;
- name.dwSize = sizeof(name);
- name.lpszLongNameA = NULL;
-
- hr = m_pDP->CreatePlayer(&m_dpid, &name, NULL, NULL, 0, 0);
- if (hr != DP_OK)
- {
- TraceErrorDP(hr);
- m_pDP->Close();
- return FALSE;
- }
- else
- {
- m_bHost = FALSE;
- return TRUE;
- }
-}
-
-void CNetwork::FreeSessionList()
-{
- if (m_sessions.list) free(m_sessions.list);
-
- m_sessions.nb = 0;
- * m_sessions.list = NULL;
-}
-
-BOOL CNetwork::CreateSession(char * pName)
-{
- DPSESSIONDESC2 desc;
- HRESULT hr;
-
- ZeroMemory(&desc, sizeof(desc));
-
- desc.guidApplication = APP_GUID;
- desc.lpszSessionNameA = pName;
- desc.dwSize = sizeof(desc);
- desc.dwFlags = DPSESSION_KEEPALIVE | DPSESSION_MIGRATEHOST;
- desc.dwMaxPlayers = MAXNETPLAYER;
-
- hr = m_pDP->Open(&desc, DPOPEN_CREATE);
- if (hr != DP_OK)
- {
- TraceErrorDP(hr);
- m_pDP->Close();
- return FALSE;
- }
- else
- {
- m_bHost = TRUE;
- return TRUE;
- }
-}
-
-BOOL CNetwork::Send(LPVOID lpData, DWORD dwDataSize, DWORD dwFlags)
-{
- HRESULT hr;
-
- if (!m_pDP) return FALSE;
-
- if (hr = m_pDP->Send(m_dpid, 0, !!dwFlags, lpData, dwDataSize), hr != DP_OK)
- {
- TraceErrorDP(hr);
- return FALSE;
- }
- return TRUE;
-}
-
-BOOL CNetwork::Receive(LPVOID pDest, DWORD dwDataSize, LPDWORD lpdwPlayer)
-{
- DPID from = 0, to = 0, dataSize = 500;
- char dataBuffer[500];
- HRESULT hr;
-
- hr = m_pDP->Receive(&from, &to, DPRECEIVE_ALL, dataBuffer, &dataSize);
- if (hr != DP_OK)
- {
- if (hr != DPERR_NOMESSAGES) TraceErrorDP(hr);
- return FALSE;
- }
-
- ZeroMemory(pDest, dwDataSize);
-
- *lpdwPlayer = -1;
- for (int i = 0; i < MAXNETPLAYER; i++)
- {
- if (m_players[i].bIsPresent && from == i)
- {
- *lpdwPlayer = i;
- break;
- }
- }
-
- return TRUE;
-}
-
-BOOL CNetwork::Close()
-{
- return m_pDP->Close() == DP_OK;
-}
-
-void CNetwork::FreeUnknownList()
-{
- if (m_unknown.list) free(m_unknown.list);
-
- m_unknown.nb = 0;
- * m_unknown.list = NULL;
-}
-
-BOOL CNetwork::IsHost()
-{
- return m_bHost;
-}
-
-void TraceErrorDP(HRESULT hErr)
-{
- char dperr[256];
- char err[1024];
-
- switch (hErr)
- {
- case DPERR_OUTOFMEMORY : sprintf(dperr, "DPERR_OUTOFMEMORY"); break;
- case DPERR_UNSUPPORTED : sprintf(dperr, "DPERR_UNSUPPORTED"); break;
- case DPERR_NOINTERFACE : sprintf(dperr, "DPERR_NOINTERFACE"); break;
- case DPERR_GENERIC : sprintf(dperr, "DPERR_GENERIC"); break;
- case DPERR_INVALIDPARAMS : sprintf(dperr, "DPERR_INVALIDPARAMS"); break;
- case DPERR_ACTIVEPLAYERS : sprintf(dperr, "DPERR_ACTIVEPLAYERS"); break;
- case DPERR_ACCESSDENIED : sprintf(dperr, "DPERR_ACCESSDENIED"); break;
- case DPERR_CANTADDPLAYER : sprintf(dperr, "DPERR_CANTADDPLAYER"); break;
- case DPERR_CANTCREATEPLAYER : sprintf(dperr, "DPERR_CANTCREATEPLAYER"); break;
- case DPERR_CANTCREATEGROUP : sprintf(dperr, "DPERR_CANTCREATEGROUP"); break;
- case DPERR_CANTCREATESESSION: sprintf(dperr, "DPERR_CANTCREATESESSION"); break;
- case DPERR_CAPSNOTAVAILABLEYET : sprintf(dperr, "DPERR_CAPTSNOTAVAILABLEYET"); break;
- case DPERR_ALREADYINITIALIZED : sprintf(dperr, "DPERR_ALREADYINITIALIZED"); break;
- case DPERR_INVALIDFLAGS: sprintf(dperr, "DPERR_INVALIDFLAGS"); break;
- case DPERR_EXCEPTION: sprintf(dperr, "DPERR_EXCEPTION"); break;
- case DPERR_INVALIDPLAYER: sprintf(dperr, "DPERR_INVALIDPLAYER"); break;
- case DPERR_INVALIDOBJECT: sprintf(dperr, "DPERR_INVALIDOBJECT"); break;
- case DPERR_NOCONNECTION: sprintf(dperr, "DPERR_NOCONNECTION"); break;
- case DPERR_NONAMESERVERFOUND: sprintf(dperr, "DPERR_NONAMESERVERFOUND"); break;
- case DPERR_NOMESSAGES: sprintf(dperr, "DPERR_NOMESSAGES"); break;
- case DPERR_NOSESSIONS: sprintf(dperr, "DPERR_NOSESSIONS"); break;
- case DPERR_NOPLAYERS: sprintf(dperr, "DPERR_NOPLAYERS"); break;
- case DPERR_TIMEOUT: sprintf(dperr, "DPERR_TIMEOUT"); break;
- case DPERR_SENDTOOBIG: sprintf(dperr, "DPERR_SENDTOOBIG"); break;
- case DPERR_BUSY: sprintf(dperr, "DPERR_BUSY"); break;
- case DPERR_UNAVAILABLE: sprintf(dperr, "DPERR_UNAVAILABLE"); break;
- case DPERR_PLAYERLOST: sprintf(dperr, "DPERR_PLAYERLOST"); break;
- case DPERR_USERCANCEL: sprintf(dperr, "DPERR_USERCANCEL"); break;
- case DPERR_BUFFERTOOLARGE: sprintf(dperr, "DPERR_BUFFERTOOLARGE"); break;
- case DPERR_SESSIONLOST: sprintf(dperr, "DPERR_SESSIONLOST"); break;
- case DPERR_APPNOTSTARTED: sprintf(dperr, "DPERR_APPNOTSTARTED"); break;
- case DPERR_CANTCREATEPROCESS: sprintf(dperr, "DPERR_CANTCREATEPROCESS"); break;
- case DPERR_UNKNOWNAPPLICATION: sprintf(dperr, "DPERR_UNKNOWNAPPLICATION"); break;
- case DPERR_INVALIDINTERFACE: sprintf(dperr, "DPERR_INVALIDINTERFACE"); break;
- case DPERR_NOTLOBBIED: sprintf(dperr, "DPERR_NOTLOBBIED"); break;
- case DP_OK: sprintf(dperr, "DP_OK"); break;
-
- default : sprintf(dperr, "Unknown Error"); break;
- }
- sprintf(err, "DirectPlay Error %s\n", dperr);
- OutputDebug(err);
-}
\ No newline at end of file
diff --git a/resource/Eggbert2.aps b/resource/Eggbert2.aps
new file mode 100644
index 0000000..d2e5440
Binary files /dev/null and b/resource/Eggbert2.aps differ
diff --git a/Eggbert2.rc b/resource/Eggbert2.rc
similarity index 90%
rename from Eggbert2.rc
rename to resource/Eggbert2.rc
index ee78f52..5b40d06 100644
Binary files a/Eggbert2.rc and b/resource/Eggbert2.rc differ
diff --git a/IDC_ARROW.cur b/resource/IDC_ARROW.cur
similarity index 100%
rename from IDC_ARROW.cur
rename to resource/IDC_ARROW.cur
diff --git a/IDC_ARROWD.cur b/resource/IDC_ARROWD.cur
similarity index 100%
rename from IDC_ARROWD.cur
rename to resource/IDC_ARROWD.cur
diff --git a/IDC_ARROWDL.cur b/resource/IDC_ARROWDL.cur
similarity index 100%
rename from IDC_ARROWDL.cur
rename to resource/IDC_ARROWDL.cur
diff --git a/IDC_ARROWDR.cur b/resource/IDC_ARROWDR.cur
similarity index 100%
rename from IDC_ARROWDR.cur
rename to resource/IDC_ARROWDR.cur
diff --git a/IDC_ARROWL.cur b/resource/IDC_ARROWL.cur
similarity index 100%
rename from IDC_ARROWL.cur
rename to resource/IDC_ARROWL.cur
diff --git a/IDC_ARROWR.cur b/resource/IDC_ARROWR.cur
similarity index 100%
rename from IDC_ARROWR.cur
rename to resource/IDC_ARROWR.cur
diff --git a/IDC_ARROWU.cur b/resource/IDC_ARROWU.cur
similarity index 100%
rename from IDC_ARROWU.cur
rename to resource/IDC_ARROWU.cur
diff --git a/IDC_ARROWUL.cur b/resource/IDC_ARROWUL.cur
similarity index 100%
rename from IDC_ARROWUL.cur
rename to resource/IDC_ARROWUL.cur
diff --git a/IDC_ARROWUR.cur b/resource/IDC_ARROWUR.cur
similarity index 100%
rename from IDC_ARROWUR.cur
rename to resource/IDC_ARROWUR.cur
diff --git a/IDC_EMPTY.cur b/resource/IDC_EMPTY.cur
similarity index 100%
rename from IDC_EMPTY.cur
rename to resource/IDC_EMPTY.cur
diff --git a/IDC_FILL.cur b/resource/IDC_FILL.cur
similarity index 100%
rename from IDC_FILL.cur
rename to resource/IDC_FILL.cur
diff --git a/IDC_MAP.cur b/resource/IDC_MAP.cur
similarity index 100%
rename from IDC_MAP.cur
rename to resource/IDC_MAP.cur
diff --git a/IDC_POINTER.cur b/resource/IDC_POINTER.cur
similarity index 100%
rename from IDC_POINTER.cur
rename to resource/IDC_POINTER.cur
diff --git a/IDC_WAIT.cur b/resource/IDC_WAIT.cur
similarity index 100%
rename from IDC_WAIT.cur
rename to resource/IDC_WAIT.cur
diff --git a/IDR_MAINFRAME.ico b/resource/IDR_MAINFRAME.ico
similarity index 100%
rename from IDR_MAINFRAME.ico
rename to resource/IDR_MAINFRAME.ico
diff --git a/Resource.aps b/resource/Resource.aps
similarity index 100%
rename from Resource.aps
rename to resource/Resource.aps
diff --git a/cursor1.cur b/resource/cursor1.cur
similarity index 100%
rename from cursor1.cur
rename to resource/cursor1.cur
diff --git a/sound.cpp b/sound.cpp
deleted file mode 100644
index de21406..0000000
--- a/sound.cpp
+++ /dev/null
@@ -1,685 +0,0 @@
-// sound.cpp
-//
-
-#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;
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-// The following macro are used for proper error handling for DirectSound.
-#define TRY_DS(exp) { { HRESULT rval = exp; if (rval != DS_OK) { TraceErrorDS(rval, __FILE__, __LINE__); return FALSE; } } }
-
-
-struct WaveHeader
-{
- BYTE RIFF[4]; // "RIFF"
- DWORD dwSize; // Size of data to follow
- BYTE WAVE[4]; // "WAVE"
- BYTE fmt_[4]; // "fmt "
- DWORD dw16; // 16
- WORD wOne_0; // 1
- WORD wChnls; // Number of Channels
- DWORD dwSRate; // Sample Rate
- DWORD BytesPerSec; // Sample Rate
- WORD wBlkAlign; // 1
- WORD BitsPerSample; // Sample size
- BYTE DATA[4]; // "DATA"
- DWORD dwDSize; // Number of Samples
-};
-
-
-
-
-// Creates a DirectSound buffer.
-
-BOOL CSound::CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, BOOL bStereo)
-{
- PCMWAVEFORMAT pcmwf;
- DSBUFFERDESC dsbdesc;
-
- // Set up wave format structure.
- memset( &pcmwf, 0, sizeof(PCMWAVEFORMAT) );
- pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM;
- pcmwf.wf.nChannels = bStereo ? 2 : 1;
- pcmwf.wf.nSamplesPerSec = dwFreq;
- pcmwf.wf.nBlockAlign = (WORD)dwBlkAlign;
- pcmwf.wf.nAvgBytesPerSec = pcmwf.wf.nSamplesPerSec * pcmwf.wf.nBlockAlign;
- pcmwf.wBitsPerSample = (WORD)dwBitsPerSample;
-
- // Set up DSBUFFERDESC structure.
- memset(&dsbdesc, 0, sizeof(DSBUFFERDESC)); // Zero it out.
- dsbdesc.dwSize = sizeof(DSBUFFERDESC);
- dsbdesc.dwFlags = DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME;
- dsbdesc.dwBufferBytes = dwBufSize;
- dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf;
-
- TRY_DS(m_lpDS->CreateSoundBuffer(&dsbdesc, &m_lpDSB[dwBuf], NULL), 63)
- return TRUE;
-}
-
-// I dunno what the fuck this does.
-/*
-BOOL CSound::ErrorSomething()
-{
- if (m_lpDS ||
- m_lpDSB != 0)
- {
- m_lpDS, m_lpDSB->TraceErrorDS;
- return FALSE;
- }
- return TRUE;
-}
-*/
-
-
-// Reads in data from a wave file.
-
-BOOL CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos)
-{
- // Seek to correct position in file (if necessary)
- if ( dwPos != 0xffffffff )
- {
- if ( fseek(pFile, dwPos, SEEK_SET) != 0 )
- {
- return FALSE;
- }
- }
-
- // Lock data in buffer for writing
- LPVOID pData1;
- DWORD dwData1Size;
- LPVOID pData2;
- DWORD dwData2Size;
- HRESULT rval;
-
- rval = lpDSB->Lock(0, dwSize, &pData1, &dwData1Size, &pData2, &dwData2Size, DSBLOCK_FROMWRITECURSOR);
- if ( rval != DS_OK )
- {
- return FALSE;
- }
-
- // Read in first chunk of data
- if ( dwData1Size > 0 )
- {
- if ( fread(pData1, dwData1Size, 1, pFile) != 1 )
- {
- char holder[256];
- wsprintfA(holder,"Data1 : %d, dwdata: %d, pFile: %d",pData1,dwData1Size,pFile);
- OutputDebug(holder);
- return FALSE;
- }
- }
-
- // read in second chunk if necessary
- if ( dwData2Size > 0 )
- {
- if ( fread(pData2, dwData2Size, 1, pFile) != 1 )
- {
- return FALSE;
- }
- }
-
- // Unlock data in buffer
- rval = lpDSB->Unlock(pData1, dwData1Size, pData2, dwData2Size);
- if ( rval != DS_OK )
- {
- return FALSE;
- }
-
- return TRUE;
-}
-
-// Creates a DirectSound buffer from a wave file.
-
-BOOL CSound::CreateBufferFromWaveFile(int dwBuf, char *pFileName)
-{
- // Open the wave file
- FILE* pFile = fopen(pFileName, "rb");
- if ( pFile == NULL ) return FALSE;
-
- // Read in the wave header
- WaveHeader wavHdr;
- if ( fread(&wavHdr, sizeof(wavHdr), 1, pFile) != 1 )
- {
- fclose(pFile);
- return NULL;
- }
-
- // Figure out the size of the data region
- DWORD dwSize = wavHdr.dwDSize;
-
- // Is this a stereo or mono file?
- BOOL bStereo = wavHdr.wChnls > 1 ? TRUE : FALSE;
-
- // Create the sound buffer for the wave file
- if ( !CreateSoundBuffer(dwBuf, dwSize, wavHdr.dwSRate,
- wavHdr.BitsPerSample, wavHdr.wBlkAlign, bStereo) )
- {
- // Close the file
- fclose(pFile);
-
- return FALSE;
- }
-
- // Read the data for the wave file into the sound buffer
- if ( !ReadData(m_lpDSB[dwBuf], pFile, dwSize, sizeof(wavHdr)) )
- {
- fclose(pFile);
- return FALSE;
- }
-
- // Close out the wave file
- fclose(pFile);
-
- return TRUE;
-}
-
-// Stops all sounds.
-
-BOOL CSound::StopAllSounds()
-{
- // Make sure we have a valid sound buffer
- for (int i = 0; i < MAXSOUND; i ++)
- {
- if ( m_lpDSB[i] )
- {
- DWORD dwStatus;
- TRY_DS(m_lpDSB[i]->GetStatus(&dwStatus));
-
- if ( (dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING )
- {
- TRY_DS(m_lpDSB[i]->Stop())
- }
- }
- }
-
- return TRUE;
-}
-
-// Plays a sound using direct sound.
-
-BOOL CSound::PlaySoundDS(DWORD dwSound, DWORD dwFlags)
-{
- // Make sure the sound is valid
- if ( dwSound >= MAXSOUND ) return FALSE;
-
- // Make sure we have a valid sound buffer
- if ( m_lpDSB[dwSound] )
- {
- DWORD dwStatus;
- TRY_DS(m_lpDSB[dwSound]->GetStatus(&dwStatus));
-
- if ( (dwStatus & DSBSTATUS_PLAYING) != DSBSTATUS_PLAYING )
- {
- // Play the sound
- TRY_DS(m_lpDSB[dwSound]->Play(0, 0, dwFlags));
- }
- }
-
- return TRUE;
-}
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-
-// Modifie le volume midi.
-// Le volume est compris entre 0 et 20 !
-
-void InitMidiVolume(int volume)
-{
- int nb, i, n;
- MMRESULT result;
- HMIDIOUT hmo = 0;
-
- static int table[21] =
- {
- 0x00000000,
- 0x11111111,
- 0x22222222,
- 0x33333333,
- 0x44444444,
- 0x55555555,
- 0x66666666,
- 0x77777777,
- 0x88888888,
- 0x99999999,
- 0xAAAAAAAA,
- 0xBBBBBBBB,
- 0xCCCCCCCC,
- 0xDDDDDDDD,
- 0xEEEEEEEE,
- 0xF222F222,
- 0xF555F555,
- 0xF777F777,
- 0xFAAAFAAA,
- 0xFDDDFDDD,
- 0xFFFFFFFF,
- };
-
- if ( volume < 0 ) volume = 0;
- if ( volume > MAXVOLUME ) volume = MAXVOLUME;
-
- nb = midiOutGetNumDevs();
- for ( i=0 ; iRelease();
- m_lpDSB[i]= NULL;
- }
- }
-
- if ( m_lpDS != NULL )
- {
- m_lpDS->Release();
- m_lpDS = NULL;
- }
-}
-
-
-// Initialisation de DirectSound.
-
-BOOL CSound::Create(HWND hWnd)
-{
- if ( !DirectSoundCreate(NULL, &m_lpDS, NULL) == DS_OK )
- {
- OutputDebug("Fatal error: DirectSoundCreate\n");
- m_bEnable = FALSE;
- return FALSE;
- }
-
- m_lpDS->SetCooperativeLevel(hWnd, DSSCL_NORMAL);
- m_bEnable = TRUE;
- m_hWnd = hWnd;
- return TRUE;
-}
-
-
-// Retourne l'�tat de DirectSound.
-
-BOOL CSound::GetEnable()
-{
- return m_bEnable;
-}
-
-
-// Enclenche ou d�clenche le son.
-
-void CSound::SetState(BOOL bState)
-{
- m_bState = bState;
-}
-
-
-// Gestion des volumes audio (.wav) et midi (.mid).
-
-void CSound::SetAudioVolume(int volume)
-{
- m_audioVolume = volume;
-}
-
-int CSound::GetAudioVolume()
-{
- if ( !m_bEnable ) return 0;
- return m_audioVolume;
-}
-
-void CSound::SetMidiVolume(int volume)
-{
- m_midiVolume = volume;
-}
-
-int CSound::GetMidiVolume()
-{
- if ( !m_bEnable ) return 0;
- return m_midiVolume;
-}
-
-
-// Cache tous les ficheirs son (.wav).
-
-void CSound::CacheAll()
-{
- int i;
- char name[50];
-
- if ( !m_bEnable ) return;
-
- for ( i=0 ; i= MAXSOUND ) return FALSE;
-
- if ( m_lpDSB[channel] != NULL )
- {
- Flush(channel);
- }
-
- return CreateBufferFromWaveFile(channel, pFilename);
-}
-
-// D�charge un son.
-
-void CSound::Flush(int channel)
-{
- if ( !m_bEnable ) return;
- if ( channel < 0 || channel >= MAXSOUND ) return;
-
- if ( m_lpDSB[channel] != NULL )
- {
- m_lpDSB[channel]->Release();
- m_lpDSB[channel]= NULL;
- }
-}
-
-// Fait entendre un son.
-// Le volume est compris entre 0 (max) et -10000 (silence).
-// Le panoramique est compris entre -10000 (gauche), 0 (centre)
-// et +10000 (droite).
-
-BOOL CSound::Play(int channel, int volume, int pan)
-{
- if ( !m_bEnable ) return TRUE;
- if ( !m_bState || m_audioVolume == 0 ) return TRUE;
-
- volume -= (MAXVOLUME-m_audioVolume)*((10000/4)/MAXVOLUME);
-
-//? if ( volume == -10000 ) return TRUE;
- if ( volume <= -10000/4 ) return TRUE;
-
- if ( channel < 0 || channel >= MAXSOUND ) return FALSE;
- if ( m_lpDSB[channel] == NULL ) return FALSE;
-
- m_lpDSB[channel]->SetVolume(volume);
- m_lpDSB[channel]->SetPan(pan);
- m_lpDSB[channel]->Play(0, 0, 0);
-
- return TRUE;
-}
-
-BOOL CSound::StopSound(Sound channel)
-{
- if (m_bEnable) return FALSE;
- if (m_bState || m_audioVolume == 0) return FALSE;
-
- if (0 < channel || channel < MAXSOUND)
- {
- if (m_lpDSB[channel] == NULL)
- return (BOOL)m_lpDSB[channel];
- m_lpDSB[channel]->Stop();
- m_lpDSB[channel]->SetCurrentPosition(0);
- return TRUE;
- }
- return FALSE;
-}
-
-// Fait entendre un son dans une image.
-// Si rank != -1, il indique le rang du blupi dont il faudra
-// �ventuellement stopper le dernier son en cours !
-
-BOOL CSound::PlayImage(int channel, POINT pos, int rank)
-{
- int stopCh, volumex, volumey, volume, pan;
-
- if ( rank >= 0 && rank < MAXBLUPI )
- {
- stopCh = m_channelBlupi[rank];
- if ( stopCh >= 0 && m_lpDSB[stopCh] != NULL )
- {
- m_lpDSB[stopCh]->Stop(); // stoppe le son pr�c�dent
- m_lpDSB[stopCh]->SetCurrentPosition(0);
- }
-
- m_channelBlupi[rank] = channel;
- }
-
-//? pan = (int)(((long)pos.x*20000L)/LXIMAGE)-10000L;
-//? pan = (int)(((long)pos.x*10000L)/LXIMAGE)-5000L;
- pan = (int)(((long)pos.x*5000L)/LXIMAGE)-2500L;
-
- volumex = 0; // volume maximum
- if ( pos.x < 0 )
- {
- volumex = (pos.x*2500)/LXIMAGE;
- }
- if ( pos.x > LXIMAGE )
- {
- pos.x -= LXIMAGE;
- volumex = (-pos.x*2500)/LXIMAGE;
- }
- if ( volumex < -10000 ) volumex = -10000;
-
- volumey = 0; // volume maximum
- if ( pos.y < 0 )
- {
- volumey = (pos.y*2500)/LYIMAGE;
- }
- if ( pos.y > LYIMAGE )
- {
- pos.y -= LYIMAGE;
- volumey = (-pos.y*2500)/LYIMAGE;
- }
- if ( volumey < -10000 ) volumey = -10000;
-
- if ( volumex < volumey ) volume = volumex;
- else volume = volumey;
-
- return Play(channel, volume, pan);
-}
-
-
-// Uses MCI to play a MIDI file. The window procedure
-// is notified when playback is complete.
-
-BOOL CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename)
-{
- MCI_OPEN_PARMS mciOpenParms;
- MCI_PLAY_PARMS mciPlayParms;
- DWORD dwReturn;
- char string[MAX_PATH];
-
- if ( !m_bEnable ) return TRUE;
- if ( m_midiVolume == 0 ) return TRUE;
- InitMidiVolume(m_midiVolume);
- m_lastMidiVolume = m_midiVolume;
-
- if ( lpszMIDIFilename[1] == ':' ) // nom complet "D:\REP..." ?
- {
- strcpy(string, lpszMIDIFilename);
- }
- else
- {
- GetCurrentDir(string, MAX_PATH-30);
- strcat(string, lpszMIDIFilename);
- }
-
- // Open the device by specifying the device and filename.
- // MCI will attempt to choose the MIDI mapper as the output port.
- mciOpenParms.lpstrDeviceType = (LPCWSTR)"sequencer";
- mciOpenParms.lpstrElementName = (LPCWSTR)string;
- dwReturn = mciSendCommand(NULL,
- MCI_OPEN,
- MCI_OPEN_TYPE|MCI_OPEN_ELEMENT,
- (DWORD)(LPVOID)&mciOpenParms);
- if ( dwReturn != 0 )
- {
- OutputDebug("PlayMusic-1\n");
- mciGetErrorStringA(dwReturn, string, 128);
- OutputDebug(string);
- // Failed to open device. Don't close it; just return error.
- return FALSE;
- }
-
- // The device opened successfully; get the device ID.
- m_MidiDeviceID = mciOpenParms.wDeviceID;
-
- // Begin playback.
- mciPlayParms.dwCallback = (DWORD)hWnd;
- dwReturn = mciSendCommand(m_MidiDeviceID,
- MCI_PLAY,
- MCI_NOTIFY,
- (DWORD)(LPVOID)&mciPlayParms);
- if ( dwReturn != 0 )
- {
- OutputDebug("PlayMusic-2\n");
- mciGetErrorStringA(dwReturn, string, 128);
- OutputDebug(string);
- StopMusic();
- return FALSE;
- }
-
- strcpy(m_MIDIFilename, lpszMIDIFilename);
-
- return TRUE;
-}
-
-// Restart the MIDI player.
-
-BOOL CSound::RestartMusic()
-{
- OutputDebug("RestartMusic\n");
- if ( !m_bEnable ) return TRUE;
- if ( m_midiVolume == 0 ) return TRUE;
- if ( m_MIDIFilename[0] == 0 ) return FALSE;
-
- return PlayMusic(m_hWnd, m_MIDIFilename);
-}
-
-// Shuts down the MIDI player.
-
-void CSound::SuspendMusic()
-{
- if ( !m_bEnable ) return;
-
- if ( m_nbSuspendSkip != 0 )
- {
- m_nbSuspendSkip --;
- return;
- }
-
- if ( m_MidiDeviceID && m_midiVolume != 0 )
- {
- mciSendCommand(m_MidiDeviceID, MCI_CLOSE, 0, NULL);
- }
- m_MidiDeviceID = 0;
-}
-
-// Shuts down the MIDI player.
-
-void CSound::StopMusic()
-{
- SuspendMusic();
- m_MIDIFilename[0] = 0;
-}
-
-// Retourne TRUE si une musique est en cours.
-
-BOOL CSound::IsPlayingMusic()
-{
- return (m_MIDIFilename[0] != 0);
-}
-
-// Adapte le volume de la musique en cours, si n�cessaire.
-
-void CSound::AdaptVolumeMusic()
-{
- if ( m_midiVolume != m_lastMidiVolume )
- {
- InitMidiVolume(m_midiVolume);
- m_lastMidiVolume = m_midiVolume;
- RestartMusic();
- }
-}
-
-// Indique le nombre de suspend � sauter.
-
-void CSound::SetSuspendSkip(int nb)
-{
- m_nbSuspendSkip = nb;
-}
-
diff --git a/sound.h b/sound.h
deleted file mode 100644
index 2d28d5b..0000000
--- a/sound.h
+++ /dev/null
@@ -1,102 +0,0 @@
-// sound.h
-//
-
-using namespace std;
-
-#pragma once
-
-#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
-{
-public:
- CSound();
- ~CSound();
-
- BOOL ErrorSomething();
- BOOL Create(HWND hWnd);
- void SetState(BOOL bState);
- BOOL GetEnable();
-
- void SetAudioVolume(int volume);
- int GetAudioVolume();
- void SetMidiVolume(int volume);
- int GetMidiVolume();
- void SetCDAudio(BOOL bCDAudio);
-
- void CacheAll();
- BOOL Cache(int channel, char *pFilename);
- void Flush(int channel);
-
- BOOL Play (int channel, int volume=0, int pan=0);
- BOOL StopSound(int channel);
- BOOL PlayImage(int channel, POINT pos, int rank=-1);
- BOOL PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename);
- BOOL RestartMusic();
- void SuspendMusic();
- void StopMusic();
- BOOL IsPlayingMusic();
- void AdaptVolumeMusic();
- void SetSuspendSkip(int nb);
-
-protected:
- BOOL CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, BOOL bStereo);
- BOOL ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos);
- BOOL CreateBufferFromWaveFile(int dwBuf, char *pFileName);
- BOOL StopAllSounds();
- BOOL PlaySoundDS(DWORD dwSound, DWORD dwFlags);
-
-protected:
- HWND m_hWnd;
- BOOL m_bEnable;
- BOOL m_bState;
- BOOL m_bCDAudio;
- LPDIRECTSOUND m_lpDS;
- LPDIRECTSOUNDBUFFER m_lpDSB[MAXSOUND];
- short m_channelBlupi[MAXBLUPI];
- UINT m_MidiDeviceID;
- char m_MIDIFilename[50];
- int m_audioVolume;
- int m_midiVolume;
- int m_lastMidiVolume;
- int m_nbSuspendSkip;
-};
\ No newline at end of file
diff --git a/blupi.cpp b/src/blupi.cpp
similarity index 52%
rename from blupi.cpp
rename to src/blupi.cpp
index ec6ccd4..3e05896 100644
--- a/blupi.cpp
+++ b/src/blupi.cpp
@@ -5,10 +5,6 @@
#pragma once
-#pragma comment(lib, "winmm.lib")
-
-using namespace std;
-
#include
#include
#include
@@ -16,7 +12,6 @@ using namespace std;
#include
#include
#include
-//#include
#include
#include "def.h"
#include "resource.h"
@@ -38,21 +33,24 @@ using namespace std;
#define NAME "Blupi"
#ifdef _EGAMES
- #define TITLE "Eggbert"
+#define TITLE "Eggbert"
#else
- #define TITLE "Blupi"
+#define TITLE "Blupi"
#endif
+#define MMTIMER FALSE
+#define THREAD FALSE
+
// Variables Globals
-HWND g_hWnd; // handle la fentre
-CEvent* g_pEvent = NULL;
+HWND g_hWnd; // handle à la fenètre
+CEvent* g_pEvent = NULL;
CPixmap* g_pPixmap = NULL; // pixmap principal
-CSound* g_pSound = NULL; // sound principal
-CMovie* g_pMovie = NULL; // movie principal
-CDecor* g_pDecor = NULL;
-CNetwork* g_pNetwork;
-char g_CDPath[MAX_PATH]; // chemin d'accs au CD-Rom
+CSound* g_pSound = NULL; // sound principal
+CMovie* g_pMovie = NULL; // movie principal
+CDecor* g_pDecor = NULL;
+CNetwork* g_pNetwork = NULL;
+char g_CDPath[MAX_PATH]; // chemin d'accès au CD-Rom
BOOL g_bFullScreen = FALSE; // FALSE si mode de test
int g_speedRate = 1;
int g_timerInterval = 50; // inverval = 50ms
@@ -61,25 +59,16 @@ int g_benchmark;
BOOL g_bBenchmarkSuccess;
BOOL g_bTrueColorBack;
BOOL g_bTrueColorDecor;
-BOOL g_bCDAudio;
+BOOL g_bCDAudio = FALSE;
int g_something;
-MMRESULT g_updateTimer; // timer gnral
+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;
-
-// Lit un numro dcimal.
+// Lit un numéro décimal.
int GetNum(char *p)
{
@@ -94,58 +83,56 @@ int GetNum(char *p)
return n;
}
-// Lit le fichier de configuration.
-
-BOOL ReadConfig (LPSTR lpCmdLine)
+BOOL ReadConfig(LPSTR lpCmdLine)
{
- FILE* file = NULL;
- char buffer[200];
- char* pText;
- int nb;
+ FILE* file = NULL;
+ char buffer[200];
+ char* pText;
+ int nb;
int i;
MEMORYSTATUS mem;
- file = fopen("data\\config.def", "rb");
- if ( file == NULL ) return FALSE;
- nb = fread(buffer, sizeof(char), 200-1, file);
- buffer[nb] = 0;
- fclose(file);
+ file = fopen("data\\config.def", "rb");
+ if (file == NULL) return FALSE;
+ nb = fread(buffer, sizeof(char), 200 - 1, file);
+ buffer[nb] = 0;
+ fclose(file);
-#if !_NOCD
- pText = strstr(buffer, "CD-Rom=");
- if ( pText == NULL )
- {
+#if _CD
+ pText = strstr(buffer, "CD-Rom=");
+ if (pText == NULL)
+ {
#if _DEMO
- GetCurrentDirectory(MAX_PATH, g_CDPath);
- i = strlen (g_CDPath);
- if ( i > 0 && g_CDPath [i-1] != '\\' )
- {
- g_CDPath[i++] = '\\';
- g_CDPath[i] = 0;
- }
+ GetCurrentDirectory(MAX_PATH, g_CDPath);
+ i = strlen(g_CDPath);
+ if (i > 0 && g_CDPath[i - 1] != '\\')
+ {
+ g_CDPath[i++] = '\\';
+ g_CDPath[i] = 0;
+ }
#else
- return FALSE;
-#endif
+ return FALSE;
+#endif // _DEMO
}
else
{
pText += 7;
i = 0;
- while ( pText[i] != 0 && pText[i] != '\n' && pText[i] != '\r' )
+ while (pText[i] != 0 && pText[i] != '\n' && pText[i] != '\r')
{
g_CDPath[i] = pText[i];
- i ++;
+ i++;
}
- if ( i > 0 && g_CDPath[i-1] != '\\' )
+ if (i > 0 && g_CDPath[i - 1] != '\\')
{
g_CDPath[i++] = '\\';
}
g_CDPath[i] = 0; // met le terminateur
}
-#if !_DEMO & !_EGAMES
- if ( strstr(lpCmdLine, "-nocd") == NULL )
+#if !_DEMO && !_EGAMES
+ if (strstr(lpCmdLine, "-nocd") == NULL)
{
char drive[10];
@@ -154,48 +141,48 @@ BOOL ReadConfig (LPSTR lpCmdLine)
drive[2] = '\\';
drive[3] = 0;
nb = GetDriveType(drive);
- if ( nb != DRIVE_CDROM ) return FALSE;
+ if (nb != DRIVE_CDROM) return FALSE;
}
-#endif
-#endif
+#endif // !_DEMO && !_EGAMES
+#endif // _CD
pText = strstr(buffer, "SpeedRate=");
- if ( pText != NULL )
+ if (pText != NULL)
{
- g_speedRate = GetNum(pText+10);
- if ( g_speedRate < 1 ) g_speedRate = 1;
- if ( g_speedRate > 2 ) g_speedRate = 2;
+ g_speedRate = GetNum(pText + 10);
+ if (g_speedRate < 1) g_speedRate = 1;
+ if (g_speedRate > 2) g_speedRate = 2;
}
pText = strstr(buffer, "Timer=");
- if ( pText != NULL )
+ if (pText != NULL)
{
- g_timerInterval = GetNum(pText+6);
- if ( g_timerInterval < 10 ) g_timerInterval = 10;
- if ( g_timerInterval > 1000 ) g_timerInterval = 1000;
+ g_timerInterval = GetNum(pText + 6);
+ if (g_timerInterval < 10) g_timerInterval = 10;
+ if (g_timerInterval > 1000) g_timerInterval = 1000;
}
pText = strstr(buffer, "FullScreen=");
- if ( pText != NULL )
+ if (pText != NULL)
{
- g_bFullScreen = GetNum(pText+11);
- if ( g_bFullScreen != 0 ) g_bFullScreen = 1;
+ g_bFullScreen = GetNum(pText + 11);
+ if (g_bFullScreen != 0) g_bFullScreen = 1;
}
pText = strstr(buffer, "MouseType=");
- if ( pText != NULL )
+ if (pText != NULL)
{
- g_mouseType = GetNum(pText+10);
- if ( g_mouseType < 1 ) g_mouseType = 1;
- if ( g_mouseType > 9 ) g_mouseType = 9;
+ g_mouseType = GetNum(pText + 10);
+ if (g_mouseType < 1) g_mouseType = 1;
+ if (g_mouseType > 9) g_mouseType = 9;
}
pText = strstr(buffer, "Benchmark=");
- if ( pText != NULL )
+ if (pText != NULL)
{
- g_benchmark = GetNum(pText+10);
- if ( g_benchmark < 0 ) g_benchmark = 0;
- if ( g_benchmark > 100000 ) g_benchmark = 100000;
+ g_benchmark = GetNum(pText + 10);
+ if (g_benchmark < 0) g_benchmark = 0;
+ if (g_benchmark > 100000) g_benchmark = 100000;
if (g_benchmark > 3099)
{
g_bBenchmarkSuccess = TRUE;
@@ -205,7 +192,7 @@ BOOL ReadConfig (LPSTR lpCmdLine)
}
pText = strstr(buffer, "TrueColor=");
- if ( pText != NULL )
+ if (pText != NULL)
{
i = GetNum(pText + 10);
if (i == 8) g_bTrueColorBack = FALSE;
@@ -214,15 +201,15 @@ BOOL ReadConfig (LPSTR lpCmdLine)
}
pText = strstr(buffer, "TrueColorBack=");
- if ( pText != NULL )
+ if (pText != NULL)
{
- i = GetNum(pText+14);
+ i = GetNum(pText + 14);
if (i == 8) g_bTrueColorBack = FALSE;
if (i == 16) g_bTrueColorBack = TRUE;
}
pText = strstr(buffer, "TrueColorDecor=");
- if ( pText != NULL )
+ if (pText != NULL)
{
i = GetNum(pText + 15);
if (i == 8) g_bTrueColorDecor = FALSE;
@@ -230,7 +217,7 @@ BOOL ReadConfig (LPSTR lpCmdLine)
}
pText = strstr(buffer, "CDAudio=");
- if ( pText != NULL )
+ if (pText != NULL)
{
i = GetNum(pText + 8);
g_bCDAudio = (i == TRUE);
@@ -238,7 +225,7 @@ BOOL ReadConfig (LPSTR lpCmdLine)
mem.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(&mem);
-
+
if (mem.dwTotalPhys < 32000000) g_bBenchmarkSuccess = FALSE;
if (!g_bBenchmarkSuccess)
@@ -250,8 +237,6 @@ BOOL ReadConfig (LPSTR lpCmdLine)
return TRUE;
}
-// Mise jour principale. [TODO: Rewrite Variables]
-
void UpdateFrame(void)
{
int phase, term;
@@ -270,82 +255,78 @@ void UpdateFrame(void)
}
}
- if (phase == WM_PHASE_INIT)
- {
- g_pEvent->DemoStep(); // d?marre ?v. d?mo automatique
- }
+ if (phase == WM_PHASE_INIT)
+ {
+ g_pEvent->DemoStep(); // d?marre ?v. d?mo automatique
+ }
- if (phase == WM_PHASE_PLAYMOVIE || phase == WM_PHASE_WINMOVIE || WM_PHASE_WINMOVIEDESIGN || WM_PHASE_WINMOVIEMULTI)
- {
- g_pEvent->MovieToStart();
- }
+ if (phase == WM_PHASE_PLAYMOVIE || phase == WM_PHASE_WINMOVIE || WM_PHASE_WINMOVIEDESIGN || WM_PHASE_WINMOVIEMULTI)
+ {
+ g_pEvent->MovieToStart();
+ }
- if (phase == WM_PHASE_INSERT)
- {
- g_pEvent->TryInsert();
- }
+ if (phase == WM_PHASE_INSERT)
+ {
+ g_pEvent->TryInsert();
+ }
- if (phase == WM_PHASE_PLAY)
+ if (phase == WM_PHASE_PLAY)
+ {
+ if (g_pEvent->IsPrivate() == FALSE)
{
- if (g_pEvent->IsPrivate() == FALSE)
+ if (g_pEvent->IsMulti() == FALSE)
{
- if (g_pEvent->IsMulti() == FALSE)
+ if (g_pDecor->IsTerminated() == -1)
{
- 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);
- }
+ g_pEvent->GetWorldGroup();
+ g_pEvent->SetLives(g_pDecor->GetNbVies());
+ g_pEvent->ChangePhase(WM_PHASE_LOST);
}
- else
+ if (g_pDecor->IsTerminated() == -2)
{
- if (g_pDecor->IsTerminated() == -1)
- {
- g_pEvent->ChangePhase(WM_PHASE_WINm);
- return;
- }
- if (g_pDecor->IsTerminated() != 0)
- {
- g_pEvent->ChangePhase(WM_PHASE_WINMOVIEm);
- return;
- }
+ 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);
}
}
else
{
if (g_pDecor->IsTerminated() == -1)
{
- g_pEvent->ChangePhase(WM_PHASE_LOSTd);
+ g_pEvent->ChangePhase(WM_PHASE_WINMULTI);
return;
}
if (g_pDecor->IsTerminated() != 0)
{
- g_pEvent->ChangePhase(WM_PHASE_WINMOVIEd);
+ g_pEvent->ChangePhase(WM_PHASE_WINMOVIEMULTI);
return;
}
}
}
+ else
+ {
+ if (g_pDecor->IsTerminated() == -1)
+ {
+ g_pEvent->ChangePhase(WM_PHASE_LOSTDESIGN);
+ return;
+ }
+ if (g_pDecor->IsTerminated() != 0)
+ {
+ g_pEvent->ChangePhase(WM_PHASE_WINMOVIEDESIGN);
+ return;
+ }
+ }
}
- return;
}
-
-
// Incomplete
-void SetDecor()
+void SetDecor(void)
{
RECT rect;
UINT phase;
@@ -367,46 +348,30 @@ void SetDecor()
g_pPixmap->DrawImage(-1, 0, rect, 1);
}
- g_pEvent->AddPhaseText();
+ g_pEvent->DrawButtons();
g_lastPhase = phase;
g_pPixmap->MouseBackDraw();
}
-int Benchmark()
-{
- MEMORYSTATUS mem;
-
- for (int i = 0; i < 10; i++)
- {
- UpdateFrame();
- SetDecor();
- g_pPixmap->Display();
- // TODO
- }
-}
-
-
-// Restitue le jeu aprs une activation en mode fullScreen.
-
+// Restitue le jeu après une activation en mode fullScreen.
BOOL RestoreGame()
{
- if ( g_pPixmap == NULL ) return FALSE;
+ if (g_pPixmap == NULL) return FALSE;
g_pEvent->RestoreGame();
return g_pPixmap->Restore();
}
-// Libre le jeu avant une dsactivation en mode fullScreen.
+// Libère le jeu avant une désactivation en mode fullScreen.
BOOL FlushGame()
{
- if ( g_pPixmap == NULL ) return FALSE;
+ if (g_pPixmap == NULL) return FALSE;
return g_pPixmap->Flush();
}
-
// Finished with all objects we use; release them.
static void FinishObjects(void)
@@ -433,7 +398,7 @@ static void FinishObjects(void)
if (g_pSound != NULL )
{
- g_pSound->StopMusic(); // stoppe la musique Midi
+ g_pSound->StopMusic();
delete g_pSound;
g_pSound = NULL;
@@ -452,188 +417,202 @@ static void FinishObjects(void)
}
}
-LRESULT CALLBACK WindowProc (HWND hWnd, UINT message,
- WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK WindowProc(HWND hWnd, UINT message,
+ WPARAM wParam, LPARAM lParam)
{
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 !
//[The F10 key sends another message to activate the menu in standard Windows apps!]
- if ( message == WM_SYSKEYDOWN && wParam == VK_F10 )
+ if (message == WM_SYSKEYDOWN && wParam == VK_F10)
{
message = WM_KEYDOWN;
}
- if ( message == WM_SYSKEYUP && wParam == VK_F10 )
+ if (message == WM_SYSKEYUP && wParam == VK_F10)
{
message = WM_KEYUP;
}
- if ( g_pEvent != NULL &&
- g_pEvent->TreatEvent(message, wParam, lParam) ) return 0;
+ if (g_pEvent != NULL &&
+ g_pEvent->TreatEvent(message, wParam, lParam)) return 0;
- switch( message )
+ switch (message)
{
- case WM_TIMER:
- case WM_UPDATE:
- if (g_pEvent != NULL && !g_pEvent->IsMovie() && !g_pEvent->IsMouseRelease()) // pas de film en cours ?
+ case WM_TIMER:
+ case WM_UPDATE:
+ if (g_pEvent != NULL && !g_pEvent->IsMovie() && !g_pEvent->IsMouseRelease()) // pas de film en cours ?
+ {
+ g_pEvent->GetPhase(); // ?
+ if (g_bActive)
{
- g_pEvent->GetPhase(); // ?
- if (g_bActive)
- {
- UpdateFrame();
- SetDecor();
- }
- g_pPixmap->Display();
+ UpdateFrame();
+ SetDecor();
}
- if (g_something > 0) g_something--;
- break;
- case WM_SYSCOLORCHANGE:
- OutputDebug("Event WM_SYSCOLORCHANGE\n");
- break;
- case WM_CREATE:
- hInstance = ((LPCREATESTRUCT)lParam)->hInstance;
- return 0;
- break;
+ g_pPixmap->Display();
+ }
+ if (g_something > 0) g_something--;
+ break;
+ case WM_SYSCOLORCHANGE:
+ OutputDebug("Event WM_SYSCOLORCHANGE\n");
+ break;
+ case WM_CREATE:
+ hInstance = ((LPCREATESTRUCT)lParam)->hInstance;
+ return 0;
+ break;
- case WM_ACTIVATEAPP:
- g_bActive = (wParam != 0);
- if ( g_pEvent != NULL )
+ case WM_ACTIVATEAPP:
+ g_bActive = (wParam != 0);
+ if (g_pEvent != NULL)
+ {
+ g_pEvent->FlushInput();
+ }
+ if (g_bActive)
+ {
+ if (g_bFullScreen)
{
- g_pEvent->FlushInput();
+ RestoreGame();
+ g_lastPhase = 999;
}
- if ( g_bActive )
+ if (!g_bFullScreen && g_bTermInit)
{
- if ( g_bFullScreen )
- {
- RestoreGame();
- g_lastPhase = 999;
- }
- if ( !g_bFullScreen && g_bTermInit )
- {
- g_pPixmap->BackgroundCache(CHLITTLE, "little.blp", { 256, 96 }, { DIMLITTLEX , DIMLITTLEY }, TRUE);
- g_pPixmap->SetTransparent(CHLITTLE, RGB(0, 0, 255)); // bleu
+ g_pPixmap->BackgroundCache(CHLITTLE, "little.blp", { 256, 96 }, { DIMLITTLEX , DIMLITTLEY }, TRUE);
+ g_pPixmap->SetTransparent(CHLITTLE, RGB(0, 0, 255)); // bleu
- g_pPixmap->SavePalette();
- g_pPixmap->InitSysPalette();
- }
- SetWindowTextA(hWnd, "Blupi");
- if ( g_pSound != NULL ) g_pSound->RestartMusic();
+ g_pPixmap->SavePalette();
+ g_pPixmap->InitSysPalette();
}
- else // dsactive ?
+ SetWindowText(hWnd, "Blupi");
+ if (g_pSound != NULL) g_pSound->RestartMusic();
+ }
+ else // désactive ?
+ {
+ if (g_bFullScreen)
{
- if ( g_bFullScreen )
- {
- FlushGame();
- }
- SetWindowTextA(hWnd, "Blupi -- stop");
- if ( g_pSound != NULL ) g_pSound->SuspendMusic();
+ FlushGame();
}
- return 0;
+ SetWindowText(hWnd, "Blupi -- stop");
+ if (g_pSound != NULL) g_pSound->SuspendMusic();
+ }
+ return 0;
- case WM_DISPLAYCHANGE:
- OutputDebug("Event WM_DISPLAYCHANGE\n");
- break;
+ case WM_DISPLAYCHANGE:
+ OutputDebug("Event WM_DISPLAYCHANGE\n");
+ break;
- case WM_QUERYNEWPALETTE:
- OutputDebug("Event WM_QUERYNEWPALETTE\n");
- break;
+ case WM_QUERYNEWPALETTE:
+ OutputDebug("Event WM_QUERYNEWPALETTE\n");
+ break;
- case WM_PALETTECHANGED:
- OutputDebug("Event WM_PALLETECHANGED\n");
- break;
+ case WM_PALETTECHANGED:
+ OutputDebug("Event WM_PALLETECHANGED\n");
+ break;
- case MM_MCINOTIFY:
- OutputDebug("Event MM_MCINOTIFY\n");
- if ( g_pEvent->IsMovie() ) // film en cours ?
+ case MM_MCINOTIFY:
+ OutputDebug("Event MM_MCINOTIFY\n");
+ if (g_pEvent->IsMovie()) // film en cours ?
+ {
+ if (wParam == MCI_NOTIFY_SUCCESSFUL)
{
- if ( wParam == MCI_NOTIFY_SUCCESSFUL )
- {
- g_pEvent->StopMovie();
- }
+ g_pEvent->StopMovie();
+ }
+ }
+ else
+ {
+ // music over, play it again
+ g_pSound->SuspendMusic();
+ // if music finished, play it again. Otherwise assume that
+ // it was aborted by the user or otherwise
+ if (wParam == MCI_NOTIFY_SUCCESSFUL)
+ {
+ OutputDebug("Event MCI_NOTIFY_SUCCESSFUL\n");
+ g_pSound->RestartMusic();
}
else
{
- // music over, play it again
- g_pSound->SuspendMusic();
- // if music finished, play it again. Otherwise assume that
- // it was aborted by the user or otherwise
- if ( wParam == MCI_NOTIFY_SUCCESSFUL )
- {
- OutputDebug("Event MCI_NOTIFY_SUCCESSFUL\n");
- g_pSound->RestartMusic();
- }
- else
- {
- char s[50];
- sprintf(s, "wParam=%d\n", wParam);
- OutputDebug(s);
- }
+ char s[50];
+ sprintf(s, "wParam=%d\n", wParam);
+ OutputDebug(s);
}
- break;
+ }
+ break;
- case WM_SETCURSOR:
-// ChangeSprite();
-// SetCursor(NULL); // pas de souris visible !
- return TRUE;
+ case WM_SETCURSOR:
+ // ChangeSprite();
+ // SetCursor(NULL); // pas de souris visible !
+ return TRUE;
- case WM_LBUTTONDOWN:
-//? Benchmark();
- GetCursorPos(&mousePos);
- ScreenToClient(hWnd, &mousePos);
- break;
+ case WM_LBUTTONDOWN:
+ //? Benchmark();
+ GetCursorPos(&mousePos);
+ ScreenToClient(hWnd, &mousePos);
+ break;
- case WM_RBUTTONDOWN:
- break;
+ case WM_RBUTTONDOWN:
+ break;
- case WM_MOUSEMOVE:
- break;
+ case WM_MOUSEMOVE:
+ break;
- case WM_KEYDOWN:
- switch (wParam)
- {
- case VK_F5:
- g_pEvent->SetSpeed(1);
- break;
- case VK_F6:
- g_pEvent->SetSpeed(2);
- break;
- case VK_F7:
- g_pEvent->SetSpeed(4);
- break;
- case VK_F8:
- g_pEvent->SetSpeed(8);
- break;
- }
+ case WM_KEYDOWN:
+ switch (wParam)
+ {
+ case VK_F5:
+ g_pEvent->SetSpeed(1);
break;
+ case VK_F6:
+ g_pEvent->SetSpeed(2);
+ break;
+ case VK_F7:
+ g_pEvent->SetSpeed(4);
+ break;
+ case VK_F8:
+ g_pEvent->SetSpeed(8);
+ break;
+ }
+ break;
+
+ case WM_DESTROY:
+#if MMTIMER
+ timeKillEvent((UINT)g_updateTimer);
+#else
+ KillTimer(g_hWnd, 1);
+#endif
+ FinishObjects();
+ PostQuitMessage(0);
+ break;
- case WM_DESTROY:
- timeKillEvent((UINT)g_hWnd);
- FinishObjects();
- PostQuitMessage(0);
- break;
-
}
return DefWindowProc(hWnd, message, wParam, lParam);
-
}
-LPTIMECALLBACK TimerStep()
+void CALLBACK TimerStep(UINT wTimerID, UINT msg,
+ DWORD dwUser, DWORD dw1, DWORD dw2)
{
+ char buf[20];
+ sprintf(buf, "%d", wTimerID);
+ OutputDebug(buf);
if (g_bActive && g_timer == 0)
{
g_timer = 1;
- PostMessageA(g_hWnd, WM_UPDATE, 0, 0);
+ PostMessage(g_hWnd, WM_UPDATE, 0, 0);
}
- return NULL;
}
-
// Erreur dans DoInit.
-BOOL InitFail(char *msg, BOOL bDirectX)
+BOOL InitFail(const char *msg, BOOL bDirectX)
{
char buffer[100];
@@ -650,51 +629,39 @@ BOOL InitFail(char *msg, BOOL bDirectX)
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];
+ struct timeb tstruct;
+ int i, j, t1, t2, time;
+ RECT rect;
+ POINT dest;
+ _MEMORYSTATUS mem;
- ftime(time);
+ ftime(&tstruct);
+ t1 = tstruct.millitm;
- num = (int)time;
- frame = 10;
-
- do
+ for (j = 0; j < 10; j++)
{
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;
+ ftime(&tstruct);
+ t2 = tstruct.millitm;
+
+ if (t1 > t2) t2 += 1000;
+ time = t2 - t1;
+
+ mem.dwLength = 32;
+ GlobalMemoryStatus(&mem);
+ FILE* file = NULL;
+ char string[100];
+ sprintf(string, "CheckTime = %d Memory = %d\r\n", time, mem.dwTotalPhys);
+ file = fopen("data\\time.blp", "wb");
+ if (file == NULL) return time;
+ fwrite(string, strlen(string), 1, file);
+ fclose(file);
+
+ return time;
}
static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
@@ -714,7 +681,7 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
-//? wc.hIcon = LoadIcon(hInstance, IDI_APPLICATION);
+ //? wc.hIcon = LoadIcon(hInstance, IDI_APPLICATION);
wc.hIcon = LoadIcon(hInstance, "IDR_MAINFRAME");
wc.hCursor = LoadCursor(hInstance, "IDC_POINTER");
wc.hbrBackground = GetStockBrush(BLACK_BRUSH);
@@ -725,7 +692,7 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
// Create a window.
if (g_bFullScreen)
{
- g_hWnd = CreateWindowExA
+ g_hWnd = CreateWindowEx
(
WS_EX_TOPMOST,
NAME,
@@ -753,7 +720,7 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
AdjustWindowRect(&WindowRect, WS_POPUPWINDOW | WS_CAPTION, TRUE);
WindowRect.top += GetSystemMetrics(SM_CYCAPTION);
- g_hWnd = CreateWindowA
+ g_hWnd = CreateWindow
(
NAME,
TITLE,
@@ -780,7 +747,7 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
return InitFail("Game not correctly installed", FALSE);
}
- // Cre le pixmap principal.
+ // Crée le pixmap principal.
g_pPixmap = new CPixmap;
if (g_pPixmap == NULL) return InitFail("New pixmap", TRUE);
@@ -795,7 +762,7 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
iconDim.x = 0;
iconDim.y = 0;
- if (!g_pPixmap->CacheAll(TRUE, g_hWnd, g_bFullScreen, g_bTrueColor, g_bTrueColorDecor, g_mouseType, "init.blp", 0))
+ if (!g_pPixmap->CacheAll(TRUE, g_hWnd, g_bFullScreen, g_bTrueColorBack, g_bTrueColorDecor, g_mouseType, "init.blp", 0))
return FALSE;
OutputDebug("SavePalette\n");
g_pPixmap->SavePalette();
@@ -810,9 +777,6 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
g_pSound->SetState(TRUE);
g_pSound->SetCDAudio(g_bCDAudio);
- g_pNetwork = new CNetwork;
- if (g_pNetwork == NULL) return InitFail("New network", TRUE);
-
g_pMovie = new CMovie;
if (g_pMovie == NULL) return InitFail("New movie", FALSE);
@@ -829,6 +793,11 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
g_pEvent->Create(hInstance, g_hWnd, g_pPixmap, g_pDecor, g_pSound, g_pNetwork, g_pMovie);
g_pEvent->SetFullScreen(g_bFullScreen);
g_pEvent->SetMouseType(g_mouseType);
+
+ g_pNetwork = new CNetwork;
+ if (g_pNetwork == NULL) return InitFail("New network", TRUE);
+ g_pNetwork->CreateProvider(0);
+
#if _INTRO
g_pEvent->ChangePhase(WM_PHASE_INTRO1);
#else
@@ -839,17 +808,6 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
return TRUE;
}
-void TimerStep()
-{
- if (g_bActive && !g_something)
- {
- g_something = TRUE;
- PostMessage(g_hWnd, WM_UPDATE, 0, 0);
- }
-}
-
-// Programme principal.
-
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
@@ -862,13 +820,26 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
}
Benchmark();
- g_hWnd = (HWND)timeSetEvent(g_timerInterval, (g_timerInterval + (g_timerInterval >> 31 & 3U)) >> 2, TimerStep(), 0, 1);
+
+#if MMTIMER
+ g_updateTimer = timeSetEvent(g_timerInterval, g_timerInterval / 4, TimerStep, NULL, TIME_PERIODIC);
+#else
+ SetTimer(g_hWnd, 1, g_timerInterval, NULL);
+#endif
- while (TRUE)
+#if THREAD
+ g_hScreenMutex = CreateMutex(NULL, FALSE, NULL);
+ g_hRunMutex = CreateMutex(NULL, TRUE, NULL);
+ g_threadNr = 0;
+
+ g_hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadDisplay, 0, DETACHED_PROCESS, &g_threadID);
+#endif
+
+ 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;
}
@@ -883,4 +854,31 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
}
return msg.wParam;
-}
\ No newline at end of file
+}
+
+#if THREAD
+// Thread d'affichage.
+
+static void ThreadDisplay(char* MyID)
+{
+ UINT phase;
+
+ do
+ {
+ phase = g_pEvent->GetPhase();
+ if (phase == WM_PHASE_PLAY)
+ {
+ // Wait for display to be available, then lock it.
+ WaitForSingleObject(g_hScreenMutex, INFINITE);
+
+ SetDecor();
+ g_pPixmap->Display();
+
+ // Clear screen lock.
+ ReleaseMutex(g_hScreenMutex);
+ }
+ }
+ // Repeat while RunMutex is still taken.
+ while (WaitForSingleObject(g_hRunMutex, 10L) == WAIT_TIMEOUT);
+}
+#endif
\ No newline at end of file
diff --git a/src/button.cpp b/src/button.cpp
new file mode 100644
index 0000000..8ddfb18
--- /dev/null
+++ b/src/button.cpp
@@ -0,0 +1,402 @@
+// Button.cpp
+//
+
+#include
+#include
+#include
+#include
+
+#include
+#include "def.h"
+#include "pixmap.h"
+#include "sound.h"
+#include "decor.h"
+#include "button.h"
+#include "misc.h"
+
+using namespace std;
+
+//////////////////////////////////////////////////////////
+
+// Constructor
+
+CButton::CButton()
+{
+ m_type = 0;
+ m_bEnable = TRUE;
+ m_bHide = FALSE;
+ m_bSomething = FALSE;
+ m_state = 0;
+ m_mouseState = 0;
+ m_nbMenu = 0;
+ m_nbToolTips = 0;
+ m_selMenu = 0;
+ m_bMouseDown = FALSE;
+ m_bMinimizeRedraw = FALSE;
+ m_bRedraw = FALSE;
+}
+
+// Destructor
+
+CButton::~CButton()
+{
+}
+
+
+// Create a new Button
+
+BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
+ POINT pos, int type, BOOL bMinimizeRedraw, UINT message)
+{
+ POINT iconDim;
+ int i, icon;
+
+ static int ttypes[] =
+ {
+ DIMBUTTONX,DIMBUTTONY,
+ };
+
+ if (type < 0 || type > 0) return FALSE;
+
+
+ iconDim.x = ttypes[type * 2 + 0];
+ iconDim.y = ttypes[type * 2 + 1];
+
+ m_hWnd = hWnd;
+ m_pPixmap = pPixmap;
+ m_pSound = pSound;
+ m_type = type;
+ m_bMinimizeRedraw = bMinimizeRedraw;
+ m_bEnable = TRUE;
+ m_bHide = FALSE;
+ m_bSomething = FALSE;
+ m_message = message;
+ m_pos.x = pos.x;
+ m_pos.y = pos.y;
+ m_dim.x = iconDim.x;
+ m_dim.y = iconDim.y;
+ m_nbMenu = 0;
+ m_nbToolTips = 0;
+ m_selMenu = 0;
+ m_state = 0;
+ m_mouseState = 0;
+ m_bMouseDown = FALSE;
+ m_bRedraw = TRUE;
+ return TRUE;
+}
+
+void CButton::SetIconMenu(int* pIcons, int nbMenu)
+{
+ for (int i = 0; i < nbMenu; i++)
+ {
+ m_iconMenu[i] = pIcons[i];
+ }
+ m_nbMenu = nbMenu;
+}
+
+void CButton::SetToolTips(int* pToolTips, int nbToolTips)
+{
+ for (int i = 0; i < nbToolTips; i++)
+ {
+ m_toolTips[i] = pToolTips[i];
+ }
+ m_nbToolTips = nbToolTips;
+}
+
+// Draw a button in its state
+
+void CButton::Draw()
+{
+ int i;
+ POINT pos;
+ RECT rect;
+
+ if (m_bMinimizeRedraw && !m_bRedraw) return;
+ m_bRedraw = FALSE;
+
+ if (m_bHide) // Hidden button
+ {
+ pos = m_pos;
+ return;
+ }
+
+ if (m_bEnable)
+ {
+ m_pPixmap->DrawIcon(-1, CHBUTTON + m_type, m_mouseState, m_pos);
+ }
+ else
+ {
+ m_pPixmap->DrawIcon(-1, CHBUTTON + m_type, m_bSomething ? 5 : 4, m_pos);
+ }
+
+ if (m_nbMenu == 0) return;
+
+ pos = m_pos;
+ if (m_nbMenu > 0)
+ {
+ m_pPixmap->DrawIcon(-1, CHBUTTON + m_type,
+ m_iconMenu[m_selMenu] + 6, pos);
+ }
+
+ if (m_nbMenu == 1 || !m_bEnable || !m_bMouseDown) return;
+
+ pos = m_pos;
+ pos.x += m_dim.x + 2;
+ for (i = 0; iDrawIcon(-1, CHBUTTON + m_type, i == m_selMenu ? 1 : 0, pos);
+ m_pPixmap->DrawIcon(-1, CHBUTTON + m_type, m_iconMenu[i] + 6, pos);
+ pos.x += m_dim.x - 1;
+ }
+}
+
+/*
+/Needed Yet?
+//////////////////////////////////////////////
+void CButton::Redraw()
+{
+m_bRedraw = TRUE;
+}
+//////////////////////////////////////////////
+*/
+
+int CButton::GetState()
+{
+ return m_state;
+}
+
+void CButton::SetState(int state)
+{
+ if (m_state != state ||
+ m_mouseState != state)
+ {
+ m_bRedraw = TRUE;
+ }
+
+ m_state = state;
+ m_mouseState = state;
+}
+
+int CButton::GetMenu()
+{
+ return m_selMenu;
+}
+
+void CButton::SetMenu(int menu)
+{
+ if (m_selMenu != menu)
+ {
+ m_bRedraw = TRUE;
+ }
+
+ m_selMenu = menu;
+}
+
+void CButton::SetEnable(BOOL bEnable)
+{
+ if (m_bEnable != bEnable)
+ {
+ m_bRedraw = TRUE;
+ }
+
+ m_bEnable = bEnable;
+}
+
+void CButton::SetSomething(BOOL bSomething)
+{
+ if (m_bSomething != bSomething)
+ {
+ m_bRedraw = TRUE;
+ }
+
+ m_bSomething = bSomething;
+}
+
+
+/*
+// Needed Yet?
+/////////////////////////////////////////
+BOOL CButton::GetHide()
+{
+return m_bHide;
+}
+/////////////////////////////////////////
+*/
+
+
+void CButton::SetHide(BOOL bHide)
+{
+ if (m_bHide != bHide)
+ {
+ m_bRedraw = TRUE;
+ }
+
+ m_bHide = bHide;
+}
+
+BOOL CButton::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam)
+{
+ POINT pos;
+
+ if (m_bHide || !m_bEnable) return FALSE;
+
+ pos = ConvLongToPos(lParam);
+
+ switch (message)
+ {
+ case WM_LBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ if (MouseDown(pos)) return TRUE;
+ break;
+
+ case WM_MOUSEMOVE:
+ if (MouseMove(pos)) return TRUE;
+ break;
+
+ case WM_LBUTTONUP:
+ case WM_RBUTTONUP:
+ if (MouseUp(pos)) return FALSE;
+ break;
+ }
+
+ return FALSE;
+}
+
+// All buttons must receive the BUTTONUP event!
+
+// Indicates whether the mouse is over this button.
+
+BOOL CButton::MouseOnButton(POINT pos)
+{
+ return Detect(pos);
+}
+
+// Return the tooltips for a button, depending
+// on mouse position.
+
+int CButton::GetToolTips(POINT pos)
+{
+ int width = m_dim.x;
+ int rank;
+
+ if (m_bHide || !m_bEnable) return -1;
+
+ if (m_nbMenu > 1 && m_bMouseDown) // Drop-down submenu?
+ {
+ width += 2 + (m_dim.x - 1)*m_nbMenu;
+ }
+
+ if (pos.x < m_pos.x ||
+ pos.x > m_pos.x + width ||
+ pos.y < m_pos.y ||
+ pos.y > m_pos.y + m_dim.y) return -1;
+
+ rank = (pos.x = -(m_pos.x + 2 + 1)) / (m_dim.x - 1);
+ if (rank < 0) rank = 0;
+ if (rank > m_nbToolTips) return -1;
+
+ if (m_nbMenu > 1)
+ {
+ if (m_bMouseDown && rank > 0)
+ {
+ rank--;
+ }
+ else
+ {
+ rank = m_selMenu;
+ }
+ }
+
+ return m_toolTips[rank];
+}
+
+BOOL CButton::Detect(POINT pos)
+{
+ int width = m_dim.x;
+
+ if (m_bHide || !m_bEnable) return FALSE;
+
+ if (m_nbMenu > 1 && m_bMouseDown)
+ {
+ width += 2 + (m_dim.x - 1)*m_nbMenu;
+ }
+
+ if (pos.x < m_pos.x ||
+ pos.x > m_pos.x + width ||
+ pos.y < m_pos.y ||
+ pos.y > m_pos.y + m_dim.y) return FALSE;
+
+ return TRUE;
+}
+
+BOOL CButton::MouseMove(POINT pos)
+{
+ int selMenu = m_selMenu;
+ int mouseState;
+ BOOL BVar3;
+ int iVar4;
+ int iVar5;
+ BOOL BVar6;
+ int iVar7;
+
+ mouseState = m_mouseState;
+ BVar6 = Detect(pos);
+ BVar3 = m_bMouseDown;
+ if (!m_bMouseDown) {
+ if (!Detect(pos)) {
+ m_mouseState = m_state;
+ }
+ else {
+ m_mouseState = m_state + 2;
+ }
+ }
+ else if (Detect(pos)) {
+ m_mouseState = 1;
+ }
+ else {
+ m_mouseState = m_state;
+ }
+ if (m_nbMenu > 1 && m_bMouseDown) {
+ if ((m_pos.x + m_dim.x + 2 < pos.x))
+ {
+ m_selMenu = (pos.x - m_pos.x - m_dim.x - 2) / (m_dim.x - 1);
+ if (m_selMenu >= m_nbMenu) m_selMenu = m_nbMenu - 1;
+ }
+ }
+ if (mouseState != m_mouseState || selMenu != m_selMenu) m_bRedraw = TRUE;
+ return BVar3;
+}
+
+
+BOOL CButton::MouseDown(POINT pos)
+{
+ if (!Detect(pos)) return FALSE;
+
+ m_mouseState = 1;
+ m_bMouseDown = TRUE;
+ m_bRedraw = TRUE;
+ // PostMessage(m_hWnd, WM_UPDATE, 0, 0);
+
+ m_pSound->PlayImage(SOUND_CLICK, pos);
+ return TRUE;
+}
+
+BOOL CButton::MouseUp(POINT pos)
+{
+ BOOL bDetect;
+
+ bDetect = Detect(pos);
+
+ m_mouseState = m_state;
+ m_bMouseDown = FALSE;
+ m_bRedraw = TRUE;
+
+ if (!bDetect) return FALSE;
+
+ if (m_message != -1)
+ {
+ PostMessage(m_hWnd, m_message, 0, 0);
+ }
+
+ return TRUE;
+}
\ No newline at end of file
diff --git a/button.h b/src/button.h
similarity index 88%
rename from button.h
rename to src/button.h
index 51bca6c..834266e 100644
--- a/button.h
+++ b/src/button.h
@@ -1,13 +1,11 @@
-//#include
+#pragma once
+
+// #include
#include
#include "decor.h"
#include "sound.h"
#include "pixmap.h"
-#pragma once
-
-using namespace std;
-
class CButton
{
public:
@@ -15,8 +13,9 @@ public:
~CButton();
BOOL Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
- POINT pos, int type, BOOL bMinimizeRedraw, int region, UINT message);
- void SetSomethingMenu(int somethingMenu);
+ POINT pos, int type, BOOL bMinimizeRedraw, UINT message);
+ void SetIconMenu(int* pIcons, int nbIcons);
+ void SetToolTips(int* pToolTips, int nbTooltips);
void Draw();
void Redraw();
diff --git a/src/ddutil.cpp b/src/ddutil.cpp
new file mode 100644
index 0000000..b51b857
--- /dev/null
+++ b/src/ddutil.cpp
@@ -0,0 +1,346 @@
+/*==========================================================================
+ *
+ * Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved.
+ *
+ * File: ddutil.cpp
+ * Content: Routines for loading bitmap and palettes from resources
+ *
+ ***************************************************************************/
+#undef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#include
+#include
+#include
+#include
+#include
+#include "ddutil.h"
+#include "misc.h"
+
+using namespace std;
+
+#define DIRECTDRAW_VERSION 0x0500
+
+BOOL g_bDebug = TRUE;
+
+void DDSetDebug(BOOL bDebug)
+{
+ g_bDebug = bDebug;
+}
+
+
+/*
+ * DDLoadBitmap
+ *
+ * create a DirectDrawSurface from a bitmap resource.
+ *
+ */
+extern "C" IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap, int dx, int dy)
+{
+ HBITMAP hbm;
+ BITMAP bm;
+ DDSURFACEDESC ddsd;
+ IDirectDrawSurface *pdds;
+
+ //
+ // try to load the bitmap as a resource, if that fails, try it as a file
+ //
+ hbm = (HBITMAP)LoadImageA(GetModuleHandle(NULL), szBitmap, IMAGE_BITMAP, dx, dy, LR_CREATEDIBSECTION);
+
+ if (hbm == NULL)
+ hbm = (HBITMAP)LoadImageA(NULL, szBitmap, IMAGE_BITMAP, dx, dy, LR_LOADFROMFILE|LR_CREATEDIBSECTION);
+
+ if (hbm == NULL)
+ return NULL;
+
+ //
+ // get size of the bitmap
+ //
+ GetObject(hbm, sizeof(bm), &bm); // get size of bitmap
+
+ //
+ // create a DirectDrawSurface for this bitmap
+ //
+ ZeroMemory(&ddsd, sizeof(ddsd));
+ ddsd.dwSize = sizeof(ddsd);
+ ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
+ ddsd.dwWidth = bm.bmWidth;
+ ddsd.dwHeight = bm.bmHeight;
+
+ if (pdd->CreateSurface(&ddsd, &pdds, NULL) != DD_OK)
+ return NULL;
+
+ DDCopyBitmap(pdds, hbm, 0, 0, 0, 0);
+
+ DeleteObject(hbm);
+
+ return pdds;
+}
+
+/*
+ * DDReLoadBitmap
+ *
+ * load a bitmap from a file or resource into a directdraw surface.
+ * normaly used to re-load a surface after a restore.
+ *
+ */
+HRESULT DDReLoadBitmap(IDirectDrawSurface *pdds, LPCSTR szBitmap)
+{
+ HBITMAP hbm;
+ HRESULT hr;
+
+ //
+ // try to load the bitmap as a resource, if that fails, try it as a file
+ //
+ hbm = (HBITMAP)LoadImageA(GetModuleHandle(NULL), szBitmap, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
+
+ if (hbm == NULL)
+ hbm = (HBITMAP)LoadImageA(NULL, szBitmap, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION);
+
+ if (hbm == NULL)
+ {
+ OutputDebugStringA("handle is null\n");
+ return E_FAIL;
+ }
+
+ hr = DDCopyBitmap(pdds, hbm, 0, 0, 0, 0);
+ if (hr != DD_OK)
+ {
+ OutputDebugStringA("ddcopybitmap failed\n");
+ }
+
+
+ DeleteObject(hbm);
+ return hr;
+}
+
+/*
+ * DDCopyBitmap
+ *
+ * draw a bitmap into a DirectDrawSurface
+ *
+ */
+extern "C" HRESULT DDCopyBitmap(IDirectDrawSurface *pdds, HBITMAP hbm, int x, int y, int dx, int dy)
+{
+ HDC hdcImage;
+ HDC hdc;
+ BITMAP bm;
+ DDSURFACEDESC ddsd;
+ HRESULT hr;
+
+ if (hbm == NULL || pdds == NULL)
+ return E_FAIL;
+
+ //
+ // make sure this surface is restored.
+ //
+ pdds->Restore();
+
+ //
+ // select bitmap into a memoryDC so we can use it.
+ //
+ hdcImage = CreateCompatibleDC(NULL);
+ if (!hdcImage)
+ OutputDebugStringA("createcompatible dc failed\n");
+ SelectObject(hdcImage, hbm);
+
+ //
+ // get size of the bitmap
+ //
+ GetObject(hbm, sizeof(bm), &bm); // get size of bitmap
+ dx = dx == 0 ? bm.bmWidth : dx; // use the passed size, unless zero
+ dy = dy == 0 ? bm.bmHeight : dy;
+
+ //
+ // get size of surface.
+ //
+ ddsd.dwSize = sizeof(ddsd);
+ ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH;
+ pdds->GetSurfaceDesc(&ddsd);
+
+ if ((hr = pdds->GetDC(&hdc)) == DD_OK)
+ {
+ StretchBlt(hdc, 0, 0, ddsd.dwWidth, ddsd.dwHeight, hdcImage, x, y, dx, dy, SRCCOPY);
+ pdds->ReleaseDC(hdc);
+ }
+
+ DeleteDC(hdcImage);
+
+ return hr;
+}
+
+//
+// DDLoadPalette
+//
+// Create a DirectDraw palette object from a bitmap resoure
+//
+// if the resource does not exist or NULL is passed create a
+// default 332 palette.
+//
+extern "C" IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap)
+{
+ IDirectDrawPalette* ddpal;
+ int i;
+ int n;
+ int fh;
+ HRSRC h;
+ LPBITMAPINFOHEADER lpbi;
+ PALETTEENTRY ape[256];
+ RGBQUAD * prgb;
+
+ //
+ // build a 332 palette as the default.
+ //
+ for (i=0; i<256; i++)
+ {
+ ape[i].peRed = (BYTE)(((i >> 5) & 0x07) * 255 / 7);
+ ape[i].peGreen = (BYTE)(((i >> 2) & 0x07) * 255 / 7);
+ ape[i].peBlue = (BYTE)(((i >> 0) & 0x03) * 255 / 3);
+ ape[i].peFlags = (BYTE)0;
+ }
+
+ //
+ // get a pointer to the bitmap resource.
+ //
+ if (szBitmap && (h = FindResourceA(NULL, szBitmap, (LPCSTR)RT_BITMAP)))
+ {
+ lpbi = (LPBITMAPINFOHEADER)LockResource(LoadResource(NULL, h));
+ if (!lpbi)
+ OutputDebugStringA("lock resource failed\n");
+ prgb = (RGBQUAD*)((BYTE*)lpbi + lpbi->biSize);
+
+ if (lpbi == NULL || lpbi->biSize < sizeof(BITMAPINFOHEADER))
+ n = 0;
+ else if (lpbi->biBitCount > 8)
+ n = 0;
+ else if (lpbi->biClrUsed == 0)
+ n = 1 << lpbi->biBitCount;
+ else
+ n = lpbi->biClrUsed;
+
+ //
+ // a DIB color table has its colors stored BGR not RGB
+ // so flip them around.
+ //
+ for(i=0; i 8)
+ n = 0;
+ else if (bi.biClrUsed == 0)
+ n = 1 << bi.biBitCount;
+ else
+ n = bi.biClrUsed;
+
+ //
+ // a DIB color table has its colors stored BGR not RGB
+ // so flip them around.
+ //
+ for(i=0; iCreatePalette(DDPCAPS_8BIT, ape, &ddpal, NULL);
+
+ return ddpal;
+}
+
+/*
+ * DDColorMatch
+ *
+ * convert a RGB color to a pysical color.
+ *
+ * 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)
+{
+ COLORREF rgbT;
+ HDC hdc;
+ DWORD dw = CLR_INVALID;
+ DDSURFACEDESC ddsd;
+ HRESULT hres;
+
+ //
+ // use GDI SetPixel to color match for us
+ //
+ if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK)
+ {
+ rgbT = GetPixel(hdc, 0, 0); // save current pixel value
+ SetPixel(hdc, 0, 0, rgb); // set our value
+ pdds->ReleaseDC(hdc);
+ }
+
+ //
+ // now lock the surface so we can read back the converted color
+ //
+ ddsd.dwSize = sizeof(ddsd);
+ while ((hres = pdds->Lock(NULL, &ddsd, 0, NULL)) == DDERR_WASSTILLDRAWING)
+ ;
+
+ if (hres == DD_OK)
+ {
+ dw = *(DWORD *)ddsd.lpSurface; // get DWORD
+ if(ddsd.ddpfPixelFormat.dwRGBBitCount < 32)
+ dw &= (1 << ddsd.ddpfPixelFormat.dwRGBBitCount)-1; // mask it to bpp
+ pdds->Unlock(NULL);
+ }
+
+ //
+ // now put the color that was there back.
+ //
+ if (rgb != CLR_INVALID && pdds->GetDC(&hdc) == DD_OK)
+ {
+ SetPixel(hdc, 0, 0, rgbT);
+ pdds->ReleaseDC(hdc);
+ }
+
+ return dw;
+}
+
+/*
+ * DDSetColorKey
+ *
+ * set a color key for a surface, given a 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)
+{
+ DDCOLORKEY ddck;
+
+ ddck.dwColorSpaceLowValue = DDColorMatch(pdds, rgb);
+ ddck.dwColorSpaceHighValue = ddck.dwColorSpaceLowValue;
+ return pdds->SetColorKey(DDCKEY_SRCBLT, &ddck);
+}
+
+extern "C" HRESULT DDSetColorKey2(IDirectDrawSurface* pdds, COLORREF rgb1,
+ COLORREF rgb2)
+{
+ DDCOLORKEY ddck;
+
+ ddck.dwColorSpaceLowValue = DDColorMatch(pdds, rgb1);
+ ddck.dwColorSpaceHighValue = DDColorMatch(pdds, rgb2);
+ return pdds->SetColorKey(DDCKEY_SRCBLT, &ddck);
+}
\ No newline at end of file
diff --git a/ddutil.h b/src/ddutil.h
similarity index 77%
rename from ddutil.h
rename to src/ddutil.h
index 9b550d1..86c1d1d 100644
--- a/ddutil.h
+++ b/src/ddutil.h
@@ -7,24 +7,26 @@
*
***************************************************************************/
+#define DIRECTDRAW_VERSION 0x0500
using namespace std;
#pragma once
+#include
-#include "ddraw.h"
+#ifdef __cplusplus
+extern "C" { /* Assume C declarations for C++ */
+#endif /* __cplusplus */
-extern void DDSetDebug (BOOL bDebug);
-extern IDirectDrawSurface * DDConnectBitmap(IDirectDraw *pdd, HBITMAP hbm);
+extern void DDSetDebug(BOOL bDebug);
extern IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap);
extern IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap, int dx, int dy);
extern HRESULT DDReLoadBitmap(IDirectDrawSurface *pdds, LPCSTR szBitmap);
extern HRESULT DDCopyBitmap(IDirectDrawSurface *pdds, HBITMAP hbm, int x, int y, int dx, int dy);
extern DWORD DDColorMatch(IDirectDrawSurface *pdds, COLORREF rgb);
extern HRESULT DDSetColorKey(IDirectDrawSurface *pdds, COLORREF rgb);
-extern HRESULT DDSetColorKey2(IDirectDrawSurface *pdds, COLORREF rgb1, COLORREF rgb2);
+extern HRESULT DDSetColorKey2(IDirectDrawSurface* pdds, COLORREF rgb1, COLORREF rgb2);
-/*
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
diff --git a/src/decblock.cpp b/src/decblock.cpp
new file mode 100644
index 0000000..a659d10
--- /dev/null
+++ b/src/decblock.cpp
@@ -0,0 +1,776 @@
+// DecBlock.cpp
+//
+
+#include "def.h"
+#include "decor.h"
+#include "misc.h"
+#include "obstacle.h"
+#include "dectables.h"
+
+BOOL CDecor::BlitzActif(POINT cel)
+{
+ if (m_phase == WM_PHASE_BUILD) {
+ //TODO: rewrite this like a human
+ int foo = m_time >> 31;
+ return 1 - (((m_time ^ foo) - foo & 1 ^ foo) == foo);
+ }
+
+ POINT pos = { cel.x * DIMOBJX, cel.y * DIMOBJY };
+
+ int num = m_time % 100;
+
+ if (m_blupiPos.x >= pos.x - 80 && m_blupiPos.x <= pos.x + 80 &&
+ m_blupiPos.y >= pos.y - 500 && m_blupiPos.y <= pos.y + 500)
+ {
+ if (m_time % 100 < 70 && cel.y > 0 && m_decor[cel.x][cel.y - 1].icon == 0x130)
+ {
+ PlaySound(SOUND_BLITZ, pos, 0);
+ }
+
+ for (int i = 0; table_blitz[i] != -1; i++)
+ {
+ if (m_time % 100 == i) return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+int CDecor::SoundEnviron(int sound, int obstacle)
+{
+ if ((obstacle >= 32 && obstacle <= 34) || (obstacle >= 41 && obstacle <= 47) || (obstacle >= 139 && obstacle <= 143))
+ {
+ if (sound == SOUND_JUMPTOC)
+ {
+ return 79;
+ }
+ if (sound == SOUND_JUMPEND)
+ {
+ return 78;
+ }
+ }
+ if ((obstacle >= 1 && obstacle <= 28) || (obstacle >= 78 && obstacle <= 90) || (obstacle >= 250 && obstacle <= 260) || (obstacle >= 311 && obstacle <= 316) || (obstacle >= 324 && obstacle <= 329))
+ {
+ if (sound == SOUND_JUMPTOC)
+ {
+ return 81;
+ }
+ if (sound == SOUND_JUMPEND)
+ {
+ return 80;
+ }
+ }
+ if ((obstacle >= 284 && obstacle <= 303) || obstacle == 338)
+ {
+ if (sound == SOUND_JUMPTOC)
+ {
+ return 83;
+ }
+ if (sound == SOUND_JUMPEND)
+ {
+ return 82;
+ }
+ }
+ if (obstacle >= 341 && obstacle <= 363)
+ {
+ if (sound == SOUND_JUMPTOC)
+ {
+ return 85;
+ }
+ if (sound == SOUND_JUMPEND)
+ {
+ return 84;
+ }
+ }
+ if (obstacle >= 215 && obstacle <= 234)
+ {
+ if (sound == SOUND_JUMPTOC)
+ {
+ return 87;
+ }
+ if (sound == SOUND_JUMPEND)
+ {
+ return 86;
+ }
+ }
+ if (obstacle >= 246 && obstacle <= 249)
+ {
+ if (sound == SOUND_JUMPTOC)
+ {
+ return 89;
+ }
+ if (sound == SOUND_JUMPEND)
+ {
+ return 88;
+ }
+ }
+ if (obstacle >= 107 && obstacle <= 109)
+ {
+ if (sound == SOUND_JUMPTOC)
+ {
+ return 91;
+ }
+ if (sound == SOUND_JUMPEND)
+ {
+ return 90;
+ }
+ }
+ return sound;
+}
+
+
+int CDecor::IsWorld(POINT pos)
+{
+ pos.x += 30;
+ pos.y += 30;
+ if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400)
+ {
+ return -1;
+ }
+ int icon = m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon;
+ if (icon >= 158 && icon <= 165)
+ {
+ return icon - 158 + 1;
+ }
+ if (icon >= 166 && icon <= 173)
+ {
+ return icon - 166 + 1;
+ }
+ if (icon == 309 || icon == 310)
+ {
+ return 9;
+ }
+ if (icon >= 411 && icon <= 415)
+ {
+ return icon - 411 + 10;
+ }
+ if (icon >= 416 && icon <= 420)
+ {
+ return icon - 416 + 10;
+ }
+ if (icon >= 174 && icon <= 181)
+ {
+ return icon - 174 + 1;
+ }
+ if (icon == 184)
+ {
+ return 199;
+ }
+ return -1;
+}
+
+void CDecor::ActiveSwitch(BOOL bState, POINT cel)
+{
+ POINT pos;
+ pos.x = cel.x * DIMOBJX;
+ pos.y = cel.y * DIMOBJY;
+ ModifDecor(pos, bState ? 384 : 385);
+ PlaySound(bState ? 77 : 76, pos);
+ cel.x -= 20;
+ for (int i = 0; i < 41; i++)
+ {
+ if (cel.x >= 0 && cel.x < 100 && m_decor[cel.x][cel.y].icon == (bState ? 379 : 378))
+ {
+ pos.x = cel.x * DIMOBJX;
+ pos.y = cel.y * DIMOBJY;
+ ModifDecor(pos, bState ? 378 : 379);
+ }
+ cel.x++;
+ }
+}
+
+int CDecor::GetTypeBarre(POINT pos)
+{
+ POINT pos2 = pos;
+ pos.x += 30;
+ pos.y += 22;
+ if (pos.y % 64 > 44)
+ {
+ return 0;
+ }
+ if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400)
+ {
+ return 0;
+ }
+ int icon = m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon;
+ if (icon != 138 && icon != 202)
+ {
+ return 0;
+ }
+ if (pos.y >= 6336)
+ {
+ return 1;
+ }
+ icon = m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY + 1].icon;
+ if (IsPassIcon(icon))
+ {
+ return 2;
+ }
+ RECT rect = BlupiRect(pos2);
+ rect.top = pos2.y + 60 - 2;
+ rect.bottom = pos2.y + 60 - 1;
+ if (DecorDetect(rect, TRUE))
+ {
+ return 2;
+ }
+ return 1;
+}
+
+BOOL CDecor::IsLave(POINT pos)
+{
+ pos.x += 30;
+ return pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 68;
+}
+
+BOOL CDecor::IsPiege(POINT pos)
+{
+ pos.x += 30;
+ pos.y += 60;
+ return pos.x % 64 >= 15 && pos.x % 64 <= 49 && pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 373;
+}
+
+BOOL CDecor::IsGoutte(POINT pos, BOOL bAlways)
+{
+ pos.x += 30;
+ if (pos.x % 64 < 15 || pos.x % 64 > 49)
+ {
+ return FALSE;
+ }
+ if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400)
+ {
+ return FALSE;
+ }
+ int icon = m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon;
+ if (bAlways)
+ {
+ return icon == 404 || icon == 410;
+ }
+ return icon == 404;
+}
+
+BOOL CDecor::IsScie(POINT pos)
+{
+ pos.x += 30;
+ return pos.x % 64 >= 4 && pos.x % 64 <= 60 && pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 378;
+}
+
+BOOL CDecor::IsSwitch(POINT pos, POINT celSwitch)
+{
+ pos.x += 30;
+ if (pos.x % 64 < 4 || pos.x % 64 > 60)
+ {
+ return FALSE;
+ }
+ if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400)
+ {
+ return FALSE;
+ }
+ celSwitch.x = pos.x / DIMOBJX;
+ celSwitch.y = pos.y / DIMOBJY;
+ return m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 384 || m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 385;
+}
+
+BOOL CDecor::IsEcraseur(POINT pos)
+{
+ if (m_time / 3 % 10 > 2)
+ {
+ return FALSE;
+ }
+ pos.x += 30;
+ return pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 317;
+}
+
+BOOL CDecor::IsBlitz(POINT pos, BOOL bAlways)
+{
+ pos.x += 30;
+ if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400)
+ {
+ return FALSE;
+ }
+ POINT tinyPoint;
+ tinyPoint.x = pos.x / DIMOBJX;
+ tinyPoint.y = pos.y / DIMOBJY;
+ return m_decor[tinyPoint.x][tinyPoint.y].icon == 305 && (bAlways || BlitzActif(tinyPoint));
+}
+
+BOOL CDecor::IsRessort(POINT pos)
+{
+ pos.x += 30;
+ pos.y += 60;
+ return pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 211;
+}
+
+BOOL CDecor::IsTemp(POINT pos)
+{
+ pos.x += 30;
+ pos.y += 60;
+ return pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 324;
+}
+
+BOOL CDecor::IsBridge(POINT pos, POINT celBridge)
+{
+ pos.x += 30;
+ pos.y += 60;
+ if (pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 364)
+ {
+ celBridge.x = pos.x / DIMOBJX;
+ celBridge.y = pos.y / DIMOBJY;
+ return TRUE;
+ }
+ pos.y -= 60;
+ if (pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 364)
+ {
+ celBridge.x = pos.x / DIMOBJX;
+ celBridge.y = pos.y / DIMOBJY;
+ return TRUE;
+ }
+ return FALSE;
+
+}
+
+int CDecor::IsDoor(POINT pos, POINT celPorte)
+{
+ int num;
+ if (m_blupiDir == 1)
+ {
+ num = -60;
+ }
+ else
+ {
+ num = 60;
+ }
+ pos.x += 30;
+ for (int i = 0; i < 2; i++)
+ {
+ if (pos.x >= 0 && pos.x < DIMOBJX * MAXCELX && pos.y >= 0 && pos.y < DIMOBJY * MAXCELY && m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon >= 334 && m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon <= 336)
+ {
+ celPorte.x = pos.x / DIMOBJX;
+ celPorte.y = pos.y / DIMOBJY;
+ return m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon;
+ }
+ pos.x += num;
+ }
+ return -1;
+}
+
+int CDecor::IsTeleporte(POINT pos)
+{
+ if (pos.x % DIMOBJX > 6)
+ {
+ return -1;
+ }
+ pos.x += 30;
+ pos.y -= 60;
+ if (pos.x < 0 || pos.x >= DIMOBJX * MAXCELX || pos.y < 0 || pos.y >= DIMOBJY * MAXCELY)
+ {
+ return -1;
+ }
+ if (m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon >= 330 && m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon <= 333)
+ {
+ return m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon;
+ }
+ return -1;
+}
+
+BOOL CDecor::SearchTeleporte(POINT pos, POINT newpos)
+{
+ int num = IsTeleporte(pos);
+ if (num == -1)
+ {
+ return FALSE;
+ }
+ for (int i = 0; i < 100; i++)
+ {
+ for (int j = 0; j < 100; j++)
+ {
+ if (num == m_decor[i][j].icon)
+ {
+ newpos.x = i * 64;
+ newpos.y = j * 64 + 60;
+ if (newpos.x < pos.x - 40 || newpos.x > pos.x + 40 || newpos.y < pos.y - 40 || newpos.y > pos.y + 40)
+ {
+ return TRUE;
+ }
+ }
+ }
+ }
+ return FALSE;
+}
+
+BOOL CDecor::IsSurfWater(POINT pos)
+{
+ if (pos.y % 64 < 64 - BLUPISURF)
+ {
+ return FALSE;
+ }
+ int icon = m_decor[(pos.x + 30) / 64][pos.y / DIMOBJY].icon;
+ int icon2 = m_decor[(pos.x + 30) / 64][(pos.y + BLUPISURF) / 64].icon;
+ return icon != 92 && icon2 == 92;
+}
+
+BOOL CDecor::IsDeepWater(POINT pos)
+{
+ int num = (pos.x + 30) / 64;
+ int num2 = pos.y / DIMOBJY;
+ if (num < 0 || num >= 100 || num2 < 0 || num2 >= 100)
+ {
+ return FALSE;
+ }
+ int icon = m_decor[num][num2].icon;
+ return icon == 91 || icon == 92;
+}
+
+BOOL CDecor::IsOutWater(POINT pos)
+{
+ int icon = m_decor[(pos.x + 30) / 64][(pos.y + 30) / 64].icon;
+ return icon != 91 && icon != 92 && IsPassIcon(icon);
+}
+
+BOOL CDecor::IsPassIcon(int icon)
+{
+ if (icon == 324 && m_time / 4 % 20 >= 18)
+ {
+ return TRUE;
+ }
+ if (icon >= 0 && icon < MAXQUART)
+ {
+ for (int i = 0; i < 16; i++)
+ {
+ if (table_decor_quart[icon * 16 + i] != 0)
+ {
+ return FALSE;
+ }
+ }
+ }
+ return TRUE;
+}
+
+BOOL CDecor::IsBlocIcon(int icon)
+{
+ if (icon < 0 || icon >= MAXQUART)
+ {
+ return FALSE;
+ }
+ if (icon == 324 && m_time / 4 % 20 < 18)
+ {
+ return FALSE;
+ }
+ for (int i = 0; i < 16; i++)
+ {
+ if (table_decor_quart[icon * 16 + i] == 0)
+ {
+ return FALSE;
+ }
+ }
+ return FALSE;
+}
+
+BOOL CDecor::IsVentillo(POINT pos)
+{
+ int num = 0;
+ BOOL flag = FALSE;
+ POINT tinyPoint;
+ pos.x += 30;
+ pos.y += 30;
+ if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400)
+ {
+ return FALSE;
+ }
+ int icon = m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon;
+ if (icon < 126 || icon > 137)
+ {
+ return FALSE;
+ }
+ if (icon == 126)
+ {
+ if (pos.x % 64 <= 16)
+ {
+ flag = TRUE;
+ }
+ tinyPoint.x = -64;
+ tinyPoint.y = 0;
+ num = 110;
+ }
+ if (icon == 129)
+ {
+ if (pos.x % 64 >= 48)
+ {
+ flag = TRUE;
+ }
+ tinyPoint.x = 64;
+ tinyPoint.y = 0;
+ num = 114;
+ }
+ if (icon == 132)
+ {
+ if (pos.y % 64 <= 32)
+ {
+ flag = TRUE;;
+ }
+ tinyPoint.x = 0;
+ tinyPoint.y = -64;
+ num = 118;
+ }
+ if (icon == 135)
+ {
+ if (pos.y % 64 >= 48)
+ {
+ flag = TRUE;
+ }
+ tinyPoint.x = 0;
+ tinyPoint.y = 64;
+ num = 122;
+ }
+ if (!flag)
+ {
+ return FALSE;
+ }
+ ModifDecor(pos, -1);
+ do
+ {
+ pos.x += tinyPoint.x;
+ pos.y += tinyPoint.y;
+ if (num != m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon)
+ {
+ break;
+ }
+ ModifDecor(pos, -1);
+ } while (pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400);
+ return TRUE;
+}
+
+void CDecor::ModifDecor(POINT pos, int icon, BOOL bMulti)
+{// TODO: this
+ int icon2 = m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon;
+ if (icon == -1 && icon >= 126 && icon2 <= 137)
+ {
+
+ }
+ m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon = icon;
+}
+
+BOOL CDecor::IsRightBorder(POINT pos, POINT offset)
+{
+ return FALSE; // TODO
+}
+
+
+BOOL CDecor::IsFromage(POINT cel)
+{
+ if (!IsValidCel(cel)) return FALSE;
+
+ int icon = m_decor[cel.x][cel.y].icon;
+ return (icon >= 246 && icon <= 249) || icon == 339;
+}
+
+BOOL CDecor::IsGrotte(POINT cel)
+{
+ if (!IsValidCel(cel)) return FALSE;
+
+ int icon = m_decor[cel.x][cel.y].icon;
+ return icon = 284 || icon == 301 || icon == 337;
+}
+
+void CDecor::AdaptMidBorder(POINT cel)
+{
+ if (!IsValidCel(cel)) return;
+
+ int num = 15;
+ if (!IsRightBorder({ cel.x, cel.y + 1 }, { 0, -1 }))
+ {
+ num &= -2;
+ }
+ if (!IsRightBorder({ cel.x, cel.y + 1 }, { 0, 1 }))
+ {
+ num &= -3;
+ }
+ if (!IsRightBorder({ cel.x + 1, cel.y }, { -1, 0 }))
+ {
+ num &= -5;
+ }
+ if (!IsRightBorder({ cel.x - 1, cel.y }, { 1, 0 }))
+ {
+ num &= -9;
+ }
+ int num2 = m_decor[cel.x][cel.y].icon;
+ if (num2 == 156)
+ {
+ num2 = 35;
+ }
+ if (num2 == 252 || num2 == 253)
+ {
+ num2 = 251;
+ }
+ if (num2 == 255)
+ {
+ num2 = 254;
+ }
+ if (num2 == 362)
+ {
+ num2 = 347;
+ }
+ if (num2 == 363)
+ {
+ num2 = 348;
+ }
+ if (num2 >= 341 && num2 <= 346)
+ {
+ num2 = 341;
+ }
+ for (int i = 0; i < 144; i++)
+ {
+ if (num2 == table_adapt_decor[i])
+ {
+ num2 = table_adapt_decor[i / 16 * 16 + num];
+ if (num2 == 35 && rand() % 2 == 0)
+ {
+ num2 = 156;
+ }
+ if (num2 == 251)
+ {
+ num2 = Random(251, 253);
+ }
+ if (num2 == 254 && rand() % 2 == 0)
+ {
+ num2 = 255;
+ }
+ if (num2 == 347 && rand() % 2 == 0)
+ {
+ num2 = 362;
+ }
+ if (num2 == 348 && rand() % 2 == 0)
+ {
+ num2 = 363;
+ }
+ if (num2 == 341)
+ {
+ num2 = Random(341, 346);
+ }
+ m_decor[cel.x][cel.y].icon = num2;
+ return;
+ }
+ }
+ num2 = m_decor[cel.x][cel.y].icon;
+ if (num2 == -1 || (num2 >= 264 && num2 <= 282))
+ {
+ num = 15;
+ if (!IsFromage(cel + POINT{ 0,1 }))
+ {
+ num &= -2;
+ }
+ if (!IsFromage(cel - POINT{ 0,1 }))
+ {
+ num &= -3;
+ }
+ if (!IsFromage(cel + POINT{ 1,0 }))
+ {
+ num &= -5;
+ }
+ if (!IsFromage(cel - POINT{ 1,0 }))
+ {
+ num &= -9;
+ }
+ num2 = table_adapt_fromage[num];
+ if (num2 == 268 && rand() % 2 == 0)
+ {
+ num2 = 279;
+ }
+ if (num2 == 269 && rand() % 2 == 0)
+ {
+ num2 = 280;
+ }
+ if (num2 == 264 && rand() % 2 == 0)
+ {
+ num2 = 281;
+ }
+ if (num2 == 265 && rand() % 2 == 0)
+ {
+ num2 = 282;
+ }
+ m_decor[cel.x][cel.y].icon = num2;
+ }
+ num2 = m_decor[cel.x][cel.y].icon;
+ if (num2 == -1 || (num2 >= 285 && num2 <= 303 && num2 != 301))
+ {
+ num = 15;
+ if (!IsGrotte(cel+POINT{0,1}))
+ {
+ num &= -2;
+ }
+ if (!IsGrotte(cel-POINT{0,1}))
+ {
+ num &= -3;
+ }
+ if (!IsGrotte(cel+POINT{1,0}))
+ {
+ num &= -5;
+ }
+ if (!IsGrotte(cel-POINT{1,0}))
+ {
+ num &= -9;
+ }
+ num2 = table_adapt_fromage[num + 16];
+ if (num2 == 289 && rand() % 2 == 0)
+ {
+ num2 = 300;
+ }
+ if (num2 == 285 && rand() % 2 == 0)
+ {
+ num2 = 302;
+ }
+ if (num2 == 286 && rand() % 2 == 0)
+ {
+ num2 = 303;
+ }
+ m_decor[cel.x][cel.y].icon = num2;
+ }
+}
+
+void CDecor::AdaptBorder(POINT cel)
+{
+ AdaptMidBorder(cel);
+ AdaptMidBorder(cel + POINT{1, 0});
+ AdaptMidBorder(cel - POINT{1, 0});
+ AdaptMidBorder(cel + POINT{ 0,1 });
+ AdaptMidBorder(cel - POINT{ 0,1 });
+ int icon = m_decor[cel.x][cel.y].icon;
+ if (icon != -1 && !IsPassIcon(icon))
+ {
+ MoveObjectDelete(cel);
+ }
+ icon = m_decor[cel.x][cel.y].icon;
+ if (icon == 304)
+ {
+ for (int i = 0; i < 4; i++)
+ {
+ cel.y++;
+ if (cel.y >= 100)
+ {
+ break;
+ }
+ icon = m_decor[cel.x][cel.y].icon;
+ if (icon != -1)
+ {
+ break;
+ }
+ m_decor[cel.x][cel.y].icon = 305;
+ }
+ }
+ if (icon == -1)
+ {
+ for (int i = 0; i < 4; i++)
+ {
+ cel.y++;
+ if (cel.y >= 100)
+ {
+ return;
+ }
+ icon = m_decor[cel.x][cel.y].icon;
+ if (icon != 305)
+ {
+ return;
+ }
+ m_decor[cel.x][cel.y].icon = -1;
+ }
+ }
+}
\ No newline at end of file
diff --git a/decblupi.cpp b/src/decblupi.cpp
similarity index 67%
rename from decblupi.cpp
rename to src/decblupi.cpp
index bf6f6f7..3314f6e 100644
--- a/decblupi.cpp
+++ b/src/decblupi.cpp
@@ -5,6 +5,7 @@
#include "DECOR.H"
#include "MISC.H"
#include "RESOURCE.H"
+#include "dectables.h"
int CDecor::GetBlupiChannelStandard()
{
@@ -106,7 +107,7 @@ void CDecor::BlupiSearchIcon()
}
if (num3 == 10)
{
- num3 == 26;
+ num3 = 26;
}
if (num3 == 3)
{
@@ -304,57 +305,92 @@ BOOL CDecor::BlupiBloque(POINT pos, int dir)
return DecorDetect(rect);
}
+// rewritten. wip
+/*
void CDecor::BlupiStep()
{
- POINT tinyPoint;
- POINT tinyPoint2;
+ RECT blupiRect, rect1;
BlupiAdjust();
- m_blupiLastPos = m_blupiPos;
- POINT tinyPoint3 = m_blupiPos;
+ POINT blupiEndPos = m_blupiPos + m_blupiVector;
+ if (m_blupiVector.x != 0 || m_blupiVector.y != 0)
+ {
+ blupiRect = BlupiRect(m_blupiPos);
+ rect1.top = m_blupiPos.y + 11;
+ rect1.left = m_blupiPos.x;
+ rect1.right =
+ rect1.bottom = m_blupiPos.x + 58;
+ TestPath(rect1, m_blupiPos, &blupiEndPos);
+ }
+ m_blupiVent = FALSE;
+ if (m_blupiTransport == -1)
+ {
+ if (!m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus)
+ {
+ int object = m_decor[(blupiEndPos.x + 32) / 64][(blupiEndPos.y + 32) / 64].icon;
+ if (object == 110) blupiEndPos.x -= 9; // left wind
+ if (object == 114) blupiEndPos.x += 9; // right
+ if (object == 118) blupiEndPos.y -= 9; // up
+ if (object == 122) blupiEndPos.y += 9; // down
+ if (object >= 110 && object <= 125)
+ {
+ m_blupiVent = TRUE;
+ rect1.top = m_blupiPos.y + 11;
+ rect1.left = m_blupiPos.x + 12;
+ rect1.right = m_blupiPos.x + 48;
+ rect1.bottom = m_blupiPos.y + 58;
+ TestPath(rect1, m_blupiPos, &blupiEndPos);
+ }
+ }
+ }
+}
+*/
+
+// derived from winphone code
+
+void CDecor::BlupiStep()
+{
+ int m_blupiSpeedX = 0; //
+ int m_blupiSpeedY = 0; // lol. lmao even
+ POINT tinyPoint;
+ POINT tinyPoint2 = m_blupiPos; // = m_blupiPos ?
+ BlupiAdjust();
+ //m_blupiLastPos = m_blupiPos;
+ POINT adjustPos = m_blupiPos;
BOOL flag = m_blupiAir;
int blupiAction = m_blupiAction;
BOOL flag2 = FALSE;
BOOL flag3 = FALSE;
- tinyPoint3.x += m_blupiVector.x;
- tinyPoint3.y += m_blupiVector.y;
- if (m_blupiFocus && (tinyPoint3.y + 30) / 64 >= 99)
- {
- BlupiDead(75, -1);
- m_blupiRestart = TRUE;
- m_blupiAir = TRUE;
- m_blupiPos.y = m_blupipos.y / DIMOBJY * 64 + BLUPIOFFY;
- PlaySound(8, m_blupiPos);
- return;
- }
+ adjustPos.x += m_blupiVector.x;
+ adjustPos.y += m_blupiVector.y;
RECT rect;
if (m_blupiVector.x != 0 || m_blupiVector.y != 0)
{
rect = BlupiRect(m_blupiPos);
rect.top = m_blupiPos.y + 11;
- rect.bottom = m_blupiPos.y + 60 - 2;
- TestPath(rect, m_blupiPos, tinyPoint3);
+ rect.bottom = m_blupiPos.y + 58;
+ TestPath(rect, m_blupiPos, &adjustPos);
}
m_blupiVent = FALSE;
int num;
if (m_blupiTransport == -1 && !m_blupiJeep && !m_blupiTank && !m_blupiSkate
&& m_blupiFocus)
{
- num = m_decor[(tinyPoint3.x + 30) / 64, (tinyPoint3.y + 30) / 64]->icon;
+ num = m_decor[(adjustPos.x + 30) / 64][(adjustPos.y + 30) / 64].icon;
if (num == 110)
{
- tinyPoint3.x -= 9;
+ adjustPos.x -= 9;
}
if (num == 114)
{
- tinyPoint3.x += 9;
+ adjustPos.x += 9;
}
if (num == 118)
{
- tinyPoint3.y -= 20;
+ adjustPos.y -= 20;
}
if (num == 122)
{
- tinyPoint3.y += 20;
+ adjustPos.y += 20;
}
if (num >= 110 && num <= 125)
{
@@ -363,45 +399,45 @@ void CDecor::BlupiStep()
rect.right = m_blupiPos.x + 60 - 12;
rect.top = m_blupiPos.y + 11;
rect.bottom = m_blupiPos.y + 60 - 2;
- TestPath(rect, m_blupiPos, tinyPoint3);
+ TestPath(rect, m_blupiPos, &adjustPos);
}
}
- BOOL flag4;
+ m_blupiVent = FALSE;
if (m_blupiTransport == -1)
{
- rect = BlupiRect(tinyPoint3);
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60 - 1;
+ rect = BlupiRect(adjustPos);
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60 - 1;
flag = !DecorDetect(rect);
}
else
{
- flag4 = FALSE;
+ flag = FALSE;
}
- rect = BlupiRect(tinyPoint3);
- rect.top = tinyPoint3.y + 10;
- rect.bottom = tinyPoint3.y + 20;
+ rect = BlupiRect(adjustPos);
+ rect.top = adjustPos.y + 10;
+ rect.bottom = adjustPos.y + 20;
BOOL flag5 = DecorDetect(rect);
int detectIcon = m_detectIcon;
- if (!m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && flag4 && m_blupiFocus)
+ if (!m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && flag5 && m_blupiFocus)
{
if (m_blupiFocus)
{
m_blupiAction = 5;
m_blupiPhase = 0;
}
- m_blupiVitesse.y = 1.0;
+ m_blupiVitesse.y = 1;
m_blupiAir = true;
flag = true;
}
- if (!m_blupiNage && !m_blupiSurf && !m_blupiSuspend && !m_blupiAir && IsRessort(tinyPoint3))
+ if (!m_blupiNage && !m_blupiSurf && !m_blupiSuspend && !m_blupiAir && IsRessort(adjustPos))
{
if ((m_blupiHelico || m_blupiOver) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi)
{
m_blupiHelico = false;
m_blupiOver = false;
- tinyPoint.x = tinyPoint3.x - 34;
- tinyPoint.y = tinyPoint3.y - 34;
+ tinyPoint.x = adjustPos.x - 34;
+ tinyPoint.y = adjustPos.y - 34;
ObjectStart(tinyPoint, 9, 0);
m_decorAction = 1;
m_decorPhase = 0;
@@ -414,8 +450,8 @@ void CDecor::BlupiStep()
if (m_blupiJeep && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi)
{
m_blupiJeep = false;
- tinyPoint.x = tinyPoint3.x - 34;
- tinyPoint.y = tinyPoint3.y - 34;
+ tinyPoint.x = adjustPos.x - 34;
+ tinyPoint.y = adjustPos.y - 34;
ObjectStart(tinyPoint, 9, 0);
m_decorAction = 1;
m_decorPhase = 0;
@@ -428,8 +464,8 @@ void CDecor::BlupiStep()
if (m_blupiTank && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi)
{
m_blupiTank = false;
- tinyPoint.x = tinyPoint3.x - 34;
- tinyPoint.y = tinyPoint3.y - 34;
+ tinyPoint.x = adjustPos.x - 34;
+ tinyPoint.y = adjustPos.y - 34;
ObjectStart(tinyPoint, 9, 0);
m_decorAction = 1;
m_decorPhase = 0;
@@ -442,8 +478,8 @@ void CDecor::BlupiStep()
if (m_blupiSkate && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi)
{
m_blupiSkate = false;
- tinyPoint.x = tinyPoint3.x - 34;
- tinyPoint.y = tinyPoint3.y - 34;
+ tinyPoint.x = adjustPos.x - 34;
+ tinyPoint.y = adjustPos.y - 34;
ObjectStart(tinyPoint, 9, 0);
m_decorAction = 1;
m_decorPhase = 0;
@@ -468,7 +504,7 @@ void CDecor::BlupiStep()
}
m_blupiAir = true;
flag = true;
- PlaySound(41, tinyPoint3);
+ PlaySound(41, adjustPos);
}
if ((m_keyPress & 1) != 0 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
{
@@ -483,13 +519,13 @@ void CDecor::BlupiStep()
m_blupiPhase = 0;
if (m_blupiSkate)
{
- PlaySound(1, tinyPoint3);
+ PlaySound(1, adjustPos);
m_blupiVitesse.y = (m_blupiPower ? -17 : -13);
}
else
{
- PlaySound(1, tinyPoint3);
- if (IsNormalJump(tinyPoint3))
+ PlaySound(1, adjustPos);
+ if (m_keyPress & KEY_UP)
{
m_blupiVitesse.y = (m_blupiPower ? -26 : -16);
}
@@ -506,35 +542,35 @@ void CDecor::BlupiStep()
{
if (flag5 && m_blupiVitesse.y < 0)
{
- if (m_blupiVitesse.y < -14.0 && m_blupiAction != 11 && m_blupiAction != 75 && m_blupiAction != 76 && m_blupiAction != 77 && m_blupiAction != 78 && m_blupiAction != 79 && m_blupiAction != 80 && m_blupiAction != 81 && !m_blupiSkate)
+ if (m_blupiVitesse.y < -14 && m_blupiAction != 11 && m_blupiAction != 75 && m_blupiAction != 76 && m_blupiAction != 77 && m_blupiAction != 78 && m_blupiAction != 79 && m_blupiAction != 80 && m_blupiAction != 81 && !m_blupiSkate)
{
m_blupiJumpAie = true;
- PlaySound(40, tinyPoint3);
+ PlaySound(40, adjustPos);
}
else
{
- PlaySound(SoundEnviron(4, detectIcon), tinyPoint3);
+ PlaySound(SoundEnviron(4, detectIcon), adjustPos);
}
- m_blupiVitesse.y = 1.0;
+ m_blupiVitesse.y = 1;
}
- tinyPoint3.y += (int)(m_blupiVitesse.y * 2.0);
- if (m_blupiVitesse.y < 20.0)
+ adjustPos.y += (int)(m_blupiVitesse.y * 2);
+ if (m_blupiVitesse.y < 20)
{
- m_blupiVitesse.y += 2.0;
+ m_blupiVitesse.y += 2;
}
- rect = BlupiRect(tinyPoint3);
- rect.top = tinyPoint3.y + 60 - 30;
- rect.bottom = tinyPoint3.y + 60 - 1;
- if (m_blupiVitesse.y >= 0.0 && DecorDetect(rect))
+ rect = BlupiRect(adjustPos);
+ rect.top = adjustPos.y + 60 - 30;
+ rect.bottom = adjustPos.y + 60 - 1;
+ if (m_blupiVitesse.y >= 0 && DecorDetect(rect))
{
- tinyPoint3.y = tinyPoint3.y / 32 * 32 + BLUPIOFFY;
- if (!IsRessort(tinyPoint3))
+ adjustPos.y = adjustPos.y / 32 * 32 + BLUPIOFFY;
+ if (!IsRessort(adjustPos))
{
- PlaySound(SoundEnviron(3, m_detectIcon), tinyPoint3);
+ PlaySound(SoundEnviron(3, m_detectIcon), adjustPos);
}
if (m_blupiFocus)
{
- if (m_blupiVitesse.y > 20.0)
+ if (m_blupiVitesse.y > 20)
{
m_blupiAction = 61;
}
@@ -552,20 +588,20 @@ void CDecor::BlupiStep()
m_blupiPhase = 0;
}
}
- rect.left = tinyPoint3.x + 20;
- rect.right = tinyPoint3.x + 60 - 20;
- rect.top = tinyPoint3.y + 60 - 33;
- rect.bottom = tinyPoint3.y + 60 - 1;
- num = AscenseurDetect(rect, m_blupiPos, tinyPoint3);
- if (m_blupiVitesse.y >= 0.0 && num != -1)
+ rect.left = adjustPos.x + 20;
+ rect.right = adjustPos.x + 60 - 20;
+ rect.top = adjustPos.y + 60 - 33;
+ rect.bottom = adjustPos.y + 60 - 1;
+ num = AscenseurDetect(rect, m_blupiPos, adjustPos);
+ if (m_blupiVitesse.y >= 0 && num != -1)
{
m_blupiTransport = num;
- flag4 = false;
- PlaySound(3, tinyPoint3);
- tinyPoint3.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY;
+ flag = false;
+ PlaySound(3, adjustPos);
+ adjustPos.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY;
if (m_blupiFocus)
{
- if (m_blupiVitesse.y > 20.0)
+ if (m_blupiVitesse.y > 20)
{
m_blupiAction = 61;
}
@@ -598,7 +634,7 @@ void CDecor::BlupiStep()
m_blupiCloud = true;
m_blupiTimeShield = 100;
m_jauges[1].SetHide(false);
- PlaySound(55, tinyPoint3);
+ PlaySound(55, adjustPos);
}
if (m_blupiAction == 58)
{
@@ -606,11 +642,11 @@ void CDecor::BlupiStep()
{
tinyPoint.x = m_blupiPos.x;
tinyPoint.y = m_blupiPos.y + 40;
- if (m_blupiVitesse.y > 0.0)
+ if (m_blupiVitesse.y > 0)
{
- tinyPoint.y += (int)(m_blupiVitesse.y * 4.0);
+ tinyPoint.y += (int)(m_blupiVitesse.y * 4);
}
- m_blupiVitesse.y -= 10.0;
+ m_blupiVitesse.y -= 10;
if (ObjectStart(tinyPoint, 23, 55) != -1)
{
PlaySound(52, m_blupiPos);
@@ -643,31 +679,31 @@ void CDecor::BlupiStep()
m_blupiPhase = 0;
m_blupiFocus = true;
}
- bool flag6;
+ BOOL flag6;
if (m_blupiAction == 48 && m_blupiPhase == 40)
{
m_blupiAction = 1;
m_blupiPhase = 0;
m_blupiFocus = true;
- num = MoveObjectDetect(tinyPoint3, out flag6);
- if (num != -1 && !flag6 && tinyPoint3.y - BLUPIFLOOR == m_moveObject[num].posCurrent.y)
+ num = MoveObjectDetect(adjustPos, &flag6);
+ if (num != -1 && !flag6 && adjustPos.y - BLUPIFLOOR == m_moveObject[num].posCurrent.y)
{
- if (m_blupiDir == 2 && tinyPoint3.x < m_moveObject[num].posCurrent.x)
+ if (m_blupiDir == 2 && adjustPos.x < m_moveObject[num].posCurrent.x)
{
- tinyPoint.x = tinyPoint3.x - 16;
- tinyPoint.y = tinyPoint3.y;
- int num2 = MoveObjectDetect(tinyPoint, out flag6);
+ tinyPoint.x = adjustPos.x - 16;
+ tinyPoint.y = adjustPos.y;
+ int num2 = MoveObjectDetect(tinyPoint, &flag6);
if (num2 == -1)
{
m_blupiAction = 9;
m_blupiPhase = 0;
}
}
- if (m_blupiDir == 1 && tinyPoint3.x > m_moveObject[num].posCurrent.x)
+ if (m_blupiDir == 1 && adjustPos.x > m_moveObject[num].posCurrent.x)
{
- tinyPoint.x = tinyPoint3.x + 16;
- tinyPoint.y = tinyPoint3.y;
- int num2 = MoveObjectDetect(tinyPoint, out flag6);
+ tinyPoint.x = adjustPos.x + 16;
+ tinyPoint.y = adjustPos.y;
+ int num2 = MoveObjectDetect(tinyPoint, &flag6);
if (num2 == -1)
{
m_blupiAction = 9;
@@ -750,13 +786,13 @@ void CDecor::BlupiStep()
{
m_blupiAction = 5;
m_blupiPhase = 0;
- m_blupiVitesse.y = -12.0;
+ m_blupiVitesse.y = -12;
m_blupiAir = true;
flag = true;
}
if (m_blupiAction == 49 && m_blupiPhase == 32)
{
- ObjectStart(m_sucettePos, m_sucetteType, 0);
+ //ObjectStart(m_sucettePos, m_sucetteType, 0); // respawn item (winphone behavior)
m_blupiAction = 1;
m_blupiPhase = 0;
m_blupiFocus = true;
@@ -764,11 +800,11 @@ void CDecor::BlupiStep()
m_blupiTimeShield = 100;
m_blupiPosMagic = m_blupiPos;
m_jauges[1].SetHide(false);
- PlaySound(44, tinyPoint3);
+ PlaySound(44, adjustPos);
}
if (m_blupiAction == 55 && m_blupiPhase == 36)
{
- ObjectStart(m_sucettePos, m_sucetteType, 0);
+ //ObjectStart(m_sucettePos, m_sucetteType, 0); // respawn item (winphone behavior)
m_blupiAction = 1;
m_blupiPhase = 0;
m_blupiFocus = true;
@@ -776,29 +812,29 @@ void CDecor::BlupiStep()
m_blupiTimeShield = 100;
m_blupiPosMagic = m_blupiPos;
m_jauges[1].SetHide(false);
- PlaySound(62, tinyPoint3);
+ PlaySound(62, adjustPos);
}
- if (m_blupiSpeedY < 0.0 && m_blupiLastSpeedY == 0.0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
+ if ( m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
{
m_blupiAction = 7;
m_blupiPhase = 0;
}
- if (m_blupiSpeedY == 0.0 && m_blupiLastSpeedY < 0.0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
+ if (m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
{
m_blupiAction = 1;
m_blupiPhase = 0;
}
- if (m_blupiSpeedY > 0.0 && m_blupiLastSpeedY == 0.0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 6 && m_blupiAction != 28 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
+ if ( m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 6 && m_blupiAction != 28 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
{
m_blupiAction = 6;
m_blupiPhase = 0;
}
- if (m_blupiSpeedY > 0.0 && m_blupiSpeedX == 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 6 && m_blupiAction != 28 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
+ if ( (m_keyPress & 1) == 0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 6 && m_blupiAction != 28 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
{
m_blupiAction = 6;
m_blupiPhase = 0;
}
- if (m_blupiSpeedY == 0.0 && m_blupiLastSpeedY > 0.0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
+ if (m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
{
m_blupiAction = 1;
m_blupiPhase = 0;
@@ -806,44 +842,44 @@ void CDecor::BlupiStep()
if (m_blupiAction == 7 && m_blupiPhase == 4)
{
m_scrollAdd.y = -150;
- PlaySound(21, tinyPoint3);
+ PlaySound(21, adjustPos);
}
if (m_blupiAction == 6 && m_blupiPhase == 4)
{
m_scrollAdd.y = 150;
- PlaySound(7, tinyPoint3);
+ PlaySound(7, adjustPos);
}
if (!m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
{
- if (m_blupiSpeedY > 0.0 && m_blupiSpeedX == 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 28 && m_blupiDir == 1 && (num = CaisseInFront()) != -1)
+ if ( (m_keyPress & 1) == 0 && m_blupiAction != 28 && m_blupiDir == 1 && (num = CaisseInFront()) != -1)
{
- tinyPoint3.x = m_moveObject[num].posCurrent.x + 64 - 5;
+ adjustPos.x = m_moveObject[num].posCurrent.x + 64 - 5;
m_blupiAction = 28;
m_blupiPhase = 0;
m_scrollAdd.y = 0;
- PlaySound(39, tinyPoint3);
+ PlaySound(39, adjustPos);
}
- if (m_blupiSpeedY > 0.0 && m_blupiSpeedX > 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 29 && m_blupiDir == 1 && CaisseInFront() != -1)
+ if ( (m_keyPress & 1) == 0 && m_blupiAction != 29 && m_blupiDir == 1 && CaisseInFront() != -1)
{
m_blupiAction = 29;
m_blupiPhase = 0;
m_scrollAdd.y = 0;
- PlaySound(39, tinyPoint3);
+ PlaySound(39, adjustPos);
}
- if (m_blupiSpeedY > 0.0 && m_blupiSpeedX == 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 28 && m_blupiDir == 2 && (num = CaisseInFront()) != -1)
+ if ( (m_keyPress & 1) == 0 && m_blupiAction != 28 && m_blupiDir == 2 && (num = CaisseInFront()) != -1)
{
- tinyPoint3.x = m_moveObject[num].posCurrent.x - 60 + 5;
+ adjustPos.x = m_moveObject[num].posCurrent.x - 60 + 5;
m_blupiAction = 28;
m_blupiPhase = 0;
m_scrollAdd.y = 0;
- PlaySound(39, tinyPoint3);
+ PlaySound(39, adjustPos);
}
- if (m_blupiSpeedY > 0.0 && m_blupiSpeedX < 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 29 && m_blupiDir == 2 && CaisseInFront() != -1)
+ if ((m_keyPress & 1) == 0 && m_blupiAction != 29 && m_blupiDir == 2 && CaisseInFront() != -1)
{
m_blupiAction = 29;
m_blupiPhase = 0;
m_scrollAdd.y = 0;
- PlaySound(39, tinyPoint3);
+ PlaySound(39, adjustPos);
}
if (m_blupiAction == 29 && m_blupiActionOuf != 47)
{
@@ -853,43 +889,25 @@ void CDecor::BlupiStep()
}
if (m_blupiAction != 28 && m_blupiAction != 29 && m_blupiFocus)
{
- if (m_blupiSpeedX < 0.0 && m_blupiLastSpeedX == 0.0 && !m_blupiAir && m_blupiSpeedY != 0.0)
- {
- m_blupiAction = 1;
- m_blupiPhase = 0;
- }
- if (m_blupiSpeedX == 0.0 && m_blupiLastSpeedX < 0.0 && m_blupiSpeedY != 0.0)
- {
- m_blupiAction = 1;
- m_blupiPhase = 0;
- }
- if (m_blupiSpeedX > 0.0 && m_blupiLastSpeedX == 0.0 && !m_blupiAir && m_blupiSpeedY != 0.0)
- {
- m_blupiAction = 1;
- m_blupiPhase = 0;
- }
- if (m_blupiSpeedX == 0.0 && m_blupiLastSpeedX > 0.0 && m_blupiSpeedY != 0.0)
- {
- m_blupiAction = 1;
- m_blupiPhase = 0;
- }
+ m_blupiAction = 1;
+ m_blupiPhase = 0;
}
int num3;
int num4;
- if (m_blupiSpeedX < 0.0 && m_blupiFocus)
+ if (m_blupiFocus)
{
- if (m_blupiDir == 2 && m_blupiAction != 3 && m_blupiAction != 59 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && ((!m_blupiJeep && !m_blupiTank && !m_blupiSkate) || Math.Abs(m_blupiVitesse.x) <= 8.0))
+ if (m_blupiDir == 2 && m_blupiAction != 3 && m_blupiAction != 59 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && ((!m_blupiJeep && !m_blupiTank && !m_blupiSkate) || abs(m_blupiVitesse.x) <= 8))
{
if (m_blupiAir)
{
- PlaySound(5, tinyPoint3);
+ PlaySound(5, adjustPos);
m_blupiAction = 59;
m_blupiPhase = 0;
m_blupiDir = 1;
}
else
{
- PlaySound(5, tinyPoint3);
+ PlaySound(5, adjustPos);
m_blupiAction = 3;
m_blupiPhase = 0;
}
@@ -903,7 +921,7 @@ void CDecor::BlupiStep()
{
if (m_blupiAction == 14)
{
- tinyPoint3.x -= CaisseGetMove(5);
+ adjustPos.x -= CaisseGetMove(5);
}
else
{
@@ -918,28 +936,28 @@ void CDecor::BlupiStep()
num4 *= 3;
num4 /= 2;
}
- tinyPoint3.x += Misc.Speed(m_blupiSpeedX, num4);
+ //tinyPoint3.x += Misc.Speed(m_blupiSpeedX, num4);
}
}
if (m_blupiDir == 2 && m_blupiAction == 29)
{
- tinyPoint3.x -= CaisseGetMove(3);
+ adjustPos.x -= CaisseGetMove(3);
}
}
- if (m_blupiSpeedX > 0.0 && m_blupiFocus)
+ if (m_blupiFocus)
{
- if (m_blupiDir == 1 && m_blupiAction != 3 && m_blupiAction != 59 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && ((!m_blupiJeep && !m_blupiTank && !m_blupiSkate) || Math.Abs(m_blupiVitesse.x) <= 8.0))
+ if (m_blupiDir == 1 && m_blupiAction != 3 && m_blupiAction != 59 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && ((!m_blupiJeep && !m_blupiTank && !m_blupiSkate) || abs(m_blupiVitesse.x) <= 8))
{
if (m_blupiAir)
{
- PlaySound(5, tinyPoint3);
+ PlaySound(5, adjustPos);
m_blupiAction = 59;
m_blupiPhase = 0;
m_blupiDir = 2;
}
else
{
- PlaySound(5, tinyPoint3);
+ PlaySound(5, adjustPos);
m_blupiAction = 3;
m_blupiPhase = 0;
}
@@ -953,7 +971,7 @@ void CDecor::BlupiStep()
{
if (m_blupiAction == 14)
{
- tinyPoint3.x += CaisseGetMove(5);
+ adjustPos.x += CaisseGetMove(5);
}
else
{
@@ -968,12 +986,11 @@ void CDecor::BlupiStep()
num4 *= 3;
num4 /= 2;
}
- tinyPoint3.x += Misc.Speed(m_blupiSpeedX, num4);
}
}
if (m_blupiDir == 1 && m_blupiAction == 29)
{
- tinyPoint3.x += CaisseGetMove(3);
+ adjustPos.x += CaisseGetMove(3);
}
}
if (m_blupiHelico)
@@ -1111,7 +1128,7 @@ void CDecor::BlupiStep()
m_blupiAction = 1;
m_blupiPhase = 0;
}
- if (m_blupiSpeedX == 0.0 && m_blupiSpeedY == 0.0 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && m_blupiFocus)
+ if (m_blupiSpeedX == 0 && m_blupiSpeedY == 0 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && m_blupiFocus)
{
if (m_blupiAction == 14 || m_blupiAction == 7)
{
@@ -1134,7 +1151,7 @@ void CDecor::BlupiStep()
{
m_blupiAction = 1;
m_blupiPhase = 0;
- PlaySound(20, tinyPoint3);
+ PlaySound(20, adjustPos);
}
m_scrollAdd.y = 0;
if (blupiAction == 14)
@@ -1150,45 +1167,45 @@ void CDecor::BlupiStep()
{
if (m_blupiAction == 9 && m_blupiDir == 1)
{
- tinyPoint3.x += 4;
+ adjustPos.x += 4;
}
if (m_blupiAction == 9 && m_blupiDir == 2)
{
- tinyPoint3.x -= 4;
+ adjustPos.x -= 4;
}
if (m_blupiAction == 10 && m_blupiDir == 1)
{
- tinyPoint3.x -= 4;
+ adjustPos.x -= 4;
}
if (m_blupiAction == 10 && m_blupiDir == 2)
{
- tinyPoint3.x += 4;
+ adjustPos.x += 4;
}
}
- if ((m_keyPress & -3) == 0 && m_blupiSpeedX == 0.0 && m_blupiSpeedY == 0.0 && (m_blupiJeep || m_blupiTank || m_blupiSkate) && m_blupiFocus)
+ if ((m_keyPress & -3) == 0 && m_blupiSpeedX == 0 && m_blupiSpeedY == 0 && (m_blupiJeep || m_blupiTank || m_blupiSkate) && m_blupiFocus)
{
if (m_blupiAction == 10 && m_blupiDir == 1)
{
- tinyPoint3.x -= 5;
+ adjustPos.x -= 5;
}
if (m_blupiAction == 10 && m_blupiDir == 2)
{
- tinyPoint3.x += 5;
+ adjustPos.x += 5;
}
}
- if ((m_keyPress & -3) == 0 && m_blupiSpeedX == 0.0 && m_blupiSpeedY == 0.0 && m_blupiNage && m_blupiFocus && m_blupiAction == 2)
+ if ((m_keyPress & -3) == 0 && m_blupiNage && m_blupiFocus && m_blupiAction == 2)
{
m_blupiAction = 1;
m_blupiPhase = 0;
}
- if ((m_keyPress & -3) == 0 && m_blupiSpeedX == 0.0 && m_blupiSpeedY == 0.0 && m_blupiSurf && m_blupiFocus && m_blupiAction == 2)
+ if ((m_keyPress & -3) == 0 && m_blupiSurf && m_blupiFocus && m_blupiAction == 2)
{
m_blupiAction = 1;
m_blupiPhase = 0;
}
if (m_blupiHelico && (m_blupiFocus || m_blupiAction == 58))
{
- if ((m_keyPress & 2) != 0 && m_blupiTimeFire == 0 && m_blupiAction != 3 && m_blupiAction != 58 && flag4)
+ if ((m_keyPress & 2) != 0 && m_blupiTimeFire == 0 && m_blupiAction != 3 && m_blupiAction != 58 && flag)
{
if (m_blupiBullet == 0)
{
@@ -1201,10 +1218,10 @@ void CDecor::BlupiStep()
m_blupiFocus = false;
}
}
- m_blupiMotorHigh = flag4;
+ ////m_blupiMotorHigh = flag4;
if (m_blupiAction != 3 && m_blupiAction != 58)
{
- if (flag4)
+ if (flag)
{
m_blupiAction = 2;
}
@@ -1212,177 +1229,144 @@ void CDecor::BlupiStep()
{
m_blupiAction = 1;
m_blupiPhase = 0;
- m_blupiVitesse.y = 0.0;
+ m_blupiVitesse.y = 0;
}
}
- if (EasyMove)
+
{
- if (m_blupiSpeedY <= -1.0 || (m_keyPress & 1) != 0)
+ if (m_blupiSpeedY <= -1 || (m_keyPress & 1) != 0)
{
- if (m_blupiVitesse.y > -7.0)
+ if (m_blupiVitesse.y > -10)
{
m_blupiVitesse.y -= 0.5;
}
- if (m_blupiVitesse.y == -0.5)
- {
- m_blupiVitesse.y = -1.0;
- }
}
- else if (m_blupiSpeedY >= 1.0)
+ else if (m_blupiSpeedY >= 1)
{
- if (m_blupiVitesse.y < 8.0)
+ if (m_blupiVitesse.y < 12)
{
m_blupiVitesse.y += 0.5;
}
}
else
{
- if (m_blupiVitesse.y > 1.0)
+ if (m_blupiVitesse.y > 1)
{
- m_blupiVitesse.y -= 1.0;
+ m_blupiVitesse.y -= 1;
}
- if (m_blupiVitesse.y < 1.0)
+ if (m_blupiVitesse.y < 1)
{
- m_blupiVitesse.y += 1.0;
+ m_blupiVitesse.y += 1;
}
}
- tinyPoint3.y += (int)m_blupiVitesse.y;
+ adjustPos.y += (int)m_blupiVitesse.y;
}
- else
+ if (FALSE)
{
- if (m_blupiSpeedY <= -1.0 || (m_keyPress & 1) != 0)
+ if (m_blupiSpeedX <= -1)
{
- if (m_blupiVitesse.y > -10.0)
- {
- m_blupiVitesse.y -= 0.5;
- }
- }
- else if (m_blupiSpeedY >= 1.0)
- {
- if (m_blupiVitesse.y < 12.0)
- {
- m_blupiVitesse.y += 0.5;
- }
- }
- else
- {
- if (m_blupiVitesse.y > 1.0)
- {
- m_blupiVitesse.y -= 1.0;
- }
- if (m_blupiVitesse.y < 1.0)
- {
- m_blupiVitesse.y += 1.0;
- }
- }
- tinyPoint3.y += (int)m_blupiVitesse.y;
- }
- if (EasyMove)
- {
- if (m_blupiSpeedX <= -1.0)
- {
- int num5 = (int)(m_blupiSpeedX * 12.0);
+ int num5 = (int)(m_blupiSpeedX * 12);
if (m_blupiVitesse.x > num5)
{
m_blupiVitesse.x -= 0.5;
}
- tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x;
- tinyPoint.y = tinyPoint3.y;
+ tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x;
+ tinyPoint.y = adjustPos.y;
if (BlupiBloque(tinyPoint, -1))
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
- else if (m_blupiSpeedX >= 1.0)
+ else if (m_blupiSpeedX >= 1)
{
- int num6 = (int)(m_blupiSpeedX * 12.0);
+ int num6 = (int)(m_blupiSpeedX * 12);
if (m_blupiVitesse.x < num6)
{
m_blupiVitesse.x += 0.5;
}
- tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x;
- tinyPoint.y = tinyPoint3.y;
+ tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x;
+ tinyPoint.y = adjustPos.y;
if (BlupiBloque(tinyPoint, 1))
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
else
{
- if (m_blupiVitesse.x > 0.0)
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x -= 2.0;
- if (m_blupiVitesse.x < 0.0)
+ m_blupiVitesse.x -= 2;
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
- if (m_blupiVitesse.x < 0.0)
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x += 2.0;
- if (m_blupiVitesse.x > 0.0)
+ m_blupiVitesse.x += 2;
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
}
- tinyPoint3.x += (int)m_blupiVitesse.x;
+ adjustPos.x += (int)m_blupiVitesse.x;
}
else
{
- if (m_blupiSpeedX <= -1.0)
+ if (m_blupiSpeedX <= -1)
{
- int num7 = (int)(m_blupiSpeedX * 16.0);
+ int num7 = (int)(m_blupiSpeedX * 16);
if (m_blupiVitesse.x > num7)
{
- m_blupiVitesse.x -= 1.0;
+ m_blupiVitesse.x -= 1;
}
- tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x;
- tinyPoint.y = tinyPoint3.y;
+ tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x;
+ tinyPoint.y = adjustPos.y;
if (BlupiBloque(tinyPoint, -1))
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
- else if (m_blupiSpeedX >= 1.0)
+ else if (m_blupiSpeedX >= 1)
{
- int num8 = (int)(m_blupiSpeedX * 16.0);
+ int num8 = (int)(m_blupiSpeedX * 16);
if (m_blupiVitesse.x < num8)
{
- m_blupiVitesse.x += 1.0;
+ m_blupiVitesse.x += 1;
}
- tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x;
- tinyPoint.y = tinyPoint3.y;
+ tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x;
+ tinyPoint.y = adjustPos.y;
if (BlupiBloque(tinyPoint, 1))
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
else
{
- if (m_blupiVitesse.x > 0.0)
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x -= 2.0;
- if (m_blupiVitesse.x < 0.0)
+ m_blupiVitesse.x -= 2;
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
- if (m_blupiVitesse.x < 0.0)
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x += 2.0;
- if (m_blupiVitesse.x > 0.0)
+ m_blupiVitesse.x += 2;
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
}
- tinyPoint3.x += (int)m_blupiVitesse.x;
+ adjustPos.x += (int)m_blupiVitesse.x;
}
MoveObjectPollution();
- if (ButtonPressed == ButtonGlygh.PlayAction && !flag4 && m_blupiTransport == -1)
+ if ( !flag && m_blupiTransport == -1)
{
- ButtonPressed = Def.ButtonGlygh.None;
+
rect.left = m_blupiPos.x + 20;
rect.right = m_blupiPos.x + 22;
rect.top = m_blupiPos.y + 60 - 2;
@@ -1411,10 +1395,10 @@ void CDecor::BlupiStep()
}
if (m_blupiOver && (m_blupiFocus || m_blupiAction == 58))
{
- m_blupiMotorHigh = flag4;
+ ////m_blupiMotorHigh = flag4;
if (m_blupiAction != 3)
{
- if (flag4)
+ if (flag)
{
m_blupiAction = 2;
}
@@ -1425,85 +1409,85 @@ void CDecor::BlupiStep()
m_blupiAction = 1;
m_blupiPhase = 0;
}
- m_blupiVitesse.y = 0.0;
+ m_blupiVitesse.y = 0;
}
}
- rect = BlupiRect(tinyPoint3);
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60 + OVERHEIGHT - 1;
+ rect = BlupiRect(adjustPos);
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60 + OVERHEIGHT - 1;
bool flag7 = !DecorDetect(rect);
num = MoveAscenseurDetect(m_blupiPos, OVERHEIGHT);
if (num != -1)
{
flag7 = false;
}
- if ((m_blupiSpeedY < 0.0 || (m_keyPress & 1) != 0) && !flag7)
+ if (((m_keyPress & 1) != 0) && !flag7)
{
- if (m_blupiVitesse.y == 0.0 && num != -1)
+ if (m_blupiVitesse.y == 0 && num != -1)
{
- m_blupiVitesse.y = -5.0;
+ m_blupiVitesse.y = -5;
}
- else if (m_blupiVitesse.y > -5.0)
+ else if (m_blupiVitesse.y > -5)
{
- m_blupiVitesse.y -= 1.0;
+ m_blupiVitesse.y -= 1;
}
}
- else if (m_blupiSpeedY > 0.0)
+ else if (m_blupiSpeedY > 0)
{
- if (m_blupiVitesse.y < 12.0)
+ if (m_blupiVitesse.y < 12)
{
- m_blupiVitesse.y += 5.0;
+ m_blupiVitesse.y += 5;
}
}
- else if (m_blupiVitesse.y < 12.0 && m_time % 2 == 0)
+ else if (m_blupiVitesse.y < 12 && m_time % 2 == 0)
{
- m_blupiVitesse.y += 1.0;
+ m_blupiVitesse.y += 1;
}
- tinyPoint3.y += (int)m_blupiVitesse.y;
- if (m_blupiSpeedX < 0.0 && flag4)
+ adjustPos.y += (int)m_blupiVitesse.y;
+ if (m_blupiSpeedX < 0 && flag)
{
- int num9 = (int)(m_blupiSpeedX * 12.0);
+ int num9 = (int)(m_blupiSpeedX * 12);
if (m_blupiVitesse.x > num9)
{
- m_blupiVitesse.x -= 1.0;
+ m_blupiVitesse.x -= 1;
}
- tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x;
- tinyPoint.y = tinyPoint3.y;
+ tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x;
+ tinyPoint.y = adjustPos.y;
if (BlupiBloque(tinyPoint, -1))
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
- else if (m_blupiSpeedX > 0.0 && flag4)
+ else if (m_blupiSpeedX > 0 && flag)
{
- int num10 = (int)(m_blupiSpeedX * 12.0);
+ int num10 = (int)(m_blupiSpeedX * 12);
if (m_blupiVitesse.x < num10)
{
- m_blupiVitesse.x += 1.0;
+ m_blupiVitesse.x += 1;
}
- tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x;
- tinyPoint.y = tinyPoint3.y;
+ tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x;
+ tinyPoint.y = adjustPos.y;
if (BlupiBloque(tinyPoint, 1))
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
else
{
- if (m_blupiVitesse.x > 0.0)
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x -= 1.0;
+ m_blupiVitesse.x -= 1;
}
- if (m_blupiVitesse.x < 0.0)
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x += 1.0;
+ m_blupiVitesse.x += 1;
}
}
- tinyPoint3.x += (int)m_blupiVitesse.x;
+ adjustPos.x += (int)m_blupiVitesse.x;
MoveObjectPollution();
- if (ButtonPressed == ButtonGlygh.PlayAction && !flag4 && m_blupiTransport == -1)
+ if ( !flag && m_blupiTransport == -1)
{
- ButtonPressed = Def.ButtonGlygh.None;
+
rect.left = m_blupiPos.x + 20;
rect.right = m_blupiPos.x + 22;
rect.top = m_blupiPos.y + 60 - 2;
@@ -1532,89 +1516,89 @@ void CDecor::BlupiStep()
}
if (m_blupiBalloon && m_blupiFocus)
{
- if (m_blupiSpeedY < 0.0 || (m_keyPress & 1) != 0)
+ if ((m_keyPress & 1) != 0)
{
- if (m_blupiVitesse.y > -5.0 && m_time % 6 == 0)
+ if (m_blupiVitesse.y > -5 && m_time % 6 == 0)
{
- m_blupiVitesse.y -= 1.0;
+ m_blupiVitesse.y -= 1;
}
}
- else if (m_blupiSpeedY > 0.0)
+ else if (m_blupiSpeedY > 0)
{
- if (m_blupiVitesse.y < 0.0 && m_time % 6 == 0)
+ if (m_blupiVitesse.y < 0 && m_time % 6 == 0)
{
- m_blupiVitesse.y += 1.0;
+ m_blupiVitesse.y += 1;
}
}
- else if (m_blupiVitesse.y > -3.0 && m_time % 6 == 0)
+ else if (m_blupiVitesse.y > -3 && m_time % 6 == 0)
{
- m_blupiVitesse.y -= 1.0;
+ m_blupiVitesse.y -= 1;
}
- tinyPoint3.y += (int)m_blupiVitesse.y;
- if (m_blupiSpeedX < 0.0)
+ adjustPos.y += (int)m_blupiVitesse.y;
+ if (m_blupiSpeedX < 0)
{
- int num11 = (int)(m_blupiSpeedX * 10.0);
+ int num11 = (int)(m_blupiSpeedX * 10);
if (m_blupiVitesse.x > num11)
{
- m_blupiVitesse.x -= 1.0;
+ m_blupiVitesse.x -= 1;
}
- tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x;
- tinyPoint.y = tinyPoint3.y;
+ tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x;
+ tinyPoint.y = adjustPos.y;
if (BlupiBloque(tinyPoint, -1))
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
- else if (m_blupiSpeedX > 0.0)
+ else if (m_blupiSpeedX > 0)
{
- int num12 = (int)(m_blupiSpeedX * 10.0);
+ int num12 = (int)(m_blupiSpeedX * 10);
if (m_blupiVitesse.x < num12)
{
- m_blupiVitesse.x += 1.0;
+ m_blupiVitesse.x += 1;
}
- tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x;
- tinyPoint.y = tinyPoint3.y;
+ tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x;
+ tinyPoint.y = adjustPos.y;
if (BlupiBloque(tinyPoint, 1))
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
else
{
- if (m_blupiVitesse.x > 0.0)
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x -= 2.0;
- if (m_blupiVitesse.x < 0.0)
+ m_blupiVitesse.x -= 2;
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
- if (m_blupiVitesse.x < 0.0)
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x += 2.0;
- if (m_blupiVitesse.x > 0.0)
+ m_blupiVitesse.x += 2;
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
}
- tinyPoint3.x += (int)m_blupiVitesse.x;
+ adjustPos.x += (int)m_blupiVitesse.x;
}
if (m_blupiEcrase && m_blupiFocus)
{
- if (flag4)
+ if (flag)
{
- if (m_blupiVitesse.y < 2.0)
+ if (m_blupiVitesse.y < 2)
{
- m_blupiVitesse.y += 1.0;
+ m_blupiVitesse.y += 1;
}
}
else
{
- m_blupiVitesse.y = 0.0;
+ m_blupiVitesse.y = 0;
}
- tinyPoint3.y += (int)m_blupiVitesse.y;
- if (flag4)
+ adjustPos.y += (int)m_blupiVitesse.y;
+ if (flag)
{
num3 = 7;
}
@@ -1623,103 +1607,103 @@ void CDecor::BlupiStep()
num3 = 4;
}
num3 = (int)(num3 * m_blupiSpeedX);
- if (m_blupiSpeedX < 0.0)
+ if (m_blupiSpeedX < 0)
{
if (m_blupiVitesse.x > num3)
{
- m_blupiVitesse.x -= 1.0;
+ m_blupiVitesse.x -= 1;
}
- tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x;
- tinyPoint.y = tinyPoint3.y;
+ tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x;
+ tinyPoint.y = adjustPos.y;
if (BlupiBloque(tinyPoint, -1))
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
- else if (m_blupiSpeedX > 0.0)
+ else if (m_blupiSpeedX > 0)
{
if (m_blupiVitesse.x < num3)
{
- m_blupiVitesse.x += 1.0;
+ m_blupiVitesse.x += 1;
}
- tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x;
- tinyPoint.y = tinyPoint3.y;
+ tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x;
+ tinyPoint.y = adjustPos.y;
if (BlupiBloque(tinyPoint, 1))
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
else
{
- if (m_blupiVitesse.x > 0.0)
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x -= 2.0;
- if (m_blupiVitesse.x < 0.0)
+ m_blupiVitesse.x -= 2;
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
- if (m_blupiVitesse.x < 0.0)
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x += 2.0;
- if (m_blupiVitesse.x > 0.0)
+ m_blupiVitesse.x += 2;
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
}
- if (m_blupiVitesse.x == 0.0 && !flag4)
+ if (m_blupiVitesse.x == 0 && !flag)
{
m_blupiAction = 1;
m_blupiPhase = 0;
}
- tinyPoint3.x += (int)m_blupiVitesse.x;
+ adjustPos.x += (int)m_blupiVitesse.x;
}
if (m_blupiJeep && m_blupiFocus)
{
- if (m_blupiVitesse.x == 0.0 && m_blupiAction == 2)
+ if (m_blupiVitesse.x == 0 && m_blupiAction == 2)
{
m_blupiAction = 1;
m_blupiPhase = 0;
}
- m_blupiMotorHigh = (m_blupiAction != 1);
- rect = BlupiRect(tinyPoint3);
+ //m_blupiMotorHigh = (m_blupiAction != 1);
+ rect = BlupiRect(adjustPos);
rect.right -= 40;
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60 - 1;
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60 - 1;
bool flag8 = !DecorDetect(rect);
rect.left += 40;
rect.right += 40;
bool flag9 = !DecorDetect(rect);
- if (flag4)
+ if (flag)
{
- if (m_blupiVitesse.y < 50.0)
+ if (m_blupiVitesse.y < 50)
{
- m_blupiVitesse.y += 5.0;
+ m_blupiVitesse.y += 5;
}
}
else
{
- if (m_blupiVitesse.y != 0.0)
+ if (m_blupiVitesse.y != 0)
{
PlaySound(3, m_blupiPos);
}
- m_blupiVitesse.y = 0.0;
+ m_blupiVitesse.y = 0;
}
- tinyPoint3.y += (int)m_blupiVitesse.y;
+ adjustPos.y += (int)m_blupiVitesse.y;
if (m_blupiTransport == -1)
{
- rect.left = tinyPoint3.x + 20;
- rect.right = tinyPoint3.x + 60 - 20;
- rect.top = tinyPoint3.y + 60 - 35;
- rect.bottom = tinyPoint3.y + 60 - 1;
- num = AscenseurDetect(rect, m_blupiPos, tinyPoint3);
- if (m_blupiVitesse.y >= 0.0 && num != -1)
+ rect.left = adjustPos.x + 20;
+ rect.right = adjustPos.x + 60 - 20;
+ rect.top = adjustPos.y + 60 - 35;
+ rect.bottom = adjustPos.y + 60 - 1;
+ num = AscenseurDetect(rect, m_blupiPos, adjustPos);
+ if (m_blupiVitesse.y >= 0 && num != -1)
{
m_blupiTransport = num;
- flag4 = false;
- PlaySound(3, tinyPoint3);
- tinyPoint3.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY;
+ flag = false;
+ PlaySound(3, adjustPos);
+ adjustPos.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY;
}
}
if (flag8 && !flag9)
@@ -1727,7 +1711,7 @@ void CDecor::BlupiStep()
int num13 = -20;
if (m_blupiVitesse.x > num13)
{
- m_blupiVitesse.x -= 1.0;
+ m_blupiVitesse.x -= 1;
}
}
else if (!flag8 && flag9)
@@ -1735,66 +1719,52 @@ void CDecor::BlupiStep()
int num14 = 20;
if (m_blupiVitesse.x < num14)
{
- m_blupiVitesse.x += 1.0;
+ m_blupiVitesse.x += 1;
}
}
- else if (m_blupiSpeedX < 0.0)
+ else if (m_blupiSpeedX < 0)
{
- int num15 = (int)(m_blupiSpeedX * 20.0);
+ int num15 = (int)(m_blupiSpeedX * 20);
if (m_blupiVitesse.x > num15)
{
- m_blupiVitesse.x -= 1.0;
+ m_blupiVitesse.x -= 1;
}
}
- else if (m_blupiSpeedX > 0.0)
+ else if (m_blupiSpeedX > 0)
{
- int num16 = (int)(m_blupiSpeedX * 20.0);
+ int num16 = (int)(m_blupiSpeedX * 20);
if (m_blupiVitesse.x < num16)
{
- m_blupiVitesse.x += 1.0;
+ m_blupiVitesse.x += 1;
}
}
else
{
- if (m_blupiVitesse.x > 0.0)
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x -= 2.0;
- if (m_blupiVitesse.x < 0.0)
+ m_blupiVitesse.x -= 2;
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
- if (m_blupiVitesse.x < 0.0)
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x += 2.0;
- if (m_blupiVitesse.x > 0.0)
+ m_blupiVitesse.x += 2;
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
}
if (m_blupiAction == 3)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
- tinyPoint3.x += (int)m_blupiVitesse.x;
- if (flag8 && !flag9)
- {
- m_blupiRealRotation = Approch(m_blupiRealRotation, -45, 5);
- }
- else if (!flag8 && flag9)
- {
- m_blupiRealRotation = Approch(m_blupiRealRotation, 45, 5);
- }
- else if (!flag4)
- {
- m_blupiRealRotation = 0;
- }
- m_blupiOffsetY = abs(m_blupiRealRotation / 2);
+ adjustPos.x += (int)m_blupiVitesse.x;
MoveObjectPollution();
- if (ButtonPressed == ButtonGlygh.PlayAction && !flag4 && m_blupiTransport == -1)
+ if ( !flag && m_blupiTransport == -1)
{
- ButtonPressed = Def.ButtonGlygh.None;
tinyPoint.x = m_blupiPos.x;
tinyPoint.y = m_blupiPos.y - BLUPIFLOOR;
ObjectStart(tinyPoint, 19, 0);
@@ -1827,14 +1797,14 @@ void CDecor::BlupiStep()
tinyPoint.x = m_blupiPos.x - 35;
tinyPoint.y = m_blupiPos.y;
num4 = -5;
- m_blupiVitesse.x += 12.0;
+ m_blupiVitesse.x += 12;
}
else
{
tinyPoint.x = m_blupiPos.x + 35;
tinyPoint.y = m_blupiPos.y;
num4 = 5;
- m_blupiVitesse.x -= 12.0;
+ m_blupiVitesse.x -= 12;
}
if (ObjectStart(tinyPoint, 23, num4) != -1)
{
@@ -1846,87 +1816,87 @@ void CDecor::BlupiStep()
}
}
}
- if (m_blupiVitesse.x == 0.0 && m_blupiAction == 2)
+ if (m_blupiVitesse.x == 0 && m_blupiAction == 2)
{
m_blupiAction = 1;
m_blupiPhase = 0;
}
- m_blupiMotorHigh = (m_blupiAction != 1);
- if (flag4)
+ //m_blupiMotorHigh = (m_blupiAction != 1);
+ if (flag)
{
- if (m_blupiVitesse.y < 50.0)
+ if (m_blupiVitesse.y < 50)
{
- m_blupiVitesse.y += 5.0;
+ m_blupiVitesse.y += 5;
}
}
else
{
- if (m_blupiVitesse.y != 0.0)
+ if (m_blupiVitesse.y != 0)
{
PlaySound(3, m_blupiPos);
}
- m_blupiVitesse.y = 0.0;
+ m_blupiVitesse.y = 0;
}
- tinyPoint3.y += (int)m_blupiVitesse.y;
+ adjustPos.y += (int)m_blupiVitesse.y;
if (m_blupiTransport == -1)
{
- rect.left = tinyPoint3.x + 20;
- rect.right = tinyPoint3.x + 60 - 20;
- rect.top = tinyPoint3.y + 60 - 35;
- rect.bottom = tinyPoint3.y + 60 - 1;
- num = AscenseurDetect(rect, m_blupiPos, tinyPoint3);
- if (m_blupiVitesse.y >= 0.0 && num != -1)
+ rect.left = adjustPos.x + 20;
+ rect.right = adjustPos.x + 60 - 20;
+ rect.top = adjustPos.y + 60 - 35;
+ rect.bottom = adjustPos.y + 60 - 1;
+ num = AscenseurDetect(rect, m_blupiPos, adjustPos);
+ if (m_blupiVitesse.y >= 0 && num != -1)
{
m_blupiTransport = num;
- flag4 = false;
- PlaySound(3, tinyPoint3);
- tinyPoint3.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY;
+ flag = false;
+ PlaySound(3, adjustPos);
+ adjustPos.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY;
}
}
- if (m_blupiSpeedX < 0.0)
+ if (m_blupiSpeedX < 0)
{
- int num17 = (int)(m_blupiSpeedX * 12.0);
+ int num17 = (int)(m_blupiSpeedX * 12);
if (m_blupiVitesse.x > num17)
{
- m_blupiVitesse.x -= 1.0;
+ m_blupiVitesse.x -= 1;
}
}
- else if (m_blupiSpeedX > 0.0)
+ else if (m_blupiSpeedX > 0)
{
- int num18 = (int)(m_blupiSpeedX * 12.0);
+ int num18 = (int)(m_blupiSpeedX * 12);
if (m_blupiVitesse.x < num18)
{
- m_blupiVitesse.x += 1.0;
+ m_blupiVitesse.x += 1;
}
}
else
{
- if (m_blupiVitesse.x > 0.0)
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x -= 3.0;
- if (m_blupiVitesse.x < 0.0)
+ m_blupiVitesse.x -= 3;
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
- if (m_blupiVitesse.x < 0.0)
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x += 3.0;
- if (m_blupiVitesse.x > 0.0)
+ m_blupiVitesse.x += 3;
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
}
if (m_blupiAction == 3)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
- tinyPoint3.x += (int)m_blupiVitesse.x;
+ adjustPos.x += (int)m_blupiVitesse.x;
MoveObjectPollution();
- if (ButtonPressed == ButtonGlygh.PlayAction && !flag4 && m_blupiTransport == -1)
+ if ( !flag && m_blupiTransport == -1)
{
- ButtonPressed = Def.ButtonGlygh.None;
+
tinyPoint.x = m_blupiPos.x;
tinyPoint.y = m_blupiPos.y;
ObjectStart(tinyPoint, 28, 0);
@@ -1941,54 +1911,54 @@ void CDecor::BlupiStep()
}
if (m_blupiSkate && m_blupiFocus)
{
- if (m_blupiVitesse.x == 0.0 && m_blupiAction == 2)
+ if (m_blupiVitesse.x == 0 && m_blupiAction == 2)
{
m_blupiAction = 1;
m_blupiPhase = 0;
}
- if (m_blupiSpeedX < 0.0)
+ if (m_blupiSpeedX < 0)
{
- int num19 = (int)(m_blupiSpeedX * 15.0);
+ int num19 = (int)(m_blupiSpeedX * 15);
if (m_blupiVitesse.x > num19)
{
- m_blupiVitesse.x -= 1.0;
+ m_blupiVitesse.x -= 1;
}
}
- else if (m_blupiSpeedX > 0.0)
+ else if (m_blupiSpeedX > 0)
{
- int num20 = (int)(m_blupiSpeedX * 15.0);
+ int num20 = (int)(m_blupiSpeedX * 15);
if (m_blupiVitesse.x < num20)
{
- m_blupiVitesse.x += 1.0;
+ m_blupiVitesse.x += 1;
}
}
else
{
- if (m_blupiVitesse.x > 0.0)
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x -= 1.0;
- if (m_blupiVitesse.x < 0.0)
+ m_blupiVitesse.x -= 1;
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
- if (m_blupiVitesse.x < 0.0)
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x += 1.0;
- if (m_blupiVitesse.x > 0.0)
+ m_blupiVitesse.x += 1;
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
}
if (m_blupiAction == 3)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
- tinyPoint3.x += (int)m_blupiVitesse.x;
- if (ButtonPressed == Def.ButtonGlygh.PlayAction && !flag4 && !m_blupiAir && m_blupiTransport == -1 && m_blupiVitesse.x < 8.0)
+ adjustPos.x += (int)m_blupiVitesse.x;
+ if ( !flag && !m_blupiAir && m_blupiTransport == -1 && m_blupiVitesse.x < 8)
{
- ButtonPressed = Def.ButtonGlygh.None;
+
m_blupiSkate = false;
m_blupiAction = 43;
m_blupiPhase = 0;
@@ -2000,10 +1970,10 @@ void CDecor::BlupiStep()
{
if (m_blupiPhase == 8)
{
- num = MoveObjectDetect(m_blupiPos, flag6);
+ num = MoveObjectDetect(m_blupiPos, &flag6);
if (num != -1)
{
- ObjectDelete(m_moveObject[num]->posCurrent, m_moveObject[num]->type);
+ ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
}
}
if (m_blupiPhase == 20)
@@ -2032,19 +2002,17 @@ void CDecor::BlupiStep()
{
if (m_blupiTransport == -1)
{
- if (m_blupiSpeedY < 0.0 || (m_keyPress & 1) != 0)
+ if ((m_keyPress & 1) != 0)
{
- if (m_blupiVitesse.y > -5.0)
+ if (m_blupiVitesse.y > -5)
{
- m_blupiVitesse.y -= 1.0;
+ m_blupiVitesse.y -= 1;
}
}
- else if (m_blupiSpeedY > 0.0)
+ else if (m_blupiVitesse.y < 5)
{
- if (m_blupiVitesse.y < 5.0)
- {
- m_blupiVitesse.y += 1.0;
- }
+ m_blupiVitesse.y += 1;
+
}
else
{
@@ -2058,55 +2026,55 @@ void CDecor::BlupiStep()
}
if (m_blupiVitesse.y > num3)
{
- m_blupiVitesse.y -= 1.0;
+ m_blupiVitesse.y -= 1;
}
if (m_blupiVitesse.y < num3)
{
- m_blupiVitesse.y += 1.0;
+ m_blupiVitesse.y += 1;
}
}
- tinyPoint3.y += (int)m_blupiVitesse.y;
+ adjustPos.y += (int)m_blupiVitesse.y;
}
- if (m_blupiSpeedX < 0.0)
+ if (m_blupiSpeedX < 0)
{
- int num21 = (int)(m_blupiSpeedX * 8.0);
+ int num21 = (int)(m_blupiSpeedX * 8);
if (m_blupiVitesse.x > num21)
{
- m_blupiVitesse.x -= 1.0;
+ m_blupiVitesse.x -= 1;
}
}
- else if (m_blupiSpeedX > 0.0)
+ else if (m_blupiSpeedX > 0)
{
- int num22 = (int)(m_blupiSpeedX * 8.0);
+ int num22 = (int)(m_blupiSpeedX * 8);
if (m_blupiVitesse.x < num22)
{
- m_blupiVitesse.x += 1.0;
+ m_blupiVitesse.x += 1;
}
}
else
{
- if (m_blupiVitesse.x > 0.0)
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x -= 2.0;
- if (m_blupiVitesse.x < 0.0)
+ m_blupiVitesse.x -= 2;
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
- if (m_blupiVitesse.x < 0.0)
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x += 2.0;
- if (m_blupiVitesse.x > 0.0)
+ m_blupiVitesse.x += 2;
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
}
num = table_vitesse_nage[m_blupiPhase % 14 / 2];
- tinyPoint3.x += (int)(m_blupiVitesse.x * num / 7.0);
+ adjustPos.x += (int)(m_blupiVitesse.x * num / 7);
if (m_time % 70 == 0 || m_time % 70 == 28)
{
- MoveObjectBlup(tinyPoint3);
+ MoveObjectBlup(adjustPos);
}
if (m_time % 5 == 0)
{
@@ -2116,7 +2084,7 @@ void CDecor::BlupiStep()
}
if (m_blupiLevel == 25)
{
- m_jauges[0].SetMode(1);
+ //m_jauges[0].SetMode(1);
}
m_jauges[0].SetLevel(m_blupiLevel);
if (m_blupiLevel == 0)
@@ -2145,7 +2113,7 @@ void CDecor::BlupiStep()
m_blupiActionOuf = 0;
m_jauges[0].SetHide(true);
m_jauges[1].SetHide(true);
- PlaySound(26, tinyPoint3);
+ PlaySound(26, adjustPos);
}
}
}
@@ -2153,122 +2121,122 @@ void CDecor::BlupiStep()
{
if (m_blupiTransport == -1)
{
- if (m_blupiSpeedY < 0.0 || (m_keyPress & 1) != 0)
+ if ((m_keyPress & 1) != 0)
{
- if (m_blupiVitesse.y > -5.0)
+ if (m_blupiVitesse.y > -5)
{
- m_blupiVitesse.y -= 1.0;
+ m_blupiVitesse.y -= 1;
}
}
- else if (m_blupiSpeedY > 0.0)
+ else if (m_blupiSpeedY > 0)
{
- if (m_blupiVitesse.y < 5.0)
+ if (m_blupiVitesse.y < 5)
{
- m_blupiVitesse.y += 1.0;
+ m_blupiVitesse.y += 1;
}
}
else
{
- if (m_blupiVitesse.y > -2.0)
+ if (m_blupiVitesse.y > -2)
{
- m_blupiVitesse.y -= 1.0;
+ m_blupiVitesse.y -= 1;
}
- if (m_blupiVitesse.y < -2.0)
+ if (m_blupiVitesse.y < -2)
{
- m_blupiVitesse.y += 1.0;
+ m_blupiVitesse.y += 1;
}
}
- tinyPoint3.y += (int)m_blupiVitesse.y;
- tinyPoint3.y += BLUPISURF;
- if (tinyPoint3.y % 64 > 30)
+ adjustPos.y += (int)m_blupiVitesse.y;
+ adjustPos.y += BLUPISURF;
+ if (adjustPos.y % 64 > 30)
{
- tinyPoint3.y += 64 - tinyPoint3.y % 64;
+ adjustPos.y += 64 - adjustPos.y % 64;
}
- tinyPoint3.y -= BLUPISURF;
+ adjustPos.y -= BLUPISURF;
}
- if (m_blupiSpeedX < 0.0)
+ if (m_blupiSpeedX < 0)
{
- int num23 = (int)(m_blupiSpeedX * 8.0);
+ int num23 = (int)(m_blupiSpeedX * 8);
if (m_blupiVitesse.x > num23)
{
- m_blupiVitesse.x -= 1.0;
+ m_blupiVitesse.x -= 1;
}
}
- else if (m_blupiSpeedX > 0.0)
+ else if (m_blupiSpeedX > 0)
{
- int num24 = (int)(m_blupiSpeedX * 8.0);
+ int num24 = (int)(m_blupiSpeedX * 8);
if (m_blupiVitesse.x < num24)
{
- m_blupiVitesse.x += 1.0;
+ m_blupiVitesse.x += 1;
}
}
else
{
- if (m_blupiVitesse.x > 0.0)
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x -= 2.0;
- if (m_blupiVitesse.x < 0.0)
+ m_blupiVitesse.x -= 2;
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
- if (m_blupiVitesse.x < 0.0)
+ if (m_blupiVitesse.x < 0)
{
- m_blupiVitesse.x += 2.0;
- if (m_blupiVitesse.x > 0.0)
+ m_blupiVitesse.x += 2;
+ if (m_blupiVitesse.x > 0)
{
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
}
}
}
num = table_vitesse_surf[m_blupiPhase % 12 / 2];
- tinyPoint3.x += (int)(m_blupiVitesse.x * num / 10.0);
+ adjustPos.x += (int)(m_blupiVitesse.x * num / 10);
}
POINT tinyPoint4;
if (m_blupiSuspend && m_blupiFocus)
{
- if (m_blupiSpeedX < 0.0 && m_blupiAction == 2)
+ if (m_blupiSpeedX < 0 && m_blupiAction == 2)
{
- int num25 = (int)(m_blupiSpeedX * 5.0);
- tinyPoint3.x += num25;
+ int num25 = (int)(m_blupiSpeedX * 5);
+ adjustPos.x += num25;
}
- if (m_blupiSpeedX > 0.0 && m_blupiAction == 2)
+ if (m_blupiSpeedX > 0 && m_blupiAction == 2)
{
- int num26 = (int)(m_blupiSpeedX * 5.0);
- tinyPoint3.x += num26;
+ int num26 = (int)(m_blupiSpeedX * 5);
+ adjustPos.x += num26;
}
- num = GetTypeBarre(tinyPoint3);
+ num = GetTypeBarre(adjustPos);
if (num == 2)
{
- tinyPoint4.x = tinyPoint3.x;
- tinyPoint4.y = tinyPoint3.y / 64 * 64 + BLUPIOFFY;
+ tinyPoint4.x = adjustPos.x;
+ tinyPoint4.y = adjustPos.y / 64 * 64 + BLUPIOFFY;
rect = BlupiRect(tinyPoint4);
if (!DecorDetect(rect, true))
{
m_blupiSuspend = false;
m_blupiAction = 1;
m_blupiPhase = 0;
- tinyPoint3 = tinyPoint4;
- m_blupiPos = tinyPoint3;
+ adjustPos = tinyPoint4;
+ m_blupiPos = adjustPos;
}
}
- if ((m_blupiSpeedY > 0.0 && m_blupiPhase > 5) || num == 0)
+ if ((m_blupiSpeedY > 0 && m_blupiPhase > 5) || num == 0)
{
m_blupiSuspend = false;
m_blupiAir = true;
m_blupiAction = 5;
- tinyPoint3.y = tinyPoint3.y;
- m_blupiVitesse.y = 0.0;
+ adjustPos.y = adjustPos.y;
+ m_blupiVitesse.y = 0;
m_blupiNoBarre = 5;
m_blupiActionOuf = 65;
m_blupiTimeOuf = 0;
}
- if (((m_keyPress & 1) != 0 || m_blupiSpeedY < 0.0) && m_blupiAction != 4 && m_blupiAction != 3)
+ if (((m_keyPress & 1) != 0 || m_blupiSpeedY < 0) && m_blupiAction != 4 && m_blupiAction != 3)
{
m_blupiAction = 4;
m_blupiPhase = 0;
}
- if ((m_keyPress & 1) == 0 && m_blupiSpeedY == 0.0 && m_blupiAction == 4)
+ if ((m_keyPress & 1) == 0 && m_blupiSpeedY == 0 && m_blupiAction == 4)
{
m_blupiAction = 1;
m_blupiPhase = 0;
@@ -2279,59 +2247,58 @@ void CDecor::BlupiStep()
m_blupiAir = true;
m_blupiAction = 5;
m_blupiPhase = 0;
- tinyPoint3.y -= 2;
- m_blupiVitesse.y = -11.0;
+ adjustPos.y -= 2;
+ m_blupiVitesse.y = -11;
m_blupiNoBarre = 5;
- PlaySound(35, tinyPoint3);
+ PlaySound(35, adjustPos);
}
}
- if (ButtonPressed == ButtonGlygh.PlayAction && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiTank && !m_blupiJeep && !m_blupiSkate && !flag4 && m_blupiTransport == -1 && m_blupiFocus)
+ if ( !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiTank && !m_blupiJeep && !m_blupiSkate /*&& !flag4*/ && m_blupiTransport == -1 && m_blupiFocus)
{
if (m_blupiDynamite > 0)
{
- ButtonPressed = Def.ButtonGlygh.None;
- rect.left = tinyPoint3.x + 18;
- rect.right = tinyPoint3.x + 20;
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60;
+
+ rect.left = adjustPos.x + 18;
+ rect.right = adjustPos.x + 20;
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60;
flag2 = !DecorDetect(rect);
- rect.left = tinyPoint3.x + 60 - 20;
- rect.right = tinyPoint3.x + 60 - 18;
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60;
+ rect.left = adjustPos.x + 60 - 20;
+ rect.right = adjustPos.x + 60 - 18;
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60;
flag3 = !DecorDetect(rect);
- if (!flag2 && !flag3 && ObjectStart(tinyPoint3, 56, 0) != -1)
+ if (!flag2 && !flag3 && ObjectStart(adjustPos, 56, 0) != -1)
{
m_blupiAction = 87;
m_blupiPhase = 0;
m_blupiFocus = false;
- PlaySound(61, tinyPoint3);
+ PlaySound(61, adjustPos);
m_blupiDynamite--;
}
}
else if (m_blupiPerso > 0)
{
- ButtonPressed = ButtonGlygh.None;
- num = MoveObjectDetect(tinyPoint3, flag6);
- if (num == -1 || m_moveObject[num]->type != 200)
+ num = MoveObjectDetect(adjustPos, &flag6);
+ if (num == -1 || m_moveObject[num].type != 200)
{
- rect.left = tinyPoint3.x + 18;
- rect.right = tinyPoint3.x + 20;
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60;
+ rect.left = adjustPos.x + 18;
+ rect.right = adjustPos.x + 20;
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60;
flag2 = !DecorDetect(rect);
- rect.left = tinyPoint3.x + 60 - 20;
- rect.right = tinyPoint3.x + 60 - 18;
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60;
+ rect.left = adjustPos.x + 60 - 20;
+ rect.right = adjustPos.x + 60 - 18;
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60;
flag3 = !DecorDetect(rect);
- num = MoveChargeDetect(tinyPoint3);
- if (num == -1 && !flag2 && !flag3 && ObjectStart(tinyPoint3, 200, 0) != -1)
+ num = MoveChargeDetect(adjustPos);
+ if (num == -1 && !flag2 && !flag3 && ObjectStart(adjustPos, 200, 0) != -1)
{
m_blupiAction = 46;
m_blupiPhase = 0;
m_blupiFocus = false;
- PlaySound(61, tinyPoint3);
+ PlaySound(61, adjustPos);
m_blupiPerso--;
}
}
@@ -2339,60 +2306,60 @@ void CDecor::BlupiStep()
{
m_blupiAction = 47;
m_blupiPhase = 0;
- PlaySound(27, tinyPoint3);
+ PlaySound(27, adjustPos);
}
}
}
rect = BlupiRect(m_blupiPos);
- tinyPoint4 = tinyPoint3;
- TestPath(rect, m_blupiPos, ref tinyPoint3);
- if (flag && m_blupiPos.x == tinyPoint3.x && m_blupiPos.x != tinyPoint4.x)
+ tinyPoint4 = adjustPos;
+ TestPath(rect, m_blupiPos, &adjustPos);
+ if (flag && m_blupiPos.x == adjustPos.x && m_blupiPos.x != tinyPoint4.x)
{
- tinyPoint3.y = tinyPoint4.y;
- TestPath(rect, m_blupiPos, ref tinyPoint3);
+ adjustPos.y = tinyPoint4.y;
+ TestPath(rect, m_blupiPos, &adjustPos);
}
- if (m_blupiVent && m_blupiPos.y == tinyPoint3.y && m_blupiPos.y != tinyPoint4.y)
+ if (m_blupiVent && m_blupiPos.y == adjustPos.y && m_blupiPos.y != tinyPoint4.y)
{
- tinyPoint3.x = tinyPoint4.x;
- TestPath(rect, m_blupiPos, ref tinyPoint3);
+ adjustPos.x = tinyPoint4.x;
+ TestPath(rect, m_blupiPos, &adjustPos);
}
- if (m_blupiTransport != -1 && m_blupiPos.x == tinyPoint3.x && m_blupiPos.x != tinyPoint4.x)
+ if (m_blupiTransport != -1 && m_blupiPos.x == adjustPos.x && m_blupiPos.x != tinyPoint4.x)
{
- tinyPoint3.y = tinyPoint4.y;
- TestPath(rect, m_blupiPos, ref tinyPoint3);
+ adjustPos.y = tinyPoint4.y;
+ TestPath(rect, m_blupiPos, &adjustPos);
}
if (m_blupiHelico || m_blupiOver || m_blupiBalloon || m_blupiEcrase || m_blupiJeep || m_blupiTank || m_blupiSkate || m_blupiNage)
{
- if (m_blupiPos.x == tinyPoint3.x && m_blupiPos.x != tinyPoint4.x)
+ if (m_blupiPos.x == adjustPos.x && m_blupiPos.x != tinyPoint4.x)
{
- tinyPoint3.y = tinyPoint4.y;
- TestPath(rect, m_blupiPos, ref tinyPoint3);
+ adjustPos.y = tinyPoint4.y;
+ TestPath(rect, m_blupiPos, &adjustPos);
}
- else if (m_blupiPos.y == tinyPoint3.y && m_blupiPos.y != tinyPoint4.y)
+ else if (m_blupiPos.y == adjustPos.y && m_blupiPos.y != tinyPoint4.y)
{
- tinyPoint3.x = tinyPoint4.x;
- TestPath(rect, m_blupiPos, ref tinyPoint3);
+ adjustPos.x = tinyPoint4.x;
+ TestPath(rect, m_blupiPos, &adjustPos);
}
}
POINT blupiPos = m_blupiPos;
- m_blupiPos = tinyPoint3;
+ m_blupiPos = adjustPos;
if ((m_blupiAction == 1 || m_blupiAction == 60 || m_blupiAction == 7 || m_blupiAction == 6) && !m_blupiAir && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
{
if (m_blupiTransport != -1)
{
- AscenseurVertigo(m_blupiTransport, flag2, flag3);
+ AscenseurVertigo(m_blupiTransport, &flag2, &flag3);
}
else
{
- rect.left = tinyPoint3.x + 24;
- rect.right = tinyPoint3.x + 26;
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60;
+ rect.left = adjustPos.x + 24;
+ rect.right = adjustPos.x + 26;
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60;
flag2 = !DecorDetect(rect);
- rect.left = tinyPoint3.x + 60 - 26;
- rect.right = tinyPoint3.x + 60 - 24;
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60;
+ rect.left = adjustPos.x + 60 - 26;
+ rect.right = adjustPos.x + 60 - 24;
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60;
flag3 = !DecorDetect(rect);
}
if (m_blupiDir == 1 && flag2 && !flag3)
@@ -2404,7 +2371,7 @@ void CDecor::BlupiStep()
}
else
{
- PlaySound(6, tinyPoint3);
+ PlaySound(6, adjustPos);
m_blupiAction = 8;
m_blupiPhase = 0;
}
@@ -2418,7 +2385,7 @@ void CDecor::BlupiStep()
}
else
{
- PlaySound(6, tinyPoint3);
+ PlaySound(6, adjustPos);
m_blupiAction = 8;
m_blupiPhase = 0;
}
@@ -2427,7 +2394,7 @@ void CDecor::BlupiStep()
{
if (!m_blupiHelico && !m_blupiOver)
{
- PlaySound(6, tinyPoint3);
+ PlaySound(6, adjustPos);
}
m_blupiAction = 10;
m_blupiPhase = 0;
@@ -2437,19 +2404,19 @@ void CDecor::BlupiStep()
{
if (m_blupiTransport != -1)
{
- AscenseurVertigo(m_blupiTransport, flag2, flag3);
+ AscenseurVertigo(m_blupiTransport, &flag2, &flag3);
}
else
{
- rect.left = tinyPoint3.x + 2;
- rect.right = tinyPoint3.x + 18;
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60;
+ rect.left = adjustPos.x + 2;
+ rect.right = adjustPos.x + 18;
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60;
flag2 = !DecorDetect(rect);
- rect.left = tinyPoint3.x + 60 - 18;
- rect.right = tinyPoint3.x + 60 - 2;
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60;
+ rect.left = adjustPos.x + 60 - 18;
+ rect.right = adjustPos.x + 60 - 2;
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60;
flag3 = !DecorDetect(rect);
}
if (flag2 && !flag3)
@@ -2467,19 +2434,19 @@ void CDecor::BlupiStep()
{
if (m_blupiTransport != -1)
{
- AscenseurVertigo(m_blupiTransport, flag2, flag3);
+ AscenseurVertigo(m_blupiTransport, &flag2, &flag3);
}
else
{
- rect.left = tinyPoint3.x + 2;
- rect.right = tinyPoint3.x + 18;
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60;
+ rect.left = adjustPos.x + 2;
+ rect.right = adjustPos.x + 18;
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60;
flag2 = !DecorDetect(rect);
- rect.left = tinyPoint3.x + 60 - 18;
- rect.right = tinyPoint3.x + 60 - 2;
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60;
+ rect.left = adjustPos.x + 60 - 18;
+ rect.right = adjustPos.x + 60 - 2;
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60;
flag3 = !DecorDetect(rect);
}
if (flag2 && !flag3)
@@ -2497,19 +2464,19 @@ void CDecor::BlupiStep()
{
if (m_blupiTransport != -1)
{
- AscenseurVertigo(m_blupiTransport, flag2, flag3);
+ AscenseurVertigo(m_blupiTransport, &flag2, &flag3);
}
else
{
- rect.left = tinyPoint3.x + 12;
- rect.right = tinyPoint3.x + 19;
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60;
+ rect.left = adjustPos.x + 12;
+ rect.right = adjustPos.x + 19;
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60;
flag2 = !DecorDetect(rect);
- rect.left = tinyPoint3.x + 60 - 19;
- rect.right = tinyPoint3.x + 60 - 12;
- rect.top = tinyPoint3.y + 60 - 2;
- rect.bottom = tinyPoint3.y + 60;
+ rect.left = adjustPos.x + 60 - 19;
+ rect.right = adjustPos.x + 60 - 12;
+ rect.top = adjustPos.y + 60 - 2;
+ rect.bottom = adjustPos.y + 60;
flag3 = !DecorDetect(rect);
}
if (flag2 && !flag3)
@@ -2642,7 +2609,7 @@ void CDecor::BlupiStep()
tinyPoint.x = m_blupiPos.x + 100;
tinyPoint.y = m_blupiPos.y;
ObjectStart(tinyPoint, 42, -10);
- PlaySound(67, tinyPoint3);
+ PlaySound(67, adjustPos);
}
else if (m_time % 3 == 0)
{
@@ -2694,13 +2661,13 @@ void CDecor::BlupiStep()
num = MoveObjectFree();
if (num != -1)
{
- m_moveObject[num]->type = 27;
- m_moveObject[num]->phase = 0;
- m_moveObject[num]->posCurrent = m_blupiPos;
- m_moveObject[num]->posStart = m_moveObject[num]->posCurrent;
- m_moveObject[num]->posEnd = m_moveObject[num]->posCurrent;
- m_moveObject[num]->step = 1;
- m_moveObject[num]->time = 0;
+ m_moveObject[num].type = 27;
+ m_moveObject[num].phase = 0;
+ m_moveObject[num].posCurrent = m_blupiPos;
+ m_moveObject[num].posStart = m_moveObject[num].posCurrent;
+ m_moveObject[num].posEnd = m_moveObject[num].posCurrent;
+ m_moveObject[num].step = 1;
+ m_moveObject[num].time = 0;
MoveObjectStepIcon(num);
m_blupiPosMagic = m_blupiPos;
}
@@ -2710,13 +2677,13 @@ void CDecor::BlupiStep()
num = MoveObjectFree();
if (num != -1)
{
- m_moveObject[num]->type = 57;
- m_moveObject[num]->phase = 0;
- m_moveObject[num]->posCurrent = m_blupiPos;
- m_moveObject[num]->posStart = m_moveObject[num]->posCurrent;
- m_moveObject[num]->posEnd = m_moveObject[num]->posCurrent;
- m_moveObject[num]->step = 1;
- m_moveObject[num]->time = 0;
+ m_moveObject[num].type = 57;
+ m_moveObject[num].phase = 0;
+ m_moveObject[num].posCurrent = m_blupiPos;
+ m_moveObject[num].posStart = m_moveObject[num].posCurrent;
+ m_moveObject[num].posEnd = m_moveObject[num].posCurrent;
+ m_moveObject[num].step = 1;
+ m_moveObject[num].time = 0;
MoveObjectStepIcon(num);
m_blupiPosMagic = m_blupiPos;
}
@@ -2726,15 +2693,15 @@ void CDecor::BlupiStep()
num = MoveObjectFree();
if (num != -1)
{
- m_moveObject[num]->type = 58;
- m_moveObject[num]->icon = m_blupiIcon;
- m_moveObject[num]->channel = 2;
- m_moveObject[num]->phase = 0;
- m_moveObject[num]->posCurrent = m_blupiPos;
- m_moveObject[num]->posStart = m_moveObject[num]->posCurrent;
- m_moveObject[num]->posEnd = m_moveObject[num]->posCurrent;
- m_moveObject[num]->step = 1;
- m_moveObject[num]->time = 0;
+ m_moveObject[num].type = 58;
+ m_moveObject[num].icon = m_blupiIcon;
+ m_moveObject[num].channel = 2;
+ m_moveObject[num].phase = 0;
+ m_moveObject[num].posCurrent = m_blupiPos;
+ m_moveObject[num].posStart = m_moveObject[num].posCurrent;
+ m_moveObject[num].posEnd = m_moveObject[num].posCurrent;
+ m_moveObject[num].step = 1;
+ m_moveObject[num].time = 0;
MoveObjectStepIcon(num);
m_blupiPosMagic = m_blupiPos;
}
@@ -2745,12 +2712,11 @@ void CDecor::BlupiStep()
}
if (m_blupiHelico && m_blupiPos.y > 2 && m_blupiFocus && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi)
{
- rect = BlupiRect(tinyPoint3);
- rect.top = tinyPoint3.y + 4;
- rect.bottom = tinyPoint3.y + 20;
+ rect = BlupiRect(adjustPos);
+ rect.top = adjustPos.y + 4;
+ rect.bottom = adjustPos.y + 20;
if (DecorDetect(rect))
{
- ByeByeHelico();
m_blupiAction = 1;
m_blupiPhase = 0;
m_blupiHelico = false;
@@ -2777,8 +2743,8 @@ void CDecor::BlupiStep()
m_blupiSurf = true;
m_blupiAction = 1;
m_blupiPhase = 0;
- m_blupiVitesse.x = 0.0;
- m_blupiVitesse.y = 0.0;
+ m_blupiVitesse.x = 0;
+ m_blupiVitesse.y = 0;
MoveObjectPlouf(m_blupiPos);
if (m_blupiTransport != -1)
{
@@ -2797,8 +2763,8 @@ void CDecor::BlupiStep()
{
m_blupiAction = 1;
m_blupiPhase = 0;
- m_blupiVitesse.x = 0.0;
- m_blupiVitesse.y = 0.0;
+ m_blupiVitesse.x = 0;
+ m_blupiVitesse.y = 0;
MoveObjectPlouf(m_blupiPos);
}
m_blupiAir = false;
@@ -2806,7 +2772,7 @@ void CDecor::BlupiStep()
m_blupiNage = true;
m_blupiLevel = 100;
m_jauges[0].SetLevel(m_blupiLevel);
- m_jauges[0].SetMode(2);
+ //m_jauges[0].SetMode(2);
m_jauges[0].SetHide(false);
}
if (m_blupiNage && IsSurfWater(m_blupiPos))
@@ -2826,14 +2792,14 @@ void CDecor::BlupiStep()
m_blupiAir = true;
m_blupiAction = 5;
m_blupiPhase = 0;
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
if (m_blupiPower)
{
- m_blupiVitesse.y = -16.0;
+ m_blupiVitesse.y = -16;
}
else
{
- m_blupiVitesse.y = -12.0;
+ m_blupiVitesse.y = -12;
}
MoveObjectTiplouf(m_blupiPos);
PlaySound(22, m_blupiPos);
@@ -2841,7 +2807,7 @@ void CDecor::BlupiStep()
}
if ((m_blupiSurf || m_blupiNage) && IsOutWater(m_blupiPos))
{
- if (m_blupiVitesse.y < 0.0)
+ if (m_blupiVitesse.y < 0)
{
if (m_blupiTransport == -1)
{
@@ -2856,13 +2822,13 @@ void CDecor::BlupiStep()
m_blupiAction = 5;
m_blupiPhase = 0;
m_blupiPos.y = m_blupiPos.y - 10;
- m_blupiVitesse.x = 0.0;
- m_blupiVitesse.y = -10.0;
+ m_blupiVitesse.x = 0;
+ m_blupiVitesse.y = -10;
PlaySound(22, m_blupiPos);
m_jauges[0].SetHide(true);
}
}
- else if (m_blupiVitesse.y > 0.0)
+ else if (m_blupiVitesse.y > 0)
{
m_blupiNage = false;
m_blupiSurf = false;
@@ -2870,8 +2836,8 @@ void CDecor::BlupiStep()
m_blupiAction = 5;
m_blupiPhase = 0;
m_blupiPos.y = m_blupiPos.y + 30;
- m_blupiVitesse.x = 0.0;
- m_blupiVitesse.y = 0.0;
+ m_blupiVitesse.x = 0;
+ m_blupiVitesse.y = 0;
PlaySound(22, m_blupiPos);
m_jauges[0].SetHide(true);
}
@@ -2883,8 +2849,8 @@ void CDecor::BlupiStep()
m_blupiAction = 1;
m_blupiPhase = 0;
m_blupiPos.y = m_blupiPos.y - 10;
- m_blupiVitesse.x = 0.0;
- m_blupiVitesse.y = 0.0;
+ m_blupiVitesse.x = 0;
+ m_blupiVitesse.y = 0;
PlaySound(22, m_blupiPos);
m_jauges[0].SetHide(true);
}
@@ -2897,7 +2863,7 @@ void CDecor::BlupiStep()
}
if ((m_blupiHelico || m_blupiOver || m_blupiJeep || m_blupiTank || m_blupiSkate) && m_blupiFocus && (IsSurfWater(m_blupiPos) || IsDeepWater(m_blupiPos)))
{
- ByeByeHelico();
+
m_blupiAction = 1;
m_blupiPhase = 0;
m_blupiHelico = false;
@@ -2969,7 +2935,7 @@ void CDecor::BlupiStep()
m_blupiFront = true;
}
}
- int num27 = MoveObjectDetect(m_blupiPos, flag6);
+ int num27 = MoveObjectDetect(m_blupiPos, &flag6);
POINT tinyPoint5;
if (m_blupiAction != 11 && m_blupiAction != 75 && m_blupiAction != 76 && m_blupiAction != 77 && m_blupiAction != 78 && m_blupiAction != 79 && m_blupiAction != 80 && m_blupiAction != 81)
{
@@ -2977,7 +2943,7 @@ void CDecor::BlupiStep()
{
BlupiDead(76, -1);
m_blupiRestart = true;
- m_blupiPos.y = m_blupipos.y / DIMOBJY * 64 + BLUPIOFFY;
+ m_blupiPos.y = m_blupiPos.y / DIMOBJY * 64 + BLUPIOFFY;
PlaySound(8, m_blupiPos);
}
if (IsPiege(m_blupiPos) && !m_blupiOver && !m_blupiJeep && !m_blupiTank && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus)
@@ -3002,30 +2968,30 @@ void CDecor::BlupiStep()
m_blupiRestart = true;
m_blupiAir = true;
}
- if (ButtonPressed == ButtonGlygh.PlayAction && (num27 == -1 || !flag6) && IsSwitch(m_blupiPos, tinyPoint) && !m_blupiOver && !m_blupiBalloon && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus)
+ if ( (num27 == -1 || !flag6) && IsSwitch(m_blupiPos, tinyPoint) && !m_blupiOver && !m_blupiBalloon && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus)
{
- ButtonPressed = Def.ButtonGlygh.None;
- ActiveSwitch(m_decor[tinyPoint.x, tinyPoint.y].icon == 385, tinyPoint);
+
+ ActiveSwitch(m_decor[tinyPoint.x][tinyPoint.y].icon == 385, tinyPoint);
m_blupiAction = 82;
m_blupiPhase = 0;
m_blupiFocus = false;
- m_blupiVitesse.x = 0.0;
- m_blupiVitesse.y = 0.0;
+ m_blupiVitesse.x = 0;
+ m_blupiVitesse.y = 0;
}
if (IsBlitz(m_blupiPos, false) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi)
{
BlupiDead(11, -1);
m_blupiRestart = true;
m_blupiAir = true;
- m_blupiPos.y = m_blupipos.y / DIMOBJY * 64 + BLUPIOFFY;
+ m_blupiPos.y = m_blupiPos.y / DIMOBJY * 64 + BLUPIOFFY;
PlaySound(8, m_blupiPos);
}
if (IsEcraseur(m_blupiPos) && !m_blupiEcrase && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus)
{
m_blupiAction = 1;
m_blupiPhase = 0;
- m_blupiVitesse.x = 0.0;
- m_blupiVitesse.y = 0.0;
+ m_blupiVitesse.x = 0;
+ m_blupiVitesse.y = 0;
m_blupiEcrase = true;
m_blupiBalloon = false;
m_blupiAir = false;
@@ -3067,10 +3033,10 @@ void CDecor::BlupiStep()
{
m_blupiAction = 74;
m_blupiPhase = 0;
- m_blupiVitesse.x = 0.0;
- m_blupiVitesse.y = 0.0;
+ m_blupiVitesse.x = 0;
+ m_blupiVitesse.y = 0;
m_blupiFocus = false;
- m_blupiPos.x = m_blupipos.x / DIMOBJX * 64;
+ m_blupiPos.x = m_blupiPos.x / DIMOBJX * 64;
PlaySound(71, m_blupiPos);
tinyPoint.x = m_blupiPos.x;
tinyPoint.y = m_blupiPos.y - 5;
@@ -3091,7 +3057,7 @@ void CDecor::BlupiStep()
tinyPoint.y = 418;
tinyPoint5.x = tinyPoint2.x * 64 - m_posDecor.x;
tinyPoint5.y = tinyPoint2.y * 64 - m_posDecor.y;
- VoyageInit(tinyPoint, m_pPixmap->HotSpotToHud(tinyPoint5), 214 + (num2 - 334) * 7, 10);
+ ////VoyageInit(tinyPoint, m_pPixmap->HotSpotToHud(tinyPoint5), 214 + (num2 - 334) * 7, 10);
}
}
if (!m_blupiHelico && !m_blupiSuspend && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiSkate && !m_blupiJeep && !m_blupiTank && !m_blupiJeep && m_blupiFocus)
@@ -3105,23 +3071,21 @@ void CDecor::BlupiStep()
}
MoveObjectFollow(m_blupiPos);
num = num27;
- if (num != -1 && !flag6 && m_moveObject[num]->type == 2 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && !m_blupiShield && !m_bSuperBlupi && m_blupiFocus)
+ if (num != -1 && !flag6 && m_moveObject[num].type == 2 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && !m_blupiShield && !m_bSuperBlupi && m_blupiFocus)
{
m_blupiActionOuf = 48;
m_blupiTimeOuf = 0;
}
if (num != -1 && flag6)
{
- if (m_moveObject[num]->type == 13 && (ButtonPressed == ButtonGlygh.PlayAction || IsFloatingObject(num)) && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
+ if (m_moveObject[num].type == 13 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
{
- ButtonPressed = Def.ButtonGlygh.None;
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
m_scrollAdd.x = 0;
m_scrollAdd.y = 0;
m_blupiAir = false;
m_blupiHelico = true;
- m_blupiRealRotation = 0;
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
if (m_blupiCloud || m_blupiHide)
{
m_blupiCloud = false;
@@ -3129,15 +3093,14 @@ void CDecor::BlupiStep()
m_jauges[1].SetHide(true);
}
}
- if (ButtonPressed == ButtonGlygh.PlayAction && m_moveObject[num]->type == 46 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
+ if (m_moveObject[num].type == 46 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
{
- ButtonPressed = Def.ButtonGlygh.None;
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
m_scrollAdd.x = 0;
m_scrollAdd.y = 0;
m_blupiAir = false;
m_blupiOver = true;
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
if (m_blupiCloud || m_blupiHide)
{
m_blupiCloud = false;
@@ -3145,9 +3108,8 @@ void CDecor::BlupiStep()
m_jauges[1].SetHide(true);
}
}
- if (ButtonPressed == ButtonGlygh.PlayAction && m_moveObject[num]->type == 19 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
+ if (m_moveObject[num].type == 19 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
{
- ButtonPressed = Def.ButtonGlygh.None;
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
m_scrollAdd.x = 0;
m_scrollAdd.y = 0;
@@ -3155,7 +3117,7 @@ void CDecor::BlupiStep()
m_blupiPhase = 0;
m_blupiAir = false;
m_blupiJeep = true;
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
if (m_blupiCloud || m_blupiHide)
{
m_blupiCloud = false;
@@ -3163,9 +3125,9 @@ void CDecor::BlupiStep()
m_jauges[1].SetHide(true);
}
}
- if (ButtonPressed == ButtonGlygh.PlayAction && m_moveObject[num]->type == 28 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
+ if ( m_moveObject[num].type == 28 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
{
- ButtonPressed = Def.ButtonGlygh.None;
+
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
m_scrollAdd.x = 0;
m_scrollAdd.y = 0;
@@ -3173,7 +3135,7 @@ void CDecor::BlupiStep()
m_blupiPhase = 0;
m_blupiAir = false;
m_blupiTank = true;
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
if (m_blupiCloud || m_blupiHide)
{
m_blupiCloud = false;
@@ -3181,23 +3143,23 @@ void CDecor::BlupiStep()
m_jauges[1].SetHide(true);
}
}
- if (m_moveObject[num]->type == 29 && m_blupiFocus && m_blupiBullet < 10)
+ if (m_moveObject[num].type == 29 && m_blupiFocus && m_blupiBullet < 10)
{
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x;
tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y;
tinyPoint5.x = 570;
tinyPoint5.y = 430;
- VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), tinyPoint5, 177, 10);
+ ////VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), tinyPoint5, 177, 10);
m_blupiBullet += 10;
if (m_blupiBullet > 10)
{
m_blupiBullet = 10;
}
}
- if (ButtonPressed == Def.ButtonGlygh.PlayAction && m_moveObject[num].type == 24 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
+ if ( m_moveObject[num].type == 24 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus)
{
- ButtonPressed = Def.ButtonGlygh.None;
+
m_scrollAdd.x = 0;
m_scrollAdd.y = 0;
m_blupiAction = 42;
@@ -3206,7 +3168,7 @@ void CDecor::BlupiStep()
m_blupiFocus = false;
m_blupiAir = false;
m_blupiSkate = true;
- m_blupiVitesse.x = 0.0;
+ m_blupiVitesse.x = 0;
if (m_blupiCloud || m_blupiHide)
{
m_blupiCloud = false;
@@ -3226,7 +3188,7 @@ void CDecor::BlupiStep()
ObjectStart(tinyPoint, 91, 0);
PlaySound(41, m_blupiPos);
m_blupiPos.y = m_blupiPos.y + 4;
- m_blupiVitesse.y = 0.0;
+ m_blupiVitesse.y = 0;
m_blupiPosHelico = m_blupiPos;
}
else if ((m_moveObject[num].type == 2 || m_moveObject[num].type == 3 || m_moveObject[num].type == 96 || m_moveObject[num].type == 97 || m_moveObject[num].type == 16 || m_moveObject[num].type == 4 || m_moveObject[num].type == 17 || m_moveObject[num].type == 20) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiPosHelico.x == -1)
@@ -3270,11 +3232,11 @@ void CDecor::BlupiStep()
}
if (m_moveObject[num].type == 44 && m_blupiFocus && !m_blupiBalloon && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi)
{
- ByeByeHelico();
+
m_blupiAction = 1;
m_blupiPhase = 0;
- m_blupiVitesse.x = 0.0;
- m_blupiVitesse.y = 0.0;
+ m_blupiVitesse.x = 0;
+ m_blupiVitesse.y = 0;
m_blupiBalloon = true;
m_blupiEcrase = false;
m_blupiAir = false;
@@ -3310,7 +3272,7 @@ void CDecor::BlupiStep()
}
if (m_moveObject[num].type == 54 && m_moveObject[num].step != 2 && m_moveObject[num].step != 4 && m_blupiFocus && !m_blupiBalloon && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi)
{
- ByeByeHelico();
+
tinyPoint.x = m_blupiPos.x;
tinyPoint.y = (m_blupiPos.y + 64 - 10) / 64 * 64 + 4;
ObjectStart(tinyPoint, 53, 0);
@@ -3320,7 +3282,7 @@ void CDecor::BlupiStep()
m_blupiJumpAie = false;
m_blupiFocus = false;
m_blupiRestart = true;
- if (flag4)
+ if (flag)
{
m_blupiAir = true;
}
@@ -3355,7 +3317,7 @@ void CDecor::BlupiStep()
}
if (m_moveObject[num].type == 23 && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiAction != 13 && m_blupiAction != 30 && m_blupiAction != 11 && m_blupiAction != 75 && m_blupiAction != 76 && m_blupiAction != 77 && m_blupiAction != 78 && m_blupiAction != 79 && m_blupiAction != 80 && m_blupiAction != 81 && m_blupiAction != 54 && m_blupiAction != 57 && m_blupiAction != 35)
{
- ByeByeHelico();
+
tinyPoint = m_moveObject[num].posCurrent;
ObjectDelete(tinyPoint, m_moveObject[num].type);
m_blupiAction = 54;
@@ -3364,7 +3326,7 @@ void CDecor::BlupiStep()
m_blupiJumpAie = false;
m_blupiFocus = false;
m_blupiRestart = true;
- if (flag4)
+ if (flag)
{
m_blupiAir = true;
}
@@ -3388,10 +3350,10 @@ void CDecor::BlupiStep()
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x;
tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y;
- TinyPoint end;
+ POINT end;
end.x = 430;
end.y = 430;
- VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end, 6, 10);
+ //VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end, 6, 10);
ObjectStart(m_moveObject[num].posCurrent, 39, -60);
ObjectStart(m_moveObject[num].posCurrent, 39, 60);
ObjectStart(m_moveObject[num].posCurrent, 39, 10);
@@ -3402,10 +3364,10 @@ void CDecor::BlupiStep()
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x;
tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y;
- TinyPoint end2;
+ POINT end2;
end2.x = 520;
end2.y = 418;
- VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end2, 215, 10);
+ //VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end2, 215, 10);
ObjectStart(m_moveObject[num].posCurrent, 39, -60);
ObjectStart(m_moveObject[num].posCurrent, 39, 60);
ObjectStart(m_moveObject[num].posCurrent, 39, 10);
@@ -3416,10 +3378,10 @@ void CDecor::BlupiStep()
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x;
tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y;
- TinyPoint end3;
+ POINT end3;
end3.x = 530;
end3.y = 418;
- VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end3, 222, 10);
+ //VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end3, 222, 10);
ObjectStart(m_moveObject[num].posCurrent, 39, -60);
ObjectStart(m_moveObject[num].posCurrent, 39, 60);
ObjectStart(m_moveObject[num].posCurrent, 39, 10);
@@ -3430,10 +3392,10 @@ void CDecor::BlupiStep()
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x;
tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y;
- TinyPoint end4;
+ POINT end4;
end4.x = 540;
end4.y = 418;
- VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end4, 229, 10);
+ //VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end4, 229, 10);
ObjectStart(m_moveObject[num].posCurrent, 39, -60);
ObjectStart(m_moveObject[num].posCurrent, 39, 60);
ObjectStart(m_moveObject[num].posCurrent, 39, 10);
@@ -3444,7 +3406,7 @@ void CDecor::BlupiStep()
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x;
tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y;
- VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), VoyageGetPosVie(m_nbVies + 1), 21, 10);
+ //VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), VoyageGetPosVie(m_nbVies + 1), 21, 10);
}
if (m_moveObject[num].type == 25 && !m_blupiShield && !m_blupiHide && !m_blupiPower && m_blupiFocus)
{
@@ -3457,18 +3419,16 @@ void CDecor::BlupiStep()
m_blupiPosMagic = m_blupiPos;
m_jauges[1].SetHide(false);
}
- if (ButtonPressed == Def.ButtonGlygh.PlayAction && m_moveObject[num].type == 26 && !m_blupiShield && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus)
+ if ( m_moveObject[num].type == 26 && !m_blupiShield && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus)
{
- ButtonPressed = Def.ButtonGlygh.None;
- m_sucettePos = m_moveObject[num].posCurrent;
- m_sucetteType = m_moveObject[num].type;
+
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
m_blupiAction = 49;
m_blupiPhase = 0;
m_blupiCloud = false;
m_blupiHide = false;
m_blupiFocus = false;
- PlaySound(50, tinyPoint3);
+ PlaySound(50, adjustPos);
}
if (m_moveObject[num].type == 40 && !m_blupiHide && m_blupiFocus)
{
@@ -3477,17 +3437,15 @@ void CDecor::BlupiStep()
m_blupiTimeShield = 100;
m_blupiPosMagic = m_blupiPos;
m_jauges[1].SetHide(false);
- PlaySound(66, tinyPoint3);
+ PlaySound(66, adjustPos);
ObjectStart(m_blupiPos, 41, -60);
ObjectStart(m_blupiPos, 41, 60);
ObjectStart(m_blupiPos, 41, 10);
ObjectStart(m_blupiPos, 41, -10);
}
- if (ButtonPressed == Def.ButtonGlygh.PlayAction && m_moveObject[num].type == 30 && !m_blupiShield && !m_blupiCloud && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus)
+ if ( m_moveObject[num].type == 30 && !m_blupiShield && !m_blupiCloud && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus)
{
- ButtonPressed = Def.ButtonGlygh.None;
- m_sucettePos = m_moveObject[num].posCurrent;
- m_sucetteType = m_moveObject[num].type;
+
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
m_blupiAction = 55;
m_blupiPhase = 0;
@@ -3495,7 +3453,7 @@ void CDecor::BlupiStep()
m_blupiPower = false;
m_blupiJumpAie = false;
m_blupiFocus = false;
- PlaySound(57, tinyPoint3);
+ PlaySound(57, adjustPos);
}
if (m_moveObject[num].type == 31 && !m_blupiShield && !m_blupiHide && !m_blupiPower && !m_blupiCloud && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus)
{
@@ -3507,7 +3465,7 @@ void CDecor::BlupiStep()
m_blupiFocus = false;
m_blupiCloud = true;
m_blupiTimeShield = 100;
- PlaySound(58, tinyPoint3);
+ PlaySound(58, adjustPos);
if (m_blupiHide)
{
m_blupiHide = false;
@@ -3518,15 +3476,15 @@ void CDecor::BlupiStep()
{
if (m_moveObject[num].type == 200)
{
- if (m_blupiPerso < 5 && ButtonPressed == Def.ButtonGlygh.PlayAction)
+ if (m_blupiPerso < 5 )
{
- ButtonPressed = Def.ButtonGlygh.None;
+
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x;
tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y;
tinyPoint5.x = 0;
tinyPoint5.y = 438;
- VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), tinyPoint5, 108, 4);
+ ////VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), tinyPoint5, 108, 4);
}
}
else if (!m_blupiShield && !m_blupiHide && !m_bSuperBlupi)
@@ -3542,41 +3500,41 @@ void CDecor::BlupiStep()
m_decorPhase = 0;
}
}
- if (m_moveObject[num].type == 55 && m_blupiFocus && m_blupiDynamite == 0 && (m_voyageIcon != 252 || m_voyageChannel != 10) && ButtonPressed == Def.ButtonGlygh.PlayAction)
+ if (m_moveObject[num].type == 55 && m_blupiFocus && m_blupiDynamite == 0 && (m_voyageIcon != 252 || m_voyageChannel != 10) )
{
- ButtonPressed = Def.ButtonGlygh.None;
+
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x;
tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y;
tinyPoint5.x = 505;
tinyPoint5.y = 414;
- VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), tinyPoint5, 252, 10);
+ ////VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), tinyPoint5, 252, 10);
m_blupiAction = 86;
m_blupiPhase = 0;
m_blupiFocus = false;
}
if (m_moveObject[num].type == 12 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus && m_blupiAction == 2)
{
- tinyPoint3 = m_moveObject[num].posCurrent;
- if (m_blupiDir == 1 && m_blupiPos.x > tinyPoint3.x)
+ adjustPos = m_moveObject[num].posCurrent;
+ if (m_blupiDir == 1 && m_blupiPos.x > adjustPos.x)
{
- tinyPoint3.x = m_blupiPos.x - 59;
- PlaySound(38, tinyPoint3);
+ adjustPos.x = m_blupiPos.x - 59;
+ PlaySound(38, adjustPos);
m_blupiActionOuf = 45;
m_blupiTimeOuf = 0;
m_blupiAction = 14;
m_blupiPhase = 0;
}
- if (m_blupiDir == 2 && m_blupiPos.x < tinyPoint3.x)
+ if (m_blupiDir == 2 && m_blupiPos.x < adjustPos.x)
{
- tinyPoint3.x = m_blupiPos.x + 55;
- PlaySound(38, tinyPoint3);
+ adjustPos.x = m_blupiPos.x + 55;
+ PlaySound(38, adjustPos);
m_blupiActionOuf = 45;
m_blupiTimeOuf = 0;
m_blupiAction = 14;
m_blupiPhase = 0;
}
- if (!TestPushCaisse(num, tinyPoint3, false))
+ if (!TestPushCaisse(num, adjustPos, false))
{
m_blupiPos.x = blupiPos.x;
}
@@ -3591,7 +3549,6 @@ void CDecor::BlupiStep()
{
m_bFoundCle = true;
}
- ByeByeHelico();
StopSound(16);
StopSound(18);
StopSound(29);
@@ -3628,16 +3585,16 @@ void CDecor::BlupiStep()
num = CaisseInFront();
if (num != -1)
{
- tinyPoint3 = m_moveObject[num].posCurrent;
+ adjustPos = m_moveObject[num].posCurrent;
if (m_blupiDir == 1)
{
- tinyPoint3.x = m_blupiPos.x - 59;
+ adjustPos.x = m_blupiPos.x - 59;
}
else
{
- tinyPoint3.x = m_blupiPos.x + 55;
+ adjustPos.x = m_blupiPos.x + 55;
}
- if (!TestPushCaisse(num, tinyPoint3, false))
+ if (!TestPushCaisse(num, adjustPos, false))
{
m_blupiPos.x = blupiPos.x;
}
@@ -3653,16 +3610,16 @@ void CDecor::BlupiStep()
num = CaisseInFront();
if (num != -1)
{
- tinyPoint3 = m_moveObject[num].posCurrent;
+ adjustPos = m_moveObject[num].posCurrent;
if (m_blupiDir == 1)
{
- tinyPoint3.x = m_blupiPos.x - 59;
+ adjustPos.x = m_blupiPos.x - 59;
}
else
{
- tinyPoint3.x = m_blupiPos.x + 55;
+ adjustPos.x = m_blupiPos.x + 55;
}
- if (!TestPushCaisse(num, tinyPoint3, true))
+ if (!TestPushCaisse(num, adjustPos, true))
{
m_blupiAction = 1;
m_blupiPhase = 0;
@@ -3772,8 +3729,8 @@ void CDecor::BlupiStep()
}
if (m_blupiAction == 74 && m_blupiPhase == 128)
{
- TinyPoint blupiPos2 = default(TinyPoint);
- if (SearchTeleporte(m_blupiPos, ref blupiPos2))
+ POINT blupiPos2 { 0,0 };
+ if (SearchTeleporte(m_blupiPos, blupiPos2))
{
m_blupiPos = blupiPos2;
ObjectStart(m_blupiPos, 27, 20);
@@ -3788,7 +3745,7 @@ void CDecor::BlupiStep()
m_blupiPhase = 0;
m_blupiFocus = true;
}
- if (ButtonPressed == Def.ButtonGlygh.PlayAction && m_blupiAction == 1)
+ if ( m_blupiAction == 1)
{
m_blupiAction = 84;
m_blupiPhase = 0;
@@ -3805,10 +3762,10 @@ void CDecor::BlupiStep()
{
m_blupiPos = m_blupiValidPos;
}
- TinyPoint posDecor = GetPosDecor(m_blupiPos);
+ POINT posDecor = GetPosDecor(m_blupiPos);
tinyPoint.x = m_blupiPos.x - posDecor.x - 30;
tinyPoint.y = m_blupiPos.y - posDecor.y;
- VoyageInit(VoyageGetPosVie(m_nbVies), m_pPixmap->HotSpotToHud(tinyPoint), 48, 2);
+ ////VoyageInit(VoyageGetPosVie(m_nbVies), m_pPixmap->HotSpotToHud(tinyPoint), 48, 2);
}
else
{
@@ -3891,7 +3848,7 @@ void CDecor::BlupiStep()
{
StopSound(47);
}
- if (m_blupiFocus && !m_blupiAir && (!m_blupiHelico || BlupiIsGround()) && (!m_blupiOver || BlupiIsGround()) && !m_blupiBalloon && !m_blupiEcrase && !m_blupiShield && !m_blupiHide && !flag2 && !flag3 && m_blupiTransport == -1 && !IsLave(m_blupiPos) && !IsPiege(m_blupiPos) && !IsGoutte(m_blupiPos, true) && !IsScie(m_blupiPos) && !IsBridge(m_blupiPos, ref tinyPoint) && IsTeleporte(m_blupiPos) == -1 && !IsBlitz(m_blupiPos, true) && !IsTemp(m_blupiPos) && !IsBalleTraj(m_blupiPos) && !IsMoveTraj(m_blupiPos))
+ if (m_blupiFocus && !m_blupiAir && (!m_blupiHelico || BlupiIsGround()) && (!m_blupiOver || BlupiIsGround()) && !m_blupiBalloon && !m_blupiEcrase && !m_blupiShield && !m_blupiHide && !flag2 && !flag3 && m_blupiTransport == -1 && !IsLave(m_blupiPos) && !IsPiege(m_blupiPos) && !IsGoutte(m_blupiPos, true) && !IsScie(m_blupiPos) && !IsBridge(m_blupiPos, tinyPoint) && IsTeleporte(m_blupiPos) == -1 && !IsBlitz(m_blupiPos, true) && !IsTemp(m_blupiPos) && !IsBalleTraj(m_blupiPos) && !IsMoveTraj(m_blupiPos))
{
if (m_blupiFifoNb > 0)
{
@@ -3899,10 +3856,10 @@ void CDecor::BlupiStep()
}
BlupiAddFifo(m_blupiPos);
}
- tinyPoint3.x = m_blupiPos.x + 30 + m_scrollAdd.x;
- tinyPoint3.y = m_blupiPos.y + 30 + m_scrollAdd.y;
- int num28 = Math.Abs(m_scrollPoint.x - tinyPoint3.x);
- int num29 = Math.Abs(m_scrollPoint.y - tinyPoint3.y);
+ adjustPos.x = m_blupiPos.x + 30 + m_scrollAdd.x;
+ adjustPos.y = m_blupiPos.y + 30 + m_scrollAdd.y;
+ int num28 = abs(m_scrollPoint.x - adjustPos.x);
+ int num29 = abs(m_scrollPoint.y - adjustPos.y);
num4 = SCROLL_SPEED;
if (num28 > SCROLL_MARGX * 2)
{
@@ -3912,36 +3869,36 @@ void CDecor::BlupiStep()
{
num4 += (num29 - SCROLL_MARGY * 2) / 4;
}
- if (m_scrollPoint.x < tinyPoint3.x)
+ if (m_scrollPoint.x < adjustPos.x)
{
m_scrollPoint.x = m_scrollPoint.x + num4;
- if (m_scrollPoint.x >= tinyPoint3.x)
+ if (m_scrollPoint.x >= adjustPos.x)
{
- m_scrollPoint.x = tinyPoint3.x;
+ m_scrollPoint.x = adjustPos.x;
}
}
- if (m_scrollPoint.x > tinyPoint3.x)
+ if (m_scrollPoint.x > adjustPos.x)
{
m_scrollPoint.x = m_scrollPoint.x - num4;
- if (m_scrollPoint.x <= tinyPoint3.x)
+ if (m_scrollPoint.x <= adjustPos.x)
{
- m_scrollPoint.x = tinyPoint3.x;
+ m_scrollPoint.x = adjustPos.x;
}
}
- if (m_scrollPoint.y < tinyPoint3.y)
+ if (m_scrollPoint.y < adjustPos.y)
{
m_scrollPoint.y = m_scrollPoint.y + num4;
- if (m_scrollPoint.y >= tinyPoint3.y)
+ if (m_scrollPoint.y >= adjustPos.y)
{
- m_scrollPoint.y = tinyPoint3.y;
+ m_scrollPoint.y = adjustPos.y;
}
}
- if (m_scrollPoint.y > tinyPoint3.y)
+ if (m_scrollPoint.y > adjustPos.y)
{
m_scrollPoint.y = m_scrollPoint.y - num4;
- if (m_scrollPoint.y <= tinyPoint3.y)
+ if (m_scrollPoint.y <= adjustPos.y)
{
- m_scrollPoint.y = tinyPoint3.y;
+ m_scrollPoint.y = adjustPos.y;
}
}
if (m_blupiAction != 75 && m_blupiAction != 76)
@@ -3950,14 +3907,14 @@ void CDecor::BlupiStep()
}
if (m_time % 4 == 0)
{
- PosSound(m_blupiPos);
+ //PosSound(m_blupiPos);
}
VoyageStep();
- m_blupiLastSpeedX = m_blupiSpeedX;
- m_blupiLastSpeedY = m_blupiSpeedY;
+
m_lastKeyPress = m_keyPress;
}
+
void CDecor::BlupiDead(int action1, int action2)
{
if (action2 == -1)
@@ -4004,7 +3961,7 @@ void CDecor::BlupiDead(int action1, int action2)
pos.y = m_blupiPos.y - m_posDecor.y;
pos2.x = m_blupiPos.x - m_posDecor.x;
pos2.y = m_blupiPos.y - m_posDecor.y - 300;
- VoyageInit(m_pPixmap->HotSpotToHud(pos), m_pPixmap->HotSpotToHud(pos2), 230, 10);
+ ////VoyageInit(m_pPixmap->HotSpotToHud(pos), m_pPixmap->HotSpotToHud(pos2), 230, 10);
PlaySound(SOUND_ANGEL, m_blupiPos);
}
if (m_blupiAction == ACTION_CLEAR3)
@@ -4013,7 +3970,7 @@ void CDecor::BlupiDead(int action1, int action2)
pos.y = m_blupiPos.y - m_posDecor.y;
pos2.x = m_blupiPos.x - m_posDecor.x;
pos2.y = m_blupiPos.y - m_posDecor.y - 2000;
- VoyageInit(m_pPixmap->HotSpotToHud(pos), m_pPixmap->HotSpotToHud(pos2), 40, 10);
+ ////VoyageInit(m_pPixmap->HotSpotToHud(pos), m_pPixmap->HotSpotToHud(pos2), 40, 10);
PlaySound(SOUND_ANGEL, m_blupiPos);
}
if (m_blupiAction == ACTION_CLEAR4)
@@ -4131,7 +4088,7 @@ BOOL CDecor::DecorDetect(RECT rect, BOOL bCaisse)
int num7 = i / 4;
if (num6 >= 0 && num6 < 100 && num7 >= 0 && num7 < 100)
{
- int icon = m_decor[num6, num7]->icon;
+ int icon = m_decor[num6][num7].icon;
if (icon >= 0 && icon < MAXQUART && (!m_blupiHelico || icon != 214) && (m_blupiOver || icon != 214) && (icon != 324 || m_time / 4 % 20 < 18))
{
num6 = j % 4;
@@ -4143,7 +4100,7 @@ BOOL CDecor::DecorDetect(RECT rect, BOOL bCaisse)
src.top = i * 16;
src.bottom = src.top + 16;
RECT tinyRect;
- if (IntersectRect(tinyRect, src, rect))
+ if (IntersectRect(&tinyRect, &src, &rect))
{
m_detectIcon = icon;
return TRUE;
@@ -4161,59 +4118,60 @@ BOOL CDecor::DecorDetect(RECT rect, BOOL bCaisse)
for (int k = 0; k < m_nbRankCaisse; k++)
{
int num8 = m_rankCaisse[k];
- src.left = m_moveObject[num8]->posCurrent.x;
- src.right = m_moveObject[num8]->posCurrent.x + 64;
- src.top = m_moveObject[num8]->posCurrent.y;
- src.bottom = m_moveObject[num8]->posCurrent.y + 64;
+ src.left = m_moveObject[num8].posCurrent.x;
+ src.right = m_moveObject[num8].posCurrent.x + 64;
+ src.top = m_moveObject[num8].posCurrent.y;
+ src.bottom = m_moveObject[num8].posCurrent.y + 64;
RECT tinyRect;
- if (IntersectRect(tinyRect, src, rect))
+ if (IntersectRect(&tinyRect, &src, &rect))
{
- m_detectIcon = m_moveObject[num8]->icon;
+ m_detectIcon = m_moveObject[num8].icon;
return TRUE;
}
}
return FALSE;
}
-BOOL CDecor::TestPath(RECT rect, POINT start, POINT end)
+
+BOOL CDecor::TestPath(RECT rect, POINT start, POINT *end)
{
- int num = abs(end.x - start.x);
- int num2 = abs(end.y - start.y);
+ int num = abs(end->x - start.x);
+ int num2 = abs(end->y - start.y);
POINT tinyPoint = start;
if (num > num2)
{
RECT rect2;
- if (end.x > start.x)
+ if (end->x > start.x)
{
for (int i = 0; i <= num; i++)
{
- int j = i * (end.y - start.y) / num;
+ int j = i * (end->y - start.y) / num;
rect2.left = rect.left + i;
rect2.right = rect.right + i;
rect2.top = rect.top + j;
rect2.bottom = rect.bottom + j;
if (DecorDetect(rect2))
{
- end = tinyPoint;
+ *end = tinyPoint;
return FALSE;
}
tinyPoint.x = start.x + i;
tinyPoint.y = start.y + j;
}
}
- if (end.x < start.x)
+ if (end->x < start.x)
{
for (int i = 0; i >= -num; i--)
{
- int j = i * (start.y - end.y) / num;
+ int j = i * (start.y - end->y) / num;
rect2.left = rect.left + i;
rect2.right = rect.right + i;
rect2.top = rect.top + j;
rect2.bottom = rect.bottom + j;
if (DecorDetect(rect2))
{
- end = tinyPoint;
+ *end = tinyPoint;
return FALSE;
}
tinyPoint.x = start.x + i;
@@ -4224,36 +4182,36 @@ BOOL CDecor::TestPath(RECT rect, POINT start, POINT end)
else
{
RECT rect2;
- if (end.y > start.y)
+ if (end->y > start.y)
{
for (int j = 0; j <= num2; j++)
{
- int i = j * (end.x - start.x) / num2;
+ int i = j * (end->x - start.x) / num2;
rect2.left = rect.left + i;
rect2.right = rect.right + i;
rect2.top = rect.top + j;
rect2.bottom = rect.bottom + j;
if (DecorDetect(rect2))
{
- end = tinyPoint;
+ *end = tinyPoint;
return FALSE;
}
tinyPoint.x = start.x + i;
tinyPoint.y = start.y + j;
}
}
- if (end.y < start.y)
+ if (end->y < start.y)
{
for (int j = 0; j >= -num2; j--)
{
- int i = j * (start.x - end.x) / num2;
+ int i = j * (start.x - end->x) / num2;
rect2.left = rect.left + i;
rect2.right = rect.right + i;
rect2.top = rect.top + j;
rect2.bottom = rect.bottom + j;
if (DecorDetect(rect2))
{
- end = tinyPoint;
+ *end = tinyPoint;
return FALSE;
}
tinyPoint.x = start.x + i;
diff --git a/src/decdesign.cpp b/src/decdesign.cpp
new file mode 100644
index 0000000..a524756
--- /dev/null
+++ b/src/decdesign.cpp
@@ -0,0 +1,659 @@
+// DecDesign.cpp
+//
+
+#include "def.h"
+#include "decor.h"
+#include "misc.h"
+#include "dectables.h"
+
+POINT CDecor::ScreenPosToCelPos(POINT pos)
+{
+ if (pos.x >= 0 && pos.x < LXIMAGE && pos.y >= 0 && pos.y < LYIMAGE) {
+ return {
+ (m_posDecor.x + m_dimCelHili.x * -32 + 32 + pos.x) / 64,
+ (m_posDecor.y + m_dimCelHili.y * -32 + 32 + pos.y) / 64
+ };
+ }
+ else return { -1, -1 };
+}
+
+void CDecor::SetCelPosFromScreenPos(POINT pos)
+{
+ m_posCelHili = ScreenPosToCelPos(pos);
+}
+
+void CDecor::SetFieldCC38AndStuff(int _foo, int _bar)
+{
+ m_dimCelHili = { 1, 1 };
+ if (_foo == 2 && _bar != 3 && _bar != 9 && _bar != 10) m_dimCelHili = { 2, 2 };
+ if (_foo == 3) m_iconLift = _bar;
+ if (_foo == 4) m_iconLift = _bar + 20;
+ if (_foo == 5) m_iconLift = _bar + 40;
+ m_2ndPositionCalculationSlot = -1;
+}
+
+void CDecor::DeleteCel(POINT cel)
+{
+ m_2ndPositionCalculationSlot = -1;
+
+ if (!IsValidCel(cel)) return;
+
+ m_decor[cel.x][cel.y].icon = -1;
+ AdaptBorder(cel);
+ m_bigDecor[cel.x][cel.y].icon = -1;
+ MoveObjectDelete(cel);
+}
+
+void CDecor::PlaceMenuItem(short *pCel, int *pTable, int lastIndex, BYTE flags, int currentIcon, BOOL bRand)
+{
+ if (bRand) {
+ *pCel = pTable[rand() % (pTable[0] + 1)];
+ }
+ else if (!(flags & 8)) {
+ if (flags & 1) {
+ lastIndex++;
+ if (*pCel == pTable[lastIndex] && currentIcon != 0 && pTable[0] <= lastIndex) {
+ lastIndex = 0;
+ }
+ *pCel = pTable[lastIndex + 1];
+ }
+ }
+ else {
+ *pCel = pTable[lastIndex + 1];
+ }
+}
+
+void CDecor::PlaceItemFromMenu1(POINT cel, int index, BYTE flags, int currentIcon)
+{
+ m_2ndPositionCalculationSlot = -1;
+
+ short *pIcon = &m_decor[cel.x][cel.y].icon;
+ short *pIconBig = &m_bigDecor[cel.x][cel.y].icon;
+
+ if (!IsValidCel(cel)) return;
+
+ switch (index) {
+ case 0: // Tree
+ PlaceMenuItem(pIconBig, table_366b0, m_lastDecorIndexes[0], flags, *pIconBig, TRUE);
+ break;
+ case 1: // Palmtree
+ PlaceMenuItem(pIconBig, table_366c0, m_lastDecorIndexes[1], flags, *pIconBig, TRUE);
+ break;
+ case 2: // Decorative plant
+ PlaceMenuItem(pIconBig, table_366d8, m_lastDecorIndexes[2], flags, *pIconBig, TRUE);
+ break;
+ case 3: // Marine plant
+ *pIcon = Object::Marine_1;
+ break;
+ case 4: // House
+ PlaceMenuItem(pIconBig, table_366e8, m_lastDecorIndexes[3], flags, *pIconBig, TRUE);
+ break;
+ case 5: // Mechanical background
+ PlaceMenuItem(pIconBig, table_366f8, m_lastDecorIndexes[4], flags, *pIconBig, TRUE);
+ break;
+ case 6: // Kid's stuff background
+ PlaceMenuItem(pIconBig, table_36710, m_lastDecorIndexes[5], flags, *pIconBig, TRUE);
+ break;
+ case 7: // Green slime 2
+ PlaceMenuItem(pIconBig, table_36748, m_lastDecorIndexes[6], flags, *pIconBig, TRUE);
+ break;
+ case 8: // Element for Palace
+ PlaceMenuItem(pIconBig, table_36520, m_lastDecorIndexes[7], flags, *pIconBig, TRUE);
+ break;
+ case 9: // Support
+ PlaceMenuItem(pIcon, table_36670, m_lastDecorIndexes[8], flags, *pIcon, TRUE);
+ break;
+ case 10: // Spider's web
+ PlaceMenuItem(pIcon, table_366a0, m_lastDecorIndexes[9], flags, *pIcon, TRUE);
+ break;
+ }
+}
+
+void CDecor::PlaceItemFromMenu2(POINT cel, int index, BYTE flags, int currentIcon)
+{
+ m_2ndPositionCalculationSlot = -1;
+
+ short *pIcon = &m_decor[cel.x][cel.y].icon;
+
+ if (!IsValidCel(cel)) return;
+
+ m_iconLift = index;
+
+ switch (index) {
+ case 0: // Square tech-blocks
+ PlaceMenuItem(pIcon, table_36418, m_lastDecorIndexes[10], flags, *pIcon, TRUE);
+ break;
+ case 1: // Special tech-blocks
+ PlaceMenuItem(pIcon, table_36458, m_lastDecorIndexes[11], flags, *pIcon, TRUE);
+ break;
+ case 2: // Triangular tech-blocks
+ PlaceMenuItem(pIcon, table_36488, m_lastDecorIndexes[12], flags, *pIcon, FALSE);
+ break;
+ case 3: // Secret tech-block
+ PlaceMenuItem(pIcon, table_364a0, m_lastDecorIndexes[13], flags, *pIcon, FALSE);
+ break;
+ case 4: // Mechanical square
+ PlaceMenuItem(pIcon, table_364b0, m_lastDecorIndexes[14], flags, *pIcon, TRUE);
+ break;
+ case 5: // Special mechanical
+ PlaceMenuItem(pIcon, table_364d0, m_lastDecorIndexes[15], flags, *pIcon, FALSE);
+ break;
+ case 6: // Secret mechanical
+ PlaceMenuItem(pIcon, table_364e8, m_lastDecorIndexes[16], flags, *pIcon, FALSE);
+ break;
+ case 7: // Pipes
+ *pIcon = Object::Pipes_1;
+ break;
+ }
+ AdaptBorder(cel);
+}
+
+void CDecor::PlaceItemFromMenu3(POINT cel, int index, BYTE flags, int currentIcon)
+{
+ m_2ndPositionCalculationSlot = -1;
+
+ short *pIcon = &m_decor[cel.x][cel.y].icon;
+
+ if (!IsValidCel(cel)) return;
+
+ m_iconLift = index + 20;
+
+ switch (index) {
+ case 0: // Square rock
+ PlaceMenuItem(pIcon, table_36530, m_lastDecorIndexes[20], flags, *pIcon, FALSE);
+ break;
+ case 1: // Triangular rock
+ PlaceMenuItem(pIcon, table_36538, m_lastDecorIndexes[21], flags, *pIcon, FALSE);
+ break;
+ case 2: // Secret rock
+ PlaceMenuItem(pIcon, table_36548, m_lastDecorIndexes[22], flags, *pIcon, FALSE);
+ break;
+ case 3: // Cave
+ // todo
+ break;
+ case 4: // Secret cave
+ *pIcon = Object::CaveSecret;
+ break;
+ case 5: // Cheese
+ *pIcon = Random(Object::CheeseSquare_1, Object::CheeseSquare_4);
+ break;
+ case 6: // Secret cheese
+ *pIcon = Object::CheeseSecret;
+ break;
+ case 7: // Green slime 2
+ *pIcon = Object::Slime_1;
+ break;
+ case 8: // Grass
+ PlaceMenuItem(pIcon, table_365d0, m_lastDecorIndexes[23], flags, *pIcon, FALSE);
+ break;
+ case 9: // Water
+ PlaceMenuItem(pIcon, table_36630, m_lastDecorIndexes[24], flags, *pIcon, FALSE);
+ break;
+ }
+ AdaptBorder(cel);
+}
+
+void CDecor::PlaceItemFromMenu4(POINT cel, int index, BYTE flags, int currentIcon)
+{
+ m_2ndPositionCalculationSlot = -1;
+
+ short *pIcon = &m_decor[cel.x][cel.y].icon;
+
+ if (!IsValidCel(cel)) return;
+
+ m_iconLift = index + 40;
+
+ switch (index) {
+ case 0: // Palace
+ break;
+ case 1: // Element for Palace
+ break;
+ case 2: // Building facade
+ break;
+ case 3: // Roof
+ break;
+ case 4: // Bricks
+ break;
+ case 5: // Furniture
+ break;
+ case 6: // Wooden wall
+ break;
+ case 7: // Kid's stuff square
+ break;
+ case 8: // Special Kid's stuff
+ break;
+ case 9: // Invisible block
+ break;
+ }
+ AdaptBorder(cel);
+}
+
+void CDecor::PlaceItemFromMenu5(POINT cel, int index, BYTE flags, int currentIcon)
+{
+ m_2ndPositionCalculationSlot = -1;
+
+ int mobId;
+ MoveObject* pMob;
+
+ short *pIcon = &m_decor[cel.x][cel.y].icon;
+
+ if (!IsValidCel(cel)) return;
+
+ switch (index) {
+ case 0: // Bomb
+ MoveObjectDelete(cel);
+ mobId = MoveObjectFree();
+ if (mobId == -1) return;
+ pMob = &m_moveObject[mobId];
+ pMob->type = TYPE_BOMBEDOWN;
+ pMob->stepAdvance = 1;
+ pMob->stepRecede = 1;
+ pMob->timeStopStart = 0;
+ pMob->timeStopEnd = 0;
+ pMob->posStart = { cel.x * DIMOBJX + 2, cel.y * DIMOBJY + 4 };
+ pMob->posEnd = pMob->posStart;
+ pMob->posCurrent = pMob->posStart;
+ pMob->step = STEP_STOPSTART;
+ pMob->time = 0;
+ pMob->phase = 0;
+ pMob->channel = CHELEMENT;
+ pMob->icon = 0x0c;
+ break;
+ case 1: // Hanging bomb
+ MoveObjectDelete(cel);
+ mobId = MoveObjectFree();
+ if (mobId == -1) return;
+ pMob = &m_moveObject[mobId];
+ pMob->type = TYPE_BOMBEUP;
+ pMob->stepAdvance = 1;
+ pMob->stepRecede = 1;
+ pMob->timeStopStart = 0;
+ pMob->timeStopEnd = 0;
+ pMob->posStart = { cel.x * DIMOBJX + 2, cel.y * DIMOBJY };
+ pMob->posEnd = pMob->posStart;
+ pMob->posCurrent = pMob->posStart;
+ pMob->step = STEP_STOPSTART;
+ pMob->time = 0;
+ pMob->phase = 0;
+ pMob->channel = CHELEMENT;
+ pMob->icon = 0x30;
+ break;
+ case 2: // Homing bomb
+ MoveObjectDelete(cel);
+ mobId = MoveObjectFree();
+ if (mobId == -1) return;
+ pMob = &m_moveObject[mobId];
+ pMob->type = TYPE_BOMBEFOLLOW1;
+ pMob->stepAdvance = 1;
+ pMob->stepRecede = 1;
+ pMob->timeStopStart = 0;
+ pMob->timeStopEnd = 0;
+ pMob->posStart = { cel.x * DIMOBJX, cel.y * DIMOBJY };
+ pMob->posEnd = pMob->posStart;
+ pMob->posCurrent = pMob->posStart;
+ pMob->step = STEP_STOPSTART;
+ pMob->time = 0;
+ pMob->phase = 0;
+ pMob->channel = CHELEMENT;
+ pMob->icon = 0x100;
+ break;
+ case 3: // Lava
+ PlaceMenuItem(pIcon, table_decor_lave, m_lastDecorIndexes[40], flags, *pIcon, FALSE);
+ break;
+ case 4: // Fan
+ PlaceMenuItem(pIcon, table_decor_ventillog, m_lastDecorIndexes[41], flags, *pIcon, FALSE);
+ break;
+ case 5: // Wind
+ PlaceMenuItem(pIcon, table_decor_ventg, m_lastDecorIndexes[42], flags, *pIcon, FALSE);
+ break;
+ case 6: // Slime trap (floor)
+ *pIcon = Object::SlimeTrapFloor_1;
+ break;
+ case 7: // Slime trap (ceiling)
+ *pIcon = Object::SlimeTrapCeiling_1;
+ break;
+ case 8: // Circular saw
+ PlaceMenuItem(pIcon, table_decor_scie, m_lastDecorIndexes[43], flags, *pIcon, FALSE);
+ break;
+ case 9: // Inverter
+ MoveObjectDelete(cel);
+ mobId = MoveObjectFree();
+ if (mobId == -1) return;
+ pMob = &m_moveObject[mobId];
+ pMob->type = TYPE_INVERT;
+ pMob->stepAdvance = 1;
+ pMob->stepRecede = 1;
+ pMob->timeStopStart = 0;
+ pMob->timeStopEnd = 0;
+ pMob->posStart = { cel.x * DIMOBJX + 2, cel.y * DIMOBJY + 8 };
+ pMob->posEnd = pMob->posStart;
+ pMob->posCurrent = pMob->posStart;
+ pMob->step = STEP_STOPSTART;
+ pMob->time = 0;
+ pMob->phase = 0;
+ pMob->channel = CHELEMENT;
+ pMob->icon = 0xBB;
+ break;
+ case 10: // Lightning
+ *pIcon = Object::LightningMachine;
+ break;
+ case 11: // Crusher
+ *pIcon = Object::Crusher_1;
+ break;
+ }
+ AdaptBorder(cel);
+}
+
+void CDecor::PlaceItemFromMenu6(POINT cel, int index, BYTE flags, int currentIcon)
+{
+ m_2ndPositionCalculationSlot = -1;
+
+ short *pIcon = &m_decor[cel.x][cel.y].icon;
+
+ if (!IsValidCel(cel) || currentIcon == 0) return;
+
+ switch (m_iconLift) {
+
+ }
+
+ switch (index) {
+ case 0: // Slow lift
+ case 1: // Normal lift
+ case 2: // Fast lift
+ case 3: // Fast/Slow lift
+ case 4: // Lift with conveyor belt
+ case 5: // Bulldozer
+ case 6: // Fish
+ case 7: // Bird
+ case 8: // Wasp
+ case 9: // Slime creature
+ case 10: // Moving bomb
+ case 11: // Heliported ennemy
+ case 12: // Motorized ennemy
+ break;
+ }
+}
+
+void CDecor::PlaceItemFromMenu7(POINT cel, int index, BYTE flags, int currentIcon)
+{
+ m_2ndPositionCalculationSlot = -1;
+
+ MoveObject* pMob;
+ int mobId;
+
+ short *pIcon = &m_decor[cel.x][cel.y].icon;
+
+ if (!IsValidCel(cel)) return;
+
+ switch (index) {
+ case 0: // Chest
+ MoveObjectDelete(cel);
+ mobId = MoveObjectFree();
+ if (mobId == -1) return;
+ pMob = &m_moveObject[mobId];
+ pMob->type = TYPE_TRESOR;
+ pMob->stepAdvance = 1;
+ pMob->stepRecede = 1;
+ pMob->timeStopStart = 0;
+ pMob->timeStopEnd = 0;
+ pMob->posStart = { cel.x * DIMOBJX + 2, cel.y * DIMOBJY + 4 };
+ pMob->posEnd = pMob->posStart;
+ pMob->posCurrent = pMob->posStart;
+ pMob->step = STEP_STOPSTART;
+ pMob->time = 0;
+ pMob->phase = 0;
+ pMob->channel = CHELEMENT;
+ pMob->icon = 0x00;
+ break;
+ case 1: // Egg
+ MoveObjectDelete(cel);
+ mobId = MoveObjectFree();
+ if (mobId == -1) return;
+ pMob = &m_moveObject[mobId];
+ pMob->type = TYPE_EGG;
+ pMob->stepAdvance = 1;
+ pMob->stepRecede = 1;
+ pMob->timeStopStart = 0;
+ pMob->timeStopEnd = 0;
+ pMob->posStart = { cel.x * DIMOBJX + 2, cel.y * DIMOBJY + 8 };
+ pMob->posEnd = pMob->posStart;
+ pMob->posCurrent = pMob->posStart;
+ pMob->step = STEP_STOPSTART;
+ pMob->time = 0;
+ pMob->phase = 0;
+ pMob->channel = CHELEMENT;
+ pMob->icon = 0x15;
+ break;
+ case 2: // Lollipop
+ MoveObjectDelete(cel);
+ mobId = MoveObjectFree();
+ if (mobId == -1) return;
+ pMob = &m_moveObject[mobId];
+ pMob->type = TYPE_POWER;
+ pMob->stepAdvance = 1;
+ pMob->stepRecede = 1;
+ pMob->timeStopStart = 0;
+ pMob->timeStopEnd = 0;
+ pMob->posStart = { cel.x * DIMOBJX + 2, cel.y * DIMOBJY + 8 };
+ pMob->posEnd = pMob->posStart;
+ pMob->posCurrent = pMob->posStart;
+ pMob->step = STEP_STOPSTART;
+ pMob->time = 0;
+ pMob->phase = 0;
+ pMob->channel = CHELEMENT;
+ pMob->icon = 0x88;
+ break;
+ case 3: // Shield
+ MoveObjectDelete(cel);
+ mobId = MoveObjectFree();
+ if (mobId == -1) return;
+ pMob = &m_moveObject[mobId];
+ pMob->type = TYPE_SHIELD;
+ pMob->stepAdvance = 1;
+ pMob->stepRecede = 1;
+ pMob->timeStopStart = 0;
+ pMob->timeStopEnd = 0;
+ pMob->posStart = { cel.x * DIMOBJX + 2, cel.y * DIMOBJY + 8 };
+ pMob->posEnd = pMob->posStart;
+ pMob->posCurrent = pMob->posStart;
+ pMob->step = STEP_STOPSTART;
+ pMob->time = 0;
+ pMob->phase = 0;
+ pMob->channel = CHELEMENT;
+ pMob->icon = 0x90;
+ break;
+ case 4: // Invisibility potion
+ MoveObjectDelete(cel);
+ mobId = MoveObjectFree();
+ if (mobId == -1) return;
+ pMob = &m_moveObject[mobId];
+ pMob->type = TYPE_DRINK;
+ pMob->stepAdvance = 1;
+ pMob->stepRecede = 1;
+ pMob->timeStopStart = 0;
+ pMob->timeStopEnd = 0;
+ pMob->posStart = { cel.x * DIMOBJX + 2, cel.y * DIMOBJY + 6 };
+ pMob->posEnd = pMob->posStart;
+ pMob->posCurrent = pMob->posStart;
+ pMob->step = STEP_STOPSTART;
+ pMob->time = 0;
+ pMob->phase = 0;
+ pMob->channel = CHELEMENT;
+ pMob->icon = 0xB2;
+ break;
+ case 5: // Glue supply
+ MoveObjectDelete(cel);
+ mobId = MoveObjectFree();
+ if (mobId == -1) return;
+ pMob = &m_moveObject[mobId];
+ pMob->type = TYPE_BULLET;
+ pMob->stepAdvance = 1;
+ pMob->stepRecede = 1;
+ pMob->timeStopStart = 0;
+ pMob->timeStopEnd = 0;
+ pMob->posStart = { cel.x * DIMOBJX + 2, cel.y * DIMOBJY + 4 };
+ pMob->posEnd = pMob->posStart;
+ pMob->posCurrent = pMob->posStart;
+ pMob->step = STEP_STOPSTART;
+ pMob->time = 0;
+ pMob->phase = 0;
+ pMob->channel = CHELEMENT;
+ pMob->icon = 0xB1;
+ break;
+ case 6: // Recharging device
+ MoveObjectDelete(cel);
+ mobId = MoveObjectFree();
+ if (mobId == -1) return;
+ pMob = &m_moveObject[mobId];
+ pMob->type = TYPE_CHARGE;
+ pMob->stepAdvance = 1;
+ pMob->stepRecede = 1;
+ pMob->timeStopStart = 0;
+ pMob->timeStopEnd = 0;
+ pMob->posStart = { cel.x * DIMOBJX + 2, cel.y * DIMOBJY + 4 };
+ pMob->posEnd = pMob->posStart;
+ pMob->posCurrent = pMob->posStart;
+ pMob->step = STEP_STOPSTART;
+ pMob->time = 0;
+ pMob->phase = 0;
+ pMob->channel = CHELEMENT;
+ pMob->icon = 0xEE;
+ break;
+ case 7: // Personal bomb
+ int type;
+ mobId = MoveObjectSearch(cel, -1);
+ if (mobId != -1 && currentIcon != 0) {
+ if (mobId >= TYPE_BOMBEPERSO4) {
+ m_lastDecorIndexes[60] = 0;
+ }
+ else {
+ m_lastDecorIndexes[60] = m_moveObject[mobId].type - TYPE_BOMBEPERSO1;
+ }
+ }
+ type = m_lastDecorIndexes[60] + TYPE_BOMBEPERSO1;
+ MoveObjectDelete(cel);
+ mobId = MoveObjectFree();
+ if (mobId == -1) return;
+ pMob = &m_moveObject[mobId];
+ pMob->type = type;
+ pMob->stepAdvance = 1;
+ pMob->stepRecede = 1;
+ pMob->timeStopStart = 0;
+ pMob->timeStopEnd = 0;
+ pMob->posStart = { cel.x * DIMOBJX + 2, cel.y * DIMOBJY + 6 };
+ pMob->posEnd = pMob->posStart;
+ pMob->posCurrent = pMob->posStart;
+ pMob->step = STEP_STOPSTART;
+ pMob->time = 0;
+ pMob->phase = 0;
+ switch (type) {
+ default:
+ case TYPE_BOMBEPERSO1:
+ pMob->channel = CHBLUPI;
+ break;
+ case TYPE_BOMBEPERSO2:
+ pMob->channel = CHBLUPI1;
+ break;
+ case TYPE_BOMBEPERSO3:
+ pMob->channel = CHBLUPI2;
+ break;
+ case TYPE_BOMBEPERSO4:
+ pMob->channel = CHBLUPI3;
+ break;
+ }
+ pMob->icon = 0x101;
+ break;
+ case 8: // Dynamite
+ MoveObjectDelete(cel);
+ mobId = MoveObjectFree();
+ if (mobId == -1) return;
+ pMob = &m_moveObject[mobId];
+ pMob->type = TYPE_DYNAMITE;
+ pMob->stepAdvance = 1;
+ pMob->stepRecede = 1;
+ pMob->timeStopStart = 0;
+ pMob->timeStopEnd = 0;
+ pMob->posStart = { cel.x * DIMOBJX + 2, cel.y * DIMOBJY + 6 };
+ pMob->posEnd = pMob->posStart;
+ pMob->posCurrent = pMob->posStart;
+ pMob->step = STEP_STOPSTART;
+ pMob->time = 0;
+ pMob->phase = 0;
+ pMob->channel = CHELEMENT;
+ pMob->icon = 0xFC;
+ break;
+ }
+ AdaptBorder(cel);
+}
+
+void CDecor::PlaceItemFromMenu8(POINT cel, int index, BYTE flags, int currentIcon)
+{
+ m_2ndPositionCalculationSlot = -1;
+
+ short *pIcon = &m_decor[cel.x][cel.y].icon;
+
+ if (!IsValidCel(cel)) return;
+
+ switch (index) {
+ case 0: // Key
+ case 1: // Door
+ case 2: // Closed while not all chests have been found
+ case 3: // Teleporter
+ case 4: // Bar to hang from
+ case 5: // Spring
+ case 6: // Vanishing bloc
+ case 7: // Fragile bridge
+ case 8: // Wooden case
+ case 9: // Secret wooden case
+ break;
+ }
+}
+
+void CDecor::PlaceItemFromMenu9(POINT cel, int index, BYTE flags, int currentIcon)
+{
+ m_2ndPositionCalculationSlot = -1;
+
+ short *pIcon = &m_decor[cel.x][cel.y].icon;
+
+ if (!IsValidCel(cel)) return;
+
+ switch (index) {
+ case 0: // Hovercraft
+ case 1: // Helicopter
+ case 2: // Skateboard
+ case 3: // Jeep
+ case 4: // Glue tank
+ break;
+ }
+}
+
+void CDecor::PlaceItemFromMenu10(POINT cel, int index, BYTE flags, int currentIcon)
+{
+ m_2ndPositionCalculationSlot = -1;
+
+ short *pIcon = &m_decor[cel.x][cel.y].icon;
+
+ if (!IsValidCel(cel)) return;
+
+ switch (index) {
+ case 0: // Goal
+ case 1: // Yellow Blupi
+ case 2: // Orange Blupi
+ case 3: // Blue Blupi
+ case 4: // Green Blupi
+ case 5: // Door
+ case 6: // Level start
+ case 7: // Key
+ break;
+ }
+}
+
+char* CDecor::GetMissionTitle()
+{
+ return m_missionTitle;
+}
+
+void CDecor::SetMissionTitle(char *str)
+{
+ strcpy(m_missionTitle, str);
+}
diff --git a/src/decio.cpp b/src/decio.cpp
new file mode 100644
index 0000000..1074613
--- /dev/null
+++ b/src/decio.cpp
@@ -0,0 +1,49 @@
+// DecIO.cpp
+//
+
+#include "def.h"
+#include "decor.h"
+#include "misc.h"
+
+void CDecor::GetMissionPath(char* str, int user, int mission, BOOL bUser)
+{
+ if (bUser != 0)
+ {
+ sprintf(str, "data\%.3d-%.3d.blp", user, mission);
+ AddUserPath(str);
+ return;
+ }
+ sprintf(str, "data\world%.3d.blp", mission);
+ AddUserPath(str);
+ return;
+}
+
+BOOL CDecor::Write(int gamer, int mission, BOOL bUser)
+{
+ return FALSE; //TODO
+}
+
+BOOL CDecor::Read(int gamer, int mission, BOOL bUser)
+{
+ return FALSE; //TODO
+}
+
+BOOL CDecor::SomethingMissionPath(int gamer, int mission, BOOL bUser)
+{
+ return FALSE; //TODO
+}
+
+BOOL CDecor::MissionStart(int gamer, int mission, BOOL bUser)
+{
+ return FALSE; //TODO
+}
+
+BOOL CDecor::CurrentRead(int gamer, int mission, BOOL *pbMission, BOOL *pbPrivate)
+{
+ return FALSE; //TODO
+}
+
+BOOL CDecor::CurrentWrite(int gamer, int mission, char* param3)
+{
+ return FALSE; //TODO
+}
diff --git a/src/decmove.cpp b/src/decmove.cpp
new file mode 100644
index 0000000..2ca01a3
--- /dev/null
+++ b/src/decmove.cpp
@@ -0,0 +1,2140 @@
+// DecMove.cpp
+//
+
+#include "def.h"
+#include "decor.h"
+#include "misc.h"
+#include "dectables.h"
+
+
+
+
+
+void CDecor::MoveObjectPollution()
+{
+}
+
+void CDecor::MoveObjectPlouf(POINT pos)
+{
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type == 14)
+ {
+ return;
+ }
+ }
+ pos.y -= 45;
+ PlaySound(23, pos);
+ ObjectStart(pos, 14, 0);
+}
+
+void CDecor::MoveObjectTiplouf(POINT pos)
+{
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type == 35)
+ {
+ return;
+ }
+ }
+ if (m_blupiDir == 2)
+ {
+ pos.x += 5;
+ }
+ else
+ {
+ pos.x -= 5;
+ }
+ pos.y -= 45;
+ PlaySound(64, pos);
+ ObjectStart(pos, 35, 0);
+}
+
+void CDecor::MoveObjectBlup(POINT pos)
+{
+ PlaySound(24, pos);
+ pos.y -= 20;
+ int num = 0;
+ POINT tinyPoint = pos;
+ while (tinyPoint.y > 0)
+ {
+ int icon = m_decor[(tinyPoint.x + 16) / DIMOBJX][tinyPoint.y / DIMOBJY].icon;
+ if (icon != 91 && icon != 92)
+ {
+ break;
+ }
+ num++;
+ tinyPoint.y -= DIMOBJY;
+ }
+ num--;
+ if (num <= 0)
+ {
+ return;
+ }
+ int num2 = MoveObjectFree();
+ if (num2 == -1)
+ {
+ return;
+ }
+ m_moveObject[num2].type = 15;
+ m_moveObject[num2].phase = 0;
+ m_moveObject[num2].posCurrent.x = pos.x;
+ m_moveObject[num2].posCurrent.y = pos.y;
+ m_moveObject[num2].posStart = m_moveObject[num2].posCurrent;
+ m_moveObject[num2].posEnd.x = pos.x;
+ m_moveObject[num2].posEnd.y = pos.y - num * DIMOBJY;
+ m_moveObject[num2].timeStopStart = 0;
+ m_moveObject[num2].stepAdvance = num * 10;
+ m_moveObject[num2].step = 2;
+ m_moveObject[num2].time = 0;
+ MoveObjectStepIcon(num2);
+}
+
+
+void CDecor::FlushBalleTraj()
+{
+ for (int i = 0; i < 1300; i++)
+ {
+ m_balleTraj[i] = 0;
+ }
+}
+
+void CDecor::SetBalleTraj(POINT pos)
+{
+ if (pos.x < 0 || pos.x >= 100 || pos.y < 0 || pos.y >= 100)
+ {
+ return;
+ }
+ int num = pos.y * 13;
+ num += pos.x / 8;
+ int num2 = pos.x & 7;
+ m_balleTraj[num] |= 1 << num2;
+}
+
+BOOL CDecor::IsBalleTraj(POINT pos)
+{
+ pos.x = (pos.x + DIMOBJX / 2) / DIMOBJX;
+ pos.y = (pos.y + DIMOBJY / 2) / DIMOBJY;
+ if (!IsValidCel(pos)) return FALSE;
+ int num = pos.y * 13;
+ num += pos.x / 8;
+ int num2 = pos.x & 7;
+ return (m_balleTraj[num] & 1 << num2) != 0;
+}
+
+void CDecor::FlushMoveTraj()
+{
+ for (int i = 0; i < 1300; i++)
+ {
+ m_moveTraj[i] = 0;
+ }
+}
+
+void CDecor::SetMoveTraj(POINT pos)
+{
+
+ if (pos.x < 0 || pos.x >= 100 || pos.y < 0 || pos.y >= 100)
+ {
+ return;
+ }
+ int num = pos.y * 13;
+ num += pos.x / 8;
+ int num2 = pos.x & 7;
+ m_moveTraj[num] |= 1 << num2;
+}
+
+BOOL CDecor::IsMoveTraj(POINT pos)
+{
+ pos.x = (pos.x + 32) / 64;
+ pos.y = (pos.y + 32) / 64;
+ if (pos.x < 0 || pos.x >= 100 || pos.y < 0 || pos.y >= 100)
+ {
+ return FALSE;
+ }
+ int num = pos.y * 13;
+ num += pos.x / 8;
+ int num2 = pos.x & 7;
+ return (m_moveTraj[num] & 1 << num2) != 0;
+}
+
+int CDecor::SearchDistRight(POINT pos, POINT dir, int type)
+{
+ int num = 0;
+ if (type == 36 || type == 39 || type == 41 || type == 42 || type == 93)
+ {
+ return 500;
+ }
+ pos.x = (pos.x + 32) / 64;
+ pos.y = (pos.y + 32) / 64;
+ while (pos.x >= 0 && pos.x < 100 && pos.y >= 0 && pos.y < 100 && !IsBlocIcon(m_decor[pos.x][pos.y].icon))
+ {
+ if (type == 23)
+ {
+ SetBalleTraj(pos);
+ }
+ num += 64;
+ pos.x += dir.x;
+ pos.y += dir.y;
+ }
+ if ((type == 34 || type == 38) && num >= 64)
+ {
+ num -= 64;
+ }
+ if (type == 23 && num >= 10)
+ {
+ num -= 10;
+ }
+ return num;
+}
+
+
+void CDecor::StartSploutchGlu(POINT pos)
+{
+ POINT pos2;
+ pos2.x = pos.x;
+ pos2.y = pos.y;
+ ObjectStart(pos2, 98, 0);
+ pos2.x = pos.x + 15;
+ pos2.y = pos.y + 20;
+ ObjectStart(pos2, 99, 0);
+ pos2.x = pos.x - 20;
+ pos2.y = pos.y + 18;
+ ObjectStart(pos2, 99, 0);
+ pos2.x = pos.x + 23;
+ pos2.y = pos.y - 18;
+ ObjectStart(pos2, 99, 0);
+ pos2.x = pos.x - 15;
+ pos2.y = pos.y - 18;
+ ObjectStart(pos2, 99, 0);
+ pos2.x = pos.x + 32;
+ pos2.y = pos.y + 10;
+ ObjectStart(pos2, 100, 0);
+ pos2.x = pos.x - 28;
+ pos2.y = pos.y + 15;
+ ObjectStart(pos2, 100, 0);
+ StopSound(16);
+ StopSound(18);
+ StopSound(29);
+ StopSound(31);
+ PlaySound(51, pos);
+}
+
+BOOL CDecor::ObjectStart(POINT pos, int type, int speed)
+{
+ return ObjectStart(pos, type, speed, FALSE);
+}
+
+BOOL CDecor::ObjectStart(POINT pos, int type, int speed, BOOL bMulti)
+{
+ int num = MoveObjectFree();
+ if (num == -1)
+ {
+ return FALSE;
+ }
+ m_moveObject[num].type = type;
+ m_moveObject[num].phase = 0;
+ m_moveObject[num].posCurrent = pos;
+ m_moveObject[num].posStart = pos;
+ m_moveObject[num].posEnd = pos;
+ MoveObjectStepIcon(num);
+ if (speed != 0)
+ {
+ POINT tinyPoint = pos;
+ int num2 = speed;
+ int num3 = 0;
+ if (num2 > 50)
+ {
+ num2 -= 50;
+ POINT dir;
+ dir.x = 0;
+ dir.y = 1;
+ num3 = SearchDistRight(tinyPoint, dir, type);
+ tinyPoint.y += num3;
+ }
+ else if (num < -50)
+ {
+ num2 += 50;
+ POINT dir;
+ dir.x = 0;
+ dir.y = -1;
+ num3 = SearchDistRight(tinyPoint, dir, type);
+ tinyPoint.y -= num3;
+ }
+ else if (num2 > 0)
+ {
+ POINT dir;
+ dir.x = 1;
+ dir.y = 0;
+ num3 = SearchDistRight(tinyPoint, dir, type);
+ tinyPoint.x += num3;
+ }
+ else if (num2 < 0)
+ {
+ POINT dir;
+ dir.x = -1;
+ dir.y = 0;
+ num3 = SearchDistRight(tinyPoint, dir, type);
+ tinyPoint.x -= num3;
+ }
+ if (num3 == 0)
+ {
+ if (type == TYPE_BALLE)
+ {
+ m_moveObject[num].type = 0;
+ return TRUE;
+ }
+ }
+ else
+ {
+ m_moveObject[num].posEnd = tinyPoint;
+ m_moveObject[num].timeStopStart = 0;
+ m_moveObject[num].stepAdvance = abs(num2 * num3 / 64);
+ m_moveObject[num].step = STEP_ADVANCE;
+ m_moveObject[num].time = 0;
+ }
+ }
+ MoveObjectPriority(num);
+ if (bMulti)
+ {
+ NetMessage msg;
+ msg.data1 = speed;
+ msg.type = MESS_OBJECTSTART;
+ msg.x = pos.x;
+ msg.y = pos.y;
+ msg.channel = type;
+ NetMessagePush(&msg);
+ }
+ return TRUE;
+}
+
+BOOL CDecor::ObjectDelete(POINT pos, int type)
+{
+ int num = MoveObjectSearch(pos, type);
+ if (num == -1)
+ {
+ return FALSE;
+ }
+ if (m_moveObject[num].type == 4 ||
+ m_moveObject[num].type == 12 ||
+ m_moveObject[num].type == 16 ||
+ m_moveObject[num].type == 17 ||
+ m_moveObject[num].type == 20 ||
+ m_moveObject[num].type == 40 ||
+ m_moveObject[num].type == 96 ||
+ m_moveObject[num].type == 97)
+ {
+ int num2 = 17;
+ double animationSpeed = 1.0;
+ if (m_moveObject[num].type == 4)
+ {
+ num2 = 7;
+ }
+ if (m_moveObject[num].type == 17 || m_moveObject[num].type == 20)
+ {
+ num2 = 33;
+ }
+ if (m_moveObject[num].type == 40)
+ {
+ animationSpeed = 0.5;
+ }
+
+ }
+ m_moveObject[num].type = 0;
+ return TRUE;
+}
+
+void CDecor::MoveObjectStep()
+{
+ m_blupiVector = { 0, 0 };
+ m_blupiTransport = -1;
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type != 0)
+ {
+ MoveObjectStepLine(i);
+ MoveObjectStepIcon(i);
+ if (m_moveObject[i].type == TYPE_BULLDOZER ||
+ m_moveObject[i].type == TYPE_BLUPITANK ||
+ m_moveObject[i].type == TYPE_BLUPIHELICO)
+ {
+ int num = MovePersoDetect(m_moveObject[i].posCurrent);
+ if (num != -1)
+ {
+ POINT posCurrent = m_moveObject[i].posCurrent;
+ posCurrent.x -= 34;
+ posCurrent.y -= 34;
+ ObjectStart(posCurrent, TYPE_EXPLO1, 0, TRUE);
+ PlaySound(10, m_moveObject[i].posCurrent);
+ m_decorAction = 1;
+ m_decorPhase = 0;
+ posCurrent = m_moveObject[i].posCurrent;
+ posCurrent.x += 2;
+ posCurrent.y += BLUPIOFFY;
+ ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type);
+ ObjectStart(posCurrent, 37, 0);
+ ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
+ }
+ if (BlupiElectro(m_moveObject[i].posCurrent))
+ {
+ POINT posCurrent = m_moveObject[i].posCurrent;
+ posCurrent.x += 2;
+ posCurrent.y += BLUPIOFFY;
+ ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type);
+ ObjectStart(posCurrent, 38, 55);
+ PlaySound(59, posCurrent);
+ }
+ }
+ }
+ }
+}
+
+void CDecor::MoveObjectStepLine(int i)
+{
+ MoveObject moveObject;
+ POINT tinyPoint;
+ BOOL flag = FALSE;
+ RECT tinyRect;
+ if (m_moveObject[i].type == 1 || m_moveObject[i].type == TYPE_ASCENSEURs || m_moveObject[i].type == TYPE_ASCENSEURsi && !m_blupiSuspend)
+ {
+ RECT src;
+ src.left = m_blupiPos.x + 20;
+ src.right = m_blupiPos.x + 60 - 20;
+ src.top = m_blupiPos.y + 60 - 2;
+ src.bottom = m_blupiPos.y + 60 - 1;
+ tinyRect.left = m_moveObject[i].posCurrent.x;
+ tinyRect.right = m_moveObject[i].posCurrent.x + 64;
+ tinyRect.top = m_moveObject[i].posCurrent.y;
+ tinyRect.bottom = m_moveObject[i].posCurrent.y + 16;
+ RECT tinyRect2;
+ flag = IntersectRect(&tinyRect2, &tinyRect, &src);
+ tinyPoint = m_moveObject[i].posCurrent;
+ }
+ POINT posCurrent;
+ if (m_blupiFocus && !m_blupiHide && m_moveObject[i].type == 97)
+ {
+ posCurrent = m_moveObject[i].posCurrent;
+ if (posCurrent.x < m_blupiPos.x)
+ {
+ posCurrent.x++;
+ }
+ if (posCurrent.x > m_blupiPos.x)
+ {
+ posCurrent.x--;
+ }
+ if (posCurrent.y < m_blupiPos.y)
+ {
+ posCurrent.y++;
+ }
+ if (posCurrent.y > m_blupiPos.y)
+ {
+ posCurrent.y--;
+ }
+ tinyRect.left = posCurrent.x + 10;
+ tinyRect.right = posCurrent.x + 60 - 10;
+ tinyRect.top = posCurrent.y + 10;
+ tinyRect.bottom = posCurrent.y + 60 - 10;
+ if (TestPath(tinyRect, m_moveObject[i].posCurrent, &posCurrent))
+ {
+ m_moveObject[i].posCurrent = posCurrent;
+ m_moveObject[i].posStart = posCurrent;
+ m_moveObject[i].posEnd = posCurrent;
+ }
+ else
+ {
+ ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type);
+ posCurrent.x -= 34;
+ posCurrent.y -= 34;
+ ObjectStart(posCurrent, 9, 0);
+ PlaySound(10, posCurrent);
+ m_decorAction = 1;
+ m_decorPhase = 0;
+ }
+ }
+ if (m_moveObject[i].posStart.x != m_moveObject[i].posEnd.x || m_moveObject[i].posStart.y != m_moveObject[i].posEnd.y)
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ if (m_moveObject[i].time < m_moveObject[i].timeStopStart)
+ {
+ m_moveObject[i].time = m_moveObject[i].time + 1;
+ }
+ else
+ {
+ m_moveObject[i].step = 2;
+ m_moveObject[i].time = 0;
+ }
+ }
+ else if (m_moveObject[i].step == 2)
+ {
+ if (m_moveObject[i].posCurrent.x != m_moveObject[i].posEnd.x || m_moveObject[i].posCurrent.x != m_moveObject[i].posEnd.y)
+ {
+ m_moveObject[i].time ++;
+ if (m_moveObject[i].stepAdvance != 0)
+ {
+ m_moveObject[i].posCurrent.x = (m_moveObject[i].posEnd.x - m_moveObject[i].posStart.x) * m_moveObject[i].time / m_moveObject[i].stepAdvance + m_moveObject[i].posStart.x;
+ m_moveObject[i].posCurrent.y = (m_moveObject[i].posEnd.y - m_moveObject[i].posStart.y) * m_moveObject[i].time / m_moveObject[i].stepAdvance + m_moveObject[i].posStart.y;
+ }
+
+ }
+ else if (m_moveObject[i].type == 15 || m_moveObject[i].type == 23)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else if (m_moveObject[i].type == 34)
+ {
+ m_moveObject[i].posStart = m_moveObject[i].posCurrent;
+ m_moveObject[i].posEnd = m_moveObject[i].posCurrent;
+ m_moveObject[i].step = 3;
+ m_moveObject[i].time = 0;
+ }
+ else
+ {
+ m_moveObject[i].step = 3;
+ m_moveObject[i].time = 0;
+ }
+ }
+ else if (m_moveObject[i].step == 3)
+ {
+ if (m_moveObject[i].time < m_moveObject[i].timeStopEnd)
+ {
+ m_moveObject[i].time ++;
+ }
+ else
+ {
+ m_moveObject[i].step = 4;
+ m_moveObject[i].time = 0;
+ }
+ }
+ else if (m_moveObject[i].step == 4)
+ {
+ if (m_moveObject[i].posCurrent.x != m_moveObject[i].posStart.x || m_moveObject[i].posCurrent.y != m_moveObject[i].posStart.y)
+ {
+ m_moveObject[i].time ++;
+ if (m_moveObject[i].stepRecede != 0)
+ {
+ m_moveObject[i].posCurrent.x = (m_moveObject[i].posStart.x - m_moveObject[i].posEnd.x) *
+ m_moveObject[i].time / m_moveObject[i].stepRecede + m_moveObject[i].posEnd.x;
+ m_moveObject[i].posCurrent.y = (m_moveObject[i].posStart.y - m_moveObject[i].posEnd.y) *
+ m_moveObject[i].time / m_moveObject[i].stepRecede + m_moveObject[i].posEnd.y;
+ }
+ }
+ else
+ {
+ m_moveObject[i].step = 1;
+ m_moveObject[i].time = 0;
+ }
+ }
+ }
+ if (m_moveObject[i].type == 22 && m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].type = 0;
+ }
+ posCurrent = m_moveObject[i].posCurrent;
+ if (m_moveObject[i].type == 1 || m_moveObject[i].type == TYPE_ASCENSEURs || m_moveObject[i].type == TYPE_ASCENSEURsi)
+ {
+ posCurrent.y -= 64;
+ }
+ posCurrent.x = (posCurrent.x + 32) / 64;
+ posCurrent.y = (posCurrent.y + 32) / 64;
+ SetMoveTraj(posCurrent);
+ if (flag)
+ {
+ m_blupiVector.x = m_moveObject[i].posCurrent.x - tinyPoint.x;
+ m_blupiVector.y = m_moveObject[i].posCurrent.y - (m_blupiPos.y + 60 - BLUPIFLOOR);
+ if (m_moveObject[i].type == TYPE_ASCENSEURs)
+ {
+ m_blupiVector.x = m_blupiVector.x + 2;
+ }
+ if (m_moveObject[i].type == TYPE_ASCENSEURsi)
+ {
+ m_blupiVector.x = m_blupiVector.x - 2;
+ }
+ if (m_blupiTimeNoAsc == 0)
+ {
+ m_blupiTransport = i;
+ }
+ }
+}
+
+void CDecor::MoveObjectStepIcon(int i)
+{
+ POINT pos;
+ if (m_moveObject[i].type == TYPE_ASCENSEURs)
+ {
+ m_moveObject[i].icon = table_chenille[m_moveObject[i].phase / 1 % 6];
+ }
+ if (m_moveObject[i].type == TYPE_ASCENSEURsi)
+ {
+ m_moveObject[i].icon = table_chenillei[m_moveObject[i].phase / 1 % 6];
+ }
+ if (m_moveObject[i].type == 2)
+ {
+ m_moveObject[i].icon = 12 + m_moveObject[i].phase / 2 % 9;
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 3)
+ {
+ m_moveObject[i].icon = 48 + m_moveObject[i].phase / 2 % 9;
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 16)
+ {
+ m_moveObject[i].icon = 69 + m_moveObject[i].phase / 1 % 9;
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 96)
+ {
+ m_moveObject[i].icon = table_follow1[m_moveObject[i].phase / 1 % 26];
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 97)
+ {
+ m_moveObject[i].icon = table_follow2[m_moveObject[i].phase / 1 % 5];
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 200)
+ {
+ m_moveObject[i].icon = 257 + m_moveObject[i].phase / 1 % 6;
+ m_moveObject[i].channel = 2;
+ }
+ if (m_moveObject[i].type == 201)
+ {
+ m_moveObject[i].icon = 257 + m_moveObject[i].phase / 1 % 6;
+ m_moveObject[i].channel = 11;
+ }
+ if (m_moveObject[i].type == 202)
+ {
+ m_moveObject[i].icon = 257 + m_moveObject[i].phase / 1 % 6;
+ m_moveObject[i].channel = 12;
+ }
+ if (m_moveObject[i].type == 203)
+ {
+ m_moveObject[i].icon = 257 + m_moveObject[i].phase / 1 % 6;
+ m_moveObject[i].channel = 13;
+ }
+ if (m_moveObject[i].type == 55)
+ {
+ m_moveObject[i].icon = 252;
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 56)
+ {
+ m_moveObject[i].icon = table_dynamitef[m_moveObject[i].phase / 1 % 100];
+ m_moveObject[i].channel = 10;
+ if (m_moveObject[i].phase == 50)
+ {
+ DynamiteStart(i, 0, 0);
+ }
+ if (m_moveObject[i].phase == 53)
+ {
+ DynamiteStart(i, -100, 8);
+ }
+ if (m_moveObject[i].phase == 55)
+ {
+ DynamiteStart(i, 80, 10);
+ }
+ if (m_moveObject[i].phase == 56)
+ {
+ DynamiteStart(i, -15, -100);
+ }
+ if (m_moveObject[i].phase == 59)
+ {
+ DynamiteStart(i, 20, 70);
+ }
+ if (m_moveObject[i].phase == 62)
+ {
+ DynamiteStart(i, 30, -50);
+ }
+ if (m_moveObject[i].phase == 64)
+ {
+ DynamiteStart(i, -40, 30);
+ }
+ if (m_moveObject[i].phase == 67)
+ {
+ DynamiteStart(i, -180, 10);
+ }
+ if (m_moveObject[i].phase == 69)
+ {
+ DynamiteStart(i, 200, -10);
+ }
+ if (m_moveObject[i].phase >= 70)
+ {
+ m_moveObject[i].type = 0;
+ }
+ }
+ if (m_moveObject[i].type == 5)
+ {
+ if (m_moveObject[i].phase / 3 % 22 < 11)
+ {
+ m_moveObject[i].icon = m_moveObject[i].phase / 3 % 11;
+ }
+ else
+ {
+ m_moveObject[i].icon = 11 - m_moveObject[i].phase / 3 % 11;
+ }
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 6)
+ {
+ m_moveObject[i].icon = 21 + m_moveObject[i].phase / 4 % 8;
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 7)
+ {
+ m_moveObject[i].icon = 29 + m_moveObject[i].phase / 3 % 8;
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == TYPE_CLE)
+ {
+ m_moveObject[i].icon = table_cle[m_moveObject[i].phase / 3 % 12];
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == TYPE_CLE1)
+ {
+ m_moveObject[i].icon = table_cle1[m_moveObject[i].phase / 3 % 12];
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == TYPE_CLE2)
+ {
+ m_moveObject[i].icon = table_cle2[m_moveObject[i].phase / 3 % 12];
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == TYPE_CLE3)
+ {
+ m_moveObject[i].icon = table_cle3[m_moveObject[i].phase / 3 % 12];
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == TYPE_SKATE)
+ {
+ m_moveObject[i].icon = table_skate[m_moveObject[i].phase / 1 % 34];
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 25)
+ {
+ m_moveObject[i].icon = table_shield[m_moveObject[i].phase / 2 % 16];
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 26)
+ {
+ m_moveObject[i].icon = table_power[m_moveObject[i].phase / 2 % 8];
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 40)
+ {
+ m_moveObject[i].icon = table_invert[m_moveObject[i].phase / 2 % 20];
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 31)
+ {
+ m_moveObject[i].icon = table_charge[m_moveObject[i].phase / 2 % 6];
+ m_moveObject[i].channel = 1;
+ }
+ if (m_moveObject[i].type == 27)
+ {
+ m_moveObject[i].icon = table_magictrack[m_moveObject[i].phase / 1 % 24];
+ m_moveObject[i].channel = 10;
+ if (m_moveObject[i].phase >= 24)
+ {
+ m_moveObject[i].type = 0;
+ }
+ }
+ if (m_moveObject[i].type == 57)
+ {
+ m_moveObject[i].icon = table_shieldtrack[m_moveObject[i].phase / 1 % 20];
+ m_moveObject[i].channel = 10;
+ if (m_moveObject[i].phase >= 20)
+ {
+ m_moveObject[i].type = 0;
+ }
+ }
+ if (m_moveObject[i].type == 39)
+ {
+ m_moveObject[i].icon = table_tresortrack[m_moveObject[i].phase / 1 % 11];
+ m_moveObject[i].channel = 10;
+ if (m_moveObject[i].phase >= 11)
+ {
+ m_moveObject[i].type = 0;
+ }
+ }
+ if (m_moveObject[i].type == 58 && m_moveObject[i].phase >= 20)
+ {
+ m_moveObject[i].type = 0;
+ }
+ if (m_moveObject[i].type == 8)
+ {
+ if (m_moveObject[i].phase >= table_explo1[0])
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_explo1[m_moveObject[i].phase];
+ m_moveObject[i].channel = 9;
+ }
+ }
+ if (m_moveObject[i].type == 9)
+ {
+ if (m_moveObject[i].phase >= 20)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_explo2[m_moveObject[i].phase % 20];
+ m_moveObject[i].channel = 9;
+ }
+ }
+ if (m_moveObject[i].type == 10)
+ {
+ if (m_moveObject[i].phase >= 20)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_explo3[m_moveObject[i].phase / 1 % 20];
+ m_moveObject[i].channel = 9;
+ }
+ }
+ if (m_moveObject[i].type == 11)
+ {
+ if (m_moveObject[i].phase >= 9)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_explo4[m_moveObject[i].phase / 1 % 9];
+ m_moveObject[i].channel = 9;
+ }
+ }
+ if (m_moveObject[i].type == 90)
+ {
+ if (m_moveObject[i].phase >= 12)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_explo5[m_moveObject[i].phase / 1 % 12];
+ m_moveObject[i].channel = 9;
+ }
+ }
+ if (m_moveObject[i].type == 91)
+ {
+ if (m_moveObject[i].phase >= 6)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_explo6[m_moveObject[i].phase / 1 % 6];
+ m_moveObject[i].channel = 9;
+ }
+ }
+ if (m_moveObject[i].type == 92)
+ {
+ if (m_moveObject[i].phase >= 128)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_explo7[m_moveObject[i].phase / 1 % 128];
+ m_moveObject[i].channel = 9;
+ }
+ }
+ if (m_moveObject[i].type == 93)
+ {
+ if (m_moveObject[i].phase >= 5)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_explo8[m_moveObject[i].phase / 1 % 5];
+ m_moveObject[i].channel = 9;
+ }
+ }
+ if (m_moveObject[i].type == 98)
+ {
+ if (m_moveObject[i].phase >= 10)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_sploutch1[m_moveObject[i].phase / 1 % 10];
+ m_moveObject[i].channel = 9;
+ }
+ }
+ if (m_moveObject[i].type == 99)
+ {
+ if (m_moveObject[i].phase >= 13)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_sploutch2[m_moveObject[i].phase / 1 % 13];
+ m_moveObject[i].channel = 9;
+ }
+ }
+ if (m_moveObject[i].type == 100)
+ {
+ if (m_moveObject[i].phase >= 18)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_sploutch3[m_moveObject[i].phase / 1 % 18];
+ m_moveObject[i].channel = 9;
+ }
+ }
+ if (m_moveObject[i].type == 53)
+ {
+ if (m_moveObject[i].phase >= 90)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_tentacule[m_moveObject[i].phase / 2 % 45];
+ m_moveObject[i].channel = 9;
+ }
+ }
+ if (m_moveObject[i].type == 52)
+ {
+ if (m_moveObject[i].phase == 0)
+ {
+ PlaySound(72, m_moveObject[i].posStart);
+ }
+ if (m_moveObject[i].phase == 137)
+ {
+ PlaySound(73, m_moveObject[i].posStart);
+ }
+ if (m_moveObject[i].phase >= 157)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_bridge[m_moveObject[i].phase / 1 % 157];
+ m_moveObject[i].channel = 1;
+ pos.x = m_moveObject[i].posStart.x / 64;
+ pos.y = m_moveObject[i].posStart.y / 64;
+ m_decor[pos.x][pos.y].icon = m_moveObject[i].icon;
+ }
+ }
+ if (m_moveObject[i].type == 36)
+ {
+ if (m_moveObject[i].phase >= 16)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_pollution[m_moveObject[i].phase / 2 % 8];
+ m_moveObject[i].channel = 10;
+ }
+ }
+ if (m_moveObject[i].type == 41)
+ {
+ if (m_moveObject[i].phase >= 16)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_invertstart[m_moveObject[i].phase / 2 % 8];
+ m_moveObject[i].channel = 10;
+ }
+ }
+ if (m_moveObject[i].type == 42)
+ {
+ if (m_moveObject[i].phase >= 16)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_invertstop[m_moveObject[i].phase / 2 % 8];
+ m_moveObject[i].channel = 10;
+ }
+ }
+ if (m_moveObject[i].type == 14)
+ {
+ if (m_moveObject[i].phase >= 14)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_plouf[m_moveObject[i].phase / 2 % 7];
+ m_moveObject[i].channel = 1;
+ }
+ }
+ if (m_moveObject[i].type == 35)
+ {
+ if (m_moveObject[i].phase >= 6)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_tiplouf[m_moveObject[i].phase / 2 % 7];
+ m_moveObject[i].channel = 1;
+ }
+ }
+ if (m_moveObject[i].type == 15)
+ {
+ m_moveObject[i].icon = table_blup[m_moveObject[i].phase / 2 % 20];
+ m_moveObject[i].channel = 1;
+ }
+ if (m_moveObject[i].type == 4)
+ {
+ if (m_moveObject[i].posStart.x > m_moveObject[i].posEnd.x)
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ m_moveObject[i].icon = table_bulldozer_turn2l[m_moveObject[i].time % 22];
+ }
+ if (m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].icon = table_bulldozer_turn2r[m_moveObject[i].time % 22];
+ }
+ if (m_moveObject[i].step == 2)
+ {
+ m_moveObject[i].icon = table_bulldozer_left[m_moveObject[i].time % 8];
+ }
+ if (m_moveObject[i].step == 4)
+ {
+ m_moveObject[i].icon = table_bulldozer_right[m_moveObject[i].time % 8];
+ }
+ }
+ else
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ m_moveObject[i].icon = table_bulldozer_turn2r[m_moveObject[i].time % 22];
+ }
+ if (m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].icon = table_bulldozer_turn2l[m_moveObject[i].time % 22];
+ }
+ if (m_moveObject[i].step == 2)
+ {
+ m_moveObject[i].icon = table_bulldozer_right[m_moveObject[i].time % 8];
+ }
+ if (m_moveObject[i].step == 4)
+ {
+ m_moveObject[i].icon = table_bulldozer_left[m_moveObject[i].time % 8];
+ }
+ }
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 17)
+ {
+ if (m_moveObject[i].posStart.x > m_moveObject[i].posEnd.x)
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ m_moveObject[i].icon = table_poisson_turn2l[m_moveObject[i].time % 48];
+ }
+ if (m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].icon = table_poisson_turn2r[m_moveObject[i].time % 48];
+ }
+ if (m_moveObject[i].step == 2)
+ {
+ m_moveObject[i].icon = table_poisson_left[m_moveObject[i].time % 8];
+ }
+ if (m_moveObject[i].step == 4)
+ {
+ m_moveObject[i].icon = table_poisson_right[m_moveObject[i].time % 8];
+ }
+ }
+ else
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ m_moveObject[i].icon = table_poisson_turn2r[m_moveObject[i].time % 48];
+ }
+ if (m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].icon = table_poisson_turn2l[m_moveObject[i].time % 48];
+ }
+ if (m_moveObject[i].step == 2)
+ {
+ m_moveObject[i].icon = table_poisson_right[m_moveObject[i].time % 8];
+ }
+ if (m_moveObject[i].step == 4)
+ {
+ m_moveObject[i].icon = table_poisson_left[m_moveObject[i].time % 8];
+ }
+ }
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 20)
+ {
+ if (m_moveObject[i].posStart.x > m_moveObject[i].posEnd.x)
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ m_moveObject[i].icon = table_oiseau_turn2l[m_moveObject[i].time % 10];
+ }
+ if (m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].icon = table_oiseau_turn2r[m_moveObject[i].time % 10];
+ }
+ if (m_moveObject[i].step == 2)
+ {
+ m_moveObject[i].icon = table_oiseau_left[m_moveObject[i].time % 8];
+ }
+ if (m_moveObject[i].step == 4)
+ {
+ m_moveObject[i].icon = table_oiseau_right[m_moveObject[i].time % 8];
+ }
+ }
+ else
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ m_moveObject[i].icon = table_oiseau_turn2r[m_moveObject[i].time % 10];
+ }
+ if (m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].icon = table_oiseau_turn2l[m_moveObject[i].time % 10];
+ }
+ if (m_moveObject[i].step == 2)
+ {
+ m_moveObject[i].icon = table_oiseau_right[m_moveObject[i].time % 8];
+ }
+ if (m_moveObject[i].step == 4)
+ {
+ m_moveObject[i].icon = table_oiseau_left[m_moveObject[i].time % 8];
+ }
+ }
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 44)
+ {
+ if (m_moveObject[i].posStart.x > m_moveObject[i].posEnd.x)
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ m_moveObject[i].icon = table_guepe_turn2l[m_moveObject[i].time % 5];
+ }
+ if (m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].icon = table_guepe_turn2r[m_moveObject[i].time % 5];
+ }
+ if (m_moveObject[i].step == 2)
+ {
+ m_moveObject[i].icon = table_guepe_left[m_moveObject[i].time % 6];
+ }
+ if (m_moveObject[i].step == 4)
+ {
+ m_moveObject[i].icon = table_guepe_right[m_moveObject[i].time % 6];
+ }
+ }
+ else
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ m_moveObject[i].icon = table_guepe_turn2r[m_moveObject[i].time % 5];
+ }
+ if (m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].icon = table_guepe_turn2l[m_moveObject[i].time % 5];
+ }
+ if (m_moveObject[i].step == 2)
+ {
+ m_moveObject[i].icon = table_guepe_right[m_moveObject[i].time % 6];
+ }
+ if (m_moveObject[i].step == 4)
+ {
+ m_moveObject[i].icon = table_guepe_left[m_moveObject[i].time % 6];
+ }
+ }
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 54)
+ {
+ if (m_moveObject[i].posStart.x > m_moveObject[i].posEnd.x)
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ m_moveObject[i].icon = table_creature_turn2[m_moveObject[i].time % 152];
+ }
+ if (m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].icon = table_creature_turn2[m_moveObject[i].time % 152];
+ }
+ if (m_moveObject[i].step == 2)
+ {
+ m_moveObject[i].icon = table_creature_left[m_moveObject[i].time % 8];
+ }
+ if (m_moveObject[i].step == 4)
+ {
+ m_moveObject[i].icon = table_creature_right[m_moveObject[i].time % 8];
+ }
+ }
+ else
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ m_moveObject[i].icon = table_creature_turn2[m_moveObject[i].time % 152];
+ }
+ if (m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].icon = table_creature_turn2[m_moveObject[i].time % 152];
+ }
+ if (m_moveObject[i].step == 2)
+ {
+ m_moveObject[i].icon = table_creature_right[m_moveObject[i].time % 8];
+ }
+ if (m_moveObject[i].step == 4)
+ {
+ m_moveObject[i].icon = table_creature_left[m_moveObject[i].time % 8];
+ }
+ }
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 32)
+ {
+ if (m_moveObject[i].posStart.x > m_moveObject[i].posEnd.x)
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ m_moveObject[i].icon = table_blupih_turn2l[m_moveObject[i].time % 26];
+ }
+ if (m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].icon = table_blupih_turn2r[m_moveObject[i].time % 26];
+ }
+ if (m_moveObject[i].step == 2)
+ {
+ m_moveObject[i].icon = table_blupih_left[m_moveObject[i].time % 8];
+ }
+ if (m_moveObject[i].step == 4)
+ {
+ m_moveObject[i].icon = table_blupih_right[m_moveObject[i].time % 8];
+ }
+ }
+ else
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ m_moveObject[i].icon = table_blupih_turn2r[m_moveObject[i].time % 26];
+ }
+ if (m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].icon = table_blupih_turn2l[m_moveObject[i].time % 26];
+ }
+ if (m_moveObject[i].step == 2)
+ {
+ m_moveObject[i].icon = table_blupih_right[m_moveObject[i].time % 8];
+ }
+ if (m_moveObject[i].step == 4)
+ {
+ m_moveObject[i].icon = table_blupih_left[m_moveObject[i].time % 8];
+ }
+ }
+ if ((m_moveObject[i].step == 1 || m_moveObject[i].step == 3) && m_moveObject[i].time == 21)
+ {
+ pos.x = m_moveObject[i].posCurrent.x;
+ pos.y = m_moveObject[i].posCurrent.y + 40;
+ if (ObjectStart(pos, 23, 55) != -1)
+ {
+ PlaySound(52, pos);
+ }
+ }
+ }
+ if (m_moveObject[i].type == 33)
+ {
+ if (m_moveObject[i].posStart.x > m_moveObject[i].posEnd.x)
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ m_moveObject[i].icon = table_blupit_turn2l[m_moveObject[i].time % 24];
+ }
+ if (m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].icon = table_blupit_turn2r[m_moveObject[i].time % 24];
+ }
+ if (m_moveObject[i].step == 2)
+ {
+ m_moveObject[i].icon = table_blupit_left[m_moveObject[i].time % 8];
+ }
+ if (m_moveObject[i].step == 4)
+ {
+ m_moveObject[i].icon = table_blupit_right[m_moveObject[i].time % 8];
+ }
+ }
+ else
+ {
+ if (m_moveObject[i].step == 1)
+ {
+ m_moveObject[i].icon = table_blupit_turn2r[m_moveObject[i].time % 24];
+ }
+ if (m_moveObject[i].step == 3)
+ {
+ m_moveObject[i].icon = table_blupit_turn2l[m_moveObject[i].time % 24];
+ }
+ if (m_moveObject[i].step == 2)
+ {
+ m_moveObject[i].icon = table_blupit_right[m_moveObject[i].time % 8];
+ }
+ if (m_moveObject[i].step == 4)
+ {
+ m_moveObject[i].icon = table_blupit_left[m_moveObject[i].time % 8];
+ }
+ }
+ if ((m_moveObject[i].step == 1 || m_moveObject[i].step == 3) && m_moveObject[i].time == 3)
+ {
+ int speed;
+ if ((m_moveObject[i].posStart.x < m_moveObject[i].posEnd.x && m_moveObject[i].step == 1) || (m_moveObject[i].posStart.x > m_moveObject[i].posEnd.x && m_moveObject[i].step == 3))
+ {
+ pos.x = m_moveObject[i].posCurrent.x - 30;
+ pos.y = m_moveObject[i].posCurrent.x + BLUPIOFFY;
+ speed = -5;
+ }
+ else
+ {
+ pos.x = m_moveObject[i].posCurrent.x + 30;
+ pos.y = m_moveObject[i].posCurrent.y + BLUPIOFFY;
+ speed = 5;
+ }
+ if (ObjectStart(pos, 23, speed) != -1)
+ {
+ PlaySound(52, pos);
+ }
+ }
+ if ((m_moveObject[i].step == 1 || m_moveObject[i].step == 3) && m_moveObject[i].time == 21)
+ {
+ int speed;
+ if ((m_moveObject[i].posStart.x < m_moveObject[i].posEnd.x && m_moveObject[i].step == 1) || (m_moveObject[i].posStart.x > m_moveObject[i].posEnd.x && m_moveObject[i].step == 3))
+ {
+ pos.x = m_moveObject[i].posCurrent.x + 30;
+ pos.y = m_moveObject[i].posCurrent.y + BLUPIOFFY;
+ speed = 5;
+ }
+ else
+ {
+ pos.x = m_moveObject[i].posCurrent.x - 30;
+ pos.y = m_moveObject[i].posCurrent.y + BLUPIOFFY;
+ speed = -5;
+ }
+ if (ObjectStart(pos, 23, speed) != -1)
+ {
+ PlaySound(52, pos);
+ }
+ }
+ }
+ if (m_moveObject[i].type == 34)
+ {
+ m_moveObject[i].icon = table_glu[m_moveObject[i].phase / 1 % 25];
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 37)
+ {
+ if (m_moveObject[i].phase >= 70)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_clear[m_moveObject[i].phase / 1 % 70];
+ m_moveObject[i].channel = 10;
+ }
+ }
+ if (m_moveObject[i].type == 38)
+ {
+ if (m_moveObject[i].phase >= 90)
+ {
+ m_moveObject[i].type = 0;
+ }
+ else
+ {
+ m_moveObject[i].icon = table_electro[m_moveObject[i].phase / 1 % 90];
+ if (m_moveObject[i].phase < 30)
+ {
+ m_moveObject[i].channel = 12;
+ }
+ else
+ {
+ m_moveObject[i].channel = 10;
+ }
+ }
+ }
+ if (m_moveObject[i].type == 13)
+ {
+ m_moveObject[i].icon = 68;
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 46)
+ {
+ m_moveObject[i].icon = 208;
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 19)
+ {
+ m_moveObject[i].icon = 89;
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 28)
+ {
+ m_moveObject[i].icon = 167;
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 23)
+ {
+ m_moveObject[i].icon = 176;
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 29)
+ {
+ m_moveObject[i].icon = 177;
+ m_moveObject[i].channel = 10;
+ }
+ if (m_moveObject[i].type == 30)
+ {
+ m_moveObject[i].icon = 178;
+ m_moveObject[i].channel = 10;
+ }
+ m_moveObject[i].phase ++;
+ if (m_moveObject[i].phase > 32700)
+ {
+ m_moveObject[i].phase = 0;
+ }
+}
+
+void CDecor::DynamiteStart(int i, int dx, int dy)
+{
+ POINT posStart = m_moveObject[i].posStart;
+ posStart.x -= 34;
+ posStart.y -= 34;
+ posStart.x += dx;
+ posStart.y -= dy;
+ ObjectStart(posStart, 8, 0);
+ if (dx == 0 && dy == 0)
+ {
+ PlaySound(10, posStart);
+ m_decorAction = 1;
+ m_decorPhase = 0;
+ }
+ RECT src;
+ src.left = posStart.x;
+ src.right = posStart.x + 128;
+ src.top = posStart.y;
+ src.bottom = posStart.y + 128;
+ POINT tinyPoint;
+ for (int j = 0; j < 2; j++)
+ {
+ tinyPoint.x = posStart.x / 64;
+ for (int k = 0; k < 2; j++)
+ {
+ if (tinyPoint.x >= 0 && tinyPoint.x < 100 && tinyPoint.y >= 0 && tinyPoint.y < 100)
+ {
+ int icon = m_decor[tinyPoint.x][tinyPoint.y].icon;
+ if (icon == 378 || icon == 379 || icon == 404 || icon == 410)
+ {
+ POINT pos;
+ pos.x = tinyPoint.x * 64;
+ pos.y = tinyPoint.y * 64;
+ ModifDecor(pos, -1);
+ }
+ }
+ tinyPoint.x++;
+ }
+ tinyPoint.y++;
+ }
+ for (i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type == 2 || m_moveObject[i].type == 3 || m_moveObject[i].type == 96 || m_moveObject[i].type == 97 || m_moveObject[i].type == 4 ||
+ m_moveObject[i].type == 6 || m_moveObject[i].type == 12 || m_moveObject[i].type == 13 || m_moveObject[i].type == 16 || m_moveObject[i].type == 17 ||
+ m_moveObject[i].type == 19 || m_moveObject[i].type == 20 || m_moveObject[i].type == TYPE_SKATE || m_moveObject[i].type == 25 || m_moveObject[i].type == 26 || m_moveObject[i].type == 28 ||
+ m_moveObject[i].type == 30 || m_moveObject[i].type == 32 || m_moveObject[i].type == 33 || m_moveObject[i].type == 34 || m_moveObject[i].type == 40 || m_moveObject[i].type == 44 ||
+ m_moveObject[i].type == 46 || m_moveObject[i].type == 52 || m_moveObject[i].type == 54 || m_moveObject[i].type == 200 || m_moveObject[i].type == 201 || m_moveObject[i].type == 202 ||
+ m_moveObject[i].type == 203)
+ {
+ RECT src2;
+ src2.left = m_moveObject[i].posCurrent.x;
+ src2.right = m_moveObject[i].posCurrent.x + 60;
+ src2.top = m_moveObject[i].posCurrent.y;
+ src2.bottom = m_moveObject[i].posCurrent.y + 20;
+ RECT tinyRect;
+ if (IntersectRect(&tinyRect, &src2, &src))
+ {
+ if (m_moveObject[i].type == 12)
+ {
+ SearchLinkCaisse(i, TRUE);
+ for (int l = 0; l < m_nbLinkCaisse; l++)
+ {
+ int channel = m_moveObject[m_linkCaisse[l]].channel;
+ int icon2 = m_moveObject[m_linkCaisse[l]].icon;
+ POINT posCurrent = m_moveObject[m_linkCaisse[l]].posCurrent;
+ double num = (double)Random(7, 23);
+ if (rand() % 2 == 0)
+ {
+ num = -num;
+ }
+ m_moveObject[m_linkCaisse[l]].type = 0;
+ }
+ ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type);
+ UpdateCaisse();
+ }
+ else
+ {
+ ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type);
+ }
+ }
+ }
+ }
+ if (m_blupiFocus && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiPos.x > posStart.x - 30 && m_blupiPos.x < posStart.x + 30 + 64 && m_blupiPos.y > posStart.y - 30 && m_blupiPos.y < posStart.y + 30 + 64)
+ {
+ BlupiDead(11, -1);
+ m_blupiAir = TRUE;
+ }
+
+}
+
+int CDecor::AscenseurDetect(RECT rect, POINT oldpos, POINT newpos)
+{
+ if (m_blupiTimeNoAsc != 0)
+ {
+ return -1;
+ }
+ int num = newpos.y - oldpos.y;
+ int num2;
+ if (num < 0)
+ {
+ num2 = -30;
+ }
+ else
+ {
+ num2 = 30;
+ }
+ num = abs(num);
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type == 1 || m_moveObject[i].type == TYPE_ASCENSEURs || m_moveObject[i].type == TYPE_ASCENSEURsi)
+ {
+ RECT src;
+ src.left = m_moveObject[i].posCurrent.x;
+ src.right = m_moveObject[i].posCurrent.x + 64;
+ src.top = m_moveObject[i].posCurrent.y;
+ src.bottom = m_moveObject[i].posCurrent.y + 16;
+ if (num < 30)
+ {
+ RECT tinyRect;
+ if (IntersectRect(&tinyRect, &src, &rect))
+ {
+ return i;
+ }
+ }
+ else
+ {
+ RECT src2 = rect;
+ src2.top -= num / 30 * num2;
+ src2.bottom -= num / 30 * num2;
+ for (int j = 0; j <= num / 30; j++)
+ {
+ RECT tinyRect;
+ if (IntersectRect(&tinyRect, &src, &src2))
+ {
+ return i;
+ }
+ src2.top += num2;
+ src2.bottom += num;
+ }
+ }
+
+ }
+ }
+ return -1;
+}
+
+void CDecor::AscenseurVertigo(int i, BOOL* pbVertigoLeft, BOOL* pbVertigoRight)
+{
+ *pbVertigoLeft = FALSE;
+
+ *pbVertigoRight = FALSE;
+ if (m_blupiPos.x + 20 + 4 < m_moveObject[i].posCurrent.x)
+ {
+ *pbVertigoLeft = TRUE;
+ }
+ if (m_blupiPos.x + 60 - 20 - 4 > m_moveObject[i].posCurrent.x + 64)
+ {
+ *pbVertigoRight = TRUE;
+ }
+ if (AscenseurShift(i))
+ {
+ if (*pbVertigoLeft)
+ {
+ *pbVertigoLeft = FALSE;
+ *pbVertigoRight = TRUE;
+ m_blupiTimeNoAsc = 10;
+ return;
+ }
+ if (*pbVertigoRight)
+ {
+ *pbVertigoRight = FALSE;
+ *pbVertigoLeft = TRUE;
+ m_blupiTimeNoAsc = 10;
+ }
+ }
+}
+
+BOOL CDecor::AscenseurShift(int i)
+{
+ return i != -1 && m_moveObject[i].icon >= 311 && m_moveObject[i].icon <= 316;
+}
+
+void CDecor::AscenseurSynchro(int i)
+{
+ for (i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ m_moveObject[i].posCurrent = m_moveObject[i].posStart;
+ m_moveObject[i].step = 1;
+ m_moveObject[i].time = 0;
+ m_moveObject[i].phase = 0;
+ }
+}
+
+void CDecor::UpdateCaisse()
+{
+ m_nbRankCaisse = 0;
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type == TYPE_CAISSE)
+ {
+ m_rankCaisse[m_nbRankCaisse++] = i;
+ }
+ }
+}
+
+BOOL CDecor::TestPushCaisse(int i, POINT pos, BOOL bPop)
+{
+ POINT move;
+
+ move.x = pos.x - m_moveObject[i].posCurrent.x;
+ move.y = 0;
+ SearchLinkCaisse(i, bPop);
+ int y = m_moveObject[i].posCurrent.y;
+ for (int j = 0; j < m_nbLinkCaisse; j++)
+ {
+ i = m_linkCaisse[j];
+ if (!TestPushOneCaisse(i, move, y))
+ {
+ return FALSE;
+ }
+ }
+ for (int j = 0; j < m_nbLinkCaisse; j++)
+ {
+ i = m_linkCaisse[j];
+ int num = i;
+ m_moveObject[num].posCurrent.x = m_moveObject[num].posCurrent.x + move.x;
+ m_moveObject[num].posStart.x = m_moveObject[num].posStart.x + move.x;
+ int num2 = i;
+ m_moveObject[num].posEnd.x = m_moveObject[num].posEnd.x + move.x;
+ }
+ return TRUE;
+}
+
+BOOL CDecor::TestPushOneCaisse(int i, POINT move, int b)
+{
+ // TODO
+ return FALSE;
+}
+
+void CDecor::SearchLinkCaisse(int rank, BOOL bPop)
+{
+ m_nbLinkCaisse = 0;
+ AddLinkCaisse(rank);
+ POINT posCurrent = m_moveObject[rank].posCurrent;
+
+ BOOL flag;
+ do
+ {
+ flag = FALSE;
+ for (int i = 0; i < m_nbLinkCaisse; i++)
+ {
+ int num = m_linkCaisse[i];
+ if (m_moveObject[num].posCurrent.y <=
+ posCurrent.y && (!bPop || (m_moveObject
+ [num].posCurrent.x >= posCurrent.x - DIMOBJX / 2 &&
+ m_moveObject[num].posCurrent.x <=
+ posCurrent.x + DIMOBJX / 2)))
+ {
+ RECT src;
+ src.left = m_moveObject[num].posCurrent.x - 1;
+ src.top = m_moveObject[num].posCurrent.y - 1;
+ src.right = src.left + DIMOBJX + 1;
+ src.bottom = src.top + DIMOBJY + 1;
+ for (int j = 0; j < m_nbRankCaisse; j++)
+ {
+ int num2 = m_rankCaisse[j];
+ if (num2 != num && m_moveObject[num2].posCurrent.y <= posCurrent.y && (!bPop || (m_moveObject[num2].posCurrent.x >= posCurrent.x - 32 && m_moveObject[num2].posCurrent.x <= posCurrent.x + 32)))
+ {
+ RECT src2;
+ src2.left = m_moveObject[num2].posCurrent.x - 1;
+ src2.top = m_moveObject[num2].posCurrent.y - 1;
+ src2.right = src2.left + 64 + 1;
+ src2.bottom = src2.top + 64 + 1;
+ RECT tinyRect;
+ if (IntersectRect(&tinyRect, &src2, &src) && AddLinkCaisse(num2))
+ {
+ flag = TRUE;
+ }
+ }
+ }
+ }
+ }
+ } while (flag);
+}
+
+BOOL CDecor::AddLinkCaisse(int rank)
+{
+ for (int i = 0; i < m_nbLinkCaisse; i++)
+ {
+ if (m_linkCaisse[i] == rank)
+ {
+ return FALSE;
+ }
+ }
+ m_linkCaisse[m_nbLinkCaisse] = rank;
+ m_nbLinkCaisse++;
+ return TRUE;
+}
+
+int CDecor::CaisseInFront()
+{
+ POINT tinyPoint;
+ if (m_blupiDir == 1)
+ {
+ tinyPoint.x = m_blupiPos.x + 16 - 32;
+ tinyPoint.y = m_blupiPos.y;
+ }
+ else
+ {
+ tinyPoint.x = m_blupiPos.x + 60 - 16 + 32;
+ tinyPoint.y = m_blupiPos.y;
+ }
+ for (int i = 0; i < m_nbRankCaisse; i++)
+ {
+ int num = m_rankCaisse[i];
+ if (tinyPoint.x > m_moveObject[num].posCurrent.x &&
+ tinyPoint.x < m_moveObject[num].posCurrent.x + 64 &&
+ tinyPoint.y > m_moveObject[num].posCurrent.y &&
+ tinyPoint.y < m_moveObject[num].posCurrent.y + 64)
+ {
+ return num;
+ }
+ }
+ return -1;
+}
+
+int CDecor::CaisseGetMove(int max)
+{
+ max -= (m_nbLinkCaisse - 1) / 2;
+ if (max < 1)
+ {
+ max = 1;
+ }
+ if (m_blupiPower)
+ {
+ max *= 2;
+ }
+ if (m_blupiPhase < 20)
+ {
+ max = max * m_blupiPhase / 20;
+ if (max == 0)
+ {
+ max++;
+ }
+ }
+ return max;
+}
+
+int CDecor::MockeryDetect(POINT pos)
+{
+ if (m_blupiTimeMockery > 0)
+ {
+ return 0;
+ }
+ if (m_blupiAir)
+ {
+ POINT tinyPoint;
+ tinyPoint.x = pos.x + 30;
+ tinyPoint.y = pos.y + 30 + 64;
+ if (tinyPoint.x >= 0 && tinyPoint.x < DIMOBJX*MAXCELX && tinyPoint.y >= 0 && tinyPoint.y < DIMOBJY*MAXCELY)
+ {
+ int icon = m_decor[tinyPoint.x / DIMOBJX][tinyPoint.y / DIMOBJY].icon;
+ if (icon == 68 || icon == 317)
+ {
+ return 64;
+ }
+ }
+ }
+ RECT src;
+ src.left = pos.x;
+ src.right = pos.x + 60;
+ src.top = pos.y + 11;
+ src.bottom = pos.y + 60;
+ if (m_blupiAir)
+ {
+ src.bottom += 90;
+ }
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type == 2 ||
+ m_moveObject[i].type == 16 ||
+ m_moveObject[i].type == 96 ||
+ m_moveObject[i].type == 97 ||
+ m_moveObject[i].type == 4 ||
+ m_moveObject[i].type == 20 ||
+ m_moveObject[i].type == 44 ||
+ m_moveObject[i].type == 54 ||
+ m_moveObject[i].type == 23 ||
+ m_moveObject[i].type == 32 ||
+ m_moveObject[i].type == 33)
+ {
+ RECT src2;
+ src2.left = m_moveObject[i].posCurrent.x;
+ src2.right = m_moveObject[i].posCurrent.x + 60;
+ src2.top = m_moveObject[i].posCurrent.y + 36;
+ src2.bottom = m_moveObject[i].posCurrent.y + 60;
+ RECT tinyRect;
+ if (IntersectRect(&tinyRect, &src2, &src))
+ {
+ if (m_moveObject[i].type == 54)
+ {
+ return 83;
+ }
+ if (m_blupiDir == 2)
+ {
+ if (pos.x >= src2.left)
+ {
+ return 64;
+ }
+ if (m_moveObject[i].type == 2)
+ {
+ return 0;
+ }
+ return 63;
+ }
+ else
+ {
+ if (pos.x < src2.left)
+ {
+ return 64;
+ }
+ if (m_moveObject[i].type == 2)
+ {
+ return 0;
+ }
+ return 63;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+BOOL CDecor::BlupiElectro(POINT pos)
+{
+ if (m_blupiCloud)
+ {
+ return FALSE;
+ }
+ RECT src;
+ src.left = pos.x + 16;
+ src.right = pos.x + 60 - 16;
+ src.top = pos.y + 11;
+ src.bottom = pos.y + 60 - 2;
+ RECT src2;
+ src2.left = m_blupiPos.x - 16 - 40;
+ src2.right = m_blupiPos.x + 60 + 16 + 40;
+ src2.top = m_blupiPos.y + 11 - 40;
+ src2.bottom = m_blupiPos.y + 60 - 2 + 40;
+ RECT tinyRect;
+ return IntersectRect(&tinyRect, &src, &src2);
+}
+
+void CDecor::MoveObjectFollow(POINT pos)
+{
+ if (m_blupiHide)
+ {
+ return;
+ }
+ RECT src = BlupiRect(pos);
+ src.left = pos.x + 16;
+ src.right = pos.x + 60 - 16;
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type == 96)
+ {
+ RECT src2;
+ src2.left = m_moveObject[i].posCurrent.x - 100;
+ src2.right = m_moveObject[i].posCurrent.x + 60 + 100;
+ src2.top = m_moveObject[i].posCurrent.y - 100;
+ src2.bottom = m_moveObject[i].posCurrent.y + 60 + 100;
+ RECT tinyRect;
+ if (IntersectRect(&tinyRect, &src2, &src))
+ {
+ m_moveObject[i].type = 97;
+ PlaySound(92, m_moveObject[i].posCurrent);
+ }
+ }
+ }
+}
+
+int CDecor::MoveObjectDetect(POINT pos, BOOL* pbNear)
+{
+ RECT src = BlupiRect(pos);
+ src.left = pos.x + 16;
+ src.right = pos.x + 60 - 16;
+ RECT src2;
+ src2.left = src.left - 20;
+ src2.right = src.right + 20;
+ src2.top = src.top - 40;
+ src2.bottom = src.bottom + 30;
+
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type != 0 &&
+ m_moveObject[i].type != 27 &&
+ m_moveObject[i].type != 57 &&
+ m_moveObject[i].type != 39 &&
+ m_moveObject[i].type != 58 &&
+ m_moveObject[i].type != 34 &&
+ m_moveObject[i].type != 37 &&
+ m_moveObject[i].type != 38 &&
+ (m_blupiAction != 14 && m_blupiAction != 29) ||
+ m_moveObject[i].type != 12)
+ {
+ RECT src3;
+ // TODO
+ }
+ }
+ return -1;
+}
+
+int CDecor::MoveAscenseurDetect(POINT pos, int height)
+{
+ if (m_blupiTimeNoAsc != 0)
+ {
+ return -1;
+ }
+ RECT src;
+ src.left = pos.x + 12;
+ src.right = pos.x + 60 - 12;
+ src.top = pos.y + 60 - 2;
+ src.bottom = pos.y + 60 + height - 1;
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type == 1 || m_moveObject[i].type == TYPE_ASCENSEURs || m_moveObject[i].type == TYPE_ASCENSEURsi)
+ {
+ RECT src2;
+ src2.left = m_moveObject[i].posCurrent.x;
+ src2.right = m_moveObject[i].posCurrent.x + 64;
+ src2.top = m_moveObject[i].posCurrent.y;
+ src2.bottom = m_moveObject[i].posCurrent.y + 16;
+ RECT tinyRect;
+ if (IntersectRect(&tinyRect, &src2, &src))
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+}
+
+int CDecor::MoveChargeDetect(POINT pos)
+{
+ RECT src;
+ src.left = pos.x + 16;
+ src.right = pos.x + 60 - 16;
+ src.top = pos.y + 11;
+ src.bottom = pos.y + 60 - 2;
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type == 31)
+ {
+ RECT src2;
+ src2.left = m_moveObject[i].posCurrent.x - 10;
+ src2.right = m_moveObject[i].posCurrent.x + 60 + 10;
+ src2.top = m_moveObject[i].posCurrent.y + 36;
+ src2.bottom = m_moveObject[i].posCurrent.y + 60;
+ RECT tinyRect;
+ if (IntersectRect(&tinyRect, &src2, &src))
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+}
+
+int CDecor::MovePersoDetect(POINT pos)
+{
+ RECT src;
+ src.left = pos.x + 16;
+ src.right = pos.x + 60 - 16;
+ src.top = pos.y + 11;
+ src.bottom = pos.y + 60 - 2;
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type >= 200 && m_moveObject[i].type <= 203)
+ {
+ RECT src2;
+ src2.left = m_moveObject[i].posCurrent.x - 16;
+ src2.right = m_moveObject[i].posCurrent.x + 60 + 16;
+ src2.top = m_moveObject[i].posCurrent.y + 36;
+ src2.bottom = m_moveObject[i].posCurrent.y + 60;
+ RECT tinyRect;
+ if (IntersectRect(&tinyRect, &src2, &src))
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+}
+
+int CDecor::MoveBalleDetect(POINT pos)
+{
+ // TODO
+ return -1;
+}
+
+int CDecor::MoveObjectDelete(POINT cel)
+{
+ int result = -1;
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type != 0)
+ {
+ if (cel.x == m_moveObject[i].posStart.x / 64 && cel.y == m_moveObject[i].posStart.y / 64)
+ {
+ result = m_moveObject[i].type;
+ m_moveObject[i].type = 0;
+ }
+ else if (cel.x == m_moveObject[i].posEnd.x / 64 && cel.y == m_moveObject[i].posEnd.y / 64)
+ {
+ result = m_moveObject[i].type;
+ m_moveObject[i].type = 0;
+ }
+ }
+ }
+ return result;
+}
+
+int CDecor::MoveObjectFree()
+{
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type == 0)
+ {
+ m_moveObject[i].type = 0;
+ return i;
+ }
+ }
+ return -1;
+}
+
+int CDecor::SortGetType(int type)
+{
+ if (type == 2 || type == 3 || type == 96 || type == 97)
+ {
+ return 1;
+ }
+ if (type == 12)
+ {
+ return 2;
+ }
+ return 3;
+}
+
+void CDecor::MoveObjectSort()
+{
+ MoveObject src;
+ int num = 0;
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type != 0)
+ {
+ MoveObjectCopy(m_moveObject[num++], m_moveObject[i]);
+ }
+ }
+ for (int i = num; i < MAXMOVEOBJECT; i++)
+ {
+ m_moveObject[i].type = 0;
+ }
+ if (num <= 1)
+ {
+ return;
+ }
+ BOOL flag;
+ do
+ {
+ flag = FALSE;
+ for (int i = 0; i < num - 1; i++)
+ {
+ if (SortGetType(m_moveObject[i].type) > SortGetType(m_moveObject[i + 1].type))
+ {
+ MoveObjectCopy(src, m_moveObject[i]);
+ MoveObjectCopy(m_moveObject[i], m_moveObject[i + 1]);
+ MoveObjectCopy(m_moveObject[i + 1], src);
+ flag = TRUE;
+ }
+ }
+ } while (flag);
+ UpdateCaisse();
+ m_nbLinkCaisse = 0;
+}
+
+void CDecor::MoveObjectPriority(int i)
+{
+
+}
+
+int CDecor::MoveObjectSearch(POINT pos, int type)
+{
+ for (int i = 0; i < MAXMOVEOBJECT; i++)
+ {
+ if (m_moveObject[i].type != 0 && (type == -1 ||
+ m_moveObject[i].type == type))
+ {
+ if (m_moveObject[i].type == 23 &&
+ m_moveObject[i].posStart.x != m_moveObject[i].posEnd.x)
+ {
+ if (m_moveObject[i].posCurrent.x >= pos.x - 100 &&
+ m_moveObject[i].posCurrent.x <= pos.x + 100 &&
+ m_moveObject[i].posCurrent.y == pos.y)
+ {
+ return i;
+ }
+ }
+ else if (m_moveObject[i].type == 23 &&
+ m_moveObject[i].posStart.y != m_moveObject[i].posEnd.y)
+ {
+ if (m_moveObject[i].posCurrent.y >= pos.y - 100 &&
+ m_moveObject[i].posCurrent.y <= pos.y + 100 &&
+ m_moveObject[i].posCurrent.x == pos.x)
+ {
+ return i;
+ }
+ }
+ else if (m_moveObject[i].posCurrent.x == pos.x &&
+ m_moveObject[i].posCurrent.y == pos.y)
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+}
diff --git a/src/decnet.cpp b/src/decnet.cpp
new file mode 100644
index 0000000..2f6efd4
--- /dev/null
+++ b/src/decnet.cpp
@@ -0,0 +1,203 @@
+// DecNet.cpp
+//
+
+#include "def.h"
+#include "decor.h"
+#include "misc.h"
+#include "network.h"
+
+void CDecor::NetStopCloud(int rank)
+{
+ NetMessage msg;
+
+ msg.data1 = 0;
+ msg.x = 0;
+ msg.y = 0;
+ msg.type = MESS_STOPCLOUD;
+ msg.channel = rank;
+ NetMessagePush(&msg);
+ return;
+}
+
+void CDecor::NetPlaySound(short channel, POINT pos)
+{
+ NetMessage msg;
+
+ msg.y = pos.y;
+ msg.x = pos.x;
+ msg.type = MESS_PLAYSOUND;
+ msg.data1 = 0;
+ msg.channel = channel;
+ NetMessagePush(&msg);
+ return;
+}
+
+void CDecor::NetStopSound(short channel)
+{
+ NetMessage msg;
+
+ msg.data1 = 0;
+ msg.x = 0;
+ msg.y = 0;
+ msg.type = MESS_STOPSOUND;
+ msg.channel = channel;
+ NetMessagePush(&msg);
+}
+
+void CDecor::NetDataFlush()
+{
+ for (int i = 0; i < MAXNETPLAYER; i++)
+ {
+ m_netPos[i].x = 0;
+ m_netPos[i].y = 0;
+ m_netIcons[i] = -1;
+ m_netUnk1[i] = 0;
+ m_netUnk2[i] = 0;
+ m_netTransports[i] = 0;
+ m_netPlayerPacketsReceived[i] = 0;
+ m_netPlayerPacketsReceived2[i] = 0;
+ m_netTimeSincePacket[i] = 0;
+ m_netVitesses[i].x = 0;
+ m_netVitesses[i].y = 0;
+ m_netUnk4[i].x = 0;
+ m_netUnk4[i].y = 0;
+ }
+ m_netPacketsSent = 0;
+ m_netPacketsSent2 = 0;
+ m_netPacketsReceived = 0;
+ m_netPacketsReceived2 = 0;
+ m_netPacketIcon = -1;
+ NetMessageIndexFlush();
+}
+
+void CDecor::NetFUN_155e0(BYTE _foo, short _bar)
+{
+ char data[4]{ 4, _foo, _bar & 0xff, _bar >> 8 };
+ m_pNetwork->Send(&data, 4, DPSEND_GUARANTEED);
+ return;
+}
+
+void CDecor::TreatNetData()
+{
+
+}
+
+void CDecor::DoNetSmooth(int player)
+{
+
+}
+
+void CDecor::NetAdjustToLift()
+{
+ for (int i = 0; i < MAXNETPLAYER; i++)
+ {
+ if (m_netPos[i].x != -1 && m_netTransports[i] >= 0 && m_netTransports[i] < MAXMOVEOBJECT)
+ {
+ m_netPos[i].y = m_moveObject[m_netTransports[i]].posCurrent.y - 58;
+ }
+ }
+}
+
+void CDecor::FUN_15da0(int index, short step)
+{
+
+}
+
+
+void CDecor::NetPlayerCollide(POINT pos, int* out)
+{
+ tagRECT rect1;
+ RECT rect2;
+ RECT rect3;
+ //TODO
+
+}
+
+void CDecor::NetMessageIndexFlush()
+{
+ m_netMessageIndex1 = 0;
+ m_netMessageIndex2 = 0;
+ m_netMessageIndex3 = 0;
+ return;
+}
+
+BOOL CDecor::NetMessagePush(NetMessage* message)
+{
+ NetMessage* messages;
+ BYTE data;
+ short pos;
+ int i;
+
+ if (m_netMessageIndex1 == MAXNETMESSAGE) return FALSE;
+
+ CopyMemory(&m_netMessages[m_netMessageIndex2], message, sizeof(NetMessage));
+ m_netMessageIndex1++;
+ m_netMessageIndex2++;
+ if (m_netMessageIndex2 == MAXNETMESSAGE)
+ {
+ m_netMessageIndex2 = 0;
+ }
+ return TRUE;
+}
+
+BOOL CDecor::NetMessagePop(NetMessage* message)
+{
+ if (m_netMessageIndex1 == 0) return FALSE;
+
+ CopyMemory(message, &m_netMessages[m_netMessageIndex3], sizeof(NetMessage));
+ m_netMessageIndex1--;
+ m_netMessageIndex3++;
+ if (m_netMessageIndex3 == MAXNETMESSAGE)
+ {
+ m_netMessageIndex3 = 0;
+ }
+ return TRUE;
+}
+
+void CDecor::NotifFlush()
+{
+ for (int i = 0; i < MAXNOTIF; i++)
+ {
+ m_notifText[i][0] = '\0';
+ }
+
+ m_notifTime = 0;
+}
+
+void CDecor::NotifPop()
+{
+ for (int i = MAXNOTIF; i > 0; --i)
+ {
+ //strcpy()
+ m_notifText[MAXNOTIF - 1][0] = '\0';
+ m_notifTime = NOTIFDELAY; // idk
+ }
+}
+
+void CDecor::NotifPush(char *str)
+{
+ int i;
+ for (i = 0; i < MAXNOTIF; i++)
+ {
+ if (m_notifText[i][0] != '\0') break;
+ }
+ if (i >= MAXNOTIF)
+ {
+ NotifPop();
+ i = MAXNOTIF - 1;
+ }
+ strcpy(m_notifText[i], str);
+ m_notifTime = NOTIFDELAY;
+ m_pSound->PlayImage(SOUND_TRESOR, { LXIMAGE / 2, LYIMAGE / 2 }, -1);
+}
+
+void CDecor::NotifStep()
+{
+ if (m_notifTime == 0)
+ {
+ NotifPop();
+ }
+ else {
+ m_notifTime--;
+ }
+}
\ No newline at end of file
diff --git a/decor.cpp b/src/decor.cpp
similarity index 90%
rename from decor.cpp
rename to src/decor.cpp
index 47d1d0f..6f5a14c 100644
--- a/decor.cpp
+++ b/src/decor.cpp
@@ -19,35 +19,8 @@
#include "network.h"
-////////////////////////////////////////////////////////////////////////////////
-
-#define MAXQUART 441
-#define SCROLL_SPEED 8
-#define SCROLL_MARGX 80
-#define SCROLL_MARGY 40
-
-#define BLUPIFLOOR 2
-#define BLUPIOFFY 4 + BLUPIFLOOR
-#define BLUPISURF 12
-#define BLUPISUSPEND 12
-#define OVERHEIGHT 80
-
-#define TEXTDELAY 10 // tooltip popup delay
-#define NOTIFDELAY 200
-
-inline BOOL IsValidCel(POINT cel)
-{
- return cel.x >= 0 && cel.x < MAXCELX && cel.y >= 0 && cel.y < MAXCELY;
-}
-
-inline void CDecor::StopVehicleSound()
-{
- StopSound(SOUND_HELICOHIGH);
- StopSound(SOUND_HELICOLOW);
- StopSound(SOUND_JEEPHIGH);
- StopSound(SOUND_JEEPLOW);
-}
+///////////////////////////////////////////////////////////////////////////////
// Constructor
@@ -124,7 +97,7 @@ BOOL CDecor::LoadImages()
iconDim = { 0, 0 };
sprintf(filename, "decor%.3d.blp", m_region);
- return m_pPixmap->BackgroundCache(CHBACK, filename, totalDim, iconDim, FALSE);
+ return m_pPixmap->BackgroundCache(CHDECOR, filename, totalDim, iconDim, FALSE);
}
void CDecor::InitGamer()
@@ -244,7 +217,7 @@ int CDecor::GetTime()
void CDecor::PlayPrepare(BOOL bTest)
{
if (bTest) m_nbVies = 3;
-
+
if (m_bMulti)
{
m_nbVies = 10;
@@ -395,7 +368,7 @@ void CDecor::MoveStep()
if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST) {
BlupiStep();
- NetFUN_15d50();
+ NetAdjustToLift();
NotifStep();
}
@@ -472,10 +445,10 @@ void CDecor::Build(RECT rect)
tinyPoint.x += LXIMAGE - pos.x;
pos.x = 0;
}
-
- tinyPoint.x = - posDecor.x % 64 - 64;
+
+ tinyPoint.x = -posDecor.x % 64 - 64;
for (int i = posDecor.x / 64 - 1; i < posDecor.x / 64 + LXIMAGE / 64 + 3; i++) {
- tinyPoint.y = - posDecor.y % 64 + 2 - 64;
+ tinyPoint.y = -posDecor.y % 64 + 2 - 64;
for (int j = posDecor.y / 64 - 1; j < posDecor.y / 64 + LYIMAGE / 64 + 2; j++)
{
if (i >= 0 && i < MAXCELX && j >= 0 && j < MAXCELY)
@@ -506,10 +479,10 @@ void CDecor::Build(RECT rect)
tinyPoint.x += 64;
}
- tinyPoint.x = - posDecor.x % 64;
+ tinyPoint.x = -posDecor.x % 64;
for (int i = posDecor.x / 64; i < posDecor.x / 64 + LXIMAGE / 64 + 2; i++)
{
- tinyPoint.y = - posDecor.y % 64;
+ tinyPoint.y = -posDecor.y % 64;
for (int j = posDecor.y / 64; j < posDecor.y / 64 + LYIMAGE / 64 + 2; j++)
{
if (i >= 0 && i < MAXCELX && j >= 0 && j < MAXCELY && m_decor[i][j].icon != -1)
@@ -615,7 +588,7 @@ void CDecor::Build(RECT rect)
m_pPixmap->QuickIcon(m_moveObject[num3].channel, m_moveObject[num3].icon, tinyPoint);
if (m_moveObject[num3].type == 30)
{
- for (int l = 0; l < sizeof(table_drinkoffset)/sizeof(int); l++)
+ for (int l = 0; l < sizeof(table_drinkoffset) / sizeof(int); l++)
{
int num4 = (m_time + table_drinkoffset[l]) % 50;
int rank = table_drinkeffect[num4 % 5];
@@ -630,7 +603,7 @@ void CDecor::Build(RECT rect)
}
}
}
- tinyPoint.x = - posDecor.x % 64;
+ tinyPoint.x = -posDecor.x % 64;
for (int i = posDecor.x / 64; i < posDecor.x / 64 + LXIMAGE / 64 + 2; i++)
{
tinyPoint.y = 0 - posDecor.y % 64;
@@ -705,9 +678,9 @@ void CDecor::Build(RECT rect)
break;
}
}
- tinyPoint.y += 64;
+ tinyPoint.y += DIMOBJY;
}
- tinyPoint.x += 64;
+ tinyPoint.x += DIMOBJX;
}
for (int num3 = 0; num3 < MAXMOVEOBJECT; num3++)
{
@@ -778,7 +751,7 @@ void CDecor::Build(RECT rect)
num2 = table_decor_eau2[(i * 11 + j * 7 + m_time / num5) % 6];
m_pPixmap->QuickIcon(1, num2, pos);
}
- if (num2 == 305 && BlitzActif(i, j))
+ if (num2 == 305 && BlitzActif({ i, j }))
{
num2 = rand() % 4 + 305;
m_pPixmap->QuickIcon(1, num2, pos);
@@ -928,14 +901,14 @@ void CDecor::DrawInfo()
POINT CDecor::DecorNextAction()
{
- int num = 0;
- if (m_decorAction == 0 || m_bPause)
- {
- return m_posDecor;
- }
+ int num = 0;
+ if (m_decorAction == 0 || m_bPause)
+ {
+ return m_posDecor;
+ }
POINT posDecor = m_posDecor;
- while (table_decor_action[num] != 0)
- {
+ while (table_decor_action[num] != 0)
+ {
if (m_decorAction == table_decor_action[num])
{
if (m_decorPhase < table_decor_action[num + 1])
@@ -985,24 +958,24 @@ POINT CDecor::DecorNextAction()
{
num += 2 + table_decor_action[num + 1] * 2;
}
- }
+ }
return posDecor;
}
void CDecor::SetInput(int keys)
{
- m_keyPress = keys;
- if (m_blupiInvert)
- {
- if (keys & KEY_LEFT)
- {
- m_keyPress = keys & ~KEY_LEFT | KEY_RIGHT;
- }
- if (keys & KEY_RIGHT)
- {
- m_keyPress = m_keyPress & ~KEY_RIGHT | KEY_LEFT;
- }
- }
+ m_keyPress = keys;
+ if (m_blupiInvert)
+ {
+ if (keys & KEY_LEFT)
+ {
+ m_keyPress = keys & ~KEY_LEFT | KEY_RIGHT;
+ }
+ if (keys & KEY_RIGHT)
+ {
+ m_keyPress = m_keyPress & ~KEY_RIGHT | KEY_LEFT;
+ }
+ }
}
void CDecor::SetJoystickEnable(BOOL bJoystick)
@@ -1010,7 +983,7 @@ void CDecor::SetJoystickEnable(BOOL bJoystick)
m_bJoystick = bJoystick;
}
-void CDecor::SetFieldD814(BOOL param)
+void CDecor::SetDemoPlay(BOOL param)
{
m_bD814 = param;
}
@@ -1037,9 +1010,14 @@ void CDecor::PlaySound(int sound, POINT pos, BOOL bLocal)
}
}
+void CDecor::PlaySound(int sound, POINT pos)
+{
+ PlaySound(sound, pos, FALSE);
+}
+
void CDecor::StopSound(int sound)
{
- m_pSound->StopSound(sound);
+ m_pSound->StopSound(sound);
switch (sound) {
case SOUND_HELICOHIGH:
@@ -1061,10 +1039,10 @@ void CDecor::AdaptMotorVehicleSound(POINT pos)
{
POINT blupiPos = pos - m_posDecor;
- if (m_bHelicoMarch) m_pSound->PlayImage(SOUND_HELICOHIGH, blupiPos);
- if (m_bHelicoStop) m_pSound->PlayImage(SOUND_HELICOLOW, blupiPos);
- if (m_bJeepMarch) m_pSound->PlayImage(SOUND_JEEPHIGH, blupiPos);
- if (m_bJeepStop) m_pSound->PlayImage(SOUND_JEEPLOW, blupiPos);
+ if (m_bHelicoMarch) m_pSound->PlayImage(SOUND_HELICOHIGH, blupiPos);
+ if (m_bHelicoStop) m_pSound->PlayImage(SOUND_HELICOLOW, blupiPos);
+ if (m_bJeepMarch) m_pSound->PlayImage(SOUND_JEEPHIGH, blupiPos);
+ if (m_bJeepStop) m_pSound->PlayImage(SOUND_JEEPLOW, blupiPos);
}
void CDecor::VehicleSoundsPhase(int phase)
@@ -1139,25 +1117,25 @@ void CDecor::SetPause(BOOL bPause)
void CDecor::InitializeDoors(BYTE* doors)
{
- for (int i = 0; i < MAXMOVEOBJECT; i++)
- {
+ for (int i = 0; i < 200; i++)
+ {
doors[i] = m_doors[i];
- }
+ }
}
void CDecor::MemorizeDoors(BYTE* doors)
{
- for (int i = 0; i < MAXMOVEOBJECT; i++)
+ for (int i = 0; i < 200; i++)
{
m_doors[i] = doors[i];
- }
+ }
}
void CDecor::SetAllMissions(BOOL bAllMissions)
{
m_bCheatDoors = bAllMissions;
AdaptDoors(m_bPrivate, m_mission);
- return;
+ return;
}
void CDecor::CheatAction(int cheat)
@@ -1397,20 +1375,20 @@ void CDecor::CheatAction(int cheat)
m_blupiCle |= CLE_RED | CLE_GREEN | CLE_BLUE;
break;
}
- if (!m_blupiShield && !m_blupiHide && !m_blupiCloud && !m_blupiPower)
- {
- m_jauges[1].SetHide(TRUE);
- }
- if (!m_blupiHelico && !m_blupiOver)
- {
- StopSound(SOUND_HELICOHIGH);
- StopSound(SOUND_HELICOLOW);
- }
- if (m_blupiJeep && m_blupiTank)
- {
- StopSound(SOUND_JEEPHIGH);
- StopSound(SOUND_JEEPLOW);
- }
+ if (!m_blupiShield && !m_blupiHide && !m_blupiCloud && !m_blupiPower)
+ {
+ m_jauges[1].SetHide(TRUE);
+ }
+ if (!m_blupiHelico && !m_blupiOver)
+ {
+ StopSound(SOUND_HELICOHIGH);
+ StopSound(SOUND_HELICOLOW);
+ }
+ if (m_blupiJeep && m_blupiTank)
+ {
+ StopSound(SOUND_JEEPHIGH);
+ StopSound(SOUND_JEEPLOW);
+ }
}
BOOL CDecor::GetSuperBlupi()
@@ -1475,7 +1453,7 @@ void CDecor::OutputNetDebug(char* text)
if (!m_bNetDebug) return;
- sprintf(textbuffer, "/ snd=%d(%d)_rcv=%d(%d)", m_netPacketsSent, m_netPacketsSent2, m_netPacketsRecieved, m_netPacketsRecieved2);
+ sprintf(textbuffer, "/ snd=%d(%d)_rcv=%d(%d)", m_netPacketsSent, m_netPacketsSent2, m_netPacketsReceived, m_netPacketsReceived2);
// ...?
}
@@ -1576,12 +1554,12 @@ void CDecor::VoyageDraw()
BOOL CDecor::DrawMap(BOOL bPlay, int team)
{
-
+ return FALSE;
}
BOOL CDecor::SearchWorld(int world, POINT *blupi, int *dir)
{
-
+ return FALSE;
}
BOOL CDecor::SearchDoor(int n, POINT *cel, POINT *blupi)
@@ -1595,34 +1573,34 @@ BOOL CDecor::SearchDoor(int n, POINT *cel, POINT *blupi)
{
if (i > 0 && m_decor[i - 1, j]->icon == 182)
{
- cel.x = i - 1;
- cel.y = j;
- blupi.x = (i - 2) * 64 + 2;
- blupi.y = j * 64 + BLUPIOFFY;
+ cel->x = i - 1;
+ cel->y = j;
+ blupi->x = (i - 2) * 64 + 2;
+ blupi->y = j * 64 + BLUPIOFFY;
return TRUE;
}
if (i > 1 && m_decor[i - 2, j]->icon == 182)
{
- cel.x = i - 2;
- cel.y = j;
- blupi.x = (i - 3) * 64 + 2;
- blupi.y = j * 64 + BLUPIOFFY;
+ cel->x = i - 2;
+ cel->y = j;
+ blupi->x = (i - 3) * 64 + 2;
+ blupi->y = j * 64 + BLUPIOFFY;
return TRUE;
}
if (i < 99 && m_decor[i + 1, j]->icon == 182)
{
- cel.x = i + 1;
- cel.y = j;
- blupi.x = (i + 2) * 64 + 2;
- blupi.y = j * 64 + BLUPIOFFY;
+ cel->x = i + 1;
+ cel->y = j;
+ blupi->x = (i + 2) * 64 + 2;
+ blupi->y = j * 64 + BLUPIOFFY;
return TRUE;
}
if (i < 98 && m_decor[i + 2, j]->icon == 182)
{
- cel.x = i + 2;
- cel.y = j;
- blupi.x = (i + 3) * 64 + 2;
- blupi.y = j * 64 + BLUPIOFFY;
+ cel->x = i + 2;
+ cel->y = j;
+ blupi->x = (i + 3) * 64 + 2;
+ blupi->y = j * 64 + BLUPIOFFY;
return TRUE;
}
}
@@ -1643,7 +1621,7 @@ void CDecor::OpenDoorsTresor()
for (int y = 0; y < MAXCELY; y++)
{
int icon = m_decor[x][y].icon;
- if (icon >= Object::DoorTreasure_1 && icon <= Object::DoorTreasure_1 + m_nbTresor - 1)
+ if (icon >= 0x1a5 && icon <= 0x1a5 + m_nbTresor - 1)
{
OpenDoor({ x, y });
}
@@ -1671,7 +1649,7 @@ void CDecor::OpenDoor(POINT cel)
m_moveObject[num].phase = 0;
m_moveObject[num].channel = CHOBJECT;
m_moveObject[num].icon = icon;
- PlaySound(33, m_moveObject[num].posStart);
+ PlaySound(33, m_moveObject[num].posStart, FALSE);
}
void CDecor::OpenDoorsWin()
@@ -1690,58 +1668,60 @@ void CDecor::DoorsLost()
// more...
}
-// BOOL CDecor::SearchGold(int n, POINT cel)
+// Winphone functions, likely unnecessary
+/*
+BOOL CDecor::SearchGold(int n, POINT cel)
{
- for (int i = 99; i >= 0; i--)
- {
- for (int j = 99; j >= 0; j--)
- {
- if (m_decor[j][i].icon == 183)
- {
- cel.x = j;
- cel.y = i;
- return TRUE;
- }
- }
- }
- return FALSE;
+for (int i = 99; i >= 0; i--)
+{
+for (int j = 99; j >= 0; j--)
+{
+if (m_decor[j][i].icon == 183)
+{
+cel.x = j;
+cel.y = i;
+return TRUE;
+}
+}
+}
+return FALSE;
}
-// BOOL CDecor::IsFloatingObject(int i)
+BOOL CDecor::IsFloatingObject(int i)
{
- POINT posCurrent = m_moveObject[i]->posCurrent;
- int num = (posCurrent.x + 32) / 64;
- int num2 = posCurrent.y / 64 + 1;
- int icon = m_decor[num, num2]->icon;
- return IsPassIcon(icon);
+POINT posCurrent = m_moveObject[i]->posCurrent;
+int num = (posCurrent.x + 32) / 64;
+int num2 = posCurrent.y / 64 + 1;
+int icon = m_decor[num, num2]->icon;
+return IsPassIcon(icon);
}
-// BOOL CDecor::IsNormalJump(POINT pos)
+BOOL CDecor::IsNormalJump(POINT pos)
{
- pos.x += 32;
- pos.y -= 32;
- if (m_blupiDir == 1)
- {
- pos.x -= 15;
- }
- else
- {
- pos.x += 15;
- }
- for (int i = 0; i < 2; i++)
- {
- int num = pos.x / DIMOBJX;
- int num2 = pos.y / DIMOBJY;
- if (num2 < 0)
- {
- return FALSE;
- }
- int icon = m_decor[num, num2]->icon;
- if (!IsPassIcon(icon))
- {
- return FALSE;
- }
- pos.y -= 64;
- }
- return TRUE;
-}
\ No newline at end of file
+pos.x += 32;
+pos.y -= 32;
+if (m_blupiDir == 1)
+{
+pos.x -= 15;
+}
+else
+{
+pos.x += 15;
+}
+for (int i = 0; i < 2; i++)
+{
+int num = pos.x / DIMOBJX;
+int num2 = pos.y / DIMOBJY;
+if (num2 < 0)
+{
+return FALSE;
+}
+int icon = m_decor[num, num2]->icon;
+if (!IsPassIcon(icon))
+{
+return FALSE;
+}
+pos.y -= 64;
+}
+return TRUE;
+}*/
\ No newline at end of file
diff --git a/decor.h b/src/decor.h
similarity index 73%
rename from decor.h
rename to src/decor.h
index cdf58b8..049d52b 100644
--- a/decor.h
+++ b/src/decor.h
@@ -1,9 +1,6 @@
// Decor.h
-
#pragma once
-#include
-
#include "DEF.H"
#include "JAUGE.H"
#include "SOUND.H"
@@ -15,16 +12,27 @@
#define MAXNETMESSAGE 20
#define MAXMOVEOBJECT 200
#define MAXNOTIF 4
+#define MAXNETPLAYER 4
+
+#define MAXQUART 441
+#define SCROLL_SPEED 8
+#define SCROLL_MARGX 80
+#define SCROLL_MARGY 40
+
+#define BLUPIFLOOR 2
+#define BLUPIOFFY 4 + BLUPIFLOOR
+#define BLUPISURF 12
+#define BLUPISUSPEND 12
+#define OVERHEIGHT 80
+
+#define TEXTDELAY 10 // tooltip popup delay
+#define NOTIFDELAY 200
-// Descripteur d'une cellule du décor.
typedef struct
{
short icon;
}
Cellule;
-// Cette structure doit être la plus petite possible, car
-// il en existe un tableau de 100x100 = 10'000 cellules !
-
typedef struct
{
@@ -46,11 +54,6 @@ typedef struct
}
MoveObject;
-typedef struct
-{
-}
-GameData;
-
typedef struct
{
char type;
@@ -61,6 +64,24 @@ typedef struct
}
NetMessage;
+typedef struct
+{
+ short majRev;
+ short minRev;
+ short reserve1[100];
+ POINT posDecor;
+ POINT dimDecor;
+ short world;
+ short music;
+ short region;
+ short reserve2[51];
+ POINT blupiPos[4];
+ int blupiDir[4];
+ char name[100];
+ short reserve3[196];
+}
+DescFile;
+
class CDecor
{
public:
@@ -69,7 +90,7 @@ public:
// Decor.cpp
void Create(HWND hWnd, CSound *pSound, CPixmap *pPixmap,
- CNetwork *pNetwork);
+ CNetwork *pNetwork);
BOOL LoadImages();
void InitGamer();
void InitDecor();
@@ -87,8 +108,9 @@ public:
POINT DecorNextAction();
void SetInput(int keys);
void SetJoystickEnable(BOOL bJoystick);
- void SetFieldD814(BOOL param_1);
+ void SetDemoPlay(BOOL param_1);
void PlaySound(int sound, POINT pos, BOOL bLocal);
+ void PlaySound(int sound, POINT pos); // hack
void StopSound(int sound);
void AdaptMotorVehicleSound(POINT pos);
void VehicleSoundsPhase(int phase);
@@ -132,7 +154,7 @@ public:
int SoundEnviron(int sound, int obstacle);
int IsWorld(POINT pos);
void ActiveSwitch(BOOL bState, POINT cel);
- char GetTypeBarre(POINT pos);
+ int GetTypeBarre(POINT pos);
BOOL IsLave(POINT pos);
BOOL IsPiege(POINT pos);
BOOL IsGoutte(POINT pos, BOOL bAlways);
@@ -152,7 +174,7 @@ public:
BOOL IsPassIcon(int icon);
BOOL IsBlocIcon(int icon);
BOOL IsVentillo(POINT pos);
- void ModifDecor(POINT pos, int icon, BOOL _foo);
+ void ModifDecor(POINT pos, int icon, BOOL bMulti=TRUE);
BOOL IsRightBorder(POINT cel, POINT offset);
BOOL IsFromage(POINT cel);
BOOL IsGrotte(POINT cel);
@@ -188,12 +210,12 @@ public:
void BlupiDead(int action, int action2);
POINT GetPosDecor(POINT pos);
void BlupiAddFifo(POINT pos);
- BOOL DecorDetect(RECT rect, BOOL bCaisse);
+ BOOL DecorDetect(RECT rect, BOOL bCaisse=TRUE);
void GetBlupiInfo(BOOL *pbHelico, BOOL *pbJeep, BOOL *pbSkate,
BOOL *pbNage);
// DecMove.cpp
- BOOL TestPath(RECT rect, POINT start, POINT end);
+ BOOL TestPath(RECT rect, POINT start, POINT *end);
void MoveObjectPollution();
void MoveObjectPlouf(POINT pos);
void MoveObjectTiplouf(POINT pos);
@@ -207,13 +229,14 @@ public:
int SearchDistRight(POINT pos, POINT dir, int type);
void StartSploutchGlu(POINT pos);
BOOL ObjectStart(POINT pos, int type, int speed);
+ BOOL ObjectStart(POINT pos, int type, int speed, BOOL bMulti);
BOOL ObjectDelete(POINT pos, int type);
void MoveObjectStep();
void MoveObjectStepLine(int i);
- void* MoveObjectStepIcon(int i);
+ void MoveObjectStepIcon(int i);
void DynamiteStart(int i, int dx, int dy);
int AscenseurDetect(RECT rect, POINT oldpos, POINT newpos);
- int AscenseurVertigo(int i, BOOL *bVertigoLeft, BOOL *bVertigoRight);
+ void AscenseurVertigo(int i, BOOL *pbVertigoLeft, BOOL *pbVertigoRight);
BOOL AscenseurShift(int i);
void AscenseurSynchro(int i);
void UpdateCaisse();
@@ -246,7 +269,7 @@ public:
void NetFUN_155e0(BYTE _foo, short _bar);
void TreatNetData();
void DoNetSmooth(int player);
- void NetFUN_15d50();
+ void NetAdjustToLift();
void FUN_15da0(int rank, short step);
void NetPlayerCollide(POINT pos, int *out);
void NetMessageIndexFlush();
@@ -256,15 +279,15 @@ public:
void NotifPop();
void NotifPush(char *str);
void NotifStep();
-
+
// DecIO.cpp
void GetMissionPath(char *out, int gamer, int mission, BOOL bUser);
- BOOL CurrentWrite(int gamer, int mission, BOOL bUser);
- BOOL CurrentRead(int gamer, int mission, BOOL bUser);
+ BOOL Write(int gamer, int mission, BOOL bUser);
+ BOOL Read(int gamer, int mission, BOOL bUser);
BOOL SomethingMissionPath(int gamer, int mission, BOOL bUser);
BOOL MissionStart(int gamer, int mission, BOOL bUser);
- BOOL Read(int gamer, int mission, BOOL *pbMission, BOOL *pbPrivate);
- BOOL Write(int gamer, int mission, char* param3);
+ BOOL CurrentRead(int gamer, int mission, BOOL *pbMission, BOOL *pbPrivate);
+ BOOL CurrentWrite(int gamer, int mission, char* param3);
BOOL SearchWorld(int world, POINT *blupi, int *dir);
BOOL SearchDoor(int n, POINT *cel, POINT *blupi);
@@ -275,27 +298,29 @@ public:
void OpenGoldsWin();
void DoorsLost();
+ inline BOOL IsValidCel(POINT cel);
+ inline void MoveObjectCopy(MoveObject src, MoveObject dest);
inline void StopVehicleSound();
protected:
HWND m_hWnd;
CSound* m_pSound;
CPixmap* m_pPixmap;
- CNetwork* m_pNetwork;
- Cellule m_decor[MAXCELX][MAXCELY];
+ CNetwork* m_pNetwork;
+ Cellule m_decor[MAXCELX][MAXCELY];
Cellule m_bigDecor[MAXCELX][MAXCELY];
- byte m_balleTraj[MAXCELX][MAXCELY/8+1];
- byte m_moveTraj[MAXCELX][MAXCELY/8+1];
- MoveObject m_moveObject[MAXMOVEOBJECT];
- int m_keyPress;
- int m_lastKeyPress;
- POINT m_posDecor;
- POINT m_dimDecor;
- POINT m_posCelHili;
+ byte m_balleTraj[MAXCELX * MAXCELY / 8 + 1];
+ byte m_moveTraj[MAXCELX * MAXCELY / 8 + 1];
+ MoveObject m_moveObject[MAXMOVEOBJECT];
+ int m_keyPress;
+ int m_lastKeyPress;
+ POINT m_posDecor;
+ POINT m_dimDecor;
+ POINT m_posCelHili;
POINT m_dimCelHili;
int m_2ndPositionCalculationSlot;
- int m_phase;
- int m_term;
+ int m_phase;
+ int m_term;
int m_music;
int m_region;
int m_lastRegion;
@@ -303,40 +328,40 @@ protected:
int m_time;
char m_missionTitle[100];
BOOL m_bPause;
- int m_nbRankCaisse;
+ int m_nbRankCaisse;
int m_rankCaisse[MAXMOVEOBJECT];
int m_nbLinkCaisse;
int m_linkCaisse[MAXMOVEOBJECT];
- POINT m_blupiPos;
- POINT m_blupiValidPos;
- int m_blupiAction;
- int m_blupiDir;
- int m_blupiPhase;
- POINT m_blupiVitesse;
- int m_blupiIcon;
+ POINT m_blupiPos;
+ POINT m_blupiValidPos;
+ int m_blupiAction;
+ int m_blupiDir;
+ int m_blupiPhase;
+ POINT m_blupiVitesse;
+ int m_blupiIcon;
int m_blupiSec;
int m_blupiChannel;
POINT m_blupiVector;
int m_blupiTransport;
BOOL m_blupiFocus;
- BOOL m_blupiAir;
- BOOL m_blupiHelico;
- BOOL m_blupiOver;
- BOOL m_blupiJeep;
- BOOL m_blupiTank;
- BOOL m_blupiSkate;
- BOOL m_blupiNage;
- BOOL m_blupiSurf;
- BOOL m_blupiVent;
- BOOL m_blupiSuspend;
- BOOL m_blupiJumpAie;
- BOOL m_blupiShield;
- BOOL m_blupiPower;
- BOOL m_blupiCloud;
- BOOL m_blupiHide;
+ BOOL m_blupiAir;
+ BOOL m_blupiHelico;
+ BOOL m_blupiOver;
+ BOOL m_blupiJeep;
+ BOOL m_blupiTank;
+ BOOL m_blupiSkate;
+ BOOL m_blupiNage;
+ BOOL m_blupiSurf;
+ BOOL m_blupiVent;
+ BOOL m_blupiSuspend;
+ BOOL m_blupiJumpAie;
+ BOOL m_blupiShield;
+ BOOL m_blupiPower;
+ BOOL m_blupiCloud;
+ BOOL m_blupiHide;
BOOL m_blupiInvert;
- BOOL m_blupiBalloon;
- BOOL m_blupiEcrase;
+ BOOL m_blupiBalloon;
+ BOOL m_blupiEcrase;
POINT m_blupiPosHelico;
POINT m_blupiPosMagic;
BOOL m_blupiRestart;
@@ -366,7 +391,7 @@ protected:
int m_netIcons[MAXNETPLAYER];
int m_netUnk1[MAXNETPLAYER];
int m_netUnk2[MAXNETPLAYER];
- int m_netUnk3[MAXNETPLAYER];
+ int m_netTransports[MAXNETPLAYER]; // index of lift ridden by each player, or -1
int m_netPlayerPacketsReceived[MAXNETPLAYER];
int m_netPlayerPacketsReceived2[MAXNETPLAYER];
int m_netTimeSincePacket[MAXNETPLAYER];
@@ -392,28 +417,28 @@ protected:
BOOL m_bCheatDoors; // opendoors
BOOL m_bSuperBlupi; // megablupi
BOOL m_bDrawSecret; // showsecret
- BOOL m_bBuildOfficialMissions; // xmission/xnjttjpo
- BOOL m_bNetPacked; // netpacked
- BOOL m_bNetMovePredict; // ynosmooth
- BOOL m_bNetDebug; // znetdebug
+ BOOL m_bBuildOfficialMissions; // xmission/xnjttjpo
+ BOOL m_bNetPacked; // netpacked
+ BOOL m_bNetMovePredict; // ynosmooth
+ BOOL m_bNetDebug; // znetdebug
BOOL m_bJoystick;
int m_bD814;
- int m_mission;
+ int m_mission;
BYTE m_doors[200];
- int m_nbVies;
- int m_nbTresor;
- int m_totalTresor;
+ int m_nbVies;
+ int m_nbTresor;
+ int m_totalTresor;
int m_goalPhase;
int m_detectIcon;
int m_D8F8;
- POINT m_scrollPoint;
- POINT m_scrollAdd;
- int m_voyageIcon;
- int m_voyageChannel;
- int m_voyagePhase;
- int m_voyageTotal;
- POINT m_voyageStart;
- POINT m_voyageEnd;
+ POINT m_scrollPoint;
+ POINT m_scrollAdd;
+ int m_voyageIcon;
+ int m_voyageChannel;
+ int m_voyagePhase;
+ int m_voyageTotal;
+ POINT m_voyageStart;
+ POINT m_voyageEnd;
int m_decorAction;
int m_decorPhase;
int m_lastDecorIndexes[200];
@@ -421,7 +446,24 @@ protected:
BYTE dummy[100000];
};
-POINT GetCel (int x, int y);
-POINT GetCel (POINT cel, int x, int y);
-inline BOOL IsValidCel (POINT cel);
-POINT GetVector (int direct);
\ No newline at end of file
+POINT GetCel(int x, int y);
+POINT GetCel(POINT cel, int x, int y);
+POINT GetVector(int direct);
+
+inline BOOL CDecor::IsValidCel(POINT cel)
+{
+ return cel.x >= 0 && cel.x < MAXCELX && cel.y >= 0 && cel.y < MAXCELY;
+}
+
+inline void CDecor::MoveObjectCopy(MoveObject src, MoveObject dest)
+{
+ memcpy(&dest, &src, sizeof(dest));
+}
+
+inline void CDecor::StopVehicleSound()
+{
+ StopSound(SOUND_HELICOHIGH);
+ StopSound(SOUND_HELICOLOW);
+ StopSound(SOUND_JEEPHIGH);
+ StopSound(SOUND_JEEPLOW);
+}
\ No newline at end of file
diff --git a/src/dectables.h b/src/dectables.h
new file mode 100644
index 0000000..9990daa
--- /dev/null
+++ b/src/dectables.h
@@ -0,0 +1,552 @@
+#pragma once
+#include "obstacle.h"
+
+extern int table_blitz[]
+{
+ 0, 7, 15, 18, 26, 27, 32, 39, 45, 47,
+ 50, 58, 60, 62, 64, 66, 68, 70, 71, 72,
+ -1
+};
+
+extern int table_vitesse_march[]
+{
+ 2, 4, 6, 8
+};
+
+extern int table_vitesse_nage[]
+{
+ 2, 1, 5, 10, 8, 6, 4
+};
+
+extern int table_vitesse_surf[]
+{
+ 0, 2, 5, 8, 3, 0
+};
+
+extern int table_bulldozer_left[8]{ 66, 66, 67, 67, 66, 66, 65, 65 };
+
+extern int table_bulldozer_right[8]{ 58, 58, 57, 57, 58, 58, 59, 59 };
+
+extern int table_bulldozer_turn2l[22]
+{
+ 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[22]
+{
+ 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[8]{ 82, 82, 81, 81, 82, 82, 83, 83 };
+
+extern int table_poisson_right[8]{ 79, 79, 78, 78, 79, 79, 80, 80 };
+
+extern int table_poisson_turn2l[48]
+{
+ 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[48]
+{
+ 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[8]{ 98, 99, 100, 101, 102, 103, 104, 105 };
+
+extern int table_oiseau_right[8]{ 90, 91, 92, 93, 94, 95, 96, 97 };
+
+extern int table_oiseau_turn2l[10]{ 106, 107, 108, 109, 110, 111, 112, 113, 105, 105 };
+
+extern int table_oiseau_turn2r[10]{ 114, 115, 116, 117, 118, 119, 120, 121, 97, 97 };
+
+extern int table_guepe_left[6]{ 195, 196, 197, 198, 197, 196 };
+
+extern int table_guepe_right[6]{ 199, 200, 201, 202, 201, 200 };
+
+extern int table_guepe_turn2l[5]{ 207, 206, 205, 204, 203 };
+
+extern int table_guepe_turn2r[5]{ 203, 204, 205, 206, 207 };
+
+extern int table_creature_left[8]{ 247, 248, 249, 250, 251, 250, 249, 248 };
+
+extern int table_creature_right[8]{ 247, 248, 249, 250, 251, 250, 249, 248 };
+
+extern int table_creature_turn2[152]
+{
+ 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[8]{ 66, 67, 68, 67, 66, 69, 70, 69 };
+
+extern int table_blupih_right[8]{ 61, 62, 63, 62, 61, 64, 65, 64 };
+
+extern int table_blupih_turn2l[26]
+{
+ 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[26]
+{
+ 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[8]{ 249, 249, 250, 250, 249, 249, 248, 248 };
+
+extern int table_blupit_right[8]{ 238, 238, 237, 237, 238, 238, 239, 239 };
+
+extern int table_blupit_turn2l[24]
+{
+ 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[24]
+{
+ 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_explo1[39]
+{
+ 0, 0, 1, 1, 2, 2, 3, 3, 4, 3,
+ 4, 4, 3, 4, 3, 3, 4, 4, 5, 5,
+ 4, 5, 6, 5, 6, 6, 5, 5, 6, 7,
+ 7, 8, 8, 9, 9, 10, 10, 11, 11
+};
+
+extern int table_explo2[20]
+{
+ 12, -1, 13, 14, -1, 15, 13, -1, 14, 15,
+ 12, -1, 13, 15, 14, 14, -1, 14, 15, 13
+};
+
+extern int table_explo3[20]
+{
+ 32, 32, 34, 34, 32, 32, 34, 34, 32, 32,
+ 34, 34, 32, 32, 35, 35, 32, 32, 35, 35
+};
+
+extern int table_explo4[9]{ 12, 13, 14, 15, 7, 8, 9, 10, 11 };
+
+extern int table_explo5[12]
+{
+ 54, -1, 55, -1, 56, -1, 57, -1, 58, -1,
+ 59, -1
+};
+
+extern int table_explo6[6]{ 54, 55, 56, 57, 58, 59 };
+
+extern int table_explo7[128]
+{
+ 60, 61, -1, 63, 64, 65, 62, 64, 62, 60,
+ 62, -1, 65, -1, 60, 65, 63, 61, 62, -1,
+ 64, 65, -1, 62, 64, 61, 62, 63, -1, 65,
+ 60, -1, 65, -1, 63, 65, -1, 61, 60, 65,
+ 62, 63, 64, -1, 62, 63, -1, 62, 62, 60,
+ 62, -1, 65, -1, 60, 65, 64, 61, 62, 63,
+ -1, 65, 60, -1, 63, 61, 62, -1, 64, 65,
+ -1, 62, 62, 60, 62, -1, 65, -1, 60, 65,
+ 60, 61, -1, 63, 64, 65, 62, 64, 63, 61,
+ 62, -1, 64, 65, -1, 62, 60, 61, -1, 63,
+ 64, 65, 62, 64, -1, 60, -1, -1, 65, -1,
+ 60, -1, 63, -1, 62, -1, -1, 65, -1, -1,
+ -1, 61, -1, -1, -1, 60, -1, -1
+};
+
+extern int table_explo8[5]{ 7, 8, 9, 10, 11 };
+
+extern int table_sploutch1[10]{ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 };
+
+extern int table_sploutch2[13]
+{
+ -1, -1, -1, 90, 91, 92, 93, 94, 95, 96,
+ 97, 98, 99
+};
+
+extern int table_sploutch3[18]
+{
+ -1, -1, -1, -1, -1, -1, -1, -1, 90, 91,
+ 92, 93, 94, 95, 96, 97, 98, 99
+};
+
+extern int table_tentacule[45]
+{
+ 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_bridge[157]
+{
+ 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_pollution[8]{ 179, 180, 181, 182, 183, 184, 185, 186 };
+
+extern int table_invertstart[8]{ 179, 180, 181, 182, 183, 184, 185, 186 };
+
+extern int table_invertstop[8]{ 186, 185, 184, 183, 182, 181, 180, 179 };
+
+extern int table_invertpanel[8]{ 187, 188, 189, 190, 191, 192, 193, 194 };
+
+extern int table_plouf[7]{ 99, 100, 101, 102, 101, 100, 99 };
+
+extern int table_tiplouf[3]{ 244, 99, 244 };
+
+extern int table_blup[20]
+{
+ 103, 104, 105, 106, 104, 103, 106, 105, 103, 104,
+ 103, 105, 106, 103, 105, 106, 103, 104, 106, 105
+};
+
+extern int table_follow1[26]
+{
+ 256, 256, 256, 257, 257, 258, 259, 260, 261, 262,
+ 263, 264, 264, 265, 265, 265, 264, 264, 263, 262,
+ 261, 260, 259, 258, 257, 257
+};
+
+extern int table_follow2[5]{ 256, 258, 260, 262, 264 };
+
+extern int table_cle[12]
+{
+ 122, 123, 124, 125, 126, 127, 128, 127, 126, 125,
+ 124, 123
+};
+
+extern int table_cle1[12]
+{
+ 209, 210, 211, 212, 213, 214, 215, 214, 213, 212, 211, 210
+};
+
+extern int table_cle2[12]
+{
+ 220, 221, 222, 221, 220, 219, 218, 217, 216, 217, 218, 219
+};
+
+extern int table_cle3[12]
+{
+ 229, 228, 227, 226, 225, 224, 223, 224, 225, 226, 227, 228
+};
+
+extern int table_decor_action[]
+{
+ 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]
+{
+ 253, 252, 254, 252, 252, 255, 252, 254, 253, 252,
+ 253, 254, 255, 252, 255, 253, 252, 254, 252, 255,
+ 253, 254, 252, 253, 255, 254, 255, 252, 253, 254,
+ 255, 252, 253, 254, 255, 254, 254, 253, 254, 255,
+ 253, 252, 255, 254, 255, 253, 252, 254, 253, 255,
+ 253, 254, 252, 253, 255, 254, 252, 255, 253, 254,
+ 255, 253, 252, 254, 255, 254, 252, 253, 254, 255,
+ 253, 254, 255, 254, 255, 253, 252, 254, 253, 255,
+ 253, 254, 255, 253, 255, 254, 255, 252, 253, 254,
+ 255, 253, 253, 254, 255, 254, 252, 253, 254, 255
+};
+
+extern int table_skate[34]
+{
+ 129, 129, 129, 129, 130, 130, 130, 131, 131, 132,
+ 132, 133, 133, 134, 134, 134, 135, 135, 135, 135,
+ 134, 134, 134, 133, 133, 132, 132, 131, 131, 131,
+ 130, 130, 130, 130
+};
+
+extern int table_glu[25]
+{
+ 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[70]
+{
+ 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[90]
+{
+ 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
+};
+
+extern int table_chenille[6]{ 311, 312, 313, 314, 315, 316 };
+
+extern int table_chenillei[6]{ 316, 315, 314, 313, 312, 311 };
+
+extern int table_adapt_decor[144]
+{
+ 153, 147, 148, 146, 40, 151, 150, 144, 39, 152,
+ 149, 145, 38, 36, 37, 35, 153, 147, 148, 146,
+ 40, 151, 150, 144, 39, 152, 149, 145, 38, 36,
+ 37, 156, 75, 75, 155, 155, 75, 75, 155, 155,
+ 74, 74, 154, 154, 75, 75, 155, 155, 157, 157,
+ 157, 157, 109, 109, 109, 109, 108, 108, 108, 108,
+ 107, 107, 107, 107, 202, 202, 138, 138, 202, 202,
+ 138, 138, 202, 202, 138, 138, 202, 202, 138, 138,
+ 283, 283, 283, 283, 262, 262, 262, 262, 263, 263,
+ 263, 263, 261, 261, 261, 261, 361, 359, 360, 352,
+ 357, 353, 355, 349, 358, 354, 356, 350, 351, 347,
+ 348, 341, 387, 387, 386, 386, 394, 394, 392, 392,
+ 395, 395, 393, 393, 397, 397, 396, 396, 251, 254,
+ 254, 254, 251, 258, 260, 258, 251, 257, 259, 257,
+ 251, 250, 256, 250
+};
+
+extern int table_adapt_fromage[32]
+{
+ -1, 265, 264, 268, 267, 273, 271, 275, 266, 272,
+ 270, 274, 269, 277, 276, 278, -1, 286, 285, 289,
+ 288, 294, 292, 296, 287, 293, 291, 295, 290, 298,
+ 297, 299
+};
+
+extern int table_shield[]
+{
+ 16,
+ 144, 145, 146, 147, 148, 149, 150, 151, 266, 267,
+ 268, 269, 270, 271, 272, 273
+};
+
+extern int table_shield_blupi[]
+{
+ 16,
+ 144, 145, 146, 147, 148, 149, 150, 151, 266, 267,
+ 268, 269, 270, 271, 272, 273
+};
+
+extern int table_power[]{ 8, 136, 137, 138, 139, 140, 141, 142, 143 };
+
+extern int table_invert[]
+{
+ 20,
+ 187, 187, 187, 188, 189, 190, 191, 192, 193, 194,
+ 187, 187, 187, 194, 193, 192, 191, 190, 189, 188
+};
+
+extern int table_charge[]{ 6, 238, 239, 240, 241, 242, 243 };
+
+extern int table_magicloop[]{ 5, 152, 153, 154, 155, 156 };
+
+extern int table_magictrack[]
+{
+ 24,
+ 152, 153, 154, 155, 156, 152, 153, 154, 155, 156,
+ 157, 158, 159, 160, 157, 158, 159, 160, 161, 162,
+ 163, 164, 165, 166
+};
+
+extern int table_shieldloop[]{ 5, 274, 275, 276, 277, 278 };
+
+extern int table_shieldtrack[]
+{
+ 20,
+ 274, 275, 276, 277, 278, 274, 275, 276, 277, 278,
+ 279, 280, 281, 282, 283, 284, 285, 286, 287, 288
+};
+
+extern int table_drinkeffect[]{ 5, 274, 275, 276, 277, 278 };
+
+extern int table_drinkoffset[]{ 3, 0, 7, 22 };
+
+extern int table_tresortrack[]
+{
+ 11,
+ 166, 165, 164, 163, 162, 161, 162, 163, 164, 165,
+ 166
+};
+
+extern int table_decor_piege1[]
+{
+ 16,
+ 374, 374, 373, 347, 373, 374, 374, 374, 373, 347,
+ 347, 373, 374, 374, 374, 374
+};
+
+extern int table_decor_piege2[]{ 4, 374, 373, 347, 373 };
+
+extern int table_decor_goutte[]
+{
+ 48,
+ 410, 409, 410, -1, -1, -1, -1, -1, -1, 410,
+ 409, 408, 409, 410, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 410, 409, 408, 407, 406, 405,
+ 404, 405, 406, 407, 408, 409, 410, -1, -1, -1,
+ -1, 410, 409, 410, -1, -1, -1, -1
+};
+
+extern int table_decor_ecraseur[]{ 10, 317, 317, 318, 319, 320, 321, 322, 323, 323, 323 };
+
+extern int table_decor_scie[]{ 6, 378, 379, 380, 381, 382, 383 };
+
+extern int table_decor_temp[]
+{
+ 20,
+ 328, 328, 327, 327, 326, 326, 325, 325, 324, 324,
+ 325, 325, 326, 326, 327, 329, 328, 328, -1, -1
+};
+
+extern int table_decor_eau1[]{ 6, 92, 93, 94, 95, 94, 93 };
+
+extern int table_decor_eau2[]{ 6, 91, 96, 97, 98, 97, 96 };
+
+
+
+extern int table_decor_ventillod[]{ 3, 129, 130, 131 };
+
+extern int table_decor_ventilloh[]{ 3, 132, 133, 134 };
+
+extern int table_decor_ventillob[]{ 3, 135, 136, 137 };
+
+
+
+extern int table_decor_ventd[]{ 4, 114, 115, 116, 117 };
+
+extern int table_decor_venth[]{ 4, 118, 119, 120, 121 };
+
+extern int table_decor_ventb[]{ 4, 122, 123, 124, 125 };
+
+extern int table_marine[]
+{
+ 0, 2, 5, 8, 3, 0
+};
+
+extern int table_36418[]{ 14, 10, 2, 3, 4, 5, 6, 7, 8, 9, 1, 11, 12, 13, 14 };
+extern int table_36458[]{ 10, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29 };
+extern int table_36488[]{ 4, 15, 16, 17, 18 };
+extern int table_364a0[]{ 2, 73, 22 };
+extern int table_364b0[]{ 7, 78, 79, 80, 81, 82, 83, 84 };
+extern int table_364d0[]{ 4, 87, 88, 89, 90 };
+extern int table_364e8[]{ 2, 85, 86 };
+extern int table_364f8[]{ 5, 396, 388, 389, 390, 391 };
+extern int table_36510[]{ 3, 398, 399, 400 };
+extern int table_36520[]{ 3, 87, 88, 89 };
+extern int table_36530[]{ 1, 0x99 };
+extern int table_36538[]{ 2, 0x9a, 0x9b };
+extern int table_36548[]{ 1, 0xb9 };
+extern int table_36550[]{ 7, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f };
+extern int table_36570[]{ 12, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xe6, 0xe7, 0xe9, 0xea };
+extern int table_365a8[]{ 8, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe8 };
+extern int table_365d0[]{ 1, 0x9d };
+extern int table_365d8[]{ 5, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f };
+extern int table_365f0[]{ 7, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0 };
+extern int table_36610[]{ 5, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5 };
+extern int table_decor_lave[]{ 8, 68, 69, 70, 71, 72, 71, 70, 69 };
+extern int table_36630[]{ 2, 0x5b, 0x5c };
+extern int table_decor_ventillog[]{ 3, 126, 127, 128 };
+extern int table_decor_ventg[]{ 4, 110, 111, 112, 113 };
+extern int table_36670[]{ 11, 0x4c, 0x4d, 0xc7, 0xc6, 0xc8, 0xc9, 0xeb, 0xec, 0x177, 0x178, 0x179 };
+extern int table_366a0[]{ 3, 0x193, 0x191, 0x192 };
+extern int table_366b0[]{ 3, 20, 21, 22 };
+extern int table_366c0[]{ 4, 16, 17, 18, 19 };
+extern int table_366d8[]{ 3, 23, 24, 25 };
+extern int table_366e8[]{ 2, 0x1a, 0x1b };
+extern int table_366f8[]{ 4, 0x1c, 0x1d, 0x1e, 0x1f };
+extern int table_36710[]{ 12, 0x2d, 0x2e, 0x2f, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c};
+extern int table_36748[]{ 4, 0x42, 0x43, 0x44, 0x45 };
+
+
+
+
+extern int table_ressort[] // i dont really care to look this up right now so heres some bs
+{
+ 8,1,2,3,4,5,5,6,7,7
+};
\ No newline at end of file
diff --git a/def.h b/src/def.h
similarity index 57%
rename from def.h
rename to src/def.h
index 6cc2525..10eb3d7 100644
--- a/def.h
+++ b/src/def.h
@@ -8,18 +8,25 @@
// prevent WinAPI from overriding our functions
#undef PlaySound
#undef DrawText
+#undef GetCharWidth
#define _DEMO FALSE // TRUE=demo, FALSE=complet
-#define _INTRO FALSE // TRUE si images d'introduction
#define _EGAMES FALSE // TRUE version pour eGames
#define _SE FALSE // TRUE eGames Special Edition
-#define _NOCD TRUE
+#define _INTRO FALSE // TRUE si images d'introduction
+
+// additional flags
+#define _CD FALSE // whether to require the game CD
+#define _BYE !_EGAMES // whether to show exit image (like _INTRO)
#define MAXGAMER 8
#define LXIMAGE 640 // dimensions de la fenêtre de jeu
#define LYIMAGE 480
+#define POSDRAWX 0
+#define POSDRAWY 0
+
#define MAXCELX 100 // nb max de cellules d'un monde
#define MAXCELY 100
@@ -41,88 +48,70 @@
#define DIMJAUGEX 124 // dimensions de la jauge
#define DIMJAUGEY 22
-#define POSSTATX 12
-#define POSSTATY 220
-
-#define DIMSTATX 60
-#define DIMSTATY 30
-
#define DIMTEXTX 16 // dimensions max d'un caractère
#define DIMTEXTY 16
#define DIMLITTLEX 16 // dimensions max d'un petit caractère
#define DIMLITTLEY 12
-#define CHDECOR 0
-#define CHOBJECT 1
-#define CHBLUPI 2
-#define CHBACK 3
-#define CHBUTTON 4
-#define CHJAUGE 5
-#define CHTEXT 6
-#define CHLITTLE 7
-#define CHMAP 8
-#define CHEXPLO 9
-#define CHELEMENT 10
-#define CHBLUPI1 11
-#define CHBLUPI2 12
-#define CHBLUPI3 13
-#define CHTEMP 14
-
-namespace Ch {
- enum Ch {
- Decor = 0,
- Object,
- Blupi,
- Back,
- Button,
- Jauge,
- Text,
- Little,
- Map,
- Explo,
- Element,
- Blupi_1,
- Blupi_2,
- Blupi_3,
- Temp
- };
+enum {
+ CHBACK = 0,
+ CHOBJECT,
+ CHBLUPI,
+ CHDECOR,
+ CHBUTTON,
+ CHJAUGE,
+ CHTEXT,
+ CHLITTLE,
+ CHMAP,
+ CHEXPLO,
+ CHELEMENT,
+ CHBLUPI1,
+ CHBLUPI2,
+ CHBLUPI3,
+ CHTEMP
};
-#define MESS_RESUME 0
-#define MESS_PAUSE 1
-#define MESS_LOBBY 4
-#define MESS_LEAVE 8
-#define MESS_LOST 9
-#define MESS_START 10
-#define MESS_PAUSE2 12
-#define MESS_OBJECTSTART 20
-#define MESS_OBJECTDELETE 21
-#define MESS_MODIFDECOR 30
-#define MESS_PLAYSOUND 40
-#define MESS_STOPSOUND 41
-#define MESS_ASCENSEURSTART 50
-#define MESS_ASCENSEUREND 51
-#define MESS_STOPCLOUD 60
+enum {
+ MESS_RESUME = 0,
+ MESS_PAUSE,
+ MESS_2,
+ MESS_3,
+ MESS_LOBBY,
+ MESS_5,
+ MESS_6,
+ MESS_7,
+ MESS_LEAVE,
+ MESS_LOST,
+ MESS_START,
+ MESS_11,
+ MESS_PAUSE2,
+
+ MESS_OBJECTSTART = 20,
+ MESS_OBJECTDELETE,
+
+ MESS_MODIFDECOR = 30,
+
+ MESS_PLAYSOUND = 40,
+ MESS_STOPSOUND,
+
+ MESS_ASCENSEURSTART = 50,
+ MESS_ASCENSEUREND,
+
+ MESS_STOPCLOUD = 60
+};
#define MAXNETMESSAGE 20
// Directions :
-#define DIR_LEFT 1
-#define DIR_RIGHT 2
-
-namespace Dir {
- enum Dir {
- Left = 1,
- Right
- };
+enum {
+ DIR_LEFT = 1,
+ DIR_RIGHT
};
-
// Actions :
-
#define ACTION_STOP 1
#define ACTION_MARCH 2
#define ACTION_TURN 3
@@ -211,114 +200,14 @@ namespace Dir {
#define ACTION_TAKEDYNAMITE 86
#define ACTION_PUTDYNAMITE 87
-namespace Action {
- enum Action {
- Stop = 1,
- March,
- Turn,
- Jump,
- Air,
- Down,
- Up,
- Vertigo,
- Recede,
- Advance,
- Clear_1,
- Set,
- Win,
- Push,
- StopHelico,
- MarchHelico,
- TurnHelico,
- StopNage,
- MarchNage,
- TurnNage,
- StopSurf,
- MarchSurf,
- TurnSurf,
- Drown,
- StopJeep,
- MarchJeep,
- TurnJeep,
- StopPop,
- Pop,
- Bye,
- StopSuspend,
- MarchSuspend,
- TurnSuspend,
- JumpSuspend,
- Hide,
- JumpAie,
- StopSkate,
- MarchSkate,
- TurnSkate,
- JumpSkate,
- AirSkate,
- TakeSkate,
- DeposeSkate,
- Ouf_1a,
- Ouf_1b,
- Ouf_2,
- Ouf_3,
- Ouf_4,
- Sucette,
- StopTank,
- MarchTank,
- TurnTank,
- FireTank,
- Glu,
- Drink,
- Charge,
- Electro,
- HelicoGlu,
- TurnAir,
- StopMarch,
- StopJump,
- StopJump_H,
- Mockery,
- Mockery_I,
- Ouf_5,
- Balloon,
- StopOver,
- MarchOver,
- TurnOver,
- Recede_Q,
- Advance_Q,
- StopEcrase,
- MarchEcrase,
- Teleporte,
- Clear_2,
- Clear_3,
- Clear_4,
- Clear_5,
- Clear_6,
- Clear_7,
- Clear_8,
- Switch,
- Mockery_P,
- Non,
- SlowDownSkate,
- TakeDynamite,
- PutDynamite
- };
-};
-
// Sécurités :
-#define SEC_SHIELD 1
-#define SEC_POWER 2
-#define SEC_CLOUD 3
-#define SEC_HIDE 4
-
-namespace Sec {
- enum Sec {
- Shield = 1,
- Power,
- Cloud,
- Hide
- };
-}
-
+enum {
+ SEC_SHIELD = 1,
+ SEC_POWER,
+ SEC_CLOUD,
+ SEC_HIDE
+};
// Types :
@@ -339,7 +228,7 @@ namespace Sec {
#define TYPE_BLUP 15
#define TYPE_BOMBEMOVE 16
#define TYPE_POISSON 17
-#define TYPE_TOMATES 18
+#define TYPE_TOMATES 18 // unused
#define TYPE_JEEP 19
#define TYPE_OISEAU 20
#define TYPE_CLE 21
@@ -394,102 +283,14 @@ namespace Sec {
#define TYPE_BOMBEPERSO3 202
#define TYPE_BOMBEPERSO4 203
-namespace Type {
- enum Type {
- Empty = 0,
- Ascenseur,
- BombeDown,
- BombeUp,
- Bulldozer,
- Tresor,
- Egg,
- Goal,
- Explo_1,
- Explo_2,
- Explo_3,
- Explo_4,
- Caisse,
- Helico,
- Plouf,
- Blup,
- BombeMove,
- Poisson,
- Tomates,
- Jeep,
- Oiseau,
- Cle,
- Door,
- Balle,
- Skate,
- Shield,
- Power,
- MagicTrack,
- Tank,
- Bullet,
- Drink,
- Charge,
- BlupiHelico,
- BlupiTank,
- Glu,
- Tiplouf,
- Pollution,
- Clear,
- Electro,
- TresorTrack,
- Invert,
- InvertStart,
- InvertStop,
- Unk_43,
- Guepe,
- Over,
- Ascenseur_S,
- Ascenseur_SI,
- Cle_1,
- Cle_2,
- Cle_3,
- Bridge,
- Tentacule,
- Creature,
- Dynamite,
- Dynamite_F,
- ShieldTrack,
- HideTrack,
- Explo_5,
- Explo_6,
- Explo_7,
- Explo_8,
- Explo_9,
- Explo_10,
- BombeFollow_1,
- BombeFollow_2,
- Sploutch_1,
- Sploutch_2,
- Sploutch_3,
-
- BombePerso_1 = 200,
- BombePerso_2,
- BombePerso_3,
- BombePerso_4
- };
-};
-
-
// Steps :
-#define STEP_STOPSTART 1
-#define STEP_ADVANCE 2
-#define STEP_STOPEND 3
-#define STEP_RECEDE 4
-
-namespace Step {
- enum Step {
- StopStart = 1,
- Advance,
- StopEnd,
- Recede
- };
-}
-
+enum {
+ STEP_STOPSTART = 1,
+ STEP_ADVANCE,
+ STEP_STOPEND,
+ STEP_RECEDE
+};
// Sons :
@@ -586,168 +387,24 @@ namespace Step {
#define SOUND_JUMPENDh 90
#define SOUND_JUMPTOCh 91
#define SOUND_FOLLOW 92
-
-namespace Sound {
- enum Sound {
- Click,
- Jump_1,
- Jump_2,
- JumpEnd,
- JumpToc,
- Turn,
- Vertigo,
- Down,
- Fall,
- New,
- Boum,
- Tresor,
- Egg,
- End_KO,
- End_OK,
- HelicoStart,
- HelicoHigh,
- HelicoStop,
- HelicoLow,
- LastTresor,
- Up,
- LookUp,
- Jump_0,
- Plouf,
- Blup,
- Surf,
- Drown,
- Error,
- JeepStart,
- JeepHigh,
- JeepStop,
- JeepLow,
- Bye,
- Door,
- SuspendToc,
- SuspendJump,
- Singe,
- Patient,
- Push,
- Pop,
- JumpAie,
- Ressort,
- StartShield,
- StopShield,
- StartPower,
- StopPower,
- Ouf_1,
- Ouf_2,
- Ouf_3,
- Ouf_4,
- Sucette,
- Glu,
- Fire_OK,
- Fire_KO,
- TakeGlu,
- StartCloud,
- StopCloud,
- Drink,
- Charge,
- Electro,
- PersoTake,
- PersoPose,
- StartHide,
- StopHide,
- Tiplouf,
- Mockery,
- InvertStart,
- InvertStop,
- OverStop,
- Blitz,
- Ecrase,
- Teleporte,
- Bridge_1,
- Bridge_2,
- Angel,
- Scie,
- SwitchOff,
- SwitchOn,
- JumpEnd_B, // bois
- JumpToc_B,
- JumpEnd_M, // metal
- JumpToc_M,
- JumpEnd_G, // grotte
- JumpToc_G,
- JumpEnd_O, // végétaux organiques
- JumpToc_O,
- JumpEnd_K, // kids stuff
- JumpToc_K,
- JumpEnd_F, // fromage
- JumpToc_F,
- JumpEnd_H, // herbe
- JumpToc_H,
- Follow
- };
-};
+#define SOUND_MOVIE 99
//
-#define KEY_LEFT (1 << 0)
-#define KEY_RIGHT (1 << 1)
-#define KEY_UP (1 << 2)
-#define KEY_DOWN (1 << 3)
-#define KEY_JUMP (1 << 4)
-#define KEY_FIRE (1 << 5)
-#define KEY_NONE 0
-
-namespace Key {
- enum Key {
- Left = 1 << 0,
- Right = 1 << 1,
- Up = 1 << 2,
- Down = 1 << 3,
- Jump = 1 << 4,
- Fire = 1 << 5
- };
+enum {
+ KEY_NONE = 0,
+ KEY_LEFT = 1,
+ KEY_RIGHT = 2,
+ KEY_UP = 4,
+ KEY_DOWN = 8,
+ KEY_JUMP = 16,
+ KEY_FIRE = 32
};
-
// Boutons (play) :
#define MAXBUTTON 40
-#define BUTTON_GO 0
-#define BUTTON_STOP 1
-#define BUTTON_MANGE 2
-#define BUTTON_CARRY 3
-#define BUTTON_DEPOSE 4
-#define BUTTON_ABAT 5
-#define BUTTON_ROC 6
-#define BUTTON_CULTIVE 7
-#define BUTTON_BUILD1 8
-#define BUTTON_BUILD2 9
-#define BUTTON_BUILD3 10
-#define BUTTON_BUILD4 11
-#define BUTTON_BUILD5 12
-#define BUTTON_BUILD6 13
-#define BUTTON_MUR 14
-#define BUTTON_PALIS 15
-#define BUTTON_ABATn 16
-#define BUTTON_ROCn 17
-#define BUTTON_PONT 18
-#define BUTTON_TOUR 19
-#define BUTTON_BOIT 20
-#define BUTTON_LABO 21
-#define BUTTON_FLEUR 22
-#define BUTTON_FLEURn 23
-#define BUTTON_DYNAMITE 24
-#define BUTTON_BATEAU 25
-#define BUTTON_DJEEP 26
-#define BUTTON_DRAPEAU 27
-#define BUTTON_EXTRAIT 28
-#define BUTTON_FABJEEP 29
-#define BUTTON_FABMINE 30
-#define BUTTON_FABDISC 31
-#define BUTTON_REPEAT 32
-#define BUTTON_DARMURE 33
-#define BUTTON_FABARMURE 34
-
-
// Lutins pour la souris
#define SPRITE_ARROW 1
@@ -768,138 +425,160 @@ namespace Key {
// User define message
-#define WM_UPDATE (WM_USER+1)
+enum {
+ WM_UPDATE = WM_USER + 1,
-#define WM_DECOR1 (WM_USER+20)
-#define WM_DECOR2 (WM_USER+21)
-#define WM_DECOR3 (WM_USER+22)
-#define WM_DECOR4 (WM_USER+23)
-#define WM_DECOR5 (WM_USER+24)
+ WM_DECOR1 = WM_USER + 20,
+ WM_DECOR2,
+ WM_DECOR3,
+ WM_DECOR4,
+ WM_DECOR5,
+ WM_DECOR6,
+ WM_DECOR7,
+ WM_DECOR8,
+ WM_DECOR9,
+ WM_DECOR10,
+ WM_DECOR11,
-#define WM_BUTTON0 (WM_USER+200)
-#define WM_BUTTON1 (WM_USER+201)
-#define WM_BUTTON2 (WM_USER+202)
-#define WM_BUTTON3 (WM_USER+203)
-#define WM_BUTTON4 (WM_USER+204)
-#define WM_BUTTON5 (WM_USER+205)
-#define WM_BUTTON6 (WM_USER+206)
-#define WM_BUTTON7 (WM_USER+207)
-#define WM_BUTTON8 (WM_USER+208)
-#define WM_BUTTON9 (WM_USER+209)
-#define WM_BUTTON10 (WM_USER+210)
-#define WM_BUTTON11 (WM_USER+211)
-#define WM_BUTTON12 (WM_USER+212)
-#define WM_BUTTON13 (WM_USER+213)
-#define WM_BUTTON14 (WM_USER+214)
-#define WM_BUTTON15 (WM_USER+215)
-#define WM_BUTTON16 (WM_USER+216)
-#define WM_BUTTON17 (WM_USER+217)
-#define WM_BUTTON18 (WM_USER+218)
-#define WM_BUTTON19 (WM_USER+219)
-#define WM_BUTTON20 (WM_USER+220)
-#define WM_BUTTON21 (WM_USER+221)
-#define WM_BUTTON22 (WM_USER+222)
-#define WM_BUTTON23 (WM_USER+223)
-#define WM_BUTTON24 (WM_USER+224)
-#define WM_BUTTON25 (WM_USER+225)
-#define WM_BUTTON26 (WM_USER+226)
-#define WM_BUTTON27 (WM_USER+227)
-#define WM_BUTTON28 (WM_USER+228)
-#define WM_BUTTON29 (WM_USER+229)
-#define WM_BUTTON30 (WM_USER+230)
-#define WM_BUTTON31 (WM_USER+231)
-#define WM_BUTTON32 (WM_USER+232)
-#define WM_BUTTON33 (WM_USER+233)
-#define WM_BUTTON34 (WM_USER+234)
-#define WM_BUTTON35 (WM_USER+235)
-#define WM_BUTTON36 (WM_USER+236)
-#define WM_BUTTON37 (WM_USER+237)
-#define WM_BUTTON38 (WM_USER+238)
-#define WM_BUTTON39 (WM_USER+239)
+ WM_BUTTON0 = WM_USER + 200,
+ WM_BUTTON1,
+ WM_BUTTON2,
+ WM_BUTTON3,
+ WM_BUTTON4,
+ WM_BUTTON5,
+ WM_BUTTON6,
+ WM_BUTTON7,
+ WM_BUTTON8,
+ WM_BUTTON9,
+ WM_BUTTON10,
+ WM_BUTTON11,
+ WM_BUTTON12,
+ WM_BUTTON13,
+ WM_BUTTON14,
+ WM_BUTTON15,
+ WM_BUTTON16,
+ WM_BUTTON17,
+ WM_BUTTON18,
+ WM_BUTTON19,
+ WM_BUTTON20,
+ WM_BUTTON21,
+ WM_BUTTON22,
+ WM_BUTTON23,
+ WM_BUTTON24,
+ WM_BUTTON25,
+ WM_BUTTON26,
+ WM_BUTTON27,
+ WM_BUTTON28,
+ WM_BUTTON29,
+ WM_BUTTON30,
+ WM_BUTTON31,
+ WM_BUTTON32,
+ WM_BUTTON33,
+ WM_BUTTON34,
+ WM_BUTTON35,
+ WM_BUTTON36,
+ WM_BUTTON37,
+ WM_BUTTON38,
+ WM_BUTTON39,
-#define WM_READ0 (WM_USER+300)
-#define WM_READ1 (WM_USER+301)
-#define WM_READ2 (WM_USER+302)
-#define WM_READ3 (WM_USER+303)
-#define WM_READ4 (WM_USER+304)
-#define WM_READ5 (WM_USER+305)
-#define WM_READ6 (WM_USER+306)
-#define WM_READ7 (WM_USER+307)
-#define WM_READ8 (WM_USER+308)
-#define WM_READ9 (WM_USER+309)
+ WM_DIMS1 = WM_USER + 241,
+ WM_DIMS2,
+ WM_DIMS3,
+ WM_DIMS4,
-#define WM_WRITE0 (WM_USER+310)
-#define WM_WRITE1 (WM_USER+311)
-#define WM_WRITE2 (WM_USER+312)
-#define WM_WRITE3 (WM_USER+313)
-#define WM_WRITE4 (WM_USER+314)
-#define WM_WRITE5 (WM_USER+315)
-#define WM_WRITE6 (WM_USER+316)
-#define WM_WRITE7 (WM_USER+317)
-#define WM_WRITE8 (WM_USER+318)
-#define WM_WRITE9 (WM_USER+319)
+ WM_READ0 = WM_USER + 300,
+ WM_READ1,
+ WM_READ2,
+ WM_READ3,
+ WM_READ4,
+ WM_READ5,
+ WM_READ6,
+ WM_READ7,
+ WM_READ8,
+ WM_READ9,
+ WM_WRITE0,
+ WM_WRITE1,
+ WM_WRITE2,
+ WM_WRITE3,
+ WM_WRITE4,
+ WM_WRITE5,
+ WM_WRITE6,
+ WM_WRITE7,
+ WM_WRITE8,
+ WM_WRITE9,
-#define WM_PHASE_INIT (WM_USER+500)
-#define WM_PHASE_PLAY (WM_USER+501)
-#define WM_PHASE_BUILD (WM_USER+502)
-#define WM_PHASE_READ (WM_USER+503)
-#define WM_PHASE_WRITE (WM_USER+504)
-#define WM_PHASE_INFO (WM_USER+505)
-#define WM_PHASE_BUTTON (WM_USER+506)
-#define WM_PHASE_TERM (WM_USER+507)
-#define WM_PHASE_WIN (WM_USER+508)
-#define WM_PHASE_LOST (WM_USER+509)
-#define WM_PHASE_STOP (WM_USER+510)
-#define WM_PHASE_SETUP (WM_USER+511)
-#define WM_PHASE_MUSIC (WM_USER+512)
-#define WM_PHASE_PLAYMOVIE (WM_USER+513)
-#define WM_PHASE_WINMOVIE (WM_USER+514)
-#define WM_PHASE_SCHOOL (WM_USER+515)
-#define WM_PHASE_MISSION (WM_USER+516)
-#define WM_PHASE_LASTWIN (WM_USER+517)
-#define WM_PHASE_WRITEp (WM_USER+518)
-#define WM_PHASE_SETUPp (WM_USER+519)
-#define WM_PHASE_REGION (WM_USER+520)
-#define WM_PHASE_INSERT (WM_USER+521)
-#define WM_PHASE_HISTORY0 (WM_USER+522)
-#define WM_PHASE_HISTORY1 (WM_USER+523)
-#define WM_PHASE_HELP (WM_USER+524)
-#define WM_PHASE_H0MOVIE (WM_USER+525)
-#define WM_PHASE_H1MOVIE (WM_USER+526)
-#define WM_PHASE_H2MOVIE (WM_USER+527)
-#define WM_PHASE_TESTCD (WM_USER+528)
-#define WM_PHASE_MANUEL (WM_USER+529)
-#define WM_PHASE_PRIVATE (WM_USER+530)
-#define WM_PHASE_UNDO (WM_USER+531)
-#define WM_PHASE_BYE (WM_USER+532)
-#define WM_PHASE_SKILL1 (WM_USER+533)
-#define WM_PHASE_SKILL2 (WM_USER+534)
-#define WM_PHASE_DEMO (WM_USER+535)
-#define WM_PHASE_INTRO1 (WM_USER+536)
-#define WM_PHASE_INTRO2 (WM_USER+537)
-#define WM_PHASE_PLAYTEST (WM_USER+538)
-#define WM_PHASE_WINMOVIEDESIGN (WM_USER+539)
-#define WM_PHASE_WINMOVIEMULTI (WM_USER+540)
+ WM_PHASE_INIT = WM_USER + 500,
+ WM_PHASE_PLAY,
+ WM_PHASE_BUILD,
+ WM_PHASE_NAMEGAMER,
+ WM_PHASE_CLEARGAMER,
+ WM_PHASE_INFO,
+ WM_PHASE_PLAYTEST,
+ WM_PHASE_1531,
+ WM_PHASE_WIN,
+ WM_PHASE_LOST,
+ WM_PHASE_SETUP,
+ WM_PHASE_MUSIC,
+ WM_PHASE_PLAYMOVIE,
+ WM_PHASE_WINMOVIE,
+ WM_PHASE_1539,
+ WM_PHASE_DOPLAY, // do singleplayer
+ WM_PHASE_LASTWIN, // PB vestige
+ WM_PHASE_SETUPp,
+ WM_PHASE_REGION,
+ WM_PHASE_INSERT,
+ WM_PHASE_QUITPLAYTEST,
+ WM_PHASE_GAMER,
+ WM_PHASE_WINDESIGN,
+ WM_PHASE_LOSTDESIGN,
+ WM_PHASE_WINMOVIEDESIGN,
+ WM_PHASE_LOSTMULTI,
+ WM_PHASE_WINMULTI,
+ WM_PHASE_WINMOVIEMULTI,
+ WM_PHASE_TESTCD,
+ WM_PHASE_MANUEL,
+ WM_PHASE_PRIVATE,
+ WM_PHASE_UNDO, // PB vestige
+ WM_PHASE_BYE,
+ WM_PHASE_DEMO,
+ WM_PHASE_NAMEDESIGN,
+ WM_PHASE_WRITEDESIGN, // export design to c:\user
+ WM_PHASE_READDESIGN, // import design from c:\user
+ WM_PHASE_CLEARDESIGN,
+ WM_PHASE_DONAMEGAMER,
+ WM_PHASE_DOCLEARGAMER,
+ WM_PHASE_DONAMEDESIGN,
+ WM_PHASE_DOWRITEDESIGN,
+ WM_PHASE_DOREADDESIGN,
+ WM_PHASE_DOCLEARDESIGN,
+ WM_PHASE_SERVICE,
+ WM_PHASE_DP_DOSERVICE,
+ WM_PHASE_DP_CANCELSERVICE,
+ WM_PHASE_SESSION,
+ WM_PHASE_DP_JOIN,
+ WM_PHASE_DP_CREATELOBBY,
+ WM_PHASE_DP_REFRESH,
+ WM_PHASE_DP_CANCELSESSION,
+ WM_PHASE_MULTI,
+ WM_PHASE_DP_STARTMULTI,
+ WM_PHASE_DP_CANCELMULTI,
+ WM_PHASE_CREATE,
+ WM_PHASE_DP_DOCREATE,
+ WM_PHASE_DP_CANCELCREATE,
+ WM_PHASE_STOP, // escape key pause menu during gameplay
+ WM_PHASE_HELP,
+ WM_PHASE_GWRITE,
+ WM_PHASE_GREADp,
+ WM_PHASE_GREAD,
+ WM_PHASE_QUITPLAY,
+ WM_PHASE_1588,
+ WM_PHASE_INTRO1,
+ WM_PHASE_INTRO2,
-#define WM_PREV (WM_USER+600)
-#define WM_NEXT (WM_USER+601)
-#define WM_MOVIE (WM_USER+602)
-#define WM_PHASE_CREATE 1579
-#define WM_PHASE_608 1544
-
-#define WM_PHASE_WINd 1546
-#define WM_PHASE_LOSTd 1547
-#define WM_PHASE_WINm 1549
-#define WM_PHASE_LOSTm 1550
-#define WM_PHASE_READd 1560
-#define WM_PHASE_634 1588
-#define WM_PHASE_GREAD 1586
-#define WM_PHASE_GREADp 1585
-#define WM_PHASE_GWRITE 1584
-#define WM_PHASE_DOQUIT 1587
-#define WM_PHASE_GAMER 1545
-
-#define WM_PHASE_CLEARGAMER 1528
+ WM_PREV = WM_USER + 600,
+ WM_NEXT,
+ WM_MOVIE
+};
// Types de gestion de la souris.
@@ -907,6 +586,157 @@ namespace Key {
#define MOUSETYPEWIN 2
#define MOUSETYPEWINPOS 3
+// Button icons
+
+enum {
+ IC_BT_TECH = 0, // Item: Square tech-block
+ IC_BT_SPECIALTECH, // Item: Special tech-block
+ IC_BT_TRIANGULARTECH, // Item: Triangular tech-block
+ IC_BT_9, // Item: Special tech-block (T shape)
+ IC_BT_10, // Scrolling: Horizontal and vertical (duplicate?)
+ IC_BT_BLUPI, // Item: Yellow Blupi
+ IC_BT_CANCEL, // UI: Black X (cancel)
+ IC_BT_TREASURE, // Item: Treasure chest
+ IC_BT_BOMB, // Item: Bomb
+ IC_BT_BOMBUP, // Item: Hanging bomb
+ IC_BT_EGG, // Item: Egg
+ IC_BT_GOAL, // Item: Goal
+ IC_BT_CANCEL2, // UI: Yellow X
+ IC_BT_HORIZONTAL, // Scrolling: Horizontal only
+ IC_BT_VERTICAL, // Scrolling: Vertical only
+ IC_BT_HORIZONTALVERTICAL, // Scrolling: Horizontal and vertical
+ IC_BT_BULLDOZER, // Item: Bulldozer
+ IC_BT_CASE, // Item: Wooden case
+ IC_BT_ACCEPT, // UI: Black checkmark
+ IC_BT_LIFTFAST, // Item: Fast lift
+ IC_BT_LIFTNORMAL, // Item: Normal lift
+ IC_BT_LIFTSLOW, // Item: Slow lift
+ IC_BT_ROCK, // Item: Square rock
+ IC_BT_WOODENWALL, // Item: Wooden wall
+ IC_BT_HELICOPTER, // Item: Helicopter
+ IC_BT_DREAM, // Item: Dream
+ IC_BT_LAVA, // Item: Lava
+ IC_BT_SECRETTECH, // Item: Secret tech-block
+ IC_BT_LIFTFASTSLOW, // Item: Fast/slow lift
+ IC_BT_PALMTREE, // Item: Palmtree
+ IC_BT_SUPPORT, // Item: Support
+ IC_BT_TREE, // Item: Tree
+ IC_BT_VEGETATION, // Item: Vegetation
+ IC_BT_HOUSE, // Item: House
+ IC_BT_MECH, // Item: Square mechanical
+ IC_BT_SPECIALMECH, // Item: Special mechanical
+ IC_BT_DELETE, // UI: Red X (delete)
+ IC_BT_BIGMECH, // Item: Mechanical background element
+ IC_BT_WATER, // Item: Water
+ IC_BT_GRASS, // Item: Grass
+ IC_BT_STOP, // UI: STOP sign
+ IC_BT_WIND, // Item: Wind
+ IC_BT_FAN, // Item: Fan
+ IC_BT_CREATE, // UI: Create multiplayer lobby
+ IC_BT_MUSIC, // UI: Music
+ IC_BT_JOIN, // UI: Join multiplayer lobby
+ IC_BT_NAME, // UI: Edit name
+ IC_BT_SETUP, // UI: Setup (analog gauge)
+ IC_BT_PLAY, // UI: Play (dice)
+ IC_BT_DESIGN, // UI: Design (wrench and screwdriver)
+ IC_BT_ARROWLEFT, // UI: Arrow pointing left
+ IC_BT_ARROWRIGHT, // UI: Arrow pointing right
+ IC_BT_READ, // UI: Load game
+ IC_BT_WRITE, // UI: Save game
+ IC_BT_MOVINGBOMB, // Item: Moving bomb
+ IC_BT_FISH, // Item: Fish
+ IC_BT_BAR, // Item: Bar to hang from
+ IC_BT_JEEP, // Item: Jeep
+ IC_BT_FURNITURE, // Item: Furniture
+ IC_BT_TRIANGULARROCK, // Item: Triangular rock
+ IC_BT_BIRD, // Item: Bird
+ IC_BT_TINY, // Scrolling: Tiny (No scrolling)
+ IC_BT_LEVELSTART, // Item: Level start
+ IC_BT_DOOR, // Item: Door (hub)
+ IC_BT_KEY, // Item: Key (goal)
+ IC_BT_FACADE, // Item: Building facade
+ IC_BT_ROOF, // Item: Roof
+ IC_BT_SECRETMECH, // Item: Secret mechanical
+ IC_BT_SECRETROCK, // Item: Secret rock
+ IC_BT_MARINE, // Item: Marine plant
+ IC_BT_SPRING, // Item: Spring
+ IC_BT_SKATEBOARD, // Item: Skateboard
+ IC_BT_ARROWUP, // UI: Arrow pointing up
+ IC_BT_ARROWDOWN, // UI: Arrow pointing down
+ IC_BT_SHIELD, // Item: Shield
+ IC_BT_LOLLIPOP, // Item: Lollipop
+ IC_BT_SECRETCASE, // Item: Secret wooden case
+ IC_BT_CONTINUE, // UI: Continue game
+ IC_BT_HALT, // UI: Halt (hand)
+ IC_BT_INVISIBLEBLOCK, // Item: Invisible block
+ IC_BT_KIDSSTUFF, // Item: Kid's stuff block
+ IC_BT_SPECIALKIDSSTUFF, // Item: Special kid's stuff
+ IC_BT_BIGKIDSSTUFF, // Item: Kid's stuff background element
+ IC_BT_MULTI, // UI: Multiplayer
+ IC_BT_DEMO, // UI: Demo
+ IC_BT_TANK, // Item: Tank
+ IC_BT_HELP, // UI: Help
+ IC_BT_DYNAMITE, // Item: Dynamite
+ IC_BT_GLUE, // Item: Glue supply
+ IC_BT_DRINK, // Item: Invisibility potion
+ IC_BT_NOTREADY, // UI: Not ready (multiplayer lobby)
+ IC_BT_READY, // UI: Ready (multiplayer lobby)
+ IC_BT_PERSO, // Item: Personal bomb
+ IC_BT_CHARGER, // Item: Recharging device
+ IC_BT_SEND, // UI: Send message
+ IC_BT_HELICOENEMY, // Item: Heliported enemy
+ IC_BT_BLUPI1, // Item: Orange Blupi
+ IC_BT_BLUPI2, // Item: Blue Blupi
+ IC_BT_BLUPI3, // Item: Green Blupi
+ IC_BT_TANKENEMY, // Item: Motorized enemy
+ IC_BT_CHEESE, // Item: Cheese
+ IC_BT_INVERTER, // Item: Inverter
+ IC_BT_PERSO0, // Item: Yellow personal bomb
+ IC_BT_PERSO1, // Item: Orange personal bomb
+ IC_BT_PERSO2, // Item: Blue personal bomb
+ IC_BT_PERSO3, // Item: Green personal bomb
+ IC_BT_PIPES, // Item: Pipes
+ IC_BT_HOMINGBOMB, // Item: Homing bomb
+ IC_BT_TEAM1, // UI: Select team 1
+ IC_BT_TEAM2, // UI: Select team 2
+ IC_BT_TEAM3, // UI: Select team 3
+ IC_BT_TEAM4, // UI: Select team 4
+ IC_BT_BRICKS, // Item: Bricks
+ IC_BT_WASP, // Item: Wasp
+ IC_BT_TEAMLITTLE1, // Gameplay: Team 1 player indicator
+ IC_BT_TEAMLITTLE2, // Gameplay: Team 2 player indicator
+ IC_BT_TEAMLITTLE3, // Gameplay: Team 3 player indicator
+ IC_BT_TEAMLITTLE4, // Gameplay: Team 4 player indicator
+ IC_BT_CAVE, // Item: Cave
+ IC_BT_HOVERCRAFT, // Item: Hovercraft
+ IC_BT_LIGHTNING, // Item: Lightning
+ IC_BT_CONVEYOR, // Item: Lift with conveyor
+ IC_BT_CRUSHER, // Item: Crusher
+ IC_BT_VANISH, // Item: Vanishing bloc
+ IC_BT_TELEPORTER, // Item: Teleporter
+ IC_BT_KEYCOLOR, // Item: Key (color)
+ IC_BT_DOORCOLOR, // Item: Door (color)
+ IC_BT_SECRETCAVE, // Item: Secret cave
+ IC_BT_SECRETCHEESE, // Item: Secret cheese
+ IC_BT_SLIME, // Item: Slime block
+ IC_BT_BIGSLIME, // Item: Slime background element
+ IC_BT_SLIMEFLOOR, // Item: Floor slime trap
+ IC_BT_SAW, // Item: Saw
+ IC_BT_LOWCOLORBACK, // UI: 256-color background
+ IC_BT_TRUECOLORBACK, // UI: 65536-color background
+ IC_BT_LOWCOLORDECOR, // UI: 256-color foreground
+ IC_BT_TRUECOLORDECOR, // UI: 65536-color foreground
+ IC_BT_PALACE, // Item: Palace
+ IC_BT_PALACEELEMENT, // Item: Element for palace
+ IC_BT_BIGPALACE, // Item: Palace background element
+ IC_BT_SLIMECREATURE, // Item: Slime creature
+ IC_BT_BRIDGE, // Item: Fragile bridge
+ IC_BT_SPIDERWEB, // Item: Spider's web
+ IC_BT_SLIMECEILING, // Item: Ceiling slime trap
+ IC_BT_TREASUREDOOR // Item: Numbered treasure door
+};
+
+
namespace Object {
enum Object {
Empty = -1,
@@ -1358,68 +1188,64 @@ namespace Object {
#define CLE_GREEN (1 << 1)
#define CLE_BLUE (1 << 2)
-struct POINT
+// helpers for POINT
+
+POINT operator+(POINT p, const POINT& a)
{
- int x;
- int y;
+ return { a.x + p.x, a.y + p.y };
+}
- POINT operator+(const POINT& a) const
- {
- return { a.x + x, a.y + y };
- }
+POINT operator-(POINT p, const POINT& a)
+{
+ return { a.x - p.x, a.y - p.y };
+}
- POINT operator-(const POINT& a) const
- {
- return { a.x - x, a.y - y };
- }
+POINT operator*(POINT p, const POINT& a)
+{
+ return { a.x * p.x, a.y * p.y };
+}
- POINT operator*(const POINT& a) const
- {
- return { a.x * x, a.y * y };
- }
+POINT operator/(POINT p, const POINT& a)
+{
+ return { p.x / a.x, p.y / a.y };
+}
- POINT operator/(const POINT& a) const
- {
- return { a.x / x, a.y / y };
- }
+POINT operator*(POINT p, const int& a)
+{
+ return { p.x * a, p.y * a };
+}
- POINT operator*(const int& a) const
- {
- return { x * a, y * a };
- }
+POINT operator/(POINT p, const int& a)
+{
+ return { p.x / a, p.y / a };
+}
- POINT operator/(const int& a) const
- {
- return { x / a, y / a };
- }
+POINT operator+=(POINT p, const POINT& a)
+{
+ return { p.x += a.x, p.y += a.y };
+}
- POINT operator+=(const POINT& a)
- {
- return { x += a.x, y += a.y };
- }
+POINT operator-=(POINT p, const POINT& a)
+{
+ return { p.x -= a.x, p.y -= a.y };
+}
- POINT operator-=(const POINT& a)
- {
- return { x -= a.x, y -= a.y };
- }
+POINT operator*=(POINT p, const POINT& a)
+{
+ return { p.x *= a.x, p.y *= a.y };
+}
- POINT operator*=(const POINT& a)
- {
- return { x *= a.x, y *= a.y };
- }
+POINT operator/=(POINT p, const POINT& a)
+{
+ return { p.x /= a.x, p.y /= a.y };
+}
- POINT operator/=(const POINT& a)
- {
- return { x /= a.x, y /= a.y };
- }
+POINT operator*=(POINT p, const int& a)
+{
+ return { p.x *= a, p.y *= a };
+}
- POINT operator*=(const int& a)
- {
- return { x *= x, y *= a };
- }
-
- POINT operator/=(const int& a)
- {
- return { x /= a, y /= a };
- }
-};
\ No newline at end of file
+POINT operator/=(POINT p, const int& a)
+{
+ return { p.x /= a, p.y /= a };
+}
\ No newline at end of file
diff --git a/src/event.cpp b/src/event.cpp
new file mode 100644
index 0000000..859215d
--- /dev/null
+++ b/src/event.cpp
@@ -0,0 +1,4908 @@
+// Event.cpp
+//
+
+#pragma once
+
+using namespace std;
+
+#include
+#include
+#include
+#include
+#include
+#include "def.h"
+#include "resource.h"
+#include "pixmap.h"
+#include "sound.h"
+#include "decor.h"
+#include "movie.h"
+#include "button.h"
+#include "menu.h"
+#include "jauge.h"
+#include "event.h"
+#include "text.h"
+#include "misc.h"
+#include "network.h"
+
+#pragma warning (disable : 4996)
+#pragma warning (disable : 4700)
+
+#define DEF_TIME_HELP 10000
+#define DEF_TIME_DEMO 1000
+#define MAXDEMO 2000
+#define MAXINDEX 20
+
+
+typedef struct
+{
+ short majRev;
+ short minRev;
+ short reserve1[9];
+ char name[100];
+ short mission;
+ short speed;
+ short bMovie;
+ short bHiliInfoButton;
+ short audioVolume;
+ short midiVolume;
+ short bBuildOfficialMissions;
+ short prive;
+ short skillUnused;
+ short multi;
+ short reserve2[92];
+ short nbVies;
+ BYTE doors[200];
+}
+DescInfo;
+
+// Toutes les premi�res lettres doivent
+// �tre diff�rentes !
+
+static char cheat_code[25][60] =
+{
+ "XMISSION", // 0 (xnjttjpo)
+ "OPENDOORS", // 1
+ "CLEANALL", // 2
+ "MEGABLUPI", // 3
+ "LAYEGG", // 4
+ "KILLEGG", // 5
+ "FUNSKATE", // 6
+ "GIVECOPTER", // 7
+ "JEEPDRIVE", // 8
+ "ALLTREASURE",
+ "ENDGOAL",
+ "SHOWSECRET",
+ "ROUNDSHIELD",
+ "QUICKLOLLIPOP",
+ "TENBOMBS",
+ "BIRDLIME",
+ "DRIVETANK",
+ "POWERCHARGE",
+ "HIDEDRINK",
+ "NETPACKED",
+ "ZNETDEBUG",
+ "YNOSMOOTH",
+ "IOVERCRAFT",
+ "UDYNAMITE",
+ "WELLKEYS",
+};
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+static Phase table[] =
+{
+ {
+ WM_PHASE_TESTCD,
+ "init.blp",
+ FALSE,
+ FALSE,
+ { 0 }
+ },
+ {
+ WM_PHASE_INTRO1,
+ "intro1.blp",
+ FALSE,
+ FALSE,
+ { 0 }
+ },
+ {
+ WM_PHASE_INTRO2,
+ "intro2.blp",
+ FALSE,
+ FALSE,
+ { 0 }
+ },
+ {
+ WM_PHASE_INIT,
+ "init.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_GAMER,
+ 0,{ 1, 48 },
+ 86, 410,
+ { 1, 109 }
+ },
+ {
+ WM_PHASE_DEMO,
+ 0,{ 1, 84 },
+ 128, 410,
+ { 1, 212 }
+ },
+ {
+ WM_PHASE_BYE,
+ 0,{ 1, 6 },
+ 540, 410,
+ { 1, 106 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_GAMER,
+ "gamer.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_BUTTON1,
+ 0,{ 0 },
+ 60, 58,
+ { 1, 117 }
+ },
+ {
+ WM_BUTTON2,
+ 0,{ 0 },
+ 60, 98,
+ { 1, 117 }
+ },
+ {
+ WM_BUTTON3,
+ 0,{ 0 },
+ 60, 138,
+ { 1, 117 }
+ },
+ {
+ WM_BUTTON4,
+ 0,{ 0 },
+ 60, 178,
+ { 1, 117 }
+ },
+ {
+ WM_BUTTON5,
+ 0,{ 0 },
+ 60, 218,
+ { 1, 117 }
+ },
+ {
+ WM_BUTTON6,
+ 0,{ 0 },
+ 60, 258,
+ { 1, 117 }
+ },
+ {
+ WM_BUTTON7,
+ 0,{ 0 },
+ 60, 298,
+ { 1, 117 }
+ },
+ {
+ WM_BUTTON8,
+ 0,{ 0 },
+ 60, 338,
+ { 1, 117 }
+ },
+ {
+ WM_PHASE_NAMEGAMER,
+ 0,{ 1, 46 },
+ 546, 178,
+ { 1, 118 }
+ },
+ {
+ WM_PHASE_CLEARGAMER,
+ 0,{ 1, 36 },
+ 546, 220,
+ { 1, 127 }
+ },
+ {
+ WM_PHASE_DOPLAY,
+ 0,{ 1, 48 },
+ 65, 414,
+ { 1, 195 }
+ },
+ {
+ WM_PHASE_SERVICE,
+ 0,{ 1, 83 },
+ 107, 414,
+ { 1, 196 }
+ },
+ {
+ WM_PHASE_PRIVATE,
+ 0,{ 1, 49 },
+ 149, 414,
+ { 1, 188 }
+ },
+ {
+ WM_PHASE_GREAD,
+ 0,{ 1, 52 },
+ 191, 414,
+ { 1, 264 }
+ },
+ {
+ WM_PHASE_SETUP,
+ 0,{ 1, 47 },
+ 330, 414,
+ { 1, 128 }
+ },
+ {
+ WM_PHASE_INIT,
+ 0,{ 1, 40 },
+ 540, 414,
+ { 1, 111 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_NAMEGAMER,
+ "name.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_DONAMEGAMER,
+ 0,{ 1, 18 },
+ 222, 326,
+ { 1, 174 }
+ },
+ {
+ WM_PHASE_GAMER,
+ 0,{ 1, 36 },
+ 378, 326,
+ { 1, 175 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_CLEARGAMER,
+ "clear.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_DOCLEARGAMER,
+ 0,{ 1, 18 },
+ 222, 326,
+ { 1, 176 }
+ },
+ {
+ WM_PHASE_GAMER,
+ 0,{ 1, 36 },
+ 378, 326,
+ { 1, 177 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_SERVICE,
+ "service.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_BUTTON1,
+ 0,{ 1, 51 },
+ 140, 110,
+ { 0 }
+ },
+ {
+ WM_BUTTON2,
+ 0,{ 1, 51 },
+ 140, 150,
+ { 0 }
+ },
+ {
+ WM_BUTTON3,
+ 0,{ 1, 51 },
+ 140, 190,
+ { 0 }
+ },
+ {
+ WM_BUTTON4,
+ 0,{ 1, 51 },
+ 140, 230,
+ { 0 }
+ },
+ {
+ WM_BUTTON5,
+ 0,{ 1, 51 },
+ 140, 270,
+ { 0 }
+ },
+ {
+ WM_BUTTON6,
+ 0,{ 1, 51 },
+ 140, 310,
+ { 0 }
+ },
+ {
+ WM_BUTTON10,
+ 0,{ 1, 72 },
+ 466, 110,
+ { 1, 242 }
+ },
+ {
+ WM_BUTTON11,
+ 0,{ 1, 73 },
+ 466, 310,
+ { 1, 241 }
+ },
+ {
+ WM_PHASE_DP_DOSERVICE,
+ 0,{ 1, 18 },
+ 222, 389,
+ { 1, 174 }
+ },
+ {
+ WM_PHASE_DP_CANCELSERVICE,
+ 0,{ 1, 36 },
+ 380, 389,
+ { 1, 175 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_SESSION,
+ "session.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_BUTTON1,
+ 0,{ 1, 51 },
+ 120, 110,
+ { 0 }
+ },
+ {
+ WM_BUTTON2,
+ 0,{ 1, 51 },
+ 120, 150,
+ { 0 }
+ },
+ {
+ WM_BUTTON3,
+ 0,{ 1, 51 },
+ 120, 190,
+ { 0 }
+ },
+ {
+ WM_BUTTON4,
+ 0,{ 1, 51 },
+ 120, 230,
+ { 0 }
+ },
+ {
+ WM_BUTTON5,
+ 0,{ 1, 51 },
+ 120, 270,
+ { 0 }
+ },
+ {
+ WM_BUTTON6,
+ 0,{ 1, 51 },
+ 120, 310,
+ { 0 }
+ },
+ {
+ WM_BUTTON10,
+ 0,{ 1, 72 },
+ 490, 110,
+ { 1, 246 }
+ },
+ {
+ WM_BUTTON11,
+ 0,{ 1, 73 },
+ 490, 310,
+ { 1, 245 }
+ },
+ {
+ WM_PHASE_DP_JOIN,
+ 0,{ 1, 45 },
+ 120, 389,
+ { 1, 247 }
+ },
+ {
+ WM_PHASE_DP_CREATELOBBY,
+ 0,{ 1, 43 },
+ 162, 389,
+ { 1, 248 }
+ },
+ {
+ WM_PHASE_DP_REFRESH,
+ 0,{ 1, 72 },
+ 260, 389,
+ { 1, 249 }
+ },
+ {
+ WM_PHASE_DP_CANCELSESSION,
+ 0,{ 1, 36 },
+ 485, 389,
+ { 1, 175 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_CREATE,
+ "create.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_DP_DOCREATE,
+ 0,{ 1, 18 },
+ 222, 326,
+ { 1, 174 }
+ },
+ {
+ WM_PHASE_DP_CANCELCREATE,
+ 0,{ 1, 36 },
+ 378, 326,
+ { 1, 175 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_MULTI,
+ "multi.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_BUTTON1,
+ 0,{ 0 },
+ 80, 98,
+ { 1, 207 }
+ },
+ {
+ WM_BUTTON2,
+ 0,{ 0 },
+ 80, 140,
+ { 1, 207 }
+ },
+ {
+ WM_BUTTON3,
+ 0,{ 0 },
+ 80, 182,
+ { 1, 207 }
+ },
+ {
+ WM_BUTTON4,
+ 0,{ 0 },
+ 80, 224,
+ { 1, 207 }
+ },
+ {
+ WM_BUTTON11,
+ 0,{ 1, 36 },
+ 288, 98,
+ { 1, 208 }
+ },
+ {
+ WM_BUTTON12,
+ 0,{ 1, 36 },
+ 288, 140,
+ { 1, 208 }
+ },
+ {
+ WM_BUTTON13,
+ 0,{ 1, 36 },
+ 288, 182,
+ { 1, 208 }
+ },
+ {
+ WM_BUTTON14,
+ 0,{ 1, 36 },
+ 288, 224,
+ { 1, 208 }
+ },
+ {
+ WM_BUTTON20,
+ 0,{ 1, 94 },
+ 404, 388,
+ { 1, 262 }
+ },
+ {
+ WM_PREV,
+ 0,{ 1, 50 },
+ 438, 249,
+ { 1, 107 }
+ },
+ {
+ WM_NEXT,
+ 0,{ 1, 51 },
+ 480, 249,
+ { 1, 108 }
+ },
+ {
+ WM_PHASE_DP_STARTMULTI,
+ 0,{ 1, 48 },
+ 508, 389,
+ { 1, 252 }
+ },
+ {
+ WM_PHASE_DP_CANCELMULTI,
+ 0,{ 1, 36 },
+ 508, 330,
+ { 1, 175 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_INFO,
+ "info.blp",
+ FALSE,
+ TRUE,
+ {
+ {
+ WM_PHASE_WRITEDESIGN,
+ 0,{ 1, 53 },
+ 188, 306,
+ { 1, 113 }
+ },
+ {
+ WM_PHASE_READDESIGN,
+ 0,{ 1, 52 },
+ 232, 306,
+ { 1, 112 }
+ },
+ {
+ WM_PHASE_CLEARDESIGN,
+ 0,{ 1, 36 },
+ 276, 306,
+ { 1, 183 }
+ },
+ {
+ WM_PREV,
+ 0,{ 1, 50 },
+ 188, 398,
+ { 1, 107 }
+ },
+ {
+ WM_PHASE_PLAYMOVIE,
+ 0,{ 1, 48 },
+ 232, 398,
+ { 1, 109 }
+ },
+ {
+ WM_NEXT,
+ 0,{ 1, 51 },
+ 276, 398,
+ { 1, 108 }
+ },
+ {
+ WM_PHASE_BUILD,
+ 0,{ 1, 49 },
+ 422, 98,
+ { 1, 110 }
+ },
+ {
+ WM_PHASE_REGION,
+ 0,{ 1, 22 },
+ 422, 195,
+ { 1, 144 }
+ },
+ {
+ WM_PHASE_NAMEDESIGN,
+ 0,{ 1, 46 },
+ 422, 239,
+ { 1, 185 }
+ },
+ {
+ WM_PHASE_MUSIC,
+ 0,{ 1, 44 },
+ 422, 283,
+ { 1, 129 }
+ },
+ {
+ WM_PHASE_GAMER,
+ 0,{ 1, 40 },
+ 422, 398,
+ { 1, 111 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_PLAY,
+ "",
+ FALSE,
+ FALSE,
+ {
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_PLAYTEST,
+ "",
+ FALSE,
+ FALSE,
+ {
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_STOP,
+ "stop.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_GWRITE,
+ 0,{ 1, 53 },
+ 187, 178,
+ { 1, 263 }
+ },
+ {
+ WM_PHASE_GREADp,
+ 0,{ 1, 52 },
+ 187, 296,
+ { 1, 264 }
+ },
+ {
+ WM_PHASE_SETUPp,
+ 0,{ 1, 47 },
+ 350, 156,
+ { 1, 128 }
+ },
+ {
+ WM_PHASE_HELP,
+ 0,{ 1, 86 },
+ 391, 156,
+ { 1, 267 }
+ },
+ {
+ WM_PHASE_QUITPLAY,
+ 0,{ 1, 78 },
+ 413, 262,
+ { 1, 266 }
+ },
+ {
+ WM_PHASE_PLAY,
+ 0,{ 1, 77 },
+ 413, 323,
+ { 1, 265 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_HELP,
+ "help.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_PLAY,
+ 0,{ 1, 18 },
+ 442, 358,
+ { 1, 174 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_GREAD,
+ "gread.blp",
+ FALSE,
+ TRUE,
+ {
+ {
+ WM_BUTTON1,
+ 0,{ 0 },
+ 280, 110,
+ { 0 }
+ },
+ {
+ WM_BUTTON2,
+ 0,{ 0 },
+ 280, 150,
+ { 0 }
+ },
+ {
+ WM_BUTTON3,
+ 0,{ 0 },
+ 280, 190,
+ { 0 }
+ },
+ {
+ WM_BUTTON4,
+ 0,{ 0 },
+ 280, 230,
+ { 0 }
+ },
+ {
+ WM_BUTTON5,
+ 0,{ 0 },
+ 280, 270,
+ { 0 }
+ },
+ {
+ WM_BUTTON6,
+ 0,{ 0 },
+ 280, 310,
+ { 0 }
+ },
+ {
+ WM_BUTTON20,
+ 0,{ 1, 18 },
+ 330, 387,
+ { 1, 174 }
+ },
+ {
+ WM_PHASE_GAMER,
+ 0,{ 1, 36 },
+ 458, 387,
+ { 1, 175 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_GREADp,
+ "gread.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_BUTTON1,
+ 0,{ 0 },
+ 280, 110,
+ { 0 }
+ },
+ {
+ WM_BUTTON2,
+ 0,{ 0 },
+ 280, 150,
+ { 0 }
+ },
+ {
+ WM_BUTTON3,
+ 0,{ 0 },
+ 280, 190,
+ { 0 }
+ },
+ {
+ WM_BUTTON4,
+ 0,{ 0 },
+ 280, 230,
+ { 0 }
+ },
+ {
+ WM_BUTTON5,
+ 0,{ 0 },
+ 280, 270,
+ { 0 }
+ },
+ {
+ WM_BUTTON6,
+ 0,{ 0 },
+ 280, 310,
+ { 0 }
+ },
+ {
+ WM_BUTTON20,
+ 0,{ 1, 18 },
+ 330, 387,
+ { 1, 174 }
+ },
+ {
+ WM_PHASE_STOP,
+ 0,{ 1, 36 },
+ 458, 387,
+ { 1, 175 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_GWRITE,
+ "gwrite.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_BUTTON1,
+ 0,{ 0 },
+ 280, 110,
+ { 0 }
+ },
+ {
+ WM_BUTTON2,
+ 0,{ 0 },
+ 280, 150,
+ { 0 }
+ },
+ {
+ WM_BUTTON3,
+ 0,{ 0 },
+ 280, 190,
+ { 0 }
+ },
+ {
+ WM_BUTTON4,
+ 0,{ 0 },
+ 280, 230,
+ { 0 }
+ },
+ {
+ WM_BUTTON5,
+ 0,{ 0 },
+ 280, 270,
+ { 0 }
+ },
+ {
+ WM_BUTTON6,
+ 0,{ 0 },
+ 280, 310,
+ { 0 }
+ },
+ {
+ WM_BUTTON20,
+ 0,{ 1, 18 },
+ 330, 387,
+ { 1, 174 }
+ },
+ {
+ WM_PHASE_STOP,
+ 0,{ 1, 36 },
+ 458, 387,
+ { 1, 175 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_SETUP,
+ "setup.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_BUTTON1,
+ 0,{ 1, 50 },
+ 70, 110,
+ { 1, 130 }
+ },
+ {
+ WM_BUTTON2,
+ 0,{ 1, 51 },
+ 110, 110,
+ { 1, 131 }
+ },
+ {
+ WM_BUTTON3,
+ 0,{ 1, 50 },
+ 70, 220,
+ { 1, 132 }
+ },
+ {
+ WM_BUTTON4,
+ 0,{ 1, 51 },
+ 110, 220,
+ { 1, 133 }
+ },
+ {
+ WM_BUTTON5,
+ 0,{ 1, 133 },
+ 70, 330,
+ { 1, 154 }
+ },
+ {
+ WM_BUTTON6,
+ 0,{ 1, 134 },
+ 110, 330,
+ { 1, 155 }
+ },
+ {
+ WM_BUTTON13,
+ 0,{ 1, 135 },
+ 170, 330,
+ { 1, 305 }
+ },
+ {
+ WM_BUTTON14,
+ 0,{ 1, 136 },
+ 210, 330,
+ { 1, 306 }
+ },
+ {
+ WM_BUTTON7,
+ 0,{ 0 },
+ 370, 110,
+ { 1, 156 }
+ },
+ {
+ WM_BUTTON8,
+ 0,{ 0 },
+ 370, 150,
+ { 1, 157 }
+ },
+ {
+ WM_BUTTON9,
+ 0,{ 0 },
+ 370, 190,
+ { 1, 157 }
+ },
+ {
+ WM_BUTTON10,
+ 0,{ 0 },
+ 370, 230,
+ { 1, 157 }
+ },
+ {
+ WM_BUTTON11,
+ 0,{ 0 },
+ 370, 270,
+ { 1, 157 }
+ },
+ {
+ WM_BUTTON12,
+ 0,{ 0 },
+ 370, 310,
+ { 1, 157 }
+ },
+ {
+ WM_PHASE_GAMER,
+ 0,{ 1, 18 },
+ 541, 411,
+ { 1, 174 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_SETUPp,
+ "setup.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_BUTTON1,
+ 0,{ 1, 50 },
+ 70, 110,
+ { 1, 130 }
+ },
+ {
+ WM_BUTTON2,
+ 0,{ 1, 51 },
+ 110, 110,
+ { 1, 131 }
+ },
+ {
+ WM_BUTTON3,
+ 0,{ 1, 50 },
+ 70, 220,
+ { 1, 132 }
+ },
+ {
+ WM_BUTTON4,
+ 0,{ 1, 51 },
+ 110, 220,
+ { 1, 133 }
+ },
+ {
+ WM_BUTTON5,
+ 0,{ 1, 133 },
+ 70, 330,
+ { 1, 154 }
+ },
+ {
+ WM_BUTTON6,
+ 0,{ 1, 134 },
+ 110, 330,
+ { 1, 155 }
+ },
+ {
+ WM_BUTTON13,
+ 0,{ 1, 135 },
+ 170, 330,
+ { 1, 305 }
+ },
+ {
+ WM_BUTTON14,
+ 0,{ 1, 136 },
+ 210, 330,
+ { 1, 306 }
+ },
+ {
+ WM_BUTTON7,
+ 0,{ 0 },
+ 370, 110,
+ { 1, 156 }
+ },
+ {
+ WM_BUTTON8,
+ 0,{ 0 },
+ 370, 150,
+ { 1, 157 }
+ },
+ {
+ WM_BUTTON9,
+ 0,{ 0 },
+ 370, 190,
+ { 1, 157 }
+ },
+ {
+ WM_BUTTON10,
+ 0,{ 0 },
+ 370, 230,
+ { 1, 157 }
+ },
+ {
+ WM_BUTTON11,
+ 0,{ 0 },
+ 370, 270,
+ { 1, 157 }
+ },
+ {
+ WM_BUTTON12,
+ 0,{ 0 },
+ 370, 310,
+ { 1, 157 }
+ },
+ {
+ WM_PHASE_PLAY,
+ 0,{ 1, 18 },
+ 541, 411,
+ { 1, 174 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_LOST,
+ "lost.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_PLAY,
+ 0,{ 1, 18 },
+ 541, 411,
+ { 1, 174 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_LOSTDESIGN,
+ "lost.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_INFO,
+ 0,{ 1, 18 },
+ 541, 411,
+ { 1, 174 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_LOSTMULTI,
+ "lost.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_GAMER,
+ 0,{ 1, 18 },
+ 541, 411,
+ { 1, 174 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_WIN,
+ "win.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_GAMER,
+ 0,{ 1, 18 },
+ 541, 411,
+ { 1, 174 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_WINDESIGN,
+ "win.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_INFO,
+ 0,{ 1, 18 },
+ 541, 411,
+ { 1, 174 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_WINMULTI,
+ "win.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_GAMER,
+ 0,{ 1, 18 },
+ 541, 411,
+ { 1, 174 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_BUILD,
+ "",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_DECOR1,
+ 0,{ 1, 6 },
+ 11, 11,
+ { 1, 1000 }
+ },
+ {
+ WM_DECOR2,
+ 0,{ 11, 31, 29, 32, 69, 33, 37, 82, 130, 139, 30, 142 },
+ 11, 53,
+ { 11, 2030, 1023, 2072, 1042, 2047, 1026, 1049, 1076, 1080, 1021, 1082 }
+ },
+ {
+ WM_DECOR3,
+ 0,{ 8, 0, 1, 2, 27, 34, 35, 67, 106 },
+ 11, 95,
+ { 8, 1001, 1002, 1003, 1020, 1024, 1025, 1038, 1062 }
+ },
+ {
+ WM_DECOR4,
+ 0,{ 10, 22, 59, 68, 118, 127, 100, 128, 129, 39, 38 },
+ 11, 137,
+ { 10, 2033, 1032, 1037, 1067, 1075, 1061, 1074, 1076, 2038, 2041 }
+ },
+ {
+ WM_DECOR5,
+ 0,{ 10, 137, 138, 65, 66, 112, 58, 23, 80, 81, 79 },
+ 11, 179,
+ { 10, 1079, 1080, 1039, 1040, 1065, 1031, 1015, 1047, 1048, 1022 }
+ },
+ {
+ WM_DECOR6,
+ 0,{ 12, 8, 9, 107, 26, 42, 41, 131, 143, 132, 101, 120, 122 },
+ 11, 221,
+ { 12, 1006, 1007, 1063, 1018, 1028, 1027, 1077, 1083, 1078, 1064, 1069, 1071 }
+ },
+ {
+ WM_DECOR7,
+ 0,{ 13, 21, 20, 19, 28, 121, 16, 55, 60, 113, 140, 54, 95, 99 },
+ 11, 263,
+ { 13, 1009, 1010, 1011, 1019, 1070, 1012, 1030, 1033, 1066, 1081, 1029, 1059, 1060 }
+ },
+ {
+ WM_DECOR8,
+ 0,{ 9, 7, 10, 75, 74, 89, 88, 93, 92, 87 },
+ 11, 305,
+ { 9, 1004, 1005, 1046, 1045, 1052, 1051, 1054, 1053, 2007 }
+ },
+ {
+ WM_DECOR9,
+ 0,{ 10, 125, 126, 144, 124, 56, 70, 123, 141, 17, 76 },
+ 11, 347,
+ { 10, 1036, 1035, 1084, 1073, 1041, 1043, 1072, 2044, 1013, 1014 }
+ },
+ {
+ WM_DECOR10,
+ 0,{ 5, 119, 24, 71, 57, 85 },
+ 11, 389,
+ { 5, 1068, 1016, 1044, 2004, 1050 }
+ },
+ {
+ WM_DECOR11,
+ 0,{ 8, 11, 5, 96, 97, 98, 63, 62, 64 },
+ 11, 431,
+ { 8, 1008, 1055, 1056, 1057, 1058, 1035, 1034, 1036 }
+ },
+ {
+ WM_PHASE_PLAYTEST,
+ 0,{ 1, 48 },
+ 544, 431,
+ { 1, 124 }
+ },
+ {
+ WM_PHASE_INFO,
+ 0,{ 1, 40 },
+ 586, 431,
+ { 1, 119 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_MUSIC,
+ "music.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_BUTTON1,
+ 0,{ 1, 40 },
+ 200, 130,
+ { 1, 134 }
+ },
+ {
+ WM_BUTTON2,
+ 0,{ 1, 44 },
+ 290, 130,
+ { 1, 135 }
+ },
+ {
+ WM_BUTTON3,
+ 0,{ 1, 44 },
+ 290, 170,
+ { 1, 136 }
+ },
+ {
+ WM_BUTTON4,
+ 0,{ 1, 44 },
+ 290, 210,
+ { 1, 137 }
+ },
+ {
+ WM_BUTTON5,
+ 0,{ 1, 44 },
+ 290, 250,
+ { 1, 138 }
+ },
+ {
+ WM_BUTTON6,
+ 0,{ 1, 44 },
+ 290, 290,
+ { 1, 139 }
+ },
+ {
+ WM_BUTTON7,
+ 0,{ 1, 44 },
+ 350, 130,
+ { 1, 140 }
+ },
+ {
+ WM_BUTTON8,
+ 0,{ 1, 44 },
+ 350, 170,
+ { 1, 141 }
+ },
+ {
+ WM_BUTTON9,
+ 0,{ 1, 44 },
+ 350, 210,
+ { 1, 142 }
+ },
+ {
+ WM_BUTTON10,
+ 0,{ 1, 44 },
+ 350, 250,
+ { 1, 143 }
+ },
+ {
+ WM_BUTTON11,
+ 0,{ 1, 44 },
+ 350, 290,
+ { 1, 171 }
+ },
+ {
+ WM_PHASE_INFO,
+ 0,{ 1, 18 },
+ 540, 410,
+ { 1, 174 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_REGION,
+ "region.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_BUTTON3,
+ 0,{ 0 },
+ 48, 58,
+ { 1, 217 }
+ },
+ {
+ WM_BUTTON28,
+ 0,{ 0 },
+ 48, 98,
+ { 1, 300 }
+ },
+ {
+ WM_BUTTON22,
+ 0,{ 0 },
+ 48, 138,
+ { 1, 236 }
+ },
+ {
+ WM_BUTTON19,
+ 0,{ 0 },
+ 48, 178,
+ { 1, 233 }
+ },
+ {
+ WM_BUTTON21,
+ 0,{ 0 },
+ 48, 218,
+ { 1, 235 }
+ },
+ {
+ WM_BUTTON20,
+ 0,{ 0 },
+ 48, 258,
+ { 1, 234 }
+ },
+ {
+ WM_BUTTON7,
+ 0,{ 0 },
+ 48, 298,
+ { 1, 221 }
+ },
+ {
+ WM_BUTTON10,
+ 0,{ 0 },
+ 48, 338,
+ { 1, 224 }
+ },
+ {
+ WM_BUTTON1,
+ 0,{ 0 },
+ 148, 58,
+ { 1, 215 }
+ },
+ {
+ WM_BUTTON15,
+ 0,{ 0 },
+ 148, 98,
+ { 1, 229 }
+ },
+ {
+ WM_BUTTON14,
+ 0,{ 0 },
+ 148, 138,
+ { 1, 228 }
+ },
+ {
+ WM_BUTTON11,
+ 0,{ 0 },
+ 148, 178,
+ { 1, 225 }
+ },
+ {
+ WM_BUTTON8,
+ 0,{ 0 },
+ 148, 218,
+ { 1, 222 }
+ },
+ {
+ WM_BUTTON23,
+ 0,{ 0 },
+ 148, 258,
+ { 1, 237 }
+ },
+ {
+ WM_BUTTON13,
+ 0,{ 0 },
+ 148, 298,
+ { 1, 227 }
+ },
+ {
+ WM_BUTTON6,
+ 0,{ 0 },
+ 148, 338,
+ { 1, 220 }
+ },
+ {
+ WM_BUTTON17,
+ 0,{ 0 },
+ 248, 58,
+ { 1, 231 }
+ },
+ {
+ WM_BUTTON18,
+ 0,{ 0 },
+ 248, 98,
+ { 1, 232 }
+ },
+ {
+ WM_BUTTON12,
+ 0,{ 0 },
+ 248, 138,
+ { 1, 226 }
+ },
+ {
+ WM_BUTTON27,
+ 0,{ 0 },
+ 248, 178,
+ { 1, 299 }
+ },
+ {
+ WM_BUTTON16,
+ 0,{ 0 },
+ 248, 218,
+ { 1, 230 }
+ },
+ {
+ WM_BUTTON2,
+ 0,{ 0 },
+ 248, 258,
+ { 1, 216 }
+ },
+ {
+ WM_BUTTON30,
+ 0,{ 0 },
+ 248, 298,
+ { 1, 302 }
+ },
+ {
+ WM_BUTTON29,
+ 0,{ 0 },
+ 248, 338,
+ { 1, 301 }
+ },
+ {
+ WM_BUTTON32,
+ 0,{ 0 },
+ 348, 58,
+ { 1, 304 }
+ },
+ {
+ WM_BUTTON5,
+ 0,{ 0 },
+ 348, 98,
+ { 1, 219 }
+ },
+ {
+ WM_BUTTON9,
+ 0,{ 0 },
+ 348, 138,
+ { 1, 223 }
+ },
+ {
+ WM_BUTTON31,
+ 0,{ 0 },
+ 348, 178,
+ { 1, 303 }
+ },
+ {
+ WM_BUTTON26,
+ 0,{ 0 },
+ 348, 218,
+ { 1, 298 }
+ },
+ {
+ WM_BUTTON24,
+ 0,{ 0 },
+ 348, 258,
+ { 1, 238 }
+ },
+ {
+ WM_BUTTON4,
+ 0,{ 0 },
+ 348, 298,
+ { 1, 218 }
+ },
+ {
+ WM_BUTTON25,
+ 0,{ 0 },
+ 348, 338,
+ { 1, 297 }
+ },
+ {
+ WM_DIMS1,
+ 0,{ 1, 15 },
+ 521, 135,
+ { 1, 121 }
+ },
+ {
+ WM_DIMS2,
+ 0,{ 1, 13 },
+ 521, 175,
+ { 1, 122 }
+ },
+ {
+ WM_DIMS3,
+ 0,{ 1, 14 },
+ 521, 215,
+ { 1, 123 }
+ },
+ {
+ WM_DIMS4,
+ 0,{ 1, 61 },
+ 521, 255,
+ { 1, 126 }
+ },
+ {
+ WM_PHASE_INFO,
+ 0,{ 1, 18 },
+ 540, 411,
+ { 1, 174 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_NAMEDESIGN,
+ "name.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_DONAMEDESIGN,
+ 0,{ 1, 18 },
+ 222, 326,
+ { 1, 174 }
+ },
+ {
+ WM_PHASE_INFO,
+ 0,{ 1, 36 },
+ 378, 326,
+ { 1, 175 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_WRITEDESIGN,
+ "write.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_BUTTON10,
+ 0,{ 1, 72 },
+ 420, 112,
+ { 1, 193 }
+ },
+ {
+ WM_BUTTON11,
+ 0,{ 1, 73 },
+ 420, 252,
+ { 1, 192 }
+ },
+ {
+ WM_PHASE_DOWRITEDESIGN,
+ 0,{ 1, 18 },
+ 222, 387,
+ { 1, 174 }
+ },
+ {
+ WM_PHASE_INFO,
+ 0,{ 1, 36 },
+ 380, 387,
+ { 1, 175 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_READDESIGN,
+ "read.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_BUTTON1,
+ 0,{ 1, 51 },
+ 190, 110,
+ { 0 }
+ },
+ {
+ WM_BUTTON2,
+ 0,{ 1, 51 },
+ 190, 150,
+ { 0 }
+ },
+ {
+ WM_BUTTON3,
+ 0,{ 1, 51 },
+ 190, 190,
+ { 0 }
+ },
+ {
+ WM_BUTTON4,
+ 0,{ 1, 51 },
+ 190, 230,
+ { 0 }
+ },
+ {
+ WM_BUTTON5,
+ 0,{ 1, 51 },
+ 190, 270,
+ { 0 }
+ },
+ {
+ WM_BUTTON6,
+ 0,{ 1, 51 },
+ 190, 310,
+ { 0 }
+ },
+ {
+ WM_BUTTON10,
+ 0,{ 1, 72 },
+ 420, 110,
+ { 1, 193 }
+ },
+ {
+ WM_BUTTON11,
+ 0,{ 1, 73 },
+ 420, 310,
+ { 1, 192 }
+ },
+ {
+ WM_PHASE_DOREADDESIGN,
+ 0,{ 1, 18 },
+ 222, 387,
+ { 1, 174 }
+ },
+ {
+ WM_PHASE_INFO,
+ 0,{ 1, 36 },
+ 380, 387,
+ { 1, 175 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_CLEARDESIGN,
+ "clear.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_DOCLEARDESIGN,
+ 0,{ 1, 18 },
+ 222, 326,
+ { 1, 176 }
+ },
+ {
+ WM_PHASE_INFO,
+ 0,{ 1, 36 },
+ 378, 326,
+ { 1, 177 }
+ },
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_PLAYMOVIE,
+ "movie.blp",
+ FALSE,
+ FALSE,
+ {
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_PLAYMOVIE,
+ "movie.blp",
+ FALSE,
+ FALSE,
+ {
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_WINMOVIEDESIGN,
+ "movie.blp",
+ FALSE,
+ FALSE,
+ {
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_WINMOVIEMULTI,
+ "movie.blp",
+ FALSE,
+ FALSE,
+ {
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_BYE,
+ "bye.blp",
+ FALSE,
+ FALSE,
+ {
+ { 0 }
+ },
+ },
+ {
+ WM_PHASE_INSERT,
+ "insert.blp",
+ FALSE,
+ FALSE,
+ {
+ {
+ WM_PHASE_GAMER,
+ 0,{ 1, 40 },
+ 16, 424,
+ { 1, 106 }
+ },
+ { 0 }
+ },
+ },
+ { 0 }
+};
+
+// Constructor
+
+CEvent::CEvent()
+{
+ int i;
+
+
+ m_somethingJoystick = 0;
+ m_bFullScreen = TRUE;
+ m_mouseType = MOUSETYPEGRA;
+ m_index = -1;
+ m_exercice = 0;
+ m_mission = 1;
+ m_private = 1;
+ m_maxMission = 0;
+ m_phase = 0;
+ m_bSchool = FALSE;
+ m_bPrivate = FALSE;
+ m_bBuildOfficialMissions = FALSE;
+ m_bRunMovie = FALSE;
+ m_bBuildModify = FALSE;
+ m_bMousePress = FALSE;
+ m_bMouseDown = FALSE;
+ m_oldMousePos.x = 0;
+ m_oldMousePos.y = 0;
+ m_mouseSprite = 0;
+ m_bFillMouse = FALSE;
+ m_bWaitMouse = FALSE;
+ m_bHideMouse = FALSE;
+ m_bShowMouse = FALSE;
+ m_bMouseRelease = FALSE;
+ m_tryPhase = 0;
+ m_rankCheat = -1;
+ m_posCheat = 0;
+ m_speed = 1;
+ m_bMovie = TRUE;
+ m_bAllMissions = FALSE;
+ m_bHiliInfoButton = TRUE;
+ m_bSpeed = FALSE;
+ m_bHelp = FALSE;
+ m_bChangeCheat = FALSE;
+ m_scrollSpeed = 1;
+ m_bPause = FALSE;
+ m_bShift = FALSE;
+ m_shiftPhase = 0;
+ m_movieToStart[0] = 0;
+ m_bInfoHelp = FALSE;
+ m_bDemoRec = FALSE;
+ m_bDemoPlay = FALSE;
+ m_pDemoBuffer = NULL;
+ m_demoTime = 0;
+ m_bCtrlDown = FALSE;
+ m_keyPress = 0;
+ m_menuIndex = 0;
+ ZeroMemory(m_menuDecor, sizeof(m_menuDecor));
+
+ return;
+}
+
+// Destructor
+
+CEvent::~CEvent()
+{
+ WriteInfo(m_gamer);
+}
+
+void CEvent::Create(HINSTANCE hInstance, HWND hWnd, CPixmap *pPixmap, CDecor *pDecor,
+ CSound *pSound, CNetwork *pNetwork, CMovie *pMovie )
+{
+ POINT pos;
+
+ m_hInstance = hInstance;
+ m_hWnd = hWnd;
+ m_pPixmap = pPixmap;
+ m_pDecor = pDecor;
+ m_pSound = pSound;
+ m_pMovie = pMovie;
+ m_pNetwork = pNetwork;
+ m_gamer = 1;
+
+ ReadInfo(1);
+ return;
+}
+
+int CEvent::GetButtonIndex(int button)
+{
+ int i=0;
+
+ while ( table[m_index].buttons[i].message != 0 )
+ {
+ if ( (UINT)button == table[m_index].buttons[i].message )
+ {
+ return i;
+ }
+ i ++;
+ }
+
+ return -1;
+}
+
+int CEvent::GetState(int button)
+{
+ int index;
+
+ index = GetButtonIndex(button);
+ if ( index < 0 ) return 0;
+
+ return m_buttons[index].GetState();
+}
+
+// Returns the mouse position
+
+POINT CEvent::GetMousePos()
+{
+ POINT pos;
+
+ GetCursorPos(&pos);
+ ScreenToClient(m_hWnd, &pos);
+
+ return pos;
+}
+
+void CEvent::SetFullScreen(BOOL bFullScreen)
+{
+ m_bFullScreen = bFullScreen;
+}
+
+// Initializes the mouse type.
+
+void CEvent::SetMouseType(int mouseType)
+{
+ m_mouseType = mouseType;
+}
+
+// Creates the event handler.
+
+
+
+// Returns the index of the button.
+
+
+
+void CEvent::SetState(int button, int state)
+{
+ int index;
+
+ index = GetButtonIndex(button);
+ if ( index < 0 ) return;
+
+ m_buttons[index].SetState(state);
+}
+
+BOOL CEvent::GetEnable(int button)
+{
+ int index;
+
+ index = GetButtonIndex(button);
+ if ( index < 0 ) return 0;
+
+ return FALSE;
+}
+
+void CEvent::SetEnable(int button, int bEnable)
+{
+ int index;
+
+ index = GetButtonIndex(button);
+ if ( index < 0 ) return;
+
+ m_buttons[index].SetEnable(bEnable);
+}
+
+/*
+BOOL CEvent::GetHide(int button)
+{
+ int index;
+
+ index = GetButtonIndex(button);
+ if (index < 0) return 0;
+
+ return m_buttons[index].GetHide();
+}
+*/
+
+void CEvent::SetHide(int button, BOOL bHide)
+{
+ int index;
+
+ index = GetButtonIndex(button);
+ if (index < 0) return;
+
+ m_buttons[index].SetHide(bHide);
+}
+
+int CEvent::GetMenu(int button)
+{
+ int index;
+
+ index = GetButtonIndex(button);
+ if ( index < 0 ) return 0;
+
+ return m_buttons[index].GetMenu();
+}
+
+void CEvent::SetMenu(int button, int menu)
+{
+ int index;
+
+ index = GetButtonIndex(button);
+ if ( index < 0 ) return;
+
+ m_buttons[index].SetMenu(menu);
+}
+
+// Restore the game after activation in fullScreen mode.
+
+void CEvent::RestoreGame()
+{
+ int i;
+
+ if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST)
+ {
+ HideMouse(FALSE);
+ WaitMouse(TRUE);
+ WaitMouse(FALSE);
+ return;
+ }
+ FillMouse(TRUE);
+ return;
+
+}
+
+void CEvent::FlushInput()
+{
+ m_keyPress = 0;
+
+ m_pDecor->SetInput(0);
+ return;
+
+}
+
+BOOL CEvent::CreateButtons()
+{
+ int message;
+ int* iconMenu;
+ POINT pos;
+ BOOL bMinimizeRedraw = FALSE;
+
+
+ for (int i = 0; table[m_index].buttons[i].message != 0; i++)
+ {
+ pos.x = table[m_index].buttons[i].x;
+ pos.y = table[m_index].buttons[i].y;
+ message = table[m_index].buttons[i].message;
+
+ m_buttons[i].Create(m_hWnd, m_pPixmap, m_pSound, pos,
+ table[m_index].buttons[i].type,
+ bMinimizeRedraw, message);
+
+ iconMenu = table[m_index].buttons[i].iconMenu;
+ if (!m_bBuildOfficialMissions && m_phase == WM_PHASE_BUILD && message == WM_DECOR11)
+ {
+ iconMenu++;
+ }
+
+ m_buttons[i].SetIconMenu(&table[m_index].buttons[i].iconMenu[1], iconMenu[0]);
+ m_buttons[i].SetToolTips(&table[m_index].buttons[i].toolTips[1], table[m_index].buttons[i].toolTips[0]);
+ }
+ return TRUE;
+}
+
+void CEvent::ReadInput()
+{
+ BOOL something;
+ MMRESULT joyPos;
+ int i;
+ UINT keyInput;
+ JOYINFOEX* joyInfo;
+ BOOL bSkateboard;
+ BOOL bHelicopter;
+ BOOL bCar;
+ BOOL bWater;
+ JOYINFOEX joy;
+ UINT bJoyID;
+
+
+ if (m_bMulti != FALSE)
+ {
+ //m_pDecor->TreatNetData();
+ }
+
+ if ((m_somethingJoystick == NULL) || (m_bDemoPlay != FALSE))
+ {
+ m_pDecor->SetJoystickEnable(FALSE);
+ }
+ else
+ {
+ m_pDecor->GetBlupiInfo(&bHelicopter, &bCar, &bSkateboard, &bWater);
+ something = TRUE;
+
+ if (((bHelicopter != FALSE) || (bCar != FALSE)) || (bSkateboard != FALSE))
+ {
+ something = FALSE;
+ }
+ bJoyID = m_joyID;
+ joyInfo = &joy;
+
+ for (i != 0; i = 13; i++)
+ {
+ joyInfo->dwSize = 0;
+ joyInfo = (JOYINFOEX*)&joyInfo->dwFlags;
+ }
+ joy.dwSize = 52;
+ joy.dwFlags = 255;
+
+ joyPos = joyGetPosEx(bJoyID, &joy);
+
+ if (joyPos == 0)
+ {
+ m_keyPress = 0;
+
+ if ((int)joy.dwXpos < 16384)
+ {
+ m_keyPress = KEY_LEFT;
+ }
+ if ((m_keyPress == KEY_NONE) && ((int)joy.dwYpos < 16384))
+ {
+ m_keyPress = KEY_UP;
+ }
+ if (((m_keyPress == KEY_NONE) || (something)) && (49152 < (int)joy.dwYpos))
+ {
+ m_keyPress = m_keyPress | KEY_DOWN;
+ }
+ if (((BYTE)joy.dwButtons & JOY_BUTTON1) != 0)
+ {
+ m_keyPress = m_keyPress & ~(KEY_DOWN | KEY_UP) | KEY_JUMP;
+ }
+ if (((BYTE)joy.dwButtons & JOY_BUTTON2) != 0)
+ {
+ if (bSkateboard == FALSE)
+ {
+ keyInput = m_keyPress & ~KEY_DOWN | KEY_UP | KEY_JUMP;
+ }
+ else
+ {
+ keyInput = m_keyPress & ~(KEY_DOWN | KEY_UP) | KEY_JUMP;
+ }
+ m_keyPress = keyInput;
+ }
+ if (((BYTE)joy.dwButtons & JOY_BUTTON3) != 0)
+ {
+ if (bHelicopter == FALSE)
+ {
+ if (bSkateboard == FALSE)
+ {
+ keyInput = m_keyPress | KEY_DOWN | KEY_JUMP;
+ }
+ else
+ {
+ keyInput = m_keyPress & ~(KEY_DOWN | KEY_UP) | KEY_JUMP;
+ }
+ }
+ else
+ {
+ keyInput = m_keyPress | KEY_DOWN;
+ }
+ m_keyPress = keyInput;
+ m_keyPress = keyInput & ~KEY_UP;
+ }
+ if (((BYTE)joy.dwButtons & JOY_BUTTON4) != 0)
+ {
+ m_keyPress = m_keyPress & ~(KEY_DOWN | KEY_UP) | KEY_FIRE;
+ }
+ m_pDecor->SetInput(m_keyPress);
+ m_pDecor->SetJoystickEnable(TRUE);
+ return;
+ }
+ }
+ return;
+}
+
+
+// CNetwork function needs to be implemented
+
+void CEvent::NetSetPause(BOOL bPause, int players)
+{
+ BOOL bPause_;
+
+ bPause_ = bPause;
+ m_pDecor->SetPause(bPause);
+ if ((m_phase == WM_PHASE_PLAY) || (m_phase == WM_PHASE_PLAYTEST))
+ {
+ if (bPause_ == FALSE)
+ {
+ m_pSound->RestartMusic();
+ }
+ else
+ {
+ m_pSound->SuspendMusic();
+ }
+ }
+ if ((m_bMulti != FALSE) && (players != 0))
+ {
+ m_pNetwork->Send(&bPause, 3, DPSEND_GUARANTEED);
+ }
+ return;
+}
+
+void CEvent::NetSendLobby()
+{
+ NetPlayer* player;
+ UCHAR (packet)[132];
+ CNetwork* pNetwork;
+
+ *(UCHAR*)packet = m_multi;
+ pNetwork = m_pNetwork;
+ packet[0] = 132;
+ packet[1] = MESS_LOBBY;
+ player = pNetwork->m_players;
+ memcpy(packet, pNetwork, 128);
+ pNetwork->Send(packet, 132, DPSEND_GUARANTEED);
+ return;
+}
+
+int CEvent::NetSearchPlayer(DPID dpid)
+{
+ int i;
+ BYTE* pDpid;
+
+ i = 0;
+ for (pDpid = (BYTE*)m_pNetwork->m_players[0].dpid; !pDpid[-4] == 0 || (dpid != *pDpid); pDpid += 32)
+ {
+ if (i++ >= 4)
+ {
+ return -1;
+ }
+ }
+ return i;
+}
+
+void CEvent::NetStartPlay()
+{
+ BOOL host;
+ int i;
+ int* player;
+ char message[2];
+ char str[52];
+ CNetwork* pNetwork;
+
+ OutputNetDebug("CEvent::NetStartPlay");
+ host = m_pNetwork->IsHost();
+
+ if (host != FALSE)
+ {
+ message[0] = '\x02';
+ message[1] = '\a';
+ m_pNetwork->Send(message, 2, DPSEND_GUARANTEED);
+ OutputNetDebug("Sending_MESS_START");
+ }
+ m_pDecor->SetTeam(0);
+ pNetwork = m_pNetwork;
+
+ i = 0;
+ player = (int*) & pNetwork->m_players[0].dpid;
+
+ while ((((NetPlayer*)(player + -1))->bIsPresent == FALSE || (pNetwork->m_dpid != (DPID)player)))
+ {
+ i++;
+ player = player + 8;
+ if (3 < i)
+ {
+ m_bMulti = TRUE;
+ m_bPrivate = FALSE;
+ m_pDecor->SetMulti(TRUE);
+ return;
+ }
+ }
+ m_pDecor->SetTeam((int)pNetwork->m_players[i].team);
+ sprintf(str, "color=%d", (int)m_pNetwork->m_players[i].team);
+ OutputNetDebug(str);
+}
+
+void CEvent::NetSend(int message, USHORT data)
+{
+ UCHAR packet[4];
+
+ packet[2] = '\0';
+ packet[3] = '\0';
+ packet[1] = message;
+ packet[0] = 4;
+ *(USHORT*)packet = data;
+ m_pNetwork->Send(packet, 4, DPSEND_GUARANTEED);
+ return;
+}
+
+void CEvent::NetDraw()
+{
+ int player;
+
+ player = NetSearchPlayer(m_pNetwork->m_dpid);
+ //m_pDecor->DrawMap(TRUE, player);
+ return;
+}
+
+void CEvent::ChatSend()
+{
+ int netplay;
+ UINT i;
+ char* text;
+ char end[4];
+ POINT* pos;
+ DPID dpid;
+ LPVOID data[25];
+ char textInput[100];
+
+ text = m_textInput;
+ if (m_textInput[0] != '\0')
+ {
+ netplay = NetSearchPlayer(m_pNetwork->m_dpid);
+ strcpy(textInput, "<");
+ }
+ if (netplay != -1)
+ {
+ strcat(textInput, (const char*)m_pNetwork->m_players[netplay].name);
+ strcat(textInput, "> ");
+ strcat(textInput, text);
+ //ChatMessageSound((char*)textInput);
+ end[0] = 108;
+ end[1] = 11;
+ dpid = m_pNetwork->m_dpid;
+ m_pNetwork->Send(&end, 108, 1);
+ text = 0;
+ pos[132].x = 0;
+ pos[132].y = strlen(text);
+ pos[133].x = 0;
+ m_textHiliEnd = i - 1;
+ m_textCursorIndex = 0;
+ SetEnable(WM_BUTTON20, 0);
+ }
+ return;
+}
+
+/*
+void CEvent::ChatMessageSound(char* data)
+{
+ int num;
+ char (*chatZone);
+ char(*chat)[5];
+ POINT pos;
+
+ num = 3;
+ chatZone = m_chatZone[0];
+ do
+ {
+ if (chatZone = '\0')
+ {
+ chat = m_chatZone + num * 20;
+ goto error;
+ }
+ num++;
+ chatZone = chatZone + 100;
+ } while (num < 6);
+ HandleChatBuffer();
+ chat = (char(*) [5])m_text;
+ return;
+
+error:
+ strcpy((char*)chat, data);
+ pos.x = 320;
+ pos.y = 240;
+ m_pSound->PlayImage(11, pos, -1);
+}
+*/
+
+void CEvent::HandleChatBuffer()
+{
+ char (*chatZone)[5];
+ int num;
+ int result;
+ char* text;
+
+ num = 5;
+ chatZone = m_chatZone;
+ do
+ {
+ result = strlen((const char*)chatZone + 100) + 1;
+ text = (char*)chatZone;
+ chatZone += 100;
+ memcpy(text, chatZone, result);
+ --num;
+ } while (num);
+ *((BYTE*)m_text) = 0;
+ return;
+}
+
+void CEvent::OutputNetDebug(const char* str)
+{
+ char* stream;
+ FILE* streamf;
+ UINT element;
+
+ streamf = (FILE*)m_pDecor->GetNetDebug();
+
+ if (m_pDecor->GetNetDebug() != FALSE)
+ {
+ if (fopen("debug.txt", "ab") != (FILE*)0)
+ {
+ fwrite(str, 1, strlen(str), streamf);
+ streamf = (FILE*)fclose(streamf);
+ }
+ }
+ return;
+}
+
+void AddCheatCode(char *pDst, char *pSrc)
+{
+ int i, j;
+
+ if ( pDst[0] != 0 ) strcat(pDst, " / ");
+
+ i = 0;
+ j = strlen(pDst);
+ while ( pSrc[i] != 0 )
+ {
+ pDst[j++] = tolower(pSrc[i++]);
+ }
+ pDst[j] = 0;
+}
+
+
+void CEvent::DrawTextCenter(int res, int x, int y, int font)
+{
+ char text[100];
+ POINT pos;
+
+ LoadString(res, text, 100);
+ pos.x = x;
+ pos.y = y;
+ ::DrawTextCenter(m_pPixmap, pos, text, font);
+}
+
+BOOL CEvent::DrawButtons()
+{
+ int i;
+ int levels[2];
+ int types[2];
+ int world, time, lg, button, volume, pente, icon, sound;
+ int nice;
+ BOOL soundEnabled;
+ char res[100];
+ char textLeft[24];
+ char text[100];
+ char pText[100];
+ POINT pos;
+ RECT rect;
+ BOOL bEnable;
+ int phase;
+
+ if ( m_phase != WM_PHASE_INSERT && m_phase != WM_PHASE_BYE )
+ {
+ m_bChangeCheat = FALSE;
+
+ text[0] = 0;
+ if (m_bBuildOfficialMissions)
+ {
+ AddCheatCode(text, cheat_code[0]);
+ }
+ if (m_bAllMissions)
+ {
+ AddCheatCode(text, cheat_code[1]);
+ }
+ if ( m_pDecor->GetSuperBlupi() )
+ {
+ AddCheatCode(text, cheat_code[3]);
+ }
+ if ( m_pDecor->GetDrawSecret() )
+ {
+ AddCheatCode(text, cheat_code[11]);
+ }
+ if ( m_pDecor->GetNetPacked() )
+ {
+ AddCheatCode(text, cheat_code[19]);
+ }
+ if (!m_pDecor->GetNetMovePredict())
+ {
+ AddCheatCode(text, cheat_code[21]);
+ }
+ }
+ m_pDecor->OutputNetDebug(text);
+
+ phase = m_phase;
+
+ if (phase != WM_PHASE_PLAY && phase != WM_PHASE_PLAYTEST && phase != WM_PHASE_BUILD)
+ {
+ rect.right = 302;
+ rect.left = 2;
+ rect.top = 2;
+ rect.bottom = 14;
+ pos.x = 2;
+ pos.y = 2;
+ m_pPixmap->DrawPart(-1, 0, pos, rect, 1, FALSE);
+ }
+ DrawTextLeft(m_pPixmap, pos, text, FONTLITTLE);
+
+ if (m_phase == WM_PHASE_INIT)
+ {
+ DrawText(m_pPixmap, { 414, 446 }, "Version 2.2", FONTLITTLE);
+ }
+
+ for (int i = 0; table[m_index].buttons[i].message != 0; i++)
+ {
+ m_buttons[i].Draw();
+ }
+
+ if (m_phase == WM_PHASE_GAMER)
+ {
+ LoadString(TX_CHOOSEGAMER, res, 100);
+ lg = GetTextWidth(res, 0);
+ pos.y = 26;
+ pos.x = LXIMAGE / 2 - lg / 2;
+ DrawTextLeft(m_pPixmap, pos, res, 1);
+ *(char*)pText = m_gamerNameList[10][100];
+ lg = 8;
+ nice = 69;
+ do
+ {
+ pos.y = 69;
+ pos.x = 110;
+ DrawText(m_pPixmap, pos, pText, 0);
+ nice = 69 + 40;
+ *(char*)pText += 100;
+ lg--;
+ } while (lg != 0);
+ SetEnable(WM_PHASE_CLEARGAMER, (int)(m_filenameBuffer + -1) + m_gamer * 4 + 212);
+ }
+
+ if (m_phase == WM_PHASE_PLAY && m_phase == WM_PHASE_PLAYTEST && m_phase == WM_PHASE_BUILD)
+ m_pPixmap->DrawPart(-1, 0, pos, rect, 1, 0);
+ if (m_phase == WM_PHASE_CREATE)
+ {
+ LoadString(TX_MULTI_CREATE, res, 50);
+ lg=GetTextWidth(res);
+ pos.x = (320 - lg) / 2;
+ pos.y = 103;
+ DrawTextLeft(m_pPixmap, pos, res, FONTSLIM);
+ LoadString(TX_MULTI_GNAME, res, 100);
+ pos.x = (320 - lg) / 2;
+ pos.y = 190;
+ DrawTextLeft(m_pPixmap, pos, res, FONTSLIM);
+ }
+ if (m_phase == WM_PHASE_SETUP || m_phase == WM_PHASE_SETUPp)
+ {
+ sound = m_pSound->GetAudioVolume();
+ soundEnabled = TRUE;
+ if ((sound == 0) || (m_pSound->GetEnable()) == FALSE)
+ {
+ soundEnabled = FALSE;
+ }
+ }
+ if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST)
+ {
+ if (m_pDecor->GetPause() == 0)
+ {
+ if (m_bDemoRec != 0)
+ {
+ LoadString(TX_DEMOREC, res, 100);
+ DrawTextLeft(m_pPixmap, pos, res, FONTRED);
+ }
+ if (m_bDemoPlay != 0)
+ {
+ LoadString(TX_DEMOPLAY, res, 100);
+ DrawTextLeft(m_pPixmap, pos, res, FONTRED);
+ }
+ }
+ else
+ {
+ if (m_pDecor->GetTime() % 20 < 15)
+ {
+ DrawTextCenter(TX_PAUSE, 320, 240, 0);
+ }
+ }
+ if (m_speed > 1)
+ {
+ sprintf(res, "x%d", m_speed);
+ DrawTextLeft(m_pPixmap, pos, res, FONTWHITE);
+ }
+ }
+ if (m_phase == WM_PHASE_STOP)
+ {
+ LoadString(TX_GAMEPAUSE, res, 100);
+ lg = GetTextWidth(res);
+ pos.x = (319 - lg) / 2;
+ pos.y = 103;
+ DrawTextLeft(m_pPixmap, pos, res, FONTRED);
+ }
+ if (m_phase == WM_PHASE_MUSIC)
+ {
+ LoadString(TX_MUSIC, res, 100);
+ lg=GetTextWidth(res);
+ pos.x = (320 - lg) / 2;
+ pos.y = 84;
+ DrawTextLeft(m_pPixmap, pos, res, FONTRED);
+ }
+ if (m_phase == WM_PHASE_REGION)
+ {
+ LoadString(TX_REGION, res, 100);
+ lg = GetTextWidth(res);
+ pos.x = (320 - lg) / 2;
+ pos.y = 26;
+ DrawTextLeft(m_pPixmap, pos, res, FONTRED);
+ }
+ if (m_phase == WM_PHASE_LOST || m_phase == WM_PHASE_LOSTDESIGN || m_phase == WM_PHASE_WINMULTI)
+ {
+ LoadString(TX_LOST1 + GetWorld() % 5, res, 50);
+ DrawTextLeft(m_pPixmap, pos, res, FONTWHITE);
+ }
+ if (m_phase == WM_PHASE_WIN || m_phase == WM_PHASE_WINDESIGN || m_phase == WM_PHASE_LOSTMULTI)
+ {
+ LoadString(TX_WIN1 + GetWorld() % 5, res, 50);
+ DrawTextLeft(m_pPixmap, pos, res, FONTWHITE);
+ }
+ if (m_phase == WM_PHASE_READDESIGN)
+ {
+
+ }
+ if (m_phase == WM_PHASE_GREAD || m_phase == WM_PHASE_GREADp || m_phase == WM_PHASE_GWRITE)
+ {
+ if (m_phase == WM_PHASE_GREAD)
+ {
+ LoadString(TX_SAVE_CGAME, res, 50);
+ }
+ else
+ {
+ LoadString(TX_LOAD_CGAME, res, 50);
+ }
+ }
+ if (m_phase == WM_PHASE_BYE)
+ {
+ LoadString(TX_FULL_END1, res, 100);
+ lg = GetTextWidth(res);
+ pos.x = (320 - lg) / 2;
+ pos.y = 20;
+ DrawTextLeft(m_pPixmap, pos, res, FONTRED);
+ LoadString(TX_FULL_END2, res, 100);
+ lg = GetTextWidth(res);
+ pos.x = (320 - lg) / 2;
+ pos.y = 40;
+ DrawTextLeft(m_pPixmap, pos, res, FONTRED);
+ LoadString(TX_FULL_END3, res, 100);
+ lg = GetTextWidth(res);
+ pos.x = (320 - lg) / 2;
+ pos.y = 430;
+ DrawTextLeft(m_pPixmap, pos, res, FONTRED);
+ LoadString(TX_FULL_END4, res, 100);
+ lg = GetTextWidth(res);
+ pos.x = (320 - lg) / 2;
+ pos.y = 450;
+ DrawTextLeft(m_pPixmap, pos, res, FONTRED);
+ }
+ if (m_phase == WM_PHASE_INSERT)
+ {
+ DrawTextCenter(TX_INSERT, LXIMAGE / 2, 20);
+ }
+ if (m_textToolTips[0] != '\0')
+ {
+ DrawTextLeft(m_pPixmap, m_posToolTips, m_textToolTips, FONTWHITE);
+ }
+ if (m_phase == WM_PHASE_CLEARGAMER)
+ {
+ LoadString(TX_CHOOSEGAMER, res, 100);
+ lg = GetTextWidth((char*)res, 0);
+ pos.y = 102;
+ pos.x = 320 - lg / 2;
+ DrawTextLeft(m_pPixmap, pos, (char*)res, 1);
+ LoadString(TX_DISCARDGAME, res, 100);
+ lg = GetTextWidth(res, 0);
+ strcpy(text, (const char*)m_gamerName);
+ strcat(text, "?");
+ lg = GetTextWidth(text, 0);
+ DrawTextLeft(m_pPixmap, pos, res, 0);
+ }
+ if (m_phase == WM_PHASE_CLEARDESIGN)
+ {
+ LoadString(TX_DESIGNMISSION, res, 100);
+ lg = GetTextWidth(res, 0);
+ pos.y = 104;
+ pos.x = 320 - lg / 2;
+ DrawTextLeft(m_pPixmap, pos, res, 1);
+ LoadString(TX_DELETEMISSION, res, 100);
+ GetWorld();
+ sprintf(text, res);
+ lg = GetTextWidth(text, 0);
+ pos.y = 210;
+ pos.x = 320 - lg / 2;
+ DrawTextLeft(m_pPixmap, pos, text, 0);
+ strcpy(text, (char*)m_pDecor->GetMissionTitle());
+
+ if (text[0] == '\0')
+ {
+ LoadString(TX_NONAME, res, 100);
+ }
+ strcat(text, "?");
+ lg = GetTextWidth(text, 0);
+ pos.y = 230;
+ pos.x = 320 - lg / 2;
+ DrawTextLeft(m_pPixmap, pos, res, 0);
+ }
+ if (m_phase == WM_PHASE_INFO)
+ {
+ LoadString(TX_DESIGNMISSION, res, 100);
+ lg = GetTextWidth(res, 0);
+ pos.y = 37;
+ pos.x = 320 - lg / 2;
+ DrawTextLeft(m_pPixmap, pos, res, 0);
+ // Unknown Field
+ // DrawIcon
+ // End of if function
+ LoadString(TX_MISSIONNUM, res, 100);
+ sprintf(text, res);
+ lg = GetTextWidth(text, 0);
+ pos.y = 106;
+ pos.x = 250 - lg / 2;
+ DrawTextLeft(m_pPixmap, pos, text, 1);
+ strcpy(text, (char*)m_pDecor->GetMissionTitle());
+ if (res[0] == '\0')
+ {
+ LoadString(TX_NONAME, res, 100);
+ }
+ lg = GetTextWidth(res, 0);
+ pos.y = 269;
+ pos.x = 250 - lg / 2;
+ DrawTextLeft(m_pPixmap, pos, res, 0);
+ }
+
+ return TRUE;
+}
+
+void CEvent::PutTextInputBox(POINT pos)
+{
+ char textInput[100];
+ char* textConst;
+ int text;
+ CPixmap* pPixmap;
+ int num;
+ UINT textHili;
+ LONG posD;
+
+ text = GetTextWidth(m_textInput, 0);
+ posD = pos.x - text / 2;
+ textHili = m_textHiliStart;
+
+ if (0 < (int)textHili)
+ {
+ memcpy(textInput, textConst, textHili);
+ pPixmap = m_pPixmap;
+ textInput[textHili] = 0;
+ DrawTextLeft(pPixmap, pos, textInput, 0);
+ text += GetTextWidth(textInput, 0);
+ }
+ if (m_textHiliStart < m_textHiliEnd)
+ {
+ textHili = m_textHiliEnd - m_textHiliStart;
+ memcpy(textInput, m_textInput + m_textHiliStart, text);
+ pPixmap = m_pPixmap;
+ textInput[textHili] = 0;
+ DrawTextLeft(pPixmap, pos, textInput, 2);
+ text += GetTextWidth(textInput, 0);
+ }
+ if (m_textCursorIndex % 16 < 8)
+ {
+ pPixmap = m_pPixmap;
+ DrawTextLeft(pPixmap, pos, (char*)"|", 0);
+ }
+ num = m_textCursorIndex;
+
+ if (num < (int)strlen((const char*)m_textInput))
+ {
+ pPixmap = m_pPixmap;
+ strcpy(textInput, num + m_textInput);
+ DrawTextLeft(pPixmap, pos, textInput, 0);
+ }
+ m_textCursorIndex = m_textCursorIndex + 1;
+ return;
+}
+
+/*
+BOOL CEvent::TextSomething()
+{
+ int textHiliStart;
+ char pText;
+
+ m_textHiliStart = textHiliStart;
+
+ if (m_textHiliEnd < textHiliStart)
+ {
+ return 0;
+ }
+
+ do {
+ m_textInput[textHiliStart] =
+ m_textHiliEnd + textHiliStart;
+ pText = m_textInput + textHiliStart;
+ textHiliStart = textHiliStart + 1;
+ } while (pText != '\0');
+ m_textHiliEnd = m_textHiliStart;
+ return 1;
+}
+*/
+
+POINT CEvent::GetLastMousePos()
+{
+ return m_oldMousePos;
+}
+
+BOOL CEvent::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if (m_bDemoPlay)
+ {
+ if (message == WM_KEYDOWN ||
+ message == WM_KEYUP ||
+ message == WM_LBUTTONUP ||
+ message == WM_RBUTTONUP)
+ {
+ DemoPlayStop();
+ return TRUE;
+ }
+ if (message == WM_MOUSEMOVE)
+ {
+ return TRUE;
+ }
+ }
+
+ return TreatEventBase(message, wParam, lParam);
+}
+
+BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam)
+{
+ POINT pos;
+ int fwKeys;
+ int i, sound;
+ char c;
+ BOOL bEnable;
+
+ pos = ConvLongToPos(lParam);
+ fwKeys = wParam;
+
+ switch (message)
+ {
+ case WM_KEYDOWN:
+
+ switch (wParam)
+ {
+ case VK_END:
+ DemoRecStop();
+ return TRUE;
+ case VK_ESCAPE:
+ if (m_bRunMovie)
+ {
+ StopMovie();
+ m_pSound->SetSuspendSkip(1);
+ return TRUE;
+ }
+ if (m_phase != WM_PHASE_PLAYTEST)
+ {
+ if (m_phase != WM_PHASE_SETUP)
+ {
+ if (m_phase != WM_PHASE_NAMEGAMER)
+ {
+ if (m_phase == WM_PHASE_NAMEDESIGN)
+ {
+ m_pDecor->SetMissionTitle(m_textInput);
+ ChangePhase(WM_PHASE_INFO);
+ return TRUE;
+ }
+
+ if (m_phase == WM_PHASE_INIT || m_phase == WM_PHASE_WINMULTI) ChangePhase(WM_PHASE_GAMER); return TRUE;
+ if (m_phase == WM_PHASE_BUILD || m_phase == WM_PHASE_LOSTDESIGN || m_phase == WM_PHASE_LOST) ChangePhase(WM_PHASE_INFO); return TRUE;
+ if (m_phase != WM_PHASE_INFO && m_phase != WM_PHASE_STOP && m_phase != WM_PHASE_HELP)
+ {
+ if (m_phase == WM_PHASE_SERVICE)
+ {
+ ChangePhase(WM_PHASE_DP_DOSERVICE);
+ return TRUE;
+ }
+ if (m_phase == WM_PHASE_CREATE)
+ {
+ ChangePhase(WM_PHASE_DP_DOCREATE);
+ return TRUE;
+ }
+ if (m_phase == WM_PHASE_MULTI)
+ {
+ ChatSend();
+ return TRUE;
+ }
+ if ((m_phase != WM_PHASE_GREAD && m_phase != WM_PHASE_GREADp) || m_choiceIndex < 0 || !LoadState(m_choiceIndex))
+ {
+ if (m_phase != WM_PHASE_GWRITE) return TRUE;
+
+ if (m_choiceIndex < 0) return TRUE;
+
+ if (!SaveState(m_choiceIndex)) return TRUE;
+ }
+ }
+ }
+ }
+ strcpy(m_gamerName, m_textInput);
+ }
+ }
+
+ if (m_phase != WM_PHASE_PLAY && m_phase != WM_PHASE_PLAYTEST)
+ {
+ return FALSE;
+ }
+ // Unknown Function
+
+ case WM_LBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ m_bMouseDown = TRUE;
+ MouseSprite(pos);
+ if (EventButtons(message, wParam, lParam)) return TRUE;
+ if (m_phase == WM_PHASE_BUILD)
+ {
+ //if (BuildDown(pos, fwKeys)) return TRUE;
+ }
+ if (m_phase == WM_PHASE_PLAY)
+ {
+ // if (PlayDown(pos, fwKeys)) return TRUE;
+ }
+ break;
+ case WM_MOUSEMOVE:
+ if (m_mouseType == MOUSETYPEGRA)
+ {
+ if (m_bShowMouse)
+ {
+ ShowCursor(FALSE); // cache la souris
+ m_pPixmap->MouseShow(TRUE); // montre sprite
+ m_bShowMouse = FALSE;
+ }
+ }
+ if (m_mouseType == MOUSETYPEWINPOS &&
+ (pos.x != m_oldMousePos.x ||
+ pos.y != m_oldMousePos.y))
+ {
+ m_oldMousePos = pos;
+ ClientToScreen(m_hWnd, &m_oldMousePos);
+ SetCursorPos(m_oldMousePos.x, m_oldMousePos.y); // (*)
+ }
+ m_oldMousePos = pos;
+
+ MouseSprite(pos);
+ if (EventButtons(message, wParam, lParam)) return TRUE;
+ if (m_phase == WM_PHASE_BUILD)
+ {
+ //if (BuildMove(pos, fwKeys)) return TRUE;
+ }
+ if (m_phase == WM_PHASE_PLAY)
+ {
+ //if (PlayMove(pos, fwKeys)) return TRUE;
+ }
+ break;
+
+ case WM_NCMOUSEMOVE:
+ if (m_mouseType == MOUSETYPEGRA)
+ {
+ if (!m_bShowMouse)
+ {
+ ShowCursor(TRUE); // montre la souris
+ m_pPixmap->MouseShow(FALSE); // cache sprite
+ m_bShowMouse = TRUE;
+ }
+ }
+ break;
+
+ case WM_LBUTTONUP:
+ case WM_RBUTTONUP:
+ m_bMousePress = FALSE;
+ if (EventButtons(message, wParam, lParam)) return TRUE;
+ if (m_phase == WM_PHASE_BUILD)
+ {
+ //if (BuildUp(pos, fwKeys)) return TRUE;
+ }
+ if (m_phase == WM_PHASE_PLAY)
+ {
+ //if (PlayUp(pos, fwKeys)) return TRUE;
+ }
+ if (m_phase == WM_PHASE_BYE)
+ {
+ PostMessage(m_hWnd, WM_CLOSE, 0, 0);
+ }
+ break;
+ case WM_PHASE_INTRO1:
+ case WM_PHASE_INTRO2:
+ case WM_PHASE_INIT:
+ case WM_PHASE_PLAY:
+ case WM_PHASE_BUILD:
+ case WM_PHASE_NAMEGAMER:
+ case WM_PHASE_CLEARGAMER:
+ case WM_PHASE_INFO:
+ case WM_PHASE_PLAYTEST:
+ case WM_PHASE_SETUP:
+ case WM_PHASE_MUSIC:
+ case WM_PHASE_PLAYMOVIE:
+ case WM_PHASE_WINMOVIE:
+ case WM_PHASE_SETUPp:
+ case WM_PHASE_REGION:
+ case WM_PHASE_GAMER:
+ case WM_PHASE_WINMOVIEDESIGN:
+ case WM_PHASE_WINMOVIEMULTI:
+ case WM_PHASE_BYE:
+ case WM_PHASE_NAMEDESIGN:
+ case WM_PHASE_WRITEDESIGN:
+ case WM_PHASE_READDESIGN:
+ case WM_PHASE_CLEARDESIGN:
+ case WM_PHASE_SERVICE:
+ case WM_PHASE_DP_DOSERVICE:
+ case WM_PHASE_DP_CANCELSERVICE:
+ case WM_PHASE_SESSION:
+ case WM_PHASE_DP_JOIN:
+ case WM_PHASE_DP_CREATELOBBY:
+ case WM_PHASE_DP_REFRESH:
+ case WM_PHASE_DP_CANCELSESSION:
+ case WM_PHASE_MULTI:
+ case WM_PHASE_DP_STARTMULTI:
+ case WM_PHASE_DP_CANCELMULTI:
+ case WM_PHASE_CREATE:
+ case WM_PHASE_DP_DOCREATE:
+ case WM_PHASE_DP_CANCELCREATE:
+ case WM_PHASE_STOP:
+ case WM_PHASE_HELP:
+ case WM_PHASE_GWRITE:
+ case WM_PHASE_GREADp:
+ case WM_PHASE_GREAD:
+ case WM_PHASE_QUITPLAY:
+ case WM_PHASE_1588:
+ if (ChangePhase(message)) return TRUE;
+ break;
+ case WM_PHASE_DOPLAY:
+ m_bPrivate = FALSE;
+ m_mission = 1;
+ if (CheckCDForWorld1())
+ {
+ return ChangePhase(WM_PHASE_PLAY);
+ }
+ else
+ {
+ m_tryInsertCount = 40;
+ m_tryPhase = WM_PHASE_PLAY;
+ return ChangePhase(WM_PHASE_INSERT);
+ }
+ break;
+ case WM_PHASE_PRIVATE:
+ m_bPrivate = true;
+ return ChangePhase(WM_PHASE_INFO);
+ break;
+ case WM_PHASE_DEMO:
+ m_demoNumber = 0;
+ DemoPlayStart();
+ return FALSE;
+ break;
+ case WM_PHASE_DONAMEGAMER:
+ case WM_PHASE_DOCLEARGAMER:
+ case WM_PHASE_DONAMEDESIGN:
+ case WM_PHASE_DOWRITEDESIGN:
+ case WM_PHASE_DOREADDESIGN:
+ case WM_PHASE_DOCLEARDESIGN:
+ ChangeButtons(message);
+ return FALSE;
+ case WM_PREV:
+ i = (m_keyPress & KEY_JUMP) ? 10 : 1;
+ if (m_phase == WM_PHASE_MULTI)
+ {
+ m_multi -= i;
+ if (m_multi < 1) m_multi = 1;
+
+ m_b6D34 = m_pDecor->Read(m_gamer, m_multi + 200, FALSE);
+ if (m_b6D34) DrawMap();
+
+ NetSendLobby();
+ NetAdjustLobbyButtons();
+ return TRUE;
+ }
+
+ if (m_bPrivate)
+ {
+ m_private -= i;
+ if (m_private < 1) m_private = 1;
+
+ return ChangePhase(WM_PHASE_INFO);
+ }
+ else
+ {
+ m_mission -= i;
+ if (m_mission < 1) m_mission = 1;
+
+ return ChangePhase(WM_PHASE_INFO);
+ }
+ break;
+ case WM_NEXT:
+ i = (m_keyPress & KEY_JUMP) ? 10 : 1;
+ if (m_phase == WM_PHASE_MULTI)
+ {
+ m_multi += i;
+ if (m_multi > 12) m_multi = 12;
+
+ m_b6D34 = m_pDecor->Read(m_gamer, m_multi + 200, FALSE);
+ if (m_b6D34) DrawMap();
+
+ NetSendLobby();
+ NetAdjustLobbyButtons();
+ return TRUE;
+ }
+
+ if (m_bPrivate || !m_bBuildOfficialMissions)
+ {
+ m_private += i;
+ if (m_private > 20) m_private = 20;
+
+ return ChangePhase(WM_PHASE_INFO);
+ }
+ else
+ {
+ m_mission += i;
+ if (m_mission > 320) m_mission = 320;
+
+ return ChangePhase(WM_PHASE_INFO);
+ }
+ break;
+ case WM_MOVIE:
+ StartMovie("movie\\essai.avi");
+ ChangePhase(WM_PHASE_INIT);
+ return FALSE;
+ case WM_DECOR1:
+ SetState(WM_DECOR1, 1);
+ SetState(WM_DECOR2, 0);
+ SetState(WM_DECOR3, 0);
+ SetState(WM_DECOR4, 0);
+ SetState(WM_DECOR5, 0);
+ SetState(WM_DECOR6, 0);
+ SetState(WM_DECOR7, 0);
+ SetState(WM_DECOR8, 0);
+ SetState(WM_DECOR9, 0);
+ SetState(WM_DECOR10, 0);
+ SetState(WM_DECOR11, 0);
+
+ i = GetMenu(WM_DECOR1);
+ m_pDecor->SetFieldCC38AndStuff(1, i);
+ m_menuIndex = 0;
+ m_menuDecor[0] = i;
+ break;
+
+ case WM_DECOR2:
+ SetState(WM_DECOR1, 0);
+ SetState(WM_DECOR2, 1);
+ SetState(WM_DECOR3, 0);
+ SetState(WM_DECOR4, 0);
+ SetState(WM_DECOR5, 0);
+ SetState(WM_DECOR6, 0);
+ SetState(WM_DECOR7, 0);
+ SetState(WM_DECOR8, 0);
+ SetState(WM_DECOR9, 0);
+ SetState(WM_DECOR10, 0);
+ SetState(WM_DECOR11, 0);
+
+ i = GetMenu(WM_DECOR2);
+ m_pDecor->SetFieldCC38AndStuff(2, i);
+ m_menuIndex = 1;
+ m_menuDecor[1] = i;
+ break;
+
+ case WM_DECOR3:
+ SetState(WM_DECOR1, 0);
+ SetState(WM_DECOR2, 0);
+ SetState(WM_DECOR3, 1);
+ SetState(WM_DECOR4, 0);
+ SetState(WM_DECOR5, 0);
+ SetState(WM_DECOR6, 0);
+ SetState(WM_DECOR7, 0);
+ SetState(WM_DECOR8, 0);
+ SetState(WM_DECOR9, 0);
+ SetState(WM_DECOR10, 0);
+ SetState(WM_DECOR11, 0);
+
+ i = GetMenu(WM_DECOR3);
+ m_pDecor->SetFieldCC38AndStuff(3, i);
+ m_menuIndex = 2;
+ m_menuDecor[2] = i;
+ break;
+
+ case WM_DECOR4:
+ SetState(WM_DECOR1, 0);
+ SetState(WM_DECOR2, 0);
+ SetState(WM_DECOR3, 0);
+ SetState(WM_DECOR4, 1);
+ SetState(WM_DECOR5, 0);
+ SetState(WM_DECOR6, 0);
+ SetState(WM_DECOR7, 0);
+ SetState(WM_DECOR8, 0);
+ SetState(WM_DECOR9, 0);
+ SetState(WM_DECOR10, 0);
+ SetState(WM_DECOR11, 0);
+
+ i = GetMenu(WM_DECOR4);
+ m_pDecor->SetFieldCC38AndStuff(4, i);
+ m_menuIndex = 3;
+ m_menuDecor[3] = i;
+ break;
+
+ case WM_DECOR5:
+ SetState(WM_DECOR1, 0);
+ SetState(WM_DECOR2, 0);
+ SetState(WM_DECOR3, 0);
+ SetState(WM_DECOR4, 0);
+ SetState(WM_DECOR5, 1);
+ SetState(WM_DECOR6, 0);
+ SetState(WM_DECOR7, 0);
+ SetState(WM_DECOR8, 0);
+ SetState(WM_DECOR9, 0);
+ SetState(WM_DECOR10, 0);
+ SetState(WM_DECOR11, 0);
+
+ i = GetMenu(WM_DECOR5);
+ m_pDecor->SetFieldCC38AndStuff(5, i);
+ m_menuIndex = 4;
+ m_menuDecor[4] = i;
+ break;
+
+ case WM_DECOR6:
+ SetState(WM_DECOR1, 0);
+ SetState(WM_DECOR2, 0);
+ SetState(WM_DECOR3, 0);
+ SetState(WM_DECOR4, 0);
+ SetState(WM_DECOR5, 0);
+ SetState(WM_DECOR6, 1);
+ SetState(WM_DECOR7, 0);
+ SetState(WM_DECOR8, 0);
+ SetState(WM_DECOR9, 0);
+ SetState(WM_DECOR10, 0);
+ SetState(WM_DECOR11, 0);
+
+ i = GetMenu(WM_DECOR6);
+ m_pDecor->SetFieldCC38AndStuff(6, i);
+ m_menuIndex = 5;
+ m_menuDecor[5] = i;
+ break;
+
+ case WM_DECOR7:
+ SetState(WM_DECOR1, 0);
+ SetState(WM_DECOR2, 0);
+ SetState(WM_DECOR3, 0);
+ SetState(WM_DECOR4, 0);
+ SetState(WM_DECOR5, 0);
+ SetState(WM_DECOR6, 0);
+ SetState(WM_DECOR7, 1);
+ SetState(WM_DECOR8, 0);
+ SetState(WM_DECOR9, 0);
+ SetState(WM_DECOR10, 0);
+ SetState(WM_DECOR11, 0);
+
+ i = GetMenu(WM_DECOR7);
+ m_pDecor->SetFieldCC38AndStuff(7, i);
+ m_menuIndex = 6;
+ m_menuDecor[6] = i;
+ break;
+
+ case WM_DECOR8:
+ SetState(WM_DECOR1, 0);
+ SetState(WM_DECOR2, 0);
+ SetState(WM_DECOR3, 0);
+ SetState(WM_DECOR4, 0);
+ SetState(WM_DECOR5, 0);
+ SetState(WM_DECOR6, 0);
+ SetState(WM_DECOR7, 0);
+ SetState(WM_DECOR8, 1);
+ SetState(WM_DECOR9, 0);
+ SetState(WM_DECOR10, 0);
+ SetState(WM_DECOR11, 0);
+
+ i = GetMenu(WM_DECOR8);
+ m_pDecor->SetFieldCC38AndStuff(8, i);
+ m_menuIndex = 7;
+ m_menuDecor[7] = i;
+ break;
+
+ case WM_DECOR9:
+ SetState(WM_DECOR1, 0);
+ SetState(WM_DECOR2, 0);
+ SetState(WM_DECOR3, 0);
+ SetState(WM_DECOR4, 0);
+ SetState(WM_DECOR5, 0);
+ SetState(WM_DECOR6, 0);
+ SetState(WM_DECOR7, 0);
+ SetState(WM_DECOR8, 0);
+ SetState(WM_DECOR9, 1);
+ SetState(WM_DECOR10, 0);
+ SetState(WM_DECOR11, 0);
+
+ i = GetMenu(WM_DECOR9);
+ m_pDecor->SetFieldCC38AndStuff(9, i);
+ m_menuIndex = 8;
+ m_menuDecor[8] = i;
+ break;
+
+ case WM_DECOR10:
+ SetState(WM_DECOR1, 0);
+ SetState(WM_DECOR2, 0);
+ SetState(WM_DECOR3, 0);
+ SetState(WM_DECOR4, 0);
+ SetState(WM_DECOR5, 0);
+ SetState(WM_DECOR6, 0);
+ SetState(WM_DECOR7, 0);
+ SetState(WM_DECOR8, 0);
+ SetState(WM_DECOR9, 0);
+ SetState(WM_DECOR10, 1);
+ SetState(WM_DECOR11, 0);
+
+ i = GetMenu(WM_DECOR10);
+ m_pDecor->SetFieldCC38AndStuff(10, i);
+ m_menuIndex = 9;
+ m_menuDecor[9] = i;
+ break;
+
+ case WM_DECOR11:
+ SetState(WM_DECOR1, 0);
+ SetState(WM_DECOR2, 0);
+ SetState(WM_DECOR3, 0);
+ SetState(WM_DECOR4, 0);
+ SetState(WM_DECOR5, 0);
+ SetState(WM_DECOR6, 0);
+ SetState(WM_DECOR7, 0);
+ SetState(WM_DECOR8, 0);
+ SetState(WM_DECOR9, 0);
+ SetState(WM_DECOR10, 0);
+ SetState(WM_DECOR11, 1);
+
+ i = GetMenu(WM_DECOR11);
+ m_pDecor->SetFieldCC38AndStuff(11, i);
+ m_menuIndex = 10;
+ m_menuDecor[10] = i;
+ break;
+
+ case WM_BUTTON0:
+ case WM_BUTTON1:
+ case WM_BUTTON2:
+ case WM_BUTTON3:
+ case WM_BUTTON4:
+ case WM_BUTTON5:
+ case WM_BUTTON6:
+ case WM_BUTTON7:
+ case WM_BUTTON8:
+ case WM_BUTTON9:
+ case WM_BUTTON10:
+ case WM_BUTTON11:
+ case WM_BUTTON12:
+ case WM_BUTTON13:
+ case WM_BUTTON14:
+ case WM_BUTTON15:
+ case WM_BUTTON16:
+ case WM_BUTTON17:
+ case WM_BUTTON18:
+ case WM_BUTTON19:
+ case WM_BUTTON20:
+ case WM_BUTTON21:
+ case WM_BUTTON22:
+ case WM_BUTTON23:
+ case WM_BUTTON24:
+ case WM_BUTTON25:
+ case WM_BUTTON26:
+ case WM_BUTTON27:
+ case WM_BUTTON28:
+ case WM_BUTTON29:
+ case WM_BUTTON30:
+ case WM_BUTTON31:
+ case WM_BUTTON32:
+ case WM_BUTTON33:
+ case WM_BUTTON34:
+ case WM_BUTTON35:
+ case WM_BUTTON36:
+ case WM_BUTTON37:
+ case WM_BUTTON38:
+ case WM_BUTTON39:
+ ChangeButtons(message);
+ break;
+ }
+
+ return FALSE;
+}
+
+BOOL CEvent::LoadState(BOOL save)
+{
+ BOOL saveNum;
+ CEvent* pEvent;
+
+ saveNum = save;
+
+ if (m_pDecor->CurrentRead(m_gamer, save, (BOOL*)&pEvent, &save) == FALSE)
+ {
+ return FALSE;
+ }
+ m_bPrivate = save;
+ SetMission((int)pEvent);
+ m_saveIndex = saveNum;
+ return TRUE;
+}
+
+int CEvent::MousePosToSprite(POINT pos)
+{
+ int sprite;
+
+ sprite = SPRITE_POINTER;
+
+ if (m_phase == WM_PHASE_PLAY ||
+ m_phase == WM_PHASE_PLAYTEST ||
+ m_phase == WM_PHASE_BUILD ||
+ m_phase == WM_PHASE_BYE ||
+ !MouseOnButton(pos))
+ {
+ sprite = SPRITE_POINTER;
+ }
+ if (m_bWaitMouse)
+ {
+ sprite = SPRITE_WAIT;
+ }
+ if (m_bHideMouse)
+ {
+ sprite = SPRITE_EMPTY;
+ }
+ if (m_bFillMouse)
+ {
+ sprite = SPRITE_FILL;
+ }
+
+ return sprite;
+}
+
+void CEvent::MouseSprite(POINT pos)
+{
+ m_mouseSprite = MousePosToSprite(pos);
+
+ m_pPixmap->SetMousePosSprite(pos, m_mouseSprite, m_bDemoPlay);
+ ChangeSprite(m_mouseSprite);
+}
+
+void CEvent::WaitMouse(BOOL bWait)
+{
+ m_bWaitMouse = bWait;
+
+ if ( bWait )
+ {
+ m_mouseSprite = SPRITE_WAIT;
+ }
+ else
+ {
+ m_mouseSprite = MousePosToSprite(GetMousePos());
+ }
+ m_pPixmap->SetMouseSprite(m_mouseSprite, m_bDemoPlay);
+ ChangeSprite(m_mouseSprite);
+}
+
+void CEvent::HideMouse(BOOL bHide)
+{
+ m_bWaitMouse = bHide;
+
+ if ( bHide )
+ {
+ m_mouseSprite = SPRITE_EMPTY;
+ }
+ else
+ {
+ m_mouseSprite = MousePosToSprite(GetMousePos());
+ }
+ m_pPixmap->SetMouseSprite(m_mouseSprite, m_bDemoPlay);
+ ChangeSprite(m_mouseSprite);
+}
+
+void CEvent::FillMouse(int bFill)
+{
+ m_bFillMouse = bFill;
+
+ if (bFill)
+ {
+ m_mouseSprite = SPRITE_FILL;
+ }
+ else
+ {
+ m_mouseSprite = MousePosToSprite(GetMousePos());
+ }
+ m_pPixmap->SetMouseSprite(m_mouseSprite, m_bDemoPlay);
+ ChangeSprite(m_mouseSprite);
+}
+
+BOOL CEvent::EventButtons(UINT message, WPARAM wParam, LPARAM lParam)
+{
+ POINT pos, test;
+ int i, lg, oldx, sound, res;
+ UINT uid;
+
+ m_textToolTips[0] = 0;
+ oldx = m_posToolTips.x;
+ m_posToolTips.x = -1;
+ if (m_phase != WM_PHASE_PLAY && m_phase != WM_PHASE_PLAYTEST)
+ {
+ for (i = 0; i < 2; i++)
+ {
+ if (!m_jauges[i].GetHide())
+ {
+
+ uid = 0xFFFFFFF;
+
+ if (uid < 0)
+ {
+ LoadString(TX_NOTINDEMO + i, m_textToolTips, 50);
+ lg = GetTextWidth(m_textToolTips);
+ test.x += (DIMJAUGEX - lg) / 2;
+ test.y += 4;
+ m_posToolTips = test;
+ break;
+ }
+ }
+ }
+ if (oldx != m_posToolTips.x)
+ {
+ for (i = 0; i < 2; i++)
+ {
+ m_jauges[i].Redraw();
+ }
+ }
+ }
+ else
+ {
+ i = 0;
+ while (table[m_index].buttons[i].message != 0)
+ {
+ res = m_buttons[i].GetToolTips(pos);
+ if (res != -1)
+ {
+ LoadString(res, m_textToolTips, 50);
+ lg = GetTextWidth(m_textToolTips);
+ pos.x += 10;
+ pos.y += 20;
+ if (pos.x > LXIMAGE - lg) pos.x = LXIMAGE - lg;
+ if (pos.y > LYIMAGE - 14) pos.y = LYIMAGE - 14;
+ m_posToolTips = pos;
+ break;
+ }
+ i++;
+ }
+ }
+ i = 0;
+ while (table[m_index].buttons[i].message != 0)
+ {
+ if (m_buttons[i].TreatEvent(message, wParam, lParam)) return TRUE;
+ i++;
+ }
+ if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST)
+ {
+ if (m_menu.TreatEvent(message, wParam, lParam)) return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL CEvent::MouseOnButton(POINT pos)
+{
+ int i;
+
+ i = 0;
+ while ( table[m_index].buttons[i].message != 0 )
+ {
+ if ( m_buttons[i].MouseOnButton(pos) ) return TRUE;
+ i ++;
+ }
+
+ return FALSE;
+}
+
+int CEvent::SearchPhase(UINT phase)
+{
+ int i = 0;
+
+ while (table[i].phase != 0)
+ {
+ if (table[i].phase == phase) return i;
+ i++;
+ }
+
+ return -1;
+}
+
+int CEvent::GetWorld()
+{
+ //m_mission = mission;
+ if (m_bPrivate) return m_bPrivate;
+ if (m_bMulti) return m_multi+200;
+ else return m_mission;
+}
+
+int CEvent::GetPhysicalWorld()
+{
+ if ( m_bPrivate ) return m_bPrivate;
+ if ( m_bMulti ) return m_multi+200;
+ else return m_mission;
+}
+
+BOOL CEvent::IsPrivate()
+{
+ return m_bPrivate;
+}
+
+BOOL CEvent::IsMulti()
+{
+ return m_bMulti;
+}
+
+int CEvent::GetWorldGroup()
+{
+ int mission;
+ m_mission = mission;
+
+ if (m_mission % 10 != 0 && m_mission != 99)
+ {
+ m_mission = (mission / 10) * 10;
+ return -(m_mission >> 31);
+ }
+ m_mission = 1;
+ return m_mission / 10;
+}
+
+void CEvent::SetMission(int index)
+{
+ if (m_bPrivate != 0)
+ {
+ m_private = index;
+ return;
+ }
+ if (m_bMulti != 0)
+ {
+ m_multi = index;
+ return;
+ }
+ m_mission = index;
+ return;
+}
+
+UINT CEvent::GetPhase()
+{
+ return m_phase;
+}
+
+void CEvent::TryInsert()
+{
+ if ( m_tryInsertCount == 0 )
+ {
+ ChangePhase(m_tryPhase);
+ }
+ else
+ {
+ m_tryInsertCount --;
+ }
+}
+
+void CEvent::ReadAll()
+{
+ BOOL mission;
+ BOOL read;
+ BOOL bUser;
+ BOOL bPrivate;
+ BOOL bMission;
+
+ if ((-1 < m_choiceIndex) && (*(int*)((int)(m_filenameBuffer + -1) + m_choiceIndex * 4 + 216) != 0))
+ {
+ //mission = m_pDecor->MissionStart(m_gamer, 999, bUser);
+
+ if (mission != FALSE)
+ {
+ read = m_pDecor->CurrentRead(m_gamer, m_choiceIndex, &bMission, &bPrivate);
+
+ if (read != FALSE)
+ {
+ //m_pDecor->DrawMap(FALSE, -1);
+ }
+ m_pDecor->CurrentRead(m_gamer, 999, &bMission, &bPrivate);
+ }
+ }
+ return;
+}
+
+BOOL CEvent::SaveState(int rank)
+{
+ BOOL bMission;
+ BOOL bUser;
+ char str[100];
+
+ //bMission = m_pDecor->MissionStart(m_gamer, rank, bUser);
+
+ if (bMission == FALSE)
+ {
+ return FALSE;
+ }
+ LoadString(TX_GAMESAVED, str, 100);
+ m_pDecor->NotifPush(str);
+ // m_field959_0x6d10 = rank;
+ return TRUE;
+}
+
+void CEvent::SomethingUserMissions(char* lpFilename, LPCSTR fileSomething)
+{
+ UINT buffer;
+ char* folderName;
+
+ mkdir("\\User");
+ strcpy(lpFilename, "\\User\\");
+ strcat(lpFilename, fileSomething);
+
+ if ((folderName = strstr(folderName, ".xch")) || ((buffer = 0, folderName - lpFilename != strlen(lpFilename) - 4)))
+ {
+ buffer = 0;
+ strcat(lpFilename, ".xch");
+ }
+ return;
+}
+
+// Add SomethingHubWorld once figured out.
+
+// Very rough code, needs improvement
+
+BOOL CEvent::ChangePhase(UINT phase)
+{
+ int index, world, time, total, music, i, max, mission;
+ POINT totalDim, iconDim;
+ char str[MAX_PATH];
+ char* pButtonExist;
+ BOOL bEnable, bHide;
+ char* playerName;
+
+ sprintf(str, "CEvent::ChangePhase [Begin] --- %d\r\n", phase - WM_USER);
+ OutputNetDebug(str);
+ if (phase == WM_PHASE_1588)
+ {
+ PostMessage(m_hWnd, WM_CLOSE, 0, 0);
+ return TRUE;
+ }
+ m_pDecor->SetDemoPlay(m_bDemoPlay);
+ if (m_mouseType == MOUSETYPEGRA && m_bFullScreen)
+ {
+ m_bShowMouse = FALSE;
+ }
+ if (phase == WM_PHASE_QUITPLAYTEST)
+ {
+ m_pDecor->Read(m_gamer, 999, TRUE);
+ phase = WM_PHASE_BUILD;
+ }
+
+ if (!m_bDemoPlay &&
+ phase == WM_PHASE_PLAY ||
+ m_phase == WM_PHASE_PLAY ||
+ phase == WM_PHASE_STOP ||
+ phase == WM_PHASE_SETUP ||
+ phase == WM_PHASE_HELP ||
+ phase == WM_PHASE_GREAD ||
+ phase == WM_PHASE_GREADp ||
+ phase == WM_PHASE_GWRITE)
+ {
+ m_pSound->StopMusic();
+ }
+
+ m_textToolTips[0] = 0;
+ m_posToolTips.x = -1;
+ m_pDecor->SetPause(FALSE);
+ m_bHili = FALSE;
+ m_bCtrlDown = FALSE;
+ m_bMouseDown = FALSE;
+ m_bInfoHelp = FALSE;
+
+
+ if (phase == WM_PHASE_INIT)
+ {
+ m_demoTime = 0;
+ }
+ if (phase == WM_PHASE_PLAY)
+ {
+ if (!m_bDemoPlay && GetWorld() > 299 && GetWorld() < 320)
+ {
+ DemoRecStart();
+ }
+ }
+ else
+ {
+ DemoRecStop();
+ }
+
+ if (phase == WM_PHASE_QUITPLAY)
+ {
+ if (!m_bPrivate)
+ {
+ if (!m_bMulti)
+ {
+ mission = m_mission;
+ if (mission != 1)
+ {
+ if (mission == 99 || mission % 10 == 0)
+ {
+ mission = 1;
+ }
+ else
+ {
+ mission = (mission / 10) * 10;
+ }
+ SetMission(mission);
+ m_phase = WM_PHASE_PLAY;
+
+ return ChangePhase(WM_PHASE_PLAY);
+ }
+ }
+ }
+ else if (!m_bMulti)
+ {
+ return ChangePhase(WM_PHASE_INFO);
+ }
+ }
+ if (phase == WM_PHASE_DP_DOSERVICE)
+ {
+ // ...
+ }
+ if (phase == WM_PHASE_DP_CANCELSERVICE)
+ {
+ // ...
+ }
+ if (phase == WM_PHASE_DP_JOIN)
+ {
+ // ...
+ }
+ if (phase == WM_PHASE_DP_CREATELOBBY)
+ {
+ // ...
+ }
+ if (phase == WM_PHASE_DP_REFRESH)
+ {
+ // ...
+ }
+ if (phase == WM_PHASE_DP_CANCELSESSION)
+ {
+ // ...
+ }
+ if (phase == WM_PHASE_DP_DOCREATE)
+ {
+ // ...
+ }
+ if (phase == WM_PHASE_DP_CANCELCREATE)
+ {
+ // ...
+ }
+ if (phase == WM_PHASE_DP_STARTMULTI)
+ {
+ // ...
+ }
+ if (phase == WM_PHASE_DP_CANCELMULTI)
+ {
+ // ...
+ }
+
+ if (SearchPhase(phase) < 0)
+ {
+ return 0;
+ }
+ m_pPixmap->MouseInvalidate();
+ HideMouse(FALSE);
+ WaitMouse(TRUE);
+
+ if (phase == WM_PHASE_GAMER || phase == WM_PHASE_PLAY)
+ {
+ OutputNetDebug("CEvent::ChangePhase_[WriteInfo]\r\n");
+ WriteInfo(m_gamer);
+ }
+
+ int oldPhase = m_phase;
+ if ((oldPhase == WM_PHASE_BUILD && phase == WM_PHASE_INFO) || oldPhase == WM_PHASE_REGION || oldPhase == WM_PHASE_NAMEDESIGN || oldPhase == WM_PHASE_MUSIC)
+ {
+ m_pDecor->Write(m_gamer, GetWorld(), !m_bBuildOfficialMissions);
+ }
+
+ m_phase = phase;
+ m_index = SearchPhase(phase);
+ if (table[m_index].bUnk && !CheckCDForWorld1())
+ {
+ m_tryInsertCount = 40;
+ m_tryPhase = m_phase;
+ return ChangePhase(WM_PHASE_INSERT);
+ }
+
+ if (table[m_index].backName[0] != '\0')
+ {
+ strcpy(str, table[m_index].backName);
+ if (str[0] != '\0')
+ {
+ if (table[m_index].bCDrom)
+ {
+ AddCDPath(str);
+ }
+ if (!m_pPixmap->BackgroundCache(0, str, { LXIMAGE, LYIMAGE }, { 0,0 }, FALSE))
+ {
+ OutputNetDebug("CEvent::ChangePhase [Cache error]\r\n");
+ WaitMouse(FALSE);
+ m_tryInsertCount = 40;
+ m_tryPhase = m_phase;
+ return ChangePhase(WM_PHASE_INSERT);
+ }
+ }
+ }
+
+ if (m_phase == WM_PHASE_PLAY && !m_bPrivate &&
+ oldPhase != WM_PHASE_SETUPp &&
+ oldPhase != WM_PHASE_HELP &&
+ oldPhase != WM_PHASE_GREAD &&
+ oldPhase != WM_PHASE_GREADp &&
+ oldPhase != WM_PHASE_GWRITE &&
+ oldPhase != WM_PHASE_STOP)
+ {
+ sprintf(str, "CEvent::ChangePhase [Read] %d, %d\r\n", m_gamer, GetWorld());
+ OutputNetDebug(str);
+
+ if (!m_pDecor->Read(m_gamer, GetWorld(), FALSE))
+ {
+ OutputNetDebug("CEvent::ChangePhase [Read error]\r\n");
+ m_tryInsertCount = 40;
+ m_tryPhase = m_phase;
+ return ChangePhase(WM_PHASE_INSERT);
+ }
+ m_pDecor->DrawMap(TRUE, -1);
+ }
+
+ if (m_phase == WM_PHASE_INFO && m_bPrivate)
+ {
+ m_b6D34 = m_pDecor->Read(m_gamer, GetWorld(), !m_bBuildOfficialMissions);
+ if (m_b6D34)
+ {
+ m_pDecor->DrawMap(TRUE, -1);
+ }
+ }
+
+ if ((m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST) &&
+ oldPhase != WM_PHASE_SETUPp &&
+ oldPhase != WM_PHASE_HELP &&
+ oldPhase != WM_PHASE_GREAD &&
+ oldPhase != WM_PHASE_GREADp &&
+ oldPhase != WM_PHASE_GWRITE &&
+ oldPhase != WM_PHASE_STOP)
+ {
+ m_pDecor->AdaptDoors(m_bPrivate, GetWorld());
+ }
+
+ if (m_phase == WM_PHASE_TESTCD)
+ {
+ if (m_pDecor->Read(1, 1, FALSE))
+ {
+ return ChangePhase(WM_PHASE_INIT);
+ }
+ else
+ {
+ m_tryInsertCount = 40;
+ m_tryPhase = m_phase;
+ return ChangePhase(WM_PHASE_INSERT);
+ }
+ }
+
+ if (m_phase == WM_PHASE_PLAYTEST)
+ {
+ m_pDecor->Write(m_gamer, 999, TRUE);
+ m_pDecor->PlayPrepare(TRUE);
+ }
+
+ if (m_phase == WM_PHASE_PLAY &&
+ oldPhase != WM_PHASE_SETUPp &&
+ oldPhase != WM_PHASE_HELP &&
+ oldPhase != WM_PHASE_GREAD &&
+ oldPhase != WM_PHASE_GREADp &&
+ oldPhase != WM_PHASE_GWRITE &&
+ oldPhase != WM_PHASE_STOP)
+ {
+ if (m_bPrivate || m_bMulti)
+ {
+ m_pDecor->PlayPrepare(TRUE);
+ }
+ else
+ {
+ m_pDecor->PlayPrepare(FALSE);
+ m_pDecor->SetNbVies(m_nbVies);
+ }
+ }
+
+ if (m_phase == WM_PHASE_BUILD)
+ {
+ m_pDecor->BuildPrepare();
+ }
+
+ CreateButtons();
+ m_96B4 = 0;
+ m_menu.Delete();
+ if (m_phase == WM_PHASE_BUILD)
+ {
+ SetState(m_menuIndex + WM_DECOR1, 1);
+ SetMenu(WM_DECOR1, m_menuDecor[0]);
+ SetMenu(WM_DECOR2, m_menuDecor[1]);
+ SetMenu(WM_DECOR3, m_menuDecor[2]);
+ SetMenu(WM_DECOR4, m_menuDecor[3]);
+ SetMenu(WM_DECOR5, m_menuDecor[4]);
+ SetMenu(WM_DECOR6, m_menuDecor[5]);
+ SetMenu(WM_DECOR7, m_menuDecor[6]);
+ SetMenu(WM_DECOR8, m_menuDecor[7]);
+ SetMenu(WM_DECOR9, m_menuDecor[8]);
+ SetMenu(WM_DECOR10, m_menuDecor[9]);
+ SetMenu(WM_DECOR11, m_menuDecor[10]);
+ m_pDecor->SetFieldCC38AndStuff(m_menuIndex + 1, GetMenu(m_menuIndex + WM_DECOR1));
+ }
+ if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST || m_phase == WM_PHASE_BUILD)
+ {
+ OutputNetDebug("CEvent::ChangePhase [LoadImages]\r\n");
+ m_pDecor->LoadImages();
+ }
+ if (m_phase == WM_PHASE_INFO)
+ {
+ SetEnable(WM_PREV, GetWorld() != 1);
+ if (m_bBuildOfficialMissions)
+ {
+ SetEnable(WM_NEXT, GetWorld() < 319);
+ }
+ else
+ {
+ SetEnable(WM_NEXT, GetWorld() < 20);
+ }
+ SetHide(WM_PHASE_BUILD, FALSE);
+ SetEnable(WM_PHASE_WRITEDESIGN, m_b6D34);
+ SetEnable(WM_PHASE_READDESIGN, !m_b6D34);
+ SetEnable(WM_PHASE_CLEARDESIGN, m_b6D34);
+ SetEnable(WM_PHASE_PLAYMOVIE, m_b6D34);
+ }
+ if (m_phase == WM_PHASE_GAMER)
+ {
+ WriteInfo(m_gamer);
+ // ...
+ }
+ if (m_phase == WM_PHASE_NAMEGAMER)
+ {
+ // ...
+ }
+ if (m_phase == WM_PHASE_NAMEDESIGN)
+ {
+ // ...
+ }
+ if (m_phase == WM_PHASE_MUSIC)
+ {
+ int music = m_pDecor->GetMusic();
+ for (int i = 0; i < 11; i++)
+ {
+ SetState(WM_BUTTON1 + i, i == music);
+ }
+ }
+ if (m_phase == WM_PHASE_REGION)
+ {
+ int region = m_pDecor->GetRegion();
+ for (int i = 0; i < 32; i++)
+ {
+ SetState(WM_BUTTON1 + i, i == region);
+ }
+ POINT dim = m_pDecor->GetDim();
+ if (dim.x == MAXCELX)
+ {
+ if (dim.y == MAXCELY)
+ {
+ SetState(WM_DIMS1, 1);
+ SetState(WM_DIMS2, 0);
+ SetState(WM_DIMS3, 0);
+ SetState(WM_DIMS4, 0);
+ }
+ if (dim.y == 0)
+ {
+ SetState(WM_DIMS1, 0);
+ SetState(WM_DIMS2, 1);
+ SetState(WM_DIMS3, 0);
+ SetState(WM_DIMS4, 0);
+ }
+ }
+ else if (dim.y == MAXCELY)
+ {
+ SetState(WM_DIMS1, 0);
+ SetState(WM_DIMS2, 0);
+ SetState(WM_DIMS3, 1);
+ SetState(WM_DIMS4, 0);
+ }
+ else
+ {
+ SetState(WM_DIMS1, 0);
+ SetState(WM_DIMS2, 0);
+ SetState(WM_DIMS3, 0);
+ SetState(WM_DIMS4, 1);
+ }
+ }
+ if (m_phase == WM_PHASE_SERVICE)
+ {
+ m_pNetwork->EnumProviders();
+ m_nbChoices = m_pNetwork->GetNbProviders();
+ m_choicePageOffset = 0;
+ m_choiceIndex = 0;
+ SetHide(WM_BUTTON10, TRUE);
+ // ...
+ }
+ if (m_phase == WM_PHASE_SESSION)
+ {
+ // ...
+ }
+ if (m_phase == WM_PHASE_MULTI)
+ {
+ // ...
+ }
+ if (m_phase == WM_PHASE_CREATE)
+ {
+ // ...
+ }
+ if (m_phase == WM_PHASE_STOP && m_bMulti)
+ {
+ SetEnable(WM_PHASE_GWRITE, 0);
+ SetEnable(WM_PHASE_GREADp, 0);
+ }
+ if (m_phase == WM_PHASE_WRITEDESIGN || m_phase == WM_PHASE_READDESIGN)
+ {
+ // ...
+ }
+ if (m_phase == WM_PHASE_READDESIGN)
+ {
+ // ...
+ }
+ if (m_phase == WM_PHASE_WRITEDESIGN)
+ {
+ // ...
+ }
+ if (m_phase == WM_PHASE_GWRITE || m_phase == WM_PHASE_GREADp || m_phase == WM_PHASE_GREAD)
+ {
+ // ...
+ }
+ if (m_phase == WM_PHASE_SETUP || m_phase == WM_PHASE_SETUPp)
+ {
+ m_0008 = 0;
+ // ...
+ }
+ if ((m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST || m_phase == WM_PHASE_MUSIC) && !m_bDemoPlay)
+ {
+ if (!m_pSound->IsPlayingMusic())
+ {
+ int music = m_pDecor->GetMusic();
+ if (music > 0)
+ {
+ m_pSound->PlayMusic(m_hWnd, music);
+ }
+ }
+ else
+ {
+ m_pSound->AdaptVolumeMusic();
+ }
+ }
+ if (m_phase == WM_PHASE_PLAYMOVIE)
+ {
+ sprintf(m_movieToStart, "movie\\play%.3d.avi", GetWorld());
+ AddCDPath(m_movieToStart);
+ m_phaseAfterMovie = WM_PHASE_PLAY;
+ }
+ if (m_phase == WM_PHASE_WINMOVIE)
+ {
+ sprintf(m_movieToStart, "movie\\win%.3d.avi", GetWorld());
+ AddCDPath(m_movieToStart);
+ m_phaseAfterMovie = WM_PHASE_WIN;
+ }
+ if (m_phase == WM_PHASE_WINMOVIEDESIGN)
+ {
+ sprintf(m_movieToStart, "movie\\win%.3d.avi", GetWorld());
+ AddCDPath(m_movieToStart);
+ m_phaseAfterMovie = WM_PHASE_WINDESIGN;
+ }
+ if (m_phase == WM_PHASE_WINMOVIEMULTI)
+ {
+ sprintf(m_movieToStart, "movie\\win%.3d.avi", GetWorld());
+ AddCDPath(m_movieToStart);
+ m_phaseAfterMovie = WM_PHASE_LOSTMULTI; // ?
+ }
+ WaitMouse(FALSE);
+ if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST)
+ {
+ FillMouse(TRUE);
+ }
+ m_pDecor->VehicleSoundsPhase(phase);
+ OutputNetDebug("CEvent::ChangePhase [End]");
+
+ return TRUE;
+
+}
+
+// Implement LoadLevel
+
+void CEvent::MovieToStart()
+{
+ if (m_movieToStart[0] != 0)
+ {
+ HideMouse(TRUE);
+
+ if (StartMovie(m_movieToStart))
+ {
+ m_phase = m_phaseAfterMovie;
+ }
+ else
+ {
+ ChangePhase(m_phaseAfterMovie);
+ }
+
+ m_movieToStart[0] = 0;
+ }
+}
+
+void CEvent::MouseRelease()
+{
+ m_bMouseRelease = TRUE;
+ ShowCursor(TRUE);
+ return;
+}
+
+void CEvent::MouseCapture()
+{
+ m_bMouseRelease = FALSE;
+ ShowCursor(FALSE);
+ return;
+}
+
+BOOL CEvent::NetCreate(int session)
+{
+ BOOL created;
+
+ MouseRelease();
+ created = m_pNetwork->CreateProvider(session);
+ MouseCapture();
+ return created;
+}
+
+BOOL CEvent::NetEnumSessions()
+{
+ BOOL enumSess;
+
+ MouseRelease();
+ enumSess = m_pNetwork->EnumProviders();
+ MouseCapture();
+ return enumSess;
+}
+
+BOOL CEvent::BuildUp(POINT pos, int fwKeys)
+{
+ return TRUE;
+}
+
+/*
+void CEvent::TryPhase()
+{
+ m_tryPhase = 1;
+ ShowCursor(1);
+}
+
+void CEvent::UnTryPhase()
+{
+ m_tryPhase = 0;
+ ShowCursor(1);
+}
+
+int CEvent::GetTryPhase()
+{
+ return m_tryPhase;
+}
+
+void CEvent::GetDoors(int doors)
+{
+ for (int i = 0; i < 200; i++)
+ {
+ doors[i] = (int)data[Gamer];
+ }
+}
+
+
+void CEvent::TableSomething()
+{
+ char filename[MAX_PATH];
+
+ if (strstr(filename, table[m_index].backName))
+ {
+ AddCDPath(filename);
+ }
+ if (!m_pPixmap->CacheAll(CHBACK, filename, totalDim, iconDim, FALSE, GetRegion()))
+ {
+ return;
+ }
+}
+*/
+
+
+
+BOOL CEvent::StartMovie(char* pFilename)
+{
+ RECT rect;
+ char filename[MAX_PATH];
+
+ if (!m_pMovie->GetEnable()) return FALSE;
+ if (!m_bMovie) return FALSE;
+
+ if (!m_pMovie->IsExist(pFilename)) return FALSE;
+
+ rect.left = 1;
+ rect.top = 1;
+ rect.right = LXIMAGE - 2;
+ rect.bottom = LYIMAGE - 2;
+
+ m_pSound->StopMusic();
+ m_pPixmap->SavePalette();
+
+ strcpy(filename, pFilename);
+ strcpy(filename + strlen(filename) - 4, ".blp");
+ m_pSound->Cache(SOUND_MOVIE, filename);
+
+ if (m_pMovie->Play(m_hWnd, rect, pFilename)) return FALSE;
+ m_bRunMovie = TRUE;
+ m_pSound->Play(SOUND_MOVIE, 0, 0);
+ return TRUE;
+}
+
+void CEvent::StopMovie()
+{
+ m_pMovie->Stop(m_hWnd);
+ m_pPixmap->RestorePalette();
+ m_pPixmap->MouseInvalidate();
+ m_pSound->Flush(SOUND_MOVIE);
+ ChangePhase(m_phase);
+ m_bRunMovie = FALSE;
+}
+
+BOOL CEvent::IsMovie()
+{
+ return m_bRunMovie;
+}
+
+BOOL CEvent::IsMouseRelease()
+{
+ return m_bMouseRelease;
+}
+
+BOOL CEvent::ReadLibelle(int world, BOOL bSchool, BOOL bHelp)
+{
+ FILE* file = NULL;
+ char* pBuffer = NULL;
+ char* pText;
+ char* pDest;
+ char indic;
+ int nb, h1, h2;
+
+ pBuffer = (char*)malloc(sizeof(char) * 2560);
+ if (pBuffer == NULL) goto error;
+ memset(pBuffer, 0, sizeof(char) * 2560);
+
+ //file = fopen
+
+
+error:
+ if (pBuffer != NULL) free(pBuffer);
+ if (file != NULL) fclose(file);
+ return FALSE;
+}
+
+void CEvent::SetLives(int lives)
+{
+ m_lives = lives;
+}
+
+void CEvent::SetSpeed(int speed)
+{
+ if ( speed > 2 ) speed = 2;
+
+ m_speed = speed;
+}
+
+int CEvent::GetSpeed()
+{
+ return m_speed;
+}
+
+BOOL CEvent::GetPause()
+{
+ return m_bPause;
+}
+
+int CEvent::MissionBack()
+{
+ int num = m_mission;
+
+ if (num % 10 == 0 ||
+ num == 99)
+ {
+ m_mission = 1;
+ return num / 10;
+ }
+ else
+ {
+ m_mission = num / 10 * 10;
+ return (num < 0);
+ }
+}
+
+void CEvent::DemoRecStart()
+{
+ m_pDemoBuffer = (DemoEvent*)malloc(MAXDEMO*sizeof(DemoEvent));
+ if ( m_pDemoBuffer == NULL ) return;
+ memset(m_pDemoBuffer, 0, MAXDEMO*sizeof(DemoEvent));
+
+ m_demoTime = 0;
+ m_demoIndex = 0;
+ m_bDemoRec = TRUE;
+ m_bDemoPlay = FALSE;
+
+ InitRandom();
+ m_pDecor->SetTime(0);
+ m_speed = 1;
+}
+
+void CEvent::DemoRecStop()
+{
+ FILE* file = NULL;
+ DemoHeader header;
+
+ if ( m_bDemoPlay ) return;
+
+ if ( m_pDemoBuffer != NULL )
+ {
+ DeleteFileA("data\\demo.3d.blp");
+ file = fopen("data\\demo.3d.blp", "wb");
+ if ( file != NULL )
+ {
+ memset(&header, 0, sizeof(DemoHeader));
+ header.majRev = 1;
+ header.minRev = 0;
+ header.bSchool = m_bSchool;
+ header.bPrivate = m_bPrivate;
+ fwrite(&header, sizeof(DemoHeader), 1, file);
+ fwrite(m_pDemoBuffer, sizeof(DemoEvent), m_demoIndex, file);
+ fclose(file);
+ }
+ free(m_pDemoBuffer);
+ m_pDemoBuffer = NULL;
+ }
+
+ m_bDemoRec = FALSE;
+ m_demoTime = 0;
+}
+
+BOOL CEvent::DemoPlayStart()
+{
+ char filename[MAX_PATH];
+ FILE* file = NULL;
+ DemoHeader header;
+ int nb, world, time, total, mission;
+
+ m_pDemoBuffer = (DemoEvent*)malloc(MAXDEMO * sizeof(DemoEvent));
+ if (m_pDemoBuffer == NULL) return FALSE;
+ memset(m_pDemoBuffer, 0, MAXDEMO * sizeof(DemoEvent));
+
+ sprintf(filename, "data\\demo%.3d.blp", m_demoNumber);
+ AddCDPath(filename); // ajoute l'acc�s au CD-Rom
+ file = fopen(filename, "rb");
+ if (file == NULL)
+ {
+ DemoPlayStop();
+ return FALSE;
+ }
+
+ nb = fread(&header, sizeof(DemoHeader), 1, file);
+ if (nb < 1)
+ {
+ DemoPlayStop();
+ return FALSE;
+ }
+ m_bSchool = header.bSchool;
+ m_bPrivate = header.bPrivate;
+ //m_pDecor->SetSkill(header.skill);
+
+ m_demoEnd = fread(m_pDemoBuffer, sizeof(DemoEvent), MAXDEMO, file);
+ fclose(file);
+
+ m_demoTime = 0;
+ m_demoIndex = 0;
+ m_bDemoPlay = TRUE;
+ m_bDemoRec = FALSE;
+
+ /*
+ if (!m_pDecor->CurrentRead(m_gamer, mission, FALSE))
+ {
+ DemoPlayStop();
+ return FALSE;
+ }
+ ChangePhase(WM_PHASE_PLAY);
+ InitRandom();
+ m_pDecor->SetTime(0);
+ m_speed = 1;
+ */
+ return TRUE;
+}
+
+void CEvent::DemoPlayStop()
+{
+ if (m_pDemoBuffer != NULL)
+ {
+ free(m_pDemoBuffer);
+ m_pDemoBuffer = NULL;
+ }
+ m_bDemoPlay = FALSE;
+ m_bDemoRec = FALSE;
+ m_demoTime = 0;
+ m_keyPress = 0;
+ m_pDecor->SetInput(0);
+ m_private = 1;
+ ChangePhase(WM_PHASE_INIT);
+}
+
+void CEvent::DemoStep()
+{
+ int time;
+ UINT message;
+ WPARAM wParam;
+ LPARAM lParam;
+ POINT pos;
+
+ if (m_phase == WM_PHASE_INIT)
+ {
+ if (m_demoTime > DEF_TIME_DEMO) // ~30 secondes �coul�es ?
+ {
+ m_demoNumber = 0;
+ DemoPlayStart(); // d�marre une d�mo automatique
+ }
+ }
+
+ if (m_bDemoPlay && // d�mo en lecture ?
+ m_pDemoBuffer != NULL)
+ {
+ while (TRUE)
+ {
+ time = m_pDemoBuffer[m_demoIndex].time;
+ if (time > m_demoTime) break;
+
+ message = m_pDemoBuffer[m_demoIndex].message;
+ wParam = m_pDemoBuffer[m_demoIndex].wParam;
+ lParam = m_pDemoBuffer[m_demoIndex].lParam;
+ m_demoIndex++;
+
+ if (message == WM_MOUSEMOVE &&
+ m_mouseType == MOUSETYPEWIN)
+ {
+ pos = ConvLongToPos(lParam);
+ ClientToScreen(m_hWnd, &pos);
+ SetCursorPos(pos.x, pos.y);
+ }
+
+ TreatEventBase(message, wParam, lParam);
+
+ if (m_demoIndex >= m_demoEnd)
+ {
+ m_demoNumber++; // d�mo suivante
+ if (!DemoPlayStart()) // d�marre la d�mo suivante
+ {
+ m_demoNumber = 0; // premi�re d�mo
+ DemoPlayStart(); // d�marre la d�mo
+ }
+ return;
+ }
+ }
+ }
+
+ m_demoTime++;
+}
+
+void CEvent::DemoRecEvent(UINT message, UINT input, WPARAM wParam, LPARAM lParam)
+{
+ if (m_demoIndex > 0 &&
+ m_pDemoBuffer[m_demoIndex - 1].time == m_demoTime &&
+ m_pDemoBuffer[m_demoIndex - 1].input == m_keyPress)
+
+ m_demoIndex++;
+ if (m_demoIndex >= MAXDEMO)
+ {
+ DemoRecStop();
+ }
+}
+
+BOOL CEvent::WriteInfo(int gamer)
+{
+ char filename[MAX_PATH];
+ FILE* file = NULL;
+ DescInfo info;
+ int nb;
+ int doors;
+ char text[100];
+
+ sprintf(filename, "data\\info%.3d.blp", gamer);
+ AddUserPath(filename);
+ file = fopen(filename, "wb");
+ if (file == NULL) goto error;
+
+ strcpy(text, m_gamerName);
+
+ info.majRev = 1;
+ info.minRev = 0;
+ info.prive = m_private;
+ info.mission = m_mission;
+ info.multi = m_multi;
+ info.nbVies = m_nbVies;
+ info.speed = m_speed;
+ info.bMovie = m_bMovie;
+ info.bHiliInfoButton = m_bHiliInfoButton;
+ info.bBuildOfficialMissions = m_bBuildOfficialMissions;
+
+ info.audioVolume = m_pSound->GetAudioVolume();
+ info.midiVolume = m_pSound->GetMidiVolume();
+
+ m_pDecor->InitializeDoors(info.doors);
+
+ nb = fwrite(&info, sizeof(DescInfo), 1, file);
+ if (nb < 1) goto error;
+
+ fclose(file);
+ return TRUE;
+
+error:
+ if (file != NULL) fclose(file);
+ return FALSE;
+}
+
+BOOL CEvent::ReadInfo(int gamer)
+{
+ char filename[MAX_PATH];
+ FILE* file = NULL;
+ DescInfo info;
+ int nb;
+ BYTE doors[200];
+ char buffer[100];
+
+
+ m_pDecor->InitGamer();
+ m_lives = 3;
+ m_mission = 1;
+ m_private = 1;
+ m_multi = 1;
+
+ LoadString(TX_READINFO, buffer, 100);
+ sprintf(m_gamerName, buffer, gamer);
+ sprintf(filename, "data\\info%.3d.blp", gamer);
+ AddUserPath(filename);
+
+
+ file = fopen(filename, "rb");
+ if (file == NULL) goto error;
+
+ nb = fread(&info, sizeof(DescInfo), 1, file);
+ if (nb < 1) goto error;
+
+ if ((BYTE*)m_gamerName)
+ {
+ strcpy((char*)m_gamerName, buffer);
+ }
+
+ info.majRev = 1;
+ m_private = info.prive;
+ m_multi = info.multi;
+ m_nbVies = info.nbVies;
+ m_bMovie = info.bMovie;
+ m_mission = info.mission;
+ m_bHiliInfoButton = info.bHiliInfoButton;
+ m_speed = info.speed;
+ m_bBuildOfficialMissions = info.bBuildOfficialMissions;
+
+ m_pDecor->SetBuildOfficialMissions(info.bBuildOfficialMissions);
+ m_pSound->SetAudioVolume(info.audioVolume);
+ m_pSound->SetMidiVolume(info.midiVolume);
+ m_pDecor->MemorizeDoors(doors);
+ fclose(file);
+ return TRUE;
+
+error:
+ if (file != NULL) fclose(file);
+ return FALSE;
+}
+
+BOOL CEvent::ReadPlayer()
+{
+ char filename[MAX_PATH];
+
+ m_playerIndex = 0;
+
+ strcpy(filename, "data\\info%.3d.blp");
+ AddUserPath(filename);
+ remove(filename);
+ return TRUE;
+}
+
+void CEvent::ChangeButtons(int message)
+{
+ if (m_phase == WM_PHASE_GAMER && message >= WM_BUTTON1 && message <= WM_BUTTON10)
+ {
+ m_gamer = message - WM_BUTTON0;
+ for (int i = 0; i < 10; i++)
+ {
+ SetState(WM_BUTTON1 + i, i == m_gamer - 1);
+ }
+ ReadInfo(m_gamer);
+ }
+ if (m_phase == WM_PHASE_NAMEGAMER && message == WM_PHASE_DONAMEGAMER)
+ {
+ WriteInfo(m_gamer);
+ ChangePhase(WM_PHASE_GAMER);
+ }
+ if (m_phase == WM_PHASE_NAMEDESIGN && message == WM_PHASE_DONAMEDESIGN)
+ {
+ m_pDecor->SetMissionTitle(m_textInput);
+ ChangePhase(WM_PHASE_INFO);
+ }
+ if (m_phase == WM_PHASE_CLEARGAMER && message == WM_PHASE_DOCLEARGAMER)
+ {
+ ClearGamer(m_gamer);
+ ChangePhase(WM_PHASE_GAMER);
+ }
+ if (m_phase == WM_PHASE_CLEARDESIGN && message == WM_PHASE_DOCLEARDESIGN)
+ {
+ m_pDecor->SomethingMissionPath(m_gamer, GetWorld(), !m_bBuildOfficialMissions);
+ ChangePhase(WM_PHASE_INFO);
+ }
+ if (m_phase == WM_PHASE_MUSIC)
+ {
+ m_pDecor->SetMusic(message - WM_BUTTON0);
+ ChangePhase(m_phase);
+ }
+ if (m_phase == WM_PHASE_REGION)
+ {
+ if (message >= WM_BUTTON1 && message <= WM_BUTTON32)
+ {
+ m_pDecor->SetRegion(message - WM_BUTTON1);
+ }
+ if (message >= WM_DIMS1 && message <= WM_DIMS4)
+ {
+ SetState(WM_DIMS1, 0);
+ SetState(WM_DIMS2, 0);
+ SetState(WM_DIMS3, 0);
+ SetState(WM_DIMS4, 0);
+ SetState(message, 1);
+ if (message == WM_DIMS1) m_pDecor->SetDim({ MAXCELX, MAXCELY });
+ if (message == WM_DIMS2) m_pDecor->SetDim({ MAXCELX, 0 });
+ if (message == WM_DIMS3) m_pDecor->SetDim({ 0, MAXCELY });
+ if (message == WM_DIMS4) m_pDecor->SetDim({ 0, 0 });
+ }
+ }
+ if (m_phase == WM_PHASE_SERVICE)
+ {
+ if (message >= WM_BUTTON1 && message <= WM_BUTTON6)
+ {
+ m_choiceIndex = message - WM_BUTTON1 + m_choicePageOffset;
+ }
+ if (message == WM_BUTTON10)
+ {
+ m_choicePageOffset -= 6;
+ if (m_choicePageOffset < 0) m_choicePageOffset = 0;
+ }
+ if (message == WM_BUTTON11)
+ {
+ m_choicePageOffset += 6;
+ }
+ SetHide(WM_BUTTON10, m_choicePageOffset == 0);
+ SetHide(WM_BUTTON11, (m_nbChoices + 5) / 6 * 6 <= m_choicePageOffset + 6);
+ for (int i = 0; i < 6; i++)
+ {
+ if (m_choicePageOffset + i < m_nbChoices)
+ {
+ SetHide(WM_BUTTON1 + i, FALSE);
+ SetState(WM_BUTTON1 + i, m_choicePageOffset == m_choiceIndex);
+ }
+ else
+ {
+ SetHide(WM_BUTTON1 + i, TRUE);
+ }
+ }
+ }
+ if (m_phase == WM_PHASE_SESSION)
+ {
+ if (message >= WM_BUTTON1 && message <= WM_BUTTON6)
+ {
+ m_choiceIndex = message - WM_BUTTON1 + m_choicePageOffset;
+ }
+ if (message == WM_BUTTON10)
+ {
+ m_choicePageOffset -= 6;
+ if (m_choicePageOffset < 0) m_choicePageOffset = 0;
+ }
+ if (message == WM_BUTTON11)
+ {
+ m_choicePageOffset += 6;
+ }
+ SetHide(WM_BUTTON10, m_choicePageOffset == 0);
+ SetHide(WM_BUTTON11, (m_nbChoices + 5) / 6 * 6 <= m_choicePageOffset + 6);
+ for (int i = 0; i < 6; i++)
+ {
+ if (m_choicePageOffset + i < m_nbChoices)
+ {
+ SetHide(WM_BUTTON1 + i, FALSE);
+ SetState(WM_BUTTON1 + i, m_choicePageOffset == m_choiceIndex);
+ }
+ else
+ {
+ SetHide(WM_BUTTON1 + i, TRUE);
+ }
+ }
+ }
+ if (m_phase == WM_PHASE_MULTI)
+ {
+ if (message >= WM_BUTTON1 && message <= WM_BUTTON4)
+ {
+ if (m_pNetwork->m_players[message - WM_BUTTON1].team >= MAXNETPLAYER)
+ {
+ m_pNetwork->m_players[message - WM_BUTTON1].team = 0;
+ }
+
+ if (m_pNetwork->IsHost())
+ {
+ NetSendLobby();
+ }
+ else
+ {
+ //TODO
+ //m_pNetwork->Send(...
+ }
+ //DrawMap();
+ //NetAdjustLobbyButtons();
+ }
+ if (message >= WM_BUTTON11 && message <= WM_BUTTON14)
+ {
+ m_pNetwork->m_players[message - WM_BUTTON11].ready ^= 1; // toggle ready
+ if (m_pNetwork->IsHost())
+ {
+ NetSendLobby();
+ }
+ else
+ {
+ //TODO
+ //m_pNetwork->Send(...
+ }
+ //NetAdjustLobbyButtons();
+ }
+ if (message == WM_BUTTON20)
+ {
+ ChatSend();
+ }
+ }
+ if (m_phase == WM_PHASE_READDESIGN)
+ {
+ //TODO
+ }
+ if (m_phase == WM_PHASE_WRITEDESIGN)
+ {
+ //TODO
+ }
+ if (m_phase == WM_PHASE_GREAD || m_phase == WM_PHASE_GREADp)
+ {
+ //TODO
+ }
+ if (m_phase == WM_PHASE_GWRITE)
+ {
+ //TODO
+ }
+ if (m_phase == WM_PHASE_SETUP || m_phase == WM_PHASE_SETUPp)
+ {
+ //TODO
+ }
+}
+
+BOOL CEvent::ClearGamer(int gamer)
+{
+ char filename[260];
+
+ m_6D30 = 0;
+ sprintf(filename, "data\\info%.3d.blp", gamer);
+ AddUserPath(filename);
+ remove(filename);
+ return TRUE;
+}
+
+BOOL CEvent::CheckCDForWorld1()
+{
+ // TODO
+ return TRUE;
+}
+
+void CEvent::DrawMap()
+{
+ //TODO
+}
+
+void CEvent::NetAdjustLobbyButtons()
+{
+ //TODO
+}
+
+BOOL CEvent::CopyMission(char *srcFileName, char *dstFileName)
+{
+ FILE *srcFile = NULL;
+ FILE *destFile = NULL;
+ size_t num;
+ BOOL bOK = TRUE;
+ void *buffer = malloc(2560);
+
+ if (buffer)
+ {
+ srcFile = fopen(srcFileName, "rb");
+ if (!srcFile) goto die;
+ destFile = fopen(dstFileName, "wb");
+ if (destFile)
+ {
+ do
+ {
+ num = fread(buffer, 1, 2560, srcFile);
+ if (ferror(srcFile)) break; // *
+ if (num <= 0)
+ {
+ bOK = FALSE;
+ break;
+ }
+ fwrite(buffer, 1, num, destFile);
+ } while (!ferror(destFile)); // *
+ }
+ }
+ if (srcFile) fclose(srcFile);
+die:
+ if (destFile) fclose(destFile);
+ if (buffer) free(buffer);
+ return bOK;
+
+ // *
+ // original code relies on undefined behavior specific to older msvc :
+ // if (srcFile->_flag & _IOERR)
+ // while (!(destFile->_flag & _IOERR))
+}
\ No newline at end of file
diff --git a/event.h b/src/event.h
similarity index 85%
rename from event.h
rename to src/event.h
index 8544239..1b40f97 100644
--- a/event.h
+++ b/src/event.h
@@ -1,13 +1,11 @@
// Event.h
-#pragma once
+
/////////////////////////////////////////////////////////////////////////////
#pragma once
-using namespace std;
-
#include "movie.h"
#include "menu.h"
#include "button.h"
@@ -28,21 +26,11 @@ typedef struct
UINT phase;
char backName[36];
BOOL bCDrom;
+ BOOL bUnk;
Button buttons[MAXBUTTON];
}
Phase;
-typedef struct
-{
- int HeaderLength[10];
- int DoorsLength[200];
- int GamerLength[10 + 200];
- int MaxGamer[3];
- int TotalLength[10 + (10 + 200) + 3];
- BYTE data;
-}
-GameData;
-
typedef struct
{
short majRev;
@@ -74,16 +62,17 @@ public:
void OutputNetDebug(const char* str);
POINT GetMousePos();
- void Create(HINSTANCE hInstance, HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, CSound *pSound, CNetwork *pNetwork, CMovie *pMovie);
+ void Create(HINSTANCE hInstance, HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, CSound *pSound, CNetwork *pNetwork, CMovie *pMovie );
void SetFullScreen(BOOL bFullScreen);
void SetMouseType(int mouseType);
int GetWorld();
int GetWorldGroup();
+ void SetMission(int index);
int GetPhysicalWorld();
int GetImageWorld();
BOOL IsHelpHide();
BOOL ChangePhase(UINT phase);
- UINT GetPhase();
+ UINT GetPhase();
void MovieToStart();
BOOL NetworkNuggets(int fuck);
void HandleInputs();
@@ -93,20 +82,18 @@ public:
void RestoreGame();
int MissionBack();
void TableSomething();
- void SetNbVies(int nbVies);
int GetButtonIndex(int button);
int GetState(int button);
void SetState(int button, int state);
BOOL GetEnable(int button);
- void SetEnable(WMessage button, int bEnable);
+ void SetEnable(int button, int bEnable);
void SetSomething(int button, int bSomething);
BOOL GetHide(int button);
void SetHide(int button, BOOL bHide);
int GetMenu(int button);
void SetMenu(int button, int menu);
- void FlushInput();
- void PauseStatus(UINT pause, int multiplayer);
+ void SomethingDecor();
BOOL IsMouseRelease();
void NetSetPause(BOOL bPause, int players);
@@ -131,11 +118,6 @@ public:
void FlushInput();
- BOOL FlipObject();
-
- void Read(int message);
- void Write(int message);
-
void SetSpeed(int speed);
int GetSpeed();
BOOL GetPause();
@@ -154,23 +136,18 @@ public:
BOOL SaveState(int rank);
void SomethingUserMissions(char* lpFilename, LPCSTR fileSomething);
-
+ BOOL ClearGamer(int gamer);
- BOOL AddPhaseText();
- void ReadInput();
-
- void DrawTextCenter(int res, POINT pos, int font=0);
+protected:
+ void DrawTextCenter(int res, int x, int y, int font=0);
BOOL CreateButtons();
BOOL EventButtons(UINT message, WPARAM wParam, LPARAM lParam);
BOOL MouseOnButton(POINT pos);
int SearchPhase(UINT phase);
void DecorShift(int dx, int dy);
- BOOL PlayDown(POINT pos, int fwKeys);
- BOOL PlayMove(POINT pos, int fwKeys);
- BOOL PlayUp(POINT pos, int fwKeys);
void ChangeButtons(int message);
-
+
void BuildFloor(POINT cel, int insIcon);
void BuildWater(POINT cel, int insIcon);
BOOL BuildDown(POINT pos, int fwKeys, BOOL bMix=TRUE);
@@ -179,8 +156,9 @@ public:
void PrivateLibelle();
BOOL ReadLibelle(int world, BOOL bSchool, BOOL bHelp);
- BOOL WriteInfo(int gamer, char* playername);
- BOOL ReadInfo(int gamer);
+ BOOL WriteInfo(int gamer);
+ BOOL ReadInfo(int gamer);
+ BOOL LoadState(BOOL save);
void TryPhase();
void UnTryPhase();
int GetTryPhase();
@@ -199,8 +177,8 @@ public:
BOOL NetEnumSessions();
int NetSearchPlayer(DPID dpid);
void NetStartPlay();
- void NetFUN_1d6b0(UINT message, USHORT data);
- void NetDrawMap();
+ void NetSend(int message, USHORT data);
+ void NetDraw();
void ChatSend();
void HandleChatBuffer();
void ChatMessageSound(char* data);
@@ -208,6 +186,11 @@ public:
void MouseRelease();
void MouseCapture();
+ void DrawMap();
+ BOOL CheckCDForWorld1();
+ void NetAdjustLobbyButtons();
+ BOOL CopyMission(char *srcFileName, char *dstFileName);
+
protected:
int m_speed;
@@ -217,12 +200,13 @@ protected:
char m_gamerNameList[10][100];
void* m_somethingJoystick;
int m_menuIndex;
- int m_fileIndex;
- int m_menuDecor[10];
+ int m_choiceIndex;
+ int m_saveIndex;
+ int m_menuDecor[11];
BOOL m_bMouseRelease;
int m_private;
int m_maxMission;
- DWORD m_phase;
+ int m_phase;
int m_index;
int m_playerIndex;
BOOL m_bSchool;
@@ -238,7 +222,7 @@ protected:
CMovie* m_pMovie;
CNetwork* m_pNetwork;
char m_movieToStart[MAX_PATH];
- UINT m_phaseAfterMovie;
+ int m_phaseAfterMovie;
CButton m_buttons[MAXBUTTON];
int m_lastFloor[MAXBUTTON];
int m_lastObject[MAXBUTTON];
@@ -293,7 +277,7 @@ protected:
BOOL m_bDemoPlay;
DemoEvent* m_pDemoBuffer;
int m_demoTime;
- int m_input;
+ int m_keyPress;
int m_demoIndex;
int m_demoEnd;
int m_demoNumber;
@@ -306,13 +290,20 @@ protected:
int m_textHiliEnd;
int m_textCursorIndex;
char m_textInput[100];
- char m_gamerName[100];
- char m_gamerNameList[10][100];
+ char m_pPlayerName[100];
int m_lives;
int m_multi;
HINSTANCE m_hInstance;
char m_chatZone[100][5];
char m_text[100];
+
+ int m_choicePageOffset;
+ int m_nbChoices;
+ int m_0008;
+ int m_6D30;
+ BOOL m_b6D34;
+ int m_96B4;
+ int m_nbVies;
};
extern
diff --git a/jauge.cpp b/src/jauge.cpp
similarity index 65%
rename from jauge.cpp
rename to src/jauge.cpp
index 7a99618..9b0c305 100644
--- a/jauge.cpp
+++ b/src/jauge.cpp
@@ -2,12 +2,13 @@
//
using namespace std;
+#pragma once
#include
#include
#include
#include
-#include
+// #include
#include
#include "def.h"
#include "pixmap.h"
@@ -52,46 +53,50 @@ BOOL CJauge::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
m_dim.y = DIMJAUGEY;
m_level = 0;
m_bRedraw = TRUE;
+ return TRUE;
}
-// Dessine un bouton dans son état.
-
void CJauge::Draw()
{
- int part;
- RECT rect;
+ RECT rect;
+ char num2[12];
- if (m_bMinimizeRedraw && !m_bRedraw) return;
- m_bRedraw = FALSE;
+ if (m_bMinimizeRedraw && !m_bRedraw) return;
+ m_bRedraw = FALSE;
- if (m_bHide) // bouton caché ?
- {
- rect = { m_pos.x, m_pos.y, m_pos.x + m_dim.x, m_pos.y + m_dim.y };
- m_pPixmap->DrawPart(-1, CHBACK, m_pos, rect, 1); // dessine le fond
- return;
- }
+ if (m_bHide) // bouton cach� ?
+ {
+ rect.right = m_dim.x + m_pos.x;
+ rect.left = m_pos.x;
+ rect.top = m_pos.y;
+ rect.bottom = m_dim.y + m_pos.y;
+ m_pPixmap->DrawPart(-1, 0, m_pos, rect, 1, FALSE);
+ return;
+ }
+ int num = m_level * 114 / 100;
- part = (m_level*(DIMJAUGEX - 6 - 4)) / 100;
+ *(char*)num2 = (124) / 64;
+ rect.bottom = 22;
+ rect.left = LOWORD(num2);
+ rect.top = HIWORD(num2);
+ rect.right = HIWORD(num2);
+ m_pPixmap->DrawPart(-1, 5, m_pos, rect, 0, FALSE);
+ if (num > 0)
+ {
+ rect.bottom = num + 6;
+ rect.left = m_type * 22;
+ rect.top = (m_type + 1) * 22;
+ rect.right = 0;
+ m_pPixmap->DrawPart(-1, 5, m_pos, rect, 0, FALSE);
+ }
- rect = { 0, 0, DIMJAUGEX, DIMJAUGEY };
- m_pPixmap->DrawPart(-1, CHJAUGE, m_pos, rect); // partie noire
-
- if (part > 0)
- {
- rect = { 0, DIMJAUGEY * m_type, 6 + part, DIMJAUGEY + (m_type + 1) };
- m_pPixmap->DrawPart(-1, CHJAUGE, m_pos, rect); // partie colorée
- }
}
-// Redessine une jauge.
-
void CJauge::Redraw()
{
- m_bRedraw = TRUE;
+ m_bRedraw = TRUE;
}
-// Modifie le niveau.
-
void CJauge::SetLevel(int level)
{
if ( level < 0 ) level = 0;
@@ -116,7 +121,6 @@ int CJauge::GetType()
return m_type;
}
-// Modifie le type.
void CJauge::SetType(int type)
{
@@ -143,12 +147,3 @@ void CJauge::SetHide(BOOL bHide)
m_bHide = bHide;
}
-POINT CJauge::GetPos()
-{
- return m_pos;
-}
-
-void CJauge::SetRedraw()
-{
- m_bRedraw = TRUE;
-}
diff --git a/jauge.h b/src/jauge.h
similarity index 92%
rename from jauge.h
rename to src/jauge.h
index 8071440..38fe673 100644
--- a/jauge.h
+++ b/src/jauge.h
@@ -3,9 +3,9 @@
#pragma once
//////////////////////////////////////////////////////////////////////////
-#include
-#include
-#include "decor.h"
+// #include
+#include "pixmap.h"
+#include "sound.h"
class CJauge
{
diff --git a/menu.cpp b/src/menu.cpp
similarity index 100%
rename from menu.cpp
rename to src/menu.cpp
diff --git a/menu.h b/src/menu.h
similarity index 94%
rename from menu.h
rename to src/menu.h
index a73d3f8..fc9c7d7 100644
--- a/menu.h
+++ b/src/menu.h
@@ -2,10 +2,7 @@
#pragma once
-using namespace std;
-
-//#include
-#include
+// #include
#include "decor.h"
#include "pixmap.h"
diff --git a/misc.cpp b/src/misc.cpp
similarity index 97%
rename from misc.cpp
rename to src/misc.cpp
index efe329b..a92a01d 100644
--- a/misc.cpp
+++ b/src/misc.cpp
@@ -89,22 +89,6 @@ int Random(int min, int max)
return (int)n;
}
-/*
-BOOL IntersectRect(RECT dst, RECT src1, RECT src2)
-{
- dst.left = max(src1.left, src2.left);
- dst.right = min(src1.right, src2.right);
- dst.top = max(src1.top, src2.top);
- dst.bottom = min(src1.bottom, src2.bottom);
- return IsRectEmpty(dst);
-}
-
-BOOL IsRectEmpty(RECT rect)
-{
- return rect.left >= rect.right || rect.top >= rect.bottom;
-}
-*/
-
void GetCurrentDir(char *pName, int lg)
{
int i;
diff --git a/misc.h b/src/misc.h
similarity index 72%
rename from misc.h
rename to src/misc.h
index 1a79881..42b875b 100644
--- a/misc.h
+++ b/src/misc.h
@@ -1,5 +1,8 @@
// misc.h
//
+#pragma once
+
+// #include
extern void InitHInstance(HINSTANCE hInstance);
extern void OutputDebug(const char *pMessage);
@@ -10,13 +13,10 @@ extern POINT ConvLongToPos(LPARAM lParam);
extern void InitRandom();
extern int Random(int min, int max);
-extern BOOL IntersectRect(RECT dst, RECT src1, RECT src2);
-extern BOOL IsRectEmpty(RECT rect);
-extern int Speed(double speed, int max);
extern void GetCurrentDir(char *pName, int lg);
extern void AddCDPath(char *pFilename);
extern void AddUserPath(char *pFilename);
extern void TraceErrorDD(HRESULT hErr, const char *sFile, int nLine);
-extern void TraceErrorDS(HRESULT hErr, char *sFile, int nLine);
+extern void TraceErrorDS(HRESULT hErr, const char *sFile, int nLine);
diff --git a/movie.cpp b/src/movie.cpp
similarity index 97%
rename from movie.cpp
rename to src/movie.cpp
index f7fac33..bf46536 100644
--- a/movie.cpp
+++ b/src/movie.cpp
@@ -14,7 +14,7 @@ using namespace std;
#include
#include
#include
-//#include
+// #include
#include "def.h"
#include "movie.h"
#include "misc.h"
@@ -39,7 +39,7 @@ BOOL CMovie::initAVI()
// set up the open parameters
mciOpen.dwCallback = 0L;
mciOpen.wDeviceID = 0;
- mciOpen.lpstrDeviceType = (LPWSTR)AVI_VIDEO;
+ mciOpen.lpstrDeviceType = AVI_VIDEO;
mciOpen.lpstrElementName = NULL;
mciOpen.lpstrAlias = NULL;
mciOpen.dwStyle = 0;
@@ -126,7 +126,7 @@ BOOL CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename)
mciOpen.dwCallback = 0L;
mciOpen.wDeviceID = 0;
mciOpen.lpstrDeviceType = NULL;
- mciOpen.lpstrElementName = (LPWSTR)string;
+ mciOpen.lpstrElementName = string;
mciOpen.lpstrAlias = NULL;
mciOpen.dwStyle = WS_CHILD;
mciOpen.hWndParent = hWnd;
@@ -144,7 +144,7 @@ BOOL CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename)
mciWindow.dwCallback = 0L;
mciWindow.hWnd = NULL;
mciWindow.nCmdShow = SW_SHOW;
- mciWindow.lpstrText = (LPWSTR)NULL;
+ mciWindow.lpstrText = NULL;
// mciSendCommand(m_wMCIDeviceID, MCI_WINDOW,
// MCI_DGV_WINDOW_STATE,
// (DWORD)(LPMCI_DGV_WINDOW_PARMS)&mciWindow);
diff --git a/movie.h b/src/movie.h
similarity index 93%
rename from movie.h
rename to src/movie.h
index b67f63b..3dbbf4f 100644
--- a/movie.h
+++ b/src/movie.h
@@ -1,11 +1,9 @@
// movie.h
//
-
#pragma once
-using namespace std;
-//#include
+// #include
class CMovie
{
diff --git a/src/network.cpp b/src/network.cpp
new file mode 100644
index 0000000..f640460
--- /dev/null
+++ b/src/network.cpp
@@ -0,0 +1,342 @@
+// Network.cpp
+//
+
+#include
+#include
+#include "dplay.h"
+#include "misc.h"
+#include "network.h"
+
+// a0f94abe-11c3-d111-be62-0040f6944838
+#define APP_GUID { 0xbe4af9a0, 0xc311, 0x11d1, { 0xbe, 0x62, 0x00, 0x40, 0xf6, 0x94, 0x48, 0x38 } };
+
+CNetwork::CNetwork()
+{
+ m_pDP = NULL;
+ m_dpid = 0;
+ m_bHost = FALSE;
+ m_providers.nb = 0;
+ m_providers.pList = NULL;
+ m_sessions.nb = 0;
+ m_sessions.pList = NULL;
+ m_unknown.nb = 0;
+ m_unknown.pList = NULL;
+}
+
+CNetwork::~CNetwork()
+{
+ FreeProviderList();
+ FreeSessionList();
+ FreeUnknownList();
+ if (m_pDP) m_pDP->Release();
+}
+
+static BOOL EnumProvidersCallback(LPGUID lpguidSP, LPSTR lpSPName,
+ DWORD dwMajorVersion, DWORD dwMinorVersion, NamedGUIDList* lpContext)
+{
+ if (lpContext->nb < MAXSESSION)
+ {
+ lpContext->pList[lpContext->nb]->guid = *lpguidSP;
+ strcpy(lpContext->pList[lpContext->nb]->name, lpSPName);
+ lpContext->nb++;
+ }
+ return TRUE;
+}
+
+BOOL CNetwork::EnumProviders()
+{
+ FreeProviderList();
+ m_providers.nb = 0;
+ m_providers.pList = (NamedGUID(*)[MAXSESSION]) malloc(MAXSESSION * sizeof(NamedGUID));
+
+ if (!m_providers.pList) return FALSE;
+#ifdef _UNICODE
+ if (DirectPlayEnumerate((LPDPENUMDPCALLBACK)EnumProvidersCallback, &m_providers) != DP_OK)
+#else
+ if (DirectPlayEnumerate((LPDPENUMDPCALLBACKA)EnumProvidersCallback, &m_providers) != DP_OK)
+#endif
+ {
+ FreeProviderList();
+ return FALSE;
+ }
+ return TRUE;
+}
+
+int CNetwork::GetNbProviders()
+{
+ return m_providers.nb;
+}
+
+char* CNetwork::GetProviderName(int index)
+{
+ if (index >= m_providers.nb) return NULL;
+ return m_providers.pList[index]->name;
+}
+
+BOOL CNetwork::CreateProvider(int index)
+{
+ LPDIRECTPLAY lpDP;
+ BOOL bOK = FALSE;
+
+ if (index >= m_providers.nb) return FALSE;
+
+ if (DirectPlayCreate(&m_providers.pList[index]->guid, &lpDP, 0) == DP_OK)
+ {
+ if (lpDP->QueryInterface(IID_IDirectPlay2A, (LPVOID*)&m_pDP) == DP_OK)
+ {
+ return TRUE;
+ }
+ }
+
+ if (lpDP) lpDP->Release();
+ return FALSE;
+}
+
+void CNetwork::FreeProviderList()
+{
+ if (m_providers.pList) free(m_providers.pList); // wrong
+
+ m_providers.nb = 0;
+ m_providers.pList = NULL;
+}
+
+
+static BOOL EnumSessionsCallback(LPDPSESSIONDESC2 lpThisSD,
+ LPDWORD lpdwTimeOut, DWORD dwFlags, NamedGUIDList* lpContext)
+{
+ if (dwFlags & DPESC_TIMEDOUT) return FALSE;
+
+ if (lpContext->nb < MAXSESSION)
+ {
+ lpContext->pList[lpContext->nb]->guid = lpThisSD->guidInstance;
+ strcpy(lpContext->pList[lpContext->nb]->name, lpThisSD->lpszSessionNameA);
+ lpContext->nb++;
+ }
+ return TRUE;
+}
+
+BOOL CNetwork::EnumSessions()
+{
+ DPSESSIONDESC2 desc;
+
+ FreeSessionList();
+ m_sessions.nb = 0;
+ m_sessions.pList = (NamedGUID(*)[MAXSESSION]) malloc(MAXSESSION * sizeof(NamedGUID));
+
+ if (!m_sessions.pList) return FALSE;
+
+ ZeroMemory(&desc, sizeof(desc));
+
+ desc.guidApplication = APP_GUID;
+ desc.dwSize = sizeof(desc);
+
+ if (m_pDP->EnumSessions(&desc, 0, (LPDPENUMSESSIONSCALLBACK2)EnumSessionsCallback, &m_sessions, DPENUMSESSIONS_AVAILABLE) != DP_OK)
+ {
+ FreeSessionList();
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+char* CNetwork::GetSessionName(int index)
+{
+ if (index >= m_sessions.nb) return NULL;
+ return m_sessions.pList[index]->name;
+}
+
+BOOL CNetwork::JoinSession(int index, char* pPlayerName)
+{
+ DPNAME name;
+ DPSESSIONDESC2 desc;
+ HRESULT hr;
+
+ if (index > m_sessions.nb) return FALSE;
+
+ ZeroMemory(&desc, sizeof(desc));
+
+ desc.guidInstance = m_sessions.pList[index]->guid;
+
+ hr = m_pDP->Open(&desc, DPOPEN_OPENSESSION);
+ if (hr != DP_OK)
+ {
+ TraceErrorDP(hr);
+ return FALSE;
+ }
+
+ name.dwSize = 16;
+ name.dwFlags = 0;
+ name.lpszShortNameA = pPlayerName;
+ name.lpszLongNameA = NULL;
+ hr = m_pDP->CreatePlayer(&m_dpid, &name, NULL, NULL, 0, 0);
+ if (hr != DP_OK)
+ {
+ TraceErrorDP(hr);
+ m_pDP->Close();
+ return FALSE;
+ }
+ else
+ {
+ m_bHost = FALSE;
+ return TRUE;
+ }
+}
+
+void CNetwork::FreeSessionList()
+{
+ if (m_sessions.pList) free(m_sessions.pList);
+
+ m_sessions.nb = 0;
+ m_sessions.pList = NULL;
+}
+
+BOOL CNetwork::CreateSession(char* pSessionName, char* pPlayerName)
+{
+ DPNAME name;
+ DPSESSIONDESC2 desc;
+ HRESULT hr;
+
+ ZeroMemory(&desc, sizeof(desc));
+
+ desc.guidApplication = APP_GUID;
+ desc.lpszSessionNameA = pSessionName;
+ desc.dwSize = sizeof(desc);
+ desc.dwFlags = DPSESSION_KEEPALIVE | DPSESSION_MIGRATEHOST;
+ desc.dwMaxPlayers = MAXPLAYERS;
+
+ hr = m_pDP->Open(&desc, DPOPEN_CREATE);
+ if (hr != DP_OK)
+ {
+ TraceErrorDP(hr);
+ return FALSE;
+ }
+ else
+ {
+ name.dwSize = 16;
+ name.dwFlags = 0;
+ name.lpszShortNameA = pPlayerName;
+ name.lpszLongNameA = NULL;
+ hr = m_pDP->CreatePlayer(&m_dpid, &name, NULL, NULL, 0, 0);
+ if (hr != DP_OK)
+ {
+ TraceErrorDP(hr);
+ m_pDP->Close();
+ return FALSE;
+ }
+ else
+ {
+ m_bHost = TRUE;
+ return TRUE;
+ }
+ }
+}
+
+BOOL CNetwork::Send(LPVOID lpData, DWORD dwDataSize, DWORD dwFlags)
+{
+ HRESULT hr;
+
+ if (!m_pDP) return FALSE;
+
+ if (hr = m_pDP->Send(m_dpid, 0, !!dwFlags, lpData, dwDataSize), hr != DP_OK)
+ {
+ TraceErrorDP(hr);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+BOOL CNetwork::Receive(LPVOID pDest, DWORD dwDataSize, LPDWORD lpdwPlayer)
+{
+ DPID from = 0, to = 0, dataSize = 500;
+ char dataBuffer[500];
+ HRESULT hr;
+
+ hr = m_pDP->Receive(&from, &to, DPRECEIVE_ALL, dataBuffer, &dataSize);
+ if (hr != DP_OK)
+ {
+ if (hr != DPERR_NOMESSAGES) TraceErrorDP(hr);
+ return FALSE;
+ }
+
+ ZeroMemory(pDest, dwDataSize);
+
+ *lpdwPlayer = -1;
+ for (int i = 0; i < MAXPLAYERS; i++)
+ {
+ if (m_players[i].bIsPresent && from == i)
+ {
+ *lpdwPlayer = i;
+ break;
+ }
+ }
+
+ return TRUE;
+}
+
+BOOL CNetwork::Close()
+{
+ return m_pDP->Close() == DP_OK;
+}
+
+void CNetwork::FreeUnknownList()
+{
+ if (m_unknown.pList) free(m_unknown.pList);
+
+ m_unknown.nb = 0;
+ m_unknown.pList = NULL;
+}
+
+BOOL CNetwork::IsHost()
+{
+ return m_bHost;
+}
+
+void TraceErrorDP(HRESULT hErr)
+{
+ char dperr[256];
+ char err[1024];
+
+ switch (hErr)
+ {
+ case DPERR_OUTOFMEMORY: sprintf(dperr, "DPERR_OUTOFMEMORY"); break;
+ case DPERR_UNSUPPORTED: sprintf(dperr, "DPERR_UNSUPPORTED"); break;
+ case DPERR_NOINTERFACE: sprintf(dperr, "DPERR_NOINTERFACE"); break;
+ case DPERR_GENERIC: sprintf(dperr, "DPERR_GENERIC"); break;
+ case DPERR_INVALIDPARAMS: sprintf(dperr, "DPERR_INVALIDPARAMS"); break;
+ case DPERR_ACTIVEPLAYERS: sprintf(dperr, "DPERR_ACTIVEPLAYERS"); break;
+ case DPERR_ACCESSDENIED: sprintf(dperr, "DPERR_ACCESSDENIED"); break;
+ case DPERR_CANTADDPLAYER: sprintf(dperr, "DPERR_CANTADDPLAYER"); break;
+ case DPERR_CANTCREATEPLAYER: sprintf(dperr, "DPERR_CANTCREATEPLAYER"); break;
+ case DPERR_CANTCREATEGROUP: sprintf(dperr, "DPERR_CANTCREATEGROUP"); break;
+ case DPERR_CANTCREATESESSION: sprintf(dperr, "DPERR_CANTCREATESESSION"); break;
+ case DPERR_CAPSNOTAVAILABLEYET: sprintf(dperr, "DPERR_CAPTSNOTAVAILABLEYET"); break;
+ case DPERR_ALREADYINITIALIZED: sprintf(dperr, "DPERR_ALREADYINITIALIZED"); break;
+ case DPERR_INVALIDFLAGS: sprintf(dperr, "DPERR_INVALIDFLAGS"); break;
+ case DPERR_EXCEPTION: sprintf(dperr, "DPERR_EXCEPTION"); break;
+ case DPERR_INVALIDPLAYER: sprintf(dperr, "DPERR_INVALIDPLAYER"); break;
+ case DPERR_INVALIDOBJECT: sprintf(dperr, "DPERR_INVALIDOBJECT"); break;
+ case DPERR_NOCONNECTION: sprintf(dperr, "DPERR_NOCONNECTION"); break;
+ case DPERR_NONAMESERVERFOUND: sprintf(dperr, "DPERR_NONAMESERVERFOUND"); break;
+ case DPERR_NOMESSAGES: sprintf(dperr, "DPERR_NOMESSAGES"); break;
+ case DPERR_NOSESSIONS: sprintf(dperr, "DPERR_NOSESSIONS"); break;
+ case DPERR_NOPLAYERS: sprintf(dperr, "DPERR_NOPLAYERS"); break;
+ case DPERR_TIMEOUT: sprintf(dperr, "DPERR_TIMEOUT"); break;
+ case DPERR_SENDTOOBIG: sprintf(dperr, "DPERR_SENDTOOBIG"); break;
+ case DPERR_BUSY: sprintf(dperr, "DPERR_BUSY"); break;
+ case DPERR_UNAVAILABLE: sprintf(dperr, "DPERR_UNAVAILABLE"); break;
+ case DPERR_PLAYERLOST: sprintf(dperr, "DPERR_PLAYERLOST"); break;
+ case DPERR_USERCANCEL: sprintf(dperr, "DPERR_USERCANCEL"); break;
+ case DPERR_BUFFERTOOLARGE: sprintf(dperr, "DPERR_BUFFERTOOLARGE"); break;
+ case DPERR_SESSIONLOST: sprintf(dperr, "DPERR_SESSIONLOST"); break;
+ case DPERR_APPNOTSTARTED: sprintf(dperr, "DPERR_APPNOTSTARTED"); break;
+ case DPERR_CANTCREATEPROCESS: sprintf(dperr, "DPERR_CANTCREATEPROCESS"); break;
+ case DPERR_UNKNOWNAPPLICATION: sprintf(dperr, "DPERR_UNKNOWNAPPLICATION"); break;
+ case DPERR_INVALIDINTERFACE: sprintf(dperr, "DPERR_INVALIDINTERFACE"); break;
+ case DPERR_NOTLOBBIED: sprintf(dperr, "DPERR_NOTLOBBIED"); break;
+ case DP_OK: sprintf(dperr, "DP_OK"); break;
+
+ default: sprintf(dperr, "Unknown Error"); break;
+ }
+ sprintf(err, "DirectPlay Error %s\n", dperr);
+ OutputDebug(err);
+}
\ No newline at end of file
diff --git a/network.h b/src/network.h
similarity index 70%
rename from network.h
rename to src/network.h
index 65a4646..7d62056 100644
--- a/network.h
+++ b/src/network.h
@@ -7,7 +7,7 @@
/////////////////////////////////////////////////////////////////////////////
#define MAXSESSION 100
-#define MAXNETPLAYER 4
+#define MAXPLAYERS 4
typedef struct
{
@@ -31,7 +31,7 @@ NamedGUID;
typedef struct
{
int nb;
- NamedGUID * list[MAXSESSION];
+ NamedGUID (*pList)[MAXSESSION];
}
NamedGUIDList;
@@ -43,14 +43,14 @@ public:
BOOL EnumProviders();
BOOL GetNbProviders();
- char * GetProviderName(int index);
+ char* GetProviderName(int index);
BOOL CreateProvider(int index);
void FreeProviderList();
BOOL EnumSessions();
- char * GetSessionName(int index);
- BOOL JoinSession(int index);
+ char* GetSessionName(int index);
+ BOOL JoinSession(int index, char* pPlayerName);
void FreeSessionList();
- BOOL CreateSession(char * pName);
+ BOOL CreateSession(char* pSessionName, char* pPlayerName);
BOOL Send(LPVOID lpData, DWORD dwDataSize, DWORD dwFlags);
BOOL Receive(LPVOID pDest, DWORD dwDataSize, LPDWORD lpdwPlayer);
BOOL Close();
@@ -59,18 +59,21 @@ public:
NetPlayer m_players[4];
DPID m_dpid;
+
protected:
- LPDIRECTPLAY2 m_pDP;
+ LPDIRECTPLAY2 m_pDP;
NamedGUIDList m_providers;
NamedGUIDList m_sessions;
NamedGUIDList m_unknown;
BOOL m_bHost;
+
+// NetPlayer m_players[4];
};
static BOOL EnumProvidersCallback(LPGUID lpguidSP, LPSTR lpSTName,
- DWORD dwMajorVersion, DWORD dwMinorVersion, NamedGUIDList * lpContext);
+ DWORD dwMajorVersion, DWORD dwMinorVersion, NamedGUIDList* lpContext);
static BOOL EnumSessionsCallback(LPDPSESSIONDESC2 lpThisSD,
- LPDWORD lpdwTimeOut, DWORD dwFlags, NamedGUIDList * lpContext);
+ LPDWORD lpdwTimeOut, DWORD dwFlags, NamedGUIDList* lpContext);
void TraceErrorDP(HRESULT hErr);
\ No newline at end of file
diff --git a/src/obstacle.h b/src/obstacle.h
new file mode 100644
index 0000000..87ac4ac
--- /dev/null
+++ b/src/obstacle.h
@@ -0,0 +1,589 @@
+#pragma once
+#define Q_EMPTY \
+ 0,0,0,0, \
+ 0,0,0,0, \
+ 0,0,0,0, \
+ 0,0,0,0
+#define Q_FULL \
+ 1,1,1,1, \
+ 1,1,1,1, \
+ 1,1,1,1, \
+ 1,1,1,1
+#define Q_TRIANGLE_RIGHT \
+ 1,1,1,1, \
+ 0,1,1,1, \
+ 0,0,0,1, \
+ 0,0,0,0
+#define Q_TRIANGLE_LEFT \
+ 1,1,1,1, \
+ 1,1,1,0, \
+ 1,0,0,0, \
+ 0,0,0,0
+#define Q_TOP_HALF \
+ 1,1,1,1, \
+ 1,1,1,1, \
+ 0,0,0,0, \
+ 0,0,0,0
+#define Q_TOP_QUARTER \
+ 1,1,1,1, \
+ 0,0,0,0, \
+ 0,0,0,0, \
+ 0,0,0,0
+#define Q_TOP_3_QUARTERS \
+ 1,1,1,1, \
+ 1,1,1,1, \
+ 1,1,1,1, \
+ 0,0,0,0
+#define Q_PILLAR \
+ 0,1,1,0, \
+ 0,1,1,0, \
+ 0,1,1,0, \
+ 0,1,1,0
+
+extern short table_decor_quart[]
+{
+ Q_FULL, // 0
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_TRIANGLE_RIGHT,
+
+ Q_TRIANGLE_RIGHT, // 16
+ Q_TRIANGLE_LEFT,
+ Q_TRIANGLE_LEFT,
+
+ 1,1,1,1,
+ 1,1,1,1,
+ 0,0,1,1,
+ 0,0,0,0,
+
+ 1,1,1,1,
+ 1,1,1,1,
+ 1,1,0,0,
+ 1,1,0,0,
+
+ 1,1,1,1,
+ 1,1,1,1,
+ 1,1,0,0,
+ 0,0,0,0,
+
+ Q_EMPTY,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_TOP_HALF,
+ Q_TOP_QUARTER,
+ Q_FULL,
+ Q_FULL,
+
+ Q_FULL, // 32
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_TOP_3_QUARTERS,
+ Q_TOP_HALF,
+ Q_TOP_QUARTER,
+
+ Q_FULL, // 48
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+
+ Q_FULL, // 64
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_TRIANGLE_LEFT,
+ Q_TRIANGLE_RIGHT,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_FULL,
+ Q_FULL,
+
+ Q_FULL, // 80
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ 1,1,1,1,
+ 1,1,1,1,
+ 1,1,1,1,
+ 1,1,0,0,
+
+ 1,1,1,1,
+ 1,1,1,1,
+ 1,1,0,0,
+ 1,1,0,0,
+
+ 1,1,1,1,
+ 1,1,1,1,
+ 1,1,1,1,
+ 0,1,1,1,
+
+ 1,1,1,1,
+ 1,1,1,1,
+ 0,0,1,1,
+ 0,0,1,1,
+
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ Q_FULL, // 96
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+
+ 1,1,1,1,
+ 1,1,1,1,
+ 1,1,1,0,
+ 1,1,1,0,
+
+ 1,1,1,1,
+ 1,1,1,1,
+ 0,1,1,1,
+ 0,1,1,1,
+
+ Q_EMPTY,
+ Q_EMPTY,
+
+ Q_EMPTY, // 112
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ 0,0,0,1,
+ 0,0,0,1,
+ 0,0,0,1,
+ 0,0,0,1,
+
+ Q_EMPTY,
+
+ Q_EMPTY, // 128
+
+ 1,0,0,0,
+ 1,0,0,0,
+ 1,0,0,0,
+ 1,0,0,0,
+
+ Q_EMPTY,
+ Q_EMPTY,
+
+ 0,0,0,0,
+ 0,0,0,0,
+ 0,0,0,0,
+ 1,1,1,1,
+
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_TOP_QUARTER,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+
+ Q_FULL, // 144
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_TRIANGLE_LEFT,
+ Q_TRIANGLE_RIGHT,
+ Q_FULL,
+ Q_FULL,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ Q_EMPTY, // 160
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ Q_EMPTY, // 176
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+
+ Q_FULL, // 192
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ Q_EMPTY, // 208
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+
+ Q_FULL, // 224
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ Q_EMPTY, // 240
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_TOP_3_QUARTERS,
+ Q_TOP_3_QUARTERS,
+
+ 1,1,1,1,
+ 1,1,1,1,
+ 1,1,1,0,
+ 0,0,0,0,
+
+ Q_FULL,
+ Q_FULL,
+
+ Q_TOP_3_QUARTERS, // 256
+ Q_FULL,
+ Q_FULL,
+ Q_TOP_3_QUARTERS,
+ Q_TOP_3_QUARTERS,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ Q_EMPTY, // 272
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_FULL,
+ Q_FULL,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ Q_EMPTY, // 288
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_FULL,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ Q_FULL, // 304
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_TOP_HALF,
+ Q_TOP_HALF,
+ Q_TOP_HALF,
+ Q_TOP_HALF,
+ Q_TOP_HALF,
+ Q_TOP_HALF,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ Q_EMPTY, // 320
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_TOP_QUARTER,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ 1,1,1,1,
+ 1,1,1,1,
+ 0,1,1,0,
+ 0,1,1,0,
+
+ 1,1,1,1,
+ 1,1,1,1,
+ 0,1,1,0,
+ 0,1,1,0,
+
+ 1,1,1,1,
+ 1,1,1,1,
+ 0,1,1,0,
+ 0,1,1,0,
+
+ 1,1,1,1,
+ 1,1,1,1,
+ 0,1,1,0,
+ 0,1,1,0,
+
+ Q_PILLAR,
+ Q_PILLAR,
+
+ Q_PILLAR, // 336
+ Q_EMPTY,
+ Q_FULL,
+ Q_EMPTY,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+
+ Q_FULL, // 352
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_TOP_QUARTER,
+ Q_TOP_QUARTER,
+ Q_TOP_QUARTER,
+ Q_EMPTY,
+
+ Q_EMPTY, // 368
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_FULL,
+ Q_FULL,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ Q_EMPTY, // 384
+ Q_EMPTY,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_FULL,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ Q_EMPTY, // 400
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+
+ Q_EMPTY, // 416
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_EMPTY,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR,
+
+ Q_PILLAR, // 432
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR,
+ Q_PILLAR
+};
\ No newline at end of file
diff --git a/pixmap.cpp b/src/pixmap.cpp
similarity index 76%
rename from pixmap.cpp
rename to src/pixmap.cpp
index a8ca72a..177e4be 100644
--- a/pixmap.cpp
+++ b/src/pixmap.cpp
@@ -11,9 +11,9 @@
#include "pixmap.h"
#include "misc.h"
#include "ddutil.h"
-#include "blupi.cpp"
+#include "pixtables.h"
-#pragma comment(lib, "ddraw.lib")
+#define DIRECTDRAW_VERSION 0x0500
/////////////////////////////////////////////////////////////////////////////
@@ -27,7 +27,7 @@ CPixmap::CPixmap()
m_bFullScreen = FALSE;
m_bBenchmarkSuccess = TRUE;
- m_bTrueColor = FALSE;
+ m_bTrueColorBack = FALSE;
m_bTrueColorDecor = FALSE;
m_mouseType = MOUSETYPEGRA;
m_bDebug = TRUE;
@@ -126,18 +126,24 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim,
BOOL bFullScreen, int mouseType, BOOL bTrueColorDecor, BOOL bTrueColor)
{
DDSURFACEDESC ddsd;
+ int devcap;
HRESULT ddrval;
POINT pos;
HDC hdc;
+ DWORD colorMode;
hdc = CreateCompatibleDC(NULL);
- if (hdc == NULL) {
+
+ if (hdc == NULL)
+ {
bTrueColor = 0;
bTrueColorDecor = 0;
}
- else {
- ddrval = GetDeviceCaps(hdc, SIZEPALETTE);
- if ((ddrval != 0) && (ddrval < 257)) {
+ else
+ {
+ devcap = GetDeviceCaps(hdc, SIZEPALETTE);
+ if ((devcap != NULL) && (devcap < 257))
+ {
bTrueColor = 0;
bTrueColorDecor = 0;
}
@@ -149,7 +155,7 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim,
m_mouseType = mouseType;
m_dim = dim;
m_bTrueColorDecor = bTrueColorDecor;
- m_bTrueColor = bTrueColor;
+ m_bTrueColorBack = bTrueColor;
if ( m_mouseType == MOUSETYPEGRA )
{
@@ -190,9 +196,14 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim,
}
// Set the video mode to 640x480x8.
- if ( m_bFullScreen )
+ if ( m_bFullScreen != FALSE)
{
- ddrval = m_lpDD->SetDisplayMode(dim.x, dim.y, bTrueColor || bTrueColorDecor ? 16 : 8);
+ if ((bTrueColor != 0) || (colorMode = 8, bTrueColorDecor != FALSE))
+ {
+ colorMode = 16;
+ }
+
+ ddrval = m_lpDD->SetDisplayMode(dim.x, dim.y, colorMode);
if ( ddrval != DD_OK )
{
OutputDebug("Fatal error: SetDisplayMode\n");
@@ -299,91 +310,73 @@ BOOL CPixmap::Restore()
void CPixmap::QuickIcon(int channel, int rank, POINT pos)
{
int num;
- tagRECT rect;
+ RECT rect;
if (channel == CHOBJECT)
{
- 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];
+ if (table_icon_object[0] <= rank) return;
+ rect.left = table_icon_object[rank * 6 + 0 + 1];
+ rect.top = table_icon_object[rank * 6 + 1 + 1];
+ rect.right = rect.left + table_icon_object[rank * 6 + 4 + 1];
+ rect.bottom = rect.top + table_icon_object[rank * 6 + 5 + 1];
+ pos.x += table_icon_object[rank * 6 + 2 + 1];
+ pos.y += table_icon_object[rank * 6 + 3 + 1];
}
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];
+ if (table_icon_element[0] <= rank) return;
+ rect.left = table_icon_element[rank * 6 + 0 + 1];
+ rect.top = table_icon_element[rank * 6 + 1 + 1];
+ rect.right = rect.left + table_icon_element[rank * 6 + 4 + 1];
+ rect.bottom = rect.top + table_icon_element[rank * 6 + 5 + 1];
+ pos.x += table_icon_element[rank * 6 + 2 + 1];
+ pos.y += table_icon_element[rank * 6 + 3 + 1];
}
- else if ((((channel == CHBLUPI) || (channel == CHBLUPI1)) || (channel == CHBLUPI2)) || (channel == CHBLUPI3))
+ else if (IsBlupiChannel(channel))
{
- 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];
+ if (table_icon_blupi[0] <= rank) return;
+ rect.left = table_icon_blupi[rank * 6 + 0 + 1];
+ rect.top = table_icon_blupi[rank * 6 + 1 + 1];
+ rect.right = rect.left + table_icon_blupi[rank * 6 + 4 + 1];
+ rect.bottom = rect.top + table_icon_blupi[rank * 6 + 5 + 1];
+ pos.x += table_icon_blupi[rank * 6 + 2 + 1];
+ pos.y += table_icon_blupi[rank * 6 + 3 + 1];
+ }
+ else if (channel == CHEXPLO)
+ {
+ if (table_icon_explo[0] <= rank) return;
+ rect.left = table_icon_explo[rank * 6 + 0 + 1];
+ rect.top = table_icon_explo[rank * 6 + 1 + 1];
+ rect.right = rect.left + table_icon_explo[rank * 6 + 4 + 1];
+ rect.bottom = rect.top + table_icon_explo[rank * 6 + 5 + 1];
+ pos.x += table_icon_explo[rank * 6 + 2 + 1];
+ pos.y += table_icon_explo[rank * 6 + 3 + 1];
}
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)
+ rect.right = m_iconDim[channel].x;
+ num = m_totalDim[channel].x / rect.right;
+ rect.bottom = m_iconDim[channel].y;
+ if (rank < 0)
{
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];
+ 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;
}
- pos.y = pos.y + num;
-LABEL_1:
num = m_clipRect.left;
if (pos.x < num)
{
- num = num - pos.x;
+ num -= pos.x;
pos.x = m_clipRect.left;
- rect.left = rect.left + num;
+ rect.left += num;
}
num = (m_clipRect.right + rect.left) - pos.x;
if (num < rect.right)
@@ -393,27 +386,23 @@ LABEL_1:
num = m_clipRect.top;
if (pos.y < num)
{
- num = num - pos.y;
+ num -= pos.y;
pos.y = m_clipRect.top;
- rect.top = rect.top + num;
+ 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))
+ 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))
+ while (TRUE)
{
- if ((num == 0x7789FE3E) && (num = RestoreAll(), num != 0))
- {
- return;
- }
- if (num != 0x7789FE3E)
- {
- return;
- }
+ num = m_lpDDSBack->BltFast(pos.x, pos.y, m_lpDDSurface[channel], &rect, 1);
+ if (num == DD_OK) return;
+ if (num == DDERR_SURFACELOST && RestoreAll() != DD_OK) return;
+ if (num != DDERR_WASSTILLDRAWING) return;
}
}
return;
@@ -444,7 +433,7 @@ BOOL CPixmap::InitSysPalette()
BOOL CPixmap::GetTrueColor()
{
- return m_bTrueColor;
+ return m_bTrueColorBack;
}
void CPixmap::SetBenchmarkSuccess(BOOL bSuccess)
@@ -454,7 +443,7 @@ void CPixmap::SetBenchmarkSuccess(BOOL bSuccess)
void CPixmap::SetTrueColor(BOOL bTrueColor)
{
- m_bTrueColor = bTrueColor;
+ m_bTrueColorBack = bTrueColor;
}
void CPixmap::SetTrueColorDecor(BOOL bTrueColorDecor)
@@ -628,6 +617,23 @@ HRESULT CPixmap::BltFast(LPDIRECTDRAWSURFACE lpDD,
return ddrval;
}
+BOOL CPixmap::DrawMap(int channel, RECT src, RECT dest)
+{
+ HRESULT hErr;
+
+ if ((channel < 0) || (channel > MAXIMAGE))
+ {
+ return FALSE;
+ }
+
+ while (hErr == DDERR_WASSTILLDRAWING)
+ {
+ hErr = m_lpDDSurface[channel]->Blt(&dest, m_lpDDSBack, &src, DDBLT_WAIT, NULL);
+ if (hErr == DD_OK) break;
+ if (hErr == DDERR_SURFACELOST) hErr = RestoreAll(); if (hErr != DD_OK) break;;
+ }
+ return (hErr == DD_OK);
+}
// Sauve toute la palette de couleurs.
@@ -730,57 +736,116 @@ 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::Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim,
- BOOL bUsePalette)
+ 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)
+ if ( m_lpDDSurface[channel] != NULL )
{
Flush(channel);
}
- // Create and set the palette.
- if (bUsePalette)
+ // Create and set the palette.
+ if ( bUsePalette )
{
- if (m_bDebug) OutputDebug("Use palette\n");
- if (m_lpDDPal != NULL)
+ 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;
}
m_lpDDPal = DDLoadPalette(m_lpDD, pFilename);
- if (m_lpDDPal)
+ 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)
+ if ( ddrval != DD_OK )
{
TraceErrorDD(ddrval, pFilename, 1);
}
}
}
- // Create the offscreen surface, by loading our bitmap.
- m_lpDDSurface[channel] = DDLoadBitmap(m_lpDD, pFilename, 0, 0);
+ // Create the offscreen surface, by loading our bitmap.
+ m_lpDDSurface[channel] = DDLoadBitmap(m_lpDD, pFilename, 0, 0);
+ if ( m_lpDDSurface[channel] == NULL )
+ {
+ OutputDebug("Fatal error: DDLoadBitmap\n");
+ return FALSE;
+ }
+
+ // Set the color key to white
+ if ( m_bDebug ) OutputDebug("DDSetColorKey\n");
+ DDSetColorKey(m_lpDDSurface[channel], RGB(255,255,255)); // blanc
+
+ strcpy(m_filename[channel], pFilename);
+
+ m_totalDim[channel] = totalDim;
+ m_iconDim[channel] = iconDim;
+
+ return TRUE;
+}
+*/
+
+// Cache une image globale.
+
+BOOL CPixmap::Cache2(int channel, LPCSTR pFilename, POINT totalDim, POINT iconDim, BOOL bUsePalette)
+{
+ HRESULT hErr;
+
+
+ if ((channel < 0) || (channel >= MAXIMAGE))
+ {
+ return FALSE;
+ }
+
+ if (m_lpDDSurface[channel] != NULL)
+ {
+ Flush(channel);
+ }
+
+ if ( bUsePalette )
+ {
+ if ( m_bDebug ) OutputDebug("Use Palette\n");
+ if (m_lpDDPal != NULL)
+ {
+ if ( m_bDebug ) OutputDebug("Release palette\n");
+ m_lpDDPal->Release();
+ m_lpDDPal = NULL;
+ }
+ }
+ m_lpDDPal = DDLoadPalette(m_lpDD, pFilename);
+
+ if ( m_lpDDPal )
+ {
+ if ( m_bDebug ) OutputDebug("Set palette\n");
+ m_lpDDSPrimary->SetPalette(NULL);
+ hErr = (m_lpDDSPrimary->SetPalette(m_lpDDPal));
+ if (hErr != DD_OK)
+ {
+ TraceErrorDD(hErr, pFilename, 1);
+ }
+ }
+ m_lpDDSurface[channel] = DDLoadBitmap(m_lpDD, pFilename, 0, 0);
if (m_lpDDSurface[channel] == NULL)
{
OutputDebug("Fatal error: DDLoadBitmap\n");
return FALSE;
}
-
- // 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));
strcpy(m_filename[channel], pFilename);
@@ -795,6 +860,7 @@ BOOL CPixmap::Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim,
// Probably not needed?
+/*
BOOL CPixmap::Cache(int channel, HBITMAP hbm, POINT totalDim)
{
if ( channel < 0 || channel >= MAXIMAGE ) return FALSE;
@@ -821,6 +887,7 @@ BOOL CPixmap::Cache(int channel, HBITMAP hbm, POINT totalDim)
return TRUE;
}
+*/
BOOL CPixmap::BackgroundCache(int channel, const char* pFilename, POINT totalDim, POINT iconDim, BOOL bUsePalette)
{
@@ -831,33 +898,23 @@ BOOL CPixmap::BackgroundCache(int channel, const char* pFilename, POINT totalDim
strstr(pFilename, "element") != pFilename &&
strstr(pFilename, "explo") != pFilename &&
strstr(pFilename, "object") != pFilename;
- if (bUsePalette)
+ if (!bUsePalette && (!decor || m_bTrueColorBack))
{
- goto LABEL1;
- }
- if (decor)
- {
- if (m_bTrueColor == FALSE)
+ strcpy(file, "image16\\");
+ strcat(file, pFilename);
+ if (Cache2(channel, file, totalDim, iconDim, FALSE))
{
- if (decor) goto LABEL1;
- if (m_bTrueColorDecor == FALSE) goto LABEL1;
+ return TRUE;
}
}
- 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);
+ return Cache2(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); //
+ SetDebug(TRUE);
char filename[100];
char image[12];
POINT totalDim;
@@ -879,7 +936,7 @@ BOOL CPixmap::CacheAll(BOOL cache, HWND hWnd, BOOL bFullScreen, BOOL bTrueColor,
delete this;
hWnd = m_hWnd;
bFullScreen = m_bFullScreen;
- bTrueColor = m_bTrueColor;
+ bTrueColor = m_bTrueColorBack;
bTrueColorDecor = m_bTrueColorDecor;
mouseType = m_mouseType;
}
@@ -889,7 +946,7 @@ BOOL CPixmap::CacheAll(BOOL cache, HWND hWnd, BOOL bFullScreen, BOOL bTrueColor,
return FALSE;
}
- OutputDebug("Image: init\n");
+ OutputDebug("Image:_init\n");
if (BackgroundCache(0, "init.blp", totalDim, iconDim, TRUE) == FALSE)
{
return FALSE;
@@ -899,7 +956,6 @@ BOOL CPixmap::CacheAll(BOOL cache, HWND hWnd, BOOL bFullScreen, BOOL bTrueColor,
SavePalette();
OutputDebug("InitSysPalette\n");
InitSysPalette();
- //SetDebug(FALSE);
if (cache == FALSE)
{
@@ -918,142 +974,182 @@ BOOL CPixmap::CacheAll(BOOL cache, HWND hWnd, BOOL bFullScreen, BOOL bTrueColor,
DrawImage(0, 0, rect, 1);
Display();
}
- if (BackgroundCache(CHOBJECT, "object.blp", totalDim, iconDim, FALSE) == FALSE)
+ totalDim.x = 1024;
+ totalDim.y = 1280;
+ iconDim.x = 64;
+ iconDim.y = 64;
+ if (!BackgroundCache(CHOBJECT, "object.blp", totalDim, iconDim, FALSE) )
{
return FALSE;
}
SetTransparent(CHOBJECT, RGB(0, 0, 255));
+ totalDim.x = 960;
+ totalDim.y = 1200;
+ iconDim.x = 60;
+ iconDim.y = 60;
if (BackgroundCache(CHBLUPI, "blupi000.blp", totalDim, iconDim, FALSE) == FALSE)
{
return FALSE;
}
SetTransparent(CHBLUPI, RGB(0, 0, 255));
+ totalDim.x = 960;
+ totalDim.y = 1200;
+ iconDim.x = 60;
+ iconDim.y = 60;
if (BackgroundCache(CHBLUPI1, "blupi001.blp", totalDim, iconDim, FALSE) == FALSE)
{
return FALSE;
}
SetTransparent(CHBLUPI1, RGB(0, 0, 255));
+ totalDim.x = 960;
+ totalDim.y = 1200;
+ iconDim.x = 60;
+ iconDim.y = 60;
if (BackgroundCache(CHBLUPI2, "blupi002.blp", totalDim, iconDim, FALSE) == FALSE)
{
return FALSE;
}
SetTransparent(CHBLUPI2, RGB(0, 0, 255));
+ totalDim.x = 960;
+ totalDim.y = 1200;
+ iconDim.x = 60;
+ iconDim.y = 60;
if (BackgroundCache(CHBLUPI3, "blupi003.blp", totalDim, iconDim, FALSE) == FALSE)
{
return FALSE;
}
SetTransparent(CHBLUPI3, RGB(0, 0, 255));
+ totalDim.x = 64;
+ totalDim.y = 64;
+ iconDim.x = 64;
+ iconDim.y = 64;
if (BackgroundCache(CHTEMP, "temp.blp", totalDim, iconDim, FALSE) == FALSE)
{
return FALSE;
}
SetTransparent(CHTEMP, RGB(0, 0, 255));
+ totalDim.x = 208;
+ totalDim.y = 160;
+ iconDim.x = 208;
+ iconDim.y = 160;
if (BackgroundCache(CHMAP, "map.blp", totalDim, iconDim, FALSE) == FALSE)
{
return FALSE;
}
SetTransparent(CHMAP, RGB(0, 0, 255));
+ totalDim.x = 960;
+ totalDim.y = 1200;
+ iconDim.x = 60;
+ iconDim.y = 60;
if (BackgroundCache(CHELEMENT, "element.blp", totalDim, iconDim, FALSE) == FALSE)
{
return FALSE;
}
SetTransparent(CHELEMENT, RGB(0, 0, 255));
+ totalDim.x = 2048;
+ totalDim.y = 640;
+ iconDim.x = 128;
+ iconDim.y = 128;
if (BackgroundCache(CHEXPLO, "explo.blp", totalDim, iconDim, FALSE) == FALSE)
{
return FALSE;
}
SetTransparent(CHEXPLO, RGB(0, 0, 255));
sprintf(filename, "decor%.3d.blp", region);
+ totalDim.x = LXIMAGE;
+ totalDim.y = LYIMAGE;
+ iconDim.x = 0;
+ iconDim.y = 0;
if (BackgroundCache(CHDECOR, filename, totalDim, iconDim, FALSE) == FALSE)
{
return FALSE;
}
+ totalDim.x = 240;
+ totalDim.y = 1040;
+ iconDim.x = 40;
+ iconDim.y = 40;
if (BackgroundCache(CHBUTTON, "button00.blp", totalDim, iconDim, FALSE) == FALSE)
{
return FALSE;
}
SetTransparent(CHBUTTON, RGB(0, 0, 255));
+ totalDim.x = 124;
+ totalDim.y = 88;
+ iconDim.x = 124;
+ iconDim.y = 22;
if (BackgroundCache(CHJAUGE, "jauge.blp", totalDim, iconDim, FALSE) == FALSE)
{
return FALSE;
}
SetTransparent(CHJAUGE, RGB(0, 0, 255));
+ totalDim.x = 256;
+ totalDim.y = 384;
+ iconDim.x = 16;
+ iconDim.y = 16;
if (BackgroundCache(CHTEXT, "text.blp", totalDim, iconDim, FALSE) != FALSE)
{
SetTransparent(CHTEXT, RGB(0, 0, 255));
+ totalDim.x = 256;
+ totalDim.y = 96;
+ iconDim.x = 16;
+ iconDim.y = 12;
if (BackgroundCache(CHLITTLE, "little.blp", totalDim, iconDim, FALSE) != FALSE)
{
SetTransparent(CHLITTLE, RGB(0, 0, 255));
Benchmark();
return TRUE;
}
+ return FALSE;
}
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];
+ timeb tstruct;
+ int i, j, t1, t2, time;
+ RECT rect;
+ POINT dest;
- ftime(time);
- num = (int)time;
- num2 = 29;
- num3 = 10;
+ ftime(&tstruct);
+ t1 = tstruct.millitm;
- 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
+ for (j = 0; j < 10; j++)
{
- pos.x = 13;
- pos.y = 13;
- QuickIcon(1, 1, pos);
- num5--;
- } while (num5);
- ftime(time);
- i = (int)time;
+ dest.x = POSDRAWX;
+ dest.y = POSDRAWY;
+ rect.left = 29;
+ rect.right = 29 + LXIMAGE;
+ rect.top = 29;
+ rect.bottom = 29 + LYIMAGE;
+ DrawPart(-1, CHDECOR, dest, rect, 1);
- crap = 0;
-
- num4 = crap & 0xFFFF;
-
- if (num4 < num)
- {
- i = num4 + 100;
+ dest.x = 13; // position quelconque non-multiple de 16
+ dest.y = 13;
+ for (i = 0; i < 120; i++)
+ {
+ QuickIcon(CHOBJECT, 1, dest);
+ }
}
- num6 = i - num;
- sprintf(buffer, "Benchmark = %d\r\n", i - num);
+ ftime(&tstruct);
+ t2 = tstruct.millitm;
+
+ if (t1 > t2) t2 += 1000;
+ time = t2 - t1;
+
+ FILE* file = NULL;
+ char string[100];
+ sprintf(string, "Benchmark = %d\r\n", time);
file = fopen("data\\bench.blp", "wb");
+ if (file == NULL) return time;
+ fwrite(string, strlen(string), 1, file);
+ fclose(file);
- if (fopen("data\\bench.blp", "wb"))
- {
- fwrite(buffer, strlen(buffer), 1, file);
- fclose(file);
- }
- return num6;
+ return time;
}
-
// Purge une image.
void CPixmap::Flush(int channel)
@@ -1102,7 +1198,7 @@ void CPixmap::SetClipping(RECT clip)
// Retourne la r�gion de clipping.
-RECT CPixmap::GetClipping(RECT* rect)
+RECT CPixmap::GetClipping()
{
return m_clipRect;
}
@@ -1124,57 +1220,58 @@ BOOL CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos,
RECT rect;
HRESULT ddrval;
COLORREF oldColor1, oldColor2;
-
if (channel == CHOBJECT)
{
- if (g_objectMax <= rank)
- {
- return FALSE;
- }
-
+ if (table_icon_object[0] <= rank) return FALSE;
+ rect.left = table_icon_object[rank * 6 + 0 + 1];
+ rect.top = table_icon_object[rank * 6 + 1 + 1];
+ rect.right = rect.left + table_icon_object[rank * 6 + 4 + 1];
+ rect.bottom = rect.top + table_icon_object[rank * 6 + 5 + 1];
+ pos.x += table_icon_object[rank * 6 + 2 + 1];
+ pos.y += table_icon_object[rank * 6 + 3 + 1];
}
else if (channel == CHELEMENT)
{
- if (g_elementMax <= rank) {
- return FALSE;
- }
+ if (table_icon_element[0] <= rank) return FALSE;
+ rect.left = table_icon_element[rank * 6 + 0 + 1];
+ rect.top = table_icon_element[rank * 6 + 1 + 1];
+ rect.right = rect.left + table_icon_element[rank * 6 + 4 + 1];
+ rect.bottom = rect.top + table_icon_element[rank * 6 + 5 + 1];
+ pos.x += table_icon_element[rank * 6 + 2 + 1];
+ pos.y += table_icon_element[rank * 6 + 3 + 1];
}
- else if (channel == CHBLUPI ||
- channel == CHBLUPI1 ||
- channel == CHBLUPI2 ||
- channel == CHBLUPI3)
+ else if (IsBlupiChannel(channel))
{
- if (g_blupiMax <= rank)
- {
- return FALSE;
- }
+ if (table_icon_blupi[0] <= rank) return FALSE;
+ rect.left = table_icon_blupi[rank * 6 + 0 + 1];
+ rect.top = table_icon_blupi[rank * 6 + 1 + 1];
+ rect.right = rect.left + table_icon_blupi[rank * 6 + 4 + 1];
+ rect.bottom = rect.top + table_icon_blupi[rank * 6 + 5 + 1];
+ pos.x += table_icon_blupi[rank * 6 + 2 + 1];
+ pos.y += table_icon_blupi[rank * 6 + 3 + 1];
+ }
+ else if (channel == CHEXPLO)
+ {
+ if (table_icon_explo[0] <= rank) return FALSE;
+ rect.left = table_icon_explo[rank * 6 + 0 + 1];
+ rect.top = table_icon_explo[rank * 6 + 1 + 1];
+ rect.right = rect.left + table_icon_explo[rank * 6 + 4 + 1];
+ rect.bottom = rect.top + table_icon_explo[rank * 6 + 5 + 1];
+ pos.x += table_icon_explo[rank * 6 + 2 + 1];
+ pos.y += table_icon_explo[rank * 6 + 3 + 1];
}
else
{
- 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 ||
+ m_iconDim[channel].y == 0) return FALSE;
- 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;
- if (rank < 0 || rank >= nbx * nby) 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;
}
- if (g_exploMax <= rank) return FALSE;
-
- 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;
rect.left = (rank%nbx)*m_iconDim[channel].x;
rect.top = (rank/nbx)*m_iconDim[channel].y;
@@ -1477,7 +1574,7 @@ void CPixmap::MouseUpdate()
{
RECT oldRect, newRect, rcRect;
- if ( m_lpDDSurface[CHBLUPI] == NULL ) return;
+ if ( m_lpDDSurface[CHELEMENT] == NULL ) return;
if ( m_mouseType != MOUSETYPEGRA ) return;
if ( m_mouseSprite == SPRITE_EMPTY ) return;
if ( !m_bMouseShow ) return;
@@ -1568,7 +1665,7 @@ void CPixmap::MouseBackDraw()
POINT dst;
RECT rcRect;
- if ( m_lpDDSurface[CHBLUPI] == NULL ) return;
+ if ( m_lpDDSurface[CHELEMENT] == NULL ) return;
if ( m_mouseType != MOUSETYPEGRA ) return;
if ( m_mouseSprite == SPRITE_EMPTY ) return;
if ( !m_bMouseShow ) return;
@@ -1577,29 +1674,29 @@ void CPixmap::MouseBackDraw()
dst.x = m_mousePos.x - m_mouseHotSpot.x;
dst.y = m_mousePos.y - m_mouseHotSpot.y;
- rcRect = MouseRectSprite();
+ MouseRectSprite(&rcRect, &dst);
if ( dst.x < 0 )
{
rcRect.left -= dst.x;
dst.x = 0;
}
- if ( dst.x+DIMBLUPIX > LXIMAGE )
+ if ( dst.x + rcRect.right - rcRect.left > LXIMAGE )
{
- rcRect.right -= (dst.x+DIMBLUPIX)-LXIMAGE;
+ rcRect.right -= (dst.x + rcRect.right - rcRect.left)-LXIMAGE;
}
if ( dst.y < 0 )
{
rcRect.top -= dst.y;
dst.y = 0;
}
- if ( dst.y+DIMBLUPIY > LYIMAGE )
+ if ( dst.y + rcRect.bottom - rcRect.top > LYIMAGE )
{
- rcRect.bottom -= (dst.y+DIMBLUPIY)-LYIMAGE;
+ rcRect.bottom -= (dst.y + rcRect.bottom - rcRect.top)-LYIMAGE;
}
// Dessine le lutin dans m_lpDDSBack.
- BltFast(m_lpDDSBack, CHBLUPI, dst, rcRect, 0);
+ BltFast(m_lpDDSBack, CHELEMENT, dst, rcRect, 0);
}
// Sauve le fond sous la souris.
@@ -1611,7 +1708,7 @@ void CPixmap::MouseBackSave()
POINT dst;
RECT rcRect;
- if ( m_lpDDSurface[CHBLUPI] == NULL ) return;
+ if ( m_lpDDSurface[CHELEMENT] == NULL ) return;
if ( m_mouseType != MOUSETYPEGRA ) return;
if ( m_mouseSprite == SPRITE_EMPTY ) return;
if ( !m_bMouseShow ) return;
@@ -1673,7 +1770,7 @@ void CPixmap::MouseBackRestore()
POINT dst;
RECT rcRect;
- if ( m_lpDDSurface[CHBLUPI] == NULL ) return;
+ if ( m_lpDDSurface[CHELEMENT] == NULL ) return;
if ( !m_bMouseBack ) return;
dst.x = m_mouseBackPos.x;
@@ -1689,18 +1786,18 @@ void CPixmap::MouseBackRestore()
rcRect.left -= dst.x;
dst.x = 0;
}
- if ( dst.x+DIMBLUPIX > LXIMAGE )
+ if ( dst.x+ rcRect.right - rcRect.left > LXIMAGE )
{
- rcRect.right -= (dst.x+DIMBLUPIX)-LXIMAGE;
+ rcRect.right -= (dst.x+ rcRect.right - rcRect.left)-LXIMAGE;
}
if ( dst.y < 0 )
{
rcRect.top -= dst.y;
dst.y = 0;
}
- if ( dst.y+DIMBLUPIY > LYIMAGE )
+ if ( dst.y+ rcRect.top - rcRect.bottom > LYIMAGE )
{
- rcRect.bottom -= (dst.y+DIMBLUPIY)-LYIMAGE;
+ rcRect.bottom -= (dst.y+ rcRect.top - rcRect.bottom)-LYIMAGE;
}
while( TRUE )
@@ -1759,34 +1856,23 @@ void CPixmap::MouseBackDebug()
// Retourne le rectangle correspondant au sprite
// de la souris dans CHBLUPI.
-RECT CPixmap::MouseRectSprite()
+void CPixmap::MouseRectSprite(RECT *rect, POINT *offset)
{
int rank, nbx;
RECT rcRect;
- rank = 348;
- if ( m_mouseSprite == SPRITE_ARROW ) rank = 348;
- if ( m_mouseSprite == SPRITE_POINTER ) rank = 349;
- if ( m_mouseSprite == SPRITE_MAP ) rank = 350;
- if ( m_mouseSprite == SPRITE_WAIT ) rank = 351;
- if ( m_mouseSprite == SPRITE_FILL ) rank = 352;
- if ( m_mouseSprite == SPRITE_ARROWL ) rank = 353;
- if ( m_mouseSprite == SPRITE_ARROWR ) rank = 354;
- if ( m_mouseSprite == SPRITE_ARROWU ) rank = 355;
- if ( m_mouseSprite == SPRITE_ARROWD ) rank = 356;
- if ( m_mouseSprite == SPRITE_ARROWDL ) rank = 357;
- if ( m_mouseSprite == SPRITE_ARROWDR ) rank = 358;
- if ( m_mouseSprite == SPRITE_ARROWUL ) rank = 359;
- if ( m_mouseSprite == SPRITE_ARROWUR ) rank = 360;
+ rank = 37;
+ if ( m_mouseSprite == SPRITE_POINTER ) rank = 38;
+ if ( m_mouseSprite == 11 ) rank = 39;
- nbx = m_totalDim[CHBLUPI].x / m_iconDim[CHBLUPI].x;
+ rect->left = table_icon_element[rank * 6 + 0 + 1];
+ rect->right = rect->left + table_icon_element[rank * 6 + 4 + 1];
+ rect->top = table_icon_element[rank * 6 + 1 + 1];
+ rect->bottom = rect->top + table_icon_element[rank * 6 + 5 + 1];
+ offset->x += table_icon_element[rank * 6 + 2 + 1];
+ offset->y += table_icon_element[rank * 6 + 3 + 1];
- rcRect.left = (rank%nbx)*m_iconDim[CHBLUPI].x;
- rcRect.top = (rank/nbx)*m_iconDim[CHBLUPI].y;
- rcRect.right = rcRect.left+m_iconDim[CHBLUPI].x;
- rcRect.bottom = rcRect.top +m_iconDim[CHBLUPI].y;
-
- return rcRect;
+ return;
}
// Initialise le hot spot selon le sprite en cours.
@@ -1829,3 +1915,7 @@ void CPixmap::MouseHotSpot()
}
+static inline BOOL IsBlupiChannel(int channel)
+{
+ return channel == CHBLUPI || channel == CHBLUPI1 || channel == CHBLUPI2 || channel == CHBLUPI3;
+}
\ No newline at end of file
diff --git a/pixmap.h b/src/pixmap.h
similarity index 89%
rename from pixmap.h
rename to src/pixmap.h
index 59656e8..b5f71d8 100644
--- a/pixmap.h
+++ b/src/pixmap.h
@@ -1,7 +1,5 @@
// CPixmap.h
-using namespace std;
-
#pragma once
#include
@@ -9,7 +7,7 @@ using namespace std;
/////////////////////////////////////////////////////////////
#define MAXIMAGE 100
-
+#define DIRECTDRAW_VERSION 0x0500 // ????????????
class CPixmap
{
@@ -38,7 +36,7 @@ public:
void SetTransparent(int channel, COLORREF color);
void SetTransparent2(int channel, COLORREF color1, COLORREF color2);
void SetClipping(RECT clip);
- RECT GetClipping(RECT* rect);
+ RECT GetClipping();
void HudIcon(int channel, int rank, POINT pos);
void QuickIcon(int channel, int rank, POINT pos);
@@ -50,6 +48,7 @@ public:
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 DrawMap(int channel, RECT src, RECT dest);
BOOL BuildIconMask(int channelMask, int rankMask,
int channel, int rankSrc, int rankDst);
@@ -63,6 +62,9 @@ public:
void MouseInvalidate();
void MouseBackClear();
void MouseBackDraw();
+ void SetBenchmarkSuccess(BOOL bSuccess);
+ void SetTrueColor(BOOL bTrueColor);
+ void SetTrueColorDecor(BOOL bTrueColorDecor);
protected:
HRESULT RestoreAll();
@@ -75,18 +77,16 @@ protected:
void MouseBackSave();
void MouseBackRestore();
void MouseBackDebug();
- RECT MouseRectSprite();
+ void MouseRectSprite(RECT *rect, POINT *offset);
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_bTrueColorBack;
BOOL m_bTrueColorDecor;
BOOL m_field5_0x14; //Need to figure out
BOOL m_field5_0x18; //Need to figure out
@@ -111,7 +111,7 @@ protected:
LPDIRECTDRAWSURFACE m_lpDDSPrimary;
LPDIRECTDRAWSURFACE m_lpDDSBack;
LPDIRECTDRAWSURFACE m_lpDDSMouse;
- LPDIRECTDRAWPALETTE m_lpDDPal;
+ IDirectDrawPalette* m_lpDDPal;
LPDIRECTDRAWSURFACE m_lpDDSurface[MAXIMAGE];
LPDIRECTDRAWCLIPPER m_lpClipper;
PALETTEENTRY m_pal[256];
@@ -122,4 +122,7 @@ protected:
POINT m_totalDim[MAXIMAGE];
POINT m_iconDim[MAXIMAGE];
DDBLTFX m_DDbltfx;
-};
\ No newline at end of file
+
+};
+
+static inline BOOL IsBlupiChannel(int channel);
\ No newline at end of file
diff --git a/src/pixtables.h b/src/pixtables.h
new file mode 100644
index 0000000..6a6157a
--- /dev/null
+++ b/src/pixtables.h
@@ -0,0 +1,1198 @@
+#pragma once
+
+// keep these structs for reference
+/*
+typedef struct {
+ short x;
+ short y;
+} ShortPOINT;
+
+typedef struct {
+ ShortPOINT pos;
+ ShortPOINT offset;
+ ShortPOINT size;
+} IconPack;
+*/
+
+
+extern short table_icon_blupi[]{
+ 336,
+ 202,185, 17,9, 32,49,
+ 194,234, 17,8, 28,50,
+ 33,284, 12,8, 35,50,
+ 222,234, 15,8, 28,50,
+ 609,91, 11,12, 32,46,
+ 614,335, 18,7, 33,52,
+ 430,234, 19,8, 32,50,
+ 462,234, 19,8, 32,50,
+ 647,335, 18,7, 33,52,
+ 494,234, 19,8, 32,50,
+ 706,284, 19,8, 32,51,
+ 680,335, 12,7, 33,52,
+ 526,234, 12,8, 32,50,
+ 558,234, 12,8, 32,50,
+ 713,335, 12,7, 33,52,
+ 718,234, 11,8, 33,50,
+ 96,335, 11,8, 33,51,
+ 108,91, 16,15, 37,43,
+ 527,185, 15,11, 37,49,
+ 564,185, 14,11, 37,49,
+ 145,91, 7,15, 37,43,
+ 601,185, 8,11, 37,49,
+ 0,387, 9,8, 36,52,
+ 590,234, 17,8, 32,50,
+ 622,234, 11,8, 32,50,
+ 541,494, 8,2, 33,57,
+ 433,137, 19,10, 33,48,
+ 362,185, 20,9, 33,49,
+ 73,137, 20,11, 36,47,
+ 219,551, 9,2, 34,58,
+ 273,137, 8,10, 32,48,
+ 395,185, 7,9, 33,49,
+ 0,137, 4,12, 36,46,
+ 138,284, 15,10, 36,50,
+ 252,91, 16,15, 36,44,
+ 0,91, 19,19, 37,39,
+ 598,137, 7,12, 36,48,
+ 288,91, 5,15, 36,44,
+ 37,91, 1,19, 37,39,
+ 0,57, 6,18, 47,32,
+ 673,25, 8,18, 46,32,
+ 305,137, 14,10, 32,48,
+ 68,284, 13,8, 35,50,
+ 169,440, 11,4, 40,54,
+ 738,284, 13,9, 32,51,
+ 644,284, 15,9, 31,51,
+ 288,494, 10,5, 42,55,
+ 435,387, 9,8, 51,52,
+ 779,0, 21,32, 17,25,
+ 570,91, 21,14, 39,45,
+ 737,91, 25,13, 34,46,
+ 182,91, 24,13, 35,44,
+ 36,137, 22,12, 37,46,
+ 357,91, 25,13, 34,45,
+ 460,91, 23,13, 36,45,
+ 496,91, 2,14, 37,45,
+ 391,91, 2,13, 34,45,
+ 217,91, 2,13, 35,44,
+ 533,91, 2,13, 37,45,
+ 324,91, 2,13, 33,45,
+ 425,91, 2,13, 35,45,
+ 683,846, 4,0, 48,60,
+ 363,846, 7,0, 45,60,
+ 177,668, 4,1, 47,59,
+ 86,668, 6,1, 45,59,
+ 498,846, 5,0, 46,60,
+ 731,846, 8,0, 48,60,
+ 408,846, 8,0, 45,60,
+ 131,668, 9,1, 46,59,
+ 636,846, 8,0, 47,60,
+ 544,846, 9,0, 46,60,
+ 590,846, 3,0, 46,60,
+ 691,609, 10,1, 41,59,
+ 321,846, 9,0, 42,60,
+ 0,668, 10,1, 43,59,
+ 453,846, 11,0, 45,60,
+ 47,57, 6,18, 47,32,
+ 141,57, 5,18, 48,32,
+ 635,57, 2,17, 57,32,
+ 333,57, 3,18, 49,32,
+ 382,57, 4,18, 49,32,
+ 189,57, 5,18, 48,32,
+ 719,25, 8,18, 46,32,
+ 237,57, 8,18, 48,32,
+ 692,57, 1,17, 58,32,
+ 431,57, 8,18, 49,32,
+ 285,57, 8,18, 48,32,
+ 94,57, 8,18, 47,32,
+ 480,57, 4,18, 49,32,
+ 532,25, 7,18, 53,31,
+ 529,57, 5,17, 52,32,
+ 581,57, 0,17, 54,32,
+ 585,25, 0,17, 60,31,
+ 180,137, 16,5, 31,48,
+ 234,185, 15,4, 32,49,
+ 654,234, 15,3, 32,50,
+ 0,335, 15,2, 32,51,
+ 582,335, 15,3, 32,52,
+ 543,387, 15,4, 31,53,
+ 337,137, 13,5, 32,48,
+ 266,185, 14,4, 32,49,
+ 686,234, 14,3, 32,50,
+ 32,335, 14,2, 32,51,
+ 551,335, 15,3, 31,52,
+ 574,387, 15,4, 32,53,
+ 638,185, 10,4, 37,49,
+ 596,284, 6,3, 48,50,
+ 486,387, 2,1, 57,52,
+ 117,440, 2,2, 52,53,
+ 606,387, 7,4, 39,53,
+ 603,440, 3,6, 56,54,
+ 498,335, 4,9, 53,51,
+ 659,440, 3,6, 56,54,
+ 715,440, 2,6, 58,54,
+ 330,440, 3,6, 54,54,
+ 289,440, 9,6, 41,54,
+ 438,440, 1,6, 55,54,
+ 0,494, 2,6, 58,54,
+ 493,440, 5,6, 55,54,
+ 384,440, 6,6, 54,54,
+ 548,440, 5,6, 55,54,
+ 36,387, 21,8, 37,52,
+ 675,185, 20,8, 38,49,
+ 713,185, 20,9, 38,49,
+ 287,284, 20,9, 39,50,
+ 706,137, 20,9, 37,48,
+ 211,284, 20,8, 38,50,
+ 184,387, 2,8, 38,52,
+ 751,185, 2,8, 38,49,
+ 0,234, 2,9, 38,49,
+ 326,284, 2,9, 39,50,
+ 743,137, 3,9, 37,48,
+ 249,284, 2,8, 38,50,
+ 298,185, 17,9, 32,49,
+ 641,91, 11,12, 32,46,
+ 673,91, 17,12, 32,46,
+ 78,185, 18,9, 31,49,
+ 428,185, 13,9, 33,49,
+ 461,185, 13,9, 33,49,
+ 705,91, 11,12, 32,46,
+ 109,185, 11,9, 31,49,
+ 494,185, 14,9, 33,49,
+ 330,185, 15,9, 32,49,
+ 87,551, 1,1, 46,57,
+ 0,846, 13,0, 33,60,
+ 599,786, 20,0, 31,60,
+ 730,494, 18,0, 42,57,
+ 42,551, 13,1, 45,57,
+ 33,846, 14,0, 33,60,
+ 630,786, 9,0, 31,60,
+ 0,551, 0,0, 42,57,
+ 574,494, 11,1, 36,57,
+ 188,551, 18,0, 31,58,
+ 610,494, 17,0, 38,57,
+ 661,786, 15,0, 32,60,
+ 693,786, 9,0, 32,60,
+ 165,846, 14,0, 34,60,
+ 66,846, 16,0, 33,60,
+ 725,786, 18,0, 32,60,
+ 99,846, 12,0, 33,60,
+ 132,846, 11,0, 33,60,
+ 757,786, 10,0, 32,60,
+ 239,846, 6,0, 41,60,
+ 280,846, 6,0, 41,60,
+ 199,846, 6,0, 40,60,
+ 178,494, 15,0, 32,55,
+ 64,335, 14,0, 32,51,
+ 378,494, 11,0, 32,56,
+ 675,284, 11,0, 31,51,
+ 466,137, 19,10, 33,48,
+ 369,137, 20,10, 32,48,
+ 751,234, 20,8, 33,50,
+ 499,137, 19,10, 33,48,
+ 532,137, 8,10, 33,48,
+ 401,137, 8,10, 32,48,
+ 0,284, 7,8, 33,50,
+ 565,137, 8,10, 33,48,
+ 211,137, 18,10, 31,48,
+ 634,137, 12,10, 36,48,
+ 109,137, 10,10, 41,47,
+ 670,137, 12,10, 36,48,
+ 150,137, 11,10, 30,48,
+ 645,387, 12,5, 39,53,
+ 222,387, 12,7, 39,52,
+ 38,234, 12,9, 39,49,
+ 0,185, 12,10, 39,48,
+ 77,234, 12,9, 39,49,
+ 203,335, 12,7, 39,51,
+ 684,387, 9,5, 39,53,
+ 261,387, 9,7, 39,52,
+ 116,234, 9,9, 39,49,
+ 39,185, 9,10, 39,48,
+ 155,234, 9,9, 39,49,
+ 242,335, 9,7, 39,51,
+ 253,551, 14,0, 38,58,
+ 443,551, 8,0, 41,58,
+ 224,668, 0,0, 47,59,
+ 615,551, 0,0, 49,58,
+ 539,609, 6,0, 38,59,
+ 577,609, 4,0, 38,59,
+ 291,551, 5,0, 38,58,
+ 329,551, 8,0, 38,58,
+ 484,551, 11,0, 41,58,
+ 271,668, 13,0, 47,59,
+ 664,551, 11,0, 49,58,
+ 615,609, 16,0, 38,59,
+ 653,609, 18,0, 38,59,
+ 367,551, 17,0, 38,58,
+ 723,387, 12,5, 39,53,
+ 0,440, 9,5, 39,53,
+ 210,494, 5,3, 39,55,
+ 209,440, 4,4, 40,54,
+ 410,494, 3,2, 40,56,
+ 648,494, 6,0, 41,57,
+ 525,551, 6,0, 45,58,
+ 318,668, 6,0, 48,59,
+ 249,494, 16,3, 39,55,
+ 249,440, 16,4, 40,54,
+ 450,494, 17,2, 40,56,
+ 689,494, 13,0, 41,57,
+ 570,551, 9,0, 45,58,
+ 366,668, 6,0, 48,59,
+ 746,335, 8,6, 35,52,
+ 73,387, 8,6, 37,52,
+ 39,440, 8,5, 39,53,
+ 78,440, 9,5, 39,53,
+ 300,387, 7,6, 43,52,
+ 281,335, 8,7, 42,51,
+ 323,335, 9,7, 42,51,
+ 365,335, 10,7, 42,51,
+ 343,387, 8,6, 43,52,
+ 407,335, 8,7, 43,51,
+ 129,335, 12,9, 37,51,
+ 174,284, 11,10, 37,50,
+ 502,284, 10,8, 47,50,
+ 450,335, 10,7, 48,51,
+ 386,387, 10,6, 49,52,
+ 510,668, 3,0, 57,59,
+ 0,609, 4,1, 56,58,
+ 567,668, 3,0, 57,59,
+ 624,668, 2,0, 58,59,
+ 287,609, 0,1, 60,58,
+ 682,668, 2,0, 58,59,
+ 414,668, 6,0, 48,59,
+ 462,668, 6,0, 48,59,
+ 740,668, 0,0, 58,59,
+ 347,609, 0,1, 60,58,
+ 290,727, 1,0, 59,59,
+ 0,727, 1,0, 58,59,
+ 56,609, 2,1, 56,58,
+ 58,727, 1,0, 58,59,
+ 713,551, 2,1, 55,58,
+ 133,551, 4,2, 55,57,
+ 410,284, 14,8, 46,50,
+ 365,284, 15,8, 45,50,
+ 549,284, 1,8, 47,50,
+ 456,284, 1,8, 46,50,
+ 690,0, 7,36, 44,24,
+ 648,0, 8,36, 42,24,
+ 570,0, 10,36, 38,24,
+ 536,0, 12,36, 34,24,
+ 608,0, 9,36, 40,24,
+ 734,0, 7,36, 45,24,
+ 140,185, 18,9, 31,49,
+ 306,234, 18,8, 31,50,
+ 337,234, 18,8, 31,50,
+ 330,494, 6,3, 48,55,
+ 490,494, 3,0, 51,56,
+ 250,234, 17,8, 28,50,
+ 103,284, 13,8, 35,50,
+ 278,234, 15,8, 28,50,
+ 467,609, 10,1, 36,59,
+ 503,609, 11,1, 36,59,
+ 405,551, 10,1, 38,58,
+ 43,668, 5,1, 43,59,
+ 732,609, 11,1, 42,59,
+ 504,25, 15,15, 28,31,
+ 448,25, 15,16, 28,29,
+ 108,0, 15,18, 28,20,
+ 360,0, 15,16, 28,23,
+ 476,25, 15,13, 28,30,
+ 645,25, 15,13, 28,32,
+ 388,0, 15,18, 28,23,
+ 136,0, 15,21, 28,20,
+ 202,25, 15,18, 28,27,
+ 171,185, 11,9, 31,49,
+ 368,234, 11,8, 31,50,
+ 399,234, 11,8, 31,50,
+ 110,387, 14,7, 37,52,
+ 147,387, 14,7, 37,52,
+ 166,335, 14,8, 37,51,
+ 116,727, 0,1, 58,59,
+ 174,727, 1,1, 58,59,
+ 169,609, 1,2, 59,58,
+ 232,727, 2,1, 58,59,
+ 112,609, 3,2, 57,58,
+ 59,786, 0,1, 60,59,
+ 119,786, 0,1, 60,59,
+ 179,786, 0,1, 60,59,
+ 349,727, 1,1, 59,59,
+ 239,786, 0,1, 60,59,
+ 408,727, 1,1, 59,59,
+ 299,786, 0,1, 60,59,
+ 359,786, 0,1, 60,59,
+ 228,609, 1,2, 59,58,
+ 419,786, 0,1, 60,59,
+ 407,609, 0,2, 60,58,
+ 479,786, 0,1, 60,59,
+ 467,727, 1,1, 59,59,
+ 539,786, 0,1, 60,59,
+ 526,727, 1,1, 59,59,
+ 585,727, 1,1, 59,59,
+ 644,727, 1,1, 59,59,
+ 703,727, 1,1, 59,59,
+ 0,786, 1,1, 59,59,
+ 58,494, 0,6, 60,54,
+ 118,494, 0,6, 60,54,
+ 279,25, 3,33, 55,27,
+ 334,25, 0,33, 59,27,
+ 416,0, 0,36, 60,23,
+ 49,0, 0,39, 59,19,
+ 476,0, 0,36, 60,23,
+ 143,25, 1,33, 59,26,
+ 393,25, 2,32, 55,28,
+ 242,137, 18,12, 31,48,
+ 74,91, 16,18, 34,42,
+ 750,57, 14,25, 40,34,
+ 0,25, 11,33, 45,25,
+ 0,0, 7,39, 49,19,
+ 311,0, 5,38, 49,22,
+ 164,0, 5,38, 49,21,
+ 213,0, 5,39, 49,21,
+ 262,0, 5,39, 49,21,
+ 45,25, 5,35, 49,25,
+ 94,25, 5,33, 49,26,
+ 230,25, 5,32, 49,27,
+};
+
+extern short table_icon_element[]{
+ 289,
+ 308,153, 9,20, 51,40,
+ 51,194, 8,19, 52,41,
+ 730,153, 8,19, 51,41,
+ 767,194, 9,18, 49,42,
+ 0,321, 10,17, 47,43,
+ 768,278, 11,17, 44,43,
+ 207,321, 12,16, 41,44,
+ 812,278, 10,17, 44,43,
+ 47,321, 8,17, 47,43,
+ 250,236, 5,18, 51,42,
+ 680,153, 6,19, 50,41,
+ 781,153, 5,19, 51,41,
+ 0,24, 7,36, 44,24,
+ 44,24, 7,36, 44,24,
+ 803,0, 8,36, 42,24,
+ 647,0, 10,36, 38,24,
+ 367,24, 12,35, 34,25,
+ 575,0, 11,36, 36,24,
+ 723,0, 9,36, 40,24,
+ 88,24, 7,36, 44,24,
+ 435,24, 6,35, 46,25,
+ 54,50, 10,28, 39,27,
+ 187,50, 12,28, 34,28,
+ 0,50, 16,28, 27,27,
+ 255,50, 13,28, 35,28,
+ 93,50, 10,28, 40,27,
+ 290,50, 13,28, 35,28,
+ 27,50, 16,28, 27,27,
+ 221,50, 12,28, 34,28,
+ 644,50, 7,16, 49,31,
+ 548,50, 8,16, 48,31,
+ 422,50, 19,16, 25,31,
+ 472,50, 12,16, 38,31,
+ 693,50, 6,16, 50,31,
+ 596,50, 7,16, 48,31,
+ 447,50, 19,16, 25,31,
+ 510,50, 12,16, 38,31,
+ 581,24, 16,17, 29,26,
+ 442,0, 19,16, 15,22,
+ 396,584, 14,1, 33,59,
+ 666,321, 11,12, 37,46,
+ 703,321, 11,12, 37,46,
+ 740,321, 11,12, 37,46,
+ 830,116, 11,22, 37,37,
+ 325,50, 11,31, 38,28,
+ 277,0, 6,41, 47,19,
+ 49,368, 5,12, 51,48,
+ 525,418, 5,8, 51,52,
+ 132,24, 7,0, 44,24,
+ 176,24, 7,0, 44,24,
+ 845,0, 8,0, 42,24,
+ 685,0, 10,0, 38,24,
+ 401,24, 12,0, 34,25,
+ 611,0, 11,0, 36,24,
+ 763,0, 9,0, 40,24,
+ 220,24, 7,0, 44,24,
+ 481,24, 6,0, 46,25,
+ 447,153, 6,18, 45,41,
+ 103,194, 3,18, 52,41,
+ 155,194, 3,18, 52,41,
+ 442,194, 0,18, 60,41,
+ 265,194, 1,18, 59,41,
+ 359,153, 9,18, 44,41,
+ 324,194, 1,18, 59,41,
+ 207,194, 2,18, 58,41,
+ 832,153, 7,18, 51,41,
+ 492,153, 10,18, 45,41,
+ 0,194, 7,18, 51,41,
+ 795,116, 14,23, 35,37,
+ 330,321, 10,9, 42,44,
+ 248,321, 10,9, 41,44,
+ 129,321, 11,9, 39,44,
+ 500,321, 12,8, 37,45,
+ 468,321, 14,8, 32,45,
+ 94,321, 12,9, 35,44,
+ 168,321, 10,9, 39,44,
+ 542,194, 9,10, 42,42,
+ 584,194, 8,10, 44,42,
+ 585,368, 2,9, 56,49,
+ 697,368, 0,9, 60,49,
+ 641,368, 2,9, 56,49,
+ 475,368, 3,9, 55,49,
+ 757,368, 0,9, 60,49,
+ 530,368, 3,9, 55,49,
+ 217,368, 8,9, 50,49,
+ 100,368, 17,9, 38,49,
+ 177,368, 10,9, 40,49,
+ 138,368, 5,9, 39,49,
+ 267,368, 2,9, 50,49,
+ 363,50, 1,31, 59,29,
+ 408,236, 2,16, 57,42,
+ 406,278, 0,14, 59,42,
+ 465,278, 0,12, 59,42,
+ 465,236, 2,9, 57,42,
+ 383,194, 0,7, 59,41,
+ 524,278, 0,4, 59,42,
+ 0,278, 1,2, 58,42,
+ 522,236, 2,2, 57,42,
+ 58,278, 2,16, 58,42,
+ 116,278, 2,14, 58,42,
+ 174,278, 2,12, 58,42,
+ 232,278, 2,9, 58,42,
+ 290,278, 2,7, 58,42,
+ 579,236, 2,4, 57,42,
+ 636,236, 3,2, 57,42,
+ 348,278, 2,2, 58,42,
+ 693,236, 1,16, 57,42,
+ 301,236, 4,14, 51,42,
+ 720,194, 8,12, 47,42,
+ 0,236, 6,9, 50,42,
+ 50,236, 6,7, 50,42,
+ 628,194, 7,4, 46,42,
+ 816,194, 7,2, 49,42,
+ 352,236, 2,2, 56,42,
+ 750,236, 3,16, 57,42,
+ 100,236, 9,14, 50,42,
+ 583,153, 8,12, 48,41,
+ 150,236, 8,9, 50,42,
+ 631,153, 8,7, 49,41,
+ 674,194, 10,4, 46,42,
+ 200,236, 6,2, 50,42,
+ 807,236, 3,2, 57,42,
+ 558,116, 16,25, 31,34,
+ 182,83, 9,25, 45,33,
+ 636,83, 4,25, 54,33,
+ 216,116, 3,25, 56,33,
+ 690,83, 4,25, 54,33,
+ 227,83, 9,25, 45,33,
+ 743,50, 16,25, 31,33,
+ 119,153, 25,19, 15,40,
+ 166,153, 23,19, 18,40,
+ 202,153, 22,19, 19,40,
+ 48,153, 20,19, 18,39,
+ 184,153, 18,19, 18,40,
+ 149,153, 17,19, 17,40,
+ 134,153, 17,19, 15,40,
+ 456,526, 20,3, 25,57,
+ 481,526, 19,3, 27,57,
+ 508,526, 19,3, 27,57,
+ 432,526, 21,3, 24,57,
+ 395,526, 24,3, 17,57,
+ 373,526, 27,3, 10,57,
+ 383,526, 27,3, 12,57,
+ 412,526, 23,3, 20,57,
+ 318,526, 1,3, 55,56,
+ 112,584, 2,1, 52,58,
+ 640,526, 1,2, 56,57,
+ 576,418, 1,5, 56,52,
+ 317,368, 3,5, 52,49,
+ 817,368, 8,2, 40,50,
+ 323,471, 9,2, 41,55,
+ 60,471, 7,3, 47,54,
+ 833,584, 0,0, 60,60,
+ 336,584, 0,2, 60,58,
+ 774,584, 1,0, 59,60,
+ 575,584, 2,1, 58,59,
+ 277,584, 1,2, 59,58,
+ 719,584, 2,0, 55,60,
+ 110,526, 2,2, 58,55,
+ 164,584, 0,2, 56,58,
+ 168,526, 1,5, 59,55,
+ 587,526, 5,2, 53,57,
+ 519,584, 3,0, 56,59,
+ 369,368, 5,3, 52,49,
+ 688,418, 8,5, 40,53,
+ 372,321, 5,10, 48,44,
+ 221,153, 8,14, 43,40,
+ 583,278, 0,17, 60,42,
+ 53,418, 0,8, 60,50,
+ 308,418, 0,7, 60,51,
+ 833,418, 0,5, 60,53,
+ 107,471, 0,4, 60,54,
+ 113,418, 0,8, 60,50,
+ 368,418, 0,7, 60,51,
+ 0,471, 0,5, 60,53,
+ 167,471, 0,4, 60,54,
+ 210,0, 24,11, 16,16,
+ 66,153, 5,19, 53,39,
+ 535,0, 26,34, 10,24,
+ 195,0, 21,37, 15,16,
+ 376,0, 19,35, 22,21,
+ 457,0, 14,32, 27,22,
+ 545,0, 12,32, 30,24,
+ 398,0, 8,35, 44,21,
+ 527,24, 2,35, 54,25,
+ 324,0, 5,38, 52,20,
+ 133,50, 2,32, 54,27,
+ 0,584, 12,2, 36,58,
+ 36,584, 11,2, 38,58,
+ 810,526, 13,2, 33,58,
+ 764,526, 18,2, 23,58,
+ 754,526, 25,2, 10,58,
+ 787,526, 18,2, 23,58,
+ 843,526, 13,2, 33,58,
+ 74,584, 11,2, 38,58,
+ 820,321, 7,5, 49,47,
+ 645,116, 6,14, 48,35,
+ 542,83, 5,13, 47,33,
+ 96,83, 6,11, 43,33,
+ 0,368, 4,5, 49,47,
+ 693,116, 6,14, 48,35,
+ 589,83, 8,13, 47,33,
+ 139,83, 11,11, 43,33,
+ 741,116, 0,14, 54,36,
+ 498,116, 0,13, 60,33,
+ 589,116, 2,11, 56,34,
+ 440,116, 2,13, 58,33,
+ 0,153, 9,14, 48,37,
+ 227,471, 0,6, 60,54,
+ 0,83, 15,25, 32,33,
+ 272,83, 9,25, 45,33,
+ 744,83, 4,25, 54,33,
+ 272,116, 3,25, 56,33,
+ 798,83, 4,25, 54,33,
+ 317,83, 9,25, 45,33,
+ 774,50, 16,25, 31,33,
+ 32,83, 15,25, 32,33,
+ 362,83, 9,25, 45,33,
+ 0,116, 4,25, 54,33,
+ 328,116, 3,25, 56,33,
+ 54,116, 4,25, 54,33,
+ 407,83, 9,25, 45,33,
+ 805,50, 16,25, 31,33,
+ 64,83, 15,25, 32,33,
+ 452,83, 9,25, 45,33,
+ 108,116, 4,25, 54,33,
+ 384,116, 3,25, 56,33,
+ 162,116, 4,25, 54,33,
+ 497,83, 9,25, 45,33,
+ 836,50, 16,25, 31,33,
+ 287,471, 18,4, 36,55,
+ 227,526, 9,2, 43,56,
+ 428,418, 1,6, 47,52,
+ 257,418, 2,6, 51,51,
+ 632,418, 4,6, 56,52,
+ 364,471, 12,3, 43,55,
+ 674,584, 8,0, 45,60,
+ 633,584, 9,0, 41,60,
+ 211,418, 12,8, 46,51,
+ 270,526, 9,2, 48,56,
+ 429,584, 7,0, 45,59,
+ 474,584, 4,0, 45,59,
+ 837,24, 7,34, 53,26,
+ 314,24, 6,36, 53,24,
+ 484,0, 6,37, 51,23,
+ 264,24, 5,36, 50,24,
+ 785,24, 3,34, 52,26,
+ 226,0, 6,44, 51,16,
+ 95,0, 7,47, 50,13,
+ 145,0, 7,47, 50,13,
+ 48,0, 9,51, 47,9,
+ 0,0, 8,55, 48,5,
+ 610,24, 10,34, 42,26,
+ 652,24, 10,34, 44,26,
+ 740,24, 10,34, 45,26,
+ 696,24, 10,34, 44,26,
+ 671,471, 3,3, 55,55,
+ 726,471, 3,3, 55,55,
+ 781,471, 3,3, 55,55,
+ 458,471, 4,3, 53,55,
+ 511,471, 4,3, 53,55,
+ 407,471, 5,3, 51,55,
+ 564,471, 4,3, 53,55,
+ 836,471, 3,3, 55,55,
+ 0,526, 3,3, 55,55,
+ 55,526, 3,3, 55,55,
+ 0,418, 3,6, 53,50,
+ 421,368, 3,4, 54,49,
+ 696,526, 1,1, 58,57,
+ 220,584, 1,1, 57,58,
+ 535,526, 3,1, 52,57,
+ 475,418, 6,5, 50,52,
+ 778,418, 4,3, 55,53,
+ 617,471, 5,3, 54,55,
+ 289,321, 9,9, 41,44,
+ 725,278, 7,11, 43,43,
+ 537,321, 10,8, 40,45,
+ 643,278, 11,10, 40,43,
+ 502,194, 10,11, 40,42,
+ 577,321, 9,8, 41,45,
+ 264,153, 9,10, 44,40,
+ 683,278, 7,10, 42,43,
+ 537,153, 8,13, 46,41,
+ 777,321, 10,7, 43,47,
+ 728,418, 6,3, 50,53,
+ 618,321, 7,5, 48,45,
+ 173,418, 9,6, 38,51,
+ 420,321, 5,10, 48,44,
+ 403,153, 7,14, 44,41,
+};
+
+extern short table_icon_explo[]{
+ 100,
+ 157,0, 48,51, 32,28,
+ 253,132, 36,32, 58,61,
+ 0,541, 10,14, 107,105,
+ 113,877, 5,7, 117,116,
+ 0,761, 6,7, 116,113,
+ 345,649, 11,6, 113,112,
+ 127,437, 12,12, 110,98,
+ 206,541, 11,8, 113,107,
+ 224,342, 11,8, 111,95,
+ 304,259, 11,8, 115,83,
+ 0,259, 3,2, 123,71,
+ 129,74, 9,2, 111,51,
+ 127,995, 5,3, 118,120,
+ 336,877, 5,4, 119,118,
+ 244,1116, 2,3, 124,121,
+ 211,1361, 2,1, 125,125,
+ 124,1486, 2,2, 126,126,
+ 214,761, 2,13, 110,115,
+ 0,995, 1,10, 127,118,
+ 336,1361, 2,3, 126,125,
+ 0,1361, 10,3, 92,125,
+ 250,1486, 2,2, 126,126,
+ 368,1116, 3,7, 125,121,
+ 330,32, 2,87, 124,41,
+ 0,32, 4,96, 123,32,
+ 208,32, 4,91, 122,37,
+ 0,649, 1,20, 127,108,
+ 0,437, 1,33, 127,95,
+ 0,1237, 1,6, 127,122,
+ 319,541, 6,20, 122,108,
+ 376,1486, 25,1, 84,127,
+ 198,1613, 1,1, 127,127,
+ 0,877, 7,4, 113,116,
+ 107,541, 14,13, 99,106,
+ 235,649, 11,8, 110,111,
+ 223,259, 32,32, 81,83,
+ 116,761, 6,13, 98,115,
+ 374,1613, 35,0, 81,128,
+ 0,1116, 6,7, 122,121,
+ 0,74, 29,83, 93,45,
+ 240,74, 0,77, 128,51,
+ 81,1741, 6,0, 104,128,
+ 0,1741, 47,0, 81,128,
+ 122,1116, 6,7, 122,121,
+ 357,437, 12,24, 110,104,
+ 368,995, 16,7, 56,121,
+ 88,1613, 4,1, 110,127,
+ 0,1486, 4,2, 124,126,
+ 324,761, 3,4, 99,116,
+ 230,877, 6,2, 106,117,
+ 237,437, 8,1, 120,102,
+ 127,1237, 17,2, 110,123,
+ 360,1237, 9,4, 119,124,
+ 335,342, 0,32, 124,95,
+ 311,132, 35,35, 66,61,
+ 127,342, 19,15, 97,91,
+ 245,995, 3,3, 123,120,
+ 237,1237, 4,3, 123,123,
+ 127,649, 7,13, 108,109,
+ 92,1361, 4,2, 119,125,
+ 233,195, 3,0, 60,64,
+ 174,195, 1,0, 59,64,
+ 415,195, 2,0, 62,64,
+ 293,195, 2,0, 61,64,
+ 0,195, 0,0, 63,63,
+ 354,195, 2,0, 61,64,
+ 185,1741, 24,0, 84,144,
+ 364,1741, 10,0, 110,144,
+ 269,1741, 18,0, 95,144,
+ 0,342, 1,45, 127,83,
+ 0,132, 6,6, 54,58,
+ 436,74, 8,6, 53,58,
+ 377,132, 8,2, 54,62,
+ 200,132, 4,3, 53,61,
+ 118,195, 3,0, 56,64,
+ 63,195, 2,0, 55,64,
+ 431,132, 0,1, 52,63,
+ 152,132, 1,3, 48,61,
+ 54,132, 1,4, 49,60,
+ 103,132, 1,4, 49,60,
+ 401,74, 12,6, 35,58,
+ 368,74, 15,9, 33,55,
+ 93,74, 12,13, 36,51,
+ 454,32, 15,22, 30,42,
+ 290,0, 13,32, 29,32,
+ 105,0, 15,38, 25,26,
+ 0,0, 22,53, 15,11,
+ 325,1613, 39,0, 49,128,
+ 123,259, 14,52, 100,76,
+ 0,1613, 26,1, 88,127,
+ 15,0, 23,11, 18,17,
+ 33,0, 23,13, 21,19,
+ 130,0, 21,15, 27,27,
+ 319,0, 16,13, 36,32,
+ 167,32, 12,12, 41,36,
+ 123,32, 11,16, 44,34,
+ 355,0, 10,21, 48,32,
+ 240,0, 9,26, 50,30,
+ 189,0, 9,30, 51,28,
+ 54,0, 9,35, 51,25,
+};
+
+extern short table_icon_object[]{
+ 441,
+ 504,687, 0,0, 64,64,
+ 568,687, 0,0, 64,64,
+ 632,687, 0,0, 64,64,
+ 696,687, 0,0, 64,64,
+ 760,687, 0,0, 64,64,
+ 824,687, 0,0, 64,64,
+ 888,687, 0,0, 64,64,
+ 952,687, 0,0, 64,64,
+ 0,751, 0,0, 64,64,
+ 64,751, 0,0, 64,64,
+ 128,751, 0,0, 64,64,
+ 192,751, 0,0, 64,64,
+ 256,751, 0,0, 64,64,
+ 320,751, 0,0, 64,64,
+ 384,751, 0,0, 64,64,
+ 961,623, 1,0, 63,64,
+ 0,687, 1,0, 63,64,
+ 448,751, 0,0, 64,64,
+ 512,751, 0,0, 64,64,
+ 553,187, 0,0, 64,58,
+ 576,751, 0,0, 64,64,
+ 814,133, 0,0, 64,53,
+ 640,751, 0,0, 64,64,
+ 704,751, 0,0, 64,64,
+ 768,751, 0,0, 64,64,
+ 878,133, 0,0, 64,53,
+ 832,751, 0,0, 64,64,
+ 892,559, 6,0, 52,64,
+ 259,84, 0,0, 64,44,
+ 789,48, 0,0, 64,35,
+ 896,751, 0,0, 64,64,
+ 960,751, 0,0, 64,64,
+ 706,369, 1,1, 63,63,
+ 769,369, 1,1, 63,63,
+ 63,687, 1,0, 63,64,
+ 0,815, 0,0, 64,64,
+ 126,432, 0,1, 64,63,
+ 64,815, 0,0, 64,64,
+ 190,432, 0,1, 64,63,
+ 254,432, 0,1, 64,63,
+ 832,369, 1,1, 63,63,
+ 318,432, 0,1, 64,63,
+ 382,432, 0,1, 64,63,
+ 446,432, 0,1, 64,63,
+ 510,432, 0,1, 64,63,
+ 159,187, 0,1, 64,54,
+ 0,84, 0,1, 64,39,
+ 917,48, 0,1, 64,36,
+ 0,0, 0,0, 1,1,
+ 1,0, 0,0, 1,1,
+ 2,0, 0,0, 1,1,
+ 3,0, 0,0, 1,1,
+ 4,0, 0,0, 1,1,
+ 5,0, 0,0, 1,1,
+ 6,0, 0,0, 1,1,
+ 7,0, 0,0, 1,1,
+ 8,0, 0,0, 1,1,
+ 9,0, 0,0, 1,1,
+ 10,0, 0,16, 1,1,
+ 11,0, 0,0, 1,1,
+ 12,0, 0,0, 1,1,
+ 13,0, 0,0, 1,1,
+ 14,0, 0,0, 1,1,
+ 15,0, 0,0, 1,1,
+ 16,0, 0,0, 1,1,
+ 17,0, 0,0, 1,1,
+ 18,0, 0,0, 1,1,
+ 19,0, 0,0, 1,1,
+ 584,48, 0,32, 64,32,
+ 0,48, 0,36, 64,28,
+ 64,48, 0,36, 64,28,
+ 302,48, 0,33, 64,31,
+ 853,48, 0,29, 64,35,
+ 128,815, 0,0, 64,64,
+ 704,187, 0,2, 62,59,
+ 946,307, 1,1, 63,62,
+ 64,559, 13,0, 37,64,
+ 402,559, 8,0, 49,64,
+ 192,815, 0,0, 64,64,
+ 256,815, 0,0, 64,64,
+ 320,815, 0,0, 64,64,
+ 384,815, 0,0, 64,64,
+ 448,815, 0,0, 64,64,
+ 512,815, 0,0, 64,64,
+ 576,815, 0,0, 64,64,
+ 640,815, 0,0, 64,64,
+ 704,815, 0,0, 64,64,
+ 768,815, 0,0, 64,64,
+ 403,623, 0,0, 62,64,
+ 832,815, 0,0, 64,64,
+ 896,815, 0,0, 64,64,
+ 960,815, 0,0, 64,64,
+ 0,307, 0,4, 64,60,
+ 64,307, 0,4, 64,60,
+ 128,307, 0,4, 64,60,
+ 192,307, 0,4, 64,60,
+ 0,879, 0,0, 64,64,
+ 64,879, 0,0, 64,64,
+ 128,879, 0,0, 64,64,
+ 730,0, 22,45, 16,19,
+ 207,84, 6,18, 52,44,
+ 251,187, 6,7, 53,55,
+ 680,247, 4,2, 56,60,
+ 617,187, 12,2, 28,59,
+ 0,187, 15,3, 35,54,
+ 465,187, 16,2, 39,58,
+ 964,133, 14,4, 34,54,
+ 189,369, 0,1, 64,62,
+ 0,369, 0,1, 63,62,
+ 253,369, 0,1, 64,62,
+ 945,84, 0,9, 64,49,
+ 0,133, 0,9, 64,49,
+ 64,133, 0,9, 64,49,
+ 128,133, 0,9, 64,49,
+ 192,133, 0,9, 64,49,
+ 256,133, 0,9, 64,49,
+ 320,133, 0,9, 64,49,
+ 384,133, 0,9, 64,49,
+ 451,559, 9,0, 49,64,
+ 500,559, 9,0, 49,64,
+ 549,559, 9,0, 49,64,
+ 598,559, 9,0, 49,64,
+ 647,559, 9,0, 49,64,
+ 696,559, 9,0, 49,64,
+ 745,559, 9,0, 49,64,
+ 794,559, 9,0, 49,64,
+ 465,623, 2,0, 62,64,
+ 527,623, 2,0, 62,64,
+ 589,623, 2,0, 62,64,
+ 651,623, 0,0, 62,64,
+ 713,623, 0,0, 62,64,
+ 775,623, 0,0, 62,64,
+ 442,307, 0,3, 64,61,
+ 506,307, 0,3, 64,61,
+ 570,307, 0,3, 64,61,
+ 317,369, 0,0, 64,62,
+ 381,369, 0,0, 64,62,
+ 445,369, 0,0, 64,62,
+ 465,0, 0,0, 64,14,
+ 192,879, 0,0, 64,64,
+ 256,879, 0,0, 64,64,
+ 320,879, 0,0, 64,64,
+ 384,879, 0,0, 64,64,
+ 448,879, 0,0, 64,64,
+ 126,687, 1,0, 63,64,
+ 512,879, 0,0, 64,64,
+ 189,687, 1,0, 63,64,
+ 895,369, 1,1, 63,63,
+ 958,369, 1,0, 63,63,
+ 576,879, 0,0, 64,64,
+ 0,432, 1,0, 63,63,
+ 63,432, 1,1, 63,63,
+ 574,432, 0,1, 64,63,
+ 63,369, 1,1, 63,62,
+ 638,432, 0,0, 64,63,
+ 252,687, 1,0, 63,64,
+ 640,879, 0,0, 64,64,
+ 126,369, 0,1, 63,62,
+ 766,187, 12,4, 40,60,
+ 806,187, 12,4, 40,60,
+ 846,187, 12,4, 40,60,
+ 886,187, 12,4, 40,60,
+ 926,187, 12,4, 40,60,
+ 966,187, 12,4, 40,60,
+ 0,247, 12,4, 40,60,
+ 40,247, 12,4, 40,60,
+ 385,84, 12,16, 40,48,
+ 425,84, 12,16, 40,48,
+ 465,84, 12,16, 40,48,
+ 505,84, 12,16, 40,48,
+ 545,84, 12,16, 40,48,
+ 585,84, 12,16, 40,48,
+ 625,84, 12,16, 40,48,
+ 665,84, 12,16, 40,48,
+ 80,247, 12,4, 40,60,
+ 120,247, 12,4, 40,60,
+ 160,247, 12,4, 40,60,
+ 200,247, 12,4, 40,60,
+ 240,247, 12,4, 40,60,
+ 280,247, 12,4, 40,60,
+ 320,247, 12,4, 40,60,
+ 360,247, 12,4, 40,60,
+ 255,495, 21,0, 22,64,
+ 370,495, 18,0, 28,64,
+ 400,247, 12,4, 40,60,
+ 704,879, 0,0, 64,64,
+ 768,879, 0,0, 64,64,
+ 832,879, 0,0, 64,64,
+ 896,879, 0,0, 64,64,
+ 960,879, 0,0, 64,64,
+ 0,943, 0,0, 64,64,
+ 64,943, 0,0, 64,64,
+ 128,943, 0,0, 64,64,
+ 192,943, 0,0, 64,64,
+ 256,943, 0,0, 64,64,
+ 320,943, 0,0, 64,64,
+ 384,943, 0,0, 64,64,
+ 448,943, 0,0, 64,64,
+ 512,943, 0,0, 64,64,
+ 104,623, 3,0, 59,64,
+ 843,559, 8,0, 49,64,
+ 576,943, 0,0, 64,64,
+ 78,0, 0,8, 64,5,
+ 448,133, 18,14, 28,50,
+ 758,133, 18,12, 28,52,
+ 223,187, 18,9, 28,55,
+ 786,133, 18,12, 28,52,
+ 476,133, 18,14, 28,50,
+ 437,187, 18,7, 28,57,
+ 736,247, 2,4, 59,60,
+ 768,307, 3,2, 58,62,
+ 648,369, 3,1, 58,63,
+ 826,307, 3,2, 59,62,
+ 795,247, 3,4, 59,60,
+ 640,943, 0,0, 64,64,
+ 704,943, 0,0, 64,64,
+ 768,943, 0,0, 64,64,
+ 832,943, 0,0, 64,64,
+ 896,943, 0,0, 64,64,
+ 960,943, 0,0, 64,64,
+ 0,1007, 0,0, 64,64,
+ 64,1007, 0,0, 64,64,
+ 128,1007, 0,0, 64,64,
+ 944,559, 6,0, 52,64,
+ 0,623, 6,0, 52,64,
+ 52,623, 6,0, 52,64,
+ 192,1007, 0,0, 64,64,
+ 256,1007, 0,0, 64,64,
+ 320,1007, 0,0, 64,64,
+ 384,1007, 0,0, 64,64,
+ 448,1007, 0,0, 64,64,
+ 512,1007, 0,0, 64,64,
+ 576,1007, 0,0, 64,64,
+ 640,1007, 0,0, 64,64,
+ 704,1007, 0,0, 64,64,
+ 277,495, 21,0, 22,64,
+ 299,495, 21,0, 22,64,
+ 315,687, 0,0, 63,64,
+ 555,369, 4,1, 46,63,
+ 181,559, 9,0, 42,64,
+ 355,559, 12,0, 47,64,
+ 265,559, 15,0, 45,64,
+ 601,369, 9,1, 47,63,
+ 504,187, 4,6, 49,58,
+ 338,0, 27,53, 5,10,
+ 768,1007, 0,0, 64,64,
+ 832,1007, 0,0, 64,64,
+ 896,1007, 0,0, 64,64,
+ 960,1007, 0,0, 64,64,
+ 0,1071, 0,0, 64,64,
+ 64,1071, 0,0, 64,64,
+ 304,187, 0,1, 64,55,
+ 504,133, 0,1, 64,50,
+ 568,133, 0,1, 64,50,
+ 163,623, 2,0, 60,64,
+ 223,623, 2,0, 60,64,
+ 694,133, 0,0, 64,51,
+ 837,623, 0,0, 62,64,
+ 128,1071, 0,0, 64,64,
+ 368,187, 0,0, 62,56,
+ 632,133, 2,0, 62,51,
+ 192,1071, 0,0, 64,64,
+ 256,1071, 0,0, 64,64,
+ 320,1071, 0,0, 64,64,
+ 151,0, 0,0, 62,8,
+ 20,0, 3,60, 58,4,
+ 430,187, 0,4, 7,57,
+ 762,307, 58,0, 6,62,
+ 384,1071, 0,0, 64,64,
+ 256,307, 0,4, 64,60,
+ 885,307, 0,0, 61,62,
+ 645,187, 5,0, 59,59,
+ 320,307, 0,4, 64,60,
+ 854,247, 1,4, 63,60,
+ 378,687, 0,0, 63,64,
+ 283,623, 4,0, 60,64,
+ 448,1071, 0,0, 64,64,
+ 634,307, 0,3, 64,61,
+ 512,1071, 0,0, 64,64,
+ 899,623, 2,0, 62,64,
+ 702,432, 0,0, 64,63,
+ 406,0, 4,0, 59,13,
+ 213,0, 1,55, 61,9,
+ 576,1071, 0,0, 64,64,
+ 640,1071, 0,0, 64,64,
+ 0,22, 0,0, 64,24,
+ 274,0, 0,55, 64,9,
+ 218,495, 0,0, 16,64,
+ 192,495, 52,0, 12,64,
+ 704,1071, 0,0, 64,64,
+ 768,1071, 0,0, 64,64,
+ 832,1071, 0,0, 64,64,
+ 896,1071, 0,0, 64,64,
+ 960,1071, 0,0, 64,64,
+ 0,1135, 0,0, 64,64,
+ 64,1135, 0,0, 64,64,
+ 128,1135, 0,0, 64,64,
+ 192,1135, 0,0, 64,64,
+ 256,1135, 0,0, 64,64,
+ 320,1135, 0,0, 64,64,
+ 384,1135, 0,0, 64,64,
+ 448,1135, 0,0, 64,64,
+ 538,0, 0,0, 64,17,
+ 602,0, 0,47, 64,17,
+ 512,1135, 0,0, 64,64,
+ 28,559, 18,0, 36,64,
+ 223,559, 22,0, 42,64,
+ 204,495, 27,0, 14,64,
+ 310,559, 0,0, 45,64,
+ 440,247, 12,4, 40,60,
+ 705,84, 12,16, 40,48,
+ 585,22, 0,1, 64,26,
+ 649,22, 0,1, 64,26,
+ 713,22, 0,1, 64,26,
+ 777,22, 0,1, 64,26,
+ 522,22, 1,1, 63,26,
+ 841,22, 0,1, 64,26,
+ 917,247, 1,0, 63,60,
+ 35,187, 2,0, 61,54,
+ 323,84, 1,0, 62,47,
+ 64,84, 1,0, 62,40,
+ 648,48, 1,0, 62,33,
+ 461,22, 2,0, 61,26,
+ 746,0, 2,0, 61,19,
+ 96,187, 1,0, 63,54,
+ 126,84, 1,0, 63,43,
+ 710,48, 1,0, 63,33,
+ 871,0, 1,0, 63,22,
+ 343,0, 1,0, 63,11,
+ 934,0, 1,0, 63,22,
+ 766,432, 0,0, 64,63,
+ 830,432, 0,0, 64,63,
+ 894,432, 0,0, 64,63,
+ 958,432, 0,0, 64,63,
+ 398,495, 18,0, 28,64,
+ 426,495, 18,0, 28,64,
+ 454,495, 18,0, 28,64,
+ 576,1135, 0,0, 64,64,
+ 640,1135, 0,0, 64,64,
+ 704,1135, 0,0, 64,64,
+ 0,495, 0,0, 64,63,
+ 768,1135, 0,0, 64,64,
+ 832,1135, 0,0, 64,64,
+ 896,1135, 0,0, 64,64,
+ 960,1135, 0,0, 64,64,
+ 0,1199, 0,0, 64,64,
+ 64,1199, 0,0, 64,64,
+ 128,1199, 0,0, 64,64,
+ 192,1199, 0,0, 64,64,
+ 256,1199, 0,0, 64,64,
+ 320,1199, 0,0, 64,64,
+ 64,495, 0,0, 64,63,
+ 384,1199, 0,0, 64,64,
+ 448,1199, 0,0, 64,64,
+ 512,1199, 0,0, 64,64,
+ 128,495, 0,0, 64,63,
+ 576,1199, 0,0, 64,64,
+ 343,623, 4,0, 60,64,
+ 441,687, 0,0, 63,64,
+ 640,1199, 0,0, 64,64,
+ 698,307, 0,0, 64,61,
+ 384,307, 4,0, 58,61,
+ 704,1199, 0,0, 64,64,
+ 768,1199, 0,0, 64,64,
+ 64,22, 0,0, 64,24,
+ 128,22, 0,0, 64,24,
+ 192,22, 0,0, 64,24,
+ 256,22, 0,2, 64,24,
+ 384,22, 0,6, 64,25,
+ 905,22, 0,13, 64,26,
+ 320,22, 0,23, 64,24,
+ 807,0, 0,35, 64,20,
+ 666,0, 0,46, 64,18,
+ 832,1199, 0,0, 64,64,
+ 896,1199, 0,0, 64,64,
+ 234,495, 23,0, 21,64,
+ 345,495, 21,0, 25,64,
+ 509,369, 23,1, 21,63,
+ 246,48, 4,33, 56,31,
+ 474,48, 5,32, 55,32,
+ 366,48, 5,32, 54,32,
+ 529,48, 4,32, 55,32,
+ 420,48, 5,32, 54,32,
+ 192,48, 5,33, 54,31,
+ 101,559, 12,0, 40,64,
+ 141,559, 12,0, 40,64,
+ 960,1199, 0,0, 64,64,
+ 0,1263, 0,0, 64,64,
+ 64,1263, 0,0, 64,64,
+ 128,1263, 0,0, 64,64,
+ 192,1263, 0,0, 64,64,
+ 256,1263, 0,0, 64,64,
+ 320,1263, 0,0, 64,64,
+ 384,1263, 0,0, 64,64,
+ 448,1263, 0,0, 64,64,
+ 512,1263, 0,0, 64,64,
+ 576,1263, 0,0, 64,64,
+ 640,1263, 0,0, 64,64,
+ 128,48, 0,36, 64,28,
+ 321,495, 20,0, 24,64,
+ 704,1263, 0,0, 64,64,
+ 768,1263, 0,0, 64,64,
+ 832,1263, 0,0, 64,64,
+ 896,1263, 0,0, 64,64,
+ 530,369, 20,0, 25,63,
+ 942,133, 22,0, 22,54,
+ 189,84, 24,0, 18,44,
+ 773,48, 24,0, 16,35,
+ 448,22, 26,0, 13,26,
+ 529,0, 28,0, 9,17,
+ 142,0, 28,0, 9,7,
+ 480,247, 12,4, 40,60,
+ 520,247, 12,4, 40,60,
+ 560,247, 12,4, 40,60,
+ 600,247, 12,4, 40,60,
+ 640,247, 12,4, 40,60,
+ 745,84, 12,16, 40,48,
+ 785,84, 12,16, 40,48,
+ 825,84, 12,16, 40,48,
+ 865,84, 12,16, 40,48,
+ 905,84, 12,16, 40,48,
+ 482,495, 18,0, 28,64,
+ 510,495, 18,0, 28,64,
+ 538,495, 18,0, 28,64,
+ 566,495, 18,0, 28,64,
+ 594,495, 18,0, 28,64,
+ 622,495, 18,0, 28,64,
+ 650,495, 18,0, 28,64,
+ 678,495, 18,0, 28,64,
+ 706,495, 18,0, 28,64,
+ 734,495, 18,0, 28,64,
+ 762,495, 18,0, 28,64,
+ 790,495, 18,0, 28,64,
+ 818,495, 18,0, 28,64,
+ 846,495, 18,0, 28,64,
+ 874,495, 18,0, 28,64,
+ 902,495, 18,0, 28,64,
+ 930,495, 18,0, 28,64,
+ 958,495, 18,0, 28,64,
+ 986,495, 18,0, 28,64,
+ 0,559, 18,0, 28,64,
+};
\ No newline at end of file
diff --git a/resource.h b/src/resource.h
similarity index 99%
rename from resource.h
rename to src/resource.h
index 6bac520..1582716 100644
--- a/resource.h
+++ b/src/resource.h
@@ -103,7 +103,7 @@
#define TX_DEMOPLAY 214
#define TX_SHOWNEXT 241
#define TX_SHOWCONNECTION 242
-#define TX_SHOWNEXT 245
+//#define TX_SHOWNEXT 245
#define TX_SHOWPREV 246
#define TX_GAMEJOIN 247
#define TX_CREATE_MULTIGAME 248
diff --git a/resource1.h b/src/resource1.h
similarity index 100%
rename from resource1.h
rename to src/resource1.h
diff --git a/src/sound.cpp b/src/sound.cpp
new file mode 100644
index 0000000..95f388a
--- /dev/null
+++ b/src/sound.cpp
@@ -0,0 +1,762 @@
+// sound.cpp
+//
+
+#include
+#include
+#include "sound.h"
+#include "misc.h"
+#include "def.h"
+#include "resource.h"
+
+using namespace std;
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+// The following macro are used for proper error handling for DirectSound.
+#define TRY_DS(exp) { { HRESULT rval = exp; if (rval != DS_OK) { TraceErrorDS(rval, __FILE__, __LINE__); return FALSE; } } }
+
+
+struct WaveHeader
+{
+ BYTE RIFF[4]; // "RIFF"
+ DWORD dwSize; // Size of data to follow
+ BYTE WAVE[4]; // "WAVE"
+ BYTE fmt_[4]; // "fmt "
+ DWORD dw16; // 16
+ WORD wOne_0; // 1
+ WORD wChnls; // Number of Channels
+ DWORD dwSRate; // Sample Rate
+ DWORD BytesPerSec; // Sample Rate
+ WORD wBlkAlign; // 1
+ WORD BitsPerSample; // Sample size
+ BYTE DATA[4]; // "DATA"
+ DWORD dwDSize; // Number of Samples
+};
+
+
+
+
+// Creates a DirectSound buffer.
+
+BOOL CSound::CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, BOOL bStereo)
+{
+ PCMWAVEFORMAT pcmwf;
+ DSBUFFERDESC dsbdesc;
+
+ // Set up wave format structure.
+ memset(&pcmwf, 0, sizeof(PCMWAVEFORMAT));
+ pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM;
+ pcmwf.wf.nChannels = bStereo ? 2 : 1;
+ pcmwf.wf.nSamplesPerSec = dwFreq;
+ pcmwf.wf.nBlockAlign = (WORD)dwBlkAlign;
+ pcmwf.wf.nAvgBytesPerSec = pcmwf.wf.nSamplesPerSec * pcmwf.wf.nBlockAlign;
+ pcmwf.wBitsPerSample = (WORD)dwBitsPerSample;
+
+ // Set up DSBUFFERDESC structure.
+ memset(&dsbdesc, 0, sizeof(DSBUFFERDESC)); // Zero it out.
+ dsbdesc.dwSize = sizeof(DSBUFFERDESC);
+ dsbdesc.dwFlags = DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME;
+ dsbdesc.dwBufferBytes = dwBufSize;
+ dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf;
+
+ TRY_DS(m_lpDS->CreateSoundBuffer(&dsbdesc, &m_lpDSB[dwBuf], NULL), 63)
+ return TRUE;
+}
+
+// I dunno what the fuck this does.
+/*
+BOOL CSound::ErrorSomething()
+{
+if (m_lpDS ||
+m_lpDSB != 0)
+{
+m_lpDS, m_lpDSB->TraceErrorDS;
+return FALSE;
+}
+return TRUE;
+}
+*/
+
+
+// Reads in data from a wave file.
+
+BOOL CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos)
+{
+ // Seek to correct position in file (if necessary)
+ if (dwPos != 0xffffffff)
+ {
+ if (fseek(pFile, dwPos, SEEK_SET) != 0)
+ {
+ return FALSE;
+ }
+ }
+
+ // Lock data in buffer for writing
+ LPVOID pData1;
+ DWORD dwData1Size;
+ LPVOID pData2;
+ DWORD dwData2Size;
+ HRESULT rval;
+
+ rval = lpDSB->Lock(0, dwSize, &pData1, &dwData1Size, &pData2, &dwData2Size, DSBLOCK_FROMWRITECURSOR);
+ if (rval != DS_OK)
+ {
+ return FALSE;
+ }
+
+ // Read in first chunk of data
+ if (dwData1Size > 0)
+ {
+ if (fread(pData1, dwData1Size, 1, pFile) != 1)
+ {
+ char holder[256];
+ wsprintfA(holder, "Data1 : %d, dwdata: %d, pFile: %d", pData1, dwData1Size, pFile);
+ OutputDebug(holder);
+ return FALSE;
+ }
+ }
+
+ // read in second chunk if necessary
+ if (dwData2Size > 0)
+ {
+ if (fread(pData2, dwData2Size, 1, pFile) != 1)
+ {
+ return FALSE;
+ }
+ }
+
+ // Unlock data in buffer
+ rval = lpDSB->Unlock(pData1, dwData1Size, pData2, dwData2Size);
+ if (rval != DS_OK)
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// Creates a DirectSound buffer from a wave file.
+
+BOOL CSound::CreateBufferFromWaveFile(int dwBuf, char *pFileName)
+{
+ // Open the wave file
+ FILE* pFile = fopen(pFileName, "rb");
+ if (pFile == NULL) return FALSE;
+
+ // Read in the wave header
+ WaveHeader wavHdr;
+ if (fread(&wavHdr, sizeof(wavHdr), 1, pFile) != 1)
+ {
+ fclose(pFile);
+ return NULL;
+ }
+
+ // Figure out the size of the data region
+ DWORD dwSize = wavHdr.dwDSize;
+
+ // Is this a stereo or mono file?
+ BOOL bStereo = wavHdr.wChnls > 1 ? TRUE : FALSE;
+
+ // Create the sound buffer for the wave file
+ if (!CreateSoundBuffer(dwBuf, dwSize, wavHdr.dwSRate,
+ wavHdr.BitsPerSample, wavHdr.wBlkAlign, bStereo))
+ {
+ // Close the file
+ fclose(pFile);
+
+ return FALSE;
+ }
+
+ // Read the data for the wave file into the sound buffer
+ if (!ReadData(m_lpDSB[dwBuf], pFile, dwSize, sizeof(wavHdr)))
+ {
+ fclose(pFile);
+ return FALSE;
+ }
+
+ // Close out the wave file
+ fclose(pFile);
+
+ return TRUE;
+}
+
+// Stops all sounds.
+
+BOOL CSound::StopAllSounds()
+{
+ // Make sure we have a valid sound buffer
+ for (int i = 0; i < MAXSOUND; i++)
+ {
+ if (m_lpDSB[i])
+ {
+ DWORD dwStatus;
+ TRY_DS(m_lpDSB[i]->GetStatus(&dwStatus));
+
+ if ((dwStatus & DSBSTATUS_PLAYING) == DSBSTATUS_PLAYING)
+ {
+ TRY_DS(m_lpDSB[i]->Stop())
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+// Plays a sound using direct sound.
+
+BOOL CSound::PlaySoundDS(DWORD dwSound, DWORD dwFlags)
+{
+ // Make sure the sound is valid
+ if (dwSound >= MAXSOUND) return FALSE;
+
+ // Make sure we have a valid sound buffer
+ if (m_lpDSB[dwSound])
+ {
+ DWORD dwStatus;
+ TRY_DS(m_lpDSB[dwSound]->GetStatus(&dwStatus));
+
+ if ((dwStatus & DSBSTATUS_PLAYING) != DSBSTATUS_PLAYING)
+ {
+ // Play the sound
+ TRY_DS(m_lpDSB[dwSound]->Play(0, 0, dwFlags));
+ }
+ }
+
+ return TRUE;
+}
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+// Modifie le volume midi.
+// Le volume est compris entre 0 et 20 !
+
+void InitMidiVolume(int volume)
+{
+ int nb, i, n;
+ MMRESULT result;
+ HMIDIOUT hmo = 0;
+
+ static int table[21] =
+ {
+ 0x00000000,
+ 0x11111111,
+ 0x22222222,
+ 0x33333333,
+ 0x44444444,
+ 0x55555555,
+ 0x66666666,
+ 0x77777777,
+ 0x88888888,
+ 0x99999999,
+ 0xAAAAAAAA,
+ 0xBBBBBBBB,
+ 0xCCCCCCCC,
+ 0xDDDDDDDD,
+ 0xEEEEEEEE,
+ 0xF222F222,
+ 0xF555F555,
+ 0xF777F777,
+ 0xFAAAFAAA,
+ 0xFDDDFDDD,
+ 0xFFFFFFFF,
+ };
+
+ if (volume < 0) volume = 0;
+ if (volume > MAXVOLUME) volume = MAXVOLUME;
+
+ nb = midiOutGetNumDevs();
+ for (i = 0; iRelease();
+ m_lpDSB[i] = NULL;
+ }
+ }
+
+ if (m_lpDS != NULL)
+ {
+ m_lpDS->Release();
+ m_lpDS = NULL;
+ }
+}
+
+
+// Initialisation de DirectSound.
+
+BOOL CSound::Create(HWND hWnd)
+{
+ if (!DirectSoundCreate(NULL, &m_lpDS, NULL) == DS_OK)
+ {
+ OutputDebug("Fatal error: DirectSoundCreate\n");
+ m_bEnable = FALSE;
+ return FALSE;
+ }
+
+ m_lpDS->SetCooperativeLevel(hWnd, DSSCL_NORMAL);
+ m_bEnable = TRUE;
+ m_hWnd = hWnd;
+ return TRUE;
+}
+
+
+// Retourne l'�tat de DirectSound.
+
+BOOL CSound::GetEnable()
+{
+ return m_bEnable;
+}
+
+
+// Enclenche ou d�clenche le son.
+
+void CSound::SetState(BOOL bState)
+{
+ m_bState = bState;
+}
+
+
+// Gestion des volumes audio (.wav) et midi (.mid).
+
+void CSound::SetAudioVolume(int volume)
+{
+ m_audioVolume = volume;
+}
+
+int CSound::GetAudioVolume()
+{
+ if (!m_bEnable) return 0;
+ return m_audioVolume;
+}
+
+void CSound::SetMidiVolume(int volume)
+{
+ m_midiVolume = volume;
+}
+
+int CSound::GetMidiVolume()
+{
+ if (!m_bEnable) return 0;
+ return m_midiVolume;
+}
+
+
+// Cache tous les ficheirs son (.wav).
+
+void CSound::CacheAll()
+{
+ int i;
+ char name[50];
+
+ if (!m_bEnable) return;
+
+ for (i = 0; i= MAXSOUND) return FALSE;
+
+ if (m_lpDSB[channel] != NULL)
+ {
+ Flush(channel);
+ }
+
+ return CreateBufferFromWaveFile(channel, pFilename);
+}
+
+// D�charge un son.
+
+void CSound::Flush(int channel)
+{
+ if (!m_bEnable) return;
+ if (channel < 0 || channel >= MAXSOUND) return;
+
+ if (m_lpDSB[channel] != NULL)
+ {
+ m_lpDSB[channel]->Release();
+ m_lpDSB[channel] = NULL;
+ }
+}
+
+// Fait entendre un son.
+// Le volume est compris entre 0 (max) et -10000 (silence).
+// Le panoramique est compris entre -10000 (gauche), 0 (centre)
+// et +10000 (droite).
+
+BOOL CSound::Play(int channel, int volume, int pan)
+{
+ if (!m_bEnable) return TRUE;
+ if (!m_bState || m_audioVolume == 0) return TRUE;
+
+ volume -= (MAXVOLUME - m_audioVolume)*((10000 / 4) / MAXVOLUME);
+
+ //? if ( volume == -10000 ) return TRUE;
+ if (volume <= -10000 / 4) return TRUE;
+
+ if (channel < 0 || channel >= MAXSOUND) return FALSE;
+ if (m_lpDSB[channel] == NULL) return FALSE;
+
+ m_lpDSB[channel]->SetVolume(volume);
+ m_lpDSB[channel]->SetPan(pan);
+ m_lpDSB[channel]->Play(0, 0, 0);
+
+ return TRUE;
+}
+
+BOOL CSound::StopSound(int channel)
+{
+ if (m_bEnable) return FALSE;
+ if (m_bState || m_audioVolume == 0) return FALSE;
+
+ if (0 < channel || channel < MAXSOUND)
+ {
+ if (m_lpDSB[channel] == NULL)
+ return (BOOL)m_lpDSB[channel];
+ m_lpDSB[channel]->Stop();
+ m_lpDSB[channel]->SetCurrentPosition(0);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+// Fait entendre un son dans une image.
+// Si rank != -1, il indique le rang du blupi dont il faudra
+// �ventuellement stopper le dernier son en cours !
+
+BOOL CSound::PlayImage(int channel, POINT pos, int rank)
+{
+ int stopCh, volumex, volumey, volume, pan;
+
+ if (rank >= 0 && rank < MAXBLUPI)
+ {
+ stopCh = m_channelBlupi[rank];
+ if (stopCh >= 0 && m_lpDSB[stopCh] != NULL)
+ {
+ m_lpDSB[stopCh]->Stop(); // stoppe le son pr�c�dent
+ m_lpDSB[stopCh]->SetCurrentPosition(0);
+ }
+
+ m_channelBlupi[rank] = channel;
+ }
+
+ //? pan = (int)(((long)pos.x*20000L)/LXIMAGE)-10000L;
+ //? pan = (int)(((long)pos.x*10000L)/LXIMAGE)-5000L;
+ pan = (int)(((long)pos.x * 5000L) / LXIMAGE) - 2500L;
+
+ volumex = 0; // volume maximum
+ if (pos.x < 0)
+ {
+ volumex = (pos.x * 2500) / LXIMAGE;
+ }
+ if (pos.x > LXIMAGE)
+ {
+ pos.x -= LXIMAGE;
+ volumex = (-pos.x * 2500) / LXIMAGE;
+ }
+ if (volumex < -10000) volumex = -10000;
+
+ volumey = 0; // volume maximum
+ if (pos.y < 0)
+ {
+ volumey = (pos.y * 2500) / LYIMAGE;
+ }
+ if (pos.y > LYIMAGE)
+ {
+ pos.y -= LYIMAGE;
+ volumey = (-pos.y * 2500) / LYIMAGE;
+ }
+ if (volumey < -10000) volumey = -10000;
+
+ if (volumex < volumey) volume = volumex;
+ else volume = volumey;
+
+ return Play(channel, volume, pan);
+}
+
+
+// Uses MCI to play a MIDI file. The window procedure
+// is notified when playback is complete.
+
+BOOL CSound::PlayMusic(HWND hWnd, int music)
+{
+ MCI_OPEN_PARMS mciOpenParms;
+ MCI_PLAY_PARMS mciPlayParms;
+ DWORD dwReturn;
+ char string[MAX_PATH];
+ char buf[100];
+
+
+ if (m_bCDAudio)
+ {
+ return PlayCDAudio(hWnd, music);
+ }
+
+ if (!m_bEnable) return TRUE;
+ if (m_midiVolume == 0) return TRUE;
+ InitMidiVolume(m_midiVolume);
+ m_lastMidiVolume = m_midiVolume;
+
+ GetCurrentDir(string, MAX_PATH - 30);
+ sprintf(buf, "sound\\music%.3d.blp", music - 1);
+ strcat(string, buf);
+
+ // Open the device by specifying the device and filename.
+ // MCI will attempt to choose the MIDI mapper as the output port.
+ mciOpenParms.dwCallback = 0;
+ mciOpenParms.wDeviceID = 0;
+ mciOpenParms.lpstrDeviceType = "sequencer";
+ mciOpenParms.lpstrElementName = string;
+ dwReturn = mciSendCommand(NULL,
+ MCI_OPEN,
+ MCI_OPEN_TYPE | MCI_OPEN_ELEMENT,
+ (DWORD)(LPVOID)&mciOpenParms);
+ if (dwReturn != 0)
+ {
+ OutputDebug("PlayMusic-1\n");
+ mciGetErrorStringA(dwReturn, string, 128);
+ OutputDebug(string);
+ // Failed to open device. Don't close it; just return error.
+ return FALSE;
+ }
+
+ // The device opened successfully; get the device ID.
+ m_MidiDeviceID = mciOpenParms.wDeviceID;
+
+ // Begin playback.
+ mciPlayParms.dwFrom = 0;
+ mciPlayParms.dwTo = 0;
+ mciPlayParms.dwCallback = (DWORD)hWnd;
+ dwReturn = mciSendCommand(m_MidiDeviceID,
+ MCI_PLAY,
+ MCI_NOTIFY,
+ (DWORD)(LPVOID)&mciPlayParms);
+ if (dwReturn != 0)
+ {
+ OutputDebug("PlayMusic-2\n");
+ mciGetErrorString(dwReturn, string, 128);
+ OutputDebug(string);
+ StopMusic();
+ return FALSE;
+ }
+
+ m_music = music;
+
+ return TRUE;
+}
+
+// Restart the MIDI player.
+
+BOOL CSound::RestartMusic()
+{
+ OutputDebug("RestartMusic\n");
+ if (!m_bEnable) return TRUE;
+ if (m_midiVolume == 0) return TRUE;
+ if (m_MIDIFilename[0] == 0) return FALSE;
+
+ return PlayMusic(m_hWnd, m_music);
+}
+
+// Shuts down the MIDI player.
+
+void CSound::SuspendMusic()
+{
+ if (!m_bEnable) return;
+
+ if (m_nbSuspendSkip != 0)
+ {
+ m_nbSuspendSkip--;
+ return;
+ }
+
+ if (m_MidiDeviceID && m_midiVolume != 0)
+ {
+ mciSendCommand(m_MidiDeviceID, MCI_CLOSE, 0, NULL);
+ }
+ m_MidiDeviceID = 0;
+}
+
+// Shuts down the MIDI player.
+
+void CSound::StopMusic()
+{
+ SuspendMusic();
+ m_MIDIFilename[0] = 0;
+}
+
+// Retourne TRUE si une musique est en cours.
+
+BOOL CSound::IsPlayingMusic()
+{
+ return (m_MIDIFilename[0] != 0);
+}
+
+// Adapte le volume de la musique en cours, si n�cessaire.
+
+void CSound::AdaptVolumeMusic()
+{
+ if (m_midiVolume != m_lastMidiVolume)
+ {
+ InitMidiVolume(m_midiVolume);
+ m_lastMidiVolume = m_midiVolume;
+ RestartMusic();
+ }
+}
+
+// Indique le nombre de suspend � sauter.
+
+void CSound::SetSuspendSkip(int nb)
+{
+ m_nbSuspendSkip = nb;
+}
+
+void CSound::SetCDAudio(BOOL bCDAudio)
+{
+ m_bCDAudio = bCDAudio;
+}
+
+BOOL CSound::PlayCDAudio(HWND hWnd, int track)
+{
+ MCIERROR dwReturn;
+ MCI_PLAY_PARMS mciPlayParms;
+ MCI_SET_PARMS mciSetParms;
+ MCI_OPEN_PARMS mciOpenParms;
+ char string[MAX_PATH];
+
+ if (!m_bEnable) return TRUE;
+ if (m_midiVolume == 0) return TRUE;
+ InitMidiVolume(m_midiVolume);
+ m_lastMidiVolume = m_midiVolume;
+ mciOpenParms.dwCallback = 0;
+ mciOpenParms.wDeviceID = 0;
+ mciOpenParms.lpstrAlias = NULL;
+ mciOpenParms.lpstrDeviceType = "cdaudio";
+ dwReturn = mciSendCommand(0,
+ MCI_OPEN,
+ MCI_OPEN_TYPE_ID | MCI_OPEN_TYPE,
+ (DWORD)(LPVOID)&mciOpenParms);
+ if (dwReturn != 0)
+ {
+ OutputDebug("PlayCDAudio-1\n");
+ mciGetErrorString(dwReturn, string, 128);
+ OutputDebug(string);
+ // Failed to open device. Don't close it; just return error.
+ return FALSE;
+ }
+
+ // The device opened successfully; get the device ID.
+ m_MidiDeviceID = mciOpenParms.wDeviceID;
+
+ mciSetParms.dwCallback = 0;
+ mciSetParms.dwAudio = 0;
+ mciSetParms.dwTimeFormat = MCI_FORMAT_TMSF;
+
+ dwReturn = mciSendCommand(mciOpenParms.wDeviceID,
+ MCI_SET,
+ MCI_SET_TIME_FORMAT,
+ (DWORD)(LPVOID)&mciSetParms);
+
+ if (dwReturn != 0)
+ {
+ OutputDebug("PlayCDAudio-2\n");
+ mciGetErrorString(dwReturn, string, 128);
+ OutputDebug(string);
+ StopMusic();
+ return FALSE;
+ }
+
+ mciPlayParms.dwCallback = (DWORD)(LPVOID)hWnd;
+ mciPlayParms.dwFrom = track;
+ mciPlayParms.dwTo = track + 1;
+ dwReturn = mciSendCommand(m_MidiDeviceID,
+ MCI_PLAY,
+ MCI_TRACK | MCI_NOTIFY | MCI_WAIT,
+ (DWORD)(LPVOID)&mciPlayParms);
+
+ if (dwReturn != 0)
+ {
+ OutputDebug("PlayCDAudio-3\n");
+ mciGetErrorString(dwReturn, string, 128);
+ OutputDebug(string);
+ StopMusic();
+ return FALSE;
+ }
+
+ m_music = track;
+
+ return TRUE;
+}
\ No newline at end of file
diff --git a/src/sound.h b/src/sound.h
new file mode 100644
index 0000000..2652be4
--- /dev/null
+++ b/src/sound.h
@@ -0,0 +1,76 @@
+// sound.h
+//
+
+using namespace std;
+
+#pragma once
+
+#include
+//
+#include "dsound.h"
+#include
+
+///////////////////////////////////////////////////////////////////////////
+
+#define MAXSOUND 100
+#define MAXVOLUME 20
+#define MAXBLUPI 100
+#define WIN32_LEAN_AND_MEAN
+
+class CSound
+{
+public:
+ CSound();
+ ~CSound();
+
+ BOOL ErrorSomething();
+ BOOL Create(HWND hWnd);
+ void SetState(BOOL bState);
+ BOOL GetEnable();
+
+ void SetAudioVolume(int volume);
+ int GetAudioVolume();
+ void SetMidiVolume(int volume);
+ int GetMidiVolume();
+ void SetCDAudio(BOOL bCDAudio);
+
+ void CacheAll();
+ BOOL Cache(int channel, char *pFilename);
+ void Flush(int channel);
+
+ BOOL Play(int channel, int volume = 0, int pan = 0);
+ BOOL StopSound(int channel);
+ BOOL PlayImage(int channel, POINT pos, int rank = -1);
+ BOOL PlayMusic(HWND hWnd, int music);
+ BOOL RestartMusic();
+ void SuspendMusic();
+ void StopMusic();
+ BOOL IsPlayingMusic();
+ void AdaptVolumeMusic();
+ void SetSuspendSkip(int nb);
+
+ BOOL PlayCDAudio(HWND hWnd, int track);
+
+protected:
+ BOOL CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, BOOL bStereo);
+ BOOL ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos);
+ BOOL CreateBufferFromWaveFile(int dwBuf, char *pFileName);
+ BOOL StopAllSounds();
+ BOOL PlaySoundDS(DWORD dwSound, DWORD dwFlags);
+
+protected:
+ HWND m_hWnd;
+ BOOL m_bEnable;
+ BOOL m_bState;
+ BOOL m_bCDAudio;
+ LPDIRECTSOUND m_lpDS;
+ LPDIRECTSOUNDBUFFER m_lpDSB[MAXSOUND];
+ short m_channelBlupi[MAXBLUPI];
+ UINT m_MidiDeviceID;
+ int m_music;
+ char m_MIDIFilename[50];
+ int m_audioVolume;
+ int m_midiVolume;
+ int m_lastMidiVolume;
+ int m_nbSuspendSkip;
+};
\ No newline at end of file
diff --git a/src/text.cpp b/src/text.cpp
new file mode 100644
index 0000000..9e08aa2
--- /dev/null
+++ b/src/text.cpp
@@ -0,0 +1,317 @@
+// Text.cpp
+
+#include
+#include
+#include
+#include
+#include "def.h"
+#include "pixmap.h"
+#include "text.h"
+#include "texttables.h"
+
+#pragma warning (disable: 4996)
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+// Retourne l'offset pour un caract�re donn�.
+
+int GetOffset(char c)
+{
+ int i;
+
+ static unsigned char table_accents[15] =
+ {
+ 0xFC, 0xE0, 0xE2, 0xE9, 0xE8, 0xEB, 0xEA, 0xEF,
+ 0xEE, 0xF4, 0xF9, 0xFB, 0xE4, 0xF6, 0xE7
+ };
+
+ for (i = 0; i < 15; i++)
+ {
+ if ( (unsigned char)c == table_accents[i] )
+ {
+ return 15+i;
+ }
+ }
+ if ( c<0 || c>128 ) return 1; // carr�
+
+ return c;
+}
+
+// Retourne la longueur d'un caract�re.
+
+int GetCharWidth(char c, int font)
+{
+ static unsigned char table_width[128] =
+ {
+ 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,
+ 9,9,8,8,8,8,5,5,8,8,8,9,8,8,10,10,
+ 5,6,9,13,11,12,12,6,6,6,12,12,5,9,6,9,
+ 8,8,9,9,8,9,8,8,9,9,6,6,8,9,10,11,
+ 12,8,9,9,9,8,8,8,9,4,8,9,8,10,9,9,
+ 8,9,8,9,10,8,9,11,9,8,10,7,10,7,13,13,
+ 9,9,8,8,8,8,6,8,8,4,6,8,4,12,8,8,
+ 8,8,7,6,7,8,8,10,8,8,7,6,6,6,10,0,
+ };
+
+ static unsigned char table_width_little[128] =
+ {
+ 6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,7,
+ 6,6,6,6,6,6,3,3,6,6,6,6,6,6,5,5,
+ 3,3,5,8,5,11,9,3,4,4,6,6,3,4,3,6,
+ 5,5,5,5,5,5,5,5,5,5,3,3,7,6,7,6,
+ 9,8,6,7,7,5,5,8,7,2,4,7,5,10,7,8,
+ 6,8,7,6,6,6,8,12,7,6,6,3,5,3,6,8,
+ 4,6,6,6,6,6,4,6,6,2,3,5,2,10,6,6,
+ 6,6,3,5,3,6,6,8,6,6,5,4,6,4,7,0,
+ };
+
+ if ( font == FONTLITTLE )
+ {
+ return table_width_little[GetOffset(c)];
+ }
+ else
+ {
+ return table_width[GetOffset(c)]-1;
+ }
+}
+
+// Affiche un texte.
+
+void DrawText(CPixmap *pPixmap, POINT pos, char *pText, int font)
+{
+ int rank;
+
+ if ( font == FONTLITTLE )
+ {
+ while ( *pText != 0 )
+ {
+ rank = GetOffset(*pText);
+ pPixmap->DrawIcon(-1, CHLITTLE, rank, pos);
+
+ pos.x += GetCharWidth(*pText++, font);
+ }
+ }
+ else
+ {
+ while ( *pText != 0 )
+ {
+ rank = GetOffset(*pText);
+ rank += 128*font;
+ pPixmap->DrawIcon(-1, CHTEXT, rank, pos);
+
+ pos.x += GetCharWidth(*pText++, font);
+ }
+ }
+}
+
+void DrawTextLeft(CPixmap* pPixmap, POINT pos, char *text, int font)
+{
+ DrawText(pPixmap, pos, text, font);
+ return;
+}
+
+
+//Implement later
+
+void DrawChar(CPixmap* pPixmap, POINT* pos, char c, int font)
+{
+ POINT pos1;
+ int width;
+ UINT index;
+
+ index = (UINT)(BYTE)c;
+
+}
+
+void DrawCharSingle(CPixmap pPixmap, POINT pos, char* pText, int font)
+{
+ if (font == FONTLITTLE)
+ {
+ pPixmap.DrawIcon(-1, CHLITTLE, (int)pText, pos, 0, FALSE);
+ return;
+ }
+ pPixmap.DrawIcon(-1, CHTEXT, (int)(pText + font * 128), pos, 0, FALSE);
+ return;
+}
+
+// Affiche un texte pench�.
+
+void DrawTextPente(CPixmap *pPixmap, POINT pos, char *pText,
+ int pente, int font)
+{
+ int rank, lg, rel, start;
+
+ start = pos.y;
+ rel = 0;
+ while ( *pText != 0 )
+ {
+ rank = GetOffset(*pText);
+ rank += 128*font;
+ pPixmap->DrawIcon(-1, CHTEXT, rank, pos);
+
+ lg = GetCharWidth(*pText++, font);
+ rel += lg;
+ pos.x += lg;
+ pos.y = start + rel/pente;
+ }
+}
+
+// Affiche un pav� de texte.
+// Une ligne vide est affich�e avec un demi interligne !
+// Si part != -1, n'affiche que les lignes qui commencent
+// par "n|", avec n=part.
+
+void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText,
+ int pente, int font, int part)
+{
+ char text[100];
+ char* pDest;
+ int itl;
+
+ if ( font == FONTLITTLE ) itl = DIMLITTLEY;
+ else itl = DIMTEXTY;
+
+ while ( *pText != 0 )
+ {
+ pDest = text;
+ while ( *pText != 0 && *pText != '\r' && *pText != '\n' )
+ {
+ *pDest++ = *pText++;
+ }
+ *pDest = 0;
+ if ( *pText == '\r' ) pText ++; // saute '\r'
+ if ( *pText == '\n' ) pText ++; // saute '\n'
+
+ pDest = text;
+ if ( text[0] != 0 && text[1] == '|' ) // commence par "n|" ?
+ {
+ if ( part != -1 && part != text[0]-'0' ) continue;
+ pDest += 2; // saute "n|"
+ }
+ else
+ {
+ if ( part != -1 ) continue;
+ }
+
+ if ( pente == 0 )
+ {
+ DrawText(pPixmap, pos, pDest, font);
+ }
+ else
+ {
+ DrawTextPente(pPixmap, pos, pDest, pente, font);
+ }
+
+ if ( pDest[0] == 0 ) // ligne vide ?
+ {
+ pos.y += itl/2; // descend de 1/2 ligne
+ }
+ else
+ {
+ pos.y += itl; // passe � la ligne suivante
+ }
+ }
+}
+
+// Affiche un texte centr� pouvant �ventuellement
+// contenir plusieurs lignes s�par�es par des '\n'.
+
+void DrawTextCenter(CPixmap *pPixmap, POINT pos, char *pText, int font)
+{
+ char text[100];
+ char* pDest;
+ int itl;
+ POINT start;
+
+ if ( font == FONTLITTLE ) itl = DIMLITTLEY;
+ else itl = DIMTEXTY;
+
+ while ( *pText != 0 )
+ {
+ pDest = text;
+ while ( *pText != 0 && *pText != '\r' && *pText != '\n' )
+ {
+ *pDest++ = *pText++;
+ }
+ *pDest = 0;
+ if ( *pText == '\r' ) pText ++; // saute '\r'
+ if ( *pText == '\n' ) pText ++; // saute '\n'
+
+ pDest = text;
+ start.x = pos.x - GetTextWidth(pDest)/2;
+ start.y = pos.y;
+ DrawText(pPixmap, start, pDest, font);
+
+ if ( pDest[0] == 0 ) // ligne vide ?
+ {
+ pos.y += itl/2; // descend de 1/2 ligne
+ }
+ else
+ {
+ pos.y += itl; // passe � la ligne suivante
+ }
+ }
+}
+
+// Retourne la hauteur d'un texte.
+
+int GetTextHeight(char *pText, int font, int part)
+{
+ char text[100];
+ char* pDest;
+ int itl;
+ int h=0;
+
+ if ( font == FONTLITTLE ) itl = DIMLITTLEY;
+ else itl = DIMTEXTY;
+
+ while ( *pText != 0 )
+ {
+ pDest = text;
+ while ( *pText != 0 && *pText != '\r' && *pText != '\n' )
+ {
+ *pDest++ = *pText++;
+ }
+ *pDest = 0;
+ if ( *pText == '\r' ) pText ++; // saute '\r'
+ if ( *pText == '\n' ) pText ++; // saute '\n'
+
+ pDest = text;
+ if ( text[0] != 0 && text[1] == '|' ) // commence par "n|" ?
+ {
+ if ( part != -1 && part != text[0]-'0' ) continue;
+ pDest += 2; // saute "n|"
+ }
+ else
+ {
+ if ( part != -1 ) continue;
+ }
+
+ if ( pDest[0] == 0 ) // ligne vide ?
+ {
+ h += itl/2; // descend de 1/2 ligne
+ }
+ else
+ {
+ h += itl; // passe � la ligne suivante
+ }
+ }
+
+ return h;
+}
+
+// Retourne la longueur d'un texte.
+
+int GetTextWidth(char *pText, int font)
+{
+ int width = 0;
+
+ while ( *pText != 0 )
+ {
+ width += GetCharWidth(*pText++, font);
+ }
+
+ return width;
+}
+
diff --git a/src/text.h b/src/text.h
new file mode 100644
index 0000000..97ede20
--- /dev/null
+++ b/src/text.h
@@ -0,0 +1,61 @@
+// Text.h
+
+#pragma once
+
+#define FONTWHITE 0
+#define FONTRED 1
+#define FONTSLIM 2
+#define FONTLITTLE 10
+
+typedef struct
+{
+ char charIcon;
+ char charOffsetX;
+ char charOffsetY;
+ char accentIcon;
+ char accentOffsetX;
+ char accentOffsetY;
+}
+CharOffset;
+
+extern
+void DrawText(CPixmap *pPixmap, POINT pos, char *pText, int font);
+
+extern
+void DrawTextLeft(CPixmap* pPixmap, POINT pos, char *text, int font);
+
+extern
+void DrawTextNew(CPixmap *pPixmap, POINT pos, char* pText, int font);
+
+extern
+void DrawChar(CPixmap* pPixmap, POINT pos, char* pText, double size);
+
+extern
+void DrawCharSingle(CPixmap* pPixmap, POINT pos, int rank, double size);
+
+extern
+void DrawTextNew(CPixmap* pPixmap, POINT pos, char* pText, int font);
+
+extern
+void DrawTextPente(CPixmap *pPixmap, POINT pos, char *pText,
+ int pente, int font=0);
+
+extern
+void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText,
+ int pente, int font=0, int part=-1);
+
+extern
+void DrawTextCenter(CPixmap *pPixmap, POINT pos, char *pText, int font=0);
+
+extern
+int GetTextHeight(char *pText, int font=0, int part=-1);
+
+extern
+int GetTextWidth(char *pText, int font=0);
+
+extern
+void DrawBignum(CPixmap *pPixmap, POINT pos, int num);
+
+extern
+int GetBignumWidth(int num);
+
diff --git a/texttables.h b/src/texttables.h
similarity index 100%
rename from texttables.h
rename to src/texttables.h
diff --git a/wave.cpp b/src/wave.cpp
similarity index 100%
rename from wave.cpp
rename to src/wave.cpp
diff --git a/wave.h b/src/wave.h
similarity index 100%
rename from wave.h
rename to src/wave.h
diff --git a/text.cpp b/text.cpp
deleted file mode 100644
index feb3c2c..0000000
--- a/text.cpp
+++ /dev/null
@@ -1,553 +0,0 @@
-// Text.cpp
-
-#include
-#include
-#include
-#include
-#include "def.h"
-#include "pixmap.h"
-#include "text.h"
-#include "texttables.h"
-
-/////////////////////////////////////////////////////////////////////////////
-
-static CharProperties table_char[] =
-{
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { ' ', 0, 0, -1, 0, 0 },
- { '!', 0, 0, -1, 0, 0 },
- { '"', 0, 0, -1, 0, 0 },
- { '#', 0, 0, -1, 0, 0 },
- { '$', 0, 0, -1, 0, 0 },
- { '%', 0, 0, -1, 0, 0 },
- { '&', 0, 0, -1, 0, 0 },
- { '\'', 0, 0, -1, 0, 0 },
- { '(', 0, 0, -1, 0, 0 },
- { ')', 0, 0, -1, 0, 0 },
- { '*', 0, 0, -1, 0, 0 },
- { '+', 0, 0, -1, 0, 0 },
- { ',', 0, 0, -1, 0, 0 },
- { '-', 0, 0, -1, 0, 0 },
- { '.', 0, 0, -1, 0, 0 },
- { '/', 0, 0, -1, 0, 0 },
- { '0', 0, 0, -1, 0, 0 },
- { '1', 0, 0, -1, 0, 0 },
- { '2', 0, 0, -1, 0, 0 },
- { '3', 0, 0, -1, 0, 0 },
- { '4', 0, 0, -1, 0, 0 },
- { '5', 0, 0, -1, 0, 0 },
- { '6', 0, 0, -1, 0, 0 },
- { '7', 0, 0, -1, 0, 0 },
- { '8', 0, 0, -1, 0, 0 },
- { '9', 0, 0, -1, 0, 0 },
- { ':', 0, 0, -1, 0, 0 },
- { ';', 0, 0, -1, 0, 0 },
- { '<', 0, 0, -1, 0, 0 },
- { '=', 0, 0, -1, 0, 0 },
- { '>', 0, 0, -1, 0, 0 },
- { '?', 0, 0, -1, 0, 0 },
- { '@', 0, 0, -1, 0, 0 },
- { 'A', 0, 0, -1, 0, 0 },
- { 'B', 0, 0, -1, 0, 0 },
- { 'C', 0, 0, -1, 0, 0 },
- { 'D', 0, 0, -1, 0, 0 },
- { 'E', 0, 0, -1, 0, 0 },
- { 'F', 0, 0, -1, 0, 0 },
- { 'G', 0, 0, -1, 0, 0 },
- { 'H', 0, 0, -1, 0, 0 },
- { 'I', 0, 0, -1, 0, 0 },
- { 'J', 0, 0, -1, 0, 0 },
- { 'K', 0, 0, -1, 0, 0 },
- { 'L', 0, 0, -1, 0, 0 },
- { 'M', 0, 0, -1, 0, 0 },
- { 'N', 0, 0, -1, 0, 0 },
- { 'O', 0, 0, -1, 0, 0 },
- { 'P', 0, 0, -1, 0, 0 },
- { 'Q', 0, 0, -1, 0, 0 },
- { 'R', 0, 0, -1, 0, 0 },
- { 'S', 0, 0, -1, 0, 0 },
- { 'T', 0, 0, -1, 0, 0 },
- { 'U', 0, 0, -1, 0, 0 },
- { 'V', 0, 0, -1, 0, 0 },
- { 'W', 0, 0, -1, 0, 0 },
- { 'X', 0, 0, -1, 0, 0 },
- { 'Y', 0, 0, -1, 0, 0 },
- { 'Z', 0, 0, -1, 0, 0 },
- { '[', 0, 0, -1, 0, 0 },
- { '\\', 0, 0, -1, 0, 0 },
- { ']', 0, 0, -1, 0, 0 },
- { '^', 0, 0, -1, 0, 0 },
- { '_', 0, 0, -1, 0, 0 },
- { '`', 0, 0, -1, 0, 0 },
- { 'a', 0, 0, -1, 0, 0 },
- { 'b', 0, 0, -1, 0, 0 },
- { 'c', 0, 0, -1, 0, 0 },
- { 'd', 0, 0, -1, 0, 0 },
- { 'e', 0, 0, -1, 0, 0 },
- { 'f', 0, 0, -1, 0, 0 },
- { 'g', 0, 0, -1, 0, 0 },
- { 'h', 0, 0, -1, 0, 0 },
- { 'i', 0, 0, -1, 0, 0 },
- { 'j', 0, 0, -1, 0, 0 },
- { 'k', 0, 0, -1, 0, 0 },
- { 'l', 0, 0, -1, 0, 0 },
- { 'm', 0, 0, -1, 0, 0 },
- { 'n', 0, 0, -1, 0, 0 },
- { 'o', 0, 0, -1, 0, 0 },
- { 'p', 0, 0, -1, 0, 0 },
- { 'q', 0, 0, -1, 0, 0 },
- { 'r', 0, 0, -1, 0, 0 },
- { 's', 0, 0, -1, 0, 0 },
- { 't', 0, 0, -1, 0, 0 },
- { 'u', 0, 0, -1, 0, 0 },
- { 'v', 0, 0, -1, 0, 0 },
- { 'w', 0, 0, -1, 0, 0 },
- { 'x', 0, 0, -1, 0, 0 },
- { 'y', 0, 0, -1, 0, 0 },
- { 'z', 0, 0, -1, 0, 0 },
- { '{', 0, 0, -1, 0, 0 },
- { '|', 0, 0, -1, 0, 0 },
- { '}', 0, 0, -1, 0, 0 },
- { '~', 0, 0, -1, 0, 0 },
- { 0x7f, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 0x05, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 0x04, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 0x10, 0, 0, -1, 0, 0 },
- { 'a', 0, 0, 2, 2, 0 },
- { 0x11, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 0x1b, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 0x1d, 0, 0, -1, 0, 0 },
- { 0x13, 0, 0, -1, 0, 0 },
- { 0x12, 0, 0, -1, 0, 0 },
- { 0x15, 0, 0, -1, 0, 0 },
- { 0x14, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 'i', 0, 0, 2, -1, 0 },
- { 0x17, 0, 0, -1, 0, 0 },
- { 0x16, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 'n', 0, 0, '~', -1, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 'o', 0, 0, 2, 1, 0 },
- { 0x18, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 0x1c, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 0x19, 0, 0, -1, 0, 0 },
- { 'u', 0, 0, 2, 2, 0 },
- { 0x1a, 0, 0, -1, 0, 0 },
- { 0x0f, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 },
- { 1, 0, 0, -1, 0, 0 }
-};
-
-// Retourne l'offset pour un caractère donné.
-
-int GetOffset(char c)
-{
- int i;
-
- static unsigned char table_accents[15] =
- {
- 0xFC, 0xE0, 0xE2, 0xE9, 0xE8, 0xEB, 0xEA, 0xEF,
- 0xEE, 0xF4, 0xF9, 0xFB, 0xE4, 0xF6, 0xE7
- };
-
- for ( i=0 ; i<15 ; i++ )
- {
- if ( (unsigned char)c == table_accents[i] )
- {
- return 15+i;
- }
- }
- if ( c<0 || c>128 ) return 1; // carr�
-
- return c;
-}
-
-// Retourne la longueur d'un caract�re.
-
-int GetCharWidthB(char c, int font)
-{
- static unsigned char table_width[128] =
- {
- 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,8,
- 9,9,8,8,8,8,5,5,8,8,8,9,8,8,10,10,
- 5,6,9,13,11,12,12,6,6,6,12,12,5,9,6,9,
- 8,8,9,9,8,9,8,8,9,9,6,6,8,9,10,11,
- 12,8,9,9,9,8,8,8,9,4,8,9,8,10,9,9,
- 8,9,8,9,10,8,9,11,9,8,10,7,10,7,13,13,
- 9,9,8,8,8,8,6,8,8,4,6,8,4,12,8,8,
- 8,8,7,6,7,8,8,10,8,8,7,6,6,6,10,0,
- };
-
- static unsigned char table_width_little[128] =
- {
- 6,6,6,6,6,6,6,6,6,6,6,6,5,6,6,7,
- 6,6,6,6,6,6,3,3,6,6,6,6,6,6,5,5,
- 3,3,5,8,5,11,9,3,4,4,6,6,3,4,3,6,
- 5,5,5,5,5,5,5,5,5,5,3,3,7,6,7,6,
- 9,8,6,7,7,5,5,8,7,2,4,7,5,10,7,8,
- 6,8,7,6,6,6,8,12,7,6,6,3,5,3,6,8,
- 4,6,6,6,6,6,4,6,6,2,3,5,2,10,6,6,
- 6,6,3,5,3,6,6,8,6,6,5,4,6,4,7,0,
- };
-
- if ( font == FONTLITTLE )
- {
- return table_width_little[GetOffset(c)];
- }
- else
- {
- return table_width[GetOffset(c)]-1;
- }
-}
-
-void DrawCharSingle(CPixmap *pPixmap, POINT pos, char *pText, int font)
-{
- if (font == FONTLITTLE)
- {
- pPixmap->DrawIcon(-1, CHLITTLE, *pText, pos, 0, FALSE);
- }
- else
- {
- pPixmap->DrawIcon(-1, CHTEXT, *pText + font * 128, pos, 0, FALSE);
- }
-}
-
-void DrawChar(CPixmap *pPixmap, POINT *pos, char c, int font)
-{
- POINT pos2 { table_char[c].charOffsetX + pos->x, table_char[c].charOffsetY + pos->y };
- DrawCharSingle(pPixmap, pos2, &table_char[c].charIcon, font);
- if (table_char[c].accentIcon != -1)
- {
- pos2 = { table_char[c].accentOffsetX + pos->x, table_char[c].accentOffsetY + pos->y };
- DrawCharSingle(pPixmap, pos2, &table_char[c].accentIcon, font);
- }
- pos->x += GetCharWidthB(c, font);
-}
-
-void DrawTextLeft(CPixmap *pPixmap, POINT pos, char *pText, int font)
-{
- DrawText(pPixmap, pos, pText, font);
-}
-
-// Affiche un texte.
-
-void DrawText(CPixmap *pPixmap, POINT pos, char *pText, int font)
-{
- while (*pText != 0)
- {
- DrawChar(pPixmap, &pos, *pText++, font);
- }
-}
-
-// Affiche un texte penché.
-
-void DrawTextPente(CPixmap *pPixmap, POINT pos, char *pText,
- int pente, int font)
-{
- int rank, lg, rel, start;
-
- start = pos.y;
- rel = 0;
- while (*pText != 0)
- {
- rank = GetOffset(*pText);
- rank += 128 * font;
- pPixmap->DrawIcon(-1, CHTEXT, rank, pos);
-
- lg = GetCharWidthB(*pText++, font);
- rel += lg;
- pos.x += lg;
- pos.y = start + rel / pente;
- }
-}
-
-// Affiche un pavé de texte.
-// Une ligne vide est affichée avec un demi interligne !
-// Si part != -1, n'affiche que les lignes qui commencent
-// par "n|", avec n=part.
-
-void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText,
- int pente, int font, int part)
-{
- char text[100];
- char* pDest;
- int itl;
-
- if (font == FONTLITTLE) itl = DIMLITTLEY;
- else itl = DIMTEXTY;
-
- while (*pText != 0)
- {
- pDest = text;
- while (*pText != 0 && *pText != '\r' && *pText != '\n')
- {
- *pDest++ = *pText++;
- }
- *pDest = 0;
- if (*pText == '\r') pText++; // saute '\r'
- if (*pText == '\n') pText++; // saute '\n'
-
- pDest = text;
- if (text[0] != 0 && text[1] == '|') // commence par "n|" ?
- {
- if (part != -1 && part != text[0] - '0') continue;
- pDest += 2; // saute "n|"
- }
- else
- {
- if (part != -1) continue;
- }
-
- if (pente == 0)
- {
- DrawText(pPixmap, pos, pDest, font);
- }
- else
- {
- DrawTextPente(pPixmap, pos, pDest, pente, font);
- }
-
- if (pDest[0] == 0) // ligne vide ?
- {
- pos.y += itl / 2; // descend de 1/2 ligne
- }
- else
- {
- pos.y += itl; // passe à la ligne suivante
- }
- }
-}
-
-// Affiche un texte centré pouvant éventuellement
-// contenir plusieurs lignes séparées par des '\n'.
-
-void DrawTextCenter(CPixmap *pPixmap, POINT pos, char *pText, int font)
-{
- char text[100];
- char* pDest;
- int itl;
- POINT start;
-
- if (font == FONTLITTLE) itl = DIMLITTLEY;
- else itl = DIMTEXTY;
-
- while (*pText != 0)
- {
- pDest = text;
- while (*pText != 0 && *pText != '\r' && *pText != '\n')
- {
- *pDest++ = *pText++;
- }
- *pDest = 0;
- if (*pText == '\r') pText++; // saute '\r'
- if (*pText == '\n') pText++; // saute '\n'
-
- pDest = text;
- start.x = pos.x - GetTextWidth(pDest) / 2;
- start.y = pos.y;
- DrawText(pPixmap, start, pDest, font);
-
- if (pDest[0] == 0) // ligne vide ?
- {
- pos.y += itl / 2; // descend de 1/2 ligne
- }
- else
- {
- pos.y += itl; // passe à la ligne suivante
- }
- }
-}
-
-// Retourne la hauteur d'un texte.
-
-int GetTextHeight(char *pText, int font, int part)
-{
- char text[100];
- char* pDest;
- int itl;
- int h = 0;
-
- if (font == FONTLITTLE) itl = DIMLITTLEY;
- else itl = DIMTEXTY;
-
- while (*pText != 0)
- {
- pDest = text;
- while (*pText != 0 && *pText != '\r' && *pText != '\n')
- {
- *pDest++ = *pText++;
- }
- *pDest = 0;
- if (*pText == '\r') pText++; // saute '\r'
- if (*pText == '\n') pText++; // saute '\n'
-
- pDest = text;
- if (text[0] != 0 && text[1] == '|') // commence par "n|" ?
- {
- if (part != -1 && part != text[0] - '0') continue;
- pDest += 2; // saute "n|"
- }
- else
- {
- if (part != -1) continue;
- }
-
- if (pDest[0] == 0) // ligne vide ?
- {
- h += itl / 2; // descend de 1/2 ligne
- }
- else
- {
- h += itl; // passe à la ligne suivante
- }
- }
-
- return h;
-}
-
-// Retourne la longueur d'un texte.
-
-int GetTextWidth(char *pText, int font)
-{
- int width = 0;
-
- while (*pText != 0)
- {
- width += GetCharWidthB(*pText++, font);
- }
-
- return width;
-}
diff --git a/text.h b/text.h
deleted file mode 100644
index e1fa3e0..0000000
--- a/text.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Text.h
-
-#pragma once
-
-#define FONTWHITE 0
-#define FONTRED 1
-#define FONTSLIM 2
-#define FONTLITTLE 10
-
-typedef struct
-{
- char charIcon;
- char charOffsetX;
- char charOffsetY;
- char accentIcon;
- char accentOffsetX;
- char accentOffsetY;
-}
-CharProperties;
-
-extern
-void DrawCharSingle(CPixmap *pPixmap, POINT pos, char *pText, int font);
-
-extern
-void DrawChar(CPixmap *pPixmap, POINT *pos, char c, int font);
-
-extern
-void DrawTextLeft(CPixmap *pPixmap, POINT pos, char *pText, int font);
-
-extern
-void DrawText(CPixmap *pPixmap, POINT pos, char *pText, int font = 0);
-
-extern
-void DrawTextPente(CPixmap *pPixmap, POINT pos, char *pText,
- int pente, int font = 0);
-
-extern
-void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText,
- int pente, int font = 0, int part = -1);
-
-extern
-void DrawTextCenter(CPixmap *pPixmap, POINT pos, char *pText, int font = 0);
-
-extern
-int GetTextHeight(char *pText, int font = 0, int part = -1);
-
-extern
-int GetTextWidth(char *pText, int font = 0);
-
diff --git a/util/extract_phasetable.py b/util/extract_phasetable.py
new file mode 100644
index 0000000..64f0e82
--- /dev/null
+++ b/util/extract_phasetable.py
@@ -0,0 +1,68 @@
+# JUMMY WAS HERE
+# extract phase table from speedy blupi 2.2 english ver
+
+import sys
+import io
+
+offset = 0x3d400
+
+outs = []
+
+with io.open('BLUPI.exe', 'rb') as f:
+ data = f.read()
+ outs.append('static Phase table[] =')
+ outs.append('{')
+ for i in range(39):
+
+ poff = offset + i * 7084
+ p = int.from_bytes(data[poff : poff + 4], 'little')
+ if p == 0:
+ outs.append('{0}')
+ break
+ outs.append('{')
+ outs.append(str(p) + ',')
+ outs.append('"' + data[poff + 4 : poff + 36].decode('ascii').rstrip('\x00') + '",')
+ outs.append('TRUE,' if int.from_bytes(data[poff + 36 : poff + 40], 'little') != 0 else 'FALSE,')
+ outs.append('TRUE,' if int.from_bytes(data[poff + 40 : poff + 44], 'little') != 0 else 'FALSE,')
+ outs.append('{')
+ for j in range(40):
+ boff = poff + 44 + j * 176
+ b = int.from_bytes(data[boff : boff + 4], 'little')
+ if b == 0:
+ outs.append('{0}')
+ break
+ else:
+ outs.append('{')
+ outs.append(str(b) + ',')
+ s = ''
+ s += str(int.from_bytes(data[boff + 4 : boff + 8], 'little')) + ', '
+ m = int.from_bytes(data[boff + 8 : boff + 12], 'little')
+ if m == 0:
+ s += '{0},'
+ else:
+ s += '{' + str(m) + ', '
+ for k in range(m):
+ moff = boff + 12 + k * 4
+ s += str(int.from_bytes(data[moff : moff + 4], 'little')) + ', '
+ s += '},'
+ outs.append(str(s))
+ outs.append(str(int.from_bytes(data[boff + 88 : boff + 92], 'little')) + ', ' + str(int.from_bytes(data[boff + 92 : boff + 96], 'little')) + ',')
+ s = ''
+ t = int.from_bytes(data[boff + 96 : boff + 100], 'little')
+ if t == 0:
+ s += '{0}'
+ else:
+ s += '{ ' + str(t) + ', '
+ for k in range(t):
+ toff = boff + 100 + k * 4
+ s += str(int.from_bytes(data[toff : toff + 4], 'little')) + ', '
+ s += '}'
+ outs.append(str(s))
+ outs.append('},')
+ outs.append('},')
+ outs.append('},')
+ outs.append('},')
+outs.append('};')
+
+with io.open('out.h', 'wb') as f2:
+ f2.write(bytearray('\n'.join(outs), 'ascii'))
diff --git a/util/extract_pixtables.py b/util/extract_pixtables.py
new file mode 100644
index 0000000..a1fd321
--- /dev/null
+++ b/util/extract_pixtables.py
@@ -0,0 +1,31 @@
+# JUMMY WAS HERE
+# extract pixtables from speedy blupi 2.2 english ver
+
+import sys
+import io
+
+offsets = {}
+offsets['table_icon_blupi'] = 0x81bf8
+offsets['table_icon_element'] = 0x84070
+offsets['table_icon_explo'] = 0x84e00
+offsets['table_icon_object'] = 0x82bc0
+
+outs = {}
+
+with io.open('BLUPI.exe', 'rb') as f:
+ data = f.read()
+ for k, v in offsets.items():
+ lg = int.from_bytes(data[v : v + 2], 'little')
+ outs[k] = []
+ outs[k].append("extern short " + k + "[]{");
+ outs[k].append(str(lg) + ',');
+ for i in range(lg):
+ string = ''
+ for j in range(6):
+ string += str(int.from_bytes(data[v + i*12 + j*2 + 2 : v + i*12 + j*2 + 4], 'little')) + ','
+ if j % 2 == 1:
+ string += ' '
+ outs[k].append(string)
+ outs[k].append('};')
+with io.open('out.h', 'wb') as f2:
+ f2.write(bytearray(('\n\n'.join(['\n'.join(w) for w in [v for _, v in outs.items()]])), 'ascii'))