1
0
mirror of https://github.com/jummy0/sb2-decomp synced 2025-03-15 04:24:48 +01:00

interim commit

it's real sucks clues in here
This commit is contained in:
jummy 2024-08-06 14:26:25 -05:00
parent e6a2228448
commit 600eb1b6d4
19 changed files with 4215 additions and 2105 deletions

4
.gitignore vendored
View File

@ -3,4 +3,6 @@
################################################################################
/.vs
planetblupi.*
planetblupi.*
/Release
/Debug

269
blupi.cpp
View File

@ -47,10 +47,11 @@ int g_timerInterval = 50; // inverval = 50ms
int g_mouseType = MOUSETYPEGRA;
int g_benchmark;
BOOL g_bBenchmarkSuccess;
BOOL g_bTrueColor;
BOOL g_bTrueColorBack;
BOOL g_bTrueColorDecor;
MMRESULT g_updateTimer; // timer général
BOOL g_bCDAudio;
int g_something;
MMRESULT g_updateTimer; // timer général
BOOL g_bActive = TRUE; // is application active ?
BOOL g_bTermInit = FALSE; // initialisation en cours
int g_objectMax;
@ -85,6 +86,7 @@ BOOL ReadConfig (LPSTR lpCmdLine)
char* pText;
int nb;
int i;
MEMORYSTATUS mem;
file = fopen("data\\config.def", "rb");
if ( file == NULL ) return FALSE;
@ -93,7 +95,7 @@ BOOL ReadConfig (LPSTR lpCmdLine)
fclose(file);
#if 0
#if !_NOCD
pText = strstr(buffer, "CD-Rom=");
if ( pText == NULL )
{
@ -177,86 +179,89 @@ BOOL ReadConfig (LPSTR lpCmdLine)
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 = 1, g_bTrueColor = 1, g_bTrueColorDecor;
if (g_benchmark > 3099)
{
g_bBenchmarkSuccess = TRUE;
g_bTrueColorBack = TRUE;
g_bTrueColorDecor = TRUE;
}
}
pText = strstr(buffer, "TrueColor=");
if ( pText != NULL )
{
i = GetNum(pText + 10);
if (i == 8) g_bTrueColor = 0;
if (i == 16) g_bTrueColor = 1;
g_bTrueColorDecor = g_bTrueColor;
if (i == 8) g_bTrueColorBack = FALSE;
if (i == 16) g_bTrueColorBack = TRUE;
g_bTrueColorDecor = g_bTrueColorBack;
}
pText = strstr(buffer, "TrueColorBack=");
if ( pText != NULL )
{
i = GetNum(pText+14);
if (i == 8) g_bTrueColor = 0;
if (i == 16) g_bTrueColor = 1;
if (i == 8) g_bTrueColorBack = FALSE;
if (i == 16) g_bTrueColorBack = TRUE;
}
pText = strstr(buffer, "TrueColorDecor=");
if ( pText != NULL )
{
i = GetNum(pText + 15);
if (i == 8) g_bTrueColorDecor = 0;
if (i == 8) g_bTrueColorDecor = FALSE;
if (i == 16) g_bTrueColorDecor = TRUE;
}
if (i == 16) g_bTrueColorDecor = 1;
pText = strstr(buffer, "CDAudio=");
if ( pText != NULL )
{
i = GetNum(pText + 8);
g_bCDAudio = (i == TRUE);
}
mem.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(&mem);
if (mem.dwTotalPhys < 32000000) g_bBenchmarkSuccess = FALSE;
if (!g_bBenchmarkSuccess)
{
g_bTrueColorBack = FALSE;
g_bTrueColorDecor = FALSE;
}
return TRUE;
}
// Mise à jour principale. [Rewrite Variables]
// Mise à jour principale. [TODO: Rewrite Variables]
void UpdateFrame(void)
{
RECT clip, rcRect;
UINT phase;
POINT posMouse;
int i, term, speed;
int phase, term;
g_pPixmap->MouseBackClear(); // enlève la souris dans "back"
posMouse = g_pEvent->GetLastMousePos();
g_pEvent->ReadInput();
phase = g_pEvent->GetPhase();
if ( phase == g_lastPhase &&
phase == WM_PHASE_PLAY || phase == WM_PHASE_PLAYTEST || phase == WM_PHASE_BUILD )
if (phase == WM_PHASE_PLAY || phase == WM_PHASE_PLAYTEST || phase == WM_PHASE_BUILD)
{
//? rcRect.left = POSDRAWX;
//? rcRect.top = POSDRAWY;
//? rcRect.right = POSDRAWX+DIMDRAWX;
//? rcRect.bottom = POSDRAWY+DIMDRAWY;
//? g_pPixmap->DrawImage(-1, CHBACK, rcRect, 1); // dessine le fond
}
else
{
rcRect.left = 0;
rcRect.top = 0;
rcRect.right = LXIMAGE;
rcRect.bottom = LYIMAGE;
g_pPixmap->DrawImage(-1, CHBACK, rcRect, 1); // dessine le fond
}
//[this block remains dormant, yet functional in SB]
if (phase == WM_PHASE_INTRO1 ||
phase == WM_PHASE_INTRO2)
{
g_pEvent->IntroStep();
if (!g_pDecor->GetPause())
{
for (int i = 0; i < g_pEvent->GetSpeed() * g_speedRate; i++)
{
g_pDecor->MoveStep();
g_pEvent->DemoStep();
}
}
}
if (phase == WM_PHASE_INIT)
{
g_pEvent->DemoStep(); // démarre év. démo automatique
g_pEvent->DemoStep();
}
if (phase == WM_PHASE_PLAYMOVIE || phase == WM_PHASE_WINMOVIE || WM_PHASE_WINMOVIEDESIGN || WM_PHASE_WINMOVIEMULTI)
if (phase == WM_PHASE_PLAYMOVIE || phase == WM_PHASE_WINMOVIE || phase == WM_PHASE_WINMOVIEDESIGN || phase == WM_PHASE_WINMOVIEMULTI)
{
g_pEvent->MovieToStart;
g_pEvent->MovieToStart();
}
if (phase == WM_PHASE_INSERT)
@ -264,64 +269,55 @@ void UpdateFrame(void)
g_pEvent->TryInsert();
}
if ( phase == WM_PHASE_PLAY )
if (phase == WM_PHASE_PLAY)
{
clip.left = POSDRAWX;
clip.top = POSDRAWY+g_pDecor->GetInfoHeight();
clip.right = POSDRAWX+DIMDRAWX;
clip.bottom = POSDRAWY+DIMDRAWY;
if ( g_pEvent->IsShift() ) // shift en cours ?
term = g_pDecor->IsTerminated();
if (g_pEvent->IsPrivate())
{
g_pEvent->DecorAutoShift(posMouse);
g_pDecor->Build(clip, posMouse); // construit juste le décor
if (term == -1)
{
g_pEvent->ChangePhase(WM_PHASE_HISTORY1);
return;
}
if (term != 0)
{
g_pEvent->ChangePhase(WM_PHASE_HELP);
return;
}
}
else
{
if ( !g_pEvent->GetPause() )
if (g_pEvent->IsMulti())
{
speed = g_pEvent->GetSpeed() * g_speedRate;
for ( i=0 ; i<speed ; i++ )
{
g_pDecor->BlupiStep(i==0); // avance tous les blupi
g_pDecor->MoveStep(i==0); // avance tous les décors
g_pEvent->DemoStep(); // avance enregistrement/reproduction
if (term == -1) {
g_pEvent->ChangePhase(WM_PHASE_H0MOVIE);
return;
}
if (term != 0) {
g_pEvent->ChangePhase(WM_PHASE_H2MOVIE);
return;
}
}
g_pEvent->DecorAutoShift(posMouse);
g_pDecor->Build(clip, posMouse); // construit le décor
g_pDecor->NextPhase(1); // refait la carte de temps en temps
else
{
if (term == -1) {
g_pEvent->GetWorldGroup(); // probably intended to be a variable assignment? wtf ghidra
g_pEvent->SetNbVies(g_pDecor->GetNbVies());
g_pEvent->ChangePhase(WM_PHASE_LOST);
}
if (term == -2) {
g_pEvent->SetNbVies(g_pDecor->GetNbVies());
g_pEvent->ChangePhase(WM_PHASE_PLAYMOVIE);
}
if (term > 0) {
g_pEvent->SetNbVies(g_pDecor->GetNbVies());
g_pDecor->SetMission(term);
g_pEvent->ChangePhase(WM_PHASE_PLAY);
}
}
}
}
if ( phase == WM_PHASE_PLAY )
{
term = g_pDecor->IsTerminated();
if ( term == 1 ) g_pEvent->ChangePhase(WM_PHASE_LOST); // perdu
if ( term == 2 ) g_pEvent->ChangePhase(WM_PHASE_WINMOVIE); // gagné
}
g_pPixmap->MouseBackDraw(); // remet la souris dans "back"
}
//[excluded from SB release builds]
void Benchmark()
{
int i;
POINT pos = { 0, 0 };
g_pPixmap->DrawIcon(-1, 2, 10, pos, 0);
pos.x = 300;
pos.y = 350;
for (i = 0; i < 10000; i++)
{
g_pPixmap->DrawIcon(-1, 2, i % 4, pos, 0);
}
g_pPixmap->DrawIcon(-1, 2, 10, pos, 0);
g_pSound->Play(0);
}
// Incomplete
@ -353,11 +349,24 @@ void SetDecor()
g_pPixmap->DrawImage(-1, 0, rect, 1);
}
g_pEvent->FUN_1d7d0();
g_pEvent->AddPhaseText();
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 après une activation en mode fullScreen.
@ -457,14 +466,17 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message,
{
case WM_TIMER:
case WM_UPDATE:
if (!g_pEvent->IsMovie()) // pas de film en cours ?
if (g_pEvent != NULL && !g_pEvent->IsMovie() && !g_pEvent->IsMouseRelease()) // pas de film en cours ?
{
g_pEvent->GetPhase(); // ?
if (g_bActive)
{
UpdateFrame();
SetDecor();
}
g_pPixmap->Display();
}
if (g_something > 0) g_something--;
break;
case WM_SYSCOLORCHANGE:
OutputDebug("Event WM_SYSCOLORCHANGE\n");
@ -478,7 +490,7 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message,
g_bActive = (wParam != 0);
if ( g_pEvent != NULL )
{
g_pEvent->SomethingDecor();
g_pEvent->FlushInput();
}
if ( g_bActive )
{
@ -489,12 +501,8 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message,
}
if ( !g_bFullScreen && g_bTermInit )
{
totalDim.x = 64;
totalDim.y = 66;
iconDim.x = 64;
iconDim.y = 66/2;
g_pPixmap->Cache(CHLITTLE, "image16\\little.blp", totalDim, iconDim, 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();
@ -502,7 +510,7 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message,
SetWindowText(hWnd, "Blupi");
if ( g_pSound != NULL ) g_pSound->RestartMusic();
}
else // dsactive ?
else // désactive ?
{
if ( g_bFullScreen )
{
@ -590,7 +598,7 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message,
break;
case WM_DESTROY:
KillTimer(g_hWnd, 1);
timeKillEvent((UINT)g_hWnd);
FinishObjects();
PostQuitMessage(0);
break;
@ -644,7 +652,7 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
wc.hIcon = LoadIcon(hInstance, "IDR_MAINFRAME");
wc.hCursor = LoadCursor(hInstance, "IDC_POINTER");
wc.hbrBackground = GetStockBrush(BLACK_BRUSH);
wc.lpszMenuMane = NAME;
wc.lpszMenuName = NAME;
wc.lpszClassName = NAME;
RegisterClass(&wc);
@ -701,7 +709,7 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
ChangeSprite(SPRITE_WAIT); // met le sablier maison
if (!bOk) // config.def pas correct ?
if (!bOK) // config.def pas correct ?
{
return InitFail("Game not correctly installed", FALSE);
}
@ -710,31 +718,14 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
g_pPixmap = new CPixmap;
if (g_pPixmap == NULL) return InitFail("New pixmap", TRUE);
totalDim.x = LXIMAGE;
totalDim.y = LYIMAGE;
if (!g_pPixmap->Create(g_hWnd, totalDim, g_bFullScreen, g_mouseType))
return InitFail("Create pixmap", TRUE);
OutputDebug("Image: init\n");
totalDim.x = LXIMAGE;
totalDim.y = LYIMAGE;
iconDim.x = 0;
iconDim.y = 0;
if (!g_pPixmap->CacheAll(g_hWnd, g_bFullScreen, g_bTrueColor, g_bTrueColorDecor, g_mouseType, "image16\\init.blp", FALSE))
return InitFail("CacheAll", TRUE)
g_pPixmap->SetBenchmarkSuccess(g_bBenchmarkSuccess);
#if _INTRO
if (!g_pPixmap->Cache(CHBACK, "image16\\init.blp", totalDim, iconDim, TRUE))
if (!g_pPixmap->CacheAll(TRUE, g_hWnd, g_bFullScreen, g_bTrueColor, g_bTrueColorDecor, g_mouseType, "intro1.blp", FALSE))
#else
if (!g_pPixmap->Cache(CHBACK, "image16\\init.blp", totalDim, iconDim, TRUE))
if (!g_pPixmap->CacheAll(TRUE, g_hWnd, g_bFullScreen, g_bTrueColorBack, g_bTrueColorDecor, g_mouseType, "init.blp", FALSE))
#endif
return FALSE;
OutputDebug("SavePalette\n");
g_pPixmap->SavePalette();
OutputDebug("InitSysPalette\n");
g_pPixmap->InitSysPalette();
return FALSE;
g_pSound = new CSound;
if (g_pSound == NULL) return InitFail("New sound", TRUE);
@ -742,6 +733,10 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
g_pSound->Create(g_hWnd);
g_pSound->CacheAll();
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);
@ -751,25 +746,32 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
g_pDecor = new CDecor;
if (g_pDecor == NULL) return InitFail("New decor", FALSE);
g_pDecor->Create(g_hWnd, g_pSound, g_pPixmap);
g_pDecor->MapInitColors();
g_pDecor->Create(g_hWnd, g_pSound, g_pPixmap, g_pNetwork);
g_pEvent = new CEvent;
if (g_pEvent == NULL) return InitFail("New event", FALSE);
g_pEvent->Create(g_hWnd, g_pPixmap, g_pDecor, g_pSound, g_pMovie);
g_pEvent->Create(hInstance, g_hWnd, g_pPixmap, g_pDecor, g_pSound, g_pMovie, g_pNetwork);
g_pEvent->SetFullScreen(g_bFullScreen);
g_pEvent->SetMouseType(g_mouseType);
#if _INTRO
g_pEvent->ChangePhase(WM_PHASE_INTRO1);
#else
g_pEvent->ChangePhase(WM_PHASE_TESTCD);
g_pEvent->ChangePhase(WM_PHASE_INIT);
#endif
g_bTermInit = TRUE;
return TRUE;
}
void TimerStep()
{
if (g_bActive && !g_something)
{
g_something = TRUE;
PostMessage(g_hWnd, WM_UPDATE, 0, 0);
}
}
// Programme principal.
@ -783,7 +785,8 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
return FALSE;
}
SetTimer(g_hWnd, 1, g_timerInterval, NULL);
Benchmark();
timeSetEvent(g_timerInterval, g_timerInterval >> 2, (LPTIMECALLBACK)TimerStep, 0, 1);
while ( TRUE )
{
@ -804,4 +807,4 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
}
return msg.wParam;
}
}

