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

Progress on CDecor

Added some network code, among other changes.
This commit is contained in:
HMVocaloid 2024-05-30 21:58:09 -04:00
parent 4c9a91f51d
commit 7579449f98
14 changed files with 4436 additions and 44 deletions

526
blupi.cpp
View File

@ -35,11 +35,17 @@ 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'acc<63>s au CD-Rom
BOOL g_bFullScreen = FALSE; // FALSE si mode de test
int g_speedRate = 1;
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<EFBFBD>ral
BOOL g_bActive = TRUE; // is application active ?
BOOL g_bTermInit = FALSE; // initialisation en cours
@ -65,6 +71,7 @@ BOOL ReadConfig (LPSTR lpCmdLine)
char buffer[200];
char* pText;
int nb;
int i;
file = fopen("data\\config.def", "rb");
if ( file == NULL ) return FALSE;
@ -151,5 +158,522 @@ BOOL ReadConfig (LPSTR lpCmdLine)
if ( g_mouseType > 9 ) g_mouseType = 9;
}
pText = strstr(buffer, "Benchmark=");
if ( pText != NULL )
{
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;
}
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;
}
pText = strstr(buffer, "TrueColorBack=");
if ( pText != NULL )
{
i = GetNum(pText+14);
if (i == 8) g_bTrueColor = 0;
if (i == 16) g_bTrueColor = 1;
}
pText = strstr(buffer, "TrueColorDecor=");
if ( pText != NULL )
{
i = GetNum(pText + 15);
if (i == 8) g_bTrueColorDecor = 0;
if (i == 16) g_bTrueColorDecor = 1;
}
return TRUE;
}
}
// Rewrite Variables
void UpdateFrame(void)
{
RECT clip, rcRect;
UINT phase;
POINT posMouse;
int i, term, speed;
g_pPixmap->MouseBackClear(); // enl<6E>ve la souris dans "back"
posMouse = g_pEvent->GetLastMousePos();
phase = g_pEvent->GetPhase();
if ( phase == g_lastPhase &&
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
}
if ( phase == WM_PHASE_INTRO1 ||
phase == WM_PHASE_INTRO2 )
{
g_pEvent->IntroStep();
}
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 ?
{
g_pEvent->DecorAutoShift(posMouse);
g_pDecor->Build(clip, posMouse); // construit juste le d<>cor
}
else
{
if ( !g_pEvent->GetPause() )
{
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
}
}
g_pEvent->DecorAutoShift(posMouse);
g_pDecor->Build(clip, posMouse); // construit le d<>cor
g_pDecor->NextPhase(1); // refait la carte de temps en temps
}
}
if ( phase == WM_PHASE_BUILD )
{
clip.left = POSDRAWX;
clip.top = POSDRAWY;
clip.right = POSDRAWX+DIMDRAWX;
clip.bottom = POSDRAWY+DIMDRAWY;
g_pEvent->DecorAutoShift(posMouse);
g_pDecor->Build(clip, posMouse); // construit le d<>cor
g_pDecor->NextPhase(-1); // refait la carte chaque fois
}
if ( phase == WM_PHASE_INIT )
{
g_pEvent->DemoStep(); // d<>marre <20>v. d<>mo automatique
}
g_pEvent->DrawButtons();
g_lastPhase = phase;
if ( phase == WM_PHASE_H0MOVIE ||
phase == WM_PHASE_H1MOVIE ||
phase == WM_PHASE_H2MOVIE ||
phase == WM_PHASE_PLAYMOVIE ||
phase == WM_PHASE_WINMOVIE )
{
g_pEvent->MovieToStart(); // fait d<>marrer un film si n<>cessaire
}
if ( phase == WM_PHASE_INSERT )
{
g_pEvent->TryInsert();
}
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<67>
}
g_pPixmap->MouseBackDraw(); // remet la souris dans "back"
}
BOOL RestoreGame()
{
if ( g_pPixmap == NULL ) return FALSE;
g_pEvent->RestoreGame();
return g_pPixmap->Restore();
}
BOOL FlushGame()
{
if ( g_pPixmap == NULL ) return FALSE;
return g_pPixmap->Flush();
}
static void FinishObjects(void)
{
if ( g_pMovie != NULL )
{
g_pEvent->StopMovie();
delete g_pMovie;
g_pMovie = NULL;
}
if ( g_pEvent != NULL )
{
delete g_pEvent;
g_pEvent = NULL;
}
if ( g_pDecor != NULL )
{
delete g_pDecor;
g_pDecor = NULL;
}
if (g_pSound != NULL )
{
g_pSound->StopMusic();
delete g_pSound;
g_pSound = NULL;
}
if (g_pNetwork != NULL )
{
delete g_pNetwork;
g_pNetwork = NULL;
}
if ( g_pPixmap != NULL )
{
delete g_pPixmap;
g_pPixmap = NULL;
}
}
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
if ( message == WM_SYSKEYDOWN && wParam == VK_F10 )
{
message = WM_KEYDOWN;
}
if ( message == WM_SYSKEYUP && wParam == VK_F10 )
{
message = WM_KEYUP;
}
if ( g_pEvent != NULL &&
g_pEvent->TreatEvent(message, wParam, lParam) ) return 0;
switch( message )
{
case WM_TIMER:
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_bActive )
{
if ( g_bFullScreen )
{
RestoreGame();
g_lastPhase = 999;
}
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));
g_pPixmap->SavePalette();
g_pPixmap->InitSysPalette();
}
SetWindowText(hWnd, "Blupi");
if ( g_pSound != NULL ) g_pSound->RestartMusic();
}
else
{
if ( g_bFullScreen )
{
FlushGame();
}
SetWindowText(hWnd, "Blupi -- stop");
if ( g_pSound != NULL ) g_pSound->SuspendMusic();
}
return 0;
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_DISPLAYCHANGE:
OutputDebug("Event WM_DISPLAYCHANGE\n");
break;
case WM_QUERYNEWPALETTE:
OutputDebug("Event WM_QUERYNEWPALETTE\n");
break;
case WM_PALETTECHANGED:
OutputDebug("Event WM_PALLETECHANGED\n");
break;
case MM_MCINOTIFY:
OutputDebug("Event MM_MCINOTIFY\n");
if ( g_pEvent->IsMovie() )
{
if ( wParam == MCI_NOTIFY_SUCCESSFUL )
{
g_pEvent->StopMovie();
}
}
else
{
g_pSound->SuspendMusic();
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);
}
}
break;
case WM_LBUTTONDOWN:
GetCursorPos(&mousePos);
ScreenToClient(hWnd, &mousePos);
break;
case WM_DESTROY:
KillTimer(g_hWnd, 1);
FinishObjects();
PostQuitMessage(0);
break;
case WM_SETCURSOR:
// ChangeSprite();
// SetCursor(NULL);
return TRUE;
case WM_UPDATE:
if ( !g_pEvent->IsMovie() )
{
if ( g_bActive )
{
UpdateFrame();
}
g_pPixmap->Display();
}
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
BOOL InitFail(char *msg, BOOL bDirectX)
{
char buffer[100];
if ( bDirectX ) strcpy(buffer, "DirectX Init FAILED\n(while ");
else strcpy(buffer, "Error (");
strcat(buffer, msg);
strcat(buffer, ")");
MessageBox(g_hWnd, buffer, TITLE, MB_OK);
FinishObjects();
DestroyWindow(g_hWnd);
return FALSE;
}
static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASS wc;
POINT totalDim, iconDim;
RECT rcRect;
BOOL bOK;
bOK = ReadConfig(lpCmdLine);
InitHInstance(hInstance);
wc.style = CS_HREDRAW|CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, "IDR_MAINFRAME");
wc.hCursor = LoadCursor(hInstance, "IDC_POINTER");
wc.hbrBackground = GetStockBrush(BLACK_BRUSH);
wc.lpszMenuMane = NAME;
wc.lpszClassName = NAME;
RegisterClass(&wc);
if ( g_bFullScreen )
{
g_hWnd = CreateWindowEx
(
WS_EX_TOPMOST,
NAME,
TITLE,
WS_POPUP,
0, 0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
NULL,
NULL,
hInstance,
NULL
);
}
else
{
int sx, sy;
RECT WindowRect;
sx = GetSystemMetrics(SM_CXSCREEN);
sy = GetSystemMetrics(SM_CYSCREEN);
SetRect(&WindowRect, (sx-LXIMAGE)/2, (sy-LYIMAGE)/2,
(sx+LXIMAGE)/2, (sy+LYIMAGE)/2);
AdjustWindowRect(&WindowRect, WS_POPUPWINDOW|WS_CAPTION, TRUE);
WindowRect.top += GetSystemMetrics(SM_CYCAPTION);
g_hWnd = CreateWindow
(
NAME,
TITLE,
WS_POPUPWINDOW|WS_CAPTION|WS_VISIBLE,
(sx-LXIMAGE)/2, (sy-LYIMAGE)/2,
WindowRect.right - WindowRect.left,
WindowRect.bottom - WindowRect.top,
HWND_DESKTOP,
NULL,
hInstance,
NULL
);
}
if ( !g_hWnd ) return FALSE;
ShowWindow(g_hWnd, nCmdShow);
UpdateWindow(g_hWnd);
SetFocus(g_hWnd);
ChangeSprite(SPRITE_WAIT);
if ( !bOk )
{
return InitFail("Game not correctly installed", FALSE);
}
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 _INTRO
if ( !g_pPixmap->Cache(CHBACK, "image16\\init.blp", totalDim, iconDim, TRUE) )
#else
if ( !g_pPixmap->Cache(CHBACK, "image16\\init.blp", totalDim, iconDim, TRUE) )
#endif
return FALSE;
OutputDebug("SavePalette\n");
g_pPixmap->SavePalette();
OutputDebug("InitSysPalette\n");
g_pPixmap->InitSysPalette();
}
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
if ( !DoInit(hInstance, lpCmdLine, nCmdShow) )
{
return FALSE;
}
SetTimer(g_hWnd, 1, g_timerInterval, NULL);
while ( TRUE )
{
if ( PeekMessage(&msg, NULL, 0,0, PM_NOREMOVE) )
{
if ( !GetMessage(&msg, NULL, 0, 0) )
{
return msg.wParam;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
if ( !g_bActive ) WaitMessage();
}
}
return msg.wParam;
}

