From 9f48cb6d67eb62f53066fd229728def9e215e097 Mon Sep 17 00:00:00 2001 From: jummy Date: Sun, 8 Sep 2024 02:19:16 -0500 Subject: [PATCH] lil bit sillay --- src/blupi.cpp | 23 ++- src/button.cpp | 43 ++-- src/button.h | 6 +- src/decblock.cpp | 5 - src/decblupi.cpp | 5 - src/decio.cpp | 8 +- src/decor.cpp | 2 +- src/decor.h | 34 ++- src/def.h | 8 +- src/event.cpp | 529 ++++++++++++++++++++++++++++++++++++++--------- src/event.h | 10 +- src/pixmap.cpp | 98 ++++----- src/sound.cpp | 105 ++++++++-- src/sound.h | 5 +- src/text.cpp | 2 +- 15 files changed, 653 insertions(+), 230 deletions(-) diff --git a/src/blupi.cpp b/src/blupi.cpp index 8ba0794..3e05896 100644 --- a/src/blupi.cpp +++ b/src/blupi.cpp @@ -423,6 +423,15 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, static HINSTANCE hInstance; POINT mousePos, totalDim, iconDim; +#if 0 + if (message != WM_TIMER) + { + char s[100]; + sprintf(s, "message=%d,%d\n", message, wParam); + OutputDebug(s); + } +#endif + // La touche F10 envoie un autre message pour activer // le menu dans les applications Windows standard ! //[The F10 key sends another message to activate the menu in standard Windows apps!] @@ -438,10 +447,6 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, if (g_pEvent != NULL && g_pEvent->TreatEvent(message, wParam, lParam)) return 0; - char buf[25]; // DEBUG - sprintf(buf, "%d\n", message); - OutputDebug(buf); - switch (message) { case WM_TIMER: @@ -487,7 +492,7 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, g_pPixmap->SavePalette(); g_pPixmap->InitSysPalette(); } - SetWindowTextA(hWnd, "Blupi"); + SetWindowText(hWnd, "Blupi"); if (g_pSound != NULL) g_pSound->RestartMusic(); } else // désactive ? @@ -496,7 +501,7 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, { FlushGame(); } - SetWindowTextA(hWnd, "Blupi -- stop"); + SetWindowText(hWnd, "Blupi -- stop"); if (g_pSound != NULL) g_pSound->SuspendMusic(); } return 0; @@ -578,7 +583,11 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, break; case WM_DESTROY: - timeKillEvent((UINT)g_hWnd); +#if MMTIMER + timeKillEvent((UINT)g_updateTimer); +#else + KillTimer(g_hWnd, 1); +#endif FinishObjects(); PostQuitMessage(0); break; diff --git a/src/button.cpp b/src/button.cpp index 1c512e9..8ddfb18 100644 --- a/src/button.cpp +++ b/src/button.cpp @@ -46,7 +46,7 @@ CButton::~CButton() // Create a new Button BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, - POINT pos, int type, int* pMenu, int nbMenu, int* pToolTips, int nbToolTips, BOOL bMinimizeRedraw, int region, UINT message) + POINT pos, int type, BOOL bMinimizeRedraw, UINT message) { POINT iconDim; int i, icon; @@ -85,40 +85,22 @@ BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, return TRUE; } -void CButton::SetIconMenu(int* icon, int iconMenu) +void CButton::SetIconMenu(int* pIcons, int nbMenu) { - int i = iconMenu; - int* iconMenu2; - - if (0 < iconMenu) + for (int i = 0; i < nbMenu; i++) { - iconMenu2 = m_iconMenu; - for (i = 0; i < iconMenu; i++) - { - icon++; - m_iconMenu[i] = icon[i]; - } + m_iconMenu[i] = pIcons[i]; } - m_nbMenu = iconMenu; + m_nbMenu = nbMenu; } -void CButton::SetToolTips(int* menu, int menuTooltips) +void CButton::SetToolTips(int* pToolTips, int nbToolTips) { - int toolTips; - int* menuTool; - int i; - - if (0 < menuTooltips) + for (int i = 0; i < nbToolTips; i++) { - menuTool = m_toolTips; - i = menuTooltips; - for (i = 0; i < menuTooltips; i++) - { - menu++; - m_toolTips[i] = menu[i]; - } + m_toolTips[i] = pToolTips[i]; } - m_nbToolTips = menuTooltips; + m_nbToolTips = nbToolTips; } // Draw a button in its state @@ -130,12 +112,11 @@ void CButton::Draw() RECT rect; if (m_bMinimizeRedraw && !m_bRedraw) return; - m_bRedraw = FALSE, m_bSomething = FALSE; + m_bRedraw = FALSE; if (m_bHide) // Hidden button { - pos.y = m_pos.y; - pos.x = m_pos.x; + pos = m_pos; return; } @@ -145,7 +126,7 @@ void CButton::Draw() } else { - m_pPixmap->DrawIcon(-1, CHBUTTON + m_type, 4, m_pos); + m_pPixmap->DrawIcon(-1, CHBUTTON + m_type, m_bSomething ? 5 : 4, m_pos); } if (m_nbMenu == 0) return; diff --git a/src/button.h b/src/button.h index 3237937..834266e 100644 --- a/src/button.h +++ b/src/button.h @@ -13,9 +13,9 @@ public: ~CButton(); BOOL Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, - POINT pos, int type, int* pMenu, int nbMenu, int* pToolTips, int nbToolTips, BOOL bMinimizeRedraw, int region, UINT message); - void SetIconMenu(int* icon, int iconMenu); - void SetToolTips(int* menu, int menuTooltips); + POINT pos, int type, BOOL bMinimizeRedraw, UINT message); + void SetIconMenu(int* pIcons, int nbIcons); + void SetToolTips(int* pToolTips, int nbTooltips); void Draw(); void Redraw(); diff --git a/src/decblock.cpp b/src/decblock.cpp index d4e18fb..a659d10 100644 --- a/src/decblock.cpp +++ b/src/decblock.cpp @@ -549,11 +549,6 @@ void CDecor::ModifDecor(POINT pos, int icon, BOOL bMulti) m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon = icon; } -void CDecor::ModifDecor(POINT pos, int icon) -{ - ModifDecor(pos, icon, TRUE); -} - BOOL CDecor::IsRightBorder(POINT pos, POINT offset) { return FALSE; // TODO diff --git a/src/decblupi.cpp b/src/decblupi.cpp index 9c51af7..4ba5780 100644 --- a/src/decblupi.cpp +++ b/src/decblupi.cpp @@ -4098,11 +4098,6 @@ BOOL CDecor::DecorDetect(RECT rect, BOOL bCaisse) return FALSE; } -BOOL CDecor::DecorDetect(RECT rect) -{ - return DecorDetect(rect, TRUE); -} - BOOL CDecor::TestPath(RECT rect, POINT start, POINT end) { int num = abs(end.x - start.x); diff --git a/src/decio.cpp b/src/decio.cpp index 2989164..1074613 100644 --- a/src/decio.cpp +++ b/src/decio.cpp @@ -18,12 +18,12 @@ void CDecor::GetMissionPath(char* str, int user, int mission, BOOL bUser) return; } -BOOL CDecor::CurrentWrite(int gamer, int mission, BOOL bUser) +BOOL CDecor::Write(int gamer, int mission, BOOL bUser) { return FALSE; //TODO } -BOOL CDecor::CurrentRead(int gamer, int mission, BOOL bUser) +BOOL CDecor::Read(int gamer, int mission, BOOL bUser) { return FALSE; //TODO } @@ -38,12 +38,12 @@ BOOL CDecor::MissionStart(int gamer, int mission, BOOL bUser) return FALSE; //TODO } -BOOL CDecor::Read(int gamer, int mission, BOOL *pbMission, BOOL *pbPrivate) +BOOL CDecor::CurrentRead(int gamer, int mission, BOOL *pbMission, BOOL *pbPrivate) { return FALSE; //TODO } -BOOL CDecor::Write(int gamer, int mission, char* param3) +BOOL CDecor::CurrentWrite(int gamer, int mission, char* param3) { return FALSE; //TODO } diff --git a/src/decor.cpp b/src/decor.cpp index 8cb0998..6f5a14c 100644 --- a/src/decor.cpp +++ b/src/decor.cpp @@ -983,7 +983,7 @@ void CDecor::SetJoystickEnable(BOOL bJoystick) m_bJoystick = bJoystick; } -void CDecor::SetFieldD814(BOOL param) +void CDecor::SetDemoPlay(BOOL param) { m_bD814 = param; } diff --git a/src/decor.h b/src/decor.h index a747f29..705f8e0 100644 --- a/src/decor.h +++ b/src/decor.h @@ -64,6 +64,24 @@ typedef struct } NetMessage; +typedef struct +{ + short majRev; + short minRev; + short reserve1[100]; + POINT posDecor; + POINT dimDecor; + short world; + short music; + short region; + short reserve2[51]; + POINT blupiPos[4]; + int blupiDir[4]; + char name[100]; + short reserve3[196]; +} +DescFile; + class CDecor { public: @@ -90,7 +108,7 @@ public: POINT DecorNextAction(); void SetInput(int keys); void SetJoystickEnable(BOOL bJoystick); - void SetFieldD814(BOOL param_1); + void SetDemoPlay(BOOL param_1); void PlaySound(int sound, POINT pos, BOOL bLocal); void PlaySound(int sound, POINT pos); // hack void StopSound(int sound); @@ -156,8 +174,7 @@ public: BOOL IsPassIcon(int icon); BOOL IsBlocIcon(int icon); BOOL IsVentillo(POINT pos); - void ModifDecor(POINT pos, int icon, BOOL _foo); - void ModifDecor(POINT pos, int icon); // hack + void ModifDecor(POINT pos, int icon, BOOL bMulti=TRUE); BOOL IsRightBorder(POINT cel, POINT offset); BOOL IsFromage(POINT cel); BOOL IsGrotte(POINT cel); @@ -193,8 +210,7 @@ public: void BlupiDead(int action, int action2); POINT GetPosDecor(POINT pos); void BlupiAddFifo(POINT pos); - BOOL DecorDetect(RECT rect, BOOL bCaisse); - BOOL DecorDetect(RECT rect); // hack + BOOL DecorDetect(RECT rect, BOOL bCaisse=TRUE); void GetBlupiInfo(BOOL *pbHelico, BOOL *pbJeep, BOOL *pbSkate, BOOL *pbNage); @@ -266,12 +282,12 @@ public: // DecIO.cpp void GetMissionPath(char *out, int gamer, int mission, BOOL bUser); - BOOL CurrentWrite(int gamer, int mission, BOOL bUser); - BOOL CurrentRead(int gamer, int mission, BOOL bUser); + BOOL Write(int gamer, int mission, BOOL bUser); + BOOL Read(int gamer, int mission, BOOL bUser); BOOL SomethingMissionPath(int gamer, int mission, BOOL bUser); BOOL MissionStart(int gamer, int mission, BOOL bUser); - BOOL Read(int gamer, int mission, BOOL *pbMission, BOOL *pbPrivate); - BOOL Write(int gamer, int mission, char* param3); + BOOL CurrentRead(int gamer, int mission, BOOL *pbMission, BOOL *pbPrivate); + BOOL CurrentWrite(int gamer, int mission, char* param3); BOOL SearchWorld(int world, POINT *blupi, int *dir); BOOL SearchDoor(int n, POINT *cel, POINT *blupi); diff --git a/src/def.h b/src/def.h index 59e0c6f..925ba2d 100644 --- a/src/def.h +++ b/src/def.h @@ -13,7 +13,7 @@ #define _DEMO FALSE // TRUE=demo, FALSE=complet #define _EGAMES FALSE // TRUE version pour eGames #define _SE FALSE // TRUE eGames Special Edition -#define _INTRO !_EGAMES // TRUE si images d'introduction +#define _INTRO FALSE // TRUE si images d'introduction // additional flags #define _CD FALSE // whether to require the game CD @@ -433,6 +433,12 @@ enum { WM_DECOR3, WM_DECOR4, WM_DECOR5, + WM_DECOR6, + WM_DECOR7, + WM_DECOR8, + WM_DECOR9, + WM_DECOR10, + WM_DECOR11, WM_BUTTON0 = WM_USER + 200, WM_BUTTON1, diff --git a/src/event.cpp b/src/event.cpp index 9bbd6a6..f2ed3a7 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -35,32 +35,26 @@ using namespace std; typedef struct { - short majRev; - short minRev; - short reserve1[9]; - short exercice; // exercice en cours (0..n) - short mission; // mission en cours (0..n) - short multi; - short lives; - short bHiliInfoButton; - short pPlayerName; - short speed; - short bMovie; - short maxMission; // derni�re mission effectu�e (0..n) - short scrollSpeed; - short audioVolume; - short midiVolume; - short bAccessBuild; - short prive; - short skill; - short reserve2[93]; + short majRev; + short minRev; + short reserve1[9]; + char name[100]; + short mission; + short speed; + short bMovie; + short bHiliInfoButton; + short audioVolume; + short midiVolume; + short bBuildOfficialMissions; + short prive; + short skillUnused; + short multi; + short reserve2[92]; + short nbVies; + BYTE doors[200]; } DescInfo; - - - - // Toutes les premi�res lettres doivent // �tre diff�rentes ! @@ -395,6 +389,7 @@ CEvent::CEvent() m_bWaitMouse = FALSE; m_bHideMouse = FALSE; m_bShowMouse = FALSE; + m_bMouseRelease = FALSE; m_tryPhase = 0; m_rankCheat = -1; m_posCheat = 0; @@ -418,12 +413,7 @@ CEvent::CEvent() m_bCtrlDown = FALSE; m_input = 0; m_menuIndex = 0; - for (i = 0; i < 20; i++) - { - m_menuDecor[i] = 0; - } - - m_menuDecor[10] = 1; + ZeroMemory(m_menuDecor, sizeof(m_menuDecor)); return; } @@ -432,12 +422,7 @@ CEvent::CEvent() CEvent::~CEvent() { - char filename[260]; - - WriteInfo(m_gamer, filename); // Read the file "info.blp" - OutputDebug(filename); - - return; + WriteInfo(m_gamer); } void CEvent::Create(HINSTANCE hInstance, HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, @@ -628,33 +613,25 @@ BOOL CEvent::CreateButtons() button = m_buttons; - if (table[m_index].buttons[0].message != 0) + while (table[m_index].buttons[i].message != 0) { + pos.x = table[m_index].buttons[i].x; + pos.y = table[m_index].buttons[i].y; + message = table[m_index].buttons[i].message; - while (table[m_index].buttons[1].iconMenu + -8 != 0) + m_buttons[i].Create(m_hWnd, m_pPixmap, m_pSound, pos, + table[m_index].buttons[i].type, + bMinimizeRedraw, message); + + iconMenu = table[m_index].buttons[i].iconMenu; + if (!m_bBuildOfficialMissions && m_phase == WM_PHASE_BUILD && message == WM_DECOR11) { - pos.x = table[m_index].buttons[i].x; - pos.y = table[m_index].buttons[i].y; - - message = table[m_index].buttons[i].message; - - m_buttons[i].Create(m_hWnd, m_pPixmap, m_pSound, pos, - table[m_index].buttons[i].type, - table[m_index].buttons[i].iconMenu + size, - table[m_index].buttons[i].iconMenu[0], - table[m_index].buttons[i].toolTips + size, - table[m_index].buttons[i].toolTips[0], - bMinimizeRedraw, m_pDecor->GetRegion(), message); - - iconMenu = table[m_index].buttons[i].iconMenu + (m_phase * sizeof(Phase)); - if (((m_bBuildOfficialMissions == FALSE) && (m_phase == WM_PHASE_BUILD)) && (message == 1054)) - { - iconMenu++; - } - m_buttons->SetIconMenu(table[m_index].buttons[i].iconMenu + i + 4, *(int*)iconMenu); - m_buttons->SetToolTips(table[m_index].buttons[i].toolTips + i + 4, *(int*)table[m_index].buttons[i].toolTips + i); + iconMenu++; } - + m_buttons->SetIconMenu(table[m_index].buttons[i].iconMenu + 1, iconMenu[0]); + m_buttons->SetToolTips(table[m_index].buttons[i].toolTips + 1, table[m_index].buttons[i].toolTips[0]); + + i++; } return TRUE; } @@ -1046,16 +1023,16 @@ BOOL CEvent::DrawButtons() BOOL bEnable; int phase; - if ( (m_phase == WM_PHASE_INSERT && m_phase == WM_PHASE_BYE )) + if ( m_phase != WM_PHASE_INSERT && m_phase != WM_PHASE_BYE ) { m_bChangeCheat = FALSE; text[0] = 0; - if (m_bBuildOfficialMissions != 0) + if (m_bBuildOfficialMissions) { AddCheatCode(text, cheat_code[0]); } - if (m_posHelpButton.y != 0) + if (m_bAllMissions) { AddCheatCode(text, cheat_code[1]); } @@ -1071,7 +1048,7 @@ BOOL CEvent::DrawButtons() { AddCheatCode(text, cheat_code[19]); } - if (m_pDecor->GetNetMovePredict()) + if (!m_pDecor->GetNetMovePredict()) { AddCheatCode(text, cheat_code[21]); } @@ -1080,7 +1057,7 @@ BOOL CEvent::DrawButtons() phase = m_phase; - if (((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) { rect.right = 302; rect.left = 2; @@ -1090,11 +1067,11 @@ BOOL CEvent::DrawButtons() pos.y = 2; m_pPixmap->DrawPart(-1, 0, pos, rect, 1, FALSE); } - DrawTextLeft(m_pPixmap, pos, textLeft, 10); + DrawTextLeft(m_pPixmap, pos, text, FONTLITTLE); if (m_phase == WM_PHASE_INIT) { - DrawText(m_pPixmap, pos, "Version 2.2", FONTLITTLE); + DrawText(m_pPixmap, { 414, 446 }, "Version 2.2", FONTLITTLE); } if (m_phase == WM_PHASE_GAMER) @@ -1114,7 +1091,7 @@ BOOL CEvent::DrawButtons() DrawText(m_pPixmap, pos, pText, 0); nice = 69 + 40; *(char*)pText += 100; - lg++; + lg--; } while (lg != 0); SetEnable(WM_PHASE_CLEARGAMER, (int)(m_filenameBuffer + -1) + m_gamer * 4 + 212); } @@ -1792,7 +1769,7 @@ BOOL CEvent::LoadState(BOOL save) saveNum = save; - if (m_pDecor->Read(m_gamer, save, (BOOL*)&pEvent, &save) == FALSE) + if (m_pDecor->CurrentRead(m_gamer, save, (BOOL*)&pEvent, &save) == FALSE) { return FALSE; } @@ -2071,13 +2048,13 @@ void CEvent::ReadAll() if (mission != FALSE) { - read = m_pDecor->Read(m_gamer, m_choiceIndex, &bMission, &bPrivate); + read = m_pDecor->CurrentRead(m_gamer, m_choiceIndex, &bMission, &bPrivate); if (read != FALSE) { //m_pDecor->DrawMap(FALSE, -1); } - m_pDecor->Read(m_gamer, 999, &bMission, &bPrivate); + m_pDecor->CurrentRead(m_gamer, 999, &bMission, &bPrivate); } } return; @@ -2126,26 +2103,26 @@ BOOL CEvent::ChangePhase(UINT phase) { int index, world, time, total, music, i, max, mission; POINT totalDim, iconDim; - char filename[MAX_PATH]; + char str[MAX_PATH]; char* pButtonExist; BOOL bEnable, bHide; char* playerName; - sprintf(filename, "CEvent::ChangePhase [Begin] --- %d\r\n", phase - WM_USER); - OutputNetDebug(filename); + sprintf(str, "CEvent::ChangePhase [Begin] --- %d\r\n", phase - WM_USER); + OutputNetDebug(str); if (phase == WM_PHASE_1588) { PostMessage(m_hWnd, WM_CLOSE, 0, 0); return TRUE; } - m_pDecor->SetFieldD814(m_bDemoPlay); + m_pDecor->SetDemoPlay(m_bDemoPlay); if (m_mouseType == MOUSETYPEGRA && m_bFullScreen) { m_bShowMouse = FALSE; } if (phase == WM_PHASE_1544) { - m_pDecor->CurrentRead(m_gamer, 999, TRUE); + m_pDecor->Read(m_gamer, 999, TRUE); phase = WM_PHASE_BUILD; } @@ -2216,8 +2193,46 @@ BOOL CEvent::ChangePhase(UINT phase) return ChangePhase(WM_PHASE_INFO); } } - - CreateButtons(); + if (phase == WM_PHASE_DPLAY_DO_SERVICE) + { + // ... + } + if (phase == WM_PHASE_DPLAY_CANCEL_SERVICE) + { + // ... + } + if (phase == WM_PHASE_1572) + { + // ... + } + if (phase == WM_PHASE_DPLAY_CREATE_LOBBY) + { + // ... + } + if (phase == WM_PHASE_DPLAY_REFRESH) + { + // ... + } + if (phase == WM_PHASE_DPLAY_CANCEL_SESSION) + { + // ... + } + if (phase == WM_PHASE_DPLAY_CREATE) + { + // ... + } + if (phase == WM_PHASE_DPLAY_CANCEL_CREATE) + { + // ... + } + if (phase == WM_PHASE_DPLAY_START_GAME_2) + { + // ... + } + if (phase == WM_PHASE_DPLAY_CANCEL_MULTI) + { + // ... + } if (SearchPhase(phase) < 0) { @@ -2230,9 +2245,327 @@ BOOL CEvent::ChangePhase(UINT phase) if (phase == WM_PHASE_GAMER || phase == WM_PHASE_PLAY) { OutputNetDebug("CEvent::ChangePhase_[WriteInfo]\r\n"); - WriteInfo(m_gamer, playerName); + WriteInfo(m_gamer); } + int oldPhase = m_phase; + if ((oldPhase == WM_PHASE_BUILD && phase == WM_PHASE_INFO) || oldPhase == WM_PHASE_REGION || oldPhase == WM_PHASE_NAMEDESIGN || oldPhase == WM_PHASE_MUSIC) + { + m_pDecor->Write(m_gamer, GetWorld(), !m_bBuildOfficialMissions); + } + + m_phase = phase; + m_index = SearchPhase(phase); + if (table[m_index].bUnk && !FUN_1fbd0()) + { + m_tryInsertCount = 40; + m_tryPhase = m_phase; + return ChangePhase(WM_PHASE_INSERT); + } + + if (table[m_index].backName[0] != '\0') + { + strcpy(str, table[m_index].backName); + if (str[0] != '\0') + { + if (table[m_index].bCDrom) + { + AddCDPath(str); + } + if (!m_pPixmap->BackgroundCache(0, str, { LXIMAGE, LYIMAGE }, { 0,0 }, FALSE)) + { + OutputNetDebug("CEvent::ChangePhase [Cache error]\r\n"); + WaitMouse(FALSE); + m_tryInsertCount = 40; + m_tryPhase = m_phase; + return ChangePhase(WM_PHASE_INSERT); + } + } + } + + if (m_phase == WM_PHASE_PLAY && !m_bPrivate && + oldPhase != WM_PHASE_SETUPp && + oldPhase != WM_PHASE_HELP && + oldPhase != WM_PHASE_GREAD && + oldPhase != WM_PHASE_GREADp && + oldPhase != WM_PHASE_GWRITE && + oldPhase != WM_PHASE_STOP) + { + sprintf(str, "CEvent::ChangePhase [Read] %d, %d\r\n", m_gamer, GetWorld()); + OutputNetDebug(str); + + if (!m_pDecor->Read(m_gamer, GetWorld(), FALSE)) + { + OutputNetDebug("CEvent::ChangePhase [Read error]\r\n"); + m_tryInsertCount = 40; + m_tryPhase = m_phase; + return ChangePhase(WM_PHASE_INSERT); + } + m_pDecor->DrawMap(TRUE, -1); + } + + if (m_phase == WM_PHASE_INFO && m_bPrivate) + { + m_b6D34 = m_pDecor->Read(m_gamer, GetWorld(), !m_bBuildOfficialMissions); + if (m_b6D34) + { + m_pDecor->DrawMap(TRUE, -1); + } + } + + if ((m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST) && + oldPhase != WM_PHASE_SETUPp && + oldPhase != WM_PHASE_HELP && + oldPhase != WM_PHASE_GREAD && + oldPhase != WM_PHASE_GREADp && + oldPhase != WM_PHASE_GWRITE && + oldPhase != WM_PHASE_STOP) + { + m_pDecor->AdaptDoors(m_bPrivate, GetWorld()); + } + + if (m_phase == WM_PHASE_TESTCD) + { + if (m_pDecor->Read(1, 1, FALSE)) + { + return ChangePhase(WM_PHASE_INIT); + } + else + { + m_tryInsertCount = 40; + m_tryPhase = m_phase; + return ChangePhase(WM_PHASE_INSERT); + } + } + + if (m_phase == WM_PHASE_PLAYTEST) + { + m_pDecor->Write(m_gamer, 999, TRUE); + m_pDecor->PlayPrepare(TRUE); + } + + if (m_phase == WM_PHASE_PLAY && + oldPhase != WM_PHASE_SETUPp && + oldPhase != WM_PHASE_HELP && + oldPhase != WM_PHASE_GREAD && + oldPhase != WM_PHASE_GREADp && + oldPhase != WM_PHASE_GWRITE && + oldPhase != WM_PHASE_STOP) + { + if (m_bPrivate || m_bMulti) + { + m_pDecor->PlayPrepare(TRUE); + } + else + { + m_pDecor->PlayPrepare(FALSE); + m_pDecor->SetNbVies(m_nbVies); + } + } + + if (m_phase == WM_PHASE_BUILD) + { + m_pDecor->BuildPrepare(); + } + + CreateButtons(); + m_96B4 = 0; + m_menu.Delete(); + if (m_phase == WM_PHASE_BUILD) + { + SetState(m_menuIndex + WM_DECOR1, 1); + SetMenu(WM_DECOR1, m_menuDecor[0]); + SetMenu(WM_DECOR2, m_menuDecor[1]); + SetMenu(WM_DECOR3, m_menuDecor[2]); + SetMenu(WM_DECOR4, m_menuDecor[3]); + SetMenu(WM_DECOR5, m_menuDecor[4]); + SetMenu(WM_DECOR6, m_menuDecor[5]); + SetMenu(WM_DECOR7, m_menuDecor[6]); + SetMenu(WM_DECOR8, m_menuDecor[7]); + SetMenu(WM_DECOR9, m_menuDecor[8]); + SetMenu(WM_DECOR10, m_menuDecor[9]); + SetMenu(WM_DECOR11, m_menuDecor[10]); + m_pDecor->SetFieldCC38AndStuff(m_menuIndex + 1, GetMenu(m_menuIndex + WM_DECOR1)); + } + if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST || m_phase == WM_PHASE_BUILD) + { + OutputNetDebug("CEvent::ChangePhase [LoadImages]\r\n"); + m_pDecor->LoadImages(); + } + if (m_phase == WM_PHASE_INFO) + { + SetEnable(WM_PREV, GetWorld() != 1); + if (m_bBuildOfficialMissions) + { + SetEnable(WM_NEXT, GetWorld() < 319); + } + else + { + SetEnable(WM_NEXT, GetWorld() < 20); + } + SetHide(WM_PHASE_BUILD, FALSE); + SetEnable(WM_PHASE_WRITEDESIGN, m_b6D34); + SetEnable(WM_PHASE_READDESIGN, !m_b6D34); + SetEnable(WM_PHASE_CLEARDESIGN, m_b6D34); + SetEnable(WM_PHASE_PLAYMOVIE, m_b6D34); + } + if (m_phase == WM_PHASE_GAMER) + { + WriteInfo(m_gamer); + // ... + } + if (m_phase == WM_PHASE_NAMEGAMER) + { + // ... + } + if (m_phase == WM_PHASE_NAMEDESIGN) + { + // ... + } + if (m_phase == WM_PHASE_MUSIC) + { + int music = m_pDecor->GetMusic(); + for (int i = 0; i < 11; i++) + { + SetState(WM_BUTTON1 + i, i == music); + } + } + if (m_phase == WM_PHASE_REGION) + { + int region = m_pDecor->GetRegion(); + for (int i = 0; i < 32; i++) + { + SetState(WM_BUTTON1 + i, i == region); + } + POINT dim = m_pDecor->GetDim(); + if (dim.x == MAXCELX) + { + if (dim.y == MAXCELY) + { + SetState(WM_DIMS1, 1); + SetState(WM_DIMS2, 0); + SetState(WM_DIMS3, 0); + SetState(WM_DIMS4, 0); + } + if (dim.y == 0) + { + SetState(WM_DIMS1, 0); + SetState(WM_DIMS2, 1); + SetState(WM_DIMS3, 0); + SetState(WM_DIMS4, 0); + } + } + else if (dim.y == MAXCELY) + { + SetState(WM_DIMS1, 0); + SetState(WM_DIMS2, 0); + SetState(WM_DIMS3, 1); + SetState(WM_DIMS4, 0); + } + else + { + SetState(WM_DIMS1, 0); + SetState(WM_DIMS2, 0); + SetState(WM_DIMS3, 0); + SetState(WM_DIMS4, 1); + } + } + if (m_phase == WM_PHASE_SERVICE) + { + m_pNetwork->EnumProviders(); + m_nbChoices = m_pNetwork->GetNbProviders(); + m_choicePageOffset = 0; + m_choiceIndex = 0; + SetHide(WM_BUTTON10, TRUE); + // ... + } + if (m_phase == WM_PHASE_SESSION) + { + // ... + } + if (m_phase == WM_PHASE_MULTI) + { + // ... + } + if (m_phase == WM_PHASE_CREATE) + { + // ... + } + if (m_phase == WM_PHASE_STOP && m_bMulti) + { + SetEnable(WM_PHASE_GWRITE, 0); + SetEnable(WM_PHASE_GREADp, 0); + } + if (m_phase == WM_PHASE_WRITEDESIGN || m_phase == WM_PHASE_READDESIGN) + { + // ... + } + if (m_phase == WM_PHASE_READDESIGN) + { + // ... + } + if (m_phase == WM_PHASE_WRITEDESIGN) + { + // ... + } + if (m_phase == WM_PHASE_GWRITE || m_phase == WM_PHASE_GREADp || m_phase == WM_PHASE_GREAD) + { + // ... + } + if (m_phase == WM_PHASE_SETUP || m_phase == WM_PHASE_SETUPp) + { + m_0008 = 0; + // ... + } + if ((m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST || m_phase == WM_PHASE_MUSIC) && !m_bDemoPlay) + { + if (!m_pSound->IsPlayingMusic()) + { + int music = m_pDecor->GetMusic(); + if (music > 0) + { + m_pSound->PlayMusic(m_hWnd, music); + } + } + else + { + m_pSound->AdaptVolumeMusic(); + } + } + if (m_phase == WM_PHASE_PLAYMOVIE) + { + sprintf(m_movieToStart, "movie\\play%.3d.avi", GetWorld()); + AddCDPath(m_movieToStart); + m_phaseAfterMovie = WM_PHASE_PLAY; + } + if (m_phase == WM_PHASE_WINMOVIE) + { + sprintf(m_movieToStart, "movie\\win%.3d.avi", GetWorld()); + AddCDPath(m_movieToStart); + m_phaseAfterMovie = WM_PHASE_WIN; + } + if (m_phase == WM_PHASE_WINMOVIEDESIGN) + { + sprintf(m_movieToStart, "movie\\win%.3d.avi", GetWorld()); + AddCDPath(m_movieToStart); + m_phaseAfterMovie = WM_PHASE_WINDESIGN; + } + if (m_phase == WM_PHASE_WINMOVIEMULTI) + { + sprintf(m_movieToStart, "movie\\win%.3d.avi", GetWorld()); + AddCDPath(m_movieToStart); + m_phaseAfterMovie = WM_PHASE_LOSTMULTI; // ? + } + WaitMouse(FALSE); + if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST) + { + FillMouse(TRUE); + } + m_pDecor->VehicleSoundsPhase(phase); + OutputNetDebug("CEvent::ChangePhase [End]"); + + return TRUE; + } // Implement LoadLevel @@ -2631,14 +2964,13 @@ void CEvent::DemoRecEvent(UINT message, UINT input, WPARAM wParam, LPARAM lParam } } -BOOL CEvent::WriteInfo(int gamer, char* playername) +BOOL CEvent::WriteInfo(int gamer) { char filename[MAX_PATH]; FILE* file = NULL; DescInfo info; int nb; int doors; - BYTE door[200]; char text[100]; sprintf(filename, "data\\info%.3d.blp", gamer); @@ -2646,24 +2978,23 @@ BOOL CEvent::WriteInfo(int gamer, char* playername) file = fopen(filename, "wb"); if (file == NULL) goto error; - strcpy(text, (const char*)m_gamerName); + strcpy(text, m_gamerName); info.majRev = 1; + info.minRev = 0; info.prive = m_private; info.mission = m_mission; info.multi = m_multi; - info.lives = m_lives; + info.nbVies = m_nbVies; info.speed = m_speed; info.bMovie = m_bMovie; info.bHiliInfoButton = m_bHiliInfoButton; - info.bAccessBuild = m_bBuildOfficialMissions; - - m_pDecor->InitializeDoors(door); + info.bBuildOfficialMissions = m_bBuildOfficialMissions; info.audioVolume = m_pSound->GetAudioVolume(); info.midiVolume = m_pSound->GetMidiVolume(); - + m_pDecor->InitializeDoors(info.doors); nb = fwrite(&info, sizeof(DescInfo), 1, file); if (nb < 1) goto error; @@ -2710,21 +3041,19 @@ BOOL CEvent::ReadInfo(int gamer) } info.majRev = 1; - info.prive = m_private; - info.mission = m_mission; - info.multi = m_multi; - info.lives = m_lives; - info.speed = m_speed; - info.bMovie = m_bMovie; - info.bHiliInfoButton = m_bHiliInfoButton; - info.bAccessBuild = m_bBuildOfficialMissions; - - m_pDecor->SetBuildOfficialMissions(info.skill); + m_private = info.prive; + m_multi = info.multi; + m_nbVies = info.nbVies; + m_bMovie = info.bMovie; + m_mission = info.mission; + m_bHiliInfoButton = info.bHiliInfoButton; + m_speed = info.speed; + m_bBuildOfficialMissions = info.bBuildOfficialMissions; + m_pDecor->SetBuildOfficialMissions(info.bBuildOfficialMissions); m_pSound->SetAudioVolume(info.audioVolume); m_pSound->SetMidiVolume(info.midiVolume); m_pDecor->MemorizeDoors(doors); - fclose(file); return TRUE; @@ -2758,7 +3087,7 @@ void CEvent::ChangeButtons(int message) } if (m_phase == WM_PHASE_NAMEGAMER && message == WM_PHASE_DONAMEGAMER) { - WriteInfo(m_gamer, m_textInput); + WriteInfo(m_gamer); ChangePhase(WM_PHASE_GAMER); } if (m_phase == WM_PHASE_NAMEDESIGN && message == WM_PHASE_DONAMEDESIGN) @@ -2931,4 +3260,10 @@ BOOL CEvent::ClearGamer(int gamer) AddUserPath(filename); remove(filename); return TRUE; +} + +BOOL CEvent::FUN_1fbd0() +{ + // TODO + return TRUE; } \ No newline at end of file diff --git a/src/event.h b/src/event.h index 1e0c7fc..2fde885 100644 --- a/src/event.h +++ b/src/event.h @@ -156,7 +156,7 @@ protected: void PrivateLibelle(); BOOL ReadLibelle(int world, BOOL bSchool, BOOL bHelp); - BOOL WriteInfo(int gamer, char* playername); + BOOL WriteInfo(int gamer); BOOL ReadInfo(int gamer); BOOL LoadState(BOOL save); void TryPhase(); @@ -186,6 +186,8 @@ protected: void MouseRelease(); void MouseCapture(); + BOOL FUN_1fbd0(); + protected: int m_speed; @@ -197,7 +199,7 @@ protected: int m_menuIndex; int m_choiceIndex; int m_saveIndex; - int m_menuDecor[10]; + int m_menuDecor[11]; BOOL m_bMouseRelease; int m_private; int m_maxMission; @@ -294,7 +296,11 @@ protected: int m_choicePageOffset; int m_nbChoices; + int m_0008; int m_6D30; + BOOL m_b6D34; + int m_96B4; + int m_nbVies; }; extern diff --git a/src/pixmap.cpp b/src/pixmap.cpp index 17db3be..0c05cbe 100644 --- a/src/pixmap.cpp +++ b/src/pixmap.cpp @@ -374,9 +374,9 @@ void CPixmap::QuickIcon(int channel, int rank, POINT pos) num = m_clipRect.left; if (pos.x < num) { - num = num - pos.x; + num -= pos.x; pos.x = m_clipRect.left; - rect.left = rect.left + num; + rect.left += num; } num = (m_clipRect.right + rect.left) - pos.x; if (num < rect.right) @@ -386,27 +386,23 @@ void CPixmap::QuickIcon(int channel, int rank, POINT pos) num = m_clipRect.top; if (pos.y < num) { - num = num - pos.y; + num -= pos.y; pos.y = m_clipRect.top; - rect.top = rect.top + num; + rect.top += num; } num = (m_clipRect.bottom + rect.top) - pos.y; if (num < rect.bottom) { rect.bottom = num; } - if ((rect.left < rect.right) && (rect.top < rect.bottom)) + if (rect.left < rect.right && rect.top < rect.bottom) { - while (num = (m_lpDDSBack->BltFast(pos.x, pos.y, m_lpDDSurface[channel], &rect, 1), num != 0)) + while (TRUE) { - if ((num == 0x7789FE3E) && (num = RestoreAll(), num != 0)) - { - return; - } - if (num != 0x7789FE3E) - { - return; - } + num = m_lpDDSBack->BltFast(pos.x, pos.y, m_lpDDSurface[channel], &rect, 1); + if (num == DD_OK) return; + if (num == DDERR_SURFACELOST && RestoreAll() != DD_OK) return; + if (num != DDERR_WASSTILLDRAWING) return; } } return; @@ -1234,54 +1230,58 @@ BOOL CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos, RECT rect; HRESULT ddrval; COLORREF oldColor1, oldColor2; - if (channel == CHOBJECT) { - if (table_icon_object[0] <= rank) - { - return FALSE; - } - + if (table_icon_object[0] <= rank) return FALSE; + rect.left = table_icon_object[rank * 6 + 0]; + rect.top = table_icon_object[rank * 6 + 1]; + rect.right = rect.left + table_icon_object[rank * 6 + 4]; + rect.bottom = rect.top + table_icon_object[rank * 6 + 5]; + pos.x += table_icon_object[rank * 6 + 2]; + pos.y += table_icon_object[rank * 6 + 3]; } else if (channel == CHELEMENT) { - if (table_icon_element[0] <= rank) { - return FALSE; - } + if (table_icon_element[0] <= rank) return FALSE; + rect.left = table_icon_element[rank * 6 + 0]; + rect.top = table_icon_element[rank * 6 + 1]; + rect.right = rect.left + table_icon_element[rank * 6 + 4]; + rect.bottom = rect.top + table_icon_element[rank * 6 + 5]; + pos.x += table_icon_element[rank * 6 + 2]; + pos.y += table_icon_element[rank * 6 + 3]; } else if (IsBlupiChannel(channel)) { - if (table_icon_blupi[0] <= rank) - { - return FALSE; - } + if (table_icon_blupi[0] <= rank) return FALSE; + rect.left = table_icon_blupi[rank * 6 + 0]; + rect.top = table_icon_blupi[rank * 6 + 1]; + rect.right = rect.left + table_icon_blupi[rank * 6 + 4]; + rect.bottom = rect.top + table_icon_blupi[rank * 6 + 5]; + pos.x += table_icon_blupi[rank * 6 + 2]; + pos.y += table_icon_blupi[rank * 6 + 3]; + } + else if (channel == CHEXPLO) + { + if (table_icon_explo[0] <= rank) return FALSE; + rect.left = table_icon_explo[rank * 6 + 0]; + rect.top = table_icon_explo[rank * 6 + 1]; + rect.right = rect.left + table_icon_explo[rank * 6 + 4]; + rect.bottom = rect.top + table_icon_explo[rank * 6 + 5]; + pos.x += table_icon_explo[rank * 6 + 2]; + pos.y += table_icon_explo[rank * 6 + 3]; } else { - if (channel != CHEXPLO) - { - nbx = m_totalDim[channel].x / m_iconDim[channel].x; - nby = m_totalDim[channel].y / m_iconDim[channel].y; + if (channel < 0 || channel >= MAXIMAGE) return FALSE; + if (m_lpDDSurface[channel] == NULL) return FALSE; + if (m_iconDim[channel].x == 0 || + m_iconDim[channel].y == 0) return FALSE; - if (channel < 0 || channel >= MAXIMAGE) return FALSE; - if (m_lpDDSurface[channel] == NULL) return FALSE; - if (m_iconDim[channel].x == 0 || - m_iconDim[channel].y == 0) return FALSE; - if (rank < 0 || rank >= nbx * nby) return FALSE; - } + nbx = m_totalDim[channel].x / m_iconDim[channel].x; + nby = m_totalDim[channel].y / m_iconDim[channel].y; + + if (rank < 0 || rank >= nbx * nby) return FALSE; } - if (table_icon_explo[0] <= rank) return FALSE; - - if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; - if ( m_lpDDSurface[channel] == NULL ) return FALSE; - - if ( m_iconDim[channel].x == 0 || - m_iconDim[channel].y == 0 ) return FALSE; - - nbx = m_totalDim[channel].x / m_iconDim[channel].x; - nby = m_totalDim[channel].y / m_iconDim[channel].y; - - if ( rank < 0 || rank >= nbx*nby ) return FALSE; rect.left = (rank%nbx)*m_iconDim[channel].x; rect.top = (rank/nbx)*m_iconDim[channel].y; diff --git a/src/sound.cpp b/src/sound.cpp index 6ac4ac0..a5e6bed 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -552,31 +552,34 @@ BOOL CSound::PlayImage(int channel, POINT pos, int rank) // Uses MCI to play a MIDI file. The window procedure // is notified when playback is complete. -BOOL CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename) +BOOL CSound::PlayMusic(HWND hWnd, int music) { MCI_OPEN_PARMS mciOpenParms; MCI_PLAY_PARMS mciPlayParms; DWORD dwReturn; char string[MAX_PATH]; + char buf[100]; + + + if (m_bCDAudio) + { + return PlayCDAudio(hWnd, music); + } if (!m_bEnable) return TRUE; if (m_midiVolume == 0) return TRUE; InitMidiVolume(m_midiVolume); m_lastMidiVolume = m_midiVolume; - if (lpszMIDIFilename[1] == ':') // nom complet "D:\REP..." ? - { - strcpy(string, lpszMIDIFilename); - } - else - { - GetCurrentDir(string, MAX_PATH - 30); - strcat(string, lpszMIDIFilename); - } + GetCurrentDir(string, MAX_PATH - 30); + sprintf(buf, "sound\\music%.3d.blp", music - 1); + strcat(string, buf); // Open the device by specifying the device and filename. // MCI will attempt to choose the MIDI mapper as the output port. - mciOpenParms.lpstrDeviceType = "sequencer"; + mciOpenParms.dwCallback = 0; + mciOpenParms.wDeviceID = 0; + mciOpenParms.lpstrDeviceType = (LPSTR)MCI_DEVTYPE_SEQUENCER; mciOpenParms.lpstrElementName = string; dwReturn = mciSendCommand(NULL, MCI_OPEN, @@ -595,6 +598,8 @@ BOOL CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename) m_MidiDeviceID = mciOpenParms.wDeviceID; // Begin playback. + mciPlayParms.dwFrom = 0; + mciPlayParms.dwTo = 0; mciPlayParms.dwCallback = (DWORD)hWnd; dwReturn = mciSendCommand(m_MidiDeviceID, MCI_PLAY, @@ -603,13 +608,13 @@ BOOL CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename) if (dwReturn != 0) { OutputDebug("PlayMusic-2\n"); - mciGetErrorStringA(dwReturn, string, 128); + mciGetErrorString(dwReturn, string, 128); OutputDebug(string); StopMusic(); return FALSE; } - strcpy(m_MIDIFilename, lpszMIDIFilename); + m_music = music; return TRUE; } @@ -623,7 +628,7 @@ BOOL CSound::RestartMusic() if (m_midiVolume == 0) return TRUE; if (m_MIDIFilename[0] == 0) return FALSE; - return PlayMusic(m_hWnd, m_MIDIFilename); + return PlayMusic(m_hWnd, m_music); } // Shuts down the MIDI player. @@ -682,4 +687,76 @@ void CSound::SetSuspendSkip(int nb) void CSound::SetCDAudio(BOOL bCDAudio) { m_bCDAudio = bCDAudio; +} + +BOOL CSound::PlayCDAudio(HWND hWnd, int track) +{ + MCIERROR dwReturn; + MCI_PLAY_PARMS mciPlayParms; + MCI_SET_PARMS mciSetParms; + MCI_OPEN_PARMS mciOpenParms; + char string[MAX_PATH]; + + if (!m_bEnable) return TRUE; + if (m_midiVolume == 0) return TRUE; + InitMidiVolume(m_midiVolume); + m_lastMidiVolume = m_midiVolume; + mciOpenParms.dwCallback = 0; + mciOpenParms.wDeviceID = 0; + mciOpenParms.lpstrAlias = NULL; + mciOpenParms.lpstrDeviceType = (LPSTR)MCI_DEVTYPE_CD_AUDIO; + dwReturn = mciSendCommand(0, + MCI_OPEN, + MCI_OPEN_TYPE_ID | MCI_OPEN_TYPE, + (DWORD)(LPVOID)&mciOpenParms); + if (dwReturn != 0) + { + OutputDebug("PlayCDAudio-1\n"); + mciGetErrorString(dwReturn, string, 128); + OutputDebug(string); + // Failed to open device. Don't close it; just return error. + return FALSE; + } + + // The device opened successfully; get the device ID. + m_MidiDeviceID = mciOpenParms.wDeviceID; + + mciSetParms.dwCallback = 0; + mciSetParms.dwAudio = 0; + mciSetParms.dwTimeFormat = MCI_FORMAT_TMSF; + + dwReturn = mciSendCommand(mciOpenParms.wDeviceID, + MCI_SET, + MCI_SET_TIME_FORMAT, + (DWORD)(LPVOID)&mciSetParms); + + if (dwReturn != 0) + { + OutputDebug("PlayCDAudio-2\n"); + mciGetErrorString(dwReturn, string, 128); + OutputDebug(string); + StopMusic(); + return FALSE; + } + + mciPlayParms.dwCallback = (DWORD)(LPVOID)hWnd; + mciPlayParms.dwFrom = track; + mciPlayParms.dwTo = track + 1; + dwReturn = mciSendCommand(m_MidiDeviceID, + MCI_PLAY, + MCI_TRACK | MCI_NOTIFY | MCI_WAIT, + (DWORD)(LPVOID)&mciPlayParms); + + if (dwReturn != 0) + { + OutputDebug("PlayCDAudio-3\n"); + mciGetErrorString(dwReturn, string, 128); + OutputDebug(string); + StopMusic(); + return FALSE; + } + + m_music = track; + + return TRUE; } \ No newline at end of file diff --git a/src/sound.h b/src/sound.h index 63d4aeb..2652be4 100644 --- a/src/sound.h +++ b/src/sound.h @@ -41,7 +41,7 @@ public: BOOL Play(int channel, int volume = 0, int pan = 0); BOOL StopSound(int channel); BOOL PlayImage(int channel, POINT pos, int rank = -1); - BOOL PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename); + BOOL PlayMusic(HWND hWnd, int music); BOOL RestartMusic(); void SuspendMusic(); void StopMusic(); @@ -49,6 +49,8 @@ public: void AdaptVolumeMusic(); void SetSuspendSkip(int nb); + BOOL PlayCDAudio(HWND hWnd, int track); + protected: BOOL CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, BOOL bStereo); BOOL ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos); @@ -65,6 +67,7 @@ protected: LPDIRECTSOUNDBUFFER m_lpDSB[MAXSOUND]; short m_channelBlupi[MAXBLUPI]; UINT m_MidiDeviceID; + int m_music; char m_MIDIFilename[50]; int m_audioVolume; int m_midiVolume; diff --git a/src/text.cpp b/src/text.cpp index bf10589..9e08aa2 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -26,7 +26,7 @@ int GetOffset(char c) 0xEE, 0xF4, 0xF9, 0xFB, 0xE4, 0xF6, 0xE7 }; - for ( i=0 ; i<15 ; i++ ) + for (i = 0; i < 15; i++) { if ( (unsigned char)c == table_accents[i] ) {