View File

@ -50,7 +50,7 @@ BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
int region,*/ UINT message)
{
POINT iconDim;
int i, icon;
//int i, icon;
static int ttypes[] =
{

View File

@ -19,7 +19,7 @@
// Le message :
// First-chance exception in Blupi.exe (GDI32.DLL): 0xC0000005: Access Violation.
// apparaît au endroits marqus par (@) ...
// apparaît au endroits marqués par (@) ...
BOOL g_bDebug = TRUE;

View File

@ -1,22 +1,27 @@
/*==========================================================================
*
* Copyright (C) 1995 Microsoft Corporation. All Rights Reserved.
*
* File: ddutil.cpp
* Content: Routines for loading bitmap and palettes from resources
*
***************************************************************************/
#pragma once
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
#ifdef _cplusplus
extern "C" {
#endif
extern void DDSetDebug (BOOL bDebug);
extern IDirectDrawSurface * DDConnectBitmap(IDirectDraw *pdd, HBITMAP hbm);
extern IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap);
extern IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap, int dx, int dy);
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 void DDSetDebug(BOOL bDebug);
extern IDirectDrawSurface * DDConnectBitmap(IDirectDraw *pdd, HBITMAP hbm);
extern IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap);
extern IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap, int dx, int dy);
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);
#ifdef __cplusplus
}