View File

@ -18,14 +18,15 @@
// Constructor
CButton:CButton()
CButton::CButton()
{
m_type = 0;
m_bEnable = TRUE;
m_bHide = FALSE;
m_bSomething = 0;
m_state = 0;
m_mouseState = 0;
m_mbMenu = 0;
m_nbMenu = 0;
m_nbToolTips = 0;
m_selMenu = 0;
m_bMouseDown = FALSE;
@ -35,7 +36,7 @@ CButton:CButton()
// Destructor
CButton:~CButton()
CButton::~CButton()
{
}
@ -68,9 +69,12 @@ BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
m_bMinimizeRedraw = bMinimizeRedraw;
m_bEnable = TRUE;
m_bHide = FALSE;
m_bSomething = 0;
m_message = message;
m_pos = pos;
m_dim = iconDim;
m_pos.x = pos.x;
m_pos.y = pos.y;
m_dim.x = iconDim.x;
m_dim.y = iconDim.y;
m_nbMenu = nbMenu;
m_nbToolTips = nbToolTips;
m_selMenu = 0;
@ -144,7 +148,7 @@ void CButton::Draw()
if( m_bEnable )
{
m_pPixmap->DrawIcon(-1, CHBUTTON+m_type, m_mousestatre, m_pos);
m_pPixmap->DrawIcon(-1, CHBUTTON+m_type, m_mousestate, m_pos);
}
else
{
@ -257,7 +261,7 @@ BOOL CButton::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam)
switch( message )
{
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN;
case WM_RBUTTONDOWN:
if ( MouseDown(pos) ) return TRUE;
break;

View File

@ -54,7 +54,8 @@ protected:
int m_toolTips[20]; // info-bulles
int m_nbMenu; // nb de case du sous-menu
int m_nbToolTips; // nb d'info-bulles
int m_selMenu; // sous-menu s<>lectionn<6E>
int m_selMenu;
int m_bSomething; // sous-menu s<>lectionn<6E>
BOOL m_bMouseDown; // TRUE -> bouton souris press<73>
BOOL m_bMinimizeRedraw;
BOOL m_bRedraw; // TRUE -> doit <20>tre redessin<69>

24
decblupi.cpp Normal file
View File

@ -0,0 +1,24 @@
// DecBlupi.cpp
//
#include "DEF.H"
#include "DECOR.H"
#include "ACTION.H"
#include "MISC.H"
#include "RESOURCE.H"
#include "decgoal.h"
void CDecor::BlupiCheat(int cheat)
{
}
void CDecor::GetBlupiHitbox(RECT *out, POINT pos)
{
int rect.top;
int rect.bottom;
int rect.left;
int rect.right;
if
}

View File

@ -56,4 +56,19 @@ CDecor::CDecor()
CDecor::~CDecor()
{
UndoClose();
}
void CDecor::SetTime(int time)
{
m_time = time;
}
int CDecor::GetTime()
{
return m_time;
}
int CDecor::GetTargetLevel(int mission)
{
m_targetMission = mission;
}

668
decor.h Normal file
View File

@ -0,0 +1,668 @@
// Decor.h
#pragma once
#include <Windows.h>
#include "DEF.H"
#include "SOUND.H"
#include "PIXMAP.H"
/////////////////////////////////////////////////////////////////////////////
#define MAXENERGY 4000
#define MAXFIRE 400
#define ICON_HILI_STAT 112
#define ICON_HILI_SEL 113
#define ICON_HILI_ANY 114
#define ICON_HILI_OP 115
#define ICON_HILI_GO 117
#define ICON_HILI_BUILD 118
#define ICON_HILI_ERR 119
// Descripteur d'une cellule du d<>cor.
typedef struct
{
short floorChannel;
short floorIcon;
short objectChannel;
short objectIcon;
short fog; // brouillard
short rankMove; // rang dans m_move
short workBlupi; // rang du blupi travaillant ici
short fire;
}
Cellule;
// Cette structure doit <20>tre la plus petite possible, car
// il en existe un tableau de 100x100 = 10'000 cellules !
// Descripteur d'un blupi anim<69>.
#define MAXBLUPI 100
#define MAXUSED 50
#define MAXLIST 10
typedef struct
{
BOOL bExist; // TRUE -> utilis<69>
BOOL bHili; // TRUE -> s<>lectionn<6E>
short perso; // personnage, voir (*)
short goalAction; // action (long terme)
short goalPhase; // phase (long terme)
POINT goalCel; // cellule vis<69>e (long terme)
POINT passCel; // cellule tranversante
short energy; // <20>nergie restante
POINT cel; // cellule actuelle
POINT destCel; // cellule destination
short action; // action en cours
short aDirect; // direction actuelle
short sDirect; // direction souhait<69>e
POINT pos; // position relative <20> partir de la cellule
short posZ; // d<>placement z
short channel;
short lastIcon;
short icon;
short phase; // phase dans l'action
short step; // pas global
short interrupt; // 0=prioritaire, 1=normal, 2=misc
short clipLeft;
int nbUsed; // nb de points d<>j<EFBFBD> visit<69>s
char nextRankUsed;
POINT posUsed[MAXUSED];
char rankUsed[MAXUSED];
short takeChannel; // objet transport<72>
short takeIcon;
POINT fix; // point fixe (cultive, pont)
short jaugePhase;
short jaugeMax;
short stop; // 1 -> devra stopper
short bArrow; // TRUE -> fl<66>che en dessus de blupi
short bRepeat; // TRUE -> r<>p<EFBFBD>te l'action
short nLoop; // nb de boucles pour GOAL_OTHERLOOP
short cLoop; // boucle en cours
short vIcon; // ic<69>ne variable
POINT goalHili; // but vis<69>
short bMalade; // TRUE -> blupi malade
short bCache; // TRUE -> cach<63> (pas dessin<69>)
short vehicule; // v<>hicule utilis<69> par blupi, voir (**)
char busyCount;
char busyDelay;
char clicCount;
char clicDelay;
char reserve2[2];
short listButton[MAXLIST];
POINT listCel[MAXLIST];
short listParam[MAXLIST];
short repeatLevelHope;
short repeatLevel;
short reserve3[88];
}
Blupi;
// (*) Personnages :
// 0 -> blupi
// 1 -> araign<67>e
// 2 -> virus
// 3 -> tracks
// 4 -> robot
// 5 -> bombe
// 6 -> d<>tonnateur de mine (invisible)
// 7 -> <20>lectro
// 8 -> disciple (robot2)
// (**) V<>hicule :
// 0 -> <20> pied
// 1 -> en bateau
// 2 -> en jeep
// 3 -> armure
// Descripteur d'un d<>cor anim<69>.
#define MAXMOVE 100
#define MOVEICONNB 1000
typedef struct
{
BOOL bExist; // TRUE -> utilis<69>
POINT cel; // cellule du d<>cor
short rankBlupi; // blupi travaillant ici
BOOL bFloor; // TRUE -> floor, FALSE -> object
short channel;
short icon;
short maskChannel;
short maskIcon;
short phase; // phase pour pMoves ou pIcon
short rankMoves; // *nb,dx,dy,...
short rankIcons; // *nb,i,i,...
short total; // nb total d'<27>tapes
short delai; // d<>lai entre deux pas
short stepY; // pas vertical *100
short cTotal;
short cDelai;
}
Move;
#define MAXLASTDRAPEAU 50
class CDecor
{
public:
CDecor();
~CDecor();
// Arrange.cpp
void ArrangeFloor(POINT cel);
void ArrangeMur(POINT cel, int &icon, int index);
void ArrangeBuild(POINT cel, int &channel, int &icon);
void ArrangeObject(POINT cel);
BOOL ArrangeFillTestFloor(POINT cel1, POINT cel2);
BOOL ArrangeFillTest(POINT pos);
void ArrangeFillPut(POINT pos, int channel, int icon);
void ArrangeFillSearch(POINT pos);
void ArrangeFill(POINT pos, int channel, int icon, BOOL bFloor);
void ArrangeBlupi();
// Obstacle.cpp
void SearchFloor(int rank, int icon, POINT cel, int *pBits);
void SearchObject(int rank, int icon, POINT cel, int *pBits);
void AjustFloor(int rank, int icon, POINT cel, int *pBits);
void AjustObject(int rank, int icon, POINT cel, int *pBits);
BOOL IsFreeDirect(POINT cel, int direct, int rank);
BOOL IsFreeCelObstacle(POINT cel);
BOOL IsFreeCelFloor(POINT cel, int rank);
BOOL IsFreeCelGo(POINT cel, int rank);
BOOL IsFreeCelHili(POINT cel, int rank);
BOOL IsFreeCel(POINT cel, int rank);
BOOL IsFreeCelDepose(POINT cel, int rank);
BOOL IsFreeCelEmbarque(POINT cel, int rank, int &action, POINT &limit);
BOOL IsFreeCelDebarque(POINT cel, int rank, int &action, POINT &limit);
BOOL IsFreeJump(POINT cel, int direct, int rank, int &action);
BOOL IsFreeGlisse(POINT cel, int direct, int rank, int &action);
int DirectSearch(POINT cel, POINT goal);
void FlushUsed(int rank);
void AddUsedPos(int rank, POINT pos);
BOOL IsUsedPos(int rank, POINT pos);
BOOL SearchBestBase(int rank, int &action, POINT &newCel, int &direct);
BOOL SearchBestPass(int rank, int &action);
BOOL IsWorkableObject(POINT cel, int rank);
BOOL SearchOtherObject(int rank, POINT initCel, int action,
int distMax, int channel,
int firstIcon1, int lastIcon1,
int firstIcon2, int lastIcon2,
POINT &foundCel, int &foundIcon);
BOOL SearchOtherDrapeau(int rank, POINT initCel, int distMax,
POINT &foundCel, int &foundIcon);
BOOL SearchOtherBateau(int rank, POINT initCel, int distMax,
POINT &foundCel, int &foundIcon);
BOOL IsSpiderObject(int icon);
BOOL SearchSpiderObject(int rank, POINT initCel, int distMax,
POINT &foundCel, int &foundIcon);
BOOL IsTracksObject(int icon);
BOOL SearchTracksObject(int rank, POINT initCel, int distMax,
POINT &foundCel, int &foundIcon);
BOOL IsRobotObject(int icon);
BOOL SearchRobotObject(int rank, POINT initCel, int distMax,
POINT &foundCel, int &foundIcon,
int &foundAction);
BOOL IsBombeObject(int icon);
BOOL SearchBombeObject(int rank, POINT initCel, int distMax,
POINT &foundCel, int &foundIcon);
BOOL SearchElectroObject(int rank, POINT initCel, int distMax,
POINT &foundCel, int &foundIcon);
BOOL IsUsineBuild(int rank, POINT cel);
BOOL IsUsineFree(int rank, POINT cel);
BOOL IsFireCel(POINT cel);
BOOL IsVirusCel(POINT cel);
int IsBuildPont(POINT &cel, int &iconBuild);
BOOL IsBuildBateau(POINT cel, int &direct);
void InitDrapeau();
void AddDrapeau(POINT cel);
void SubDrapeau(POINT cel);
BOOL TestDrapeau(POINT cel);
// DecBlupi.cpp
void BlupiFlush();
int BlupiCreate(POINT cel, int action, int direct,
int perso, int energy);
BOOL BlupiDelete(POINT cel, int perso=-1);
void BlupiDelete(int rank);
void BlupiKill(int exRank, POINT cel, int type);
BOOL BlupiIfExist(int rank);
void BlupiCheat(int cheat);
void BlupiActualise(int rank);
void BlupiAdaptIcon(int rank);
void BlupiPushFog(int rank);
void BlupiSound(int rank, int sound, POINT pos, BOOL bStop=FALSE);
void BlupiInitAction(int rank, int action, int direct=-1);
void BlupiChangeAction(int rank, int action, int direct=-1);
void ListFlush(int rank);
int ListGetParam(int rank, int button, POINT cel);
BOOL ListPut(int rank, int button, POINT cel, POINT cMem);
void ListRemove(int rank);
int ListSearch(int rank, int button, POINT cel, int &textForButton);
BOOL RepeatAdjust(int rank, int button, POINT &cel, POINT &cMem,
int param, int list);
void GoalStart(int rank, int action, POINT cel);
BOOL GoalNextPhase(int rank);
void SetTotalTime(int total);
int GetTotalTime();
void GoalInitJauge(int rank);
void GoalInitPassCel(int rank);
void GoalAdjustCel(int rank, int &x, int &y);
BOOL GoalNextOp(int rank, short *pTable);
void GoalUnwork(int rank);
void GoalStop(int rank, BOOL bError=FALSE, BOOL bSound=TRUE);
BOOL BlupiIsGoalUsed(POINT cel);
void BlupiStartStopRayon(int rank, POINT startCel, POINT endCel);
BOOL BlupiRotate(int rank);
BOOL BlupiNextAction(int rank);
void BlupiNextGoal(int rank);
void BlupiStep(BOOL bFirst);
void BlupiGetRect(int rank, RECT &rect);
int GetTargetBlupi(POINT pos);
void BlupiDeselect();
void BlupiDeselect(int rank);
void BlupiSetArrow(int rank, BOOL bArrow);
void InitOutlineRect();
void BlupiHiliDown(POINT pos, BOOL bAdd=FALSE);
void BlupiHiliMove(POINT pos, BOOL bAdd=FALSE);
void BlupiHiliUp(POINT pos, BOOL bAdd=FALSE);
void BlupiDrawHili();
int GetDefButton(POINT cel);
BOOL BlupiGoal(int rank, int button, POINT cel, POINT cMem);
void BlupiGoal(POINT cel, int button);
void BlupiDestCel(int rank);
BOOL IsTracksHere(POINT cel, BOOL bSkipInMove);
BOOL IsBlupiHereEx(POINT cel1, POINT cel2, int exRank, BOOL bSkipInMove);
BOOL IsBlupiHereEx(POINT cel, int exRank, BOOL bSkipInMove);
BOOL IsBlupiHere(POINT cel, BOOL bSkipInMove);
BOOL IsBlupiHere(POINT cel, int direct, BOOL bSkipInMove);
void GetLevelJauge(int *pLevels, int *pTypes);
BOOL IsWorkBlupi(int rank);
void BlupiGetButtons(POINT pos, int &nb, int *pButtons, int *pErrors, int &perso);
void TerminatedInit();
int IsTerminated();
Term* GetTerminated();
// DecMove.cpp
void MoveFlush();
int MoveMaxFire();
void MoveFixInit();
BOOL MoveCreate(POINT cel, int rankBlupi, BOOL bFloor,
int channel, int icon,
int maskChannel, int maskIcon,
int total, int delai, int stepY,
BOOL bMisc=FALSE, BOOL bNotIfExist=FALSE);
BOOL MoveAddMoves(POINT cel, int rankMoves);
BOOL MoveAddIcons(POINT cel, int rankIcons, BOOL bContinue=FALSE);
BOOL MoveStartFire(POINT cel);
void MoveProxiFire(POINT cel);
void MoveFire(int rank);
void MoveStep(BOOL bFirst);
void MoveFinish(POINT cel);
void MoveFinish(int rankBlupi);
BOOL MoveIsUsed(POINT cel);
BOOL MoveGetObject(POINT cel, int &channel, int &icon);
BOOL MovePutObject(POINT cel, int channel, int icon);
// DecIO.cpp
BOOL Write(int rank, BOOL bUser, int world, int time, int total);
BOOL Read(int rank, BOOL bUser, int &world, int &time, int &total);
BOOL FileExist(int rank, BOOL bUser, int &world, int &time, int &total);
void Flush();
// DecMap.cpp
void MapInitColors();
POINT ConvCelToMap(POINT cel);
POINT ConvMapToCel(POINT pos);
BOOL MapMove(POINT pos);
void MapPutCel(POINT pos);
BOOL GenerateMap();
// DecStat.cpp
void StatisticInit();
void StatisticUpdate();
int StatisticGetBlupi();
int StatisticGetFire();
void StatisticDraw();
void GenerateStatictic();
BOOL StatisticDown(POINT pos, int fwKeys);
BOOL StatisticMove(POINT pos, int fwKeys);
BOOL StatisticUp(POINT pos, int fwKeys);
int StatisticDetect(POINT pos);
// Chemin.cpp
void CheminMemPos(int exRank);
BOOL CheminTestPos(POINT pos, int &rank);
int CheminARebours(int rank);
void CheminFillTerrain(int rank);
BOOL CheminTestDirection(int rank, int pos, int dir,
int &next, int &ampli,
int &cout, int &action);
BOOL CheminCherche(int rank, int &action);
BOOL IsCheminFree(int rank, POINT dest, int button);
// Decor.cpp
void SetShiftOffset(POINT offset);
POINT ConvCelToPos(POINT cel);
POINT ConvPosToCel(POINT pos, BOOL bMap=FALSE);
POINT ConvPosToCel2(POINT pos);
void Create(HWND hWnd, CSound *pSound, CPixmap *pPixmap);
void Init(int channel, int icon);
void InitAfterBuild();
void ResetHili();
BOOL LoadImages();
void ClearFog();
void ClearFire();
void SetBuild(BOOL bBuild);
void EnableFog(BOOL bEnable);
BOOL GetInvincible();
void SetInvincible(BOOL bInvincible);
BOOL GetSuper();
void SetSuper(BOOL bSuper);
void FlipOutline();
BOOL PutFloor(POINT cel, int channel, int icon);
BOOL PutObject(POINT cel, int channel, int icon);
BOOL GetFloor(POINT cel, int &channel, int &icon);
BOOL GetObject(POINT cel, int &channel, int &icon);
BOOL SetFire(POINT cel, BOOL bFire);
void SetCoin(POINT coin, BOOL bCenter=FALSE);
POINT GetCoin();
POINT GetHome();
void MemoPos(int rank, BOOL bRecord);
void SetTime(int time);
int GetTime();
void SetMusic(int music);
int GetMusic();
void SetSkill(int skill);
int GetSkill();
void SetRegion(int region);
int GetRegion();
void SetInfoMode(BOOL bInfo);
BOOL GetInfoMode();
void SetInfoHeight(int height);
int GetInfoHeight();
int GetTargetLevel();
char* GetButtonExist();
void BuildPutBlupi();
void BuildMoveFloor(int x, int y, POINT pos, int rank);
void BuildMoveObject(int x, int y, POINT pos, int rank);
void BuildGround(RECT clip);
void Build(RECT clip, POINT posMouse);
void NextPhase(int mode);
int CountFloor(int channel, int icon);
int CelOkForAction(POINT cel, int action, int rank,
int icons[4][4],
POINT &celOutline1,
POINT &celOutline2);
int CelOkForAction(POINT cel, int action, int rank);
int GetHiliRankBlupi(int nb);
void CelHili(POINT pos, int action);
void CelHiliButton(POINT cel, int button);
void CelHiliRepeat(int list);
int GetResHili(POINT posMouse);
void HideTooltips(BOOL bHide);
void UndoOpen();
void UndoClose();
void UndoCopy();
void UndoBack();
BOOL IsUndo();
protected:
BOOL GetSeeBits(POINT cel, char *pBits, int index);
int GetSeeIcon(char *pBits, int index);
protected:
HWND m_hWnd;
CSound* m_pSound;
CPixmap* m_pPixmap;
CNetwork* m_pNetwork;
Object m_objects[100][100];
Explo m_explos[100][100];
Perso m_persos[200];
int m_input;
int m_previousInput;
POINT m_cameraPos;
POINT m_worldDims;
POINT m_selectedCelPos;
WMessage m_phrase;
int m_targetMission;
int m_missionTitle;
int m_nbCases;
int m_caseIndexes[200];
int m_nbSomethings;
int m_somethingIndexes;
POINT m_pos;
POINT m_safePos;
Action m_action;
int m_direction;
int m_actionFrameCount;
POINT m_velocity;
Icon4 m_blupiIcon;
/*
undefined
undefined
undefined
undefined
*/
IconChannel m_blupiChannel;
POINT m_activeConveyorVelocity;
int m_activeLiftIndex;
BOOL m_bPlayerHasControl;
BOOL m_bIsFalling;
BOOL m_bHelicopter;
BOOL m_bHovercraft;
BOOL m_bJeep;
BOOL m_bTank;
BOOL m_bSkateboard;
BOOL m_bInDeepWater;
BOOL m_bInSurfaceWater;
BOOL m_bInWind;
BOOL m_bIsHangingFromBar;
BOOL m_bHeadache;
BOOL m_bShield;
BOOL m_bLollipop;
BOOL m_bPowercharge;
BOOL m_bInvisible;
BOOL m_bInverter;
BOOL m_bWaspSting;
BOOL m_bCrushed;
BOOL m_bUseSafePosition;
BOOL m_bIsTerminating;
int m_glue;
int m_keys;
int m_personalBombs;
int m_dynamite;
int m_powerEnergy;
int m_queuedActionFrames;
Action m_queuedAction;
int m_nbSafePositions;
POINT m_safePositions[13];
int m_bMulti;
int m_team;
int m_netPacketsSent;
int m_netPacketsSent2;
int m_netPacketsRecieved;
int m_netPacketsRecieved2;
SoundEvent m_soundEvents[20];
int m_soundEventIndex1;
char m_messages[4][100];
int m_air;
int m_energyUnused;
BOOL m_bHelicopterFlying;
BOOL m_bHelicopterStationary;
BOOL m_bCarMoving;
BOOL m_bCarStationary;
BOOL m_bWorldComplete;
BOOL m_bPrivate;
BOOL m_AllMissions; // opendoors
BOOL m_bInvincible; // megablupi
BOOL m_bShowSecret; // showsecret
BOOL m_bAccessBuild; // xmission/xnjttjpo
BOOL m_bNetPacked; // netpacked
BOOL m_bNetMovePredict; // ynosmooth
BOOL m_bNetDebug; // znetdebug
int m_mission;
BYTE m_missionsCleared[180];
BYTE m_worldsCleared[20];
int m_lives;
int m_chestsCollected;
int m_chestsTotal;
POINT m_cameraTargetPos;
POINT m_cameraTargetOffset;
int m_flyupIcon;
int m_flyupChannel;
int m_flyupFrameCount;
int m_flyupFrameTotal;
POINT m_flyupStartPos;
POINT m_flyupEndPos;
BOOL m_bScreenShake;
int m_screenShakeIndex;
int m_menuSelections[112];
BYTE m_overloadProtection[100000];
Cellule* m_pUndoDecor;
Cellule m_decor[MAXCELX/2][MAXCELY/2];
short m_rankBlupi[MAXCELX][MAXCELY];
Blupi m_blupi[MAXBLUPI];
Move m_move[MAXMOVE];
POINT m_celCoin; // cellule sup/gauche
POINT m_celHome; // pour touche Home
POINT m_celHili;
POINT m_celOutline1;
POINT m_celOutline2;
POINT m_shiftOffset;
int m_iconHili[4][4];
int m_rankHili; // rang du blupi vis<69>
BOOL m_bHiliRect;
POINT m_p1Hili; // coins rectangle de s<>lection
POINT m_p2Hili;
int m_shiftHili;
int m_nbBlupiHili; // nb de blupi s<>lectionn<6E>s
int m_rankBlupiHili; // rang blupi s<>lectionn<6E>
BOOL m_bFog; // TRUE -> brouillard (jeu)
BOOL m_bBuild; // TRUE -> construction
BOOL m_bInvincible; // TRUE -> cheat code
BOOL m_bSuper; // TRUE -> cheat code
short m_colors[100];
int m_time; // temps relatif global
int m_timeConst; // temps relatif global constant
int m_timeFlipOutline; // temps quand basculer mode outline
int m_totalTime; // temps total pass<73> sur une partie
int m_phase; // phase pour la carte
POINT m_celArrow; // cellule avec fl<66>che
BOOL m_bOutline;
BOOL m_bGroundRedraw;
char m_buttonExist[MAXBUTTON];
int m_statNb; // nb de statistiques
int m_statFirst; // premi<6D>re statistique visible
int m_bStatUp; // fl<66>che up statistique
int m_bStatDown; // fl<66>che down statistique
int m_statHili; // statistique survol<6F>e
BOOL m_bStatRecalc; // TRUE -> recalcule les statistiques
BOOL m_bStatRedraw; // TRUE -> redessine les statistiques
int m_nbStatHach; // nb de hachures
int m_nbStatHachBlupi; // hachures occup<75>es par blupi
int m_nbStatHachPlanche;// hachures occup<75>es par planches
int m_nbStatHachTomate; // hachures occup<75>es par tomates
int m_nbStatHachMetal; // hachures occup<75>es par m<>tal
int m_nbStatHachRobot; // hachures occup<75>es par robot
int m_nbStatHome; // nb de maisons
int m_nbStatHomeBlupi; // maisons occup<75>es par blupi
int m_nbStatRobots; // nb d'ennemis
Term m_term; // conditions pour gagner
int m_winCount; // compteur avant gagn<67>
int m_winLastHachBlupi; // dernier nombre atteint
int m_winLastHachPlanche;// dernier nombre atteint
int m_winLastHachTomate;// dernier nombre atteint
int m_winLastHachMetal; // dernier nombre atteint
int m_winLastHachRobot; // dernier nombre atteint
int m_winLastHome; // dernier nombre atteint
int m_winLastHomeBlupi; // dernier nombre atteint
int m_winLastRobots; // dernier nombre atteint
int m_music; // num<75>ro musique
int m_region; // num<75>ro r<>gion (*)
int m_lastRegion; // num<75>ro derni<6E>re r<>gion
int m_blupiHere;
POINT m_lastDrapeau[MAXLASTDRAPEAU];
BOOL m_bHideTooltips; // TRUE -> menu pr<70>sent
char m_text[50];
POINT m_textLastPos;
int m_textCount;
int m_skill;
BOOL m_bInfo;
int m_infoHeight;
POINT m_memoPos[4];
BYTE m_cheminWork[MAXCELX*MAXCELY];
int m_cheminNbPos;
POINT m_cheminPos[MAXBLUPI*2];
int m_cheminRank[MAXBLUPI*2];
BOOL m_bFillFloor;
int m_fillSearchChannel;
int m_fillSearchIcon;
int m_fillPutChannel;
int m_fillPutIcon;
char* m_pFillMap;
int SetBlupiChannel();
int GetBlupiChannel();
int GetTargetLevel(int mission);
BOOL GetShowSecret();
void SetShowSecret(BOOL secret);
void GetBlupiHitbox(RECT *out, POINT pos);
};
// (*) R<>gions :
// 0 -> normal
// 1 -> palmier
// 2 -> hiver
// 3 -> sapin
/////////////////////////////////////////////////////////////////////////////
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[];

618
def.h Normal file
View File

@ -0,0 +1,618 @@
// Def.h
//
#pragma once
#include <Windows.h>
#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 LXIMAGE 640 // dimensions de la fen<65>tre de jeu
#define LYIMAGE 480
#define POSDRAWX 144 // surface de dessin
#define POSDRAWY 15
#define DIMDRAWX 480
#define DIMDRAWY 450
#define POSMAPX 8 // surface pour la carte
#define POSMAPY 15
#define DIMMAPX 128
#define DIMMAPY 128
#define MAXCELX 200 // nb max de cellules d'un monde
#define MAXCELY 200
#define DIMCELX 60 // dimensions d'une cellule (d<>cor)
#define DIMCELY 30
#define DIMOBJX 120 // dimensions d'un objet
#define DIMOBJY 120
#define DIMBLUPIX 60 // dimensions de blupi
#define DIMBLUPIY 60
#define SHIFTBLUPIY 5 // petit d<>calage vers le haut
#define DIMBUTTONX 40 // dimensions d'un button
#define DIMBUTTONY 40
#define DIMJAUGEX 124 // dimensions de la jauge
#define DIMJAUGEY 22
#define POSSTATX 12 // statistiques
#define POSSTATY 220
#define DIMSTATX 60
#define DIMSTATY 30
#define DIMTEXTX 16 // dimensions max d'un caract<63>re
#define DIMTEXTY 16
#define DIMLITTLEX 16 // dimensions max d'un petit caract<63>re
#define DIMLITTLEY 12
#define CHBACK 0
#define CHFLOOR 1
#define CHOBJECT 2
#define CHOBJECTo 3
#define CHBLUPI 4
#define CHHILI 5
#define CHFOG 6
#define CHMASK1 7
#define CHLITTLE 8
#define CHMAP 9
#define CHBUTTON 10
#define CHGROUND 11
#define CHJAUGE 12
#define CHTEXT 13
#define CHBIGNUM 14
#define FOGHIDE 4
// Directions :
#define DIRECT_E (0*16) // est
#define DIRECT_SE (1*16) // sud-est
#define DIRECT_S (2*16) // sud
#define DIRECT_SO (3*16) // sud-ouest
#define DIRECT_O (4*16) // ouest
#define DIRECT_NO (5*16) // nord-ouest
#define DIRECT_N (6*16) // nord
#define DIRECT_NE (7*16) // nord-est
// NO
// O | N
// \ | /
// \ | /
// \|/
// SO -------o------- NE
// /|\
// / | \
// / | \
// S | E
// (y) SE (x)
// Actions :
#define ACTION_STOP 0 // arr<72>t
#define ACTION_STOPf 1 // arr<72>t fatigu<67>
#define ACTION_MARCHE 2 // marche
#define ACTION_MARCHEf 3 // marche fatigu<67>
#define ACTION_BUILD 4 // construit
#define ACTION_PIOCHE 5 // pioche
#define ACTION_ENERGY 6 // prend de l'<27>nergie
#define ACTION_TAKE 8 // fait sauter un objet sur la t<>te (est)
#define ACTION_DEPOSE 9 // repose l'objet sur la t<>te (est)
#define ACTION_SCIE 10 // scie du bois
#define ACTION_BRULE 11 // blupi crame !
#define ACTION_TCHAO 12 // blupi disparait !
#define ACTION_MANGE 13 // blupi mange
#define ACTION_NAISSANCE 14 // naissance
#define ACTION_SAUTE2 15 // saute par-dessus un obstacle
#define ACTION_SAUTE3 16 // saute par-dessus un obstacle
#define ACTION_SAUTE4 17 // saute par-dessus un obstacle
#define ACTION_SAUTE5 18 // saute par-dessus un obstacle
#define ACTION_PONT 19 // pousse un pont
#define ACTION_MISC1 20 // divers 1 (hausse les <20>paules)
#define ACTION_MISC2 21 // divers 2 (grat-grat)
#define ACTION_MISC3 22 // divers 3 (yoyo)
#define ACTION_MISC1f 23 // divers 1 fatigu<67> (bof-bof)
#define ACTION_GLISSE 24 // glisse en marchant
#define ACTION_BOIT 25 // blupi boit
#define ACTION_LABO 26 // blupi travaille dans son laboratoire
#define ACTION_DYNAMITE 27 // blupi fait p<>ter la dynamite
#define ACTION_DELAY 28 // blupi attend un frame
#define ACTION_CUEILLE1 29 // blupi cueille des fleurs
#define ACTION_CUEILLE2 30 // blupi cueille des fleurs
#define ACTION_MECHE 31 // blupi se bouche les oreilles
#define ACTION_STOPb 32 // arr<72>t en bateau
#define ACTION_MARCHEb 33 // avance en bateau
#define ACTION_STOPj 34 // arr<72>t en jeep
#define ACTION_MARCHEj 35 // avance en jeep
#define ACTION_ELECTRO 36 // blupi <20>lectrocut<75>
#define ACTION_GRILLE1 37 // blupi grille (phase 1)
#define ACTION_GRILLE2 38 // blupi grille (phase 2)
#define ACTION_GRILLE3 39 // blupi grille (phase 3)
#define ACTION_MISC4 40 // divers 4 (ferme les yeux)
#define ACTION_CONTENT 41 // blupi est content
#define ACTION_ARROSE 42 // blupi arrose
#define ACTION_BECHE 43 // blupi b<>che
#define ACTION_CUEILLE3 44 // blupi cueille des fleurs
#define ACTION_BUILDBREF 45 // construit
#define ACTION_BUILDSEC 46 // construit
#define ACTION_BUILDSOURD 47 // construit
#define ACTION_BUILDPIERRE 48 // construit
#define ACTION_PIOCHEPIERRE 49 // pioche
#define ACTION_PIOCHESOURD 50 // pioche
#define ACTION_MISC5 51 // divers 5 (oh<6F>)
#define ACTION_TELEPORTE1 52 // t<>l<EFBFBD>porte
#define ACTION_TELEPORTE2 53 // t<>l<EFBFBD>porte
#define ACTION_TELEPORTE3 54 // t<>l<EFBFBD>porte
#define ACTION_STOPa 55 // arr<72>t armure
#define ACTION_MARCHEa 56 // marche armure
#define ACTION_ARMUREOPEN 57 // ouvre armure
#define ACTION_ARMURECLOSE 58 // ferme armure
#define ACTION_SAUTE1 59 // saute dans la jeep
#define ACTION_MISC6 60 // divers 6 (diabolo)
#define ACTION_A_STOP 100 // araign<67>e: arr<72>t
#define ACTION_A_MARCHE 101 // araign<67>e: marche
#define ACTION_A_SAUT 102 // araign<67>e: saute
#define ACTION_A_GRILLE 103 // araign<67>e: grille dans rayon
#define ACTION_A_POISON 105 // araign<67>e: empoison<6F>e
#define ACTION_A_MORT1 106 // araign<67>e: meurt
#define ACTION_A_MORT2 107 // araign<67>e: meurt
#define ACTION_A_MORT3 108 // araign<67>e: meurt
#define ACTION_V_STOP 200 // virus: arr<72>t
#define ACTION_V_MARCHE 201 // virus: marche
#define ACTION_V_GRILLE 202 // virus: grille dans rayon
#define ACTION_T_STOP 300 // tracks: arr<72>t
#define ACTION_T_MARCHE 301 // tracks: marche
#define ACTION_T_ECRASE 302 // tracks: <20>crase un objet
#define ACTION_R_STOP 400 // robot: arr<72>t
#define ACTION_R_MARCHE 401 // robot: marche
#define ACTION_R_APLAT 402 // robot: applatit
#define ACTION_R_BUILD 403 // robot: construit
#define ACTION_R_DELAY 404 // robot: construit
#define ACTION_R_CHARGE 405 // robot: recharge
#define ACTION_R_ECRASE 406 // robot: <20>crase un objet
#define ACTION_B_STOP 500 // bombe: arr<72>t
#define ACTION_B_MARCHE 501 // bombe: marche
#define ACTION_D_DELAY 600 // d<>tonnateur: attend
#define ACTION_E_STOP 700 // <20>lectro: arr<72>t
#define ACTION_E_MARCHE 701 // <20>lectro: marche
#define ACTION_E_DEBUT 702 // <20>lectro: d<>bute
#define ACTION_E_RAYON 703 // <20>lectro: rayonne
#define ACTION_D_STOP 800 // disciple: arr<72>t
#define ACTION_D_MARCHE 801 // disciple: marche
#define ACTION_D_BUILD 802 // disciple: construit
#define ACTION_D_PIOCHE 803 // disciple: pioche
#define ACTION_D_SCIE 804 // disciple: scie du bois
#define ACTION_D_TCHAO 805 // disciple: disparait !
#define ACTION_D_CUEILLE1 806 // disciple: cueille des fleurs
#define ACTION_D_CUEILLE2 807 // disciple: cueille des fleurs
#define ACTION_D_MECHE 808 // disciple: se bouche les oreilles
#define ACTION_D_ARROSE 809 // disciple: arrose
#define ACTION_D_BECHE 810 // disciple: b<>che
// Sons :
#define SOUND_CLICK 0
#define SOUND_BOING 1
#define SOUND_OK1 2
#define SOUND_OK2 3
#define SOUND_OK3 4
#define SOUND_GO1 5
#define SOUND_GO2 6
#define SOUND_GO3 7
#define SOUND_TERM1 8
#define SOUND_TERM2 9
#define SOUND_TERM3 10
#define SOUND_COUPTERRE 11
#define SOUND_COUPTOC 12
#define SOUND_SAUT 13
#define SOUND_HOP 14
#define SOUND_SCIE 15
#define SOUND_FEU 16
#define SOUND_BRULE 17
#define SOUND_TCHAO 18
#define SOUND_MANGE 19
#define SOUND_NAISSANCE 20
#define SOUND_A_SAUT 21
#define SOUND_A_HIHI 22
#define SOUND_PLOUF 23
#define SOUND_BUT 24
#define SOUND_RAYON1 25
#define SOUND_RAYON2 26
#define SOUND_VIRUS 27
#define SOUND_GLISSE 28
#define SOUND_BOIT 29
#define SOUND_LABO 30
#define SOUND_DYNAMITE 31
#define SOUND_PORTE 32
#define SOUND_FLEUR 33
#define SOUND_T_MOTEUR 34
#define SOUND_T_ECRASE 35
#define SOUND_PIEGE 36
#define SOUND_AIE 37
#define SOUND_A_POISON 38
#define SOUND_R_MOTEUR 39
#define SOUND_R_APLAT 40
#define SOUND_R_ROTATE 41
#define SOUND_R_CHARGE 42
#define SOUND_B_SAUT 43
#define SOUND_BATEAU 44
#define SOUND_JEEP 45
#define SOUND_MINE 46
#define SOUND_USINE 47
#define SOUND_E_RAYON 48
#define SOUND_E_TOURNE 49
#define SOUND_ARROSE 50
#define SOUND_BECHE 51
#define SOUND_D_BOING 52
#define SOUND_D_OK 53
#define SOUND_D_GO 54
#define SOUND_D_TERM 55
#define SOUND_BOING1 56
#define SOUND_BOING2 57
#define SOUND_BOING3 58
#define SOUND_OK4 59
#define SOUND_OK5 60
#define SOUND_OK6 61
#define SOUND_OK1f 62
#define SOUND_OK2f 63
#define SOUND_OK3f 64
#define SOUND_OK1e 65
#define SOUND_OK2e 66
#define SOUND_OK3e 67
#define SOUND_GO4 68
#define SOUND_GO5 69
#define SOUND_GO6 70
#define SOUND_TERM4 71
#define SOUND_TERM5 72
#define SOUND_TERM6 73
#define SOUND_COUPSEC 74
#define SOUND_COUPPIERRE 75
#define SOUND_COUPSOURD 76
#define SOUND_COUPBREF 77
#define SOUND_OPEN 78
#define SOUND_CLOSE 79
#define SOUND_TELEPORTE 80
#define SOUND_ARMUREOPEN 81
#define SOUND_ARMURECLOSE 82
#define SOUND_WIN 83
#define SOUND_LOST 84
#define SOUND_MOVIE 99
// 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
// Erreurs :
#define ERROR_MISC 1
#define ERROR_GROUND 2
#define ERROR_FREE 3
#define ERROR_PONTOP 4
#define ERROR_PONTTERM 5
#define ERROR_TOURISOL 6
#define ERROR_TOUREAU 7
#define ERROR_TELE2 8
// Lutins pour la souris
#define SPRITE_ARROW 1
#define SPRITE_POINTER 2
#define SPRITE_MAP 3
#define SPRITE_ARROWU 4
#define SPRITE_ARROWD 5
#define SPRITE_ARROWL 6
#define SPRITE_ARROWR 7
#define SPRITE_ARROWUL 8
#define SPRITE_ARROWUR 9
#define SPRITE_ARROWDL 10
#define SPRITE_ARROWDR 11
#define SPRITE_WAIT 12
#define SPRITE_EMPTY 13
#define SPRITE_FILL 14
// User define message
#define 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)
#define WM_ACTION_GO (WM_USER+30)
#define WM_ACTION_ABAT1 (WM_USER+31)
#define WM_ACTION_ABAT2 (WM_USER+32)
#define WM_ACTION_ABAT3 (WM_USER+33)
#define WM_ACTION_ABAT4 (WM_USER+34)
#define WM_ACTION_ABAT5 (WM_USER+35)
#define WM_ACTION_ABAT6 (WM_USER+36)
#define WM_ACTION_BUILD1 (WM_USER+37)
#define WM_ACTION_BUILD2 (WM_USER+38)
#define WM_ACTION_BUILD3 (WM_USER+39)
#define WM_ACTION_BUILD4 (WM_USER+40)
#define WM_ACTION_BUILD5 (WM_USER+41)
#define WM_ACTION_BUILD6 (WM_USER+42)
#define WM_ACTION_STOP (WM_USER+43)
#define WM_ACTION_CARRY (WM_USER+44)
#define WM_ACTION_DEPOSE (WM_USER+45)
#define WM_ACTION_ROC1 (WM_USER+46)
#define WM_ACTION_ROC2 (WM_USER+47)
#define WM_ACTION_ROC3 (WM_USER+48)
#define WM_ACTION_ROC4 (WM_USER+49)
#define WM_ACTION_ROC5 (WM_USER+50)
#define WM_ACTION_ROC6 (WM_USER+51)
#define WM_ACTION_ROC7 (WM_USER+52)
#define WM_ACTION_MUR (WM_USER+53)
#define WM_ACTION_CULTIVE (WM_USER+54)
#define WM_ACTION_CULTIVE2 (WM_USER+55)
#define WM_ACTION_MANGE (WM_USER+56)
#define WM_ACTION_MAKE (WM_USER+57)
#define WM_ACTION_BUILD (WM_USER+58)
#define WM_ACTION_PALIS (WM_USER+59)
#define WM_ACTION_NEWBLUPI (WM_USER+60)
#define WM_ACTION_PONTE (WM_USER+61)
#define WM_ACTION_PONTS (WM_USER+62)
#define WM_ACTION_PONTO (WM_USER+63)
#define WM_ACTION_PONTN (WM_USER+64)
#define WM_ACTION_PONTEL (WM_USER+65)
#define WM_ACTION_PONTSL (WM_USER+66)
#define WM_ACTION_PONTOL (WM_USER+67)
#define WM_ACTION_PONTNL (WM_USER+68)
#define WM_ACTION_TOUR (WM_USER+69)
#define WM_ACTION_CARRY2 (WM_USER+70)
#define WM_ACTION_DEPOSE2 (WM_USER+71)
#define WM_ACTION_MANGE2 (WM_USER+72)
#define WM_ACTION_BOIT (WM_USER+73)
#define WM_ACTION_BOIT2 (WM_USER+74)
#define WM_ACTION_LABO (WM_USER+75)
#define WM_ACTION_FLEUR1 (WM_USER+76)
#define WM_ACTION_FLEUR2 (WM_USER+77)
#define WM_ACTION_DYNAMITE (WM_USER+78)
#define WM_ACTION_DYNAMITE2 (WM_USER+79)
#define WM_ACTION_T_DYNAMITE (WM_USER+80)
#define WM_ACTION_FLEUR3 (WM_USER+81)
#define WM_ACTION_R_BUILD1 (WM_USER+82)
#define WM_ACTION_R_BUILD2 (WM_USER+83)
#define WM_ACTION_R_BUILD3 (WM_USER+84)
#define WM_ACTION_R_BUILD4 (WM_USER+85)
#define WM_ACTION_R_MAKE1 (WM_USER+86)
#define WM_ACTION_R_MAKE2 (WM_USER+87)
#define WM_ACTION_R_MAKE3 (WM_USER+88)
#define WM_ACTION_R_MAKE4 (WM_USER+89)
#define WM_ACTION_R_BUILD5 (WM_USER+90)
#define WM_ACTION_R_MAKE5 (WM_USER+91)
#define WM_ACTION_BATEAUE (WM_USER+92)
#define WM_ACTION_BATEAUS (WM_USER+93)
#define WM_ACTION_BATEAUO (WM_USER+94)
#define WM_ACTION_BATEAUN (WM_USER+95)
#define WM_ACTION_BATEAUDE (WM_USER+96)
#define WM_ACTION_BATEAUDS (WM_USER+97)
#define WM_ACTION_BATEAUDO (WM_USER+98)
#define WM_ACTION_BATEAUDN (WM_USER+99)
#define WM_ACTION_BATEAUAE (WM_USER+100)
#define WM_ACTION_BATEAUAS (WM_USER+101)
#define WM_ACTION_BATEAUAO (WM_USER+102)
#define WM_ACTION_BATEAUAN (WM_USER+103)
#define WM_ACTION_MJEEP (WM_USER+104)
#define WM_ACTION_DJEEP (WM_USER+105)
#define WM_ACTION_DRAPEAU (WM_USER+106)
#define WM_ACTION_DRAPEAU2 (WM_USER+107)
#define WM_ACTION_DRAPEAU3 (WM_USER+108)
#define WM_ACTION_EXTRAIT (WM_USER+109)
#define WM_ACTION_FABJEEP (WM_USER+110)
#define WM_ACTION_FABMINE (WM_USER+111)
#define WM_ACTION_MINE (WM_USER+112)
#define WM_ACTION_MINE2 (WM_USER+113)
#define WM_ACTION_R_BUILD6 (WM_USER+114)
#define WM_ACTION_R_MAKE6 (WM_USER+115)
#define WM_ACTION_E_RAYON (WM_USER+116)
#define WM_ACTION_ELECTRO (WM_USER+117)
#define WM_ACTION_ELECTROm (WM_USER+118)
#define WM_ACTION_GRILLE (WM_USER+119)
#define WM_ACTION_MAISON (WM_USER+120)
#define WM_ACTION_FABDISC (WM_USER+121)
#define WM_ACTION_A_MORT (WM_USER+122)
#define WM_ACTION_REPEAT (WM_USER+123)
#define WM_ACTION_TELEPORTE00 (WM_USER+124)
#define WM_ACTION_TELEPORTE10 (WM_USER+125)
#define WM_ACTION_TELEPORTE01 (WM_USER+126)
#define WM_ACTION_TELEPORTE11 (WM_USER+127)
#define WM_ACTION_FABARMURE (WM_USER+128)
#define WM_ACTION_MARMURE (WM_USER+129)
#define WM_ACTION_DARMURE (WM_USER+130)
#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)
#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)
#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)
#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_PREV (WM_USER+600)
#define WM_NEXT (WM_USER+601)
#define WM_MOVIE (WM_USER+602)
// Types de gestion de la souris.
#define MOUSETYPEGRA 1
#define MOUSETYPEWIN 2
#define MOUSETYPEWINPOS 3
// Conditions pour gagner.
typedef struct
{
short bHachBlupi; // blupi sur dalle hachur<75>e
short bHachPlanche; // planches sur dalle hachur<75>e
short bStopFire; // feu <20>teint
short nbMinBlupi; // nb de blupi n<>cessaires
short nbMaxBlupi; // nb de blupi n<>cessaires
short bHomeBlupi; // blupi <20> la maison
short bKillRobots; // plus d'ennemis
short bHachTomate; // tomates sur dalle hachur<75>e
short bHachMetal; // m<>tal sur dalle hachur<75>e
short bHachRobot; // robot sur dalle hachur<75>e
short reserve[14];
}
Term;

2154
dplay.h Normal file

File diff suppressed because it is too large Load Diff

325
event.cpp
View File

@ -18,6 +18,7 @@
#include "action.h"
#include "text.h"
#include "misc.h"
#include "network.h"
#define DEF_TIME_HELP 10000
@ -50,17 +51,33 @@ DescInfo;
// Toutes les premi<6D>res lettres doivent
// <20>tre diff<66>rentes !
static char cheat_code[9][20] =
static char cheat_code[25][60] =
{
"VISION", // 0
"POWER", // 1
"LONESOME", // 2
"ALLMISSIONS", // 3
"QUICK", // 4
"HELPME", // 5
"INVINCIBLE", // 6
"SUPERBLUPI", // 7
"CONSTRUIRE", // 8 (CPOTUSVJSF)
"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",
};
@ -72,7 +89,7 @@ static Phase table[] =
{
{
WM_PHASE_TESTCD,
"image\\init.blp",
"image16\\init.blp",
FALSE,
{
{
@ -94,7 +111,7 @@ static Phase table[] =
{
WM_PHASE_INTRO2,
"image\\intro2.blp",
"image16\\intro2.blp",
FALSE,
{
{
@ -105,7 +122,7 @@ static Phase table[] =
{
WM_PHASE_INIT,
"image\\init.blp",
"image16\\init.blp",
FALSE,
{
{
@ -195,7 +212,7 @@ static Phase table[] =
{
WM_PHASE_INFO,
"image\\info%.3d.blp",
"image16\\info%.3d.blp",
FALSE,
{
{
@ -291,7 +308,7 @@ static Phase table[] =
{
WM_PHASE_STOP,
"image\\stop%.3d.blp",
"image16\\stop%.3d.blp",
FALSE,
{
{
@ -340,7 +357,7 @@ static Phase table[] =
{
WM_PHASE_HELP,
"image\\help.blp",
"image16\\help.blp",
TRUE,
{
{
@ -381,7 +398,7 @@ static Phase table[] =
{
WM_PHASE_SETUP,
"image\\setup.blp",
"image16\\setup.blp",
FALSE,
{
{
@ -460,7 +477,7 @@ static Phase table[] =
{
WM_PHASE_SETUPp,
"image\\setup.blp",
"image16\\setup.blp",
FALSE,
{
{
@ -539,7 +556,7 @@ static Phase table[] =
{
WM_PHASE_READ,
"image\\read.blp",
"image16\\read.blp",
FALSE,
{
{
@ -616,7 +633,7 @@ static Phase table[] =
{
WM_PHASE_WRITE,
"image\\write.blp",
"image16\\write.blp",
FALSE,
{
{
@ -693,7 +710,7 @@ static Phase table[] =
{
WM_PHASE_WRITEp,
"image\\write.blp",
"image16\\write.blp",
FALSE,
{
{
@ -770,7 +787,7 @@ static Phase table[] =
{
WM_PHASE_LOST,
"image\\lost.blp",
"image16\\lost.blp",
TRUE,
{
{
@ -787,7 +804,7 @@ static Phase table[] =
{
WM_PHASE_WIN,
"image\\win.blp",
"image16\\win.blp",
TRUE,
{
{
@ -906,7 +923,7 @@ static Phase table[] =
{
WM_PHASE_BUTTON,
"image\\button.blp",
"image16\\button00.blp",
TRUE,
{
{
@ -1222,7 +1239,7 @@ static Phase table[] =
{
WM_PHASE_MUSIC,
"image\\music.blp",
"image16\\music.blp",
TRUE,
{
{
@ -1299,7 +1316,7 @@ static Phase table[] =
{
WM_PHASE_REGION,
"image\\region.blp",
"image16\\region.blp",
TRUE,
{
{
@ -1395,7 +1412,7 @@ static Phase table[] =
{
WM_PHASE_BYE,
"image\\bye.blp",
"image16\\bye.blp",
FALSE,
{
{
@ -1529,16 +1546,17 @@ void CEvent::SetMouseType(int mouseType)
// Creates the event handler.
void CEvent::Create(HWND hWnd, CPixmap *pPixmap, CDecor *pDecor,
void CEvent::Create(HINSTANCE hInstance, HWND hWnd, CPixmap *pPixmap, CDecor *pDecor,
CSound *pSound, CMovie *pMovie, CNetwork *pNetwork)
{
POINT pos;
m_hWnd = hWnd;
m_pPixmap = pPixmapl
m_pPixmap = pPixmap;
m_pDecor = pDecor;
m_pSound = pSound;
m_pMovie = pMovie;
m_pNetwork = pNetwork;
ReadInfo();
}
@ -1574,7 +1592,7 @@ int CEvent::GetState(int button)
void CEvent::SetState(int button, int state)
{
ind index;
int index;
index = GetButtonIndex(button);
if ( index < 0 ) return;
@ -1611,3 +1629,250 @@ int CEvent::GetMenu(int button)
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);
}
/*
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;
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_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]);
}
}
}
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_WAIT;
}
else
{
m_mouseSprite = MousePosToSprite(GetMousePos());
}
m_pPixmap->SetMouseSprite(m_mouseSprite, m_bDemoPlay);
ChangeSprite(m_mouseSprite);
}
/*
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::GetWorld()
{
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;
}
UINT CDecor::GetPhase()
{
return m_phase;
}
void CEvent::TryInsert()
{
if ( m_tryInsertCount == 0 )
{
ChangePhase(m_tryPhase);
}
else
{
m_tryInsertCount --;
}
}
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;
}
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 )
{
DeleteFile("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_pDemoBufferm sizeof(DemoEvent), m_demoIndex, file);
fclose(file);
}
free(m_pDemoBuffer);
m_pDemoBuffer = NULL;
}
m_bDemoRec = FALSE;
m_demoTime = 0;
}

21
event.h
View File

@ -53,7 +53,7 @@ public:
~CEvent();
POINT GetMousePos();
void Create(HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, CSound *pSound, CMovie *pMovie);
void Create(HINSTANCE hInstance, HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, CSound *pSound, CMovie *pMovie, CNetwork *pNetwork);
void SetFullScreen(BOOL bFullScreen);
void SetMouseType(int mouseType);
int GetWorld();
@ -142,11 +142,12 @@ protected:
int m_mission;
int m_private;
int m_maxMission;
int m_phase;
WMessage m_phase;
int m_index;
BOOL m_bSchool;
BOOL m_bPrivate;
BOOL m_bAccesBuild;
BOOL m_bMulti;
BOOL m_bAccessBuild;
BOOL m_bFullScreen;
int m_mouseType;
HWND m_hWnd;
@ -154,6 +155,7 @@ protected:
CDecor* m_pDecor;
CSound* m_pSound;
CMovie* m_pMovie;
CNetwork* m_pNetwork;
char m_movieToStart[MAX_PATH];
int m_phaseAfterMovie;
CButton m_buttons[MAXBUTTON];
@ -217,4 +219,17 @@ protected:
BOOL m_bCtrlDown;
POINT m_debugPos;
int m_introTime;
int m_joyID;
BOOL m_gamer;
int m_textHiliStart;
int m_textHiliEnd;
int m_textCursorIndex;
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];
char m_text[100];
};

54
network.cpp Normal file
View File

@ -0,0 +1,54 @@
// 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"
CNetwork::CNetwork()
{
m_field0_0x0;
m_field8_0x20;
m_field7_0x1c;
m_pUnkC;
m_pSessions;
m_field3_0xc;
m_field4_0x10;
m_field5_0x14;
m_field6_0x18;
}
void TraceErrorDP(HRESULT hErr, char *sFile, int nLine)
{
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_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;
default : sprintf(dperr, "Unknown Error"); break;
}
sprintf(err, "DirectPlay Error %s in file %s at line %d\n", dperr, sFile, nLine);
OutputDebug(err);
}

19
network.h Normal file
View File

@ -0,0 +1,19 @@
class CNetwork
{
public:
CNetwork();
~CNetwork();
BOOL Create();
protected:
int m_field0_0x0;
int m_field8_0x20;
int m_field7_0x1c;
int m_pUnkC;
void m_pSessions;
int m_field3_0xc;
void m_field4_0x10;
int m_field5_0x14;
int m_field6_0x18;
NetPlayer m_players[4];
};

View File

@ -22,6 +22,9 @@ CPixmap::CPixmap()
int i;
m_bFullScreen = FALSE;
m_bBenchmarkSuccess = TRUE;
m_bTrueColor = FALSE;
m_bTrueColorDecor = FALSE;
m_mouseType = MOUSETYPEGRA;
m_bDebug = TRUE;
m_bPalette = TRUE;
@ -294,6 +297,26 @@ BOOL CPixmap::InitSysPalette()
return TRUE;
}
BOOL CPixmap::GetTrueColor()
{
return m_bTrueColor;
}
void CPixmap::SetBenchmarkSuccess(BOOL bSuccess)
{
m_bBenchmarkSuccess = bSuccess;
}
void CPixmap::SetTrueColor(BOOL bTrueColor)
{
m_bTrueColor = bTrueColor;
}
void CPixmap::SetTrueColorDecor(BOOL bTrueColorDecor)
{
m_bTrueColorDecor = bTrueColorDecor;
}
// Indique si l'on utilise une palette.
BOOL CPixmap::IsPalette()
@ -693,7 +716,10 @@ void CPixmap::SetTransparent2(int channel, COLORREF color1, COLORREF color2)
void CPixmap::SetClipping(RECT clip)
{
m_clipRect = clip;
m_clipRect.left = clip.left;
m_clipRect.top = clip.top;
m_clipRect.right = clip.right;
m_clipRect.bottom = clip.bottom;
}
// Retourne la r<>gion de clipping.

View File

@ -70,6 +70,11 @@ protected:
void MouseBackDebug();
RECT MouseRectSprite();
void MouseHotSpot();
BOOL GetTrueColor();
void SetBenchmarkSuccess(BOOL bSuccess);
void SetTrueColor(BOOL bTrueColor);
void SetTrueColorDecor(BOOL bTrueColorDecor);
protected:
BOOL m_bFullScreen;
@ -107,5 +112,5 @@ protected:
char m_filename[MAXIMAGE][20];
POINT m_totalDim[MAXIMAGE];
POINT m_iconDim[MAXIMAGE];
DDBLTFX m_DDbltfx
DDBLTFX m_DDbltfx
}