From f58de3167ffb94ee3c2f22eb4f383422bf835a72 Mon Sep 17 00:00:00 2001 From: HMVocaloid <66088611+HMVocaloid@users.noreply.github.com> Date: Tue, 21 May 2024 12:47:46 -0400 Subject: [PATCH] Added decor.h and updated blupi.cpp --- blupi.cpp | 273 ++++++++++++++++++++++- decor.h | 656 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 928 insertions(+), 1 deletion(-) create mode 100644 decor.h diff --git a/blupi.cpp b/blupi.cpp index 21aea1a..6fda44f 100644 --- a/blupi.cpp +++ b/blupi.cpp @@ -169,6 +169,15 @@ BOOL ReadConfig (LPSTR lpCmdLine) 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; } @@ -187,7 +196,7 @@ void UpdateFrame(void) phase = g_pEvent->GetPhase(); if ( phase == g_lastPhase && - phase == WM_PHASE_PLAY ) + phase == WM_PHASE_PLAY || phase == WM_PHASE_PLAYTEST || phase == WM_PHASE_BUILD ) { //? rcRect.left = POSDRAWX; //? rcRect.top = POSDRAWY; @@ -337,6 +346,160 @@ static void FinishObjects(void) } } +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_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->InitSyspallete(); + } + 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_QUERYNEWPALLETE: + 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_SUCESSFUL ) + { + 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_SETCUROR: +// 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]; @@ -352,6 +515,114 @@ BOOL InitFail(char *msg, BOOL bDirectX) 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) { diff --git a/decor.h b/decor.h new file mode 100644 index 0000000..3a58b8d --- /dev/null +++ b/decor.h @@ -0,0 +1,656 @@ +// Decor.h + +#pragma once + +#include + +#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 �tre la plus petite possible, car +// il en existe un tableau de 100x100 = 10'000 cellules ! + +// Descripteur d'un blupi anim�. +#define MAXBLUPI 100 +#define MAXUSED 50 +#define MAXLIST 10 + +typedef struct +{ + BOOL bExist; // TRUE -> utilis� + BOOL bHili; // TRUE -> s�lectionn� + + short perso; // personnage, voir (*) + + short goalAction; // action (long terme) + short goalPhase; // phase (long terme) + POINT goalCel; // cellule vis�e (long terme) + POINT passCel; // cellule tranversante + + short energy; // �nergie restante + + POINT cel; // cellule actuelle + POINT destCel; // cellule destination + short action; // action en cours + short aDirect; // direction actuelle + short sDirect; // direction souhait�e + + POINT pos; // position relative � 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� visit�s + char nextRankUsed; + POINT posUsed[MAXUSED]; + char rankUsed[MAXUSED]; + + short takeChannel; // objet transport� + short takeIcon; + + POINT fix; // point fixe (cultive, pont) + + short jaugePhase; + short jaugeMax; + short stop; // 1 -> devra stopper + short bArrow; // TRUE -> fl�che en dessus de blupi + short bRepeat; // TRUE -> r�p�te l'action + short nLoop; // nb de boucles pour GOAL_OTHERLOOP + short cLoop; // boucle en cours + short vIcon; // ic�ne variable + POINT goalHili; // but vis� + short bMalade; // TRUE -> blupi malade + short bCache; // TRUE -> cach� (pas dessin�) + short vehicule; // v�hicule utilis� 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�e +// 2 -> virus +// 3 -> tracks +// 4 -> robot +// 5 -> bombe +// 6 -> d�tonnateur de mine (invisible) +// 7 -> �lectro +// 8 -> disciple (robot2) + +// (**) V�hicule : +// 0 -> � pied +// 1 -> en bateau +// 2 -> en jeep +// 3 -> armure + + +// Descripteur d'un d�cor anim�. +#define MAXMOVE 100 +#define MOVEICONNB 1000 + +typedef struct +{ + BOOL bExist; // TRUE -> utilis� + + 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'�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 &li, + 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(); + + 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; + BOOL m_bInvincible; + BOOL m_bShowSecret; + BOOL m_bAccessBuild; + BOOL m_bNetPacked; + BOOL m_bNetMovePredict; + BOOL m_bNetDebug; + int m_mission; + short m_missionsCleared[90]; + short m_worldsCleared[10]; + 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; + 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� + 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�s + int m_rankBlupiHili; // rang blupi s�lectionn� + 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� sur une partie + int m_phase; // phase pour la carte + POINT m_celArrow; // cellule avec fl�che + BOOL m_bOutline; + BOOL m_bGroundRedraw; + char m_buttonExist[MAXBUTTON]; + int m_statNb; // nb de statistiques + int m_statFirst; // premi�re statistique visible + int m_bStatUp; // fl�che up statistique + int m_bStatDown; // fl�che down statistique + int m_statHili; // statistique survol�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�es par blupi + int m_nbStatHachPlanche;// hachures occup�es par planches + int m_nbStatHachTomate; // hachures occup�es par tomates + int m_nbStatHachMetal; // hachures occup�es par m�tal + int m_nbStatHachRobot; // hachures occup�es par robot + int m_nbStatHome; // nb de maisons + int m_nbStatHomeBlupi; // maisons occup�es par blupi + int m_nbStatRobots; // nb d'ennemis + Term m_term; // conditions pour gagner + int m_winCount; // compteur avant gagn� + 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�ro musique + int m_region; // num�ro r�gion (*) + int m_lastRegion; // num�ro derni�re r�gion + int m_blupiHere; + POINT m_lastDrapeau[MAXLASTDRAPEAU]; + BOOL m_bHideTooltips; // TRUE -> menu pr�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; +}; + +// (*) 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[];. + + + + + + + + + +