View File

@ -3,7 +3,6 @@
#include "DEF.H"
#include "DECOR.H"
#include "ACTION.H"
#include "MISC.H"
#include "RESOURCE.H"

3424
decor.cpp

File diff suppressed because it is too large Load Diff

124
decor.h
View File

@ -12,11 +12,10 @@
/////////////////////////////////////////////////////////////////////////////
#define MAXNETMESSAGE 20
#define MAXMOVEOBJECT 200
// Descripteur d'une cellule du dcor.
// Descripteur d'une cellule du décor.
typedef struct
{
short icon;
@ -46,6 +45,21 @@ typedef struct
}
MoveObject;
typedef struct
{
}
GameData;
typedef struct
{
char type;
char data1;
short x;
short y;
short channel;
}
NetMessage;
class CDecor
{
public:
@ -72,45 +86,44 @@ public:
void DrawInfo();
POINT DecorNextAction();
void TreatKeys(int keys);
void SetSpeedX(int speed);
void SetSpeedY(int speed);
void SetJoystickEnable(BOOL bJoystick);
void SetFieldD814(BOOL param_1);
void GetBlupiInfo(BOOL &pbHelico, BOOL &pbJeep, BOOL &pbSkate,
BOOL &pbNage);
int SoundEnviron(int sound, int obstacle);
void PlaySound(int sound, POINT pos, int _foo);
void PlaySound(int sound, POINT pos, BOOL bLocal);
void StopSound(int sound);
void AdaptMotorVehicleSound(POINT pos);
void FUN_05c80(int phase);
POINT* ScreenPosToCelPos(POINT *cel, int _foo, int _bar);
void SetCelPosFromScreenPos(POINT cel);
void SetFieldCC38(int _foo, int _bar);
void DeleteCel(int celX, int celY);
//void PlaceSelectableItem();
//void PlaceItemFromMenu1();
//void PlaceItemFromMenu2();
//void PlaceItemFromMenu3();
//void PlaceItemFromMenu4();
//void PlaceItemFromMenu5();
//void PlaceItemFromMenu6();
//void PlaceItemFromMenu7();
//void PlaceItemFromMenu8();
//void PlaceItemFromMenu9();
//void PlaceItemFromMenu10();
void VehicleSoundsPhase(int phase);
POINT ScreenPosToCelPos(POINT pos);
void SetCelPosFromScreenPos(POINT pos);
void SetFieldCC38AndStuff(int _foo, int _bar);
void DeleteCel(POINT cel);
void PlaceMenuItem(short *pCel, int *pTable, int lastIndex, BYTE flags, int currentIcon, BOOL bRand);
void PlaceItemFromMenu1(POINT cel, int index, BYTE flags, int currentIcon);
void PlaceItemFromMenu2(POINT cel, int index, BYTE flags, int currentIcon);
void PlaceItemFromMenu3(POINT cel, int index, BYTE flags, int currentIcon);
void PlaceItemFromMenu4(POINT cel, int index, BYTE flags, int currentIcon);
void PlaceItemFromMenu5(POINT cel, int index, BYTE flags, int currentIcon);
void PlaceItemFromMenu6(POINT cel, int index, BYTE flags, int currentIcon);
void PlaceItemFromMenu7(POINT cel, int index, BYTE flags, int currentIcon);
void PlaceItemFromMenu8(POINT cel, int index, BYTE flags, int currentIcon);
void PlaceItemFromMenu9(POINT cel, int index, BYTE flags, int currentIcon);
void PlaceItemFromMenu10(POINT cel, int index, BYTE flags, int currentIcon);
char* GetMissionTitle();
void SetMissionTitle(char *str);
int GetRegion();
void SetRegion(int region);
int GetMusic();
void SetMusic(int music);
void GetDim(POINT *out);
POINT GetDim();
void SetDim(POINT dim);
int GetNbVies();
void SetNbVies(int nbVies);
BOOL GetPause();
void SetPause(BOOL bPause);
//void InitializeDoors();
//void MemorizeDoors();
void InitializeDoors(GameData *gameData);
void MemorizeDoors();
void SetAllMissions(BOOL bAllMissions);
void CheatAction(int cheat);
BOOL GetSuperBlupi();
@ -129,12 +142,12 @@ public:
void SetTeam(int team);
void BlupiSearchIcon();
BOOL BlupiIsGround();
void BlupiRect(RECT *out, POINT pos);
RECT BlupiRect(POINT pos);
void BlupiAdjust();
void BlupiBloque(POINT pos, int dir);
BOOL BlupiBloque(POINT pos, int dir);
void BlupiStep();
void BlupiDead(int action, int action2);
void GetPosDecor(POINT *out, POINT pos);
POINT GetPosDecor(POINT pos);
void BlupiAddFifo(POINT pos);
BOOL DecorDetect(RECT rect, BOOL bCaisse);
BOOL TestPath(RECT rect, POINT start, POINT *end);
@ -183,7 +196,7 @@ public:
void FUN_155e0(byte _foo, short _bar);
void TreatNetData();
void DoNetSmooth(int player);
void FUN_15d50();
void NetFUN_15d50();
void FUN_15da0(int rank, short phase);
void NetPlayerCollide(POINT pos, int &result);
void NetMessageIndexFlush();
@ -249,6 +262,8 @@ public:
void OpenGoldsWin();
void DoorsLost();
void SetMission(int mission);
// ?
void GetMissionsCleared();
void SetDemoState(BOOL demoState);
@ -267,11 +282,9 @@ protected:
int m_lastKeyPress;
POINT m_posDecor;
POINT m_dimDecor;
POINT m_selectedCelPos;
int m_CC18;
int m_CC1C;
int m_CC20;
POINT m_posCelHili;
POINT m_dimCelHili;
int m_2ndPositionCalculationSlot;
int m_phase;
int m_term;
@ -279,7 +292,7 @@ protected:
int m_region;
int m_lastRegion;
int m_CC38;
int m_iconLift;
int m_time;
char m_missionTitle[100];
@ -364,21 +377,21 @@ protected:
CJauge m_jauges[2];
int m_blupiLevel;
int m_blupiEnergyUnused;
BOOL m_bHelicopterFlying;
BOOL m_bHelicopterStationary;
BOOL m_bCarMoving;
BOOL m_bCarStationary;
BOOL m_bHelicoMarch;
BOOL m_bHelicoStop;
BOOL m_bJeepMarch;
BOOL m_bJeepStop;
BOOL m_bFoundCle;
BOOL m_bPrivate;
BOOL m_bCheatDoors; // opendoors
BOOL m_bSuperBlupi; // megablupi
BOOL m_bDrawSecret; // showsecret
BOOL m_buildOfficialMissions; // xmission/xnjttjpo
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
int m_blupiSpeedX;
int m_blupiSpeedY;
BOOL m_bJoystick;
int m_bD814;
int m_mission;
BYTE m_doors[200];
int m_nbVies;
@ -399,27 +412,14 @@ protected:
POINT m_voyageEnd;
int m_decorAction;
int m_decorPhase;
int m_lastDecorIcon[200];
int m_lastDecorIndexes[200];
int reserve[11];
BYTE dummy[100000];
};
POINT GetCel (int x, int y);
POINT GetCel (POINT cel, int x, int y);
BOOL IsValid (POINT cel);
POINT GetVector (int direct);
extern int table_multi_goal[];
extern short table_actions[];
BOOL IsValidCel (POINT cel);
POINT GetVector (int direct);

View File

@ -1,21 +0,0 @@
#pragma once
extern int table_shield_blupi[]
{
144,
145,
146,
147,
148,
149,
150,
151,
266,
267,
268,
269,
270,
271,
272,
273
};

View File

@ -1,90 +1,538 @@
#pragma once
extern int table_shield_blupi[]
{
144,
145,
146,
147,
148,
149,
150,
151,
266,
267,
268,
269,
270,
271,
272,
273
};
#include "obstacle.h"
extern int table_shieldloop[]
extern int table_blitz[]
{
274,
275,
276,
277,
278
};
extern int table_shieldtrack[]
{
274,
275,
276,
277,
278,
274,
275,
276,
277,
278,
279,
280,
281,
282,
283,
284,
285,
286,
287,
288
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
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
};
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_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_cle3[12]
{
229, 228, 227, 226, 225, 224, 223, 224, 225, 226,
227, 228
};
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[]
{
11,
203, 204, 205, 206, 207, 208, 207, 206, 205, 204,
203
};
extern int table_ressort[]{ 8, 209, 210, 211, 212, 213, 212, 211, 210 };
extern int table_366b0[]{ 3, 20, 21, 22 };
extern int table_366c0[]{ 4, 16, 17, 18, 19 };
extern int table_366d8[]{ 3, 0x17, 0x18, 0x19 };
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_36520[]{ 3, 0x57, 0x58, 0x59 };
extern int table_36670[]{ 11, 0x4c, 0x4d, 0xc7, 0xc6, 0xc8, 0xc9, 0xeb, 0xec, 0x177, 0x178, 0x179 };
extern int table_366a0[]{ 3, 0x193, 0x191, 0x192 };

777
def.h
View File

@ -9,13 +9,14 @@
#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 LXIMAGE 640 // dimensions de la fenêtre de jeu
#define LYIMAGE 480
#define MAXCELX 200 // nb max de cellules d'un monde
#define MAXCELY 200
#define MAXCELX 100 // nb max de cellules d'un monde
#define MAXCELY 100
#define DIMOBJX 64 // dimensions d'un objet
#define DIMOBJY 64
@ -63,12 +64,39 @@
#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
};
};
// Directions :
#define DIR_LEFT 1
#define DIR_RIGHT 2
namespace Dir {
enum Dir {
Left = 1,
Right
};
};
// Actions :
@ -161,14 +189,114 @@
#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 :
// 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
};
}
// Types :
@ -244,6 +372,85 @@
#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 :
@ -252,6 +459,15 @@
#define STEP_STOPEND 3
#define STEP_RECEDE 4
namespace Step {
enum Step {
StopStart = 1,
Advance,
StopEnd,
Recede
};
}
// Sons :
@ -349,6 +565,103 @@
#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
};
};
//
@ -359,6 +672,16 @@
#define KEY_JUMP (1 << 4)
#define KEY_FIRE (1 << 5)
namespace Key {
enum Key {
Left = 1 << 0,
Right = 1 << 1,
Up = 1 << 2,
Down = 1 << 3,
Jump = 1 << 4,
Fire = 1 << 5
};
};
// Boutons (play) :
@ -649,11 +972,455 @@
#define WM_PHASE_DOQUIT
#define WM_PHASE_GAMER
// Types de gestion de la souris.
#define MOUSETYPEGRA 1
#define MOUSETYPEWIN 2
#define MOUSETYPEWINPOS 3
namespace Object {
enum Object {
Empty = -1,
Hili,
TechSquare_1,
TechSquare_2,
TechSquare_3,
TechSquare_4,
TechSquare_5,
TechSquare_6,
TechSquare_7,
TechSquare_8,
TechSquare_9,
TechSquare_10,
TechSquare_11,
TechSquare_12,
TechSquare_13,
TechSquare_14,
TechTriRight_1,
TechTriRight_2, // 16
TechTriLeft_1,
TechTriLeft_2,
TechSpecial_1,
TechSpecial_2,
TechSpecial_3,
TechSecret_1,
TechSpecial_4,
TechSpecial_5,
TechSpecial_6,
TechSpecial_7,
TechSpecial_8,
TechSpecial_9,
TechSpecial_10,
LiftPoint_1,
LiftPoint_2,
Caisse_1, // 32
Caisse_2,
Caisse_3,
RockSquare_1,
RockSquare_2,
RockSquare_3,
RockSquare_4,
RockSquare_5,
RockSquare_6,
WoodWall_1,
WoodWall_2,
WoodWall_3,
WoodWall_4,
WoodWall_5,
WoodWall_6,
WoodWall_7,
Dream_1, // 48
Dream_2,
Dream_3,
Dream_4,
Dream_5,
Dream_6,
Dream_7,
Dream_8,
Dream_9,
Dream_10,
Dream_11,
Dream_12,
Dream_13,
Dream_14,
Dream_15,
Dream_16,
Dream_17, // 64
Dream_18,
Dream_19,
Dream_20,
Lava_1,
Lava_2,
Lava_3,
Lava_4,
Lava_5,
TechSecret_2,
RockTriLeft_1,
RockTriRight_1,
Support_1,
Support_2,
MechSquare_1,
MechSquare_2,
MechSquare_3, // 80
MechSquare_4,
MechSquare_5,
MechSquare_6,
MechSquare_7,
MechSecret_1,
MechSecret_2,
MechSpecial_1,
MechSpecial_2,
MechSpecial_3,
MechSpecial_4,
WaterSquare_1,
WaterSurf_1,
WaterSurf_2,
WaterSurf_3,
WaterSurf_4,
WaterSquare_2, // 96
WaterSquare_3,
WaterSquare_4,
Splash_1,
Splash_2,
Splash_3,
Splash_4,
Bubble_1,
Bubble_2,
Bubble_3,
Bubble_4,
GrassSquare_1,
GrassLeft,
GrassRight,
WindLeft_1,
WindLeft_2, // 112
WindLeft_3,
WindLeft_4,
WindRight_1,
WindRight_2,
WindRight_3,
WindRight_4,
WindUp_1,
WindUp_2,
WindUp_3,
WindUp_4,
WindDown_1,
WindDown_2,
WindDown_3,
WindDown_4,
FanLeft_1,
FanLeft_2, // 128
FanLeft_3,
FanRight_1,
FanRight_2,
FanRight_3,
FanUp_1,
FanUp_2,
FanUp_3,
FanDown_1,
FanDown_2,
FanDown_3,
Bar_1,
Bookshelf_1,
Bookshelf_2,
Bookshelf_3,
Bookshelf_4,
Bookshelf_5,
RockSquare_7, // 144
RockSquare_8,
RockSquare_9,
RockSquare_10,
RockSquare_11,
RockSquare_12,
RockSquare_13,
RockSquare_14,
RockSquare_15,
RockSquare_16,
RockTriLeft_2,
RockTriRight_2,
RockSquare_17,
GrassSquare_2,
Course_1,
Course_2,
Course_3, // 160
Course_4,
Course_5,
Course_6,
Course_7,
Course_8,
CourseDone_1,
CourseDone_2,
CourseDone_3,
CourseDone_4,
CourseDone_5,
CourseDone_6,
CourseDone_7,
CourseDone_8,
Level_1,
Level_2,
Level_3, // 176
Level_4,
Level_5,
Level_6,
Level_7,
Level_8,
DoorLevel,
DoorCourse,
CourseBack,
RockSecret,
Facade_1,
Facade_2,
Facade_3,
Facade_4,
Facade_5,
Facade_6,
Facade_7, // 192
Roof_1,
Roof_2,
Roof_3,
Roof_4,
Roof_5,
Support_3,
Support_4,
Support_5,
Support_6,
Bar_2,
Marine_1,
Marine_2,
Marine_3,
Marine_4,
Marine_5,
Marine_6, // 208
Spring_1,
Spring_2,
Spring_3,
Spring_4,
Spring_5,
Invisible,
KidsSquare_1,
KidsSquare_2,
KidsSquare_3,
KidsSquare_4,
KidsSquare_5,
KidsSquare_6,
KidsSquare_7,
KidsSquare_8,
KidsSpecial_1,
KidsSpecial_2, // 224
KidsSpecial_3,
KidsSpecial_4,
KidsSpecial_5,
KidsSpecial_6,
KidsSpecial_7,
KidsSquare_9,
KidsSquare_10,
KidsSpecial_8,
KidsSquare_11,
KidsSquare_12,
Support_7,
Support_8,
DitherMask,
Charger_1,
Charger_2,
Charger_3, // 240
Charger_4,
Charger_5,
Charger_6,
Splash_5,
Unk_F5,
CheeseSquare_1,
CheeseSquare_2,
CheeseSquare_3,
CheeseSquare_4,
Pipes_1,
Pipes_2,
Pipes_3,
Pipes_4,
Pipes_5,
Pipes_6,
Pipes_7, // 256
Pipes_8,
Pipes_9,
Pipes_10,
Pipes_11,
Bricks_1,
Bricks_2,
Bricks_3,
CheeseSupport_1,
CheeseSupport_2,
CheeseSupport_3,
CheeseSupport_4,
CheeseSupport_5,
CheeseSupport_6,
CheeseSupport_7,
CheeseSupport_8,
CheeseSupport_9, // 272
CheeseSupport_10,
CheeseSupport_11,
CheeseSupport_12,
CheeseSupport_13,
CheeseSupport_14,
CheeseSupport_15,
CheeseSupport_16,
CheeseSupport_17,
CheeseSupport_18,
CheeseSupport_19,
Bricks_4,
Cave_1,
CaveSupport_1,
CaveSupport_2,
CaveSupport_3,
CaveSupport_4, // 288
CaveSupport_5,
CaveSupport_6,
CaveSupport_7,
CaveSupport_8,
CaveSupport_9,
CaveSupport_10,
CaveSupport_11,
CaveSupport_12,
CaveSupport_13,
CaveSupport_14,
CaveSupport_15,
CaveSupport_16,
Cave_2,
CaveSupport_17,
CaveSupport_18,
LightningMachine, // 304
Lightning_1,
Lightning_2,
Lightning_3,
Lightning_4,
Course_9,
CourseDone_9,
Conveyor_1,
Conveyor_2,
Conveyor_3,
Conveyor_4,
Conveyor_5,
Conveyor_6,
Crusher_1,
Crusher_2,
Crusher_3,
Crusher_4, // 320
Crusher_5,
Crusher_6,
Crusher_7,
Vanish_1,
Vanish_2,
Vanish_3,
Vanish_4,
Vanish_5,
Vanish_6,
Teleporter_1,
Teleporter_2,
Teleporter_3,
Teleporter_4,
DoorRed,
DoorGreen,
DoorBlue, // 336
CaveSecret,
Cave_3,
CheeseSecret,
CheeseSquare_5,
Slime_1,
Slime_2,
Slime_3,
Slime_4,
Slime_5,
Slime_6,
Slime_7,
Slime_8,
Slime_9,
Slime_10,
Slime_11,
Slime_12, // 352
Slime_13,
Slime_14,
Slime_15,
Slime_16,
Slime_17,
Slime_18,
Slime_19,
Slime_20,
Slime_21,
Slime_22,
Slime_23,
FragileBridge_1,
FragileBridge_2,
FragileBridge_3,
FragileBridge_4,
FragileBridge_5, // 368
FragileBridge_6,
FragileBridge_7,
FragileBridge_8,
FragileBridge_9,
SlimeTrapFloor_1,
SlimeTrapFloor_2,
Support_9,
Support_10,
Support_11,
Saw_1,
Saw_2,
Saw_3,
Saw_4,
Saw_5,
Saw_6,
SawSwitchOn, // 382
SawSwitchOff,
Palace_1,
Palace_2,
Palace_3,
Palace_4,
Palace_5,
Palace_6,
Palace_7,
Palace_8,
Palace_9,
Palace_10,
Palace_11,
Palace_12,
PalaceElement_1,
PalaceElement_2,
PalaceElement_3, // 398
SpiderWeb_1,
SpiderWeb_2,
SpiderWeb_3,
SlimeTrapCeiling_1,
SlimeTrapCeiling_2,
SlimeTrapCeiling_3,
SlimeTrapCeiling_4,
SlimeTrapCeiling_5,
SlimeTrapCeiling_6,
SlimeTrapCeiling_7,
Course_10,
Course_11,
Course_12,
Course_13,
Course_14,
CourseDone_10, // 414
CourseDone_11,
CourseDone_12,
CourseDone_13,
CourseDone_14,
DoorTreasure_1,
DoorTreasure_2,
DoorTreasure_3,
DoorTreasure_4,
DoorTreasure_5,
DoorTreasure_6,
DoorTreasure_7,
DoorTreasure_8,
DoorTreasure_9,
DoorTreasure_10,
DoorTreasure_11,
DoorTreasure_12, // 430
DoorTreasure_13,
DoorTreasure_14,
DoorTreasure_15,
DoorTreasure_16,
DoorTreasure_17,
DoorTreasure_18,
DoorTreasure_19,
DoorTreasure_20
};
}

15
event.h
View File

@ -1,6 +1,6 @@
// Event.h
#pragma once
/////////////////////////////////////////////////////////////////////////////
@ -59,6 +59,7 @@ public:
void SetFullScreen(BOOL bFullScreen);
void SetMouseType(int mouseType);
int GetWorld();
int GetWorldGroup();
int GetPhysicalWorld();
int GetImageWorld();
BOOL IsHelpHide();
@ -70,6 +71,7 @@ public:
void RestoreGame();
int MissionBack();
void TableSomething();
void SetNbVies(int nbVies);
int GetButtonIndex(int button);
int GetState(int button);
@ -81,8 +83,9 @@ public:
void SetHide(int button, BOOL bHide);
int GetMenu(int button);
void SetMenu(int button, int menu);
void SomethingDecor();
void FlushInput();
void PauseStatus(UINT pause, int multiplayer);
BOOL IsMouseRelease();
BOOL DrawButtons();
BOOL TextSomething();
@ -116,7 +119,9 @@ public:
void IntroStep();
protected:
void AddPhaseText();
void ReadInput();
void DrawTextCenter(int res, int x, int y, int font=0);
BOOL CreateButtons();
BOOL EventButtons(UINT message, WPARAM wParam, LPARAM lParam);
@ -159,7 +164,7 @@ protected:
int m_mission;
int m_private;
int m_maxMission;
WMessage m_phase;
DWORD m_phase;
int m_index;
int m_playerIndex;
BOOL m_bSchool;
@ -234,7 +239,6 @@ protected:
int m_demoIndex;
int m_demoEnd;
int m_demoNumber;
int m_tryPhase;
BOOL m_bCtrlDown;
POINT m_debugPos;
int m_introTime;
@ -246,7 +250,6 @@ protected:
char m_textInput[100];
char m_pPlayerName[100];
int m_lives;
int m_mission;
int m_multi;
HINSTANCE m_hInstance;
char m_chatZone[100][5];

View File

@ -34,12 +34,12 @@ CJauge::~CJauge()
// Create a new Button.
BOOL CJauge::Create(HWND hWnd, CPixmap *pPixmap, CDecor *pDecor,
BOOL CJauge::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
POINT pos, int type, BOOL bMinimizeRedraw)
{
m_hWnd = hWnd;
m_pPixmap = pPixmap;
m_pDecor = pDecor;
m_pSound = pSound;
m_type = type;
m_bMinimizeRedraw = bMinimizeRedraw;
m_bHide = TRUE;
@ -50,34 +50,44 @@ BOOL CJauge::Create(HWND hWnd, CPixmap *pPixmap, CDecor *pDecor,
m_bRedraw = TRUE;
}
// Dessine un bouton dans son état.
void CJauge::Draw()
{
int part;
RECT rect;
int part;
RECT rect;
if (m_bMinimizeRedraw && !m_bRedraw) return;
m_bRedraw = FALSE;
if (m_bMinimizeRedraw && !m_bRedraw) return;
m_bRedraw = FALSE;
if (m_bHide) // bouton cach<63> ?
{
m_pPixmap->DrawPart(-1, 0, m_pos, rect);
return;
}
int num = m_level * 114 / 100;
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;
}
m_pPixmap->DrawPart(-1, 5, m_pos, rect);
if (num > 0)
{
m_pPixmap->DrawPart(-1, 5, m_pos, rect);
}
part = (m_level*(DIMJAUGEX - 6 - 4)) / 100;
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;
@ -102,6 +112,7 @@ int CJauge::GetType()
return m_type;
}
// Modifie le type.
void CJauge::SetType(int type)
{
@ -128,3 +139,12 @@ void CJauge::SetHide(BOOL bHide)
m_bHide = bHide;
}
POINT CJauge::GetPos()
{
return m_pos;
}
void CJauge::SetRedraw()
{
m_bRedraw = TRUE;
}

View File

@ -1,6 +1,6 @@
// Jauge.h
#pragma once
//////////////////////////////////////////////////////////////////////////

View File

@ -1,43 +1,277 @@
// Network.cpp
//
#include "dplay.h"
#include <windows.h>
#include "decor.h"
#include "event.h"
#include <stdlib.h>
#include <stdio.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;
m_pDPID;
m_bUnk1C;
m_pContext;
m_pSessions2;
m_pUnkC;
m_pSessions;
m_pUnk18;
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()
{
LPDIRECTPLAY2 lpDP;
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_pSessions != NULL)
{
free(m_pSessions);
}
m_pUnkC = NULL;
m_pSessions = NULL;
if (m_sessions.list) free(m_sessions.list);
m_sessions.nb = 0;
* m_sessions.list = NULL;
}
void TraceErrorDP(HRESULT hErr, char *sFile, int nLine)
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 = MAXPLAYERS;
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 < 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.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];
@ -54,15 +288,35 @@ void TraceErrorDP(HRESULT hErr, char *sFile, int nLine)
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_NOAGGREGATION : sprintf(dperr, "DPERR_NOAGGREGATION"); break;
case DPERR_BUFFERTOOSMALL : sprintf(dperr, "DPERR_BUFFERTOOSMALL"); break;
case DPERR_OTHERAPPHASPRIO : sprintf(dperr, "DPERR_OTHERAPPHASPRIO"); break;
case DPERR_UNINITIALIZED : sprintf(dperr, "DPERR_UNINITIALIZED"); 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 in file %s at line %d\n", dperr, sFile, nLine);
sprintf(err, "DirectPlay Error %s\n", dperr);
OutputDebug(err);
}

View File

@ -1,21 +1,76 @@
// Network.h
#pragma once
#include "dplay.h"
/////////////////////////////////////////////////////////////////////////////
#define MAXSESSION 100
#define MAXPLAYERS 4
typedef struct
{
char bIsPresent;
char ready;
char unk_2;
char unk_3;
DPID dpid;
short team;
char name[22];
}
NetPlayer;
typedef struct
{
GUID guid;
char name[100];
}
NamedGUID;
typedef struct
{
int nb;
NamedGUID * list[MAXSESSION];
}
NamedGUIDList;
class CNetwork
{
public:
CNetwork();
~CNetwork();
BOOL Create();
void FreeSessionList();
void FreeSessionList2();
BOOL EnumProviders();
BOOL GetNbProviders();
char * GetProviderName(int index);
BOOL CreateProvider(int index);
void FreeProviderList();
BOOL EnumSessions();
char * GetSessionName(int index);
BOOL JoinSession(int index);
void FreeSessionList();
BOOL CreateSession(char * pName);
BOOL Send(LPVOID lpData, DWORD dwDataSize, DWORD dwFlags);
BOOL Receive(LPVOID pDest, DWORD dwDataSize, LPDWORD lpdwPlayer);
BOOL Close();
void FreeUnknownList();
BOOL IsHost();
protected:
IDirectPlay2 m_pDP;
LPVOID m_pContext;
NetSessionList m_pSessions2;
LPVOID m_pUnkC;
addr m_pUnk18;
NetSessionList m_pSessions;
BOOL m_pUnk1C;
DPID m_pDPID;
NetPlayer m_players[4];
};
LPDIRECTPLAY2 m_pDP;
NamedGUIDList m_providers;
NamedGUIDList m_sessions;
NamedGUIDList m_unknown;
BOOL m_bHost;
DPID m_dpid;
NetPlayer m_players[4];
};
static BOOL EnumProvidersCallback(LPGUID lpguidSP, LPSTR lpSTName,
DWORD dwMajorVersion, DWORD dwMinorVersion, NamedGUIDList * lpContext);
static BOOL EnumSessionsCallback(LPDPSESSIONDESC2 lpThisSD,
LPDWORD lpdwTimeOut, DWORD dwFlags, NamedGUIDList * lpContext);
void TraceErrorDP(HRESULT hErr);

589
obstacle.h Normal file
View File

@ -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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_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
};

View File

@ -75,7 +75,6 @@ protected:
void MouseBackDebug();
RECT MouseRectSprite();
void MouseHotSpot();
BOOL GetTrueColor();
protected:
BOOL m_bFullScreen;

View File

@ -28,13 +28,14 @@ public:
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, int volume, int pan);
BOOL StopSound(int channel);
BOOL PlayImage(int channel, POINT pos, int rank=-1);
BOOL PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename);
BOOL RestartMusic();