diff --git a/blupi.cpp b/blupi.cpp index f0ba5f8..8b7f2d5 100644 --- a/blupi.cpp +++ b/blupi.cpp @@ -335,19 +335,13 @@ void SetDecor() phase = g_pEvent->GetPhase(); + rect = { 0, 0, LXIMAGE, LYIMAGE }; + if (phase == WM_PHASE_PLAY || phase == WM_PHASE_PLAYTEST || phase == WM_PHASE_BUILD) { - rect.bottom = LYIMAGE; - rect.right = LXIMAGE; - rect.top = 0; - rect.left = 0; g_pDecor->Build(rect); } else { - rect.bottom = LYIMAGE; - rect.right = LXIMAGE; - rect.top = 0; - rect.left = 0; g_pPixmap->DrawImage(-1, 0, rect, 1); } @@ -753,7 +747,7 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) g_pEvent = new CEvent; if (g_pEvent == NULL) return InitFail("New event", FALSE); - g_pEvent->Create(hInstance, g_hWnd, g_pPixmap, g_pDecor, g_pSound, g_pMovie, g_pNetwork); + g_pEvent->Create(hInstance, g_hWnd, g_pPixmap, g_pDecor, g_pSound, g_pNetwork, g_pMovie); g_pEvent->SetFullScreen(g_bFullScreen); g_pEvent->SetMouseType(g_mouseType); #if _INTRO diff --git a/button.cpp b/button.cpp index 5f5282c..672bcd8 100644 --- a/button.cpp +++ b/button.cpp @@ -156,9 +156,7 @@ void CButton::Draw() if ( m_bHide ) // is button hidden ? { - pos.y = m_pos.y; - pos.x = m_pos.x; - m_pPixmap->DrawPart(-1, CHBACK, m_pos, rect, 1); // draw the background + m_pPixmap->DrawPart(-1, CHBACK, m_pos, { m_pos.x, m_pos.y, m_pos.x + m_dim.x, m_pos.y + m_dim.y }, 1); // draw the background return; } diff --git a/decblock.cpp b/decblock.cpp new file mode 100644 index 0000000..0b43788 --- /dev/null +++ b/decblock.cpp @@ -0,0 +1,780 @@ +// DecBlock.cpp +// + +#include "def.h" +#include "decor.h" +#include "misc.h" + +BOOL CDecor::BlitzActif(int celx, int cely) +{ + if (m_phase == WM_PHASE_BUILD) { + //TODO: rewrite this like a human + int foo = m_time >> 31; + return 1 - (((m_time ^ foo) - foo & 1 ^ foo) == foo); + } + + POINT pos = { celx * DIMOBJX, cely * DIMOBJY }; + + int num = m_time % 100; + + if (m_blupiPos.x >= pos.x - 80 && m_blupiPos.x <= pos.x + 80 && + m_blupiPos.y >= pos.y - 500 && m_blupiPos.y <= pos.y + 500) + { + if (m_time % 100 < 70 && cely > 0 && m_decor[celx][cely - 1].icon == 0x130) + { + PlaySound(SOUND_BLITZ, pos, 0); + } + + for (int i = 0; table_blitz[i] != -1; i++) + { + if (m_time % 100 == i) return TRUE; + } + } + + return FALSE; +} + +int CDecor::SoundEnviron(int sound, int obstacle) +{ + if ((obstacle >= 32 && obstacle <= 34) || (obstacle >= 41 && obstacle <= 47) || (obstacle >= 139 && obstacle <= 143)) + { + if (sound == SOUND_JUMPTOC) + { + return 79; + } + if (sound == SOUND_JUMPEND) + { + return 78; + } + } + if ((obstacle >= 1 && obstacle <= 28) || (obstacle >= 78 && obstacle <= 90) || (obstacle >= 250 && obstacle <= 260) || (obstacle >= 311 && obstacle <= 316) || (obstacle >= 324 && obstacle <= 329)) + { + if (sound == SOUND_JUMPTOC) + { + return 81; + } + if (sound == SOUND_JUMPEND) + { + return 80; + } + } + if ((obstacle >= 284 && obstacle <= 303) || obstacle == 338) + { + if (sound == SOUND_JUMPTOC) + { + return 83; + } + if (sound == SOUND_JUMPEND) + { + return 82; + } + } + if (obstacle >= 341 && obstacle <= 363) + { + if (sound == SOUND_JUMPTOC) + { + return 85; + } + if (sound == SOUND_JUMPEND) + { + return 84; + } + } + if (obstacle >= 215 && obstacle <= 234) + { + if (sound == SOUND_JUMPTOC) + { + return 87; + } + if (sound == SOUND_JUMPEND) + { + return 86; + } + } + if (obstacle >= 246 && obstacle <= 249) + { + if (sound == SOUND_JUMPTOC) + { + return 89; + } + if (sound == SOUND_JUMPEND) + { + return 88; + } + } + if (obstacle >= 107 && obstacle <= 109) + { + if (sound == SOUND_JUMPTOC) + { + return 91; + } + if (sound == SOUND_JUMPEND) + { + return 90; + } + } + return sound; +} + + +int CDecor::IsWorld(POINT pos) +{ + pos.x += 30; + pos.y += 30; + if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) + { + return -1; + } + int icon = m_decor[pos.x / 64, pos.y / 64]->icon; + if (icon >= 158 && icon <= 165) + { + return icon - 158 + 1; + } + if (icon >= 166 && icon <= 173) + { + return icon - 166 + 1; + } + if (icon == 309 || icon == 310) + { + return 9; + } + if (icon >= 411 && icon <= 415) + { + return icon - 411 + 10; + } + if (icon >= 416 && icon <= 420) + { + return icon - 416 + 10; + } + if (icon >= 174 && icon <= 181) + { + return icon - 174 + 1; + } + if (icon == 184) + { + return 199; + } + return -1; +} + +void CDecor::ActiveSwitch(BOOL bState, POINT cel) +{ + POINT pos; + pos.x = cel.x * 64; + pos.y = cel.y * 64; + ModifDecor(pos, bState ? 384 : 385); + PlaySoundB(bState ? 77 : 76, pos); + cel.x -= 20; + for (int i = 0; i < 41; i++) + { + if (cel.x >= 0 && cel.x < 100 && m_decor[cel.x, cel.y]->icon == (bState ? 379 : 378)) + { + pos.x = cel.x * 64; + pos.y = cel.y * 64; + ModifDecor(pos, bState ? 378 : 379); + } + cel.x++; + } +} + +int CDecor::GetTypeBarre(POINT pos) +{ + POINT pos2 = pos; + pos.x += 30; + pos.y += 22; + if (pos.y % 64 > 44) + { + return 0; + } + if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) + { + return 0; + } + int icon = m_decor[pos.x / 64, pos.y / 64]->icon; + if (icon != 138 && icon != 202) + { + return 0; + } + if (pos.y >= 6336) + { + return 1; + } + icon = m_decor[pos.x / 64, pos.y / 64 + 1]->icon; + if (IsPassIcon(icon)) + { + return 2; + } + RECT rect = BlupiRect(pos2); + rect.top = pos2.y + 60 - 2; + rect.bottom = pos2.y + 60 - 1; + if (DecorDetect(rect, TRUE)) + { + return 2; + } + return 1; +} + +BOOL CDecor::IsLave(POINT pos) +{ + pos.x += 30; + return pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 68; +} + +BOOL CDecor::IsPiege(POINT pos) +{ + pos.x += 30; + pos.y += 60; + return pos.x % 64 >= 15 && pos.x % 64 <= 49 && pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 373; +} + +BOOL CDecor::IsGoutte(POINT pos, BOOL bAlways) +{ + pos.x += 30; + if (pos.x % 64 < 15 || pos.x % 64 > 49) + { + return FALSE; + } + if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) + { + return FALSE; + } + int icon = m_decor[pos.x / 64, pos.y / 64]->icon; + if (bAlways) + { + return icon == 404 || icon == 410; + } + return icon == 404; +} + +BOOL CDecor::IsScie(POINT pos) +{ + pos.x += 30; + return pos.x % 64 >= 4 && pos.x % 64 <= 60 && pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 378; +} + +BOOL CDecor::IsSwitch(POINT pos, POINT celSwitch) +{ + pos.x += 30; + if (pos.x % 64 < 4 || pos.x % 64 > 60) + { + return FALSE; + } + if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) + { + return FALSE; + } + celSwitch.x = pos.x / 64; + celSwitch.y = pos.y / 64; + return m_decor[pos.x / 64, pos.y / 64]->icon == 384 || m_decor[pos.x / 64, pos.y / 64]->icon == 385; +} + +BOOL CDecor::IsEcraseur(POINT pos) +{ + if (m_time / 3 % 10 > 2) + { + return FALSE; + } + pos.x += 30; + return pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 317; +} + +BOOL CDecor::IsBlitz(POINT pos, BOOL bAlways) +{ + pos.x += 30; + if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) + { + return FALSE; + } + POINT tinyPoint; + tinyPoint.x = pos.x / 64; + tinyPoint.y = pos.y / 64; + return m_decor[tinyPoint.x, tinyPoint.y]->icon == 305 && (bAlways || BlitzActif(tinyPoint.x, tinyPoint.y)); +} + +BOOL CDecor::IsRessort(POINT pos) +{ + pos.x += 30; + pos.y += 60; + return pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 211; +} + +BOOL CDecor::IsTemp(POINT pos) +{ + pos.x += 30; + pos.y += 60; + return pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 324; +} + +BOOL CDecor::IsBridge(POINT pos, POINT celBridge) +{ + pos.x += 30; + pos.y += 60; + if (pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 364) + { + celBridge.x = pos.x / 64; + celBridge.y = pos.y / 64; + return TRUE; + } + pos.y -= 60; + if (pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 364) + { + celBridge.x = pos.x / 64; + celBridge.y = pos.y / 64; + return TRUE; + } + return FALSE; + +} + +int CDecor::IsDoor(POINT pos, POINT celPorte) +{ + int num; + if (m_blupiDir == 1) + { + num = -60; + } + else + { + num = 60; + } + pos.x += 30; + for (int i = 0; i < 2; i++) + { + if (pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon >= 334 && m_decor[pos.x / 64, pos.y / 64]->icon <= 336) + { + celPorte.x = pos.x / 64; + celPorte.y = pos.y / 64; + return m_decor[pos.x / 64, pos.y / 64]->icon; + } + pos.x += num; + } + return -1; +} + +int CDecor::IsTeleporte(POINT pos) +{ + if (pos.x % 64 > 6) + { + return -1; + } + pos.x += 30; + pos.y -= 60; + if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) + { + return -1; + } + if (m_decor[pos.x / 64, pos.y / 64]->icon >= 330 && m_decor[pos.x / 64, pos.y / 64]->icon <= 333) + { + return m_decor[pos.x / 64, pos.y / 64]->icon; + } + return -1; +} + +BOOL CDecor::SearchTeleporte(POINT pos, POINT newpos) +{ + int num = IsTeleporte(pos); + if (num == -1) + { + return FALSE; + } + for (int i = 0; i < 100; i++) + { + for (int j = 0; j < 100; j++) + { + if (num == m_decor[i][j]->icon) + { + newpos.x = i * 64; + newpos.y = j * 64 + 60; + if (newpos.x < pos.x - 40 || newpos.x > pos.x + 40 || newpos.y < pos.y - 40 || newpos.y > pos.y + 40) + { + return TRUE; + } + } + } + } + return FALSE; +} + +BOOL CDecor::IsSurfWater(POINT pos) +{ + if (pos.y % 64 < 64 - BLUPISURF) + { + return FALSE; + } + int icon = m_decor[(pos.x + 30) / 64, pos.y / 64]->icon; + int icon2 = m_decor[(pos.x + 30) / 64, (pos.y + BLUPISURF) / 64]->icon; + return icon != 92 && icon2 == 92; +} + +BOOL CDecor::IsDeepWater(POINT pos) +{ + int num = (pos.x + 30) / 64; + int num2 = pos.y / 64; + if (num < 0 || num >= 100 || num2 < 0 || num2 >= 100) + { + return FALSE; + } + int icon = m_decor[num, num2]->icon; + return icon == 91 || icon == 92; +} + +BOOL CDecor::IsOutWater(POINT pos) +{ + int icon = m_decor[(pos.x + 30) / 64, (pos.y + 30) / 64]->icon; + return icon != 91 && icon != 92 && IsPassIcon(icon); +} + +BOOL CDecor::IsPassIcon(int icon) +{ + if (icon == 324 && m_time / 4 % 20 >= 18) + { + return TRUE; + } + if (icon >= 0 && icon < MAXQUART) + { + for (int i = 0; i < 16; i++) + { + if (table_decor_quart[icon * 16 + i] != 0) + { + return FALSE; + } + } + } + return TRUE; +} + +BOOL CDecor::IsBlocIcon(int icon) +{ + if (icon < 0 || icon >= MAXQUART) + { + return FALSE; + } + if (icon == 324 && m_time / 4 % 20 < 18) + { + return FALSE; + } + for (int i = 0; i < 16; i++) + { + if (table_decor_quart[icon * 16 + i] == 0) + { + return FALSE; + } + } + return FALSE; +} + +BOOL CDecor::IsVentillo(POINT pos) +{ + int num = 0; + BOOL flag = FALSE; + POINT tinyPoint; + pos.x += 30; + pos.y += 30; + if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) + { + return FALSE; + } + int icon = m_decor[pos.x / 64, pos.y / 64]->icon; + if (icon < 126 || icon > 137) + { + return FALSE; + } + if (icon == 126) + { + if (pos.x % 64 <= 16) + { + flag = TRUE; + } + tinyPoint.x = -64; + tinyPoint.y = 0; + num = 110; + } + if (icon == 129) + { + if (pos.x % 64 >= 48) + { + flag = TRUE; + } + tinyPoint.x = 64; + tinyPoint.y = 0; + num = 114; + } + if (icon == 132) + { + if (pos.y % 64 <= 32) + { + flag = TRUE;; + } + tinyPoint.x = 0; + tinyPoint.y = -64; + num = 118; + } + if (icon == 135) + { + if (pos.y % 64 >= 48) + { + flag = TRUE; + } + tinyPoint.x = 0; + tinyPoint.y = 64; + num = 122; + } + if (!flag) + { + return FALSE; + } + ModifDecor(pos, -1); + do + { + pos.x += tinyPoint.x; + pos.y += tinyPoint.y; + if (num != m_decor[pos.x / 64, pos.y / 64]->icon) + { + break; + } + ModifDecor(pos, -1); + } while (pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400); + return TRUE; +} + +void CDecor::ModifDecor(POINT pos, int icon, BOOL bMulti) +{// TODO: this + int icon2 = m_decor[pos.x / 64, pos.y / 64]->icon; + if (icon == -1 && icon >= 126 && icon2 <= 137) + { + ByeByeAdd(1, icon2, pos, 17.0, 1.0); + } + m_decor[pos.x / 64, pos.y / 64]->icon = icon; +} + +BOOL CDecor::IsRightBorder(POINT pos, POINT offset) +{ + +} + + +BOOL CDecor::IsFromage(int x, int y) +{ + if (x < 0 || x >= 100 || y < 0 || y >= 100) + { + return FALSE; + } + int icon = m_decor[x, y]->icon; + return (icon >= 246 && icon <= 249) || icon == 339; +} + +BOOL CDecor::IsGrotte(int x, int y) +{ + if (x < 0 || x >= 100 || y < 0 || y >= 100) + { + return FALSE; + } + int icon = m_decor[x, y]->icon; + return icon = 284 || icon == 301 || icon == 337; +} + +void CDecor::AdaptMidBorder(int x, int y) +{ + if (x < 0 || x >= 100 || y < 0 || y >= 100) + { + return; + } + int num = 15; + if (!IsRightBorder(x, y + 1, 0, -1)) + { + num &= -2; + } + if (!IsRightBorder(x, y + 1, 0, 1)) + { + num &= -3; + } + if (!IsRightBorder(x + 1, y, -1, 0)) + { + num &= -5; + } + if (!IsRightBorder(x - 1, y, 1, 0)) + { + num &= -9; + } + int num2 = m_decor[x, y]->icon; + if (num2 == 156) + { + num2 = 35; + } + if (num2 == 252 || num2 == 253) + { + num2 = 251; + } + if (num2 == 255) + { + num2 = 254; + } + if (num2 == 362) + { + num2 = 347; + } + if (num2 == 363) + { + num2 = 348; + } + if (num2 >= 341 && num2 <= 346) + { + num2 = 341; + } + for (int i = 0; i < 144; i++) + { + if (num2 == table_adapt_decor[i]) + { + num2 = table_adapt_decor[i / 16 * 16 + num]; + if (num2 == 35 && m_random->next() % 2 == 0) + { + num2 = 156; + } + if (num2 == 251) + { + num2 = m_random->next(251, 253); + } + if (num2 == 254 && m_random->next() % 2 == 0) + { + num2 = 255; + } + if (num2 == 347 && m_random->next() % 2 == 0) + { + num2 = 362; + } + if (num2 == 348 && m_random->next() % 2 == 0) + { + num2 = 363; + } + if (num2 == 341) + { + num2 = m_random->next(341, 346); + } + m_decor[x, y]->icon = num2; + return; + } + } + num2 = m_decor[x, y]->icon; + if (num2 == -1 || (num2 >= 264 && num2 <= 282)) + { + num = 15; + if (!IsFromage(x, y + 1)) + { + num &= -2; + } + if (!IsFromage(x, y - 1)) + { + num &= -3; + } + if (!IsFromage(x + 1, y)) + { + num &= -5; + } + if (!IsFromage(x - 1, y)) + { + num &= -9; + } + num2 = table_adapt_fromage[num]; + if (num2 == 268 && m_random->next() % 2 == 0) + { + num2 = 279; + } + if (num2 == 269 && m_random->next() % 2 == 0) + { + num2 = 280; + } + if (num2 == 264 && m_random->next() % 2 == 0) + { + num2 = 281; + } + if (num2 == 265 && m_random->next() % 2 == 0) + { + num2 = 282; + } + m_decor[x, y]->icon = num2; + } + num2 = m_decor[x, y]->icon; + if (num2 == -1 || (num2 >= 285 && num2 <= 303 && num2 != 301)) + { + num = 15; + if (!IsGrotte(x, y + 1)) + { + num &= -2; + } + if (!IsGrotte(x, y - 1)) + { + num &= -3; + } + if (!IsGrotte(x + 1, y)) + { + num &= -5; + } + if (!IsGrotte(x - 1, y)) + { + num &= -9; + } + num2 = table_adapt_fromage[num + 16]; + if (num2 == 289 && m_random->next() % 2 == 0) + { + num2 == 300; + } + if (num2 == 285 && m_random->next() % 2 == 0) + { + num2 = 302; + } + if (num2 == 286 && m_random->next() % 2 == 0) + { + num2 = 303; + } + m_decor[x, y]->icon = num2; + } +} + +void CDecor::AdaptBorder(POINT cel) +{ + AdaptMidBorder(cel.x, cel.y); + AdaptMidBorder(cel.x + 1, cel.y); + AdaptMidBorder(cel.x - 1, cel.y); + AdaptMidBorder(cel.x, cel.y + 1); + AdaptMidBorder(cel.x, cel.y - 1); + int icon = m_decor[cel.x, cel.y]->icon; + if (icon != -1 && !IsPassIcon(icon)) + { + MoveObjectDelete(cel); + } + icon = m_decor[cel.x, cel.y]->icon; + if (icon == 304) + { + for (int i = 0; i < 4; i++) + { + cel.y++; + if (cel.y >= 100) + { + break; + } + icon = m_decor[cel.x, cel.y]->icon; + if (icon != -1) + { + break; + } + m_decor[cel.x, cel.y]->icon = 305; + } + } + if (icon == -1) + { + for (int i = 0; i < 4; i++) + { + cel.y++; + if (cel.y >= 100) + { + return; + } + icon = m_decor[cel.x, cel.y]->icon; + if (icon != 305) + { + return; + } + m_decor[cel.x, cel.y]->icon = -1; + } + } +} \ No newline at end of file diff --git a/decblupi.cpp b/decblupi.cpp index 96999fb..8e7ab34 100644 --- a/decblupi.cpp +++ b/decblupi.cpp @@ -6,36 +6,4261 @@ #include "MISC.H" #include "RESOURCE.H" -void CDecor::BlupiCheat(int cheat) +int CDecor::GetBlupiChannelStandard() { - int rank; - Perso *persos; - PersoType persosType; - - m_persos = persos; - - for (rank = 0; rank < MAXBLUPI; rank++) - { - if (cheat == 2) - { - if (persosType == perso_bomb || - persosType == perso_hangingbomb || - persosType == perso_homingbomb || - persosType == perso_hombingbombactive || - persosType == perso_bulldozer || - persosType == perso_movingbomb) - } - } + if (m_bMulti && m_blupiChannel == CHBLUPI && m_team > 0) { + return m_team + CHBLUPI1 - 1; + } + else { + return m_blupiChannel; + } } -/* -void CDecor::GetBlupiHitbox(RECT *out, POINT pos) +int CDecor::GetBlupiChannelActual() { - int rect.top; - int rect.bottom; - int rect.left; - int rect.right; - - if + if (m_bMulti && m_team > 0) { + return m_team + CHBLUPI1 - 1; + } + return CHBLUPI; } -*/ \ No newline at end of file + +void CDecor::GetBlupiInfo(BOOL* bHelico, BOOL* bJeep, BOOL* bSkate, BOOL* bNage) +{ + bHelico = m_blupiHelico; + bJeep = (m_blupiJeep | m_blupiTank); + bSkate = m_blupiSkate; + bNage = (m_blupiNage | m_blupiSurf); +} + +void CDecor::BlupiSearchIcon() +{ + int num = 0; + int num2 = 2; + int num3 = m_blupiAction; + if (m_blupiVent && m_blupiHelico && m_blupiOver) + { + if (num3 == 1) + { + num3 = 8; + } + if (num3 == 2) + { + num3 = 14; + } + } + if (m_blupiHelico) + { + if (num3 == 1) + { + num3 = 15; + } + if (num3 == 2) + { + num3 = 16; + } + if (num3 == 3) + { + num3 = 17; + } + if (num3 == 10) + { + num3 = 15; + } + if (num3 == 9) + { + num3 = 15; + } + m_blupiRealRotation = (int)(m_blupiVitesseX * 2.0); + } + if (m_blupiOver) + { + if (num3 == 1) + { + num3 = 67; + } + if (num3 == 2) + { + num3 = 68; + } + if (num3 == 3) + { + num3 = 69; + } + if (num3 == 10) + { + num3 = 67; + } + if (num3 == 9) + { + num3 = 67; + } + } + if (m_blupiJeep) + { + if (num3 == 1) + { + num3 = 25; + } + if (num3 == 2) + { + num3 = 26; + } + if (num3 == 10) + { + num3 == 26; + } + if (num3 == 3) + { + num3 = 27; + } + } + if (m_blupiTank) + { + if (num3 == 1) + { + num3 = 50; + } + if (num3 == 2) + { + num3 = 51; + } + if (num3 == 10) + { + num3 = 51; + } + if (num3 == 3) + { + num3 = 52; + } + } + +} + +BOOL CDecor::BlupiIsGround() +{ + if (m_blupiTransport == -1) + { + RECT rect = BlupiRect(m_blupiPos); + rect.top = m_blupiPos.y + 60 - 2; + rect.bottom = m_blupiPos.y + 60 - 1; + return DecorDetect(rect, TRUE); + } + else { + return FALSE; + } +} + +RECT CDecor::BlupiRect(POINT pos) +{ + RECT result; + if (m_blupiNage || m_blupiSurf) + { + result.left = pos.x + 12; + result.right = pos.x + 60 - 12; + if (m_blupiAction == 1) + { + result.top = pos.y + 5; + result.bottom = pos.y + 60 - 10; + } + else + { + result.top = pos.y + 15; + result.bottom = pos.y + 60 - 10; + } + } + else if (m_blupiJeep) + { + result.left = pos.x + 2; + result.right = pos.x + 60 - 2; + result.top = pos.y + 10; + result.bottom = pos.y + 60 - 2; + } + else if (m_blupiTank) + { + result.left = pos.x + 2; + result.right = pos.x + 60 - 2; + result.top = pos.y + 10; + result.bottom = pos.y + 60 - 2; + } + else if (m_blupiOver) + { + result.left = pos.x + 2; + result.right = pos.x + 60 - 2; + result.top = pos.y + 2; + result.bottom = pos.y + 60 - 2; + } + else if (m_blupiBalloon) + { + result.left = pos.x + 10; + result.right = pos.x + 60 - 10; + result.top = pos.y + 5; + result.bottom = pos.y + 60 - 2; + } + else if (m_blupiEcrase) + { + result.left = pos.x + 5; + result.right = pos.x + 60 - 5; + result.top = pos.y + 39; + result.bottom = pos.y + 60 - 2; + } + else + { + result.left = pos.x + 12; + result.right = pos.x + 60 - 12; + result.top = pos.y + 11; + result.bottom = pos.y + 60 - 2; + } + return result; +} + +void CDecor::BlupiAdjust() +{ + RECT tinyRect = BlupiRect(m_blupiPos); + + if (DecorDetect(tinyRect)) + { + return; + } + for (int i = 0; i < 50; i++) + { + RECT rect = tinyRect; + rect.bottom = rect.top + 2; + rect.left = m_blupiPos.x + 12; + rect.right = m_blupiPos.x + 60 - 12; + if (DecorDetect(rect)) + { + break; + } + tinyRect.top += 2; + tinyRect.bottom += 2; + m_blupiPos.y = m_blupiPos.y + 2; + } + for (int i = 0; i < 50; i++) + { + RECT rect = tinyRect; + rect.right = rect.left + 2; + rect.top = m_blupiPos.y + 11; + rect.bottom = m_blupiPos.y + 60 - 2; + if (DecorDetect(rect)) + { + break; + } + tinyRect.left += 2; + tinyRect.right += 2; + m_blupiPos.x = m_blupiPos.x + 2; + } + for (int i = 0; i < 50; i++) + { + RECT rect = tinyRect; + rect.left = rect.right - 2; + rect.top = m_blupiPos.y + 11; + rect.bottom = m_blupiPos.y + 60 - 2; + if (DecorDetect(rect)) + { + break; + } + tinyRect.left -= 2; + tinyRect.right -= 2; + m_blupiPos.x = m_blupiPos.x - 2; + } + for (int i = 0; i < 50; i++) + { + RECT rect = tinyRect; + rect.right = rect.left + 2; + if (DecorDetect(rect)) + { + break; + } + tinyRect.left += 2; + tinyRect.right += 2; + m_blupiPos.x = m_blupiPos.x + 2; + } + for (int i = 0; i < 50; i++) + { + RECT rect = tinyRect; + rect.left = rect.right - 2; + if (DecorDetect(rect)) + { + return; + } + tinyRect.left -= 2; + tinyRect.right -= 2; + m_blupiPos.x = m_blupiPos.x - 2; + } +} + +BOOL CDecor::BlupiBloque(POINT pos, int dir) +{ + RECT rect = BlupiRect(pos); + rect.top = rect.bottom - 20; + rect.bottom -= 2; + if (dir > 0) + { + rect.left = rect.right - 2; + } + if (dir < 0) + { + rect.right = rect.left + 2; + } + return DecorDetect(rect); +} + +void CDecor::BlupiStep() +{ + POINT tinyPoint; + POINT tinyPoint2; + BlupiAdjust(); + m_blupiLastPos = m_blupiPos; + POINT tinyPoint3 = m_blupiPos; + BOOL flag = m_blupiAir; + int blupiAction = m_blupiAction; + BOOL flag2 = FALSE; + BOOL flag3 = FALSE; + tinyPoint3.x += m_blupiVector.x; + tinyPoint3.y += m_blupiVector.y; + if (m_blupiFocus && (tinyPoint3.y + 30) / 64 >= 99) + { + BlupiDead(75, -1); + m_blupiRestart = TRUE; + m_blupiAir = TRUE; + m_blupiPos.y = m_blupiPos.y / 64 * 64 + BLUPIOFFY; + PlaySound(8, m_blupiPos); + return; + } + RECT rect; + if (m_blupiVector.x != 0 || m_blupiVector.y != 0) + { + rect = BlupiRect(m_blupiPos); + rect.top = m_blupiPos.y + 11; + rect.bottom = m_blupiPos.y + 60 - 2; + TestPath(rect, m_blupiPos, tinyPoint3); + } + m_blupiVent = FALSE; + int num; + if (m_blupiTransport == -1 && !m_blupiJeep && !m_blupiTank && !m_blupiSkate + && m_blupiFocus) + { + num = m_decor[(tinyPoint3.x + 30) / 64, (tinyPoint3.y + 30) / 64]->icon; + if (num == 110) + { + tinyPoint3.x -= 9; + } + if (num == 114) + { + tinyPoint3.x += 9; + } + if (num == 118) + { + tinyPoint3.y -= 20; + } + if (num == 122) + { + tinyPoint3.y += 20; + } + if (num >= 110 && num <= 125) + { + m_blupiVent = TRUE; + rect.left = m_blupiPos.x + 12; + rect.right = m_blupiPos.x + 60 - 12; + rect.top = m_blupiPos.y + 11; + rect.bottom = m_blupiPos.y + 60 - 2; + TestPath(rect, m_blupiPos, tinyPoint3); + } + } + BOOL flag4; + if (m_blupiTransport == -1) + { + rect = BlupiRect(tinyPoint3); + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60 - 1; + flag = !DecorDetect(rect); + } + else + { + flag4 = FALSE; + } + rect = BlupiRect(tinyPoint3); + rect.top = tinyPoint3.y + 10; + rect.bottom = tinyPoint3.y + 20; + BOOL flag5 = DecorDetect(rect); + int detectIcon = m_detectIcon; + if (!m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && flag4 && m_blupiFocus) + { + if (m_blupiFocus) + { + m_blupiAction = 5; + m_blupiPhase = 0; + } + m_blupiVitesse.y = 1.0; + m_blupiAir = true; + flag = true; + } + if (!m_blupiNage && !m_blupiSurf && !m_blupiSuspend && !m_blupiAir && IsRessort(tinyPoint3)) + { + if ((m_blupiHelico || m_blupiOver) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + { + m_blupiHelico = false; + m_blupiOver = false; + tinyPoint.x = tinyPoint3.x - 34; + tinyPoint.y = tinyPoint3.y - 34; + ObjectStart(tinyPoint, 9, 0); + m_decorAction = 1; + m_decorPhase = 0; + StopSound(16); + StopSound(18); + StopSound(29); + StopSound(31); + PlaySound(10, m_blupiPos); + } + if (m_blupiJeep && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + { + m_blupiJeep = false; + tinyPoint.x = tinyPoint3.x - 34; + tinyPoint.y = tinyPoint3.y - 34; + ObjectStart(tinyPoint, 9, 0); + m_decorAction = 1; + m_decorPhase = 0; + StopSound(16); + StopSound(18); + StopSound(29); + StopSound(31); + PlaySound(10, m_blupiPos); + } + if (m_blupiTank && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + { + m_blupiTank = false; + tinyPoint.x = tinyPoint3.x - 34; + tinyPoint.y = tinyPoint3.y - 34; + ObjectStart(tinyPoint, 9, 0); + m_decorAction = 1; + m_decorPhase = 0; + StopSound(16); + StopSound(18); + StopSound(29); + StopSound(31); + PlaySound(10, m_blupiPos); + } + if (m_blupiSkate && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + { + m_blupiSkate = false; + tinyPoint.x = tinyPoint3.x - 34; + tinyPoint.y = tinyPoint3.y - 34; + ObjectStart(tinyPoint, 9, 0); + m_decorAction = 1; + m_decorPhase = 0; + StopSound(16); + StopSound(18); + StopSound(29); + StopSound(31); + PlaySound(10, m_blupiPos); + } + if (m_blupiFocus && m_blupiAction != 11 && m_blupiAction != 75 && m_blupiAction != 76 && m_blupiAction != 77 && m_blupiAction != 78 && m_blupiAction != 79 && m_blupiAction != 80 && m_blupiAction != 81) + { + m_blupiAction = 5; + m_blupiPhase = 0; + } + if ((m_keyPress & 1) != 0 && m_blupiFocus) + { + m_blupiVitesse.y = (m_blupiPower ? -25 : -19); + } + else + { + m_blupiVitesse.y = (m_blupiPower ? -16 : -10); + } + m_blupiAir = true; + flag = true; + PlaySound(41, tinyPoint3); + } + if ((m_keyPress & 1) != 0 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + if (m_blupiAction != 4 && m_blupiAction != 3 && !m_blupiAir) + { + m_blupiAction = 4; + m_blupiPhase = 0; + } + if (m_blupiAction == 4 && m_blupiPhase == 3) + { + m_blupiAction = 5; + m_blupiPhase = 0; + if (m_blupiSkate) + { + PlaySound(1, tinyPoint3); + m_blupiVitesse.y = (m_blupiPower ? -17 : -13); + } + else + { + PlaySound(1, tinyPoint3); + if (IsNormalJump(tinyPoint3)) + { + m_blupiVitesse.y = (m_blupiPower ? -26 : -16); + } + else + { + m_blupiVitesse.y = (m_blupiPower ? -16 : -12); + } + } + m_blupiAir = true; + flag = true; + } + } + if (m_blupiAir) + { + if (flag5 && m_blupiVitesse.y < 0) + { + if (m_blupiVitesse.y < -14.0 && m_blupiAction != 11 && m_blupiAction != 75 && m_blupiAction != 76 && m_blupiAction != 77 && m_blupiAction != 78 && m_blupiAction != 79 && m_blupiAction != 80 && m_blupiAction != 81 && !m_blupiSkate) + { + m_blupiJumpAie = true; + PlaySound(40, tinyPoint3); + } + else + { + PlaySound(SoundEnviron(4, detectIcon), tinyPoint3); + } + m_blupiVitesse.y = 1.0; + } + tinyPoint3.y += (int)(m_blupiVitesse.y * 2.0); + if (m_blupiVitesse.y < 20.0) + { + m_blupiVitesse.y += 2.0; + } + rect = BlupiRect(tinyPoint3); + rect.top = tinyPoint3.y + 60 - 30; + rect.bottom = tinyPoint3.y + 60 - 1; + if (m_blupiVitesse.y >= 0.0 && DecorDetect(rect)) + { + tinyPoint3.y = tinyPoint3.y / 32 * 32 + BLUPIOFFY; + if (!IsRessort(tinyPoint3)) + { + PlaySound(SoundEnviron(3, m_detectIcon), tinyPoint3); + } + if (m_blupiFocus) + { + if (m_blupiVitesse.y > 20.0) + { + m_blupiAction = 61; + } + else + { + m_blupiAction = 61; + } + m_blupiPhase = 0; + } + m_blupiAir = false; + if (m_blupiJumpAie) + { + m_blupiJumpAie = false; + m_blupiAction = 36; + m_blupiPhase = 0; + } + } + rect.left = tinyPoint3.x + 20; + rect.right = tinyPoint3.x + 60 - 20; + rect.top = tinyPoint3.y + 60 - 33; + rect.bottom = tinyPoint3.y + 60 - 1; + num = AscenseurDetect(rect, m_blupiPos, tinyPoint3); + if (m_blupiVitesse.y >= 0.0 && num != -1) + { + m_blupiTransport = num; + flag4 = false; + PlaySound(3, tinyPoint3); + tinyPoint3.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY; + if (m_blupiFocus) + { + if (m_blupiVitesse.y > 20.0) + { + m_blupiAction = 61; + } + else + { + m_blupiAction = 61; + } + m_blupiPhase = 0; + } + m_blupiAir = false; + if (m_blupiJumpAie) + { + m_blupiJumpAie = false; + m_blupiAction = 36; + m_blupiPhase = 0; + } + } + } + if (m_blupiAction == 36 && m_blupiPhase == 30) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + if (m_blupiAction == 56 && m_blupiPhase == 64) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + m_blupiCloud = true; + m_blupiTimeShield = 100; + m_jauges[1].SetHide(false); + PlaySound(55, tinyPoint3); + } + if (m_blupiAction == 58) + { + if (m_blupiPhase == 8) + { + tinyPoint.x = m_blupiPos.x; + tinyPoint.y = m_blupiPos.y + 40; + if (m_blupiVitesse.y > 0.0) + { + tinyPoint.y += (int)(m_blupiVitesse.y * 4.0); + } + m_blupiVitesse.y -= 10.0; + if (ObjectStart(tinyPoint, 23, 55) != -1) + { + PlaySound(52, m_blupiPos); + m_blupiTimeFire = 10; + m_blupiBullet--; + } + } + if (m_blupiPhase == 14) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + } + if ((m_blupiAction == 44 || m_blupiAction == 45) && m_blupiPhase == 29) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + if (m_blupiAction == 46 && m_blupiPhase == 32) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + if (m_blupiAction == 47 && m_blupiPhase == 34) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + bool flag6; + if (m_blupiAction == 48 && m_blupiPhase == 40) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + num = MoveObjectDetect(tinyPoint3, out flag6); + if (num != -1 && !flag6 && tinyPoint3.y - BLUPIFLOOR == m_moveObject[num].posCurrent.y) + { + if (m_blupiDir == 2 && tinyPoint3.x < m_moveObject[num].posCurrent.x) + { + tinyPoint.x = tinyPoint3.x - 16; + tinyPoint.y = tinyPoint3.y; + int num2 = MoveObjectDetect(tinyPoint, out flag6); + if (num2 == -1) + { + m_blupiAction = 9; + m_blupiPhase = 0; + } + } + if (m_blupiDir == 1 && tinyPoint3.x > m_moveObject[num].posCurrent.x) + { + tinyPoint.x = tinyPoint3.x + 16; + tinyPoint.y = tinyPoint3.y; + int num2 = MoveObjectDetect(tinyPoint, out flag6); + if (num2 == -1) + { + m_blupiAction = 9; + m_blupiPhase = 0; + } + } + } + } + if (m_blupiAction == 65) + { + if (m_blupiPhase == 4) + { + PlaySound(47, m_blupiPos); + } + if (m_blupiPhase == 44) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + } + if (m_blupiAction == 63) + { + if (m_blupiPhase == 1) + { + PlaySound(65, m_blupiPos); + m_blupiTimeMockery = 300; + } + if (m_blupiPhase == 92) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + } + if (m_blupiAction == 64) + { + if (m_blupiPhase == 6) + { + PlaySound(65, m_blupiPos); + m_blupiTimeMockery = 300; + } + if (m_blupiPhase == 104) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + } + if (m_blupiAction == 83) + { + if (m_blupiPhase == 4) + { + PlaySound(47, m_blupiPos); + } + if (m_blupiPhase == 60) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + } + if (m_blupiAction == 84 && m_blupiPhase == 18) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + if (m_blupiAction == 60 && m_blupiPhase == 3) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + if (m_blupiAction == 61 && m_blupiPhase == 5) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + if (m_blupiAction == 62 && m_blupiPhase == 2) + { + m_blupiAction = 5; + m_blupiPhase = 0; + m_blupiVitesse.y = -12.0; + m_blupiAir = true; + flag = true; + } + if (m_blupiAction == 49 && m_blupiPhase == 32) + { + ObjectStart(m_sucettePos, m_sucetteType, 0); + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + m_blupiPower = true; + m_blupiTimeShield = 100; + m_blupiPosMagic = m_blupiPos; + m_jauges[1].SetHide(false); + PlaySound(44, tinyPoint3); + } + if (m_blupiAction == 55 && m_blupiPhase == 36) + { + ObjectStart(m_sucettePos, m_sucetteType, 0); + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + m_blupiHide = true; + m_blupiTimeShield = 100; + m_blupiPosMagic = m_blupiPos; + m_jauges[1].SetHide(false); + PlaySound(62, tinyPoint3); + } + if (m_blupiSpeedY < 0.0 && m_blupiLastSpeedY == 0.0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + m_blupiAction = 7; + m_blupiPhase = 0; + } + if (m_blupiSpeedY == 0.0 && m_blupiLastSpeedY < 0.0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + if (m_blupiSpeedY > 0.0 && m_blupiLastSpeedY == 0.0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 6 && m_blupiAction != 28 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + m_blupiAction = 6; + m_blupiPhase = 0; + } + if (m_blupiSpeedY > 0.0 && m_blupiSpeedX == 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 6 && m_blupiAction != 28 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + m_blupiAction = 6; + m_blupiPhase = 0; + } + if (m_blupiSpeedY == 0.0 && m_blupiLastSpeedY > 0.0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + if (m_blupiAction == 7 && m_blupiPhase == 4) + { + m_scrollAdd.y = -150; + PlaySound(21, tinyPoint3); + } + if (m_blupiAction == 6 && m_blupiPhase == 4) + { + m_scrollAdd.y = 150; + PlaySound(7, tinyPoint3); + } + if (!m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + if (m_blupiSpeedY > 0.0 && m_blupiSpeedX == 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 28 && m_blupiDir == 1 && (num = CaisseInFront()) != -1) + { + tinyPoint3.x = m_moveObject[num].posCurrent.x + 64 - 5; + m_blupiAction = 28; + m_blupiPhase = 0; + m_scrollAdd.y = 0; + PlaySound(39, tinyPoint3); + } + if (m_blupiSpeedY > 0.0 && m_blupiSpeedX > 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 29 && m_blupiDir == 1 && CaisseInFront() != -1) + { + m_blupiAction = 29; + m_blupiPhase = 0; + m_scrollAdd.y = 0; + PlaySound(39, tinyPoint3); + } + if (m_blupiSpeedY > 0.0 && m_blupiSpeedX == 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 28 && m_blupiDir == 2 && (num = CaisseInFront()) != -1) + { + tinyPoint3.x = m_moveObject[num].posCurrent.x - 60 + 5; + m_blupiAction = 28; + m_blupiPhase = 0; + m_scrollAdd.y = 0; + PlaySound(39, tinyPoint3); + } + if (m_blupiSpeedY > 0.0 && m_blupiSpeedX < 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 29 && m_blupiDir == 2 && CaisseInFront() != -1) + { + m_blupiAction = 29; + m_blupiPhase = 0; + m_scrollAdd.y = 0; + PlaySound(39, tinyPoint3); + } + if (m_blupiAction == 29 && m_blupiActionOuf != 47) + { + m_blupiActionOuf = 47; + m_blupiTimeOuf = 0; + } + } + if (m_blupiAction != 28 && m_blupiAction != 29 && m_blupiFocus) + { + if (m_blupiSpeedX < 0.0 && m_blupiLastSpeedX == 0.0 && !m_blupiAir && m_blupiSpeedY != 0.0) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + if (m_blupiSpeedX == 0.0 && m_blupiLastSpeedX < 0.0 && m_blupiSpeedY != 0.0) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + if (m_blupiSpeedX > 0.0 && m_blupiLastSpeedX == 0.0 && !m_blupiAir && m_blupiSpeedY != 0.0) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + if (m_blupiSpeedX == 0.0 && m_blupiLastSpeedX > 0.0 && m_blupiSpeedY != 0.0) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + } + int num3; + int num4; + if (m_blupiSpeedX < 0.0 && m_blupiFocus) + { + if (m_blupiDir == 2 && m_blupiAction != 3 && m_blupiAction != 59 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && ((!m_blupiJeep && !m_blupiTank && !m_blupiSkate) || Math.Abs(m_blupiVitesse.x) <= 8.0)) + { + if (m_blupiAir) + { + PlaySound(5, tinyPoint3); + m_blupiAction = 59; + m_blupiPhase = 0; + m_blupiDir = 1; + } + else + { + PlaySound(5, tinyPoint3); + m_blupiAction = 3; + m_blupiPhase = 0; + } + } + if (m_blupiDir == 1 && m_blupiAction != 2 && m_blupiAction != 14 && m_blupiAction != 4 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && !m_blupiAir) + { + m_blupiAction = 2; + m_blupiPhase = 0; + } + if (m_blupiDir == 1 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend) + { + if (m_blupiAction == 14) + { + tinyPoint3.x -= CaisseGetMove(5); + } + else + { + num3 = m_blupiPhase; + if (num3 > 3 || m_blupiAir) + { + num3 = 3; + } + num4 = table_vitesse_march[num3]; + if (m_blupiPower) + { + num4 *= 3; + num4 /= 2; + } + tinyPoint3.x += Misc.Speed(m_blupiSpeedX, num4); + } + } + if (m_blupiDir == 2 && m_blupiAction == 29) + { + tinyPoint3.x -= CaisseGetMove(3); + } + } + if (m_blupiSpeedX > 0.0 && m_blupiFocus) + { + if (m_blupiDir == 1 && m_blupiAction != 3 && m_blupiAction != 59 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && ((!m_blupiJeep && !m_blupiTank && !m_blupiSkate) || Math.Abs(m_blupiVitesse.x) <= 8.0)) + { + if (m_blupiAir) + { + PlaySound(5, tinyPoint3); + m_blupiAction = 59; + m_blupiPhase = 0; + m_blupiDir = 2; + } + else + { + PlaySound(5, tinyPoint3); + m_blupiAction = 3; + m_blupiPhase = 0; + } + } + if (m_blupiDir == 2 && m_blupiAction != 2 && m_blupiAction != 14 && m_blupiAction != 4 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && !m_blupiAir) + { + m_blupiAction = 2; + m_blupiPhase = 0; + } + if (m_blupiDir == 2 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend) + { + if (m_blupiAction == 14) + { + tinyPoint3.x += CaisseGetMove(5); + } + else + { + num3 = m_blupiPhase; + if (num3 > 3 || m_blupiAir) + { + num3 = 3; + } + num4 = table_vitesse_march[num3]; + if (m_blupiPower) + { + num4 *= 3; + num4 /= 2; + } + tinyPoint3.x += Misc.Speed(m_blupiSpeedX, num4); + } + } + if (m_blupiDir == 1 && m_blupiAction == 29) + { + tinyPoint3.x += CaisseGetMove(3); + } + } + if (m_blupiHelico) + { + if (m_blupiAction == 3 && m_blupiPhase == 10) + { + m_blupiAction = 2; + if (m_blupiDir == 1) + { + m_blupiDir = 2; + } + else + { + m_blupiDir = 1; + } + } + } + else if (m_blupiOver) + { + if (m_blupiAction == 3 && m_blupiPhase == 7) + { + m_blupiAction = 2; + if (m_blupiDir == 1) + { + m_blupiDir = 2; + } + else + { + m_blupiDir = 1; + } + } + } + else if (m_blupiJeep) + { + if (m_blupiAction == 3 && m_blupiPhase == 7) + { + m_blupiAction = 1; + m_blupiPhase = 0; + if (m_blupiDir == 1) + { + m_blupiDir = 2; + } + else + { + m_blupiDir = 1; + } + } + } + else if (m_blupiTank) + { + if (m_blupiAction == 3 && m_blupiPhase == 12) + { + m_blupiAction = 1; + m_blupiPhase = 0; + if (m_blupiDir == 1) + { + m_blupiDir = 2; + } + else + { + m_blupiDir = 1; + } + } + } + else if (m_blupiSkate) + { + if (m_blupiAction == 3 && m_blupiPhase == 14) + { + m_blupiAction = 1; + m_blupiPhase = 0; + if (m_blupiDir == 1) + { + m_blupiDir = 2; + } + else + { + m_blupiDir = 1; + } + } + } + else if (m_blupiNage || m_blupiSurf) + { + if (m_blupiAction == 3 && m_blupiPhase == 10) + { + m_blupiAction = 2; + if (m_blupiDir == 1) + { + m_blupiDir = 2; + } + else + { + m_blupiDir = 1; + } + } + } + else if (m_blupiSuspend) + { + if (m_blupiAction == 3 && m_blupiPhase == 10) + { + m_blupiAction = 1; + m_blupiPhase = 0; + if (m_blupiDir == 1) + { + m_blupiDir = 2; + } + else + { + m_blupiDir = 1; + } + } + } + else + { + if (m_blupiAction == 3 && m_blupiPhase == 6) + { + m_blupiAction = 1; + m_blupiPhase = 0; + if (m_blupiDir == 1) + { + m_blupiDir = 2; + } + else + { + m_blupiDir = 1; + } + } + if (m_blupiAction == 59 && m_blupiPhase == 6) + { + m_blupiAction = 5; + m_blupiPhase = 0; + } + } + if (!m_blupiSuspend && m_blupiAction == 4 && m_blupiPhase == 3) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + if (m_blupiSpeedX == 0.0 && m_blupiSpeedY == 0.0 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && m_blupiFocus) + { + if (m_blupiAction == 14 || m_blupiAction == 7) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + if (m_blupiAction == 2) + { + if (m_blupiSuspend || m_blupiPhase < 10) + { + m_blupiAction = 1; + } + else + { + m_blupiAction = 60; + } + m_blupiPhase = 0; + } + if (m_blupiAction == 6) + { + m_blupiAction = 1; + m_blupiPhase = 0; + PlaySound(20, tinyPoint3); + } + m_scrollAdd.y = 0; + if (blupiAction == 14) + { + StopSound(38); + } + if (blupiAction == 29 || blupiAction == 28) + { + StopSound(39); + } + } + if (!m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && m_blupiFocus) + { + if (m_blupiAction == 9 && m_blupiDir == 1) + { + tinyPoint3.x += 4; + } + if (m_blupiAction == 9 && m_blupiDir == 2) + { + tinyPoint3.x -= 4; + } + if (m_blupiAction == 10 && m_blupiDir == 1) + { + tinyPoint3.x -= 4; + } + if (m_blupiAction == 10 && m_blupiDir == 2) + { + tinyPoint3.x += 4; + } + } + if ((m_keyPress & -3) == 0 && m_blupiSpeedX == 0.0 && m_blupiSpeedY == 0.0 && (m_blupiJeep || m_blupiTank || m_blupiSkate) && m_blupiFocus) + { + if (m_blupiAction == 10 && m_blupiDir == 1) + { + tinyPoint3.x -= 5; + } + if (m_blupiAction == 10 && m_blupiDir == 2) + { + tinyPoint3.x += 5; + } + } + if ((m_keyPress & -3) == 0 && m_blupiSpeedX == 0.0 && m_blupiSpeedY == 0.0 && m_blupiNage && m_blupiFocus && m_blupiAction == 2) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + if ((m_keyPress & -3) == 0 && m_blupiSpeedX == 0.0 && m_blupiSpeedY == 0.0 && m_blupiSurf && m_blupiFocus && m_blupiAction == 2) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + if (m_blupiHelico && (m_blupiFocus || m_blupiAction == 58)) + { + if ((m_keyPress & 2) != 0 && m_blupiTimeFire == 0 && m_blupiAction != 3 && m_blupiAction != 58 && flag4) + { + if (m_blupiBullet == 0) + { + PlaySound(53, m_blupiPos); + } + else + { + m_blupiAction = 58; + m_blupiPhase = 0; + m_blupiFocus = false; + } + } + m_blupiMotorHigh = flag4; + if (m_blupiAction != 3 && m_blupiAction != 58) + { + if (flag4) + { + m_blupiAction = 2; + } + else + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiVitesse.y = 0.0; + } + } + if (EasyMove) + { + if (m_blupiSpeedY <= -1.0 || (m_keyPress & 1) != 0) + { + if (m_blupiVitesse.y > -7.0) + { + m_blupiVitesse.y -= 0.5; + } + if (m_blupiVitesse.y == -0.5) + { + m_blupiVitesse.y = -1.0; + } + } + else if (m_blupiSpeedY >= 1.0) + { + if (m_blupiVitesse.y < 8.0) + { + m_blupiVitesse.y += 0.5; + } + } + else + { + if (m_blupiVitesse.y > 1.0) + { + m_blupiVitesse.y -= 1.0; + } + if (m_blupiVitesse.y < 1.0) + { + m_blupiVitesse.y += 1.0; + } + } + tinyPoint3.y += (int)m_blupiVitesse.y; + } + else + { + if (m_blupiSpeedY <= -1.0 || (m_keyPress & 1) != 0) + { + if (m_blupiVitesse.y > -10.0) + { + m_blupiVitesse.y -= 0.5; + } + } + else if (m_blupiSpeedY >= 1.0) + { + if (m_blupiVitesse.y < 12.0) + { + m_blupiVitesse.y += 0.5; + } + } + else + { + if (m_blupiVitesse.y > 1.0) + { + m_blupiVitesse.y -= 1.0; + } + if (m_blupiVitesse.y < 1.0) + { + m_blupiVitesse.y += 1.0; + } + } + tinyPoint3.y += (int)m_blupiVitesse.y; + } + if (EasyMove) + { + if (m_blupiSpeedX <= -1.0) + { + int num5 = (int)(m_blupiSpeedX * 12.0); + if (m_blupiVitesse.x > num5) + { + m_blupiVitesse.x -= 0.5; + } + tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; + tinyPoint.y = tinyPoint3.y; + if (BlupiBloque(tinyPoint, -1)) + { + m_blupiVitesse.x = 0.0; + } + } + else if (m_blupiSpeedX >= 1.0) + { + int num6 = (int)(m_blupiSpeedX * 12.0); + if (m_blupiVitesse.x < num6) + { + m_blupiVitesse.x += 0.5; + } + tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; + tinyPoint.y = tinyPoint3.y; + if (BlupiBloque(tinyPoint, 1)) + { + m_blupiVitesse.x = 0.0; + } + } + else + { + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x -= 2.0; + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x += 2.0; + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + } + tinyPoint3.x += (int)m_blupiVitesse.x; + } + else + { + if (m_blupiSpeedX <= -1.0) + { + int num7 = (int)(m_blupiSpeedX * 16.0); + if (m_blupiVitesse.x > num7) + { + m_blupiVitesse.x -= 1.0; + } + tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; + tinyPoint.y = tinyPoint3.y; + if (BlupiBloque(tinyPoint, -1)) + { + m_blupiVitesse.x = 0.0; + } + } + else if (m_blupiSpeedX >= 1.0) + { + int num8 = (int)(m_blupiSpeedX * 16.0); + if (m_blupiVitesse.x < num8) + { + m_blupiVitesse.x += 1.0; + } + tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; + tinyPoint.y = tinyPoint3.y; + if (BlupiBloque(tinyPoint, 1)) + { + m_blupiVitesse.x = 0.0; + } + } + else + { + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x -= 2.0; + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x += 2.0; + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + } + tinyPoint3.x += (int)m_blupiVitesse.x; + } + MoveObjectPollution(); + if (ButtonPressed == ButtonGlygh.PlayAction && !flag4 && m_blupiTransport == -1) + { + ButtonPressed = Def.ButtonGlygh.None; + rect.left = m_blupiPos.x + 20; + rect.right = m_blupiPos.x + 22; + rect.top = m_blupiPos.y + 60 - 2; + rect.bottom = m_blupiPos.y + 60; + flag2 = !DecorDetect(rect); + rect.left = m_blupiPos.x + 60 - 22; + rect.right = m_blupiPos.x + 60 - 20; + rect.top = m_blupiPos.y + 60 - 2; + rect.bottom = m_blupiPos.y + 60; + flag3 = !DecorDetect(rect); + if (!flag2 && !flag3) + { + tinyPoint.x = m_blupiPos.x; + tinyPoint.y = m_blupiPos.y - BLUPIFLOOR; + ObjectStart(tinyPoint, 13, 0); + m_blupiHelico = false; + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiPosHelico = m_blupiPos; + m_blupiFocus = true; + StopSound(16); + StopSound(18); + PlaySound(17, m_blupiPos); + } + } + } + if (m_blupiOver && (m_blupiFocus || m_blupiAction == 58)) + { + m_blupiMotorHigh = flag4; + if (m_blupiAction != 3) + { + if (flag4) + { + m_blupiAction = 2; + } + else + { + if (m_blupiAction != 1) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + m_blupiVitesse.y = 0.0; + } + } + rect = BlupiRect(tinyPoint3); + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60 + OVERHEIGHT - 1; + bool flag7 = !DecorDetect(rect); + num = MoveAscenseurDetect(m_blupiPos, OVERHEIGHT); + if (num != -1) + { + flag7 = false; + } + if ((m_blupiSpeedY < 0.0 || (m_keyPress & 1) != 0) && !flag7) + { + if (m_blupiVitesse.y == 0.0 && num != -1) + { + m_blupiVitesse.y = -5.0; + } + else if (m_blupiVitesse.y > -5.0) + { + m_blupiVitesse.y -= 1.0; + } + } + else if (m_blupiSpeedY > 0.0) + { + if (m_blupiVitesse.y < 12.0) + { + m_blupiVitesse.y += 5.0; + } + } + else if (m_blupiVitesse.y < 12.0 && m_time % 2 == 0) + { + m_blupiVitesse.y += 1.0; + } + tinyPoint3.y += (int)m_blupiVitesse.y; + if (m_blupiSpeedX < 0.0 && flag4) + { + int num9 = (int)(m_blupiSpeedX * 12.0); + if (m_blupiVitesse.x > num9) + { + m_blupiVitesse.x -= 1.0; + } + tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; + tinyPoint.y = tinyPoint3.y; + if (BlupiBloque(tinyPoint, -1)) + { + m_blupiVitesse.x = 0.0; + } + } + else if (m_blupiSpeedX > 0.0 && flag4) + { + int num10 = (int)(m_blupiSpeedX * 12.0); + if (m_blupiVitesse.x < num10) + { + m_blupiVitesse.x += 1.0; + } + tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; + tinyPoint.y = tinyPoint3.y; + if (BlupiBloque(tinyPoint, 1)) + { + m_blupiVitesse.x = 0.0; + } + } + else + { + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x -= 1.0; + } + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x += 1.0; + } + } + tinyPoint3.x += (int)m_blupiVitesse.x; + MoveObjectPollution(); + if (ButtonPressed == ButtonGlygh.PlayAction && !flag4 && m_blupiTransport == -1) + { + ButtonPressed = Def.ButtonGlygh.None; + rect.left = m_blupiPos.x + 20; + rect.right = m_blupiPos.x + 22; + rect.top = m_blupiPos.y + 60 - 2; + rect.bottom = m_blupiPos.y + 60; + flag2 = !DecorDetect(rect); + rect.left = m_blupiPos.x + 60 - 22; + rect.right = m_blupiPos.x + 60 - 20; + rect.top = m_blupiPos.y + 60 - 2; + rect.bottom = m_blupiPos.y + 60; + flag3 = !DecorDetect(rect); + if (!flag2 && !flag3) + { + tinyPoint.x = m_blupiPos.x; + tinyPoint.y = m_blupiPos.y - BLUPIFLOOR; + ObjectStart(tinyPoint, 46, 0); + m_blupiOver = false; + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiPosHelico = m_blupiPos; + m_blupiFocus = true; + StopSound(16); + StopSound(18); + PlaySound(17, m_blupiPos); + } + } + } + if (m_blupiBalloon && m_blupiFocus) + { + if (m_blupiSpeedY < 0.0 || (m_keyPress & 1) != 0) + { + if (m_blupiVitesse.y > -5.0 && m_time % 6 == 0) + { + m_blupiVitesse.y -= 1.0; + } + } + else if (m_blupiSpeedY > 0.0) + { + if (m_blupiVitesse.y < 0.0 && m_time % 6 == 0) + { + m_blupiVitesse.y += 1.0; + } + } + else if (m_blupiVitesse.y > -3.0 && m_time % 6 == 0) + { + m_blupiVitesse.y -= 1.0; + } + tinyPoint3.y += (int)m_blupiVitesse.y; + if (m_blupiSpeedX < 0.0) + { + int num11 = (int)(m_blupiSpeedX * 10.0); + if (m_blupiVitesse.x > num11) + { + m_blupiVitesse.x -= 1.0; + } + tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; + tinyPoint.y = tinyPoint3.y; + if (BlupiBloque(tinyPoint, -1)) + { + m_blupiVitesse.x = 0.0; + } + } + else if (m_blupiSpeedX > 0.0) + { + int num12 = (int)(m_blupiSpeedX * 10.0); + if (m_blupiVitesse.x < num12) + { + m_blupiVitesse.x += 1.0; + } + tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; + tinyPoint.y = tinyPoint3.y; + if (BlupiBloque(tinyPoint, 1)) + { + m_blupiVitesse.x = 0.0; + } + } + else + { + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x -= 2.0; + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x += 2.0; + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + } + tinyPoint3.x += (int)m_blupiVitesse.x; + } + if (m_blupiEcrase && m_blupiFocus) + { + if (flag4) + { + if (m_blupiVitesse.y < 2.0) + { + m_blupiVitesse.y += 1.0; + } + } + else + { + m_blupiVitesse.y = 0.0; + } + tinyPoint3.y += (int)m_blupiVitesse.y; + if (flag4) + { + num3 = 7; + } + else + { + num3 = 4; + } + num3 = (int)(num3 * m_blupiSpeedX); + if (m_blupiSpeedX < 0.0) + { + if (m_blupiVitesse.x > num3) + { + m_blupiVitesse.x -= 1.0; + } + tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; + tinyPoint.y = tinyPoint3.y; + if (BlupiBloque(tinyPoint, -1)) + { + m_blupiVitesse.x = 0.0; + } + } + else if (m_blupiSpeedX > 0.0) + { + if (m_blupiVitesse.x < num3) + { + m_blupiVitesse.x += 1.0; + } + tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; + tinyPoint.y = tinyPoint3.y; + if (BlupiBloque(tinyPoint, 1)) + { + m_blupiVitesse.x = 0.0; + } + } + else + { + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x -= 2.0; + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x += 2.0; + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + } + if (m_blupiVitesse.x == 0.0 && !flag4) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + tinyPoint3.x += (int)m_blupiVitesse.x; + } + if (m_blupiJeep && m_blupiFocus) + { + if (m_blupiVitesse.x == 0.0 && m_blupiAction == 2) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + m_blupiMotorHigh = (m_blupiAction != 1); + rect = BlupiRect(tinyPoint3); + rect.right -= 40; + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60 - 1; + bool flag8 = !DecorDetect(rect); + rect.left += 40; + rect.right += 40; + bool flag9 = !DecorDetect(rect); + if (flag4) + { + if (m_blupiVitesse.y < 50.0) + { + m_blupiVitesse.y += 5.0; + } + } + else + { + if (m_blupiVitesse.y != 0.0) + { + PlaySound(3, m_blupiPos); + } + m_blupiVitesse.y = 0.0; + } + tinyPoint3.y += (int)m_blupiVitesse.y; + if (m_blupiTransport == -1) + { + rect.left = tinyPoint3.x + 20; + rect.right = tinyPoint3.x + 60 - 20; + rect.top = tinyPoint3.y + 60 - 35; + rect.bottom = tinyPoint3.y + 60 - 1; + num = AscenseurDetect(rect, m_blupiPos, tinyPoint3); + if (m_blupiVitesse.y >= 0.0 && num != -1) + { + m_blupiTransport = num; + flag4 = false; + PlaySound(3, tinyPoint3); + tinyPoint3.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY; + } + } + if (flag8 && !flag9) + { + int num13 = -20; + if (m_blupiVitesse.x > num13) + { + m_blupiVitesse.x -= 1.0; + } + } + else if (!flag8 && flag9) + { + int num14 = 20; + if (m_blupiVitesse.x < num14) + { + m_blupiVitesse.x += 1.0; + } + } + else if (m_blupiSpeedX < 0.0) + { + int num15 = (int)(m_blupiSpeedX * 20.0); + if (m_blupiVitesse.x > num15) + { + m_blupiVitesse.x -= 1.0; + } + } + else if (m_blupiSpeedX > 0.0) + { + int num16 = (int)(m_blupiSpeedX * 20.0); + if (m_blupiVitesse.x < num16) + { + m_blupiVitesse.x += 1.0; + } + } + else + { + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x -= 2.0; + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x += 2.0; + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + } + if (m_blupiAction == 3) + { + m_blupiVitesse.x = 0.0; + } + tinyPoint3.x += (int)m_blupiVitesse.x; + if (flag8 && !flag9) + { + m_blupiRealRotation = Approch(m_blupiRealRotation, -45, 5); + } + else if (!flag8 && flag9) + { + m_blupiRealRotation = Approch(m_blupiRealRotation, 45, 5); + } + else if (!flag4) + { + m_blupiRealRotation = 0; + } + m_blupiOffsetY = abs(m_blupiRealRotation / 2); + MoveObjectPollution(); + if (ButtonPressed == ButtonGlygh.PlayAction && !flag4 && m_blupiTransport == -1) + { + ButtonPressed = Def.ButtonGlygh.None; + tinyPoint.x = m_blupiPos.x; + tinyPoint.y = m_blupiPos.y - BLUPIFLOOR; + ObjectStart(tinyPoint, 19, 0); + m_blupiJeep = false; + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiPosHelico = m_blupiPos; + StopSound(29); + StopSound(31); + PlaySound(30, m_blupiPos); + } + } + if (m_blupiTank && m_blupiFocus) + { + if (m_blupiAction == 53 && m_blupiPhase == 6) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + if ((m_keyPress & 2) != 0 && m_blupiTimeFire == 0 && m_blupiAction != 3) + { + if (m_blupiBullet == 0) + { + PlaySound(53, m_blupiPos); + } + else + { + if (m_blupiDir == 1) + { + tinyPoint.x = m_blupiPos.x - 35; + tinyPoint.y = m_blupiPos.y; + num4 = -5; + m_blupiVitesse.x += 12.0; + } + else + { + tinyPoint.x = m_blupiPos.x + 35; + tinyPoint.y = m_blupiPos.y; + num4 = 5; + m_blupiVitesse.x -= 12.0; + } + if (ObjectStart(tinyPoint, 23, num4) != -1) + { + m_blupiAction = 53; + m_blupiPhase = 0; + PlaySound(52, m_blupiPos); + m_blupiTimeFire = 10; + m_blupiBullet--; + } + } + } + if (m_blupiVitesse.x == 0.0 && m_blupiAction == 2) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + m_blupiMotorHigh = (m_blupiAction != 1); + if (flag4) + { + if (m_blupiVitesse.y < 50.0) + { + m_blupiVitesse.y += 5.0; + } + } + else + { + if (m_blupiVitesse.y != 0.0) + { + PlaySound(3, m_blupiPos); + } + m_blupiVitesse.y = 0.0; + } + tinyPoint3.y += (int)m_blupiVitesse.y; + if (m_blupiTransport == -1) + { + rect.left = tinyPoint3.x + 20; + rect.right = tinyPoint3.x + 60 - 20; + rect.top = tinyPoint3.y + 60 - 35; + rect.bottom = tinyPoint3.y + 60 - 1; + num = AscenseurDetect(rect, m_blupiPos, tinyPoint3); + if (m_blupiVitesse.y >= 0.0 && num != -1) + { + m_blupiTransport = num; + flag4 = false; + PlaySound(3, tinyPoint3); + tinyPoint3.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY; + } + } + if (m_blupiSpeedX < 0.0) + { + int num17 = (int)(m_blupiSpeedX * 12.0); + if (m_blupiVitesse.x > num17) + { + m_blupiVitesse.x -= 1.0; + } + } + else if (m_blupiSpeedX > 0.0) + { + int num18 = (int)(m_blupiSpeedX * 12.0); + if (m_blupiVitesse.x < num18) + { + m_blupiVitesse.x += 1.0; + } + } + else + { + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x -= 3.0; + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x += 3.0; + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + } + if (m_blupiAction == 3) + { + m_blupiVitesse.x = 0.0; + } + tinyPoint3.x += (int)m_blupiVitesse.x; + MoveObjectPollution(); + if (ButtonPressed == ButtonGlygh.PlayAction && !flag4 && m_blupiTransport == -1) + { + ButtonPressed = Def.ButtonGlygh.None; + tinyPoint.x = m_blupiPos.x; + tinyPoint.y = m_blupiPos.y; + ObjectStart(tinyPoint, 28, 0); + m_blupiTank = false; + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiPosHelico = m_blupiPos; + StopSound(29); + StopSound(31); + PlaySound(30, m_blupiPos); + } + } + if (m_blupiSkate && m_blupiFocus) + { + if (m_blupiVitesse.x == 0.0 && m_blupiAction == 2) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + if (m_blupiSpeedX < 0.0) + { + int num19 = (int)(m_blupiSpeedX * 15.0); + if (m_blupiVitesse.x > num19) + { + m_blupiVitesse.x -= 1.0; + } + } + else if (m_blupiSpeedX > 0.0) + { + int num20 = (int)(m_blupiSpeedX * 15.0); + if (m_blupiVitesse.x < num20) + { + m_blupiVitesse.x += 1.0; + } + } + else + { + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x -= 1.0; + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x += 1.0; + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + } + if (m_blupiAction == 3) + { + m_blupiVitesse.x = 0.0; + } + tinyPoint3.x += (int)m_blupiVitesse.x; + if (ButtonPressed == Def.ButtonGlygh.PlayAction && !flag4 && !m_blupiAir && m_blupiTransport == -1 && m_blupiVitesse.x < 8.0) + { + ButtonPressed = Def.ButtonGlygh.None; + m_blupiSkate = false; + m_blupiAction = 43; + m_blupiPhase = 0; + m_blupiFocus = false; + m_blupiPosHelico = m_blupiPos; + } + } + if (m_blupiAction == 42) + { + if (m_blupiPhase == 8) + { + num = MoveObjectDetect(m_blupiPos, flag6); + if (num != -1) + { + ObjectDelete(m_moveObject[num]->posCurrent, m_moveObject[num]->type); + } + } + if (m_blupiPhase == 20) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + } + if (m_blupiAction == 43) + { + if (m_blupiPhase == 12) + { + tinyPoint.x = m_blupiPos.x; + tinyPoint.y = m_blupiPos.y - BLUPIFLOOR + 1; + ObjectStart(tinyPoint, 24, 0); + } + if (m_blupiPhase == 20) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + } + if (m_blupiNage && m_blupiFocus) + { + if (m_blupiTransport == -1) + { + if (m_blupiSpeedY < 0.0 || (m_keyPress & 1) != 0) + { + if (m_blupiVitesse.y > -5.0) + { + m_blupiVitesse.y -= 1.0; + } + } + else if (m_blupiSpeedY > 0.0) + { + if (m_blupiVitesse.y < 5.0) + { + m_blupiVitesse.y += 1.0; + } + } + else + { + if (m_blupiAction == 1) + { + num3 = -1; + } + else + { + num3 = 0; + } + if (m_blupiVitesse.y > num3) + { + m_blupiVitesse.y -= 1.0; + } + if (m_blupiVitesse.y < num3) + { + m_blupiVitesse.y += 1.0; + } + } + tinyPoint3.y += (int)m_blupiVitesse.y; + } + if (m_blupiSpeedX < 0.0) + { + int num21 = (int)(m_blupiSpeedX * 8.0); + if (m_blupiVitesse.x > num21) + { + m_blupiVitesse.x -= 1.0; + } + } + else if (m_blupiSpeedX > 0.0) + { + int num22 = (int)(m_blupiSpeedX * 8.0); + if (m_blupiVitesse.x < num22) + { + m_blupiVitesse.x += 1.0; + } + } + else + { + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x -= 2.0; + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x += 2.0; + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + } + num = table_vitesse_nage[m_blupiPhase % 14 / 2]; + tinyPoint3.x += (int)(m_blupiVitesse.x * num / 7.0); + if (m_time % 70 == 0 || m_time % 70 == 28) + { + MoveObjectBlup(tinyPoint3); + } + if (m_time % 5 == 0) + { + if (!m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + { + m_blupiLevel--; + } + if (m_blupiLevel == 25) + { + m_jauges[0].SetMode(1); + } + m_jauges[0].SetLevel(m_blupiLevel); + if (m_blupiLevel == 0) + { + m_blupiAction = 24; + m_blupiPhase = 0; + m_blupiFocus = false; + m_blupiHelico = false; + m_blupiOver = false; + m_blupiJeep = false; + m_blupiTank = false; + m_blupiSkate = false; + m_blupiNage = false; + m_blupiSurf = false; + m_blupiSuspend = false; + m_blupiJumpAie = false; + m_blupiShield = false; + m_blupiPower = false; + m_blupiCloud = false; + m_blupiHide = false; + m_blupiInvert = false; + m_blupiBalloon = false; + m_blupiEcrase = false; + m_blupiAir = false; + m_blupiRestart = true; + m_blupiActionOuf = 0; + m_jauges[0].SetHide(true); + m_jauges[1].SetHide(true); + PlaySound(26, tinyPoint3); + } + } + } + if (m_blupiSurf && m_blupiFocus) + { + if (m_blupiTransport == -1) + { + if (m_blupiSpeedY < 0.0 || (m_keyPress & 1) != 0) + { + if (m_blupiVitesse.y > -5.0) + { + m_blupiVitesse.y -= 1.0; + } + } + else if (m_blupiSpeedY > 0.0) + { + if (m_blupiVitesse.y < 5.0) + { + m_blupiVitesse.y += 1.0; + } + } + else + { + if (m_blupiVitesse.y > -2.0) + { + m_blupiVitesse.y -= 1.0; + } + if (m_blupiVitesse.y < -2.0) + { + m_blupiVitesse.y += 1.0; + } + } + tinyPoint3.y += (int)m_blupiVitesse.y; + tinyPoint3.y += BLUPISURF; + if (tinyPoint3.y % 64 > 30) + { + tinyPoint3.y += 64 - tinyPoint3.y % 64; + } + tinyPoint3.y -= BLUPISURF; + } + if (m_blupiSpeedX < 0.0) + { + int num23 = (int)(m_blupiSpeedX * 8.0); + if (m_blupiVitesse.x > num23) + { + m_blupiVitesse.x -= 1.0; + } + } + else if (m_blupiSpeedX > 0.0) + { + int num24 = (int)(m_blupiSpeedX * 8.0); + if (m_blupiVitesse.x < num24) + { + m_blupiVitesse.x += 1.0; + } + } + else + { + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x -= 2.0; + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + if (m_blupiVitesse.x < 0.0) + { + m_blupiVitesse.x += 2.0; + if (m_blupiVitesse.x > 0.0) + { + m_blupiVitesse.x = 0.0; + } + } + } + num = table_vitesse_surf[m_blupiPhase % 12 / 2]; + tinyPoint3.x += (int)(m_blupiVitesse.x * num / 10.0); + } + POINT tinyPoint4; + if (m_blupiSuspend && m_blupiFocus) + { + if (m_blupiSpeedX < 0.0 && m_blupiAction == 2) + { + int num25 = (int)(m_blupiSpeedX * 5.0); + tinyPoint3.x += num25; + } + if (m_blupiSpeedX > 0.0 && m_blupiAction == 2) + { + int num26 = (int)(m_blupiSpeedX * 5.0); + tinyPoint3.x += num26; + } + num = GetTypeBarre(tinyPoint3); + if (num == 2) + { + tinyPoint4.x = tinyPoint3.x; + tinyPoint4.y = tinyPoint3.y / 64 * 64 + BLUPIOFFY; + rect = BlupiRect(tinyPoint4); + if (!DecorDetect(rect, true)) + { + m_blupiSuspend = false; + m_blupiAction = 1; + m_blupiPhase = 0; + tinyPoint3 = tinyPoint4; + m_blupiPos = tinyPoint3; + } + } + if ((m_blupiSpeedY > 0.0 && m_blupiPhase > 5) || num == 0) + { + m_blupiSuspend = false; + m_blupiAir = true; + m_blupiAction = 5; + tinyPoint3.y = tinyPoint3.y; + m_blupiVitesse.y = 0.0; + m_blupiNoBarre = 5; + m_blupiActionOuf = 65; + m_blupiTimeOuf = 0; + } + if (((m_keyPress & 1) != 0 || m_blupiSpeedY < 0.0) && m_blupiAction != 4 && m_blupiAction != 3) + { + m_blupiAction = 4; + m_blupiPhase = 0; + } + if ((m_keyPress & 1) == 0 && m_blupiSpeedY == 0.0 && m_blupiAction == 4) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + if (m_blupiAction == 4 && m_blupiPhase == 10) + { + m_blupiSuspend = false; + m_blupiAir = true; + m_blupiAction = 5; + m_blupiPhase = 0; + tinyPoint3.y -= 2; + m_blupiVitesse.y = -11.0; + m_blupiNoBarre = 5; + PlaySound(35, tinyPoint3); + } + } + if (ButtonPressed == ButtonGlygh.PlayAction && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiTank && !m_blupiJeep && !m_blupiSkate && !flag4 && m_blupiTransport == -1 && m_blupiFocus) + { + if (m_blupiDynamite > 0) + { + ButtonPressed = Def.ButtonGlygh.None; + rect.left = tinyPoint3.x + 18; + rect.right = tinyPoint3.x + 20; + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60; + flag2 = !DecorDetect(rect); + rect.left = tinyPoint3.x + 60 - 20; + rect.right = tinyPoint3.x + 60 - 18; + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60; + flag3 = !DecorDetect(rect); + if (!flag2 && !flag3 && ObjectStart(tinyPoint3, 56, 0) != -1) + { + m_blupiAction = 87; + m_blupiPhase = 0; + m_blupiFocus = false; + PlaySound(61, tinyPoint3); + m_blupiDynamite--; + } + } + else if (m_blupiPerso > 0) + { + ButtonPressed = ButtonGlygh.None; + num = MoveObjectDetect(tinyPoint3, flag6); + if (num == -1 || m_moveObject[num]->type != 200) + { + rect.left = tinyPoint3.x + 18; + rect.right = tinyPoint3.x + 20; + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60; + flag2 = !DecorDetect(rect); + rect.left = tinyPoint3.x + 60 - 20; + rect.right = tinyPoint3.x + 60 - 18; + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60; + flag3 = !DecorDetect(rect); + num = MoveChargeDetect(tinyPoint3); + if (num == -1 && !flag2 && !flag3 && ObjectStart(tinyPoint3, 200, 0) != -1) + { + m_blupiAction = 46; + m_blupiPhase = 0; + m_blupiFocus = false; + PlaySound(61, tinyPoint3); + m_blupiPerso--; + } + } + if (m_blupiFocus) + { + m_blupiAction = 47; + m_blupiPhase = 0; + PlaySound(27, tinyPoint3); + } + } + } + rect = BlupiRect(m_blupiPos); + tinyPoint4 = tinyPoint3; + TestPath(rect, m_blupiPos, ref tinyPoint3); + if (flag && m_blupiPos.x == tinyPoint3.x && m_blupiPos.x != tinyPoint4.x) + { + tinyPoint3.y = tinyPoint4.y; + TestPath(rect, m_blupiPos, ref tinyPoint3); + } + if (m_blupiVent && m_blupiPos.y == tinyPoint3.y && m_blupiPos.y != tinyPoint4.y) + { + tinyPoint3.x = tinyPoint4.x; + TestPath(rect, m_blupiPos, ref tinyPoint3); + } + if (m_blupiTransport != -1 && m_blupiPos.x == tinyPoint3.x && m_blupiPos.x != tinyPoint4.x) + { + tinyPoint3.y = tinyPoint4.y; + TestPath(rect, m_blupiPos, ref tinyPoint3); + } + if (m_blupiHelico || m_blupiOver || m_blupiBalloon || m_blupiEcrase || m_blupiJeep || m_blupiTank || m_blupiSkate || m_blupiNage) + { + if (m_blupiPos.x == tinyPoint3.x && m_blupiPos.x != tinyPoint4.x) + { + tinyPoint3.y = tinyPoint4.y; + TestPath(rect, m_blupiPos, ref tinyPoint3); + } + else if (m_blupiPos.y == tinyPoint3.y && m_blupiPos.y != tinyPoint4.y) + { + tinyPoint3.x = tinyPoint4.x; + TestPath(rect, m_blupiPos, ref tinyPoint3); + } + } + POINT blupiPos = m_blupiPos; + m_blupiPos = tinyPoint3; + if ((m_blupiAction == 1 || m_blupiAction == 60 || m_blupiAction == 7 || m_blupiAction == 6) && !m_blupiAir && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + if (m_blupiTransport != -1) + { + AscenseurVertigo(m_blupiTransport, flag2, flag3); + } + else + { + rect.left = tinyPoint3.x + 24; + rect.right = tinyPoint3.x + 26; + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60; + flag2 = !DecorDetect(rect); + rect.left = tinyPoint3.x + 60 - 26; + rect.right = tinyPoint3.x + 60 - 24; + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60; + flag3 = !DecorDetect(rect); + } + if (m_blupiDir == 1 && flag2 && !flag3) + { + if (m_blupiHelico || m_blupiOver || AscenseurShift(m_blupiTransport)) + { + m_blupiAction = 9; + m_blupiPhase = 0; + } + else + { + PlaySound(6, tinyPoint3); + m_blupiAction = 8; + m_blupiPhase = 0; + } + } + if (m_blupiDir == 2 && !flag2 && flag3) + { + if (m_blupiHelico || m_blupiOver || AscenseurShift(m_blupiTransport)) + { + m_blupiAction = 9; + m_blupiPhase = 0; + } + else + { + PlaySound(6, tinyPoint3); + m_blupiAction = 8; + m_blupiPhase = 0; + } + } + if (m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && (flag2 || flag3)) + { + if (!m_blupiHelico && !m_blupiOver) + { + PlaySound(6, tinyPoint3); + } + m_blupiAction = 10; + m_blupiPhase = 0; + } + } + if (m_blupiAction == 1 && m_blupiJeep && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + if (m_blupiTransport != -1) + { + AscenseurVertigo(m_blupiTransport, flag2, flag3); + } + else + { + rect.left = tinyPoint3.x + 2; + rect.right = tinyPoint3.x + 18; + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60; + flag2 = !DecorDetect(rect); + rect.left = tinyPoint3.x + 60 - 18; + rect.right = tinyPoint3.x + 60 - 2; + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60; + flag3 = !DecorDetect(rect); + } + if (flag2 && !flag3) + { + m_blupiAction = 10; + m_blupiPhase = 0; + } + if (flag3 && !flag2) + { + m_blupiAction = 10; + m_blupiPhase = 0; + } + } + if (m_blupiAction == 1 && m_blupiTank && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + if (m_blupiTransport != -1) + { + AscenseurVertigo(m_blupiTransport, flag2, flag3); + } + else + { + rect.left = tinyPoint3.x + 2; + rect.right = tinyPoint3.x + 18; + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60; + flag2 = !DecorDetect(rect); + rect.left = tinyPoint3.x + 60 - 18; + rect.right = tinyPoint3.x + 60 - 2; + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60; + flag3 = !DecorDetect(rect); + } + if (flag2 && !flag3) + { + m_blupiAction = 10; + m_blupiPhase = 0; + } + if (flag3 && !flag2) + { + m_blupiAction = 10; + m_blupiPhase = 0; + } + } + if (m_blupiAction == 1 && m_blupiSkate && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + if (m_blupiTransport != -1) + { + AscenseurVertigo(m_blupiTransport, flag2, flag3); + } + else + { + rect.left = tinyPoint3.x + 12; + rect.right = tinyPoint3.x + 19; + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60; + flag2 = !DecorDetect(rect); + rect.left = tinyPoint3.x + 60 - 19; + rect.right = tinyPoint3.x + 60 - 12; + rect.top = tinyPoint3.y + 60 - 2; + rect.bottom = tinyPoint3.y + 60; + flag3 = !DecorDetect(rect); + } + if (flag2 && !flag3) + { + m_blupiAction = 10; + m_blupiPhase = 0; + } + if (flag3 && !flag2) + { + m_blupiAction = 10; + m_blupiPhase = 0; + } + } + if (m_blupiFocus) + { + if (m_blupiAction == 8 && m_blupiPhase == 16) + { + m_blupiAction = 9; + m_blupiPhase = 0; + } + if (m_blupiAction == 9 && m_blupiPhase == 3) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiActionOuf = 0; + } + num3 = 5; + if (m_blupiJeep) + { + num3 = 10; + } + if (m_blupiTank) + { + num3 = 10; + } + if (m_blupiSkate) + { + num3 = 10; + } + if (m_blupiAction == 10 && m_blupiPhase == num3) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + } + BlupiSearchIcon(); + if (m_blupiShield) + { + if (m_blupiTimeShield == 10) + { + PlaySound(43, m_blupiPos); + } + if (m_blupiTimeShield == 0) + { + m_blupiShield = false; + m_jauges[1].SetHide(true); + } + else if (m_time % 5 == 0) + { + m_blupiTimeShield--; + m_jauges[1].SetLevel(m_blupiTimeShield); + } + } + if (m_blupiPower) + { + if (m_blupiTimeShield == 20) + { + PlaySound(45, m_blupiPos); + } + if (m_blupiTimeShield == 0) + { + m_blupiPower = false; + m_jauges[1].SetHide(true); + } + else if (m_time % 3 == 0) + { + m_blupiTimeShield--; + m_jauges[1].SetLevel(m_blupiTimeShield); + } + } + if (m_blupiCloud) + { + if (m_blupiTimeShield == 25) + { + PlaySound(56, m_blupiPos); + } + if (m_blupiTimeShield == 0) + { + m_blupiCloud = false; + m_jauges[1].SetHide(true); + } + else if (m_time % 4 == 0) + { + m_blupiTimeShield--; + m_jauges[1].SetLevel(m_blupiTimeShield); + } + } + if (m_blupiHide) + { + if (m_blupiTimeShield == 20) + { + PlaySound(63, m_blupiPos); + } + if (m_blupiTimeShield == 0) + { + m_blupiHide = false; + m_jauges[1].SetHide(true); + } + else if (m_time % 4 == 0) + { + m_blupiTimeShield--; + m_jauges[1].SetLevel(m_blupiTimeShield); + } + } + if (m_blupiInvert) + { + if (m_blupiTimeShield == 0) + { + m_blupiInvert = false; + m_jauges[1].SetHide(true); + tinyPoint.x = m_blupiPos.x; + tinyPoint.y = m_blupiPos.y + 100; + ObjectStart(tinyPoint, 42, -60); + tinyPoint.x = m_blupiPos.x; + tinyPoint.y = m_blupiPos.y - 100; + ObjectStart(tinyPoint, 42, 60); + tinyPoint.x = m_blupiPos.x - 100; + tinyPoint.y = m_blupiPos.y; + ObjectStart(tinyPoint, 42, 10); + tinyPoint.x = m_blupiPos.x + 100; + tinyPoint.y = m_blupiPos.y; + ObjectStart(tinyPoint, 42, -10); + PlaySound(67, tinyPoint3); + } + else if (m_time % 3 == 0) + { + m_blupiTimeShield--; + m_jauges[1].SetLevel(m_blupiTimeShield); + } + } + if (m_blupiBalloon) + { + if (m_blupiTimeShield == 0) + { + m_blupiBalloon = false; + m_jauges[1].SetHide(true); + tinyPoint.x = m_blupiPos.x - 34; + tinyPoint.y = m_blupiPos.y - 34; + ObjectStart(tinyPoint, 91, 0); + PlaySound(41, m_blupiPos); + } + else if (m_time % 2 == 0) + { + m_blupiTimeShield--; + m_jauges[1].SetLevel(m_blupiTimeShield); + } + } + if (m_blupiEcrase) + { + if (m_blupiTimeShield == 0) + { + m_blupiEcrase = false; + m_blupiAir = true; + m_jauges[1].SetHide(true); + ObjectStart(m_blupiPos, 41, -60); + ObjectStart(m_blupiPos, 41, 60); + ObjectStart(m_blupiPos, 41, 10); + ObjectStart(m_blupiPos, 41, -10); + tinyPoint.x = m_blupiPos.x - 34; + tinyPoint.y = m_blupiPos.y - 34; + ObjectStart(tinyPoint, 90, 0); + PlaySound(41, m_blupiPos); + } + else if (m_time % 2 == 0) + { + m_blupiTimeShield--; + m_jauges[1].SetLevel(m_blupiTimeShield); + } + } + if (m_blupiPower && abs(m_blupiPos.x - m_blupiPosMagic.x) + abs(m_blupiPos.y - m_blupiPosMagic.y) >= 40) + { + num = MoveObjectFree(); + if (num != -1) + { + m_moveObject[num]->type = 27; + m_moveObject[num]->phase = 0; + m_moveObject[num]->posCurrent = m_blupiPos; + m_moveObject[num]->posStart = m_moveObject[num]->posCurrent; + m_moveObject[num]->posEnd = m_moveObject[num]->posCurrent; + m_moveObject[num]->step = 1; + m_moveObject[num]->time = 0; + MoveObjectStepIcon(num); + m_blupiPosMagic = m_blupiPos; + } + } + if (m_blupiShield && abs(m_blupiPos.x - m_blupiPosMagic.x) + abs(m_blupiPos.y - m_blupiPosMagic.y) >= 40) + { + num = MoveObjectFree(); + if (num != -1) + { + m_moveObject[num]->type = 57; + m_moveObject[num]->phase = 0; + m_moveObject[num]->posCurrent = m_blupiPos; + m_moveObject[num]->posStart = m_moveObject[num]->posCurrent; + m_moveObject[num]->posEnd = m_moveObject[num]->posCurrent; + m_moveObject[num]->step = 1; + m_moveObject[num]->time = 0; + MoveObjectStepIcon(num); + m_blupiPosMagic = m_blupiPos; + } + } + if (m_blupiHide && abs(m_blupiPos.x - m_blupiPosMagic.x) + abs(m_blupiPos.y - m_blupiPosMagic.y) >= 10) + { + num = MoveObjectFree(); + if (num != -1) + { + m_moveObject[num]->type = 58; + m_moveObject[num]->icon = m_blupiIcon; + m_moveObject[num]->channel = 2; + m_moveObject[num]->phase = 0; + m_moveObject[num]->posCurrent = m_blupiPos; + m_moveObject[num]->posStart = m_moveObject[num]->posCurrent; + m_moveObject[num]->posEnd = m_moveObject[num]->posCurrent; + m_moveObject[num]->step = 1; + m_moveObject[num]->time = 0; + MoveObjectStepIcon(num); + m_blupiPosMagic = m_blupiPos; + } + } + if (m_blupiTimeNoAsc > 0) + { + m_blupiTimeNoAsc--; + } + if (m_blupiHelico && m_blupiPos.y > 2 && m_blupiFocus && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + { + rect = BlupiRect(tinyPoint3); + rect.top = tinyPoint3.y + 4; + rect.bottom = tinyPoint3.y + 20; + if (DecorDetect(rect)) + { + ByeByeHelico(); + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiHelico = false; + tinyPoint.x = m_blupiPos.x - 34; + tinyPoint.y = m_blupiPos.y - 34; + ObjectStart(tinyPoint, 9, 0); + m_decorAction = 1; + m_decorPhase = 0; + StopSound(16); + StopSound(18); + StopSound(29); + StopSound(31); + PlaySound(10, m_blupiPos); + } + } + if (!m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus) + { + if (!m_blupiNage && !m_blupiSurf && IsSurfWater(m_blupiPos)) + { + m_scrollAdd.x = 0; + m_scrollAdd.y = 0; + m_blupiAir = false; + m_blupiNage = false; + m_blupiSurf = true; + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiVitesse.x = 0.0; + m_blupiVitesse.y = 0.0; + MoveObjectPlouf(m_blupiPos); + if (m_blupiTransport != -1) + { + m_blupiPos.y = m_blupiPos.y - 10; + m_blupiTransport = -1; + } + if (m_blupiCloud) + { + m_blupiCloud = false; + m_jauges[1].SetHide(true); + } + } + if (!m_blupiNage && !IsSurfWater(m_blupiPos) && IsDeepWater(m_blupiPos)) + { + if (!m_blupiSurf) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiVitesse.x = 0.0; + m_blupiVitesse.y = 0.0; + MoveObjectPlouf(m_blupiPos); + } + m_blupiAir = false; + m_blupiSurf = false; + m_blupiNage = true; + m_blupiLevel = 100; + m_jauges[0].SetLevel(m_blupiLevel); + m_jauges[0].SetMode(2); + m_jauges[0].SetHide(false); + } + if (m_blupiNage && IsSurfWater(m_blupiPos)) + { + m_blupiAir = false; + m_blupiNage = false; + m_blupiSurf = true; + PlaySound(25, m_blupiPos); + m_jauges[0].SetHide(true); + } + tinyPoint4.x = m_blupiPos.x; + tinyPoint4.y = m_blupiPos.y - 60; + if ((m_blupiSurf || m_blupiNage) && (m_blupiPos.y % 64 == 64 - BLUPISURF || m_blupiPos.y % 64 == 32) && IsOutWater(tinyPoint4) && (m_keyPress & 1) != 0) + { + m_blupiNage = false; + m_blupiSurf = false; + m_blupiAir = true; + m_blupiAction = 5; + m_blupiPhase = 0; + m_blupiVitesse.x = 0.0; + if (m_blupiPower) + { + m_blupiVitesse.y = -16.0; + } + else + { + m_blupiVitesse.y = -12.0; + } + MoveObjectTiplouf(m_blupiPos); + PlaySound(22, m_blupiPos); + m_jauges[0].SetHide(true); + } + if ((m_blupiSurf || m_blupiNage) && IsOutWater(m_blupiPos)) + { + if (m_blupiVitesse.y < 0.0) + { + if (m_blupiTransport == -1) + { + m_blupiPos = blupiPos; + } + else + { + m_blupiTransport = -1; + m_blupiNage = false; + m_blupiSurf = false; + m_blupiAir = true; + m_blupiAction = 5; + m_blupiPhase = 0; + m_blupiPos.y = m_blupiPos.y - 10; + m_blupiVitesse.x = 0.0; + m_blupiVitesse.y = -10.0; + PlaySound(22, m_blupiPos); + m_jauges[0].SetHide(true); + } + } + else if (m_blupiVitesse.y > 0.0) + { + m_blupiNage = false; + m_blupiSurf = false; + m_blupiAir = false; + m_blupiAction = 5; + m_blupiPhase = 0; + m_blupiPos.y = m_blupiPos.y + 30; + m_blupiVitesse.x = 0.0; + m_blupiVitesse.y = 0.0; + PlaySound(22, m_blupiPos); + m_jauges[0].SetHide(true); + } + else + { + m_blupiNage = false; + m_blupiSurf = false; + m_blupiAir = false; + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiPos.y = m_blupiPos.y - 10; + m_blupiVitesse.x = 0.0; + m_blupiVitesse.y = 0.0; + PlaySound(22, m_blupiPos); + m_jauges[0].SetHide(true); + } + } + if ((m_blupiSurf || m_blupiNage) && m_blupiActionOuf != 44) + { + m_blupiActionOuf = 44; + m_blupiTimeOuf = 0; + } + } + if ((m_blupiHelico || m_blupiOver || m_blupiJeep || m_blupiTank || m_blupiSkate) && m_blupiFocus && (IsSurfWater(m_blupiPos) || IsDeepWater(m_blupiPos))) + { + ByeByeHelico(); + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiHelico = false; + m_blupiOver = false; + m_blupiJeep = false; + m_blupiTank = false; + m_blupiSkate = false; + tinyPoint.x = m_blupiPos.x - 34; + tinyPoint.y = m_blupiPos.y - 34; + ObjectStart(tinyPoint, 9, 0); + m_decorAction = 1; + m_decorPhase = 0; + StopSound(16); + StopSound(18); + StopSound(29); + StopSound(31); + PlaySound(10, m_blupiPos); + } + if (m_blupiFocus && !m_blupiSuspend && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && m_blupiNoBarre == 0 && GetTypeBarre(m_blupiPos) == 1) + { + tinyPoint4.x = m_blupiPos.x; + tinyPoint4.y = (m_blupiPos.y + 22) / 64 * 64 + BLUPISUSPEND; + rect = BlupiRect(tinyPoint4); + if (!DecorDetect(rect, true)) + { + m_blupiPos = tinyPoint4; + m_blupiSuspend = true; + m_blupiAir = false; + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiActionOuf = 0; + PlaySound(34, m_blupiPos); + } + } + if (m_blupiNoBarre > 0) + { + m_blupiNoBarre--; + } + if (IsVentillo(m_blupiPos)) + { + if (m_blupiFocus && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + { + BlupiDead(11, 75); + } + tinyPoint.x = m_blupiPos.x - 34; + tinyPoint.y = m_blupiPos.y - 34; + ObjectStart(tinyPoint, 11, 0); + m_decorAction = 2; + m_decorPhase = 0; + StopSound(16); + StopSound(18); + StopSound(29); + StopSound(31); + PlaySound(10, m_blupiPos); + } + if (m_blupiAction != 30 && m_blupiFocus) + { + num = IsWorld(m_blupiPos); + if (num != -1) + { + StopSound(16); + StopSound(18); + StopSound(29); + StopSound(31); + PlaySound(32, m_blupiPos); + m_blupiAction = 30; + m_blupiPhase = 0; + m_blupiFocus = false; + m_blupiFront = true; + } + } + int num27 = MoveObjectDetect(m_blupiPos, flag6); + POINT tinyPoint5; + if (m_blupiAction != 11 && m_blupiAction != 75 && m_blupiAction != 76 && m_blupiAction != 77 && m_blupiAction != 78 && m_blupiAction != 79 && m_blupiAction != 80 && m_blupiAction != 81) + { + if (IsLave(m_blupiPos) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + { + BlupiDead(76, -1); + m_blupiRestart = true; + m_blupiPos.y = m_blupiPos.y / 64 * 64 + BLUPIOFFY; + PlaySound(8, m_blupiPos); + } + if (IsPiege(m_blupiPos) && !m_blupiOver && !m_blupiJeep && !m_blupiTank && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus) + { + BlupiDead(54, -1); + m_blupiRestart = true; + m_blupiAir = true; + ObjectStart(m_blupiPos, 53, 0); + PlaySound(51, m_blupiPos); + } + if (IsGoutte(m_blupiPos, false) && !m_blupiOver && !m_blupiJeep && !m_blupiTank && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus) + { + BlupiDead(54, -1); + m_blupiRestart = true; + m_blupiAir = true; + PlaySound(51, m_blupiPos); + } + if (IsScie(m_blupiPos) && !m_blupiOver && !m_blupiJeep && !m_blupiTank && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus) + { + BlupiDead(77, -1); + m_blupiFront = true; + m_blupiRestart = true; + m_blupiAir = true; + } + if (ButtonPressed == ButtonGlygh.PlayAction && (num27 == -1 || !flag6) && IsSwitch(m_blupiPos, tinyPoint) && !m_blupiOver && !m_blupiBalloon && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus) + { + ButtonPressed = Def.ButtonGlygh.None; + ActiveSwitch(m_decor[tinyPoint.x, tinyPoint.y].icon == 385, tinyPoint); + m_blupiAction = 82; + m_blupiPhase = 0; + m_blupiFocus = false; + m_blupiVitesse.x = 0.0; + m_blupiVitesse.y = 0.0; + } + if (IsBlitz(m_blupiPos, false) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + { + BlupiDead(11, -1); + m_blupiRestart = true; + m_blupiAir = true; + m_blupiPos.y = m_blupiPos.y / 64 * 64 + BLUPIOFFY; + PlaySound(8, m_blupiPos); + } + if (IsEcraseur(m_blupiPos) && !m_blupiEcrase && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiVitesse.x = 0.0; + m_blupiVitesse.y = 0.0; + m_blupiEcrase = true; + m_blupiBalloon = false; + m_blupiAir = false; + m_blupiHelico = false; + m_blupiOver = false; + m_blupiJeep = false; + m_blupiTank = false; + m_blupiSkate = false; + m_blupiNage = false; + m_blupiSurf = false; + m_blupiSuspend = false; + m_blupiJumpAie = false; + m_blupiShield = false; + m_blupiPower = false; + m_blupiCloud = false; + m_blupiHide = false; + m_blupiTimeShield = 100; + m_blupiPosMagic = m_blupiPos; + m_jauges[1].SetHide(false); + if (!m_blupiJeep && !m_blupiTank) + { + StopSound(16); + StopSound(18); + StopSound(29); + StopSound(31); + } + PlaySound(70, m_blupiPos); + ObjectStart(m_blupiPos, 41, -60); + ObjectStart(m_blupiPos, 41, 60); + ObjectStart(m_blupiPos, 41, 10); + ObjectStart(m_blupiPos, 41, -10); + tinyPoint.x = m_blupiPos.x - 34; + tinyPoint.y = m_blupiPos.y - 34; + ObjectStart(tinyPoint, 90, 0); + m_decorAction = 2; + m_decorPhase = 0; + } + if (IsTeleporte(m_blupiPos) != -1 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiAir && m_blupiFocus && m_blupiPosHelico.x == -1) + { + m_blupiAction = 74; + m_blupiPhase = 0; + m_blupiVitesse.x = 0.0; + m_blupiVitesse.y = 0.0; + m_blupiFocus = false; + m_blupiPos.x = m_blupiPos.x / 64 * 64; + PlaySound(71, m_blupiPos); + tinyPoint.x = m_blupiPos.x; + tinyPoint.y = m_blupiPos.y - 5; + ObjectStart(tinyPoint, 92, 0); + } + if (IsBridge(m_blupiPos, tinyPoint2) && m_blupiFocus) + { + tinyPoint2.x *= 64; + tinyPoint2.y *= 64; + ObjectStart(tinyPoint2, 52, 0); + } + int num2 = IsDoor(m_blupiPos, tinyPoint2); + if (num2 != -1 && (m_blupiCle & 1 << num2 - 334) != 0) + { + OpenDoor(tinyPoint2); + m_blupiCle &= ~(1 << num2 - 334); + tinyPoint.x = 520; + tinyPoint.y = 418; + tinyPoint5.x = tinyPoint2.x * 64 - m_posDecor.x; + tinyPoint5.y = tinyPoint2.y * 64 - m_posDecor.y; + VoyageInit(tinyPoint, m_pPixmap->HotSpotToHud(tinyPoint5), 214 + (num2 - 334) * 7, 10); + } + } + if (!m_blupiHelico && !m_blupiSuspend && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiSkate && !m_blupiJeep && !m_blupiTank && !m_blupiJeep && m_blupiFocus) + { + num = MockeryDetect(m_blupiPos); + if (num != 0) + { + m_blupiActionOuf = num; + m_blupiTimeOuf = 0; + } + } + MoveObjectFollow(m_blupiPos); + num = num27; + if (num != -1 && !flag6 && m_moveObject[num]->type == 2 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && !m_blupiShield && !m_bSuperBlupi && m_blupiFocus) + { + m_blupiActionOuf = 48; + m_blupiTimeOuf = 0; + } + if (num != -1 && flag6) + { + if (m_moveObject[num]->type == 13 && (ButtonPressed == ButtonGlygh.PlayAction || IsFloatingObject(num)) && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + ButtonPressed = Def.ButtonGlygh.None; + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + m_scrollAdd.x = 0; + m_scrollAdd.y = 0; + m_blupiAir = false; + m_blupiHelico = true; + m_blupiRealRotation = 0; + m_blupiVitesse.x = 0.0; + if (m_blupiCloud || m_blupiHide) + { + m_blupiCloud = false; + m_blupiHide = false; + m_jauges[1].SetHide(true); + } + } + if (ButtonPressed == ButtonGlygh.PlayAction && m_moveObject[num]->type == 46 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + ButtonPressed = Def.ButtonGlygh.None; + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + m_scrollAdd.x = 0; + m_scrollAdd.y = 0; + m_blupiAir = false; + m_blupiOver = true; + m_blupiVitesse.x = 0.0; + if (m_blupiCloud || m_blupiHide) + { + m_blupiCloud = false; + m_blupiHide = false; + m_jauges[1].SetHide(true); + } + } + if (ButtonPressed == ButtonGlygh.PlayAction && m_moveObject[num]->type == 19 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + ButtonPressed = Def.ButtonGlygh.None; + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + m_scrollAdd.x = 0; + m_scrollAdd.y = 0; + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiAir = false; + m_blupiJeep = true; + m_blupiVitesse.x = 0.0; + if (m_blupiCloud || m_blupiHide) + { + m_blupiCloud = false; + m_blupiHide = false; + m_jauges[1].SetHide(true); + } + } + if (ButtonPressed == ButtonGlygh.PlayAction && m_moveObject[num]->type == 28 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + ButtonPressed = Def.ButtonGlygh.None; + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + m_scrollAdd.x = 0; + m_scrollAdd.y = 0; + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiAir = false; + m_blupiTank = true; + m_blupiVitesse.x = 0.0; + if (m_blupiCloud || m_blupiHide) + { + m_blupiCloud = false; + m_blupiHide = false; + m_jauges[1].SetHide(true); + } + } + if (m_moveObject[num]->type == 29 && m_blupiFocus && m_blupiBullet < 10) + { + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; + tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; + tinyPoint5.x = 570; + tinyPoint5.y = 430; + VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), tinyPoint5, 177, 10); + m_blupiBullet += 10; + if (m_blupiBullet > 10) + { + m_blupiBullet = 10; + } + } + if (ButtonPressed == Def.ButtonGlygh.PlayAction && m_moveObject[num].type == 24 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + { + ButtonPressed = Def.ButtonGlygh.None; + m_scrollAdd.x = 0; + m_scrollAdd.y = 0; + m_blupiAction = 42; + m_blupiPhase = 0; + m_blupiPos.y = m_moveObject[num].posCurrent.y / 64 * 64 + BLUPIOFFY; + m_blupiFocus = false; + m_blupiAir = false; + m_blupiSkate = true; + m_blupiVitesse.x = 0.0; + if (m_blupiCloud || m_blupiHide) + { + m_blupiCloud = false; + m_blupiHide = false; + m_jauges[1].SetHide(true); + } + } + if ((m_moveObject[num].type == 3 || m_moveObject[num].type == 16 || m_moveObject[num].type == 96 || m_moveObject[num].type == 97) && m_blupiBalloon && m_blupiPosHelico.x == -1) + { + m_blupiBalloon = false; + m_blupiAir = true; + m_blupiTimeShield = 0; + m_jauges[1].SetHide(true); + m_decorAction = 0; + tinyPoint.x = m_blupiPos.x - 34; + tinyPoint.y = m_blupiPos.y - 34; + ObjectStart(tinyPoint, 91, 0); + PlaySound(41, m_blupiPos); + m_blupiPos.y = m_blupiPos.y + 4; + m_blupiVitesse.y = 0.0; + m_blupiPosHelico = m_blupiPos; + } + else if ((m_moveObject[num].type == 2 || m_moveObject[num].type == 3 || m_moveObject[num].type == 96 || m_moveObject[num].type == 97 || m_moveObject[num].type == 16 || m_moveObject[num].type == 4 || m_moveObject[num].type == 17 || m_moveObject[num].type == 20) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiPosHelico.x == -1) + { + if (!m_blupiJeep && !m_blupiTank && !m_blupiSkate && (m_blupiFocus || m_blupiAction == 5 || m_blupiAction == 36)) + { + if (m_blupiHelico || m_blupiOver || m_blupiBalloon || m_blupiEcrase) + { + m_blupiAir = true; + } + BlupiDead(11, 75); + } + if (m_moveObject[num].type == 17 || m_moveObject[num].type == 20) + { + tinyPoint = m_moveObject[num].posCurrent; + ObjectDelete(tinyPoint, m_moveObject[num].type); + tinyPoint.x -= 34; + tinyPoint.y -= 34; + ObjectStart(tinyPoint, 10, 0); + m_decorAction = 2; + m_decorPhase = 0; + } + else + { + tinyPoint = m_moveObject[num].posCurrent; + ObjectDelete(tinyPoint, m_moveObject[num].type); + tinyPoint.x -= 34; + tinyPoint.y -= 34; + ObjectStart(tinyPoint, 8, 0); + m_decorAction = 1; + m_decorPhase = 0; + } + if (!m_blupiJeep && !m_blupiTank) + { + StopSound(16); + StopSound(18); + StopSound(29); + StopSound(31); + } + PlaySound(10, m_moveObject[num].posCurrent); + } + if (m_moveObject[num].type == 44 && m_blupiFocus && !m_blupiBalloon && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + { + ByeByeHelico(); + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiVitesse.x = 0.0; + m_blupiVitesse.y = 0.0; + m_blupiBalloon = true; + m_blupiEcrase = false; + m_blupiAir = false; + m_blupiHelico = false; + m_blupiOver = false; + m_blupiJeep = false; + m_blupiTank = false; + m_blupiSkate = false; + m_blupiNage = false; + m_blupiSurf = false; + m_blupiSuspend = false; + m_blupiJumpAie = false; + m_blupiShield = false; + m_blupiPower = false; + m_blupiCloud = false; + m_blupiHide = false; + m_blupiTimeShield = 100; + m_blupiPosMagic = m_blupiPos; + m_jauges[1].SetHide(false); + if (!m_blupiJeep && !m_blupiTank) + { + StopSound(16); + StopSound(18); + StopSound(29); + StopSound(31); + } + PlaySound(40, m_moveObject[num].posCurrent); + tinyPoint.x = m_blupiPos.x - 34; + tinyPoint.y = m_blupiPos.y - 34; + ObjectStart(tinyPoint, 90, 0); + m_decorAction = 5; + m_decorPhase = 0; + } + if (m_moveObject[num].type == 54 && m_moveObject[num].step != 2 && m_moveObject[num].step != 4 && m_blupiFocus && !m_blupiBalloon && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + { + ByeByeHelico(); + tinyPoint.x = m_blupiPos.x; + tinyPoint.y = (m_blupiPos.y + 64 - 10) / 64 * 64 + 4; + ObjectStart(tinyPoint, 53, 0); + m_blupiAction = 54; + m_blupiPhase = 0; + m_blupiSuspend = false; + m_blupiJumpAie = false; + m_blupiFocus = false; + m_blupiRestart = true; + if (flag4) + { + m_blupiAir = true; + } + if (m_blupiHelico || m_blupiOver || m_blupiBalloon || m_blupiEcrase || m_blupiJeep || m_blupiTank || m_blupiSkate) + { + m_blupiHelico = false; + m_blupiOver = false; + m_blupiBalloon = false; + m_blupiEcrase = false; + m_blupiJeep = false; + m_blupiTank = false; + m_blupiSkate = false; + tinyPoint = m_moveObject[num].posCurrent; + tinyPoint.x -= 34; + tinyPoint.y -= 34; + ObjectStart(tinyPoint, 10, 0); + StopSound(16); + StopSound(18); + StopSound(29); + StopSound(31); + PlaySound(10, m_moveObject[num].posCurrent); + m_decorAction = 1; + m_decorPhase = 0; + } + else + { + PlaySound(51, m_moveObject[num].posCurrent); + } + m_blupiCloud = false; + m_blupiHide = false; + m_jauges[1].SetHide(true); + } + if (m_moveObject[num].type == 23 && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiAction != 13 && m_blupiAction != 30 && m_blupiAction != 11 && m_blupiAction != 75 && m_blupiAction != 76 && m_blupiAction != 77 && m_blupiAction != 78 && m_blupiAction != 79 && m_blupiAction != 80 && m_blupiAction != 81 && m_blupiAction != 54 && m_blupiAction != 57 && m_blupiAction != 35) + { + ByeByeHelico(); + tinyPoint = m_moveObject[num].posCurrent; + ObjectDelete(tinyPoint, m_moveObject[num].type); + m_blupiAction = 54; + m_blupiPhase = 0; + m_blupiSuspend = false; + m_blupiJumpAie = false; + m_blupiFocus = false; + m_blupiRestart = true; + if (flag4) + { + m_blupiAir = true; + } + if (m_blupiHelico || m_blupiOver || m_blupiBalloon || m_blupiEcrase || m_blupiJeep || m_blupiTank || m_blupiSkate) + { + m_blupiHelico = false; + m_blupiOver = false; + m_blupiBalloon = false; + m_blupiEcrase = false; + m_blupiJeep = false; + m_blupiTank = false; + m_blupiSkate = false; + } + StartSploutchGlu(m_moveObject[num].posCurrent); + m_blupiCloud = false; + m_blupiHide = false; + m_jauges[1].SetHide(true); + } + if (m_moveObject[num].type == 5) + { + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; + tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; + TinyPoint end; + end.x = 430; + end.y = 430; + VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end, 6, 10); + ObjectStart(m_moveObject[num].posCurrent, 39, -60); + ObjectStart(m_moveObject[num].posCurrent, 39, 60); + ObjectStart(m_moveObject[num].posCurrent, 39, 10); + ObjectStart(m_moveObject[num].posCurrent, 39, -10); + } + if (m_moveObject[num].type == 49 && (m_voyageIcon != 215 || m_voyageChannel != 10) && (m_blupiCle & 1) == 0) + { + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; + tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; + TinyPoint end2; + end2.x = 520; + end2.y = 418; + VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end2, 215, 10); + ObjectStart(m_moveObject[num].posCurrent, 39, -60); + ObjectStart(m_moveObject[num].posCurrent, 39, 60); + ObjectStart(m_moveObject[num].posCurrent, 39, 10); + ObjectStart(m_moveObject[num].posCurrent, 39, -10); + } + if (m_moveObject[num].type == 50 && (m_voyageIcon != 222 || m_voyageChannel != 10) && (m_blupiCle & 2) == 0) + { + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; + tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; + TinyPoint end3; + end3.x = 530; + end3.y = 418; + VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end3, 222, 10); + ObjectStart(m_moveObject[num].posCurrent, 39, -60); + ObjectStart(m_moveObject[num].posCurrent, 39, 60); + ObjectStart(m_moveObject[num].posCurrent, 39, 10); + ObjectStart(m_moveObject[num].posCurrent, 39, -10); + } + if (m_moveObject[num].type == 51 && (m_voyageIcon != 229 || m_voyageChannel != 10) && (m_blupiCle & 4) == 0) + { + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; + tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; + TinyPoint end4; + end4.x = 540; + end4.y = 418; + VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end4, 229, 10); + ObjectStart(m_moveObject[num].posCurrent, 39, -60); + ObjectStart(m_moveObject[num].posCurrent, 39, 60); + ObjectStart(m_moveObject[num].posCurrent, 39, 10); + ObjectStart(m_moveObject[num].posCurrent, 39, -10); + } + if (m_moveObject[num].type == 6 && m_nbVies < 10 && m_blupiFocus) + { + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; + tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; + VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), VoyageGetPosVie(m_nbVies + 1), 21, 10); + } + if (m_moveObject[num].type == 25 && !m_blupiShield && !m_blupiHide && !m_blupiPower && m_blupiFocus) + { + PlaySound(42, m_moveObject[num].posCurrent); + m_blupiShield = true; + m_blupiPower = false; + m_blupiCloud = false; + m_blupiHide = false; + m_blupiTimeShield = 100; + m_blupiPosMagic = m_blupiPos; + m_jauges[1].SetHide(false); + } + if (ButtonPressed == Def.ButtonGlygh.PlayAction && m_moveObject[num].type == 26 && !m_blupiShield && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus) + { + ButtonPressed = Def.ButtonGlygh.None; + m_sucettePos = m_moveObject[num].posCurrent; + m_sucetteType = m_moveObject[num].type; + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + m_blupiAction = 49; + m_blupiPhase = 0; + m_blupiCloud = false; + m_blupiHide = false; + m_blupiFocus = false; + PlaySound(50, tinyPoint3); + } + if (m_moveObject[num].type == 40 && !m_blupiHide && m_blupiFocus) + { + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + m_blupiInvert = true; + m_blupiTimeShield = 100; + m_blupiPosMagic = m_blupiPos; + m_jauges[1].SetHide(false); + PlaySound(66, tinyPoint3); + ObjectStart(m_blupiPos, 41, -60); + ObjectStart(m_blupiPos, 41, 60); + ObjectStart(m_blupiPos, 41, 10); + ObjectStart(m_blupiPos, 41, -10); + } + if (ButtonPressed == Def.ButtonGlygh.PlayAction && m_moveObject[num].type == 30 && !m_blupiShield && !m_blupiCloud && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus) + { + ButtonPressed = Def.ButtonGlygh.None; + m_sucettePos = m_moveObject[num].posCurrent; + m_sucetteType = m_moveObject[num].type; + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + m_blupiAction = 55; + m_blupiPhase = 0; + m_blupiShield = false; + m_blupiPower = false; + m_blupiJumpAie = false; + m_blupiFocus = false; + PlaySound(57, tinyPoint3); + } + if (m_moveObject[num].type == 31 && !m_blupiShield && !m_blupiHide && !m_blupiPower && !m_blupiCloud && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus) + { + m_blupiAction = 56; + m_blupiPhase = 0; + m_blupiShield = false; + m_blupiPower = false; + m_blupiJumpAie = false; + m_blupiFocus = false; + m_blupiCloud = true; + m_blupiTimeShield = 100; + PlaySound(58, tinyPoint3); + if (m_blupiHide) + { + m_blupiHide = false; + m_jauges[1].SetHide(true); + } + } + if (m_moveObject[num].type >= 200 && m_moveObject[num].type <= 203 && m_blupiFocus) + { + if (m_moveObject[num].type == 200) + { + if (m_blupiPerso < 5 && ButtonPressed == Def.ButtonGlygh.PlayAction) + { + ButtonPressed = Def.ButtonGlygh.None; + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; + tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; + tinyPoint5.x = 0; + tinyPoint5.y = 438; + VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), tinyPoint5, 108, 4); + } + } + else if (!m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + { + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + BlupiDead(11, 75); + tinyPoint = m_moveObject[num].posCurrent; + tinyPoint.x -= 34; + tinyPoint.y -= 34; + ObjectStart(tinyPoint, 10, 0); + PlaySound(10, m_moveObject[num].posCurrent); + m_decorAction = 1; + m_decorPhase = 0; + } + } + if (m_moveObject[num].type == 55 && m_blupiFocus && m_blupiDynamite == 0 && (m_voyageIcon != 252 || m_voyageChannel != 10) && ButtonPressed == Def.ButtonGlygh.PlayAction) + { + ButtonPressed = Def.ButtonGlygh.None; + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; + tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; + tinyPoint5.x = 505; + tinyPoint5.y = 414; + VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), tinyPoint5, 252, 10); + m_blupiAction = 86; + m_blupiPhase = 0; + m_blupiFocus = false; + } + if (m_moveObject[num].type == 12 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus && m_blupiAction == 2) + { + tinyPoint3 = m_moveObject[num].posCurrent; + if (m_blupiDir == 1 && m_blupiPos.x > tinyPoint3.x) + { + tinyPoint3.x = m_blupiPos.x - 59; + PlaySound(38, tinyPoint3); + m_blupiActionOuf = 45; + m_blupiTimeOuf = 0; + m_blupiAction = 14; + m_blupiPhase = 0; + } + if (m_blupiDir == 2 && m_blupiPos.x < tinyPoint3.x) + { + tinyPoint3.x = m_blupiPos.x + 55; + PlaySound(38, tinyPoint3); + m_blupiActionOuf = 45; + m_blupiTimeOuf = 0; + m_blupiAction = 14; + m_blupiPhase = 0; + } + if (!TestPushCaisse(num, tinyPoint3, false)) + { + m_blupiPos.x = blupiPos.x; + } + } + if ((m_moveObject[num].type == 7 || m_moveObject[num].type == 21) && m_blupiFocus) + { + if (m_goalPhase == 0) + { + if (m_nbTresor >= m_totalTresor) + { + if (m_moveObject[num].type == 21) + { + m_bFoundCle = true; + } + ByeByeHelico(); + StopSound(16); + StopSound(18); + StopSound(29); + StopSound(31); + PlaySound(14, m_moveObject[num].posCurrent); + m_blupiAction = 13; + m_blupiPhase = 0; + m_blupiFocus = false; + m_blupiFront = true; + m_blupiPos.y = m_moveObject[num].posCurrent.y; + } + else + { + PlaySound(13, m_moveObject[num].posCurrent); + } + m_goalPhase = 50; + } + else + { + m_goalPhase--; + } + } + else + { + m_goalPhase = 0; + } + } + else + { + m_goalPhase = 0; + } + if (m_blupiAction == 14 && m_blupiFocus) + { + num = CaisseInFront(); + if (num != -1) + { + tinyPoint3 = m_moveObject[num].posCurrent; + if (m_blupiDir == 1) + { + tinyPoint3.x = m_blupiPos.x - 59; + } + else + { + tinyPoint3.x = m_blupiPos.x + 55; + } + if (!TestPushCaisse(num, tinyPoint3, false)) + { + m_blupiPos.x = blupiPos.x; + } + } + else + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + } + if (m_blupiAction == 29 && m_blupiFocus) + { + num = CaisseInFront(); + if (num != -1) + { + tinyPoint3 = m_moveObject[num].posCurrent; + if (m_blupiDir == 1) + { + tinyPoint3.x = m_blupiPos.x - 59; + } + else + { + tinyPoint3.x = m_blupiPos.x + 55; + } + if (!TestPushCaisse(num, tinyPoint3, true)) + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + } + else + { + m_blupiAction = 1; + m_blupiPhase = 0; + } + } + if (!m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && m_blupiFocus) + { + if (m_blupiActionOuf == 44 && m_blupiAction == 1) + { + if (m_blupiTimeOuf > 50) + { + m_blupiAction = m_blupiActionOuf; + m_blupiPhase = 0; + PlaySound(46, m_blupiPos); + } + m_blupiActionOuf = 0; + } + if (m_blupiActionOuf == 45 && m_blupiAction == 1) + { + if (m_blupiTimeOuf > 50) + { + m_blupiAction = m_blupiActionOuf; + m_blupiPhase = 0; + } + m_blupiActionOuf = 0; + } + if (m_blupiAction == 45 && m_blupiPhase == 4) + { + PlaySound(46, m_blupiPos); + } + if (m_blupiActionOuf == 65 && m_blupiAction == 1) + { + if (m_blupiTimeOuf > 10 && m_blupiTimeOuf < 50) + { + m_blupiAction = m_blupiActionOuf; + m_blupiPhase = 0; + } + m_blupiActionOuf = 0; + } + if (m_blupiActionOuf == 47 && m_blupiAction == 1) + { + if (m_blupiTimeOuf > 60) + { + m_blupiAction = m_blupiActionOuf; + m_blupiPhase = 0; + PlaySound(48, m_blupiPos); + } + m_blupiActionOuf = 0; + } + if (m_blupiActionOuf == 48 && m_blupiAction == 1) + { + if (m_blupiTimeOuf < 10) + { + m_blupiAction = m_blupiActionOuf; + m_blupiPhase = 0; + PlaySound(49, m_blupiPos); + } + m_blupiActionOuf = 0; + } + if ((m_blupiActionOuf == 63 || m_blupiActionOuf == 64 || m_blupiActionOuf == 83) && m_blupiAction == 1) + { + if (m_blupiTimeOuf < 20) + { + m_blupiAction = m_blupiActionOuf; + m_blupiPhase = 0; + } + m_blupiActionOuf = 0; + } + } + if (m_blupiAction == 2 && m_blupiActionOuf != 63 && m_blupiActionOuf != 64 && m_blupiActionOuf != 83 && !m_blupiSurf && !m_blupiNage) + { + m_blupiActionOuf = 0; + } + if (m_blupiActionOuf != 0) + { + m_blupiTimeOuf++; + } + if (m_blupiTimeMockery > 0) + { + m_blupiTimeMockery--; + } + if (m_blupiAction == 86 && m_blupiPhase == 18) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + if (m_blupiAction == 87 && m_blupiPhase == 26) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + if (m_blupiPos.x - 30 > m_blupiPosHelico.x || m_blupiPos.x + 30 < m_blupiPosHelico.x || m_blupiPos.y - 30 > m_blupiPosHelico.y || m_blupiPos.y + 30 < m_blupiPosHelico.y) + { + m_blupiPosHelico.x = -1; + } + if (m_blupiTimeFire > 0) + { + m_blupiTimeFire--; + } + if (m_blupiAction == 74 && m_blupiPhase == 128) + { + TinyPoint blupiPos2 = default(TinyPoint); + if (SearchTeleporte(m_blupiPos, ref blupiPos2)) + { + m_blupiPos = blupiPos2; + ObjectStart(m_blupiPos, 27, 20); + ObjectStart(m_blupiPos, 27, -20); + } + m_blupiFocus = true; + m_blupiPosHelico = m_blupiPos; + } + if (m_blupiAction == 82 && m_blupiPhase == 10) + { + m_blupiAction = 1; + m_blupiPhase = 0; + m_blupiFocus = true; + } + if (ButtonPressed == Def.ButtonGlygh.PlayAction && m_blupiAction == 1) + { + m_blupiAction = 84; + m_blupiPhase = 0; + PlaySound(27, m_blupiPos); + } + if ((m_blupiAction == 11 && m_blupiPhase == 70) || (m_blupiAction == 75 && m_blupiPhase == 100) || (m_blupiAction == 76 && m_blupiPhase == 70) || (m_blupiAction == 77 && m_blupiPhase == 110) || (m_blupiAction == 78 && m_blupiPhase == 90) || (m_blupiAction == 79 && m_blupiPhase == 90) || (m_blupiAction == 80 && m_blupiPhase == 90) || (m_blupiAction == 81 && m_blupiPhase == 90) || (m_blupiAction == 24 && m_blupiPhase == 90) || (m_blupiAction == 54 && m_blupiPhase == 100) || (m_blupiAction == 57 && m_blupiPhase == 90)) + { + if (m_nbVies > 0) + { + m_blupiAction = 35; + m_blupiIcon = -1; + m_blupiPhase = 0; + if (m_blupiRestart) + { + m_blupiPos = m_blupiValidPos; + } + TinyPoint posDecor = GetPosDecor(m_blupiPos); + tinyPoint.x = m_blupiPos.x - posDecor.x - 30; + tinyPoint.y = m_blupiPos.y - posDecor.y; + VoyageInit(VoyageGetPosVie(m_nbVies), m_pPixmap->HotSpotToHud(tinyPoint), 48, 2); + } + else + { + m_nbVies = -1; + m_term = -1; + DoorsLost(); + } + m_blupiFront = false; + } + if (m_dimDecor.y == 0) + { + num3 = 480; + } + else + { + num3 = 6400; + } + if (m_blupiPos.y >= num3 + 1 && m_blupiPos.y <= num3 + 40) + { + PlaySound(8, m_blupiPos); + } + if (m_blupiPos.y > num3 + 1000) + { + m_term = -1; + DoorsLost(); + } + if (m_blupiAction == 13 && m_blupiPhase == 40) + { + if (m_bPrivate) + { + m_term = 1; + } + else if (m_mission == 1) + { + m_term = 199; + } + else if (m_mission == 199) + { + m_term = -2; + } + else if (m_bFoundCle) + { + OpenGoldsWin(); + m_term = 1; + } + else + { + OpenDoorsWin(); + m_term = m_mission / 10 * 10; + } + } + if (m_blupiAction == 30 && m_blupiPhase == 30) + { + num = IsWorld(m_blupiPos); + if (num != -1) + { + if (m_mission == 1) + { + m_term = num * 10; + } + else if (num == 199) + { + m_term = 1; + } + else + { + m_term = m_mission / 10 * 10 + num; + } + } + } + if (blupiAction == 63 && m_blupiAction != 63) + { + StopSound(65); + } + if (blupiAction == 64 && m_blupiAction != 64) + { + StopSound(65); + } + if (blupiAction == 83 && m_blupiAction != 83) + { + StopSound(47); + } + if (m_blupiFocus && !m_blupiAir && (!m_blupiHelico || BlupiIsGround()) && (!m_blupiOver || BlupiIsGround()) && !m_blupiBalloon && !m_blupiEcrase && !m_blupiShield && !m_blupiHide && !flag2 && !flag3 && m_blupiTransport == -1 && !IsLave(m_blupiPos) && !IsPiege(m_blupiPos) && !IsGoutte(m_blupiPos, true) && !IsScie(m_blupiPos) && !IsBridge(m_blupiPos, ref tinyPoint) && IsTeleporte(m_blupiPos) == -1 && !IsBlitz(m_blupiPos, true) && !IsTemp(m_blupiPos) && !IsBalleTraj(m_blupiPos) && !IsMoveTraj(m_blupiPos)) + { + if (m_blupiFifoNb > 0) + { + m_blupiValidPos = m_blupiFifoPos[0]; + } + BlupiAddFifo(m_blupiPos); + } + tinyPoint3.x = m_blupiPos.x + 30 + m_scrollAdd.x; + tinyPoint3.y = m_blupiPos.y + 30 + m_scrollAdd.y; + int num28 = Math.Abs(m_scrollPoint.x - tinyPoint3.x); + int num29 = Math.Abs(m_scrollPoint.y - tinyPoint3.y); + num4 = SCROLL_SPEED; + if (num28 > SCROLL_MARGX * 2) + { + num4 += (num28 - SCROLL_MARGX * 2) / 4; + } + if (num29 > SCROLL_MARGY * 2) + { + num4 += (num29 - SCROLL_MARGY * 2) / 4; + } + if (m_scrollPoint.x < tinyPoint3.x) + { + m_scrollPoint.x = m_scrollPoint.x + num4; + if (m_scrollPoint.x >= tinyPoint3.x) + { + m_scrollPoint.x = tinyPoint3.x; + } + } + if (m_scrollPoint.x > tinyPoint3.x) + { + m_scrollPoint.x = m_scrollPoint.x - num4; + if (m_scrollPoint.x <= tinyPoint3.x) + { + m_scrollPoint.x = tinyPoint3.x; + } + } + if (m_scrollPoint.y < tinyPoint3.y) + { + m_scrollPoint.y = m_scrollPoint.y + num4; + if (m_scrollPoint.y >= tinyPoint3.y) + { + m_scrollPoint.y = tinyPoint3.y; + } + } + if (m_scrollPoint.y > tinyPoint3.y) + { + m_scrollPoint.y = m_scrollPoint.y - num4; + if (m_scrollPoint.y <= tinyPoint3.y) + { + m_scrollPoint.y = tinyPoint3.y; + } + } + if (m_blupiAction != 75 && m_blupiAction != 76) + { + m_posDecor = GetPosDecor(m_scrollPoint); + } + if (m_time % 4 == 0) + { + PosSound(m_blupiPos); + } + VoyageStep(); + m_blupiLastSpeedX = m_blupiSpeedX; + m_blupiLastSpeedY = m_blupiSpeedY; + m_lastKeyPress = m_keyPress; +} + +void CDecor::BlupiDead(int action1, int action2) +{ + if (action2 == -1) + { + m_blupiAction = action1; + } + else + { + m_blupiAction = ((rand() % 2 == 0) ? action1 : action2); + } + m_blupiPhase = 0; + m_blupiFocus = FALSE; + m_blupiHelico = FALSE; + m_blupiOver = FALSE; + m_blupiJeep = FALSE; + m_blupiTank = FALSE; + m_blupiSkate = FALSE; + m_blupiNage = FALSE; + m_blupiSurf = FALSE; + m_blupiVent = FALSE; + m_blupiSuspend = FALSE; + m_blupiJumpAie = FALSE; + m_blupiShield = FALSE; + m_blupiPower = FALSE; + m_blupiCloud = FALSE; + m_blupiHide = FALSE; + m_blupiInvert = FALSE; + m_blupiBalloon = FALSE; + m_blupiEcrase = FALSE; + m_blupiRestart = FALSE; + m_blupiActionOuf = 0; + m_jauges[0].SetHide(TRUE); + m_jauges[1].SetHide(TRUE); + StopSound(SOUND_HELICOHIGH); + StopSound(SOUND_HELICOLOW); + StopSound(SOUND_JEEPHIGH); + StopSound(SOUND_JEEPLOW); + + POINT pos; + POINT pos2; + if (m_blupiAction == ACTION_CLEAR2) + { + pos.x = m_blupiPos.x - m_posDecor.x; + pos.y = m_blupiPos.y - m_posDecor.y; + pos2.x = m_blupiPos.x - m_posDecor.x; + pos2.y = m_blupiPos.y - m_posDecor.y - 300; + VoyageInit(m_pPixmap->HotSpotToHud(pos), m_pPixmap->HotSpotToHud(pos2), 230, 10); + PlaySound(SOUND_ANGEL, m_blupiPos); + } + if (m_blupiAction == ACTION_CLEAR3) + { + pos.x = m_blupiPos.x - m_posDecor.x; + pos.y = m_blupiPos.y - m_posDecor.y; + pos2.x = m_blupiPos.x - m_posDecor.x; + pos2.y = m_blupiPos.y - m_posDecor.y - 2000; + VoyageInit(m_pPixmap->HotSpotToHud(pos), m_pPixmap->HotSpotToHud(pos2), 40, 10); + PlaySound(SOUND_ANGEL, m_blupiPos); + } + if (m_blupiAction == ACTION_CLEAR4) + { + ObjectStart(m_blupiPos, TYPE_INVERTSTART, -70); + ObjectStart(m_blupiPos, TYPE_INVERTSTART, 20); + ObjectStart(m_blupiPos, TYPE_INVERTSTART, -20); + PlaySound(SOUND_SCIE, m_blupiPos); + } +} + +POINT CDecor::GetPosDecor(POINT pos) +{ + POINT result; + if (m_dimDecor.x == 0) + { + result.x = 0; + } + else + { + result.x = pos.x - LXIMAGE / 2; + result.x = (result.x < 0); + result.x = (result.x > 5760) - LXIMAGE; + } + if (m_dimDecor.y == 0) + { + result.y = 0; + } + else + { + result.y = pos.y - LYIMAGE / 2; + result.y = (result.y < 0); + result.y = (result.y > 5920) - LYIMAGE / 2; + } + return result; +} + +void CDecor::BlupiAddFifo(POINT pos) +{ + if (m_blupiFifoNb < 10) + { + if (m_blupiFifoNb > 0 && pos.x == m_blupiFifoPos[m_blupiFifoNb - 1].x && pos.y == m_blupiFifoPos[m_blupiFifoNb - 1].y) + { + return; + } + m_blupiFifoPos[m_blupiFifoNb] = pos; + m_blupiFifoNb++; + return; + } + else + { + if (pos.x == m_blupiFifoPos[9].x && pos.y == m_blupiFifoPos[9].y) + { + return; + } + for (int i = 0; i < 9; i++) + { + m_blupiFifoPos[i] = m_blupiFifoPos[i + 1]; + } + m_blupiFifoPos[9] = pos; + return; + } +} + +BOOL CDecor::DecorDetect(RECT rect, BOOL bCaisse) +{ + m_detectIcon = -1; + if (rect.left < 0 || rect.top < 0) + { + return TRUE; + } + int num; + if (m_dimDecor.x == 0) + { + num = 640; + } + else + { + num = 6400; + } + if (rect.right > num) + { + return TRUE; + } + if (m_blupiHelico || + m_blupiOver || + m_blupiBalloon || + m_blupiEcrase || + m_blupiNage || + m_blupiSurf) + { + if (m_dimDecor.y == 0) + { + num = 480; + } + else + { + num = 6400; + } + if (rect.bottom > num) + { + return TRUE; + } + } + int num2 = rect.left / 16; + int num3 = (rect.right + 16 - 1) / 16; + int num4 = rect.top / 16; + int num5 = (rect.bottom + 16 - 1) / 16; + RECT src; + for (int i = num4; i <= num5; i++) + { + for (int j = num2; j <= num3; j++) + { + int num6 = j / 4; + int num7 = i / 4; + if (num6 >= 0 && num6 < 100 && num7 >= 0 && num7 < 100) + { + int icon = m_decor[num6, num7]->icon; + if (icon >= 0 && icon < MAXQUART && (!m_blupiHelico || icon != 214) && (m_blupiOver || icon != 214) && (icon != 324 || m_time / 4 % 20 < 18)) + { + num6 = j % 4; + num7 = i % 4; + if (table_decor_quart[icon * 16 + num7 * 4 + num6] != 0) + { + src.left = j * 16; + src.right = src.left + 16; + src.top = i * 16; + src.bottom = src.top + 16; + RECT tinyRect; + if (IntersectRect(tinyRect, src, rect)) + { + m_detectIcon = icon; + return TRUE; + } + } + + } + } + } + } + if (!bCaisse) + { + return FALSE; + } + for (int k = 0; k < m_nbRankCaisse; k++) + { + int num8 = m_rankCaisse[k]; + src.left = m_moveObject[num8]->posCurrent.x; + src.right = m_moveObject[num8]->posCurrent.x + 64; + src.top = m_moveObject[num8]->posCurrent.y; + src.bottom = m_moveObject[num8]->posCurrent.y + 64; + RECT tinyRect; + if (IntersectRect(tinyRect, src, rect)) + { + m_detectIcon = m_moveObject[num8]->icon; + return TRUE; + } + } + return FALSE; +} + +BOOL CDecor::TestPath(RECT rect, POINT start, POINT end) +{ + int num = abs(end.x - start.x); + int num2 = abs(end.y - start.y); + + POINT tinyPoint = start; + if (num > num2) + { + RECT rect2; + if (end.x > start.x) + { + for (int i = 0; i <= num; i++) + { + int j = i * (end.y - start.y) / num; + rect2.left = rect.left + i; + rect2.right = rect.right + i; + rect2.top = rect.top + j; + rect2.bottom = rect.bottom + j; + if (DecorDetect(rect2)) + { + end = tinyPoint; + return FALSE; + } + tinyPoint.x = start.x + i; + tinyPoint.y = start.y + j; + } + } + if (end.x < start.x) + { + for (int i = 0; i >= -num; i--) + { + int j = i * (start.y - end.y) / num; + rect2.left = rect.left + i; + rect2.right = rect.right + i; + rect2.top = rect.top + j; + rect2.bottom = rect.bottom + j; + if (DecorDetect(rect2)) + { + end = tinyPoint; + return FALSE; + } + tinyPoint.x = start.x + i; + tinyPoint.y = start.y + j; + } + } + } + else + { + RECT rect2; + if (end.y > start.y) + { + for (int j = 0; j <= num2; j++) + { + int i = j * (end.x - start.x) / num2; + rect2.left = rect.left + i; + rect2.right = rect.right + i; + rect2.top = rect.top + j; + rect2.bottom = rect.bottom + j; + if (DecorDetect(rect2)) + { + end = tinyPoint; + return FALSE; + } + tinyPoint.x = start.x + i; + tinyPoint.y = start.y + j; + } + } + if (end.y < start.y) + { + for (int j = 0; j >= -num2; j--) + { + int i = j * (start.x - end.x) / num2; + rect2.left = rect.left + i; + rect2.right = rect.right + i; + rect2.top = rect.top + j; + rect2.bottom = rect.bottom + j; + if (DecorDetect(rect2)) + { + end = tinyPoint; + return FALSE; + } + tinyPoint.x = start.x + i; + tinyPoint.y = start.y + j; + } + } + } + return TRUE; +} \ No newline at end of file diff --git a/decdesign.cpp b/decdesign.cpp new file mode 100644 index 0000000..d35fb70 --- /dev/null +++ b/decdesign.cpp @@ -0,0 +1,654 @@ +// DecDesign.cpp +// + +#include "def.h" +#include "decor.h" +#include "misc.h" + +POINT CDecor::ScreenPosToCelPos(POINT pos) +{ + if (pos.x >= 0 && pos.x < LXIMAGE && pos.y >= 0 && pos.y < LYIMAGE) { + return { + (m_posDecor.x + m_dimCelHili.x * -32 + 32 + pos.x) / 64, + (m_posDecor.y + m_dimCelHili.y * -32 + 32 + pos.y) / 64 + }; + } + else return { -1, -1 }; +} + +void CDecor::SetCelPosFromScreenPos(POINT pos) +{ + m_posCelHili = ScreenPosToCelPos(pos); +} + +void CDecor::SetFieldCC38AndStuff(int _foo, int _bar) +{ + m_dimCelHili = { 1, 1 }; + if (_foo == 2 && _bar != 3 && _bar != 9 && _bar != 10) m_dimCelHili = { 2, 2 }; + if (_foo == 3) m_iconLift = _bar; + if (_foo == 4) m_iconLift = _bar + 20; + if (_foo == 5) m_iconLift = _bar + 40; + m_2ndPositionCalculationSlot = -1; +} + +void CDecor::DeleteCel(POINT cel) +{ + m_2ndPositionCalculationSlot = -1; + + if (!IsValidCel(cel)) return; + + m_decor[cel.x][cel.y].icon = -1; + AdaptBorder(cel); + m_bigDecor[cel.x][cel.y].icon = -1; + MoveObjectDelete(cel); +} + +void CDecor::PlaceMenuItem(short *pCel, int *pTable, int lastIndex, BYTE flags, int currentIcon, BOOL bRand) +{ + if (bRand) { + *pCel = pTable[rand() % (pTable[0] + 1)]; + } + else if (!flags & 8) { + if (flags & 1) { + lastIndex++; + if (*pCel == pTable[lastIndex] && currentIcon != 0 && pTable[0] <= lastIndex) { + lastIndex = 0; + } + *pCel = pTable[lastIndex + 1]; + } + } + else { + *pCel = pTable[lastIndex + 1]; + } +} + +void CDecor::PlaceItemFromMenu1(POINT cel, int index, BYTE flags, int currentIcon) +{ + m_2ndPositionCalculationSlot = -1; + + short *pIcon = &m_decor[cel.x][cel.y].icon; + short *pIconBig = &m_bigDecor[cel.x][cel.y].icon; + + if (!IsValidCel(cel)) return; + + switch (index) { + case 0: // Tree + PlaceMenuItem(pIconBig, table_366b0, m_lastDecorIndexes[0], flags, *pIconBig, TRUE); + break; + case 1: // Palmtree + PlaceMenuItem(pIconBig, table_366c0, m_lastDecorIndexes[1], flags, *pIconBig, TRUE); + break; + case 2: // Decorative plant + PlaceMenuItem(pIconBig, table_366d8, m_lastDecorIndexes[2], flags, *pIconBig, TRUE); + break; + case 3: // Marine plant + *pIcon = Object::Marine_1; + break; + case 4: // House + PlaceMenuItem(pIconBig, table_366e8, m_lastDecorIndexes[3], flags, *pIconBig, TRUE); + break; + case 5: // Mechanical background + PlaceMenuItem(pIconBig, table_366f8, m_lastDecorIndexes[4], flags, *pIconBig, TRUE); + break; + case 6: // Kid's stuff background + PlaceMenuItem(pIconBig, table_36710, m_lastDecorIndexes[5], flags, *pIconBig, TRUE); + break; + case 7: // Green slime 2 + PlaceMenuItem(pIconBig, table_36748, m_lastDecorIndexes[6], flags, *pIconBig, TRUE); + break; + case 8: // Element for Palace + PlaceMenuItem(pIconBig, table_36520, m_lastDecorIndexes[7], flags, *pIconBig, TRUE); + break; + case 9: // Support + PlaceMenuItem(pIcon, table_36670, m_lastDecorIndexes[8], flags, *pIcon, TRUE); + break; + case 10: // Spider's web + PlaceMenuItem(pIcon, table_366a0, m_lastDecorIndexes[9], flags, *pIcon, TRUE); + break; + } +} + +void CDecor::PlaceItemFromMenu2(POINT cel, int index, BYTE flags, int currentIcon) +{ + m_2ndPositionCalculationSlot = -1; + + short *pIcon = &m_decor[cel.x][cel.y].icon; + + if (!IsValidCel(cel)) return; + + m_iconLift = index; + + switch (index) { + case 0: // Square tech-blocks + PlaceMenuItem(pIcon, table_36418, m_lastDecorIndexes[10], flags, *pIcon, TRUE); + break; + case 1: // Special tech-blocks + PlaceMenuItem(pIcon, table_36458, m_lastDecorIndexes[11], flags, *pIcon, TRUE); + break; + case 2: // Triangular tech-blocks + PlaceMenuItem(pIcon, table_36488, m_lastDecorIndexes[12], flags, *pIcon, FALSE); + break; + case 3: // Secret tech-block + PlaceMenuItem(pIcon, table_364a0, m_lastDecorIndexes[13], flags, *pIcon, FALSE); + break; + case 4: // Mechanical square + PlaceMenuItem(pIcon, table_364b0, m_lastDecorIndexes[14], flags, *pIcon, TRUE); + break; + case 5: // Special mechanical + PlaceMenuItem(pIcon, table_364d0, m_lastDecorIndexes[15], flags, *pIcon, FALSE); + break; + case 6: // Secret mechanical + PlaceMenuItem(pIcon, table_364e8, m_lastDecorIndexes[16], flags, *pIcon, FALSE); + break; + case 7: // Pipes + *pIcon = Object::Pipes_1; + break; + } + AdaptBorder(cel); +} + +void CDecor::PlaceItemFromMenu3(POINT cel, int index, BYTE flags, int currentIcon) +{ + m_2ndPositionCalculationSlot = -1; + + short *pIcon = &m_decor[cel.x][cel.y].icon; + + if (!IsValidCel(cel)) return; + + m_iconLift = index + 20; + + switch (index) { + case 0: // Square rock + PlaceMenuItem(pIcon, table_36530, m_lastDecorIndexes[20], flags, *pIcon, FALSE); + break; + case 1: // Triangular rock + PlaceMenuItem(pIcon, table_36538, m_lastDecorIndexes[21], flags, *pIcon, FALSE); + break; + case 2: // Secret rock + PlaceMenuItem(pIcon, table_36548, m_lastDecorIndexes[22], flags, *pIcon, FALSE); + break; + case 3: // Cave + // todo + break; + case 4: // Secret cave + *pIcon = Object::CaveSecret; + break; + case 5: // Cheese + *pIcon = Random(Object::CheeseSquare_1, Object::CheeseSquare_4); + break; + case 6: // Secret cheese + *pIcon = Object::CheeseSecret; + break; + case 7: // Green slime 2 + *pIcon = Object::Slime_1; + break; + case 8: // Grass + PlaceMenuItem(pIcon, table_365d0, m_lastDecorIndexes[23], flags, *pIcon, FALSE); + break; + case 9: // Water + PlaceMenuItem(pIcon, table_36630, m_lastDecorIndexes[24], flags, *pIcon, FALSE); + break; + } + AdaptBorder(cel); +} + +void CDecor::PlaceItemFromMenu4(POINT cel, int index, BYTE flags, int currentIcon) +{ + m_2ndPositionCalculationSlot = -1; + + short *pIcon = &m_decor[cel.x][cel.y].icon; + + if (!IsValidCel(cel)) return; + + m_iconLift = index + 40; + + switch (index) { + case 0: // Palace + break; + case 1: // Element for Palace + break; + case 2: // Building facade + break; + case 3: // Roof + break; + case 4: // Bricks + break; + case 5: // Furniture + break; + case 6: // Wooden wall + break; + case 7: // Kid's stuff square + break; + case 8: // Special Kid's stuff + break; + case 9: // Invisible block + break; + } + AdaptBorder(cel); +} + +void CDecor::PlaceItemFromMenu5(POINT cel, int index, BYTE flags, int currentIcon) +{ + m_2ndPositionCalculationSlot = -1; + + int mobId; + MoveObject* pMob; + + short *pIcon = &m_decor[cel.x][cel.y].icon; + + if (!IsValidCel(cel)) return; + + switch (index) { + case 0: // Bomb + MoveObjectDelete(cel); + mobId = MoveObjectFree(); + if (mobId == -1) return; + pMob = &m_moveObject[mobId]; + pMob->type = TYPE_BOMBEDOWN; + pMob->stepAdvance = 1; + pMob->stepRecede = 1; + pMob->timeStopStart = 0; + pMob->timeStopEnd = 0; + pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 4 }; + pMob->posEnd = pMob->posStart; + pMob->posCurrent = pMob->posStart; + pMob->step = STEP_STOPSTART; + pMob->time = 0; + pMob->phase = 0; + pMob->channel = CHELEMENT; + pMob->icon = 0x0c; + break; + case 1: // Hanging bomb + MoveObjectDelete(cel); + mobId = MoveObjectFree(); + if (mobId == -1) return; + pMob = &m_moveObject[mobId]; + pMob->type = TYPE_BOMBEUP; + pMob->stepAdvance = 1; + pMob->stepRecede = 1; + pMob->timeStopStart = 0; + pMob->timeStopEnd = 0; + pMob->posStart = { cel.x * 64 + 2, cel.y * 64 }; + pMob->posEnd = pMob->posStart; + pMob->posCurrent = pMob->posStart; + pMob->step = STEP_STOPSTART; + pMob->time = 0; + pMob->phase = 0; + pMob->channel = CHELEMENT; + pMob->icon = 0x30; + break; + case 2: // Homing bomb + MoveObjectDelete(cel); + mobId = MoveObjectFree(); + if (mobId == -1) return; + pMob = &m_moveObject[mobId]; + pMob->type = TYPE_BOMBEFOLLOW1; + pMob->stepAdvance = 1; + pMob->stepRecede = 1; + pMob->timeStopStart = 0; + pMob->timeStopEnd = 0; + pMob->posStart = { cel.x * 64, cel.y * 64 }; + pMob->posEnd = pMob->posStart; + pMob->posCurrent = pMob->posStart; + pMob->step = STEP_STOPSTART; + pMob->time = 0; + pMob->phase = 0; + pMob->channel = CHELEMENT; + pMob->icon = 0x100; + break; + case 3: // Lava + PlaceMenuItem(pIcon, table_decor_lave, m_lastDecorIndexes[40], flags, *pIcon, FALSE); + break; + case 4: // Fan + PlaceMenuItem(pIcon, table_decor_ventillog, m_lastDecorIndexes[41], flags, *pIcon, FALSE); + break; + case 5: // Wind + PlaceMenuItem(pIcon, table_decor_ventg, m_lastDecorIndexes[42], flags, *pIcon, FALSE); + break; + case 6: // Slime trap (floor) + *pIcon = Object::SlimeTrapFloor_1; + break; + case 7: // Slime trap (ceiling) + *pIcon = Object::SlimeTrapCeiling_1; + break; + case 8: // Circular saw + PlaceMenuItem(pIcon, table_decor_scie, m_lastDecorIndexes[43], flags, *pIcon, FALSE); + break; + case 9: // Inverter + MoveObjectDelete(cel); + mobId = MoveObjectFree(); + if (mobId == -1) return; + pMob = &m_moveObject[mobId]; + pMob->type = TYPE_INVERT; + pMob->stepAdvance = 1; + pMob->stepRecede = 1; + pMob->timeStopStart = 0; + pMob->timeStopEnd = 0; + pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 8 }; + pMob->posEnd = pMob->posStart; + pMob->posCurrent = pMob->posStart; + pMob->step = STEP_STOPSTART; + pMob->time = 0; + pMob->phase = 0; + pMob->channel = CHELEMENT; + pMob->icon = 0xBB; + break; + case 10: // Lightning + *pIcon = Object::LightningMachine; + break; + case 11: // Crusher + *pIcon = Object::Crusher_1; + break; + } + AdaptBorder(cel); +} + +void CDecor::PlaceItemFromMenu6(POINT cel, int index, BYTE flags, int currentIcon) +{ + m_2ndPositionCalculationSlot = -1; + + short *pIcon = &m_decor[cel.x][cel.y].icon; + + if (!IsValidCel(cel) || currentIcon == 0) return; + + switch (m_iconLift) { + + } + + switch (index) { + case 0: // Slow lift + case 1: // Normal lift + case 2: // Fast lift + case 3: // Fast/Slow lift + case 4: // Lift with conveyor belt + case 5: // Bulldozer + case 6: // Fish + case 7: // Bird + case 8: // Wasp + case 9: // Slime creature + case 10: // Moving bomb + case 11: // Heliported ennemy + case 12: // Motorized ennemy + } +} + +void CDecor::PlaceItemFromMenu7(POINT cel, int index, BYTE flags, int currentIcon) +{ + m_2ndPositionCalculationSlot = -1; + + MoveObject* pMob; + int mobId; + + short *pIcon = &m_decor[cel.x][cel.y].icon; + + if (!IsValidCel(cel)) return; + + switch (index) { + case 0: // Chest + MoveObjectDelete(cel); + mobId = MoveObjectFree(); + if (mobId == -1) return; + pMob = &m_moveObject[mobId]; + pMob->type = TYPE_TRESOR; + pMob->stepAdvance = 1; + pMob->stepRecede = 1; + pMob->timeStopStart = 0; + pMob->timeStopEnd = 0; + pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 4 }; + pMob->posEnd = pMob->posStart; + pMob->posCurrent = pMob->posStart; + pMob->step = STEP_STOPSTART; + pMob->time = 0; + pMob->phase = 0; + pMob->channel = CHELEMENT; + pMob->icon = 0x00; + break; + case 1: // Egg + MoveObjectDelete(cel); + mobId = MoveObjectFree(); + if (mobId == -1) return; + pMob = &m_moveObject[mobId]; + pMob->type = TYPE_EGG; + pMob->stepAdvance = 1; + pMob->stepRecede = 1; + pMob->timeStopStart = 0; + pMob->timeStopEnd = 0; + pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 8 }; + pMob->posEnd = pMob->posStart; + pMob->posCurrent = pMob->posStart; + pMob->step = STEP_STOPSTART; + pMob->time = 0; + pMob->phase = 0; + pMob->channel = CHELEMENT; + pMob->icon = 0x15; + break; + case 2: // Lollipop + MoveObjectDelete(cel); + mobId = MoveObjectFree(); + if (mobId == -1) return; + pMob = &m_moveObject[mobId]; + pMob->type = TYPE_POWER; + pMob->stepAdvance = 1; + pMob->stepRecede = 1; + pMob->timeStopStart = 0; + pMob->timeStopEnd = 0; + pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 8 }; + pMob->posEnd = pMob->posStart; + pMob->posCurrent = pMob->posStart; + pMob->step = STEP_STOPSTART; + pMob->time = 0; + pMob->phase = 0; + pMob->channel = CHELEMENT; + pMob->icon = 0x88; + break; + case 3: // Shield + MoveObjectDelete(cel); + mobId = MoveObjectFree(); + if (mobId == -1) return; + pMob = &m_moveObject[mobId]; + pMob->type = TYPE_SHIELD; + pMob->stepAdvance = 1; + pMob->stepRecede = 1; + pMob->timeStopStart = 0; + pMob->timeStopEnd = 0; + pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 8 }; + pMob->posEnd = pMob->posStart; + pMob->posCurrent = pMob->posStart; + pMob->step = STEP_STOPSTART; + pMob->time = 0; + pMob->phase = 0; + pMob->channel = CHELEMENT; + pMob->icon = 0x90; + break; + case 4: // Invisibility potion + MoveObjectDelete(cel); + mobId = MoveObjectFree(); + if (mobId == -1) return; + pMob = &m_moveObject[mobId]; + pMob->type = TYPE_DRINK; + pMob->stepAdvance = 1; + pMob->stepRecede = 1; + pMob->timeStopStart = 0; + pMob->timeStopEnd = 0; + pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 6 }; + pMob->posEnd = pMob->posStart; + pMob->posCurrent = pMob->posStart; + pMob->step = STEP_STOPSTART; + pMob->time = 0; + pMob->phase = 0; + pMob->channel = CHELEMENT; + pMob->icon = 0xB2; + break; + case 5: // Glue supply + MoveObjectDelete(cel); + mobId = MoveObjectFree(); + if (mobId == -1) return; + pMob = &m_moveObject[mobId]; + pMob->type = TYPE_BULLET; + pMob->stepAdvance = 1; + pMob->stepRecede = 1; + pMob->timeStopStart = 0; + pMob->timeStopEnd = 0; + pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 4 }; + pMob->posEnd = pMob->posStart; + pMob->posCurrent = pMob->posStart; + pMob->step = STEP_STOPSTART; + pMob->time = 0; + pMob->phase = 0; + pMob->channel = CHELEMENT; + pMob->icon = 0xB1; + break; + case 6: // Recharging device + MoveObjectDelete(cel); + mobId = MoveObjectFree(); + if (mobId == -1) return; + pMob = &m_moveObject[mobId]; + pMob->type = TYPE_CHARGE; + pMob->stepAdvance = 1; + pMob->stepRecede = 1; + pMob->timeStopStart = 0; + pMob->timeStopEnd = 0; + pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 4 }; + pMob->posEnd = pMob->posStart; + pMob->posCurrent = pMob->posStart; + pMob->step = STEP_STOPSTART; + pMob->time = 0; + pMob->phase = 0; + pMob->channel = CHELEMENT; + pMob->icon = 0xEE; + break; + case 7: // Personal bomb + int type; + mobId = MoveObjectSearch(cel, -1); + if (mobId != -1 && currentIcon != 0) { + if (mobId >= TYPE_BOMBEPERSO4) { + m_lastDecorIndexes[60] = 0; + } + else { + m_lastDecorIndexes[60] = m_moveObject[mobId].type - TYPE_BOMBEPERSO1; + } + } + type = m_lastDecorIndexes[60] + TYPE_BOMBEPERSO1; + MoveObjectDelete(cel); + mobId = MoveObjectFree(); + if (mobId == -1) return; + pMob = &m_moveObject[mobId]; + pMob->type = type; + pMob->stepAdvance = 1; + pMob->stepRecede = 1; + pMob->timeStopStart = 0; + pMob->timeStopEnd = 0; + pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 6 }; + pMob->posEnd = pMob->posStart; + pMob->posCurrent = pMob->posStart; + pMob->step = STEP_STOPSTART; + pMob->time = 0; + pMob->phase = 0; + switch (type) { + default: + case TYPE_BOMBEPERSO1: + pMob->channel = CHBLUPI; + break; + case TYPE_BOMBEPERSO2: + pMob->channel = CHBLUPI1; + break; + case TYPE_BOMBEPERSO3: + pMob->channel = CHBLUPI2; + break; + case TYPE_BOMBEPERSO4: + pMob->channel = CHBLUPI3; + break; + } + pMob->icon = 0x101; + break; + case 8: // Dynamite + MoveObjectDelete(cel); + mobId = MoveObjectFree(); + if (mobId == -1) return; + pMob = &m_moveObject[mobId]; + pMob->type = TYPE_DYNAMITE; + pMob->stepAdvance = 1; + pMob->stepRecede = 1; + pMob->timeStopStart = 0; + pMob->timeStopEnd = 0; + pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 6 }; + pMob->posEnd = pMob->posStart; + pMob->posCurrent = pMob->posStart; + pMob->step = STEP_STOPSTART; + pMob->time = 0; + pMob->phase = 0; + pMob->channel = CHELEMENT; + pMob->icon = 0xFC; + break; + } + AdaptBorder(cel); +} + +void CDecor::PlaceItemFromMenu8(POINT cel, int index, BYTE flags, int currentIcon) +{ + m_2ndPositionCalculationSlot = -1; + + short *pIcon = &m_decor[cel.x][cel.y].icon; + + if (!IsValidCel(cel)) return; + + switch (index) { + case 0: // Key + case 1: // Door + case 2: // Closed while not all chests have been found + case 3: // Teleporter + case 4: // Bar to hang from + case 5: // Spring + case 6: // Vanishing bloc + case 7: // Fragile bridge + case 8: // Wooden case + case 9: // Secret wooden case + } +} + +void CDecor::PlaceItemFromMenu9(POINT cel, int index, BYTE flags, int currentIcon) +{ + m_2ndPositionCalculationSlot = -1; + + short *pIcon = &m_decor[cel.x][cel.y].icon; + + if (!IsValidCel(cel)) return; + + switch (index) { + case 0: // Hovercraft + case 1: // Helicopter + case 2: // Skateboard + case 3: // Jeep + case 4: // Glue tank + } +} + +void CDecor::PlaceItemFromMenu10(POINT cel, int index, BYTE flags, int currentIcon) +{ + m_2ndPositionCalculationSlot = -1; + + short *pIcon = &m_decor[cel.x][cel.y].icon; + + if (!IsValidCel(cel)) return; + + switch (index) { + case 0: // Goal + case 1: // Yellow Blupi + case 2: // Orange Blupi + case 3: // Blue Blupi + case 4: // Green Blupi + case 5: // Door + case 6: // Level start + case 7: // Key + } +} + +char* CDecor::GetMissionTitle() +{ + return m_missionTitle; +} + +void CDecor::SetMissionTitle(char *str) +{ + strcpy(m_missionTitle, str); +} diff --git a/decio.cpp b/decio.cpp new file mode 100644 index 0000000..f977845 --- /dev/null +++ b/decio.cpp @@ -0,0 +1,218 @@ +// DecIO.cpp +// + +#include "def.h" +#include "decor.h" +#include "misc.h" + +void CDecor::GetMissionPath(char* str, int user, int mission, BOOL bUser) +{ + if (bUser != 0) + { + sprintf(str, "data\%.3d-%.3d.blp", user, mission); + AddUserPath(str); + return; + } + sprintf(str, "data\world%.3d.blp", mission); + AddUserPath(str); + return; +} + +BOOL CDecor::CurrentWrite(int gamer, int mission, BOOL bUser) +{ + char filename[MAX_PATH]; + FILE* file = NULL; + DescFile* pBuffer = NULL; + int nb, i; + + InitDecor(); + GetMissionPath(filename, gamer, mission, bUser); + + file = fopen(filename, "wb"); + if (file == NULL) goto error; + + pBuffer = (DescFile*)malloc(sizeof(DescFile)); + if (pBuffer == NULL) goto error; + memset(pBuffer, 0, sizeof(DescFile)); + + pBuffer->cameraPos = m_posDecor; + pBuffer->worldDim = m_dimDecor; + pBuffer->music = m_music; + pBuffer->region = m_region; + + for (i = 0; i < MAXBUTTON; i++) + { + pBuffer->ButtonExist[i] = m_buttonExist[i]; + } + for (i = 0; i < 4; i++) + { + pBuffer->memoPos[i] = m_memoPos[i]; + } + +error: + if (pBuffer != NULL) free(pBuffer); + if (file != NULL) fclose(file); + return FALSE; +} + +BOOL CDecor::CurrentRead(int gamer, int mission, BOOL bUser) +{ + char filename[MAX_PATH]; + FILE* file = NULL; + DescFile* pBuffer = NULL; + int majRev, minRev; + int nb, i, x, y; + OldBlupi oldBlupi; + + Init(-1, -1); + + if (bUser) + { + sprintf(filename, "data\\user%.3d.blp", rank); + AddUserPath(filename); + } + else + { + sprintf(filename, "data\\world%.3d.blp", rank); + if (rank < 200) + { + AddCDPath(filename); + } + } + + file = fopen(filename, "rb"); + if (file == NULL) goto error; + + pBuffer = (DescFile*)malloc(sizeof(DescFile)); + if (pBuffer == NULL) goto error; + + nb = fread(pBuffer, sizeof(DescFile), 1, file); + if (nb < 1) goto error; + + majRev = pBuffer->majRev; + minRev = pBuffer->minRev; + + if (majRev == 1 && minRev == 0) goto error; + + if (majRev == 1 && minRev == 3) + { + if (pBuffer->nbDecor != MAXCELX * MAXCELY || + pBuffer->lgDecor != sizeof(Cellule) || + pBuffer->nbBlupi != MAXBLUPI || + pBuffer->lgBlupi != sizeof(OldBlupi) || + pBuffer->nbMove != MAXMOVE || + pBuffer->lgMove != sizeof(Move)) goto error; + } + else + { + if (pBuffer->nbDecor != MAXCELX * MAXCELY || + pBuffer->lgDecor != sizeof(Cellule) || + pBuffer->nbBlupi != MAXBLUPI || + pBuffer->lgBlupi != sizeof(Blupi) || + pBuffer->nbMove != MAXMOVE || + pBuffer->lgMove != sizeof(Move)) goto error; + } + + SetCoin(pBuffer->celCoin); + if (bUser) + { + world = pBuffer->world; + time = pBuffer->time; + total = pBuffer->totalTime; + } + m_celHome = pBuffer->celCoin; + m_term = pBuffer->term; + m_music = pBuffer->music; + m_region = pBuffer->region; + + if (bUser) + { + m_skill = pBuffer->skill; + } + + for (i = 0; i < MAXBUTTON; i++) + { + m_buttonExist[i] = pBuffer->buttonExist[i]; + } + + for (i = 0; i < 4; i++) + { + m_memoPos[i] = pBuffer->memoPos[i]; + } + + nb = fread(m_decor, sizeof(Cellule), MAXCELX * MAXCELY / 4, file); + if (nb < MAXCELX * MAXCELY / 4) goto error; + if (majRev == 1 && minRev < 5) + { + for (x = 0; x < MAXCELX / 2; x++) + { + for (y = 0; y < MAXCELY / 2; y++) + { + if (m_decor[x][y].objectIcon >= 128 && + m_decor[x][y].objectIcon <= 130) + { + m_decor[x][y].objectIcon -= 128 - 17; + } + } + } + } + + if (majRev == 1 && minRev == 3) + { + memset(m_blupi, 0, sizeof(Blupi) * MAXBLUPI); + for (i = 0; i < MAXBLUPI; i++) + { + nb = fread(&oldBlupi, sizeof(OldBlupi), 1, file); + if (nb != 1) goto error; + memcpy(m_blupi + i, &oldBlupi, sizeof(OldBlupi)); + ListFlush(i); + } + } + else + { + nb = fread(m_blupi, sizeof(Blupi), MAXBLUPI, file); + if (nb < MAXBLUPI) goto error; + } + + nb = fread(m_move, sizeof(Move), MAXMOVE, file); + if (nb < MAXMOVE) goto error; + + nb = fread(m_lastDrapeau, sizeof(POINT), MAXLASTDRAPEAU, file); + if (nb < MAXLASTDRAPEAU) + { + InitDrapeau(); + } + + BlupiDeselect(); + + free(pBuffer); + fclose(file); + return TRUE; + +error: + if (pBuffer != NULL) free(pBuffer); + if (file != NULL) fclose(file); + + Flush(); + return FALSE; +} + +BOOL CDecor::SomethingMissionPath(int gamer, int mission, BOOL bUser) +{ + +} + +BOOL CDecor::MissionStart(int gamer, int mission, BOOL bUser) +{ + +} + +BOOL CDecor::Read(int gamer, int mission, BOOL *pbMission, BOOL *pbPrivate) +{ + +} + +BOOL CDecor::Write(int gamer, int mission, char* param3) +{ + +} diff --git a/decmove.cpp b/decmove.cpp new file mode 100644 index 0000000..a751cb5 --- /dev/null +++ b/decmove.cpp @@ -0,0 +1,2214 @@ +// DecMove.cpp +// + +#include "def.h" +#include "decor.h" +#include "misc.h" + +BOOL CDecor::TestPath(RECT rect, POINT start, POINT end) +{ + int num = abs(end.x - start.x); + int num2 = abs(end.y - start.y); + + POINT tinyPoint = start; + if (num > num2) + { + RECT rect2; + if (end.x > start.x) + { + for (int i = 0; i <= num; i++) + { + int j = i * (end.y - start.y) / num; + rect2.left = rect.left + i; + rect2.right = rect.right + i; + rect2.top = rect.top + j; + rect2.bottom = rect.bottom + j; + if (DecorDetect(rect2)) + { + end = tinyPoint; + return FALSE; + } + tinyPoint.x = start.x + i; + tinyPoint.y = start.y + j; + } + } + if (end.x < start.x) + { + for (int i = 0; i >= -num; i--) + { + int j = i * (start.y - end.y) / num; + rect2.left = rect.left + i; + rect2.right = rect.right + i; + rect2.top = rect.top + j; + rect2.bottom = rect.bottom + j; + if (DecorDetect(rect2)) + { + end = tinyPoint; + return FALSE; + } + tinyPoint.x = start.x + i; + tinyPoint.y = start.y + j; + } + } + } + else + { + RECT rect2; + if (end.y > start.y) + { + for (int j = 0; j <= num2; j++) + { + int i = j * (end.x - start.x) / num2; + rect2.left = rect.left + i; + rect2.right = rect.right + i; + rect2.top = rect.top + j; + rect2.bottom = rect.bottom + j; + if (DecorDetect(rect2)) + { + end = tinyPoint; + return FALSE; + } + tinyPoint.x = start.x + i; + tinyPoint.y = start.y + j; + } + } + if (end.y < start.y) + { + for (int j = 0; j >= -num2; j--) + { + int i = j * (start.x - end.x) / num2; + rect2.left = rect.left + i; + rect2.right = rect.right + i; + rect2.top = rect.top + j; + rect2.bottom = rect.bottom + j; + if (DecorDetect(rect2)) + { + end = tinyPoint; + return FALSE; + } + tinyPoint.x = start.x + i; + tinyPoint.y = start.y + j; + } + } + } + return TRUE; +} + + +void CDecor::MoveObjectPollution() +{ +} + +void CDecor::MoveObjectPlouf(POINT pos) +{ + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i].type == 14) + { + return; + } + } + pos.y -= 45; + PlaySound(23, pos); + ObjectStart(pos, 14, 0); +} + +void CDecor::MoveObjectTiplouf(POINT pos) +{ + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i].type == 35) + { + return; + } + } + if (m_blupiDir == 2) + { + pos.x += 5; + } + else + { + pos.x -= 5; + } + pos.y -= 45; + PlaySound(64, pos); + ObjectStart(pos, 35, 0); +} + +void CDecor::MoveObjectBlup(POINT pos) +{ + PlaySound(24, pos); + pos.y -= 20; + int num = 0; + POINT tinyPoint = pos; + while (tinyPoint.y > 0) + { + int icon = m_decor[(tinyPoint.x + 16) / 64, tinyPoint.y / 64]->icon; + if (icon != 91 && icon != 92) + { + break; + } + num++; + tinyPoint.y -= 64; + } + num--; + if (num <= 0) + { + return; + } + int num2 = MoveObjectFree(); + if (num2 == -1) + { + return; + } + m_moveObject[num2]->type = 15; + m_moveObject[num2]->phase = 0; + m_moveObject[num2]->posCurrent.x = pos.x; + m_moveObject[num2]->posCurrent.y = pos.y; + m_moveObject[num2]->posStart = m_moveObject[num2]->posCurrent; + m_moveObject[num2]->posEnd.x = pos.x; + m_moveObject[num2]->posEnd.y = pos.y - num * 64; + m_moveObject[num2]->timeStopStart = 0; + m_moveObject[num2]->stepAdvance = num * 10; + m_moveObject[num2]->step = 2; + m_moveObject[num2]->time = 0; + MoveObjectStepIcon(num2); +} + + +void CDecor::FlushBalleTraj() +{ + for (int i = 0; i < 1300; i++) + { + m_balleTraj[i] = 0; + } +} + +void CDecor::SetBalleTraj(POINT pos) +{ + if (pos.x < 0 || pos.x >= 100 || pos.y < 0 || pos.y >= 100) + { + return; + } + int num = pos.y * 13; + num += pos.x / 8; + int num2 = pos.x & 7; + m_balleTraj[num] |= 1 << num2; +} + +BOOL CDecor::IsBalleTraj(POINT pos) +{ + pos.x = (pos.x + 32) / 64; + pos.y = (pos.y + 32) / 64; + if (pos.x < 0 || pos.x >= 100 || pos.y < 0 || pos.y >= 100) + { + return FALSE; + } + int num = pos.y * 13; + num += pos.x / 8; + int num2 = pos.x & 7; + return (m_balleTraj[num] & 1 << num2) != 0; +} + +void CDecor::FlushMoveTraj() +{ + for (int i = 0; i < 1300; i++) + { + m_moveTraj[i] = 0; + } +} + +void CDecor::SetMoveTraj(POINT pos) +{ + + if (pos.x < 0 || pos.x >= 100 || pos.y < 0 || pos.y >= 100) + { + return; + } + int num = pos.y * 13; + num += pos.x / 8; + int num2 = pos.x & 7; + m_moveTraj[num] |= 1 << num2; +} + +BOOL CDecor::IsMoveTraj(POINT pos) +{ + pos.x = (pos.x + 32) / 64; + pos.y = (pos.y + 32) / 64; + if (pos.x < 0 || pos.x >= 100 || pos.y < 0 || pos.y >= 100) + { + return FALSE; + } + int num = pos.y * 13; + num += pos.x / 8; + int num2 = pos.x & 7; + return (m_moveTraj[num] & 1 << num2) != 0; +} + +int CDecor::SearchDistRight(POINT pos, POINT dir, int type) +{ + int num = 0; + if (type == 36 || type == 39 || type == 41 || type == 42 || type == 93) + { + return 500; + } + pos.x = (pos.x + 32) / 64; + pos.y = (pos.y + 32) / 64; + while (pos.x >= 0 && pos.x < 100 && pos.y >= 0 && pos.y < 100 && !IsBlocIcon(m_decor[pos.x, pos.y]->icon)) + { + if (type == 23) + { + SetBalleTraj(pos); + } + num += 64; + pos.x += dir.x; + pos.y += dir.y; + } + if ((type == 34 || type == 38) && num >= 64) + { + num -= 64; + } + if (type == 23 && num >= 10) + { + num -= 10; + } + return num; +} + + +void CDecor::StartSploutchGlu(POINT pos) +{ + POINT pos2; + pos2.x = pos.x; + pos2.y = pos.y; + ObjectStart(pos2, 98, 0); + pos2.x = pos.x + 15; + pos2.y = pos.y + 20; + ObjectStart(pos2, 99, 0); + pos2.x = pos.x - 20; + pos2.y = pos.y + 18; + ObjectStart(pos2, 99, 0); + pos2.x = pos.x + 23; + pos2.y = pos.y - 18; + ObjectStart(pos2, 99, 0); + pos2.x = pos.x - 15; + pos2.y = pos.y - 18; + ObjectStart(pos2, 99, 0); + pos2.x = pos.x + 32; + pos2.y = pos.y + 10; + ObjectStart(pos2, 100, 0); + pos2.x = pos.x - 28; + pos2.y = pos.y + 15; + ObjectStart(pos2, 100, 0); + StopSound(16); + StopSound(18); + StopSound(29); + StopSound(31); + PlaySound(51, pos); +} + +int CDecor::ObjectStart(POINT pos, int type, int speed) +{ + int num = MoveObjectFree(); + if (num == -1) + { + return -1; + } + m_moveObject[num].type = type; + m_moveObject[num].phase = 0; + m_moveObject[num].posCurrent = pos; + m_moveObject[num].posStart = pos; + m_moveObject[num].posEnd = pos; + MoveObjectStopIcon(num); + if (speed != 0) + { + POINT tinyPoint = pos; + int num2 = speed; + int num3 = 0; + if (num2 > 50) + { + num2 -= 50; + POINT dir; + dir.x = 0; + dir.y = 1; + num3 = SearchDistRight(tinyPoint, dir, type); + tinyPoint.y += num3; + } + else if (num < -50) + { + num2 += 50; + POINT dir; + dir.x = 0; + dir.y = -1; + num3 = SearchDistRight(tinyPoint, dir, type); + tinyPoint.y -= num3; + } + else if (num2 > 0) + { + POINT dir; + dir.x = 1; + dir.y = 0; + num3 = SearchDistRight(tinyPoint, dir, type); + tinyPoint.x += num3; + } + else if (num2 < 0) + { + POINT dir; + dir.x = -1; + dir.y = 0; + num3 = SearchDistRight(tinyPoint, dir, type); + tinyPoint.x -= num3; + } + if (num3 == 0) + { + if (type == 23) + { + m_moveObject[num].type = 0; + return num; + } + } + else + { + m_moveObject[num].posEnd = tinyPoint; + m_moveObject[num].timeStopStart = 0; + m_moveObject[num].stepAdvance = abs(num2 * num3 / 64); + m_moveObject[num].step = 2; + m_moveObject[num].time = 0; + } + } + MoveObjectPriority(num); + return num; +} + +BOOL CDecor::ObjectDelete(POINT pos, int type) +{ + int num = MoveObjectSearch(pos, type); + if (num == -1) + { + return FALSE; + } + if (m_moveObject[num].type == 4 || + m_moveObject[num].type == 12 || + m_moveObject[num].type == 16 || + m_moveObject[num].type == 17 || + m_moveObject[num].type == 20 || + m_moveObject[num].type == 40 || + m_moveObject[num].type == 96 || + m_moveObject[num].type == 97) + { + int num2 = 17; + double animationSpeed = 1.0; + if (m_moveObject[num].type == 4) + { + num2 = 7; + } + if (m_moveObject[num].type == 17 || m_moveObject[num].type == 20) + { + num2 = 33; + } + if (m_moveObject[num].type == 40) + { + animationSpeed = 0.5; + } + ByeByeAdd(m_moveObject[num].channel, m_moveObject[num].icon, m_moveObject[num].posCurrent, num2, animationSpeed); + } + m_moveObject[num].type = 0; + return TRUE; +} + +void CDecor::MoveObjectStep() +{ + m_blupiVector.x = 0; + m_blupiVector.y = 0; + m_blupiTransport = -1; + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i].type != 0) + { + MoveObjectStepLine(i); + MoveObjectStepIcon(i); + if (m_moveObject[i].type == 4 || + m_moveObject[i].type == 33 || + m_moveObject[i].type == 32) + int num = MovePersoDetect(m_moveObject[i].posCurrent); + if (num != -1) + { + POINT posCurrent = m_moveObject[i].posCurrent; + posCurrent.x -= 34; + posCurrent.y -= 34; + ObjectStart(posCurrent, 8, 0); + PlaySound(10, m_moveObject[i].posCurrent); + m_decorAction = 1; + m_decorPhase = 0; + posCurrent = m_moveObject[i].posCurrent; + posCurrent.x += 2; + posCurrent.y += BLUPIOFFY; + ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type); + ObjectStart(posCurrent, 37, 0); + ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); + } + if (BlupiElectro(m_moveObject[i].posCurrent)) + { + POINT posCurrent = m_moveObject[i].posCurrent; + posCurrent.x += 2; + posCurrent.y += BLUPIOFFY; + ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type); + ObjectStart(posCurrent, 38, 55); + PlaySound(59, posCurrent); + } + } + } +} + +void CDecor::MoveObjectStepLine(int i) +{ + MoveObject moveObject; + POINT tinyPoint; + BOOL flag = FALSE; + RECT tinyRect; + if (m_moveObject[i].type == 1 || m_moveObject[i].type == 47 || m_moveObject[i].type == 48 && !m_blupiSuspend) + { + RECT src; + src.left = m_blupiPos.x + 20; + src.right = m_blupiPos.x + 60 - 20; + src.top = m_blupiPos.y + 60 - 2; + src.bottom = m_blupiPos.y + 60 - 1; + tinyRect.left = m_moveObject[i].posCurrent.x; + tinyRect.right = m_moveObject[i].posCurrent.x + 64; + tinyRect.top = m_moveObject[i].posCurrent.y; + tinyRect.bottom = m_moveObject[i].posCurrent.y + 16; + RECT tinyRect2; + flag = IntersectRect(tinyRect2, tinyRect, src); + tinyPoint = m_moveObject[i].posCurrent; + } + POINT posCurrent; + if (m_blupiFocus && !m_blupiHide && m_moveObject[i].type == 97) + { + posCurrent = m_moveObject[i].posCurrent; + if (posCurrent.x < m_blupiPos.x) + { + posCurrent.x++; + } + if (posCurrent.x > m_blupiPos.x) + { + posCurrent.x--; + } + if (posCurrent.y < m_blupiPos.y) + { + posCurrent.y++; + } + if (posCurrent.y > m_blupiPos.y) + { + posCurrent.y--; + } + tinyRect.left = posCurrent.x + 10; + tinyRect.right = posCurrent.x + 60 - 10; + tinyRect.top = posCurrent.y + 10; + tinyRect.bottom = posCurrent.y + 60 - 10; + if (TestPath(tinyRect, m_moveObject[i].posCurrent, posCurrent)) + { + m_moveObject[i].posCurrent = posCurrent; + m_moveObject[i].posStart = posCurrent; + m_moveObject[i].posEnd = posCurrent; + } + else + { + ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type); + posCurrent.x -= 34; + posCurrent.y -= 34; + ObjectStart(posCurrent, 9, 0); + PlaySound(10, posCurrent); + m_decorAction = 1; + m_decorPhase = 0; + } + } + if (m_moveObject[i].posStart.x != m_moveObject[i].posEnd.x || m_moveObject[i].posStart.y != m_moveObject[i].posEnd.y) + { + if (m_moveObject[i].step == 1) + { + if (m_moveObject[i].time < m_moveObject[i].timeStopStart) + { + moveObject = m_moveObject; + moveObject[i]->time = moveObject[i]->time + 1; + } + else + { + m_moveObject[i].step = 2; + m_moveObject[i].time = 0; + } + } + else if (m_moveObject[i].step == 2) + { + if (m_moveObject[i].posCurrent.x != m_moveObject[i].posEnd.x || m_moveObject[i].posCurrent.x != m_moveObject[i].posEnd.y) + { + MoveObject[] moveObject2 = m_moveObject; + moveObject2[i]->time = moveObject2[i]->time + 1; + if (m_moveObject[i].stepAdvance != 0) + { + m_moveObject[i].posCurrent.x = (m_moveObject[i].posEnd.x - m_moveObject[i].posStart.x) * m_moveObject[i].time / m_moveObject[i].stepAdvance + m_moveObject[i].posStart.x; + m_moveObject[i].posCurrent.y = (m_moveObject[i].posEnd.y - m_moveObject[i].posStart.y) * m_moveObject[i].time / m_moveObject[i].stepAdvance + m_moveObject[i].posStart.y; + } + + } + else if (m_moveObject[i].type == 15 || m_moveObject[i].type == 23) + { + m_moveObject[i].type = 0; + } + else if (m_moveObject[i].type == 34) + { + m_moveObject[i].posStart = m_moveObject[i].posCurrent; + m_moveObject[i].posEnd = m_moveObject[i].posCurrent; + m_moveObject[i].step = 3; + m_moveObject[i].time = 0; + } + else + { + m_moveObject[i].step = 3; + m_moveObject[i].time = 0; + } + } + else if (m_moveObject[i].step == 3) + { + if (m_moveObject[i].time < m_moveObject[i].timeStopEnd) + { + MoveObject[] moveObject3 = m_moveObject; + moveObject3[i]->time = moveObject3[i]->time + 1; + } + else + { + m_moveObject[i].step = 4; + m_moveObject[i].time = 0; + } + } + else if (m_moveObject[i].step == 4) + { + if (m_moveObject[i].posCurrent.x != m_moveObject[i].posStart.x || m_moveObject[i].posCurrent.y != m_moveObject[i].posStart.y) + { + MoveObject[] moveObject4 = m_moveObject; + moveObject4[i]->time = moveObject4[i]->time + 1; + if (m_moveObject[i].stepRecede != 0) + { + m_moveObject[i].posCurrent.x = (m_moveObject[i].posStart.x - m_moveObject[i].posEnd.x) * + m_moveObject[i].time / m_moveObject[i].stepRecede + m_moveObject[i].posEnd.x; + m_moveObject[i].posCurrent.y = (m_moveObject[i].posStart.y - m_moveObject[i].posEnd.y) * + m_moveObject[i].time / m_moveObject[i].stepRecede + m_moveObject[i].posEnd.y; + } + } + else + { + m_moveObject[i].step = 1; + m_moveObject[i].time = 0; + } + } + } + if (m_moveObject[i].type == 22 && m_moveObject[i].step == 3) + { + m_moveObject[i].type = 0; + } + posCurrent = m_moveObject[i].posCurrent; + if (m_moveObject[i].type == 1 || m_moveObject[i].type == 47 || m_moveObject[i].type == 48) + { + posCurrent.y -= 64; + } + posCurrent.x = (posCurrent.x + 32) / 64; + posCurrent.y = (posCurrent.y + 32) / 64; + SetMoveTraj(posCurrent); + if (flag) + { + m_blupiVector.x = m_moveObject[i].posCurrent.x - tinyPoint.x; + m_blupiVector.y = m_moveObject[i].posCurrent.y - (m_blupiPos.y + 60 - BLUPIFLOOR); + if (m_moveObject[i].type == 47) + { + m_blupiVector.x = m_blupiVector.x + 2; + } + if (m_moveObject[i].type == 48) + { + m_blupiVector.x = m_blupiVector.x - 2; + } + if (m_blupiTimeNoAsc == 0) + { + m_blupiTransport = i; + } + } +} + +void CDecor::MoveObjectStepIcon(int i) +{ + if (m_moveObject[i]->type == 47) + { + m_moveObject[i]->icon = table_chenille[m_moveObject[i]->phase / 1 % 6]; + } + if (m_moveObject[i]->type == 48) + { + m_moveObject[i]->icon = table_chenillei[m_moveObject[i]->phase / 1 % 6]; + } + if (m_moveObject[i]->type == 2) + { + m_moveObject[i]->icon = 12 + m_moveObject[i]->phase / 2 % 9; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 3) + { + m_moveObject[i]->icon = 48 + m_moveObject[i]->phase / 2 % 9; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 16) + { + m_moveObject[i]->icon = 69 + m_moveObject[i]->phase / 1 % 9; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 96) + { + m_moveObject[i]->icon = table_follow1[m_moveObject[i]->phase / 1 % 26]; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 97) + { + m_moveObject[i]->icon = table_follow2[m_moveObject[i]->phase / 1 % 5]; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 200) + { + m_moveObject[i]->icon = 257 + m_moveObject[i]->phase / 1 % 6; + m_moveObject[i]->channel = 2; + } + if (m_moveObject[i]->type == 201) + { + m_moveObject[i]->icon = 257 + m_moveObject[i]->phase / 1 % 6; + m_moveObject[i]->channel = 11; + } + if (m_moveObject[i]->type == 202) + { + m_moveObject[i]->icon = 257 + m_moveObject[i]->phase / 1 % 6; + m_moveObject[i]->channel = 12; + } + if (m_moveObject[i]->type == 203) + { + m_moveObject[i]->icon = 257 + m_moveObject[i]->phase / 1 % 6; + m_moveObject[i]->channel = 13; + } + if (m_moveObject[i]->type == 55) + { + m_moveObject[i]->icon = 252; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 56) + { + m_moveObject[i]->icon = table_dynamitef[m_moveObject[i]->phase / 1 % 100]; + m_moveObject[i]->channel = 10; + if (m_moveObject[i]->phase == 50) + { + DynamiteStart(i, 0, 0); + } + if (m_moveObject[i]->phase == 53) + { + DynamiteStart(i, -100, 8); + } + if (m_moveObject[i]->phase == 55) + { + DynamiteStart(i, 80, 10); + } + if (m_moveObject[i]->phase == 56) + { + DynamiteStart(i, -15, -100); + } + if (m_moveObject[i]->phase == 59) + { + DynamiteStart(i, 20, 70); + } + if (m_moveObject[i]->phase == 62) + { + DynamiteStart(i, 30, -50); + } + if (m_moveObject[i]->phase == 64) + { + DynamiteStart(i, -40, 30); + } + if (m_moveObject[i]->phase == 67) + { + DynamiteStart(i, -180, 10); + } + if (m_moveObject[i]->phase == 69) + { + DynamiteStart(i, 200, -10); + } + if (m_moveObject[i]->phase >= 70) + { + m_moveObject[i]->type = 0; + } + } + if (m_moveObject[i]->type == 5) + { + if (m_moveObject[i]->phase / 3 % 22 < 11) + { + m_moveObject[i]->icon = m_moveObject[i]->phase / 3 % 11; + } + else + { + m_moveObject[i]->icon = 11 - m_moveObject[i]->phase / 3 % 11; + } + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 6) + { + m_moveObject[i]->icon = 21 + m_moveObject[i]->phase / 4 % 8; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 7) + { + m_moveObject[i]->icon = 29 + m_moveObject[i]->phase / 3 % 8; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 21) + { + m_moveObject[i]->icon = table_cle[m_moveObject[i]->phase / 3 % 12]; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 49) + { + m_moveObject[i]->icon = table_cle1[m_moveObject[i]->phase / 3 % 12]; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 50) + { + m_moveObject[i]->icon = table_cle2[m_moveObject[i]->phase / 3 % 12]; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 51) + { + m_moveObject[i]->icon = table_cle3[m_moveObject[i]->phase / 3 % 12]; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 24) + { + m_moveObject[i]->icon = table_skate[m_moveObject[i]->phase / 1 % 34]; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 25) + { + m_moveObject[i]->icon = table_shield[m_moveObject[i]->phase / 2 % 16]; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 26) + { + m_moveObject[i]->icon = table_power[m_moveObject[i]->phase / 2 % 8]; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 40) + { + m_moveObject[i]->icon = table_invert[m_moveObject[i]->phase / 2 % 20]; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 31) + { + m_moveObject[i]->icon = table_charge[m_moveObject[i]->phase / 2 % 6]; + m_moveObject[i]->channel = 1; + } + if (m_moveObject[i]->type == 27) + { + m_moveObject[i]->icon = table_magictrack[m_moveObject[i]->phase / 1 % 24]; + m_moveObject[i]->channel = 10; + if (m_moveObject[i]->phase >= 24) + { + m_moveObject[i]->type = 0; + } + } + if (m_moveObject[i]->type == 57) + { + m_moveObject[i]->icon = table_shieldtrack[m_moveObject[i]->phase / 1 % 20]; + m_moveObject[i]->channel = 10; + if (m_moveObject[i]->phase >= 20) + { + m_moveObject[i]->type = 0; + } + } + if (m_moveObject[i]->type == 39) + { + m_moveObject[i]->icon = table_tresortrack[m_moveObject[i]->phase / 1 % 11]; + m_moveObject[i]->channel = 10; + if (m_moveObject[i]->phase >= 11) + { + m_moveObject[i]->type = 0; + } + } + if (m_moveObject[i]->type == 58 && m_moveObject[i]->phase >= 20) + { + m_moveObject[i]->type = 0; + } + if (m_moveObject[i]->type == 8) + { + if (m_moveObject[i]->phase >= table_explo1->length) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_explo1[m_moveObject[i]->phase]; + m_moveObject[i]->channel = 9; + } + } + if (m_moveObject[i]->type == 9) + { + if (m_moveObject[i]->phase >= 20) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_explo2[m_moveObject[i]->phase % 20]; + m_moveObject[i]->channel = 9; + } + } + if (m_moveObject[i]->type == 10) + { + if (m_moveObject[i]->phase >= 20) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_explo3[m_moveObject[i]->phase / 1 % 20]; + m_moveObject[i]->channel = 9; + } + } + if (m_moveObject[i]->type == 11) + { + if (m_moveObject[i]->phase >= 9) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_explo4[m_moveObject[i]->phase / 1 % 9]; + m_moveObject[i]->channel = 9; + } + } + if (m_moveObject[i]->type == 90) + { + if (m_moveObject[i]->phase >= 12) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_explo5[m_moveObject[i]->phase / 1 % 12]; + m_moveObject[i]->channel = 9; + } + } + if (m_moveObject[i]->type == 91) + { + if (m_moveObject[i]->phase >= 6) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_explo6[m_moveObject[i]->phase / 1 % 6]; + m_moveObject[i]->channel = 9; + } + } + if (m_moveObject[i]->type == 92) + { + if (m_moveObject[i]->phase >= 128) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_explo7[m_moveObject[i]->phase / 1 % 128]; + m_moveObject[i]->channel = 9; + } + } + if (m_moveObject[i]->type == 93) + { + if (m_moveObject[i]->phase >= 5) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_explo8[m_moveObject[i]->phase / 1 % 5]; + m_moveObject[i]->channel = 9; + } + } + if (m_moveObject[i]->type == 98) + { + if (m_moveObject[i]->phase >= 10) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_sploutch1[m_moveObject[i]->phase / 1 % 10]; + m_moveObject[i]->channel = 9; + } + } + if (m_moveObject[i]->type == 99) + { + if (m_moveObject[i]->phase >= 13) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_sploutch2[m_moveObject[i]->phase / 1 % 13]; + m_moveObject[i]->channel = 9; + } + } + if (m_moveObject[i]->type == 100) + { + if (m_moveObject[i]->phase >= 18) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_sploutch3[m_moveObject[i]->phase / 1 % 18]; + m_moveObject[i]->channel = 9; + } + } + if (m_moveObject[i]->type == 53) + { + if (m_moveObject[i]->phase >= 90) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_tentacule[m_moveObject[i]->phase / 2 % 45]; + m_moveObject[i]->channel = 9; + } + } + TinyPoint pos; + if (m_moveObject[i]->type == 52) + { + if (m_moveObject[i]->phase == 0) + { + PlaySound(72, m_moveObject[i]->posStart); + } + if (m_moveObject[i]->phase == 137) + { + PlaySound(73, m_moveObject[i]->posStart); + } + if (m_moveObject[i]->phase >= 157) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_bridge[m_moveObject[i]->phase / 1 % 157]; + m_moveObject[i]->channel = 1; + pos->X = m_moveObject[i]->posStart->X / 64; + pos->Y = m_moveObject[i]->posStart->Y / 64; + m_decor[pos->X, pos->Y]->icon = m_moveObject[i]->icon; + } + } + if (m_moveObject[i]->type == 36) + { + if (m_moveObject[i]->phase >= 16) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_pollution[m_moveObject[i]->phase / 2 % 8]; + m_moveObject[i]->channel = 10; + } + } + if (m_moveObject[i]->type == 41) + { + if (m_moveObject[i]->phase >= 16) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_invertstart[m_moveObject[i]->phase / 2 % 8]; + m_moveObject[i]->channel = 10; + } + } + if (m_moveObject[i]->type == 42) + { + if (m_moveObject[i]->phase >= 16) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_invertstop[m_moveObject[i]->phase / 2 % 8]; + m_moveObject[i]->channel = 10; + } + } + if (m_moveObject[i]->type == 14) + { + if (m_moveObject[i]->phase >= 14) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_plouf[m_moveObject[i]->phase / 2 % 7]; + m_moveObject[i]->channel = 1; + } + } + if (m_moveObject[i]->type == 35) + { + if (m_moveObject[i]->phase >= 6) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_tiplouf[m_moveObject[i]->phase / 2 % 7]; + m_moveObject[i]->channel = 1; + } + } + if (m_moveObject[i]->type == 15) + { + m_moveObject[i]->icon = table_blup[m_moveObject[i]->phase / 2 % 20]; + m_moveObject[i]->channel = 1; + } + if (m_moveObject[i]->type == 4) + { + if (m_moveObject[i]->posStart->X > m_moveObject[i]->posEnd->X) + { + if (m_moveObject[i]->step == 1) + { + m_moveObject[i]->icon = table_bulldozer_turn2l[m_moveObject[i]->time % 22]; + } + if (m_moveObject[i]->step == 3) + { + m_moveObject[i]->icon = table_bulldozer_turn2r[m_moveObject[i]->time % 22]; + } + if (m_moveObject[i]->step == 2) + { + m_moveObject[i]->icon = table_bulldozer_left[m_moveObject[i]->time % 8]; + } + if (m_moveObject[i]->step == 4) + { + m_moveObject[i]->icon = table_bulldozer_right[m_moveObject[i]->time % 8]; + } + } + else + { + if (m_moveObject[i]->step == 1) + { + m_moveObject[i]->icon = table_bulldozer_turn2r[m_moveObject[i]->time % 22]; + } + if (m_moveObject[i]->step == 3) + { + m_moveObject[i]->icon = table_bulldozer_turn2l[m_moveObject[i]->time % 22]; + } + if (m_moveObject[i]->step == 2) + { + m_moveObject[i]->icon = table_bulldozer_right[m_moveObject[i]->time % 8]; + } + if (m_moveObject[i]->step == 4) + { + m_moveObject[i]->icon = table_bulldozer_left[m_moveObject[i]->time % 8]; + } + } + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 17) + { + if (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x) + { + if (m_moveObject[i]->step == 1) + { + m_moveObject[i]->icon = table_poisson_turn2l[m_moveObject[i]->time % 48]; + } + if (m_moveObject[i]->step == 3) + { + m_moveObject[i]->icon = table_poisson_turn2r[m_moveObject[i]->time % 48]; + } + if (m_moveObject[i]->step == 2) + { + m_moveObject[i]->icon = table_poisson_left[m_moveObject[i]->time % 8]; + } + if (m_moveObject[i]->step == 4) + { + m_moveObject[i]->icon = table_poisson_right[m_moveObject[i]->time % 8]; + } + } + else + { + if (m_moveObject[i]->step == 1) + { + m_moveObject[i]->icon = table_poisson_turn2r[m_moveObject[i]->time % 48]; + } + if (m_moveObject[i]->step == 3) + { + m_moveObject[i]->icon = table_poisson_turn2l[m_moveObject[i]->time % 48]; + } + if (m_moveObject[i]->step == 2) + { + m_moveObject[i]->icon = table_poisson_right[m_moveObject[i]->time % 8]; + } + if (m_moveObject[i]->step == 4) + { + m_moveObject[i]->icon = table_poisson_left[m_moveObject[i]->time % 8]; + } + } + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 20) + { + if (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x) + { + if (m_moveObject[i]->step == 1) + { + m_moveObject[i]->icon = table_oiseau_turn2l[m_moveObject[i]->time % 10]; + } + if (m_moveObject[i]->step == 3) + { + m_moveObject[i]->icon = table_oiseau_turn2r[m_moveObject[i]->time % 10]; + } + if (m_moveObject[i]->step == 2) + { + m_moveObject[i]->icon = table_oiseau_left[m_moveObject[i]->time % 8]; + } + if (m_moveObject[i]->step == 4) + { + m_moveObject[i]->icon = table_oiseau_right[m_moveObject[i]->time % 8]; + } + } + else + { + if (m_moveObject[i]->step == 1) + { + m_moveObject[i]->icon = table_oiseau_turn2r[m_moveObject[i]->time % 10]; + } + if (m_moveObject[i]->step == 3) + { + m_moveObject[i]->icon = table_oiseau_turn2l[m_moveObject[i]->time % 10]; + } + if (m_moveObject[i]->step == 2) + { + m_moveObject[i]->icon = table_oiseau_right[m_moveObject[i]->time % 8]; + } + if (m_moveObject[i]->step == 4) + { + m_moveObject[i]->icon = table_oiseau_left[m_moveObject[i]->time % 8]; + } + } + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 44) + { + if (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x) + { + if (m_moveObject[i]->step == 1) + { + m_moveObject[i]->icon = table_guepe_turn2l[m_moveObject[i]->time % 5]; + } + if (m_moveObject[i]->step == 3) + { + m_moveObject[i]->icon = table_guepe_turn2r[m_moveObject[i]->time % 5]; + } + if (m_moveObject[i]->step == 2) + { + m_moveObject[i]->icon = table_guepe_left[m_moveObject[i]->time % 6]; + } + if (m_moveObject[i]->step == 4) + { + m_moveObject[i]->icon = table_guepe_right[m_moveObject[i]->time % 6]; + } + } + else + { + if (m_moveObject[i]->step == 1) + { + m_moveObject[i]->icon = table_guepe_turn2r[m_moveObject[i]->time % 5]; + } + if (m_moveObject[i]->step == 3) + { + m_moveObject[i]->icon = table_guepe_turn2l[m_moveObject[i]->time % 5]; + } + if (m_moveObject[i]->step == 2) + { + m_moveObject[i]->icon = table_guepe_right[m_moveObject[i]->time % 6]; + } + if (m_moveObject[i]->step == 4) + { + m_moveObject[i]->icon = table_guepe_left[m_moveObject[i]->time % 6]; + } + } + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 54) + { + if (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x) + { + if (m_moveObject[i]->step == 1) + { + m_moveObject[i]->icon = table_creature_turn2[m_moveObject[i]->time % 152]; + } + if (m_moveObject[i]->step == 3) + { + m_moveObject[i]->icon = table_creature_turn2[m_moveObject[i]->time % 152]; + } + if (m_moveObject[i]->step == 2) + { + m_moveObject[i]->icon = table_creature_left[m_moveObject[i]->time % 8]; + } + if (m_moveObject[i]->step == 4) + { + m_moveObject[i]->icon = table_creature_right[m_moveObject[i]->time % 8]; + } + } + else + { + if (m_moveObject[i]->step == 1) + { + m_moveObject[i]->icon = table_creature_turn2[m_moveObject[i]->time % 152]; + } + if (m_moveObject[i]->step == 3) + { + m_moveObject[i]->icon = table_creature_turn2[m_moveObject[i]->time % 152]; + } + if (m_moveObject[i]->step == 2) + { + m_moveObject[i]->icon = table_creature_right[m_moveObject[i]->time % 8]; + } + if (m_moveObject[i]->step == 4) + { + m_moveObject[i]->icon = table_creature_left[m_moveObject[i]->time % 8]; + } + } + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 32) + { + if (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x) + { + if (m_moveObject[i]->step == 1) + { + m_moveObject[i]->icon = table_blupih_turn2l[m_moveObject[i]->time % 26]; + } + if (m_moveObject[i]->step == 3) + { + m_moveObject[i]->icon = table_blupih_turn2r[m_moveObject[i]->time % 26]; + } + if (m_moveObject[i]->step == 2) + { + m_moveObject[i]->icon = table_blupih_left[m_moveObject[i]->time % 8]; + } + if (m_moveObject[i]->step == 4) + { + m_moveObject[i]->icon = table_blupih_right[m_moveObject[i]->time % 8]; + } + } + else + { + if (m_moveObject[i]->step == 1) + { + m_moveObject[i]->icon = table_blupih_turn2r[m_moveObject[i]->time % 26]; + } + if (m_moveObject[i]->step == 3) + { + m_moveObject[i]->icon = table_blupih_turn2l[m_moveObject[i]->time % 26]; + } + if (m_moveObject[i]->step == 2) + { + m_moveObject[i]->icon = table_blupih_right[m_moveObject[i]->time % 8]; + } + if (m_moveObject[i]->step == 4) + { + m_moveObject[i]->icon = table_blupih_left[m_moveObject[i]->time % 8]; + } + } + if ((m_moveObject[i]->step == 1 || m_moveObject[i]->step == 3) && m_moveObject[i]->time == 21) + { + pos.x = m_moveObject[i]->posCurrent.x; + pos.y = m_moveObject[i]->posCurrent.y + 40; + if (ObjectStart(pos, 23, 55) != -1) + { + PlaySound(52, pos); + } + } + } + if (m_moveObject[i]->type == 33) + { + if (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x) + { + if (m_moveObject[i]->step == 1) + { + m_moveObject[i]->icon = table_blupit_turn2l[m_moveObject[i]->time % 24]; + } + if (m_moveObject[i]->step == 3) + { + m_moveObject[i]->icon = table_blupit_turn2r[m_moveObject[i]->time % 24]; + } + if (m_moveObject[i]->step == 2) + { + m_moveObject[i]->icon = table_blupit_left[m_moveObject[i]->time % 8]; + } + if (m_moveObject[i]->step == 4) + { + m_moveObject[i]->icon = table_blupit_right[m_moveObject[i]->time % 8]; + } + } + else + { + if (m_moveObject[i]->step == 1) + { + m_moveObject[i]->icon = table_blupit_turn2r[m_moveObject[i]->time % 24]; + } + if (m_moveObject[i]->step == 3) + { + m_moveObject[i]->icon = table_blupit_turn2l[m_moveObject[i]->time % 24]; + } + if (m_moveObject[i]->step == 2) + { + m_moveObject[i]->icon = table_blupit_right[m_moveObject[i]->time % 8]; + } + if (m_moveObject[i]->step == 4) + { + m_moveObject[i]->icon = table_blupit_left[m_moveObject[i]->time % 8]; + } + } + if ((m_moveObject[i]->step == 1 || m_moveObject[i]->step == 3) && m_moveObject[i]->time == 3) + { + int speed; + if ((m_moveObject[i]->posStart.x < m_moveObject[i]->posEnd.x && m_moveObject[i]->step == 1) || (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x && m_moveObject[i]->step == 3)) + { + pos.x = m_moveObject[i]->posCurrent.x - 30; + pos.y = m_moveObject[i]->posCurrent.x + BLUPIOFFY; + speed = -5; + } + else + { + pos.x = m_moveObject[i]->posCurrent.x + 30; + pos.y = m_moveObject[i]->posCurrent.y + BLUPIOFFY; + speed = 5; + } + if (ObjectStart(pos, 23, speed) != -1) + { + PlaySound(52, pos); + } + } + if ((m_moveObject[i]->step == 1 || m_moveObject[i]->step == 3) && m_moveObject[i]->time == 21) + { + int speed; + if ((m_moveObject[i]->posStart.x < m_moveObject[i]->posEnd.x && m_moveObject[i]->step == 1) || (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x && m_moveObject[i]->step == 3)) + { + pos.x = m_moveObject[i]->posCurrent.x + 30; + pos.y = m_moveObject[i]->posCurrent.y + BLUPIOFFY; + speed = 5; + } + else + { + pos.x = m_moveObject[i]->posCurrent.x - 30; + pos.y = m_moveObject[i]->posCurrent.y + BLUPIOFFY; + speed = -5; + } + if (ObjectStart(pos, 23, speed) != -1) + { + PlaySound(52, pos); + } + } + } + if (m_moveObject[i]->type == 34) + { + m_moveObject[i]->icon = table_glu[m_moveObject[i]->phase / 1 % 25]; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 37) + { + if (m_moveObject[i]->phase >= 70) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_clear[m_moveObject[i]->phase / 1 % 70]; + m_moveObject[i]->channel = 10; + } + } + if (m_moveObject[i]->type == 38) + { + if (m_moveObject[i]->phase >= 90) + { + m_moveObject[i]->type = 0; + } + else + { + m_moveObject[i]->icon = table_electro[m_moveObject[i]->phase / 1 % 90]; + if (m_moveObject[i]->phase < 30) + { + m_moveObject[i]->channel = 12; + } + else + { + m_moveObject[i]->channel = 10; + } + } + } + if (m_moveObject[i]->type == 13) + { + m_moveObject[i]->icon = 68; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 46) + { + m_moveObject[i]->icon = 208; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 19) + { + m_moveObject[i]->icon = 89; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 28) + { + m_moveObject[i]->icon = 167; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 23) + { + m_moveObject[i]->icon = 176; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 29) + { + m_moveObject[i]->icon = 177; + m_moveObject[i]->channel = 10; + } + if (m_moveObject[i]->type == 30) + { + m_moveObject[i]->icon = 178; + m_moveObject[i]->channel = 10; + } + MoveObject[] moveObject = m_moveObject; + moveObject[i]->phase = moveObject[i]->phase + 1; + if (m_moveObject[i]->phase > 32700) + { + m_moveObject[i]->phase = 0; + } +} + +void CDecor::DynamiteStart(int i, int dx, int dy) +{ + POINT posStart = m_moveObject[i].posStart; + posStart.x -= 34; + posStart.y -= 34; + posStart.x += dx; + posStart.y -= dy; + ObjectStart(posStart, 8, 0); + if (dx == 0 && dy == 0) + { + PlaySound(10, posStart); + m_decorAction = 1; + m_decorPhase = 0; + } + RECT src; + src.left = posStart.x; + src.right = posStart.x + 128; + src.top = posStart.y; + src.bottom = posStart.y + 128; + POINT tinyPoint; + for (int j = 0; j < 2; j++) + { + tinyPoint.x = posStart.x / 64; + for (int k = 0; k < 2; j++) + { + if (tinyPoint.x >= 0 && tinyPoint.x < 100 && tinyPoint.y >= 0 && tinyPoint.y < 100) + { + int icon = m_decor[tinyPoint.x, tinyPoint.y]->icon; + if (icon == 378 || icon == 379 || icon == 404 || icon == 410) + { + POINT pos; + pos.x = tinyPoint.x * 64; + pos.y = tinyPoint.y * 64; + ModifDecor(pos, -1); + } + } + tinyPoint.x++; + } + tinyPoint.y++; + } + for (i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i].type == 2 || m_moveObject[i].type == 3 || m_moveObject[i].type == 96 || m_moveObject[i].type == 97 || m_moveObject[i].type == 4 || + m_moveObject[i].type == 6 || m_moveObject[i].type == 12 || m_moveObject[i].type == 13 || m_moveObject[i].type == 16 || m_moveObject[i].type == 17 || + m_moveObject[i].type == 19 || m_moveObject[i].type == 20 || m_moveObject[i].type == 24 || m_moveObject[i].type == 25 || m_moveObject[i].type == 26 || m_moveObject[i].type == 28 || + m_moveObject[i].type == 30 || m_moveObject[i].type == 32 || m_moveObject[i].type == 33 || m_moveObject[i].type == 34 || m_moveObject[i].type == 40 || m_moveObject[i].type == 44 || + m_moveObject[i].type == 46 || m_moveObject[i].type == 52 || m_moveObject[i].type == 54 || m_moveObject[i].type == 200 || m_moveObject[i].type == 201 || m_moveObject[i].type == 202 || + m_moveObject[i].type == 203) + { + RECT src2; + src2.left = m_moveObject[i].posCurrent.x; + src2.right = m_moveObject[i].posCurrent.x + 60; + src2.top = m_moveObject[i].posCurrent.y; + src2.bottom = m_moveObject[i].posCurrent.y + 20; + RECT tinyRect; + if (IntersectRect(tinyRect, src2, src)) + { + if (m_moveObject[i].type == 12) + { + SearchLinkCaisse(i, TRUE); + for (int l = 0; l < m_nbLinkCaisse; l++) + { + int channel = m_moveObject[m_linkCaisse[l]]->channel; + int icon2 = m_moveObject[m_linkCaisse[l]]->icon; + POINT posCurrent = m_moveObject[m_linkCaisse[l]]->posCurrent; + double num = (double)Random(7, 23); + if (m_random->next(0, 100) % 2 == 0) + { + num = -num; + } + ByeByeAdd(channel, icon2, posCurrent, num, 1.0); + m_moveObject[m_linkCaisse[l]]->type = 0; + } + ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type); + UpdateCaisse(); + } + else + { + ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type); + } + } + } + } + if (m_blupiFocus && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiPos.x > posStart.x - 30 && m_blupiPos.x < posStart.x + 30 + 64 && m_blupiPos.y > posStart.y - 30 && m_blupiPos.y < posStart.y + 30 + 64) + { + BlupiDead(11, -1); + m_blupiAir = TRUE; + } + +} + +int CDecor::AscenseurDetect(RECT rect, POINT oldpos, POINT newpos) +{ + if (m_blupiTimeNoAsc != 0) + { + return -1; + } + int num = newpos.y - oldpos.y; + int num2; + if (num < 0) + { + num2 = -30; + } + else + { + num2 = 30; + } + num = abs(num); + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i].type == 1 || m_moveObject[i].type == 47 || m_moveObject[i].type == 48) + { + RECT src; + src.left = m_moveObject[i]->posCurrent.x; + src.right = m_moveObject[i]->posCurrent.x + 64; + src.top = m_moveObject[i]->posCurrent.y; + src.bottom = m_moveObject[i]->posCurrent.y + 16; + if (num < 30) + { + RECT tinyRect; + if (IntersectRect(tinyRect, src, rect)) + { + return i; + } + } + else + { + RECT src2 = rect; + src2.top -= num / 30 * num2; + src2.bottom -= num / 30 * num2; + for (int j = 0; j <= num / 30; j++) + { + RECT tinyRect; + if (IntersectRect(tinyRect, src, src2)) + { + return i; + } + src2.top += num2; + src2.bottom += num; + } + } + + } + } + return -1; +} + +void CDecor::AscenseurVertigo(int i, BOOL* pbVertigoLeft, BOOL* pbVertigoRight) +{ + bVertigoLeft = FALSE; + bVertigoRight = FALSE; + if (m_blupiPos.x + 20 + 4 < m_moveObject[i]->posCurrent.x) + { + bVertigoLeft = TRUE; + } + if (m_blupiPos.x + 60 - 20 - 4 > m_moveObject[i]->posCurrent.x + 64) + { + bVertigoRight = TRUE; + } + if (AscenseurShift(i)) + { + if (bVertigoLeft) + { + bVertigoLeft = FALSE; + bVertigoRight = TRUE; + m_blupiTimeNoAsc = 10; + return; + } + if (bVertigoRight) + { + bVertigoRight = FALSE; + bVertigoLeft = TRUE; + m_blupiTimeNoAsc = 10; + } + } +} + +BOOL CDecor::AscenseurShift(int i) +{ + return i != -1 && m_moveObject[i]->icon >= 311 && m_moveObject[i]->icon <= 316; +} + +void CDecor::AscenseurSynchro(int i) +{ + for (i = 0; i < MAXMOVEOBJECT; i++) + { + m_moveObject[i]->posCurrent = m_moveObject[i]->posStart; + m_moveObject[i]->step = 1; + m_moveObject[i]->time = 0; + m_moveObject[i]->phase = 0; + } +} + +void CDecor::UpdateCaisse() +{ + m_nbRankCaisse = 0; + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i].type == TYPE_CAISSE) + { + m_rankCaisse[m_nbRankCaisse++] = i; + } + } +} + +BOOL CDecor::TestPushCaisse(int i, POINT pos, BOOL bPop) +{ + POINT move; + + move.x = pos.x - m_moveObject[i].posCurrent.x; + move.y = 0; + SearchLinkCaisse(i, bPop); + int y = m_moveObject[i].posCurrent.y; + for (int j = 0; j < m_nbLinkCaisse; j++) + { + i = m_linkCaisse[j]; + if (!TestPushOneCaisse(i, move, y)) + { + return FALSE; + } + } + for (int j = 0; j < m_nbLinkCaisse; j++) + { + i = m_linkCaisse[j]; + int num = i; + m_moveObject[num].posCurrent.x = m_moveObject[num].posCurrent.x + move.x; + m_moveObject[num].posStart.x = m_moveObject[num].posStart.x + move.x; + int num2 = i; + m_moveObject[num].posEnd.x = m_moveObject[num].posEnd.x + move.x; + } + return TRUE; +} + +BOOL CDecor::TestPushOneCaisse(int i, POINT move, int b) +{ + +} + +void CDecor::SearchLinkCaisse(int rank, BOOL bPop) +{ + m_nbLinkCaisse = 0; + AddLinkCaisse(rank); + POINT posCurrent = m_moveObject; + + BOOL flag; + do + { + flag = FALSE; + for (int i = 0; i < m_nbLinkCaisse; i++) + { + int num = m_linkCaisse[i]; + if (m_moveObject[num]->posCurrent.y <= + posCurrent.y && (!bPop || (m_moveObject + [num]->posCurrent.x >= posCurrent.x - 32 && + m_moveObject[num]->posCurrent.x <= + posCurrent.x + 32))) + { + RECT src; + src.left = m_moveObject[num]->posCurrent.x - 1; + src.top = m_moveObject[num]->posCurrent.y - 1; + src.right = src.left + 64 + 1; + src.bottom = src.top + 64 + 1; + for (int j = 0; j < m_nbRankCaisse; j++) + { + int num2 = m_rankCaisse[j]; + if (num2 != num && m_moveObject[num2]->posCurrent.y <= posCurrent.y && (!bPop || (m_moveObject[num2]->posCurrent.x >= posCurrent.x - 32 && m_moveObject[num2]->posCurrent.x <= posCurrent.x + 32))) + { + RECT src2; + src2.left = m_moveObject[num2]->posCurrent.x - 1; + src2.top = m_moveObject[num2]->posCurrent.y - 1; + src2.right = src2.left + 64 + 1; + src2.bottom = src2.top + 64 + 1; + RECT tinyRect; + if (IntersectRect(tinyRect, src2, src) && AddLinkCaisse(num2)) + { + flag = TRUE; + } + } + } + } + } + } while (flag); +} + +BOOL CDecor::AddLinkCaisse(int rank) +{ + for (int i = 0; i < m_nbLinkCaisse; i++) + { + if (m_linkCaisse[i] == rank) + { + return FALSE; + } + } + m_linkCaisse[m_nbLinkCaisse] = rank; + m_nbLinkCaisse++; + return TRUE; +} + +int CDecor::CaisseInFront() +{ + POINT tinyPoint; + if (m_blupiDir == 1) + { + tinyPoint.x = m_blupiPos.x + 16 - 32; + tinyPoint.y = m_blupiPos.y; + } + else + { + tinyPoint.x = m_blupiPos.x + 60 - 16 + 32; + tinyPoint.y = m_blupiPos.y; + } + for (int i = 0; i < m_nbRankCaisse; i++) + { + int num = m_rankCaisse[i]; + if (tinyPoint.x > m_moveObject[num]->posCurrent.x && + tinyPoint.x < m_moveObject[num]->posCurrent.x + 64 && + tinyPoint.y > m_moveObject[num]->posCurrent.y && + tinyPoint.y < m_moveObject[num]->posCurrent.y + 64) + { + return num; + } + } + return -1; +} + +int CDecor::CaisseGetMove(int max) +{ + max -= (m_nbLinkCaisse - 1) / 2; + if (max < 1) + { + max = 1; + } + if (m_blupiPower) + { + max *= 2; + } + if (m_blupiPhase < 20) + { + max = max * m_blupiPhase / 20; + if (max == 0) + { + max++; + } + } + return max; +} + +int CDecor::MockeryDetect(POINT pos) +{ + if (m_blupiTimeMockery > 0) + { + return 0; + } + if (m_blupiAir) + { + POINT tinyPoint; + tinyPoint.x = pos.x + 30; + tinyPoint.y = pos.y + 30 + 64; + if (tinyPoint.x >= 0 && tinyPoint.x < 6400 && tinyPoint.y >= 0 && tinyPoint.y < 6400) + { + int icon = m_decor[tinyPoint.x / 64, tinyPoint.y / 64]->icon; + if (icon == 68 || icon == 317) + { + return 64; + } + } + } + RECT src; + src.left = pos.x; + src.right = pos.x + 60; + src.top = pos.y + 11; + src.bottom = pos.y + 60; + if (m_blupiAir) + { + src.bottom += 90; + } + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i]->type == 2 || + m_moveObject[i]->type == 16 || + m_moveObject[i]->type == 96 || + m_moveObject[i]->type == 97 || + m_moveObject[i]->type == 4 || + m_moveObject[i]->type == 20 || + m_moveObject[i]->type == 44 || + m_moveObject[i]->type == 54 || + m_moveObject[i]->type == 23 || + m_moveObject[i]->type == 32 || + m_moveObject[i]->type == 33) + { + RECT src2; + src2.left = m_moveObject[i]->posCurrent.x; + src2.right = m_moveObject[i]->posCurrent.x + 60; + src2.top = m_moveObject[i]->posCurrent.y + 36; + src2.bottom = m_moveObject[i]->posCurrent.y + 60; + RECT tinyRect; + if (IntersectRect(tinyRect, src2, src)) + { + if (m_moveObject[i]->type == 54) + { + return 83; + } + if (m_blupiDir == 2) + { + if (pos.x >= src2.left) + { + return 64; + } + if (m_moveObject[i]->type == 2) + { + return 0; + } + return 63; + } + else + { + if (pos.x < src2.left) + { + return 64; + } + if (m_moveObject[i]->type == 2) + { + return 0; + } + return 63; + } + } + } + } + return 0; +} + +BOOL CDecor::BlupiElectro(POINT pos) +{ + if (m_blupiCloud) + { + return FALSE; + } + RECT src; + src.left = pos.x + 16; + src.right = pos.x + 60 - 16; + src.top = pos.y + 11; + src.bottom = pos.y + 60 - 2; + RECT src2; + src2.left = m_blupiPos.x - 16 - 40; + src2.right = m_blupiPos.x + 60 + 16 + 40; + src2.top = m_blupiPos.y + 11 - 40; + src2.bottom = m_blupiPos.y + 60 - 2 + 40; + RECT tinyRect; + return IntersectRect(tinyRect, src, src2); +} + +void CDecor::MoveObjectFollow(POINT pos) +{ + if (m_blupiHide) + { + return; + } + RECT src = BlupiRect(pos); + src.left = pos.x + 16; + src.right = pos.x + 60 - 16; + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i]->type == 96) + { + RECT src2; + src2.left = m_moveObject[i]->posCurrent.x - 100; + src2.right = m_moveObject[i]->posCurrent.x + 60 + 100; + src2.top = m_moveObject[i]->posCurrent.y - 100; + src2.bottom = m_moveObject[i]->posCurrent.y + 60 + 100; + RECT tinyRect; + if (IntersectRect(tinyRect, src2, src)) + { + m_moveObject[i]->type = 97; + PlaySound(92, m_moveObject[i]->posCurrent); + } + } + } +} + +int CDecor::MoveObjectDetect(POINT pos, BOOL* pbNear) +{ + RECT src = BlupiRect(pos); + src.left = pos.x + 16; + src.right = pos.x + 60 - 16; + RECT src2; + src2.left = src.left - 20; + src2.right = src.right + 20; + src2.top = src.top - 40; + src2.bottom = src.bottom + 30; + + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i]->type != 0 && + m_moveObject[i]->type != 27 && + m_moveObject[i]->type != 57 && + m_moveObject[i]->type != 39 && + m_moveObject[i]->type != 58 && + m_moveObject[i]->type != 34 && + m_moveObject[i]->type != 37 && + m_moveObject[i]->type != 38 && + (m_blupiAction != 14 && m_blupiAction != 29) || + m_moveObject[i]->type != 12) + { + RECT src3; + + } + } +} + +int CDecor::MoveAscenseurDetect(POINT pos, int height) +{ + if (m_blupiTimeNoAsc != 0) + { + return -1; + } + RECT src; + src.left = pos.x + 12; + src.right = pos.x + 60 - 12; + src.top = pos.y + 60 - 2; + src.bottom = pos.y + 60 + height - 1; + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i]->type == 1 || m_moveObject[i]->type == 47 || m_moveObject[i]->type == 48) + { + RECT src2; + src2.left = m_moveObject[i]->posCurrent.x; + src2.right = m_moveObject[i]->posCurrent.x + 64; + src2.top = m_moveObject[i]->posCurrent.y; + src2.bottom = m_moveObject[i]->posCurrent.y + 16; + RECT tinyRect; + if (IntersectRect(tinyRect, src2, src)) + { + return i; + } + } + } + return -1; +} + +int CDecor::MoveChargeDetect(POINT pos) +{ + RECT src; + src.left = pos.x + 16; + src.right = pos.x + 60 - 16; + src.top = pos.y + 11; + src.bottom = pos.y + 60 - 2; + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i]->type == 31) + { + RECT src2; + src2.left = m_moveObject[i]->posCurrent.x - 10; + src2.right = m_moveObject[i]->posCurrent.x + 60 + 10; + src2.top = m_moveObject[i]->posCurrent.y + 36; + src2.bottom = m_moveObject[i]->posCurrent.y + 60; + RECT tinyRect; + if (IntersectRect(tinyRect, src2, src)) + { + return i; + } + } + } + return -1; +} + +int CDecor::MovePersoDetect(POINT pos) +{ + RECT src; + src.left = pos.x + 16; + src.right = pos.x + 60 - 16; + src.top = pos.y + 11; + src.bottom = pos.y + 60 - 2; + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i]->type >= 200 && m_moveObject[i]->type <= 203) + { + RECT src2; + src2.left = m_moveObject[i]->posCurrent.x - 16; + src2.right = m_moveObject[i]->posCurrent.x + 60 + 16; + src2.top = m_moveObject[i]->posCurrent.y + 36; + src2.bottom = m_moveObject[i]->posCurrent.y + 60; + RECT tinyRect; + if (IntersectRect(tinyRect, src2, src)) + { + return i; + } + } + } + return -1; +} + +int CDecor::MoveBalleDetect(POINT pos) +{ + +} + +int CDecor::MoveObjectDelete(POINT cel) +{ + int result = -1; + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i]->type != 0) + { + if (cel.x == m_moveObject[i]->posStart.x / 64 && cel.y == m_moveObject[i]->posStart.y / 64) + { + result = m_moveObject[i]->type; + m_moveObject[i]->type = 0; + } + else if (cel.x == m_moveObject[i]->posEnd.x / 64 && cel.y == m_moveObject[i]->posEnd.y / 64) + { + result = m_moveObject[i]->type; + m_moveObject[i]->type = 0; + } + } + } + return result; +} + +int CDecor::MoveObjectFree() +{ + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i]->type == 0) + { + m_moveObject[i]->type = 0; + return i; + } + } + return -1; +} + +int CDecor::SortGetType(int type) +{ + if (type == 2 || type == 3 || type == 96 || type == 97) + { + return 1; + } + if (type == 12) + { + return 2; + } + return 3; +} + +void CDecor::MoveObjectSort() +{ + MoveObject src = default(MoveObject); + int num = 0; + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i]->type != 0) + { + MoveObjectCopy(m_moveObject[num++], m_moveObject[i]); + } + } + for (int i = num; i < MAXMOVEOBJECT; i++) + { + m_moveObject[i]->type = 0; + } + if (num <= 1) + { + return; + } + BOOL flag; + do + { + flag = FALSE; + for (int i = 0; i < num - 1; i++) + { + if (SortGetType(m_moveObject[i]->type) > SortGetType(m_moveObject[i + 1]->type)) + { + MoveObjectCopy(src, m_moveObject[i]); + MoveObjectCopy(m_moveObject[i], m_moveObject[i + 1]); + MoveObjectCopy(m_moveObject[i + 1], src); + flag = TRUE; + } + } + } while (flag); + UpdateCaisse(); + m_nbLinkCaisse = 0; +} + +void CDecor::MoveObjectPriority(int i) +{ + +} + +int CDecor::MoveObjectSearch(POINT pos, int type) +{ + for (int i = 0; i < MAXMOVEOBJECT; i++) + { + if (m_moveObject[i]->type != 0 && (type == -1 || + m_moveObject[i]->type == type)) + { + if (m_moveObject[i]->type == 23 && + m_moveObject[i]->posStart.x != m_moveObject[i]->posEnd.x) + { + if (m_moveObject[i]->posCurrent.x >= pos.x - 100 && + m_moveObject[i]->posCurrent.x <= pos.x + 100 && + m_moveObject[i]->posCurrent.y == pos.y) + { + return i; + } + } + else if (m_moveObject[i]->type == 23 && + m_moveObject[i]->posStart.y != m_moveObject[i]->posEnd.y) + { + if (m_moveObject[i]->posCurrent.y >= pos.y - 100 && + m_moveObject[i]->posCurrent.y <= pos.y + 100 && + m_moveObject[i]->posCurrent.x == pos.x) + { + return i; + } + } + else if (m_moveObject[i]->posCurrent.x == pos.x && + m_moveObject[i]->posCurrent.y == pos.y) + { + return i; + } + } + } + return -1; +} diff --git a/decmove.h b/decmove.h deleted file mode 100644 index 8c022e7..0000000 --- a/decmove.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -short* GetListMoves(int rank); -short* GetListIcons(int rank); \ No newline at end of file diff --git a/decnet.cpp b/decnet.cpp new file mode 100644 index 0000000..85e2145 --- /dev/null +++ b/decnet.cpp @@ -0,0 +1,197 @@ +// DecNet.cpp +// + +#include "def.h" +#include "decor.h" +#include "misc.h" +#include "network.h" + +void CDecor::NetStopCloud(int rank) +{ + NetMessage msg; + + msg.data1 = 0; + msg.x = 0; + msg.y = 0; + msg.type = MESS_STOPCLOUD; + msg.channel = rank; + NetMessagePush(&msg); + return; +} + +void CDecor::NetPlaySound(short channel, POINT pos) +{ + NetMessage msg; + + msg.y = pos.y; + msg.x = pos.x; + msg.type = MESS_PLAYSOUND; + msg.data1 = 0; + msg.channel = channel; + NetMessagePush(&msg); + return; +} + +void CDecor::NetStopSound(short channel) +{ + NetMessage msg; + + msg.data1 = 0; + msg.x = 0; + msg.y = 0; + msg.type = MESS_STOPSOUND; + msg.channel = channel; + NetMessagePush(&msg); +} + +void CDecor::NetDataFlush() +{ + for (int i = 0; i < MAXNETPLAYER; i++) + { + m_netPos[i].x = 0; + m_netPos[i].y = 0; + m_netIcons[i] = -1; + m_netUnk1[i] = 0; + m_netUnk2[i] = 0; + m_netUnk3[i] = 0; + m_netPlayerPacketsReceived[i] = 0; + m_netPlayerPacketsReceived2[i] = 0; + m_netTimeSincePacket[i] = 0; + m_netVitesses[i].x = 0; + m_netVitesses[i].y = 0; + m_netUnk4[i].x = 0; + m_netUnk4[i].y = 0; + } + m_netPacketsSent = 0; + m_netPacketsSent2 = 0; + m_netPacketsReceived = 0; + m_netPacketsReceived2 = 0; + m_netPacketIcon = -1; + NetMessageIndexFlush(); +} + +void CDecor::NetFUN_155e0(BYTE _foo, short _bar) +{ + char data[4]{ 4, _foo, _bar & 0xff, _bar >> 8 }; + m_pNetwork->Send(&data, 4, DPSEND_GUARANTEED); + return; +} + +void CDecor::TreatNetData() +{ + +} + +void CDecor::DoNetSmooth(int player) +{ + +} + +void CDecor::NetFUN_15d50() +{ + +} + +void CDecor::FUN_15da0(int index, short step) +{ + +} + + +void CDecor::NetPlayerCollide(POINT pos, int* out) +{ + tagRECT rect1; + RECT rect2; + RECT rect3; + //TODO + +} + +void CDecor::NetMessageIndexFlush() +{ + m_netMessageIndex1 = 0; + m_netMessageIndex2 = 0; + m_netMessageIndex3 = 0; + return; +} + +BOOL CDecor::NetMessagePush(NetMessage* message) +{ + NetMessage* messages; + BYTE data; + short pos; + int i; + + if (m_netMessageIndex1 == MAXNETMESSAGE) return FALSE; + + CopyMemory(&m_netMessages[m_netMessageIndex2], message, sizeof(NetMessage)); + m_netMessageIndex1++; + m_netMessageIndex2++; + if (m_netMessageIndex2 == MAXNETMESSAGE) + { + m_netMessageIndex2 = 0; + } + return TRUE; +} + +BOOL CDecor::NetMessagePop(NetMessage* message) +{ + if (m_netMessageIndex1 == 0) return FALSE; + + CopyMemory(message, &m_netMessages[m_netMessageIndex3], sizeof(NetMessage)); + m_netMessageIndex1--; + m_netMessageIndex3++; + if (m_netMessageIndex3 == MAXNETMESSAGE) + { + m_netMessageIndex3 = 0; + } + return TRUE; +} + +void CDecor::NotifFlush() +{ + for (int i = 0; i < MAXNOTIF; i++) + { + m_notifText[i][0] = '\0'; + } + + m_notifTime = 0; +} + +void CDecor::NotifPop() +{ + for (int i = MAXNOTIF; i > 0; --i) + { + strcpy() + m_notifText[MAXNOTIF - 1][0] = '\0'; + m_notifTime = NOTIFDELAY; // idk + } +} + +void CDecor::NotifPush(char *str) +{ + int i; + for (i = 0; i < MAXNOTIF; i++) + { + if (m_notifText[i][0] != '\0') break; + } + if (i >= MAXNOTIF) + { + NotifPop(); + i = MAXNOTIF - 1; + } + strcpy(m_notifText[i], str); + m_notifTime = NOTIFDELAY; + m_pSound->PlayImage(SOUND_TRESOR, { LXIMAGE / 2, LYIMAGE / 2 }, -1); +} + +void CDecor::NotifStep() +{ + if (m_notifTime == 0) + { + NotifPop(); + } + else { + m_notifTime--; + } +} \ No newline at end of file diff --git a/decor.cpp b/decor.cpp index 5fe2455..fdc8886 100644 --- a/decor.cpp +++ b/decor.cpp @@ -35,6 +35,7 @@ #define OVERHEIGHT 80 #define TEXTDELAY 10 // tooltip popup delay +#define NOTIFDELAY 200 BOOL IsValidCel(POINT cel) { @@ -104,104 +105,6 @@ void CDecor::Create(HWND hWnd, CSound* pSound, CPixmap* pPixmap, CNetwork* pNetw NotifFlush(); } -void CDecor::NetMessageIndexFlush() -{ - m_netMessageIndex1 = 0; - m_netMessageIndex2 = 0; - m_netMessageIndex3 = 0; - return; -} - -void CDecor::NotifFlush() -{ - int players; - char* notifBuffer[100]; - - notifBuffer = m_notifText; - - m_notifTime = 0; -} - -BOOL CDecor::NetMessagePush(NetMessage* message) -{ - NetMessage* messages; - BYTE data; - short pos; - int i; - - if (m_netMessageIndex1 == NETEVENTMAX) - { - return FALSE; - } - - i = m_netMessageIndex2; - data = message->data1; - pos = message->x; - messages = m_netMessages + i; - messages->messageType = message->messageType; - messages->data1 = data; - pos = message->channel; - - m_netMessages[i].y = message->y; - m_netMessages[i].channel = pos; - i = m_netMessageIndex2 + 1; - m_netMessageIndex1++; - m_netMessageIndex2 = i; - - if (i == NETEVENTMAX) - { - m_netEventIndex2 = 0; - } - return TRUE; -} - -void CDecor::NetSendData(BYTE bufferSize, UCHAR send) -{ - int data; - - data = ((UINT)bufferSize, 4); - data = (send, (int)data); - m_pNetwork->Send(&data, 4, DPSEND_GUARANTEED); - return; -} - -void CDecor::NetPlayerCollide(POINT pos, int* out) -{ - tagRECT rect1; - RECT rect2; - RECT rect3; - - -} - -void CDecor::NetPlaySound(short channel, POINT pos) -{ - NetMessage event; - - event.y = (short)pos.y; - event.x = (short)pos.x; - event.messageType = PK_PLAYSOUND; - event.data1 = 0; - event.channel = channel; - NetMessagePush(&event); - return; -} - -void CDecor::NetStopCloud(int rank) -{ - NetMessage cloud; - - cloud.data1 = 0; - cloud.x = 0; - cloud.y = 0; - cloud.messageType = 60; - cloud.channel = (short)rank; - NetMessagePush(cloud); - return; -} - -// The only seemingly sane function. - BOOL CDecor::LoadImages() { POINT totalDim, iconDim; @@ -214,7 +117,7 @@ BOOL CDecor::LoadImages() iconDim = { 0, 0 }; sprintf(filename, "decor%.3d.blp", m_region); - return m_pPixmap->BackgroundCache(CHBACK, filename, totalDim, iconDim, 0); + return m_pPixmap->BackgroundCache(CHBACK, filename, totalDim, iconDim, FALSE); } void CDecor::InitGamer() @@ -223,9 +126,7 @@ void CDecor::InitGamer() FillMemory(m_doors, sizeof(m_doors), 1); } -// The fuck does this even do? - -void CDecor::InitDecor(int channel, int icon) +void CDecor::InitDecor() { m_posDecor = { 0, 0 }; m_dimDecor = { 100, 100 }; @@ -233,12 +134,12 @@ void CDecor::InitDecor(int channel, int icon) m_region = 2; m_missionTitle[0] = '\0'; m_decorAction = 0; - for (int y = 0; y < MAXCELY; y++) + for (int x = 0; x < MAXCELX; x++) { - for (int x = 0; x < MAXCELX; x++) + for (int y = 0; y < MAXCELY; y++) { - m_decor[y][x].icon = -1; - m_bigDecor[y][x].icon = -1; + m_decor[x][y].icon = -1; + m_bigDecor[x][y].icon = -1; } } m_decor[3][4].icon = 40; @@ -455,8 +356,6 @@ void CDecor::PlayPrepare(BOOL bTest) m_bPause = FALSE; } -// Sort of makes sense. - void CDecor::BuildPrepare() { for (int i = 0; i < MAXMOVEOBJECT; i++) @@ -527,24 +426,6 @@ void CDecor::MoveStep() } } -int CDecor::GetBlupiChannelStandard() -{ - if (m_bMulti && m_blupiChannel == CHBLUPI && m_team > 0) { - return m_team + CHBLUPI1 - 1; - } - else { - return m_blupiChannel; - } -} - -int CDecor::GetBlupiChannelActual() -{ - if (m_bMulti && m_team > 0) { - return m_team + CHBLUPI1 - 1; - } - return CHBLUPI; -} - int CDecor::GetIconPerso() { if (m_bMulti) { @@ -555,35 +436,6 @@ int CDecor::GetIconPerso() } } -BOOL CDecor::BlitzActif(int celx, int cely) -{ - if (m_phase == WM_PHASE_BUILD) { - //TODO: rewrite this like a human - int foo = m_time >> 31; - return 1 - (((m_time ^ foo) - foo & 1 ^ foo) == foo); - } - - POINT pos = { celx * DIMOBJX, cely * DIMOBJY }; - - int num = m_time % 100; - - if (m_blupiPos.x >= pos.x - 80 && m_blupiPos.x <= pos.x + 80 && - m_blupiPos.y >= pos.y - 500 && m_blupiPos.y <= pos.y + 500) - { - if (m_time % 100 < 70 && cely > 0 && m_decor[celx][cely - 1].icon == 0x130) - { - PlaySound(SOUND_BLITZ, pos, 0); - } - - for (int i = 0; table_blitz[i] != -1; i++) - { - if (m_time % 100 == i) return TRUE; - } - } - - return FALSE; -} - void CDecor::Build(RECT rect) { int num = 1; @@ -997,10 +849,10 @@ void CDecor::DrawInfo() if (m_phase == WM_PHASE_PLAY || WM_PHASE_PLAYTEST) { for (int i = 4; i != 0; i--) { - if (m_messages[i] != '\0') { + if (m_notifText[i] != '\0') { pos.x = 10; pos.y = 10; - DrawText(m_pPixmap, pos, m_messages[i], 0); + DrawTextB(m_pPixmap, pos, m_notifText[i], 0); } } @@ -1089,7 +941,7 @@ POINT CDecor::DecorNextAction() return posDecor; } -void CDecor::TreatKeys(int keys) +void CDecor::SetInput(int keys) { m_keyPress = keys; if (m_blupiInvert) @@ -1115,89 +967,7 @@ void CDecor::SetFieldD814(BOOL param) m_bD814 = param; } -int CDecor::SoundEnviron(int sound, int obstacle) -{ - if ((obstacle >= 32 && obstacle <= 34) || (obstacle >= 41 && obstacle <= 47) || (obstacle >= 139 && obstacle <= 143)) - { - if (sound == SOUND_JUMPTOC) - { - return 79; - } - if (sound == SOUND_JUMPEND) - { - return 78; - } - } - if ((obstacle >= 1 && obstacle <= 28) || (obstacle >= 78 && obstacle <= 90) || (obstacle >= 250 && obstacle <= 260) || (obstacle >= 311 && obstacle <= 316) || (obstacle >= 324 && obstacle <= 329)) - { - if (sound == SOUND_JUMPTOC) - { - return 81; - } - if (sound == SOUND_JUMPEND) - { - return 80; - } - } - if ((obstacle >= 284 && obstacle <= 303) || obstacle == 338) - { - if (sound == SOUND_JUMPTOC) - { - return 83; - } - if (sound == SOUND_JUMPEND) - { - return 82; - } - } - if (obstacle >= 341 && obstacle <= 363) - { - if (sound == SOUND_JUMPTOC) - { - return 85; - } - if (sound == SOUND_JUMPEND) - { - return 84; - } - } - if (obstacle >= 215 && obstacle <= 234) - { - if (sound == SOUND_JUMPTOC) - { - return 87; - } - if (sound == SOUND_JUMPEND) - { - return 86; - } - } - if (obstacle >= 246 && obstacle <= 249) - { - if (sound == SOUND_JUMPTOC) - { - return 89; - } - if (sound == SOUND_JUMPEND) - { - return 88; - } - } - if (obstacle >= 107 && obstacle <= 109) - { - if (sound == SOUND_JUMPTOC) - { - return 91; - } - if (sound == SOUND_JUMPEND) - { - return 90; - } - } - return sound; -} - -void CDecor::PlaySound(int sound, POINT pos, BOOL bLocal) +void CDecor::PlaySoundB(int sound, POINT pos, BOOL bLocal) { if (!bLocal) NetPlaySound(sound, pos); @@ -1284,784 +1054,6 @@ void CDecor::VehicleSoundsPhase(int phase) } } -POINT CDecor::ScreenPosToCelPos(POINT pos) -{ - if (pos.x >= 0 && pos.x < LXIMAGE && pos.y >= 0 && pos.y < LYIMAGE) { - return { - (m_posDecor.x + m_dimCelHili.x * -32 + 32 + pos.x) / 64, - (m_posDecor.y + m_dimCelHili.y * -32 + 32 + pos.y) / 64 - }; - } - else return { -1, -1 }; -} - -void CDecor::SetCelPosFromScreenPos(POINT pos) -{ - m_posCelHili = ScreenPosToCelPos(pos); -} - -void CDecor::SetFieldCC38AndStuff(int _foo, int _bar) -{ - m_dimCelHili = { 1, 1 }; - if (_foo == 2 && _bar != 3 && _bar != 9 && _bar != 10) m_dimCelHili = { 2, 2 }; - if (_foo == 3) m_iconLift = _bar; - if (_foo == 4) m_iconLift = _bar + 20; - if (_foo == 5) m_iconLift = _bar + 40; - m_2ndPositionCalculationSlot = -1; -} - -void CDecor::DeleteCel(POINT cel) -{ - m_2ndPositionCalculationSlot = -1; - - if (!IsValidCel(cel)) return; - - m_decor[cel.x][cel.y].icon = -1; - AdaptBorder(cel); - m_bigDecor[cel.x][cel.y].icon = -1; - MoveObjectDelete(cel); -} - -void CDecor::PlaceMenuItem(short *pCel, int *pTable, int lastIndex, BYTE flags, int currentIcon, BOOL bRand) -{ - if (bRand) { - *pCel = pTable[rand() % (pTable[0] + 1)]; - } - else if (!flags & 8) { - if (flags & 1) { - lastIndex++; - if (*pCel == pTable[lastIndex] && currentIcon != 0 && pTable[0] <= lastIndex) { - lastIndex = 0; - } - *pCel = pTable[lastIndex + 1]; - } - } - else { - *pCel = pTable[lastIndex + 1]; - } -} - -void CDecor::PlaceItemFromMenu1(POINT cel, int index, BYTE flags, int currentIcon) -{ - m_2ndPositionCalculationSlot = -1; - - short *pIcon = &m_decor[cel.x][cel.y].icon; - short *pIconBig = &m_bigDecor[cel.x][cel.y].icon; - - if (!IsValidCel(cel)) return; - - switch (index) { - case 0: // Tree - PlaceMenuItem(pIconBig, table_366b0, m_lastDecorIndexes[0], flags, *pIconBig, TRUE); - break; - case 1: // Palmtree - PlaceMenuItem(pIconBig, table_366c0, m_lastDecorIndexes[1], flags, *pIconBig, TRUE); - break; - case 2: // Decorative plant - PlaceMenuItem(pIconBig, table_366d8, m_lastDecorIndexes[2], flags, *pIconBig, TRUE); - break; - case 3: // Marine plant - *pIcon = Object::Marine_1; - break; - case 4: // House - PlaceMenuItem(pIconBig, table_366e8, m_lastDecorIndexes[3], flags, *pIconBig, TRUE); - break; - case 5: // Mechanical background - PlaceMenuItem(pIconBig, table_366f8, m_lastDecorIndexes[4], flags, *pIconBig, TRUE); - break; - case 6: // Kid's stuff background - PlaceMenuItem(pIconBig, table_36710, m_lastDecorIndexes[5], flags, *pIconBig, TRUE); - break; - case 7: // Green slime 2 - PlaceMenuItem(pIconBig, table_36748, m_lastDecorIndexes[6], flags, *pIconBig, TRUE); - break; - case 8: // Element for Palace - PlaceMenuItem(pIconBig, table_36520, m_lastDecorIndexes[7], flags, *pIconBig, TRUE); - break; - case 9: // Support - PlaceMenuItem(pIcon, table_36670, m_lastDecorIndexes[8], flags, *pIcon, TRUE); - break; - case 10: // Spider's web - PlaceMenuItem(pIcon, table_366a0, m_lastDecorIndexes[9], flags, *pIcon, TRUE); - break; - } -} - -void CDecor::PlaceItemFromMenu2(POINT cel, int index, BYTE flags, int currentIcon) -{ - m_2ndPositionCalculationSlot = -1; - - short *pIcon = &m_decor[cel.x][cel.y].icon; - - if (!IsValidCel(cel)) return; - - m_iconLift = index; - - switch (index) { - case 0: // Square tech-blocks - PlaceMenuItem(pIcon, table_36418, m_lastDecorIndexes[10], flags, *pIcon, TRUE); - break; - case 1: // Special tech-blocks - PlaceMenuItem(pIcon, table_36458, m_lastDecorIndexes[11], flags, *pIcon, TRUE); - break; - case 2: // Triangular tech-blocks - PlaceMenuItem(pIcon, table_36488, m_lastDecorIndexes[12], flags, *pIcon, FALSE); - break; - case 3: // Secret tech-block - PlaceMenuItem(pIcon, table_364a0, m_lastDecorIndexes[13], flags, *pIcon, FALSE); - break; - case 4: // Mechanical square - PlaceMenuItem(pIcon, table_364b0, m_lastDecorIndexes[14], flags, *pIcon, TRUE); - break; - case 5: // Special mechanical - PlaceMenuItem(pIcon, table_364d0, m_lastDecorIndexes[15], flags, *pIcon, FALSE); - break; - case 6: // Secret mechanical - PlaceMenuItem(pIcon, table_364e8, m_lastDecorIndexes[16], flags, *pIcon, FALSE); - break; - case 7: // Pipes - *pIcon = Object::Pipes_1; - break; - } - AdaptBorder(cel); -} - -void CDecor::PlaceItemFromMenu3(POINT cel, int index, BYTE flags, int currentIcon) -{ - m_2ndPositionCalculationSlot = -1; - - short *pIcon = &m_decor[cel.x][cel.y].icon; - - if (!IsValidCel(cel)) return; - - m_iconLift = index + 20; - - switch (index) { - case 0: // Square rock - PlaceMenuItem(pIcon, table_36530, m_lastDecorIndexes[20], flags, *pIcon, FALSE); - break; - case 1: // Triangular rock - PlaceMenuItem(pIcon, table_36538, m_lastDecorIndexes[21], flags, *pIcon, FALSE); - break; - case 2: // Secret rock - PlaceMenuItem(pIcon, table_36548, m_lastDecorIndexes[22], flags, *pIcon, FALSE); - break; - case 3: // Cave - // todo - break; - case 4: // Secret cave - *pIcon = Object::CaveSecret; - break; - case 5: // Cheese - *pIcon = Random(Object::CheeseSquare_1, Object::CheeseSquare_4); - break; - case 6: // Secret cheese - *pIcon = Object::CheeseSecret; - break; - case 7: // Green slime 2 - *pIcon = Object::Slime_1; - break; - case 8: // Grass - PlaceMenuItem(pIcon, table_365d0, m_lastDecorIndexes[23], flags, *pIcon, FALSE); - break; - case 9: // Water - PlaceMenuItem(pIcon, table_36630, m_lastDecorIndexes[24], flags, *pIcon, FALSE); - break; - } - AdaptBorder(cel); -} - -void CDecor::PlaceItemFromMenu4(POINT cel, int index, BYTE flags, int currentIcon) -{ - m_2ndPositionCalculationSlot = -1; - - short *pIcon = &m_decor[cel.x][cel.y].icon; - - if (!IsValidCel(cel)) return; - - m_iconLift = index + 40; - - switch (index) { - case 0: // Palace - break; - case 1: // Element for Palace - break; - case 2: // Building facade - break; - case 3: // Roof - break; - case 4: // Bricks - break; - case 5: // Furniture - break; - case 6: // Wooden wall - break; - case 7: // Kid's stuff square - break; - case 8: // Special Kid's stuff - break; - case 9: // Invisible block - break; - } - AdaptBorder(cel); -} - -void CDecor::PlaceItemFromMenu5(POINT cel, int index, BYTE flags, int currentIcon) -{ - m_2ndPositionCalculationSlot = -1; - - int mobId; - MoveObject* pMob; - - short *pIcon = &m_decor[cel.x][cel.y].icon; - - if (!IsValidCel(cel)) return; - - switch (index) { - case 0: // Bomb - MoveObjectDelete(cel); - mobId = MoveObjectFree(); - if (mobId == -1) return; - pMob = &m_moveObject[mobId]; - pMob->type = TYPE_BOMBEDOWN; - pMob->stepAdvance = 1; - pMob->stepRecede = 1; - pMob->timeStopStart = 0; - pMob->timeStopEnd = 0; - pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 4 }; - pMob->posEnd = pMob->posStart; - pMob->posCurrent = pMob->posStart; - pMob->step = STEP_STOPSTART; - pMob->time = 0; - pMob->phase = 0; - pMob->channel = CHELEMENT; - pMob->icon = 0x0c; - break; - case 1: // Hanging bomb - MoveObjectDelete(cel); - mobId = MoveObjectFree(); - if (mobId == -1) return; - pMob = &m_moveObject[mobId]; - pMob->type = TYPE_BOMBEUP; - pMob->stepAdvance = 1; - pMob->stepRecede = 1; - pMob->timeStopStart = 0; - pMob->timeStopEnd = 0; - pMob->posStart = { cel.x * 64 + 2, cel.y * 64 }; - pMob->posEnd = pMob->posStart; - pMob->posCurrent = pMob->posStart; - pMob->step = STEP_STOPSTART; - pMob->time = 0; - pMob->phase = 0; - pMob->channel = CHELEMENT; - pMob->icon = 0x30; - break; - case 2: // Homing bomb - MoveObjectDelete(cel); - mobId = MoveObjectFree(); - if (mobId == -1) return; - pMob = &m_moveObject[mobId]; - pMob->type = TYPE_BOMBEFOLLOW1; - pMob->stepAdvance = 1; - pMob->stepRecede = 1; - pMob->timeStopStart = 0; - pMob->timeStopEnd = 0; - pMob->posStart = { cel.x * 64, cel.y * 64 }; - pMob->posEnd = pMob->posStart; - pMob->posCurrent = pMob->posStart; - pMob->step = STEP_STOPSTART; - pMob->time = 0; - pMob->phase = 0; - pMob->channel = CHELEMENT; - pMob->icon = 0x100; - break; - case 3: // Lava - PlaceMenuItem(pIcon, table_decor_lave, m_lastDecorIndexes[40], flags, *pIcon, FALSE); - break; - case 4: // Fan - PlaceMenuItem(pIcon, table_decor_ventillog, m_lastDecorIndexes[41], flags, *pIcon, FALSE); - break; - case 5: // Wind - PlaceMenuItem(pIcon, table_decor_ventg, m_lastDecorIndexes[42], flags, *pIcon, FALSE); - break; - case 6: // Slime trap (floor) - *pIcon = Object::SlimeTrapFloor_1; - break; - case 7: // Slime trap (ceiling) - *pIcon = Object::SlimeTrapCeiling_1; - break; - case 8: // Circular saw - PlaceMenuItem(pIcon, table_decor_scie, m_lastDecorIndexes[43], flags, *pIcon, FALSE); - break; - case 9: // Inverter - MoveObjectDelete(cel); - mobId = MoveObjectFree(); - if (mobId == -1) return; - pMob = &m_moveObject[mobId]; - pMob->type = TYPE_INVERT; - pMob->stepAdvance = 1; - pMob->stepRecede = 1; - pMob->timeStopStart = 0; - pMob->timeStopEnd = 0; - pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 8 }; - pMob->posEnd = pMob->posStart; - pMob->posCurrent = pMob->posStart; - pMob->step = STEP_STOPSTART; - pMob->time = 0; - pMob->phase = 0; - pMob->channel = CHELEMENT; - pMob->icon = 0xBB; - break; - case 10: // Lightning - *pIcon = Object::LightningMachine; - break; - case 11: // Crusher - *pIcon = Object::Crusher_1; - break; - } - AdaptBorder(cel); -} - -void CDecor::PlaceItemFromMenu6(POINT cel, int index, BYTE flags, int currentIcon) -{ - m_2ndPositionCalculationSlot = -1; - - short *pIcon = &m_decor[cel.x][cel.y].icon; - - if (!IsValidCel(cel) || currentIcon == 0) return; - - switch (m_iconLift) { - - } - - switch (index) { - case 0: // Slow lift - case 1: // Normal lift - case 2: // Fast lift - case 3: // Fast/Slow lift - case 4: // Lift with conveyor belt - case 5: // Bulldozer - case 6: // Fish - case 7: // Bird - case 8: // Wasp - case 9: // Slime creature - case 10: // Moving bomb - case 11: // Heliported ennemy - case 12: // Motorized ennemy - } -} - -void CDecor::PlaceItemFromMenu7(POINT cel, int index, BYTE flags, int currentIcon) -{ - m_2ndPositionCalculationSlot = -1; - - MoveObject* pMob; - int mobId; - - short *pIcon = &m_decor[cel.x][cel.y].icon; - - if (!IsValidCel(cel)) return; - - switch (index) { - case 0: // Chest - MoveObjectDelete(cel); - mobId = MoveObjectFree(); - if (mobId == -1) return; - pMob = &m_moveObject[mobId]; - pMob->type = TYPE_TRESOR; - pMob->stepAdvance = 1; - pMob->stepRecede = 1; - pMob->timeStopStart = 0; - pMob->timeStopEnd = 0; - pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 4 }; - pMob->posEnd = pMob->posStart; - pMob->posCurrent = pMob->posStart; - pMob->step = STEP_STOPSTART; - pMob->time = 0; - pMob->phase = 0; - pMob->channel = CHELEMENT; - pMob->icon = 0x00; - break; - case 1: // Egg - MoveObjectDelete(cel); - mobId = MoveObjectFree(); - if (mobId == -1) return; - pMob = &m_moveObject[mobId]; - pMob->type = TYPE_EGG; - pMob->stepAdvance = 1; - pMob->stepRecede = 1; - pMob->timeStopStart = 0; - pMob->timeStopEnd = 0; - pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 8 }; - pMob->posEnd = pMob->posStart; - pMob->posCurrent = pMob->posStart; - pMob->step = STEP_STOPSTART; - pMob->time = 0; - pMob->phase = 0; - pMob->channel = CHELEMENT; - pMob->icon = 0x15; - break; - case 2: // Lollipop - MoveObjectDelete(cel); - mobId = MoveObjectFree(); - if (mobId == -1) return; - pMob = &m_moveObject[mobId]; - pMob->type = TYPE_POWER; - pMob->stepAdvance = 1; - pMob->stepRecede = 1; - pMob->timeStopStart = 0; - pMob->timeStopEnd = 0; - pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 8 }; - pMob->posEnd = pMob->posStart; - pMob->posCurrent = pMob->posStart; - pMob->step = STEP_STOPSTART; - pMob->time = 0; - pMob->phase = 0; - pMob->channel = CHELEMENT; - pMob->icon = 0x88; - break; - case 3: // Shield - MoveObjectDelete(cel); - mobId = MoveObjectFree(); - if (mobId == -1) return; - pMob = &m_moveObject[mobId]; - pMob->type = TYPE_SHIELD; - pMob->stepAdvance = 1; - pMob->stepRecede = 1; - pMob->timeStopStart = 0; - pMob->timeStopEnd = 0; - pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 8 }; - pMob->posEnd = pMob->posStart; - pMob->posCurrent = pMob->posStart; - pMob->step = STEP_STOPSTART; - pMob->time = 0; - pMob->phase = 0; - pMob->channel = CHELEMENT; - pMob->icon = 0x90; - break; - case 4: // Invisibility potion - MoveObjectDelete(cel); - mobId = MoveObjectFree(); - if (mobId == -1) return; - pMob = &m_moveObject[mobId]; - pMob->type = TYPE_DRINK; - pMob->stepAdvance = 1; - pMob->stepRecede = 1; - pMob->timeStopStart = 0; - pMob->timeStopEnd = 0; - pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 6 }; - pMob->posEnd = pMob->posStart; - pMob->posCurrent = pMob->posStart; - pMob->step = STEP_STOPSTART; - pMob->time = 0; - pMob->phase = 0; - pMob->channel = CHELEMENT; - pMob->icon = 0xB2; - break; - case 5: // Glue supply - MoveObjectDelete(cel); - mobId = MoveObjectFree(); - if (mobId == -1) return; - pMob = &m_moveObject[mobId]; - pMob->type = TYPE_BULLET; - pMob->stepAdvance = 1; - pMob->stepRecede = 1; - pMob->timeStopStart = 0; - pMob->timeStopEnd = 0; - pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 4 }; - pMob->posEnd = pMob->posStart; - pMob->posCurrent = pMob->posStart; - pMob->step = STEP_STOPSTART; - pMob->time = 0; - pMob->phase = 0; - pMob->channel = CHELEMENT; - pMob->icon = 0xB1; - break; - case 6: // Recharging device - MoveObjectDelete(cel); - mobId = MoveObjectFree(); - if (mobId == -1) return; - pMob = &m_moveObject[mobId]; - pMob->type = TYPE_CHARGE; - pMob->stepAdvance = 1; - pMob->stepRecede = 1; - pMob->timeStopStart = 0; - pMob->timeStopEnd = 0; - pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 4 }; - pMob->posEnd = pMob->posStart; - pMob->posCurrent = pMob->posStart; - pMob->step = STEP_STOPSTART; - pMob->time = 0; - pMob->phase = 0; - pMob->channel = CHELEMENT; - pMob->icon = 0xEE; - break; - case 7: // Personal bomb - int type; - mobId = MoveObjectSearch(cel, -1); - if (mobId != -1 && currentIcon != 0) { - if (mobId >= TYPE_BOMBEPERSO4) { - m_lastDecorIndexes[60] = 0; - } - else { - m_lastDecorIndexes[60] = m_moveObject[mobId].type - TYPE_BOMBEPERSO1; - } - } - type = m_lastDecorIndexes[60] + TYPE_BOMBEPERSO1; - MoveObjectDelete(cel); - mobId = MoveObjectFree(); - if (mobId == -1) return; - pMob = &m_moveObject[mobId]; - pMob->type = type; - pMob->stepAdvance = 1; - pMob->stepRecede = 1; - pMob->timeStopStart = 0; - pMob->timeStopEnd = 0; - pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 6 }; - pMob->posEnd = pMob->posStart; - pMob->posCurrent = pMob->posStart; - pMob->step = STEP_STOPSTART; - pMob->time = 0; - pMob->phase = 0; - switch (type) { - default: - case TYPE_BOMBEPERSO1: - pMob->channel = CHBLUPI; - break; - case TYPE_BOMBEPERSO2: - pMob->channel = CHBLUPI1; - break; - case TYPE_BOMBEPERSO3: - pMob->channel = CHBLUPI2; - break; - case TYPE_BOMBEPERSO4: - pMob->channel = CHBLUPI3; - break; - } - pMob->icon = 0x101; - break; - case 8: // Dynamite - MoveObjectDelete(cel); - mobId = MoveObjectFree(); - if (mobId == -1) return; - pMob = &m_moveObject[mobId]; - pMob->type = TYPE_DYNAMITE; - pMob->stepAdvance = 1; - pMob->stepRecede = 1; - pMob->timeStopStart = 0; - pMob->timeStopEnd = 0; - pMob->posStart = { cel.x * 64 + 2, cel.y * 64 + 6 }; - pMob->posEnd = pMob->posStart; - pMob->posCurrent = pMob->posStart; - pMob->step = STEP_STOPSTART; - pMob->time = 0; - pMob->phase = 0; - pMob->channel = CHELEMENT; - pMob->icon = 0xFC; - break; - } - AdaptBorder(cel); -} - -void CDecor::PlaceItemFromMenu8(POINT cel, int index, BYTE flags, int currentIcon) -{ - m_2ndPositionCalculationSlot = -1; - - short *pIcon = &m_decor[cel.x][cel.y].icon; - - if (!IsValidCel(cel)) return; - - switch (index) { - case 0: // Key - case 1: // Door - case 2: // Closed while not all chests have been found - case 3: // Teleporter - case 4: // Bar to hang from - case 5: // Spring - case 6: // Vanishing bloc - case 7: // Fragile bridge - case 8: // Wooden case - case 9: // Secret wooden case - } -} - -void CDecor::PlaceItemFromMenu9(POINT cel, int index, BYTE flags, int currentIcon) -{ - m_2ndPositionCalculationSlot = -1; - - short *pIcon = &m_decor[cel.x][cel.y].icon; - - if (!IsValidCel(cel)) return; - - switch (index) { - case 0: // Hovercraft - case 1: // Helicopter - case 2: // Skateboard - case 3: // Jeep - case 4: // Glue tank - } -} - -void CDecor::PlaceItemFromMenu10(POINT cel, int index, BYTE flags, int currentIcon) -{ - m_2ndPositionCalculationSlot = -1; - - short *pIcon = &m_decor[cel.x][cel.y].icon; - - if (!IsValidCel(cel)) return; - - switch (index) { - case 0: // Goal - case 1: // Yellow Blupi - case 2: // Orange Blupi - case 3: // Blue Blupi - case 4: // Green Blupi - case 5: // Door - case 6: // Level start - case 7: // Key - } -} - -void CDecor::UpdateCaisse() -{ - m_nbRankCaisse = 0; - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i].type == TYPE_CAISSE) - { - m_rankCaisse[m_nbRankCaisse++] = i; - } - } -} - -BOOL CDecor::TestPushCaisse(int i, POINT pos, BOOL bPop) -{ - POINT move; - - move.x = pos.x - m_moveObject[i].posCurrent.x; - move.y = 0; - SearchLinkCaisse(i, bPop); - int y = m_moveObject[i].posCurrent.y; - for (int j = 0; j < m_nbLinkCaisse; j++) - { - i = m_linkCaisse[j]; - if (!TestPushOneCaisse(i, move, y)) - { - return FALSE; - } - } - for (int j = 0; j < m_nbLinkCaisse; j++) - { - i = m_linkCaisse[j]; - int num = i; - m_moveObject[num].posCurrent.x = m_moveObject[num].posCurrent.x + move.x; - m_moveObject[num].posStart.x = m_moveObject[num].posStart.x + move.x; - int num2 = i; - m_moveObject[num].posEnd.x = m_moveObject[num].posEnd.x + move.x; - } - return TRUE; -} - -BOOL CDecor::TestPushOneCaisse(int i, POINT move, int b) -{ - -} - -void CDecor::SearchLinkCaisse(int rank, BOOL bPop) -{ - m_nbLinkCaisse = 0; - AddLinkCaisse(rank); - POINT posCurrent = m_moveObject; - - BOOL flag; - do - { - flag = FALSE; - for (int i = 0; i < m_nbLinkCaisse; i++) - { - int num = m_linkCaisse[i]; - if (m_moveObject[num]->posCurrent.y <= - posCurrent.y && (!bPop || (m_moveObject - [num]->posCurrent.x >= posCurrent.x - 32 && - m_moveObject[num]->posCurrent.x <= - posCurrent.x + 32))) - { - RECT src; - src.left = m_moveObject[num]->posCurrent.x - 1; - src.top = m_moveObject[num]->posCurrent.y - 1; - src.right = src.left + 64 + 1; - src.bottom = src.top + 64 + 1; - for (int j = 0; j < m_nbRankCaisse; j++) - { - int num2 = m_rankCaisse[j]; - if (num2 != num && m_moveObject[num2]->posCurrent.y <= posCurrent.y && (!bPop || (m_moveObject[num2]->posCurrent.x >= posCurrent.x - 32 && m_moveObject[num2]->posCurrent.x <= posCurrent.x + 32))) - { - RECT src2; - src2.left = m_moveObject[num2]->posCurrent.x - 1; - src2.top = m_moveObject[num2]->posCurrent.y - 1; - src2.right = src2.left + 64 + 1; - src2.bottom = src2.top + 64 + 1; - RECT tinyRect; - if (IntersectRect(tinyRect, src2, src) && AddLinkCaisse(num2)) - { - flag = TRUE; - } - } - } - } - } - } while (flag); -} - -BOOL CDecor::AddLinkCaisse(int rank) -{ - for (int i = 0; i < m_nbLinkCaisse; i++) - { - if (m_linkCaisse[i] == rank) - { - return FALSE; - } - } - m_linkCaisse[m_nbLinkCaisse] = rank; - m_nbLinkCaisse++; - return TRUE; -} - - -BOOL CDecor::LoadBackgroundImages() -{ - char filename[52]; - POINT totalDim, iconDim; - - if (m_region == m_lastRegion) return TRUE; - m_lastRegion == m_region; - - totalDim.x = DIMCELX * 2 * 16; - totalDim.y = DIMCELY * 2 * 6; - iconDim.x = DIMCELX * 2; - iconDim.y = DIMCELY * 2; - sprintf(filename, "image\\decor%.3d.blp", m_region); - if (!m_pPixmap->Cache(CHFLOOR, filename, totalDim, iconDim, FALSE)) - return FALSE; - - return TRUE; -} - - - - -} - -void CDecor::SetTime(int time) -{ - m_time = time; -} - -int CDecor::GetTime() -{ - return m_time; -} - int CDecor::GetRegion() { return m_region; @@ -2099,20 +1091,19 @@ int CDecor::GetNbVies() void CDecor::SetNbVies(int nbVies) { - m_nbVies = nbVies; + m_nbVies = nbVies; } BOOL CDecor::GetPause() { - return m_bPause; + return m_bPause; } void CDecor::SetPause(BOOL bPause) { - m_bPause = bPause; + m_bPause = bPause; } - void CDecor::InitializeDoors(GameData *gameData) { for (int i = 0; i < MAXMOVEOBJECT; i++) @@ -2121,6 +1112,19 @@ void CDecor::InitializeDoors(GameData *gameData) } } +void CDecor::MemorizeDoors(BYTE* doors) +{ + int i; + + i = 0; + + do + { + m_doors[i] = doors[i]; + i++; + } while (i < 200); + return; +} void CDecor::SetAllMissions(BOOL bAllMissions) { @@ -2386,3788 +1390,29 @@ void CDecor::CheatAction(int cheat) } } -void CDecor::BlupiSearchIcon() -{ - int num = 0; - int num2 = 2; - int num3 = m_blupiAction; - if (m_blupiVent && m_blupiHelico && m_blupiOver) - { - if (num3 == 1) - { - num3 = 8; - } - if (num3 == 2) - { - num3 = 14; - } - } - if (m_blupiHelico) - { - if (num3 == 1) - { - num3 = 15; - } - if (num3 == 2) - { - num3 = 16; - } - if (num3 == 3) - { - num3 = 17; - } - if (num3 == 10) - { - num3 = 15; - } - if (num3 == 9) - { - num3 = 15; - } - m_blupiRealRotation = (int)(m_blupiVitesseX * 2.0); - } - if (m_blupiOver) - { - if (num3 == 1) - { - num3 = 67; - } - if (num3 == 2) - { - num3 = 68; - } - if (num3 == 3) - { - num3 = 69; - } - if (num3 == 10) - { - num3 = 67; - } - if (num3 == 9) - { - num3 = 67; - } - } - if (m_blupiJeep) - { - if (num3 == 1) - { - num3 = 25; - } - if (num3 == 2) - { - num3 = 26; - } - if (num3 == 10) - { - num3 == 26; - } - if (num3 == 3) - { - num3 = 27; - } - } - if (m_blupiTank) - { - if (num3 == 1) - { - num3 = 50; - } - if (num3 == 2) - { - num3 = 51; - } - if (num3 == 10) - { - num3 = 51; - } - if (num3 == 3) - { - num3 = 52; - } - } - -} - -void CDecor::BlupiStep() -{ - POINT tinyPoint; - POINT tinyPoint2; - BlupiAdjust(); - m_blupiLastPos = m_blupiPos; - POINT tinyPoint3 = m_blupiPos; - BOOL flag = m_blupiAir; - int blupiAction = m_blupiAction; - BOOL flag2 = FALSE; - BOOL flag3 = FALSE; - tinyPoint3.x += m_blupiVector.x; - tinyPoint3.y += m_blupiVector.y; - if (m_blupiFocus && (tinyPoint3.y + 30) / 64 >= 99) - { - BlupiDead(75, -1); - m_blupiRestart = TRUE; - m_blupiAir = TRUE; - m_blupiPos.y = m_blupiPos.y / 64 * 64 + BLUPIOFFY; - PlaySound(8, m_blupiPos); - return; - } - RECT rect; - if (m_blupiVector.x != 0 || m_blupiVector.y != 0) - { - rect = BlupiRect(m_blupiPos); - rect.top = m_blupiPos.y + 11; - rect.bottom = m_blupiPos.y + 60 - 2; - TestPath(rect, m_blupiPos, tinyPoint3); - } - m_blupiVent = FALSE; - int num; - if (m_blupiTransport == -1 && !m_blupiJeep && !m_blupiTank && !m_blupiSkate - && m_blupiFocus) - { - num = m_decor[(tinyPoint3.x + 30) / 64, (tinyPoint3.y + 30) / 64]->icon; - if (num == 110) - { - tinyPoint3.x -= 9; - } - if (num == 114) - { - tinyPoint3.x += 9; - } - if (num == 118) - { - tinyPoint3.y -= 20; - } - if (num == 122) - { - tinyPoint3.y += 20; - } - if (num >= 110 && num <= 125) - { - m_blupiVent = TRUE; - rect.left = m_blupiPos.x + 12; - rect.right = m_blupiPos.x + 60 - 12; - rect.top = m_blupiPos.y + 11; - rect.bottom = m_blupiPos.y + 60 - 2; - TestPath(rect, m_blupiPos, tinyPoint3); - } - } - BOOL flag4; - if (m_blupiTransport == -1) - { - rect = BlupiRect(tinyPoint3); - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60 - 1; - flag = !DecorDetect(rect); - } - else - { - flag4 = FALSE; - } - rect = BlupiRect(tinyPoint3); - rect.top = tinyPoint3.y + 10; - rect.bottom = tinyPoint3.y + 20; - BOOL flag5 = DecorDetect(rect); - int detectIcon = m_detectIcon; - if (!m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && flag4 && m_blupiFocus) - { - if (m_blupiFocus) - { - m_blupiAction = 5; - m_blupiPhase = 0; - } - m_blupiVitesse.y = 1.0; - m_blupiAir = true; - flag = true; - } - if (!m_blupiNage && !m_blupiSurf && !m_blupiSuspend && !m_blupiAir && IsRessort(tinyPoint3)) - { - if ((m_blupiHelico || m_blupiOver) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) - { - m_blupiHelico = false; - m_blupiOver = false; - tinyPoint.x = tinyPoint3.x - 34; - tinyPoint.y = tinyPoint3.y - 34; - ObjectStart(tinyPoint, 9, 0); - m_decorAction = 1; - m_decorPhase = 0; - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - PlaySound(10, m_blupiPos); - } - if (m_blupiJeep && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) - { - m_blupiJeep = false; - tinyPoint.x = tinyPoint3.x - 34; - tinyPoint.y = tinyPoint3.y - 34; - ObjectStart(tinyPoint, 9, 0); - m_decorAction = 1; - m_decorPhase = 0; - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - PlaySound(10, m_blupiPos); - } - if (m_blupiTank && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) - { - m_blupiTank = false; - tinyPoint.x = tinyPoint3.x - 34; - tinyPoint.y = tinyPoint3.y - 34; - ObjectStart(tinyPoint, 9, 0); - m_decorAction = 1; - m_decorPhase = 0; - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - PlaySound(10, m_blupiPos); - } - if (m_blupiSkate && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) - { - m_blupiSkate = false; - tinyPoint.x = tinyPoint3.x - 34; - tinyPoint.y = tinyPoint3.y - 34; - ObjectStart(tinyPoint, 9, 0); - m_decorAction = 1; - m_decorPhase = 0; - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - PlaySound(10, m_blupiPos); - } - if (m_blupiFocus && m_blupiAction != 11 && m_blupiAction != 75 && m_blupiAction != 76 && m_blupiAction != 77 && m_blupiAction != 78 && m_blupiAction != 79 && m_blupiAction != 80 && m_blupiAction != 81) - { - m_blupiAction = 5; - m_blupiPhase = 0; - } - if ((m_keyPress & 1) != 0 && m_blupiFocus) - { - m_blupiVitesse.y = (m_blupiPower ? -25 : -19); - } - else - { - m_blupiVitesse.y = (m_blupiPower ? -16 : -10); - } - m_blupiAir = true; - flag = true; - PlaySound(41, tinyPoint3); - } - if ((m_keyPress & 1) != 0 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - if (m_blupiAction != 4 && m_blupiAction != 3 && !m_blupiAir) - { - m_blupiAction = 4; - m_blupiPhase = 0; - } - if (m_blupiAction == 4 && m_blupiPhase == 3) - { - m_blupiAction = 5; - m_blupiPhase = 0; - if (m_blupiSkate) - { - PlaySound(1, tinyPoint3); - m_blupiVitesse.y = (m_blupiPower ? -17 : -13); - } - else - { - PlaySound(1, tinyPoint3); - if (IsNormalJump(tinyPoint3)) - { - m_blupiVitesse.y = (m_blupiPower ? -26 : -16); - } - else - { - m_blupiVitesse.y = (m_blupiPower ? -16 : -12); - } - } - m_blupiAir = true; - flag = true; - } - } - if (m_blupiAir) - { - if (flag5 && m_blupiVitesse.y < 0) - { - if (m_blupiVitesse.y < -14.0 && m_blupiAction != 11 && m_blupiAction != 75 && m_blupiAction != 76 && m_blupiAction != 77 && m_blupiAction != 78 && m_blupiAction != 79 && m_blupiAction != 80 && m_blupiAction != 81 && !m_blupiSkate) - { - m_blupiJumpAie = true; - PlaySound(40, tinyPoint3); - } - else - { - PlaySound(SoundEnviron(4, detectIcon), tinyPoint3); - } - m_blupiVitesse.y = 1.0; - } - tinyPoint3.y += (int)(m_blupiVitesse.y * 2.0); - if (m_blupiVitesse.y < 20.0) - { - m_blupiVitesse.y += 2.0; - } - rect = BlupiRect(tinyPoint3); - rect.top = tinyPoint3.y + 60 - 30; - rect.bottom = tinyPoint3.y + 60 - 1; - if (m_blupiVitesse.y >= 0.0 && DecorDetect(rect)) - { - tinyPoint3.y = tinyPoint3.y / 32 * 32 + BLUPIOFFY; - if (!IsRessort(tinyPoint3)) - { - PlaySound(SoundEnviron(3, m_detectIcon), tinyPoint3); - } - if (m_blupiFocus) - { - if (m_blupiVitesse.y > 20.0) - { - m_blupiAction = 61; - } - else - { - m_blupiAction = 61; - } - m_blupiPhase = 0; - } - m_blupiAir = false; - if (m_blupiJumpAie) - { - m_blupiJumpAie = false; - m_blupiAction = 36; - m_blupiPhase = 0; - } - } - rect.left = tinyPoint3.x + 20; - rect.right = tinyPoint3.x + 60 - 20; - rect.top = tinyPoint3.y + 60 - 33; - rect.bottom = tinyPoint3.y + 60 - 1; - num = AscenseurDetect(rect, m_blupiPos, tinyPoint3); - if (m_blupiVitesse.y >= 0.0 && num != -1) - { - m_blupiTransport = num; - flag4 = false; - PlaySound(3, tinyPoint3); - tinyPoint3.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY; - if (m_blupiFocus) - { - if (m_blupiVitesse.y > 20.0) - { - m_blupiAction = 61; - } - else - { - m_blupiAction = 61; - } - m_blupiPhase = 0; - } - m_blupiAir = false; - if (m_blupiJumpAie) - { - m_blupiJumpAie = false; - m_blupiAction = 36; - m_blupiPhase = 0; - } - } - } - if (m_blupiAction == 36 && m_blupiPhase == 30) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - if (m_blupiAction == 56 && m_blupiPhase == 64) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - m_blupiCloud = true; - m_blupiTimeShield = 100; - m_jauges[1].SetHide(false); - PlaySound(55, tinyPoint3); - } - if (m_blupiAction == 58) - { - if (m_blupiPhase == 8) - { - tinyPoint.x = m_blupiPos.x; - tinyPoint.y = m_blupiPos.y + 40; - if (m_blupiVitesse.y > 0.0) - { - tinyPoint.y += (int)(m_blupiVitesse.y * 4.0); - } - m_blupiVitesse.y -= 10.0; - if (ObjectStart(tinyPoint, 23, 55) != -1) - { - PlaySound(52, m_blupiPos); - m_blupiTimeFire = 10; - m_blupiBullet--; - } - } - if (m_blupiPhase == 14) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - } - if ((m_blupiAction == 44 || m_blupiAction == 45) && m_blupiPhase == 29) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - if (m_blupiAction == 46 && m_blupiPhase == 32) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - if (m_blupiAction == 47 && m_blupiPhase == 34) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - bool flag6; - if (m_blupiAction == 48 && m_blupiPhase == 40) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - num = MoveObjectDetect(tinyPoint3, out flag6); - if (num != -1 && !flag6 && tinyPoint3.y - BLUPIFLOOR == m_moveObject[num].posCurrent.y) - { - if (m_blupiDir == 2 && tinyPoint3.x < m_moveObject[num].posCurrent.x) - { - tinyPoint.x = tinyPoint3.x - 16; - tinyPoint.y = tinyPoint3.y; - int num2 = MoveObjectDetect(tinyPoint, out flag6); - if (num2 == -1) - { - m_blupiAction = 9; - m_blupiPhase = 0; - } - } - if (m_blupiDir == 1 && tinyPoint3.x > m_moveObject[num].posCurrent.x) - { - tinyPoint.x = tinyPoint3.x + 16; - tinyPoint.y = tinyPoint3.y; - int num2 = MoveObjectDetect(tinyPoint, out flag6); - if (num2 == -1) - { - m_blupiAction = 9; - m_blupiPhase = 0; - } - } - } - } - if (m_blupiAction == 65) - { - if (m_blupiPhase == 4) - { - PlaySound(47, m_blupiPos); - } - if (m_blupiPhase == 44) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - } - if (m_blupiAction == 63) - { - if (m_blupiPhase == 1) - { - PlaySound(65, m_blupiPos); - m_blupiTimeMockery = 300; - } - if (m_blupiPhase == 92) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - } - if (m_blupiAction == 64) - { - if (m_blupiPhase == 6) - { - PlaySound(65, m_blupiPos); - m_blupiTimeMockery = 300; - } - if (m_blupiPhase == 104) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - } - if (m_blupiAction == 83) - { - if (m_blupiPhase == 4) - { - PlaySound(47, m_blupiPos); - } - if (m_blupiPhase == 60) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - } - if (m_blupiAction == 84 && m_blupiPhase == 18) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - if (m_blupiAction == 60 && m_blupiPhase == 3) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if (m_blupiAction == 61 && m_blupiPhase == 5) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if (m_blupiAction == 62 && m_blupiPhase == 2) - { - m_blupiAction = 5; - m_blupiPhase = 0; - m_blupiVitesse.y = -12.0; - m_blupiAir = true; - flag = true; - } - if (m_blupiAction == 49 && m_blupiPhase == 32) - { - ObjectStart(m_sucettePos, m_sucetteType, 0); - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - m_blupiPower = true; - m_blupiTimeShield = 100; - m_blupiPosMagic = m_blupiPos; - m_jauges[1].SetHide(false); - PlaySound(44, tinyPoint3); - } - if (m_blupiAction == 55 && m_blupiPhase == 36) - { - ObjectStart(m_sucettePos, m_sucetteType, 0); - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - m_blupiHide = true; - m_blupiTimeShield = 100; - m_blupiPosMagic = m_blupiPos; - m_jauges[1].SetHide(false); - PlaySound(62, tinyPoint3); - } - if (m_blupiSpeedY < 0.0 && m_blupiLastSpeedY == 0.0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - m_blupiAction = 7; - m_blupiPhase = 0; - } - if (m_blupiSpeedY == 0.0 && m_blupiLastSpeedY < 0.0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if (m_blupiSpeedY > 0.0 && m_blupiLastSpeedY == 0.0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 6 && m_blupiAction != 28 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - m_blupiAction = 6; - m_blupiPhase = 0; - } - if (m_blupiSpeedY > 0.0 && m_blupiSpeedX == 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 6 && m_blupiAction != 28 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - m_blupiAction = 6; - m_blupiPhase = 0; - } - if (m_blupiSpeedY == 0.0 && m_blupiLastSpeedY > 0.0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if (m_blupiAction == 7 && m_blupiPhase == 4) - { - m_scrollAdd.y = -150; - PlaySound(21, tinyPoint3); - } - if (m_blupiAction == 6 && m_blupiPhase == 4) - { - m_scrollAdd.y = 150; - PlaySound(7, tinyPoint3); - } - if (!m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - if (m_blupiSpeedY > 0.0 && m_blupiSpeedX == 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 28 && m_blupiDir == 1 && (num = CaisseInFront()) != -1) - { - tinyPoint3.x = m_moveObject[num].posCurrent.x + 64 - 5; - m_blupiAction = 28; - m_blupiPhase = 0; - m_scrollAdd.y = 0; - PlaySound(39, tinyPoint3); - } - if (m_blupiSpeedY > 0.0 && m_blupiSpeedX > 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 29 && m_blupiDir == 1 && CaisseInFront() != -1) - { - m_blupiAction = 29; - m_blupiPhase = 0; - m_scrollAdd.y = 0; - PlaySound(39, tinyPoint3); - } - if (m_blupiSpeedY > 0.0 && m_blupiSpeedX == 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 28 && m_blupiDir == 2 && (num = CaisseInFront()) != -1) - { - tinyPoint3.x = m_moveObject[num].posCurrent.x - 60 + 5; - m_blupiAction = 28; - m_blupiPhase = 0; - m_scrollAdd.y = 0; - PlaySound(39, tinyPoint3); - } - if (m_blupiSpeedY > 0.0 && m_blupiSpeedX < 0.0 && (m_keyPress & 1) == 0 && m_blupiAction != 29 && m_blupiDir == 2 && CaisseInFront() != -1) - { - m_blupiAction = 29; - m_blupiPhase = 0; - m_scrollAdd.y = 0; - PlaySound(39, tinyPoint3); - } - if (m_blupiAction == 29 && m_blupiActionOuf != 47) - { - m_blupiActionOuf = 47; - m_blupiTimeOuf = 0; - } - } - if (m_blupiAction != 28 && m_blupiAction != 29 && m_blupiFocus) - { - if (m_blupiSpeedX < 0.0 && m_blupiLastSpeedX == 0.0 && !m_blupiAir && m_blupiSpeedY != 0.0) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if (m_blupiSpeedX == 0.0 && m_blupiLastSpeedX < 0.0 && m_blupiSpeedY != 0.0) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if (m_blupiSpeedX > 0.0 && m_blupiLastSpeedX == 0.0 && !m_blupiAir && m_blupiSpeedY != 0.0) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if (m_blupiSpeedX == 0.0 && m_blupiLastSpeedX > 0.0 && m_blupiSpeedY != 0.0) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - } - int num3; - int num4; - if (m_blupiSpeedX < 0.0 && m_blupiFocus) - { - if (m_blupiDir == 2 && m_blupiAction != 3 && m_blupiAction != 59 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && ((!m_blupiJeep && !m_blupiTank && !m_blupiSkate) || Math.Abs(m_blupiVitesse.x) <= 8.0)) - { - if (m_blupiAir) - { - PlaySound(5, tinyPoint3); - m_blupiAction = 59; - m_blupiPhase = 0; - m_blupiDir = 1; - } - else - { - PlaySound(5, tinyPoint3); - m_blupiAction = 3; - m_blupiPhase = 0; - } - } - if (m_blupiDir == 1 && m_blupiAction != 2 && m_blupiAction != 14 && m_blupiAction != 4 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && !m_blupiAir) - { - m_blupiAction = 2; - m_blupiPhase = 0; - } - if (m_blupiDir == 1 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend) - { - if (m_blupiAction == 14) - { - tinyPoint3.x -= CaisseGetMove(5); - } - else - { - num3 = m_blupiPhase; - if (num3 > 3 || m_blupiAir) - { - num3 = 3; - } - num4 = table_vitesse_march[num3]; - if (m_blupiPower) - { - num4 *= 3; - num4 /= 2; - } - tinyPoint3.x += Misc.Speed(m_blupiSpeedX, num4); - } - } - if (m_blupiDir == 2 && m_blupiAction == 29) - { - tinyPoint3.x -= CaisseGetMove(3); - } - } - if (m_blupiSpeedX > 0.0 && m_blupiFocus) - { - if (m_blupiDir == 1 && m_blupiAction != 3 && m_blupiAction != 59 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && ((!m_blupiJeep && !m_blupiTank && !m_blupiSkate) || Math.Abs(m_blupiVitesse.x) <= 8.0)) - { - if (m_blupiAir) - { - PlaySound(5, tinyPoint3); - m_blupiAction = 59; - m_blupiPhase = 0; - m_blupiDir = 2; - } - else - { - PlaySound(5, tinyPoint3); - m_blupiAction = 3; - m_blupiPhase = 0; - } - } - if (m_blupiDir == 2 && m_blupiAction != 2 && m_blupiAction != 14 && m_blupiAction != 4 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && !m_blupiAir) - { - m_blupiAction = 2; - m_blupiPhase = 0; - } - if (m_blupiDir == 2 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 7 && m_blupiAction != 6 && m_blupiAction != 29 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend) - { - if (m_blupiAction == 14) - { - tinyPoint3.x += CaisseGetMove(5); - } - else - { - num3 = m_blupiPhase; - if (num3 > 3 || m_blupiAir) - { - num3 = 3; - } - num4 = table_vitesse_march[num3]; - if (m_blupiPower) - { - num4 *= 3; - num4 /= 2; - } - tinyPoint3.x += Misc.Speed(m_blupiSpeedX, num4); - } - } - if (m_blupiDir == 1 && m_blupiAction == 29) - { - tinyPoint3.x += CaisseGetMove(3); - } - } - if (m_blupiHelico) - { - if (m_blupiAction == 3 && m_blupiPhase == 10) - { - m_blupiAction = 2; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } - } - } - else if (m_blupiOver) - { - if (m_blupiAction == 3 && m_blupiPhase == 7) - { - m_blupiAction = 2; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } - } - } - else if (m_blupiJeep) - { - if (m_blupiAction == 3 && m_blupiPhase == 7) - { - m_blupiAction = 1; - m_blupiPhase = 0; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } - } - } - else if (m_blupiTank) - { - if (m_blupiAction == 3 && m_blupiPhase == 12) - { - m_blupiAction = 1; - m_blupiPhase = 0; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } - } - } - else if (m_blupiSkate) - { - if (m_blupiAction == 3 && m_blupiPhase == 14) - { - m_blupiAction = 1; - m_blupiPhase = 0; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } - } - } - else if (m_blupiNage || m_blupiSurf) - { - if (m_blupiAction == 3 && m_blupiPhase == 10) - { - m_blupiAction = 2; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } - } - } - else if (m_blupiSuspend) - { - if (m_blupiAction == 3 && m_blupiPhase == 10) - { - m_blupiAction = 1; - m_blupiPhase = 0; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } - } - } - else - { - if (m_blupiAction == 3 && m_blupiPhase == 6) - { - m_blupiAction = 1; - m_blupiPhase = 0; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } - } - if (m_blupiAction == 59 && m_blupiPhase == 6) - { - m_blupiAction = 5; - m_blupiPhase = 0; - } - } - if (!m_blupiSuspend && m_blupiAction == 4 && m_blupiPhase == 3) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if (m_blupiSpeedX == 0.0 && m_blupiSpeedY == 0.0 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && m_blupiFocus) - { - if (m_blupiAction == 14 || m_blupiAction == 7) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if (m_blupiAction == 2) - { - if (m_blupiSuspend || m_blupiPhase < 10) - { - m_blupiAction = 1; - } - else - { - m_blupiAction = 60; - } - m_blupiPhase = 0; - } - if (m_blupiAction == 6) - { - m_blupiAction = 1; - m_blupiPhase = 0; - PlaySound(20, tinyPoint3); - } - m_scrollAdd.y = 0; - if (blupiAction == 14) - { - StopSound(38); - } - if (blupiAction == 29 || blupiAction == 28) - { - StopSound(39); - } - } - if (!m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && m_blupiFocus) - { - if (m_blupiAction == 9 && m_blupiDir == 1) - { - tinyPoint3.x += 4; - } - if (m_blupiAction == 9 && m_blupiDir == 2) - { - tinyPoint3.x -= 4; - } - if (m_blupiAction == 10 && m_blupiDir == 1) - { - tinyPoint3.x -= 4; - } - if (m_blupiAction == 10 && m_blupiDir == 2) - { - tinyPoint3.x += 4; - } - } - if ((m_keyPress & -3) == 0 && m_blupiSpeedX == 0.0 && m_blupiSpeedY == 0.0 && (m_blupiJeep || m_blupiTank || m_blupiSkate) && m_blupiFocus) - { - if (m_blupiAction == 10 && m_blupiDir == 1) - { - tinyPoint3.x -= 5; - } - if (m_blupiAction == 10 && m_blupiDir == 2) - { - tinyPoint3.x += 5; - } - } - if ((m_keyPress & -3) == 0 && m_blupiSpeedX == 0.0 && m_blupiSpeedY == 0.0 && m_blupiNage && m_blupiFocus && m_blupiAction == 2) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if ((m_keyPress & -3) == 0 && m_blupiSpeedX == 0.0 && m_blupiSpeedY == 0.0 && m_blupiSurf && m_blupiFocus && m_blupiAction == 2) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if (m_blupiHelico && (m_blupiFocus || m_blupiAction == 58)) - { - if ((m_keyPress & 2) != 0 && m_blupiTimeFire == 0 && m_blupiAction != 3 && m_blupiAction != 58 && flag4) - { - if (m_blupiBullet == 0) - { - PlaySound(53, m_blupiPos); - } - else - { - m_blupiAction = 58; - m_blupiPhase = 0; - m_blupiFocus = false; - } - } - m_blupiMotorHigh = flag4; - if (m_blupiAction != 3 && m_blupiAction != 58) - { - if (flag4) - { - m_blupiAction = 2; - } - else - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiVitesse.y = 0.0; - } - } - if (EasyMove) - { - if (m_blupiSpeedY <= -1.0 || (m_keyPress & 1) != 0) - { - if (m_blupiVitesse.y > -7.0) - { - m_blupiVitesse.y -= 0.5; - } - if (m_blupiVitesse.y == -0.5) - { - m_blupiVitesse.y = -1.0; - } - } - else if (m_blupiSpeedY >= 1.0) - { - if (m_blupiVitesse.y < 8.0) - { - m_blupiVitesse.y += 0.5; - } - } - else - { - if (m_blupiVitesse.y > 1.0) - { - m_blupiVitesse.y -= 1.0; - } - if (m_blupiVitesse.y < 1.0) - { - m_blupiVitesse.y += 1.0; - } - } - tinyPoint3.y += (int)m_blupiVitesse.y; - } - else - { - if (m_blupiSpeedY <= -1.0 || (m_keyPress & 1) != 0) - { - if (m_blupiVitesse.y > -10.0) - { - m_blupiVitesse.y -= 0.5; - } - } - else if (m_blupiSpeedY >= 1.0) - { - if (m_blupiVitesse.y < 12.0) - { - m_blupiVitesse.y += 0.5; - } - } - else - { - if (m_blupiVitesse.y > 1.0) - { - m_blupiVitesse.y -= 1.0; - } - if (m_blupiVitesse.y < 1.0) - { - m_blupiVitesse.y += 1.0; - } - } - tinyPoint3.y += (int)m_blupiVitesse.y; - } - if (EasyMove) - { - if (m_blupiSpeedX <= -1.0) - { - int num5 = (int)(m_blupiSpeedX * 12.0); - if (m_blupiVitesse.x > num5) - { - m_blupiVitesse.x -= 0.5; - } - tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; - tinyPoint.y = tinyPoint3.y; - if (BlupiBloque(tinyPoint, -1)) - { - m_blupiVitesse.x = 0.0; - } - } - else if (m_blupiSpeedX >= 1.0) - { - int num6 = (int)(m_blupiSpeedX * 12.0); - if (m_blupiVitesse.x < num6) - { - m_blupiVitesse.x += 0.5; - } - tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; - tinyPoint.y = tinyPoint3.y; - if (BlupiBloque(tinyPoint, 1)) - { - m_blupiVitesse.x = 0.0; - } - } - else - { - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x -= 2.0; - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x += 2.0; - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - } - tinyPoint3.x += (int)m_blupiVitesse.x; - } - else - { - if (m_blupiSpeedX <= -1.0) - { - int num7 = (int)(m_blupiSpeedX * 16.0); - if (m_blupiVitesse.x > num7) - { - m_blupiVitesse.x -= 1.0; - } - tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; - tinyPoint.y = tinyPoint3.y; - if (BlupiBloque(tinyPoint, -1)) - { - m_blupiVitesse.x = 0.0; - } - } - else if (m_blupiSpeedX >= 1.0) - { - int num8 = (int)(m_blupiSpeedX * 16.0); - if (m_blupiVitesse.x < num8) - { - m_blupiVitesse.x += 1.0; - } - tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; - tinyPoint.y = tinyPoint3.y; - if (BlupiBloque(tinyPoint, 1)) - { - m_blupiVitesse.x = 0.0; - } - } - else - { - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x -= 2.0; - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x += 2.0; - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - } - tinyPoint3.x += (int)m_blupiVitesse.x; - } - MoveObjectPollution(); - if (ButtonPressed == ButtonGlygh.PlayAction && !flag4 && m_blupiTransport == -1) - { - ButtonPressed = Def.ButtonGlygh.None; - rect.left = m_blupiPos.x + 20; - rect.right = m_blupiPos.x + 22; - rect.top = m_blupiPos.y + 60 - 2; - rect.bottom = m_blupiPos.y + 60; - flag2 = !DecorDetect(rect); - rect.left = m_blupiPos.x + 60 - 22; - rect.right = m_blupiPos.x + 60 - 20; - rect.top = m_blupiPos.y + 60 - 2; - rect.bottom = m_blupiPos.y + 60; - flag3 = !DecorDetect(rect); - if (!flag2 && !flag3) - { - tinyPoint.x = m_blupiPos.x; - tinyPoint.y = m_blupiPos.y - BLUPIFLOOR; - ObjectStart(tinyPoint, 13, 0); - m_blupiHelico = false; - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiPosHelico = m_blupiPos; - m_blupiFocus = true; - StopSound(16); - StopSound(18); - PlaySound(17, m_blupiPos); - } - } - } - if (m_blupiOver && (m_blupiFocus || m_blupiAction == 58)) - { - m_blupiMotorHigh = flag4; - if (m_blupiAction != 3) - { - if (flag4) - { - m_blupiAction = 2; - } - else - { - if (m_blupiAction != 1) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - m_blupiVitesse.y = 0.0; - } - } - rect = BlupiRect(tinyPoint3); - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60 + OVERHEIGHT - 1; - bool flag7 = !DecorDetect(rect); - num = MoveAscenseurDetect(m_blupiPos, OVERHEIGHT); - if (num != -1) - { - flag7 = false; - } - if ((m_blupiSpeedY < 0.0 || (m_keyPress & 1) != 0) && !flag7) - { - if (m_blupiVitesse.y == 0.0 && num != -1) - { - m_blupiVitesse.y = -5.0; - } - else if (m_blupiVitesse.y > -5.0) - { - m_blupiVitesse.y -= 1.0; - } - } - else if (m_blupiSpeedY > 0.0) - { - if (m_blupiVitesse.y < 12.0) - { - m_blupiVitesse.y += 5.0; - } - } - else if (m_blupiVitesse.y < 12.0 && m_time % 2 == 0) - { - m_blupiVitesse.y += 1.0; - } - tinyPoint3.y += (int)m_blupiVitesse.y; - if (m_blupiSpeedX < 0.0 && flag4) - { - int num9 = (int)(m_blupiSpeedX * 12.0); - if (m_blupiVitesse.x > num9) - { - m_blupiVitesse.x -= 1.0; - } - tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; - tinyPoint.y = tinyPoint3.y; - if (BlupiBloque(tinyPoint, -1)) - { - m_blupiVitesse.x = 0.0; - } - } - else if (m_blupiSpeedX > 0.0 && flag4) - { - int num10 = (int)(m_blupiSpeedX * 12.0); - if (m_blupiVitesse.x < num10) - { - m_blupiVitesse.x += 1.0; - } - tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; - tinyPoint.y = tinyPoint3.y; - if (BlupiBloque(tinyPoint, 1)) - { - m_blupiVitesse.x = 0.0; - } - } - else - { - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x -= 1.0; - } - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x += 1.0; - } - } - tinyPoint3.x += (int)m_blupiVitesse.x; - MoveObjectPollution(); - if (ButtonPressed == ButtonGlygh.PlayAction && !flag4 && m_blupiTransport == -1) - { - ButtonPressed = Def.ButtonGlygh.None; - rect.left = m_blupiPos.x + 20; - rect.right = m_blupiPos.x + 22; - rect.top = m_blupiPos.y + 60 - 2; - rect.bottom = m_blupiPos.y + 60; - flag2 = !DecorDetect(rect); - rect.left = m_blupiPos.x + 60 - 22; - rect.right = m_blupiPos.x + 60 - 20; - rect.top = m_blupiPos.y + 60 - 2; - rect.bottom = m_blupiPos.y + 60; - flag3 = !DecorDetect(rect); - if (!flag2 && !flag3) - { - tinyPoint.x = m_blupiPos.x; - tinyPoint.y = m_blupiPos.y - BLUPIFLOOR; - ObjectStart(tinyPoint, 46, 0); - m_blupiOver = false; - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiPosHelico = m_blupiPos; - m_blupiFocus = true; - StopSound(16); - StopSound(18); - PlaySound(17, m_blupiPos); - } - } - } - if (m_blupiBalloon && m_blupiFocus) - { - if (m_blupiSpeedY < 0.0 || (m_keyPress & 1) != 0) - { - if (m_blupiVitesse.y > -5.0 && m_time % 6 == 0) - { - m_blupiVitesse.y -= 1.0; - } - } - else if (m_blupiSpeedY > 0.0) - { - if (m_blupiVitesse.y < 0.0 && m_time % 6 == 0) - { - m_blupiVitesse.y += 1.0; - } - } - else if (m_blupiVitesse.y > -3.0 && m_time % 6 == 0) - { - m_blupiVitesse.y -= 1.0; - } - tinyPoint3.y += (int)m_blupiVitesse.y; - if (m_blupiSpeedX < 0.0) - { - int num11 = (int)(m_blupiSpeedX * 10.0); - if (m_blupiVitesse.x > num11) - { - m_blupiVitesse.x -= 1.0; - } - tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; - tinyPoint.y = tinyPoint3.y; - if (BlupiBloque(tinyPoint, -1)) - { - m_blupiVitesse.x = 0.0; - } - } - else if (m_blupiSpeedX > 0.0) - { - int num12 = (int)(m_blupiSpeedX * 10.0); - if (m_blupiVitesse.x < num12) - { - m_blupiVitesse.x += 1.0; - } - tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; - tinyPoint.y = tinyPoint3.y; - if (BlupiBloque(tinyPoint, 1)) - { - m_blupiVitesse.x = 0.0; - } - } - else - { - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x -= 2.0; - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x += 2.0; - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - } - tinyPoint3.x += (int)m_blupiVitesse.x; - } - if (m_blupiEcrase && m_blupiFocus) - { - if (flag4) - { - if (m_blupiVitesse.y < 2.0) - { - m_blupiVitesse.y += 1.0; - } - } - else - { - m_blupiVitesse.y = 0.0; - } - tinyPoint3.y += (int)m_blupiVitesse.y; - if (flag4) - { - num3 = 7; - } - else - { - num3 = 4; - } - num3 = (int)(num3 * m_blupiSpeedX); - if (m_blupiSpeedX < 0.0) - { - if (m_blupiVitesse.x > num3) - { - m_blupiVitesse.x -= 1.0; - } - tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; - tinyPoint.y = tinyPoint3.y; - if (BlupiBloque(tinyPoint, -1)) - { - m_blupiVitesse.x = 0.0; - } - } - else if (m_blupiSpeedX > 0.0) - { - if (m_blupiVitesse.x < num3) - { - m_blupiVitesse.x += 1.0; - } - tinyPoint.x = tinyPoint3.x + (int)m_blupiVitesse.x; - tinyPoint.y = tinyPoint3.y; - if (BlupiBloque(tinyPoint, 1)) - { - m_blupiVitesse.x = 0.0; - } - } - else - { - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x -= 2.0; - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x += 2.0; - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - } - if (m_blupiVitesse.x == 0.0 && !flag4) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - tinyPoint3.x += (int)m_blupiVitesse.x; - } - if (m_blupiJeep && m_blupiFocus) - { - if (m_blupiVitesse.x == 0.0 && m_blupiAction == 2) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - m_blupiMotorHigh = (m_blupiAction != 1); - rect = BlupiRect(tinyPoint3); - rect.right -= 40; - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60 - 1; - bool flag8 = !DecorDetect(rect); - rect.left += 40; - rect.right += 40; - bool flag9 = !DecorDetect(rect); - if (flag4) - { - if (m_blupiVitesse.y < 50.0) - { - m_blupiVitesse.y += 5.0; - } - } - else - { - if (m_blupiVitesse.y != 0.0) - { - PlaySound(3, m_blupiPos); - } - m_blupiVitesse.y = 0.0; - } - tinyPoint3.y += (int)m_blupiVitesse.y; - if (m_blupiTransport == -1) - { - rect.left = tinyPoint3.x + 20; - rect.right = tinyPoint3.x + 60 - 20; - rect.top = tinyPoint3.y + 60 - 35; - rect.bottom = tinyPoint3.y + 60 - 1; - num = AscenseurDetect(rect, m_blupiPos, tinyPoint3); - if (m_blupiVitesse.y >= 0.0 && num != -1) - { - m_blupiTransport = num; - flag4 = false; - PlaySound(3, tinyPoint3); - tinyPoint3.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY; - } - } - if (flag8 && !flag9) - { - int num13 = -20; - if (m_blupiVitesse.x > num13) - { - m_blupiVitesse.x -= 1.0; - } - } - else if (!flag8 && flag9) - { - int num14 = 20; - if (m_blupiVitesse.x < num14) - { - m_blupiVitesse.x += 1.0; - } - } - else if (m_blupiSpeedX < 0.0) - { - int num15 = (int)(m_blupiSpeedX * 20.0); - if (m_blupiVitesse.x > num15) - { - m_blupiVitesse.x -= 1.0; - } - } - else if (m_blupiSpeedX > 0.0) - { - int num16 = (int)(m_blupiSpeedX * 20.0); - if (m_blupiVitesse.x < num16) - { - m_blupiVitesse.x += 1.0; - } - } - else - { - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x -= 2.0; - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x += 2.0; - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - } - if (m_blupiAction == 3) - { - m_blupiVitesse.x = 0.0; - } - tinyPoint3.x += (int)m_blupiVitesse.x; - if (flag8 && !flag9) - { - m_blupiRealRotation = Approch(m_blupiRealRotation, -45, 5); - } - else if (!flag8 && flag9) - { - m_blupiRealRotation = Approch(m_blupiRealRotation, 45, 5); - } - else if (!flag4) - { - m_blupiRealRotation = 0; - } - m_blupiOffsetY = abs(m_blupiRealRotation / 2); - MoveObjectPollution(); - if (ButtonPressed == ButtonGlygh.PlayAction && !flag4 && m_blupiTransport == -1) - { - ButtonPressed = Def.ButtonGlygh.None; - tinyPoint.x = m_blupiPos.x; - tinyPoint.y = m_blupiPos.y - BLUPIFLOOR; - ObjectStart(tinyPoint, 19, 0); - m_blupiJeep = false; - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiPosHelico = m_blupiPos; - StopSound(29); - StopSound(31); - PlaySound(30, m_blupiPos); - } - } - if (m_blupiTank && m_blupiFocus) - { - if (m_blupiAction == 53 && m_blupiPhase == 6) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if ((m_keyPress & 2) != 0 && m_blupiTimeFire == 0 && m_blupiAction != 3) - { - if (m_blupiBullet == 0) - { - PlaySound(53, m_blupiPos); - } - else - { - if (m_blupiDir == 1) - { - tinyPoint.x = m_blupiPos.x - 35; - tinyPoint.y = m_blupiPos.y; - num4 = -5; - m_blupiVitesse.x += 12.0; - } - else - { - tinyPoint.x = m_blupiPos.x + 35; - tinyPoint.y = m_blupiPos.y; - num4 = 5; - m_blupiVitesse.x -= 12.0; - } - if (ObjectStart(tinyPoint, 23, num4) != -1) - { - m_blupiAction = 53; - m_blupiPhase = 0; - PlaySound(52, m_blupiPos); - m_blupiTimeFire = 10; - m_blupiBullet--; - } - } - } - if (m_blupiVitesse.x == 0.0 && m_blupiAction == 2) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - m_blupiMotorHigh = (m_blupiAction != 1); - if (flag4) - { - if (m_blupiVitesse.y < 50.0) - { - m_blupiVitesse.y += 5.0; - } - } - else - { - if (m_blupiVitesse.y != 0.0) - { - PlaySound(3, m_blupiPos); - } - m_blupiVitesse.y = 0.0; - } - tinyPoint3.y += (int)m_blupiVitesse.y; - if (m_blupiTransport == -1) - { - rect.left = tinyPoint3.x + 20; - rect.right = tinyPoint3.x + 60 - 20; - rect.top = tinyPoint3.y + 60 - 35; - rect.bottom = tinyPoint3.y + 60 - 1; - num = AscenseurDetect(rect, m_blupiPos, tinyPoint3); - if (m_blupiVitesse.y >= 0.0 && num != -1) - { - m_blupiTransport = num; - flag4 = false; - PlaySound(3, tinyPoint3); - tinyPoint3.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY; - } - } - if (m_blupiSpeedX < 0.0) - { - int num17 = (int)(m_blupiSpeedX * 12.0); - if (m_blupiVitesse.x > num17) - { - m_blupiVitesse.x -= 1.0; - } - } - else if (m_blupiSpeedX > 0.0) - { - int num18 = (int)(m_blupiSpeedX * 12.0); - if (m_blupiVitesse.x < num18) - { - m_blupiVitesse.x += 1.0; - } - } - else - { - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x -= 3.0; - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x += 3.0; - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - } - if (m_blupiAction == 3) - { - m_blupiVitesse.x = 0.0; - } - tinyPoint3.x += (int)m_blupiVitesse.x; - MoveObjectPollution(); - if (ButtonPressed == ButtonGlygh.PlayAction && !flag4 && m_blupiTransport == -1) - { - ButtonPressed = Def.ButtonGlygh.None; - tinyPoint.x = m_blupiPos.x; - tinyPoint.y = m_blupiPos.y; - ObjectStart(tinyPoint, 28, 0); - m_blupiTank = false; - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiPosHelico = m_blupiPos; - StopSound(29); - StopSound(31); - PlaySound(30, m_blupiPos); - } - } - if (m_blupiSkate && m_blupiFocus) - { - if (m_blupiVitesse.x == 0.0 && m_blupiAction == 2) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if (m_blupiSpeedX < 0.0) - { - int num19 = (int)(m_blupiSpeedX * 15.0); - if (m_blupiVitesse.x > num19) - { - m_blupiVitesse.x -= 1.0; - } - } - else if (m_blupiSpeedX > 0.0) - { - int num20 = (int)(m_blupiSpeedX * 15.0); - if (m_blupiVitesse.x < num20) - { - m_blupiVitesse.x += 1.0; - } - } - else - { - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x -= 1.0; - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x += 1.0; - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - } - if (m_blupiAction == 3) - { - m_blupiVitesse.x = 0.0; - } - tinyPoint3.x += (int)m_blupiVitesse.x; - if (ButtonPressed == Def.ButtonGlygh.PlayAction && !flag4 && !m_blupiAir && m_blupiTransport == -1 && m_blupiVitesse.x < 8.0) - { - ButtonPressed = Def.ButtonGlygh.None; - m_blupiSkate = false; - m_blupiAction = 43; - m_blupiPhase = 0; - m_blupiFocus = false; - m_blupiPosHelico = m_blupiPos; - } - } - if (m_blupiAction == 42) - { - if (m_blupiPhase == 8) - { - num = MoveObjectDetect(m_blupiPos, flag6); - if (num != -1) - { - ObjectDelete(m_moveObject[num]->posCurrent, m_moveObject[num]->type); - } - } - if (m_blupiPhase == 20) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - } - if (m_blupiAction == 43) - { - if (m_blupiPhase == 12) - { - tinyPoint.x = m_blupiPos.x; - tinyPoint.y = m_blupiPos.y - BLUPIFLOOR + 1; - ObjectStart(tinyPoint, 24, 0); - } - if (m_blupiPhase == 20) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - } - if (m_blupiNage && m_blupiFocus) - { - if (m_blupiTransport == -1) - { - if (m_blupiSpeedY < 0.0 || (m_keyPress & 1) != 0) - { - if (m_blupiVitesse.y > -5.0) - { - m_blupiVitesse.y -= 1.0; - } - } - else if (m_blupiSpeedY > 0.0) - { - if (m_blupiVitesse.y < 5.0) - { - m_blupiVitesse.y += 1.0; - } - } - else - { - if (m_blupiAction == 1) - { - num3 = -1; - } - else - { - num3 = 0; - } - if (m_blupiVitesse.y > num3) - { - m_blupiVitesse.y -= 1.0; - } - if (m_blupiVitesse.y < num3) - { - m_blupiVitesse.y += 1.0; - } - } - tinyPoint3.y += (int)m_blupiVitesse.y; - } - if (m_blupiSpeedX < 0.0) - { - int num21 = (int)(m_blupiSpeedX * 8.0); - if (m_blupiVitesse.x > num21) - { - m_blupiVitesse.x -= 1.0; - } - } - else if (m_blupiSpeedX > 0.0) - { - int num22 = (int)(m_blupiSpeedX * 8.0); - if (m_blupiVitesse.x < num22) - { - m_blupiVitesse.x += 1.0; - } - } - else - { - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x -= 2.0; - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x += 2.0; - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - } - num = table_vitesse_nage[m_blupiPhase % 14 / 2]; - tinyPoint3.x += (int)(m_blupiVitesse.x * num / 7.0); - if (m_time % 70 == 0 || m_time % 70 == 28) - { - MoveObjectBlup(tinyPoint3); - } - if (m_time % 5 == 0) - { - if (!m_blupiShield && !m_blupiHide && !m_bSuperBlupi) - { - m_blupiLevel--; - } - if (m_blupiLevel == 25) - { - m_jauges[0].SetMode(1); - } - m_jauges[0].SetLevel(m_blupiLevel); - if (m_blupiLevel == 0) - { - m_blupiAction = 24; - m_blupiPhase = 0; - m_blupiFocus = false; - m_blupiHelico = false; - m_blupiOver = false; - m_blupiJeep = false; - m_blupiTank = false; - m_blupiSkate = false; - m_blupiNage = false; - m_blupiSurf = false; - m_blupiSuspend = false; - m_blupiJumpAie = false; - m_blupiShield = false; - m_blupiPower = false; - m_blupiCloud = false; - m_blupiHide = false; - m_blupiInvert = false; - m_blupiBalloon = false; - m_blupiEcrase = false; - m_blupiAir = false; - m_blupiRestart = true; - m_blupiActionOuf = 0; - m_jauges[0].SetHide(true); - m_jauges[1].SetHide(true); - PlaySound(26, tinyPoint3); - } - } - } - if (m_blupiSurf && m_blupiFocus) - { - if (m_blupiTransport == -1) - { - if (m_blupiSpeedY < 0.0 || (m_keyPress & 1) != 0) - { - if (m_blupiVitesse.y > -5.0) - { - m_blupiVitesse.y -= 1.0; - } - } - else if (m_blupiSpeedY > 0.0) - { - if (m_blupiVitesse.y < 5.0) - { - m_blupiVitesse.y += 1.0; - } - } - else - { - if (m_blupiVitesse.y > -2.0) - { - m_blupiVitesse.y -= 1.0; - } - if (m_blupiVitesse.y < -2.0) - { - m_blupiVitesse.y += 1.0; - } - } - tinyPoint3.y += (int)m_blupiVitesse.y; - tinyPoint3.y += BLUPISURF; - if (tinyPoint3.y % 64 > 30) - { - tinyPoint3.y += 64 - tinyPoint3.y % 64; - } - tinyPoint3.y -= BLUPISURF; - } - if (m_blupiSpeedX < 0.0) - { - int num23 = (int)(m_blupiSpeedX * 8.0); - if (m_blupiVitesse.x > num23) - { - m_blupiVitesse.x -= 1.0; - } - } - else if (m_blupiSpeedX > 0.0) - { - int num24 = (int)(m_blupiSpeedX * 8.0); - if (m_blupiVitesse.x < num24) - { - m_blupiVitesse.x += 1.0; - } - } - else - { - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x -= 2.0; - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - if (m_blupiVitesse.x < 0.0) - { - m_blupiVitesse.x += 2.0; - if (m_blupiVitesse.x > 0.0) - { - m_blupiVitesse.x = 0.0; - } - } - } - num = table_vitesse_surf[m_blupiPhase % 12 / 2]; - tinyPoint3.x += (int)(m_blupiVitesse.x * num / 10.0); - } - POINT tinyPoint4; - if (m_blupiSuspend && m_blupiFocus) - { - if (m_blupiSpeedX < 0.0 && m_blupiAction == 2) - { - int num25 = (int)(m_blupiSpeedX * 5.0); - tinyPoint3.x += num25; - } - if (m_blupiSpeedX > 0.0 && m_blupiAction == 2) - { - int num26 = (int)(m_blupiSpeedX * 5.0); - tinyPoint3.x += num26; - } - num = GetTypeBarre(tinyPoint3); - if (num == 2) - { - tinyPoint4.x = tinyPoint3.x; - tinyPoint4.y = tinyPoint3.y / 64 * 64 + BLUPIOFFY; - rect = BlupiRect(tinyPoint4); - if (!DecorDetect(rect, true)) - { - m_blupiSuspend = false; - m_blupiAction = 1; - m_blupiPhase = 0; - tinyPoint3 = tinyPoint4; - m_blupiPos = tinyPoint3; - } - } - if ((m_blupiSpeedY > 0.0 && m_blupiPhase > 5) || num == 0) - { - m_blupiSuspend = false; - m_blupiAir = true; - m_blupiAction = 5; - tinyPoint3.y = tinyPoint3.y; - m_blupiVitesse.y = 0.0; - m_blupiNoBarre = 5; - m_blupiActionOuf = 65; - m_blupiTimeOuf = 0; - } - if (((m_keyPress & 1) != 0 || m_blupiSpeedY < 0.0) && m_blupiAction != 4 && m_blupiAction != 3) - { - m_blupiAction = 4; - m_blupiPhase = 0; - } - if ((m_keyPress & 1) == 0 && m_blupiSpeedY == 0.0 && m_blupiAction == 4) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if (m_blupiAction == 4 && m_blupiPhase == 10) - { - m_blupiSuspend = false; - m_blupiAir = true; - m_blupiAction = 5; - m_blupiPhase = 0; - tinyPoint3.y -= 2; - m_blupiVitesse.y = -11.0; - m_blupiNoBarre = 5; - PlaySound(35, tinyPoint3); - } - } - if (ButtonPressed == ButtonGlygh.PlayAction && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiTank && !m_blupiJeep && !m_blupiSkate && !flag4 && m_blupiTransport == -1 && m_blupiFocus) - { - if (m_blupiDynamite > 0) - { - ButtonPressed = Def.ButtonGlygh.None; - rect.left = tinyPoint3.x + 18; - rect.right = tinyPoint3.x + 20; - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60; - flag2 = !DecorDetect(rect); - rect.left = tinyPoint3.x + 60 - 20; - rect.right = tinyPoint3.x + 60 - 18; - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60; - flag3 = !DecorDetect(rect); - if (!flag2 && !flag3 && ObjectStart(tinyPoint3, 56, 0) != -1) - { - m_blupiAction = 87; - m_blupiPhase = 0; - m_blupiFocus = false; - PlaySound(61, tinyPoint3); - m_blupiDynamite--; - } - } - else if (m_blupiPerso > 0) - { - ButtonPressed = ButtonGlygh.None; - num = MoveObjectDetect(tinyPoint3, flag6); - if (num == -1 || m_moveObject[num]->type != 200) - { - rect.left = tinyPoint3.x + 18; - rect.right = tinyPoint3.x + 20; - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60; - flag2 = !DecorDetect(rect); - rect.left = tinyPoint3.x + 60 - 20; - rect.right = tinyPoint3.x + 60 - 18; - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60; - flag3 = !DecorDetect(rect); - num = MoveChargeDetect(tinyPoint3); - if (num == -1 && !flag2 && !flag3 && ObjectStart(tinyPoint3, 200, 0) != -1) - { - m_blupiAction = 46; - m_blupiPhase = 0; - m_blupiFocus = false; - PlaySound(61, tinyPoint3); - m_blupiPerso--; - } - } - if (m_blupiFocus) - { - m_blupiAction = 47; - m_blupiPhase = 0; - PlaySound(27, tinyPoint3); - } - } - } - rect = BlupiRect(m_blupiPos); - tinyPoint4 = tinyPoint3; - TestPath(rect, m_blupiPos, ref tinyPoint3); - if (flag && m_blupiPos.x == tinyPoint3.x && m_blupiPos.x != tinyPoint4.x) - { - tinyPoint3.y = tinyPoint4.y; - TestPath(rect, m_blupiPos, ref tinyPoint3); - } - if (m_blupiVent && m_blupiPos.y == tinyPoint3.y && m_blupiPos.y != tinyPoint4.y) - { - tinyPoint3.x = tinyPoint4.x; - TestPath(rect, m_blupiPos, ref tinyPoint3); - } - if (m_blupiTransport != -1 && m_blupiPos.x == tinyPoint3.x && m_blupiPos.x != tinyPoint4.x) - { - tinyPoint3.y = tinyPoint4.y; - TestPath(rect, m_blupiPos, ref tinyPoint3); - } - if (m_blupiHelico || m_blupiOver || m_blupiBalloon || m_blupiEcrase || m_blupiJeep || m_blupiTank || m_blupiSkate || m_blupiNage) - { - if (m_blupiPos.x == tinyPoint3.x && m_blupiPos.x != tinyPoint4.x) - { - tinyPoint3.y = tinyPoint4.y; - TestPath(rect, m_blupiPos, ref tinyPoint3); - } - else if (m_blupiPos.y == tinyPoint3.y && m_blupiPos.y != tinyPoint4.y) - { - tinyPoint3.x = tinyPoint4.x; - TestPath(rect, m_blupiPos, ref tinyPoint3); - } - } - POINT blupiPos = m_blupiPos; - m_blupiPos = tinyPoint3; - if ((m_blupiAction == 1 || m_blupiAction == 60 || m_blupiAction == 7 || m_blupiAction == 6) && !m_blupiAir && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - if (m_blupiTransport != -1) - { - AscenseurVertigo(m_blupiTransport, flag2, flag3); - } - else - { - rect.left = tinyPoint3.x + 24; - rect.right = tinyPoint3.x + 26; - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60; - flag2 = !DecorDetect(rect); - rect.left = tinyPoint3.x + 60 - 26; - rect.right = tinyPoint3.x + 60 - 24; - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60; - flag3 = !DecorDetect(rect); - } - if (m_blupiDir == 1 && flag2 && !flag3) - { - if (m_blupiHelico || m_blupiOver || AscenseurShift(m_blupiTransport)) - { - m_blupiAction = 9; - m_blupiPhase = 0; - } - else - { - PlaySound(6, tinyPoint3); - m_blupiAction = 8; - m_blupiPhase = 0; - } - } - if (m_blupiDir == 2 && !flag2 && flag3) - { - if (m_blupiHelico || m_blupiOver || AscenseurShift(m_blupiTransport)) - { - m_blupiAction = 9; - m_blupiPhase = 0; - } - else - { - PlaySound(6, tinyPoint3); - m_blupiAction = 8; - m_blupiPhase = 0; - } - } - if (m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && (flag2 || flag3)) - { - if (!m_blupiHelico && !m_blupiOver) - { - PlaySound(6, tinyPoint3); - } - m_blupiAction = 10; - m_blupiPhase = 0; - } - } - if (m_blupiAction == 1 && m_blupiJeep && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - if (m_blupiTransport != -1) - { - AscenseurVertigo(m_blupiTransport, flag2, flag3); - } - else - { - rect.left = tinyPoint3.x + 2; - rect.right = tinyPoint3.x + 18; - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60; - flag2 = !DecorDetect(rect); - rect.left = tinyPoint3.x + 60 - 18; - rect.right = tinyPoint3.x + 60 - 2; - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60; - flag3 = !DecorDetect(rect); - } - if (flag2 && !flag3) - { - m_blupiAction = 10; - m_blupiPhase = 0; - } - if (flag3 && !flag2) - { - m_blupiAction = 10; - m_blupiPhase = 0; - } - } - if (m_blupiAction == 1 && m_blupiTank && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - if (m_blupiTransport != -1) - { - AscenseurVertigo(m_blupiTransport, flag2, flag3); - } - else - { - rect.left = tinyPoint3.x + 2; - rect.right = tinyPoint3.x + 18; - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60; - flag2 = !DecorDetect(rect); - rect.left = tinyPoint3.x + 60 - 18; - rect.right = tinyPoint3.x + 60 - 2; - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60; - flag3 = !DecorDetect(rect); - } - if (flag2 && !flag3) - { - m_blupiAction = 10; - m_blupiPhase = 0; - } - if (flag3 && !flag2) - { - m_blupiAction = 10; - m_blupiPhase = 0; - } - } - if (m_blupiAction == 1 && m_blupiSkate && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - if (m_blupiTransport != -1) - { - AscenseurVertigo(m_blupiTransport, flag2, flag3); - } - else - { - rect.left = tinyPoint3.x + 12; - rect.right = tinyPoint3.x + 19; - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60; - flag2 = !DecorDetect(rect); - rect.left = tinyPoint3.x + 60 - 19; - rect.right = tinyPoint3.x + 60 - 12; - rect.top = tinyPoint3.y + 60 - 2; - rect.bottom = tinyPoint3.y + 60; - flag3 = !DecorDetect(rect); - } - if (flag2 && !flag3) - { - m_blupiAction = 10; - m_blupiPhase = 0; - } - if (flag3 && !flag2) - { - m_blupiAction = 10; - m_blupiPhase = 0; - } - } - if (m_blupiFocus) - { - if (m_blupiAction == 8 && m_blupiPhase == 16) - { - m_blupiAction = 9; - m_blupiPhase = 0; - } - if (m_blupiAction == 9 && m_blupiPhase == 3) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiActionOuf = 0; - } - num3 = 5; - if (m_blupiJeep) - { - num3 = 10; - } - if (m_blupiTank) - { - num3 = 10; - } - if (m_blupiSkate) - { - num3 = 10; - } - if (m_blupiAction == 10 && m_blupiPhase == num3) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - } - BlupiSearchIcon(); - if (m_blupiShield) - { - if (m_blupiTimeShield == 10) - { - PlaySound(43, m_blupiPos); - } - if (m_blupiTimeShield == 0) - { - m_blupiShield = false; - m_jauges[1].SetHide(true); - } - else if (m_time % 5 == 0) - { - m_blupiTimeShield--; - m_jauges[1].SetLevel(m_blupiTimeShield); - } - } - if (m_blupiPower) - { - if (m_blupiTimeShield == 20) - { - PlaySound(45, m_blupiPos); - } - if (m_blupiTimeShield == 0) - { - m_blupiPower = false; - m_jauges[1].SetHide(true); - } - else if (m_time % 3 == 0) - { - m_blupiTimeShield--; - m_jauges[1].SetLevel(m_blupiTimeShield); - } - } - if (m_blupiCloud) - { - if (m_blupiTimeShield == 25) - { - PlaySound(56, m_blupiPos); - } - if (m_blupiTimeShield == 0) - { - m_blupiCloud = false; - m_jauges[1].SetHide(true); - } - else if (m_time % 4 == 0) - { - m_blupiTimeShield--; - m_jauges[1].SetLevel(m_blupiTimeShield); - } - } - if (m_blupiHide) - { - if (m_blupiTimeShield == 20) - { - PlaySound(63, m_blupiPos); - } - if (m_blupiTimeShield == 0) - { - m_blupiHide = false; - m_jauges[1].SetHide(true); - } - else if (m_time % 4 == 0) - { - m_blupiTimeShield--; - m_jauges[1].SetLevel(m_blupiTimeShield); - } - } - if (m_blupiInvert) - { - if (m_blupiTimeShield == 0) - { - m_blupiInvert = false; - m_jauges[1].SetHide(true); - tinyPoint.x = m_blupiPos.x; - tinyPoint.y = m_blupiPos.y + 100; - ObjectStart(tinyPoint, 42, -60); - tinyPoint.x = m_blupiPos.x; - tinyPoint.y = m_blupiPos.y - 100; - ObjectStart(tinyPoint, 42, 60); - tinyPoint.x = m_blupiPos.x - 100; - tinyPoint.y = m_blupiPos.y; - ObjectStart(tinyPoint, 42, 10); - tinyPoint.x = m_blupiPos.x + 100; - tinyPoint.y = m_blupiPos.y; - ObjectStart(tinyPoint, 42, -10); - PlaySound(67, tinyPoint3); - } - else if (m_time % 3 == 0) - { - m_blupiTimeShield--; - m_jauges[1].SetLevel(m_blupiTimeShield); - } - } - if (m_blupiBalloon) - { - if (m_blupiTimeShield == 0) - { - m_blupiBalloon = false; - m_jauges[1].SetHide(true); - tinyPoint.x = m_blupiPos.x - 34; - tinyPoint.y = m_blupiPos.y - 34; - ObjectStart(tinyPoint, 91, 0); - PlaySound(41, m_blupiPos); - } - else if (m_time % 2 == 0) - { - m_blupiTimeShield--; - m_jauges[1].SetLevel(m_blupiTimeShield); - } - } - if (m_blupiEcrase) - { - if (m_blupiTimeShield == 0) - { - m_blupiEcrase = false; - m_blupiAir = true; - m_jauges[1].SetHide(true); - ObjectStart(m_blupiPos, 41, -60); - ObjectStart(m_blupiPos, 41, 60); - ObjectStart(m_blupiPos, 41, 10); - ObjectStart(m_blupiPos, 41, -10); - tinyPoint.x = m_blupiPos.x - 34; - tinyPoint.y = m_blupiPos.y - 34; - ObjectStart(tinyPoint, 90, 0); - PlaySound(41, m_blupiPos); - } - else if (m_time % 2 == 0) - { - m_blupiTimeShield--; - m_jauges[1].SetLevel(m_blupiTimeShield); - } - } - if (m_blupiPower && abs(m_blupiPos.x - m_blupiPosMagic.x) + abs(m_blupiPos.y - m_blupiPosMagic.y) >= 40) - { - num = MoveObjectFree(); - if (num != -1) - { - m_moveObject[num]->type = 27; - m_moveObject[num]->phase = 0; - m_moveObject[num]->posCurrent = m_blupiPos; - m_moveObject[num]->posStart = m_moveObject[num]->posCurrent; - m_moveObject[num]->posEnd = m_moveObject[num]->posCurrent; - m_moveObject[num]->step = 1; - m_moveObject[num]->time = 0; - MoveObjectStepIcon(num); - m_blupiPosMagic = m_blupiPos; - } - } - if (m_blupiShield && abs(m_blupiPos.x - m_blupiPosMagic.x) + abs(m_blupiPos.y - m_blupiPosMagic.y) >= 40) - { - num = MoveObjectFree(); - if (num != -1) - { - m_moveObject[num]->type = 57; - m_moveObject[num]->phase = 0; - m_moveObject[num]->posCurrent = m_blupiPos; - m_moveObject[num]->posStart = m_moveObject[num]->posCurrent; - m_moveObject[num]->posEnd = m_moveObject[num]->posCurrent; - m_moveObject[num]->step = 1; - m_moveObject[num]->time = 0; - MoveObjectStepIcon(num); - m_blupiPosMagic = m_blupiPos; - } - } - if (m_blupiHide && abs(m_blupiPos.x - m_blupiPosMagic.x) + abs(m_blupiPos.y - m_blupiPosMagic.y) >= 10) - { - num = MoveObjectFree(); - if (num != -1) - { - m_moveObject[num]->type = 58; - m_moveObject[num]->icon = m_blupiIcon; - m_moveObject[num]->channel = 2; - m_moveObject[num]->phase = 0; - m_moveObject[num]->posCurrent = m_blupiPos; - m_moveObject[num]->posStart = m_moveObject[num]->posCurrent; - m_moveObject[num]->posEnd = m_moveObject[num]->posCurrent; - m_moveObject[num]->step = 1; - m_moveObject[num]->time = 0; - MoveObjectStepIcon(num); - m_blupiPosMagic = m_blupiPos; - } - } - if (m_blupiTimeNoAsc > 0) - { - m_blupiTimeNoAsc--; - } - if (m_blupiHelico && m_blupiPos.y > 2 && m_blupiFocus && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) - { - rect = BlupiRect(tinyPoint3); - rect.top = tinyPoint3.y + 4; - rect.bottom = tinyPoint3.y + 20; - if (DecorDetect(rect)) - { - ByeByeHelico(); - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiHelico = false; - tinyPoint.x = m_blupiPos.x - 34; - tinyPoint.y = m_blupiPos.y - 34; - ObjectStart(tinyPoint, 9, 0); - m_decorAction = 1; - m_decorPhase = 0; - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - PlaySound(10, m_blupiPos); - } - } - if (!m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus) - { - if (!m_blupiNage && !m_blupiSurf && IsSurfWater(m_blupiPos)) - { - m_scrollAdd.x = 0; - m_scrollAdd.y = 0; - m_blupiAir = false; - m_blupiNage = false; - m_blupiSurf = true; - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiVitesse.x = 0.0; - m_blupiVitesse.y = 0.0; - MoveObjectPlouf(m_blupiPos); - if (m_blupiTransport != -1) - { - m_blupiPos.y = m_blupiPos.y - 10; - m_blupiTransport = -1; - } - if (m_blupiCloud) - { - m_blupiCloud = false; - m_jauges[1].SetHide(true); - } - } - if (!m_blupiNage && !IsSurfWater(m_blupiPos) && IsDeepWater(m_blupiPos)) - { - if (!m_blupiSurf) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiVitesse.x = 0.0; - m_blupiVitesse.y = 0.0; - MoveObjectPlouf(m_blupiPos); - } - m_blupiAir = false; - m_blupiSurf = false; - m_blupiNage = true; - m_blupiLevel = 100; - m_jauges[0].SetLevel(m_blupiLevel); - m_jauges[0].SetMode(2); - m_jauges[0].SetHide(false); - } - if (m_blupiNage && IsSurfWater(m_blupiPos)) - { - m_blupiAir = false; - m_blupiNage = false; - m_blupiSurf = true; - PlaySound(25, m_blupiPos); - m_jauges[0].SetHide(true); - } - tinyPoint4.x = m_blupiPos.x; - tinyPoint4.y = m_blupiPos.y - 60; - if ((m_blupiSurf || m_blupiNage) && (m_blupiPos.y % 64 == 64 - BLUPISURF || m_blupiPos.y % 64 == 32) && IsOutWater(tinyPoint4) && (m_keyPress & 1) != 0) - { - m_blupiNage = false; - m_blupiSurf = false; - m_blupiAir = true; - m_blupiAction = 5; - m_blupiPhase = 0; - m_blupiVitesse.x = 0.0; - if (m_blupiPower) - { - m_blupiVitesse.y = -16.0; - } - else - { - m_blupiVitesse.y = -12.0; - } - MoveObjectTiplouf(m_blupiPos); - PlaySound(22, m_blupiPos); - m_jauges[0].SetHide(true); - } - if ((m_blupiSurf || m_blupiNage) && IsOutWater(m_blupiPos)) - { - if (m_blupiVitesse.y < 0.0) - { - if (m_blupiTransport == -1) - { - m_blupiPos = blupiPos; - } - else - { - m_blupiTransport = -1; - m_blupiNage = false; - m_blupiSurf = false; - m_blupiAir = true; - m_blupiAction = 5; - m_blupiPhase = 0; - m_blupiPos.y = m_blupiPos.y - 10; - m_blupiVitesse.x = 0.0; - m_blupiVitesse.y = -10.0; - PlaySound(22, m_blupiPos); - m_jauges[0].SetHide(true); - } - } - else if (m_blupiVitesse.y > 0.0) - { - m_blupiNage = false; - m_blupiSurf = false; - m_blupiAir = false; - m_blupiAction = 5; - m_blupiPhase = 0; - m_blupiPos.y = m_blupiPos.y + 30; - m_blupiVitesse.x = 0.0; - m_blupiVitesse.y = 0.0; - PlaySound(22, m_blupiPos); - m_jauges[0].SetHide(true); - } - else - { - m_blupiNage = false; - m_blupiSurf = false; - m_blupiAir = false; - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiPos.y = m_blupiPos.y - 10; - m_blupiVitesse.x = 0.0; - m_blupiVitesse.y = 0.0; - PlaySound(22, m_blupiPos); - m_jauges[0].SetHide(true); - } - } - if ((m_blupiSurf || m_blupiNage) && m_blupiActionOuf != 44) - { - m_blupiActionOuf = 44; - m_blupiTimeOuf = 0; - } - } - if ((m_blupiHelico || m_blupiOver || m_blupiJeep || m_blupiTank || m_blupiSkate) && m_blupiFocus && (IsSurfWater(m_blupiPos) || IsDeepWater(m_blupiPos))) - { - ByeByeHelico(); - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiHelico = false; - m_blupiOver = false; - m_blupiJeep = false; - m_blupiTank = false; - m_blupiSkate = false; - tinyPoint.x = m_blupiPos.x - 34; - tinyPoint.y = m_blupiPos.y - 34; - ObjectStart(tinyPoint, 9, 0); - m_decorAction = 1; - m_decorPhase = 0; - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - PlaySound(10, m_blupiPos); - } - if (m_blupiFocus && !m_blupiSuspend && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && m_blupiNoBarre == 0 && GetTypeBarre(m_blupiPos) == 1) - { - tinyPoint4.x = m_blupiPos.x; - tinyPoint4.y = (m_blupiPos.y + 22) / 64 * 64 + BLUPISUSPEND; - rect = BlupiRect(tinyPoint4); - if (!DecorDetect(rect, true)) - { - m_blupiPos = tinyPoint4; - m_blupiSuspend = true; - m_blupiAir = false; - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiActionOuf = 0; - PlaySound(34, m_blupiPos); - } - } - if (m_blupiNoBarre > 0) - { - m_blupiNoBarre--; - } - if (IsVentillo(m_blupiPos)) - { - if (m_blupiFocus && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) - { - BlupiDead(11, 75); - } - tinyPoint.x = m_blupiPos.x - 34; - tinyPoint.y = m_blupiPos.y - 34; - ObjectStart(tinyPoint, 11, 0); - m_decorAction = 2; - m_decorPhase = 0; - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - PlaySound(10, m_blupiPos); - } - if (m_blupiAction != 30 && m_blupiFocus) - { - num = IsWorld(m_blupiPos); - if (num != -1) - { - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - PlaySound(32, m_blupiPos); - m_blupiAction = 30; - m_blupiPhase = 0; - m_blupiFocus = false; - m_blupiFront = true; - } - } - int num27 = MoveObjectDetect(m_blupiPos, flag6); - POINT tinyPoint5; - if (m_blupiAction != 11 && m_blupiAction != 75 && m_blupiAction != 76 && m_blupiAction != 77 && m_blupiAction != 78 && m_blupiAction != 79 && m_blupiAction != 80 && m_blupiAction != 81) - { - if (IsLave(m_blupiPos) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) - { - BlupiDead(76, -1); - m_blupiRestart = true; - m_blupiPos.y = m_blupiPos.y / 64 * 64 + BLUPIOFFY; - PlaySound(8, m_blupiPos); - } - if (IsPiege(m_blupiPos) && !m_blupiOver && !m_blupiJeep && !m_blupiTank && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus) - { - BlupiDead(54, -1); - m_blupiRestart = true; - m_blupiAir = true; - ObjectStart(m_blupiPos, 53, 0); - PlaySound(51, m_blupiPos); - } - if (IsGoutte(m_blupiPos, false) && !m_blupiOver && !m_blupiJeep && !m_blupiTank && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus) - { - BlupiDead(54, -1); - m_blupiRestart = true; - m_blupiAir = true; - PlaySound(51, m_blupiPos); - } - if (IsScie(m_blupiPos) && !m_blupiOver && !m_blupiJeep && !m_blupiTank && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus) - { - BlupiDead(77, -1); - m_blupiFront = true; - m_blupiRestart = true; - m_blupiAir = true; - } - if (ButtonPressed == ButtonGlygh.PlayAction && (num27 == -1 || !flag6) && IsSwitch(m_blupiPos, tinyPoint) && !m_blupiOver && !m_blupiBalloon && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus) - { - ButtonPressed = Def.ButtonGlygh.None; - ActiveSwitch(m_decor[tinyPoint.x, tinyPoint.y].icon == 385, tinyPoint); - m_blupiAction = 82; - m_blupiPhase = 0; - m_blupiFocus = false; - m_blupiVitesse.x = 0.0; - m_blupiVitesse.y = 0.0; - } - if (IsBlitz(m_blupiPos, false) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) - { - BlupiDead(11, -1); - m_blupiRestart = true; - m_blupiAir = true; - m_blupiPos.y = m_blupiPos.y / 64 * 64 + BLUPIOFFY; - PlaySound(8, m_blupiPos); - } - if (IsEcraseur(m_blupiPos) && !m_blupiEcrase && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiVitesse.x = 0.0; - m_blupiVitesse.y = 0.0; - m_blupiEcrase = true; - m_blupiBalloon = false; - m_blupiAir = false; - m_blupiHelico = false; - m_blupiOver = false; - m_blupiJeep = false; - m_blupiTank = false; - m_blupiSkate = false; - m_blupiNage = false; - m_blupiSurf = false; - m_blupiSuspend = false; - m_blupiJumpAie = false; - m_blupiShield = false; - m_blupiPower = false; - m_blupiCloud = false; - m_blupiHide = false; - m_blupiTimeShield = 100; - m_blupiPosMagic = m_blupiPos; - m_jauges[1].SetHide(false); - if (!m_blupiJeep && !m_blupiTank) - { - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - } - PlaySound(70, m_blupiPos); - ObjectStart(m_blupiPos, 41, -60); - ObjectStart(m_blupiPos, 41, 60); - ObjectStart(m_blupiPos, 41, 10); - ObjectStart(m_blupiPos, 41, -10); - tinyPoint.x = m_blupiPos.x - 34; - tinyPoint.y = m_blupiPos.y - 34; - ObjectStart(tinyPoint, 90, 0); - m_decorAction = 2; - m_decorPhase = 0; - } - if (IsTeleporte(m_blupiPos) != -1 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiAir && m_blupiFocus && m_blupiPosHelico.x == -1) - { - m_blupiAction = 74; - m_blupiPhase = 0; - m_blupiVitesse.x = 0.0; - m_blupiVitesse.y = 0.0; - m_blupiFocus = false; - m_blupiPos.x = m_blupiPos.x / 64 * 64; - PlaySound(71, m_blupiPos); - tinyPoint.x = m_blupiPos.x; - tinyPoint.y = m_blupiPos.y - 5; - ObjectStart(tinyPoint, 92, 0); - } - if (IsBridge(m_blupiPos, tinyPoint2) && m_blupiFocus) - { - tinyPoint2.x *= 64; - tinyPoint2.y *= 64; - ObjectStart(tinyPoint2, 52, 0); - } - int num2 = IsDoor(m_blupiPos, tinyPoint2); - if (num2 != -1 && (m_blupiCle & 1 << num2 - 334) != 0) - { - OpenDoor(tinyPoint2); - m_blupiCle &= ~(1 << num2 - 334); - tinyPoint.x = 520; - tinyPoint.y = 418; - tinyPoint5.x = tinyPoint2.x * 64 - m_posDecor.x; - tinyPoint5.y = tinyPoint2.y * 64 - m_posDecor.y; - VoyageInit(tinyPoint, m_pPixmap->HotSpotToHud(tinyPoint5), 214 + (num2 - 334) * 7, 10); - } - } - if (!m_blupiHelico && !m_blupiSuspend && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiSkate && !m_blupiJeep && !m_blupiTank && !m_blupiJeep && m_blupiFocus) - { - num = MockeryDetect(m_blupiPos); - if (num != 0) - { - m_blupiActionOuf = num; - m_blupiTimeOuf = 0; - } - } - MoveObjectFollow(m_blupiPos); - num = num27; - if (num != -1 && !flag6 && m_moveObject[num]->type == 2 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && !m_blupiShield && !m_bSuperBlupi && m_blupiFocus) - { - m_blupiActionOuf = 48; - m_blupiTimeOuf = 0; - } - if (num != -1 && flag6) - { - if (m_moveObject[num]->type == 13 && (ButtonPressed == ButtonGlygh.PlayAction || IsFloatingObject(num)) && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - ButtonPressed = Def.ButtonGlygh.None; - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - m_scrollAdd.x = 0; - m_scrollAdd.y = 0; - m_blupiAir = false; - m_blupiHelico = true; - m_blupiRealRotation = 0; - m_blupiVitesse.x = 0.0; - if (m_blupiCloud || m_blupiHide) - { - m_blupiCloud = false; - m_blupiHide = false; - m_jauges[1].SetHide(true); - } - } - if (ButtonPressed == ButtonGlygh.PlayAction && m_moveObject[num]->type == 46 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - ButtonPressed = Def.ButtonGlygh.None; - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - m_scrollAdd.x = 0; - m_scrollAdd.y = 0; - m_blupiAir = false; - m_blupiOver = true; - m_blupiVitesse.x = 0.0; - if (m_blupiCloud || m_blupiHide) - { - m_blupiCloud = false; - m_blupiHide = false; - m_jauges[1].SetHide(true); - } - } - if (ButtonPressed == ButtonGlygh.PlayAction && m_moveObject[num]->type == 19 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - ButtonPressed = Def.ButtonGlygh.None; - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - m_scrollAdd.x = 0; - m_scrollAdd.y = 0; - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiAir = false; - m_blupiJeep = true; - m_blupiVitesse.x = 0.0; - if (m_blupiCloud || m_blupiHide) - { - m_blupiCloud = false; - m_blupiHide = false; - m_jauges[1].SetHide(true); - } - } - if (ButtonPressed == ButtonGlygh.PlayAction && m_moveObject[num]->type == 28 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - ButtonPressed = Def.ButtonGlygh.None; - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - m_scrollAdd.x = 0; - m_scrollAdd.y = 0; - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiAir = false; - m_blupiTank = true; - m_blupiVitesse.x = 0.0; - if (m_blupiCloud || m_blupiHide) - { - m_blupiCloud = false; - m_blupiHide = false; - m_jauges[1].SetHide(true); - } - } - if (m_moveObject[num]->type == 29 && m_blupiFocus && m_blupiBullet < 10) - { - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; - tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; - tinyPoint5.x = 570; - tinyPoint5.y = 430; - VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), tinyPoint5, 177, 10); - m_blupiBullet += 10; - if (m_blupiBullet > 10) - { - m_blupiBullet = 10; - } - } - if (ButtonPressed == Def.ButtonGlygh.PlayAction && m_moveObject[num].type == 24 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) - { - ButtonPressed = Def.ButtonGlygh.None; - m_scrollAdd.x = 0; - m_scrollAdd.y = 0; - m_blupiAction = 42; - m_blupiPhase = 0; - m_blupiPos.y = m_moveObject[num].posCurrent.y / 64 * 64 + BLUPIOFFY; - m_blupiFocus = false; - m_blupiAir = false; - m_blupiSkate = true; - m_blupiVitesse.x = 0.0; - if (m_blupiCloud || m_blupiHide) - { - m_blupiCloud = false; - m_blupiHide = false; - m_jauges[1].SetHide(true); - } - } - if ((m_moveObject[num].type == 3 || m_moveObject[num].type == 16 || m_moveObject[num].type == 96 || m_moveObject[num].type == 97) && m_blupiBalloon && m_blupiPosHelico.x == -1) - { - m_blupiBalloon = false; - m_blupiAir = true; - m_blupiTimeShield = 0; - m_jauges[1].SetHide(true); - m_decorAction = 0; - tinyPoint.x = m_blupiPos.x - 34; - tinyPoint.y = m_blupiPos.y - 34; - ObjectStart(tinyPoint, 91, 0); - PlaySound(41, m_blupiPos); - m_blupiPos.y = m_blupiPos.y + 4; - m_blupiVitesse.y = 0.0; - m_blupiPosHelico = m_blupiPos; - } - else if ((m_moveObject[num].type == 2 || m_moveObject[num].type == 3 || m_moveObject[num].type == 96 || m_moveObject[num].type == 97 || m_moveObject[num].type == 16 || m_moveObject[num].type == 4 || m_moveObject[num].type == 17 || m_moveObject[num].type == 20) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiPosHelico.x == -1) - { - if (!m_blupiJeep && !m_blupiTank && !m_blupiSkate && (m_blupiFocus || m_blupiAction == 5 || m_blupiAction == 36)) - { - if (m_blupiHelico || m_blupiOver || m_blupiBalloon || m_blupiEcrase) - { - m_blupiAir = true; - } - BlupiDead(11, 75); - } - if (m_moveObject[num].type == 17 || m_moveObject[num].type == 20) - { - tinyPoint = m_moveObject[num].posCurrent; - ObjectDelete(tinyPoint, m_moveObject[num].type); - tinyPoint.x -= 34; - tinyPoint.y -= 34; - ObjectStart(tinyPoint, 10, 0); - m_decorAction = 2; - m_decorPhase = 0; - } - else - { - tinyPoint = m_moveObject[num].posCurrent; - ObjectDelete(tinyPoint, m_moveObject[num].type); - tinyPoint.x -= 34; - tinyPoint.y -= 34; - ObjectStart(tinyPoint, 8, 0); - m_decorAction = 1; - m_decorPhase = 0; - } - if (!m_blupiJeep && !m_blupiTank) - { - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - } - PlaySound(10, m_moveObject[num].posCurrent); - } - if (m_moveObject[num].type == 44 && m_blupiFocus && !m_blupiBalloon && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) - { - ByeByeHelico(); - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiVitesse.x = 0.0; - m_blupiVitesse.y = 0.0; - m_blupiBalloon = true; - m_blupiEcrase = false; - m_blupiAir = false; - m_blupiHelico = false; - m_blupiOver = false; - m_blupiJeep = false; - m_blupiTank = false; - m_blupiSkate = false; - m_blupiNage = false; - m_blupiSurf = false; - m_blupiSuspend = false; - m_blupiJumpAie = false; - m_blupiShield = false; - m_blupiPower = false; - m_blupiCloud = false; - m_blupiHide = false; - m_blupiTimeShield = 100; - m_blupiPosMagic = m_blupiPos; - m_jauges[1].SetHide(false); - if (!m_blupiJeep && !m_blupiTank) - { - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - } - PlaySound(40, m_moveObject[num].posCurrent); - tinyPoint.x = m_blupiPos.x - 34; - tinyPoint.y = m_blupiPos.y - 34; - ObjectStart(tinyPoint, 90, 0); - m_decorAction = 5; - m_decorPhase = 0; - } - if (m_moveObject[num].type == 54 && m_moveObject[num].step != 2 && m_moveObject[num].step != 4 && m_blupiFocus && !m_blupiBalloon && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) - { - ByeByeHelico(); - tinyPoint.x = m_blupiPos.x; - tinyPoint.y = (m_blupiPos.y + 64 - 10) / 64 * 64 + 4; - ObjectStart(tinyPoint, 53, 0); - m_blupiAction = 54; - m_blupiPhase = 0; - m_blupiSuspend = false; - m_blupiJumpAie = false; - m_blupiFocus = false; - m_blupiRestart = true; - if (flag4) - { - m_blupiAir = true; - } - if (m_blupiHelico || m_blupiOver || m_blupiBalloon || m_blupiEcrase || m_blupiJeep || m_blupiTank || m_blupiSkate) - { - m_blupiHelico = false; - m_blupiOver = false; - m_blupiBalloon = false; - m_blupiEcrase = false; - m_blupiJeep = false; - m_blupiTank = false; - m_blupiSkate = false; - tinyPoint = m_moveObject[num].posCurrent; - tinyPoint.x -= 34; - tinyPoint.y -= 34; - ObjectStart(tinyPoint, 10, 0); - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - PlaySound(10, m_moveObject[num].posCurrent); - m_decorAction = 1; - m_decorPhase = 0; - } - else - { - PlaySound(51, m_moveObject[num].posCurrent); - } - m_blupiCloud = false; - m_blupiHide = false; - m_jauges[1].SetHide(true); - } - if (m_moveObject[num].type == 23 && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiAction != 13 && m_blupiAction != 30 && m_blupiAction != 11 && m_blupiAction != 75 && m_blupiAction != 76 && m_blupiAction != 77 && m_blupiAction != 78 && m_blupiAction != 79 && m_blupiAction != 80 && m_blupiAction != 81 && m_blupiAction != 54 && m_blupiAction != 57 && m_blupiAction != 35) - { - ByeByeHelico(); - tinyPoint = m_moveObject[num].posCurrent; - ObjectDelete(tinyPoint, m_moveObject[num].type); - m_blupiAction = 54; - m_blupiPhase = 0; - m_blupiSuspend = false; - m_blupiJumpAie = false; - m_blupiFocus = false; - m_blupiRestart = true; - if (flag4) - { - m_blupiAir = true; - } - if (m_blupiHelico || m_blupiOver || m_blupiBalloon || m_blupiEcrase || m_blupiJeep || m_blupiTank || m_blupiSkate) - { - m_blupiHelico = false; - m_blupiOver = false; - m_blupiBalloon = false; - m_blupiEcrase = false; - m_blupiJeep = false; - m_blupiTank = false; - m_blupiSkate = false; - } - StartSploutchGlu(m_moveObject[num].posCurrent); - m_blupiCloud = false; - m_blupiHide = false; - m_jauges[1].SetHide(true); - } - if (m_moveObject[num].type == 5) - { - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; - tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; - TinyPoint end; - end.x = 430; - end.y = 430; - VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end, 6, 10); - ObjectStart(m_moveObject[num].posCurrent, 39, -60); - ObjectStart(m_moveObject[num].posCurrent, 39, 60); - ObjectStart(m_moveObject[num].posCurrent, 39, 10); - ObjectStart(m_moveObject[num].posCurrent, 39, -10); - } - if (m_moveObject[num].type == 49 && (m_voyageIcon != 215 || m_voyageChannel != 10) && (m_blupiCle & 1) == 0) - { - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; - tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; - TinyPoint end2; - end2.x = 520; - end2.y = 418; - VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end2, 215, 10); - ObjectStart(m_moveObject[num].posCurrent, 39, -60); - ObjectStart(m_moveObject[num].posCurrent, 39, 60); - ObjectStart(m_moveObject[num].posCurrent, 39, 10); - ObjectStart(m_moveObject[num].posCurrent, 39, -10); - } - if (m_moveObject[num].type == 50 && (m_voyageIcon != 222 || m_voyageChannel != 10) && (m_blupiCle & 2) == 0) - { - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; - tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; - TinyPoint end3; - end3.x = 530; - end3.y = 418; - VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end3, 222, 10); - ObjectStart(m_moveObject[num].posCurrent, 39, -60); - ObjectStart(m_moveObject[num].posCurrent, 39, 60); - ObjectStart(m_moveObject[num].posCurrent, 39, 10); - ObjectStart(m_moveObject[num].posCurrent, 39, -10); - } - if (m_moveObject[num].type == 51 && (m_voyageIcon != 229 || m_voyageChannel != 10) && (m_blupiCle & 4) == 0) - { - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; - tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; - TinyPoint end4; - end4.x = 540; - end4.y = 418; - VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), end4, 229, 10); - ObjectStart(m_moveObject[num].posCurrent, 39, -60); - ObjectStart(m_moveObject[num].posCurrent, 39, 60); - ObjectStart(m_moveObject[num].posCurrent, 39, 10); - ObjectStart(m_moveObject[num].posCurrent, 39, -10); - } - if (m_moveObject[num].type == 6 && m_nbVies < 10 && m_blupiFocus) - { - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; - tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; - VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), VoyageGetPosVie(m_nbVies + 1), 21, 10); - } - if (m_moveObject[num].type == 25 && !m_blupiShield && !m_blupiHide && !m_blupiPower && m_blupiFocus) - { - PlaySound(42, m_moveObject[num].posCurrent); - m_blupiShield = true; - m_blupiPower = false; - m_blupiCloud = false; - m_blupiHide = false; - m_blupiTimeShield = 100; - m_blupiPosMagic = m_blupiPos; - m_jauges[1].SetHide(false); - } - if (ButtonPressed == Def.ButtonGlygh.PlayAction && m_moveObject[num].type == 26 && !m_blupiShield && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus) - { - ButtonPressed = Def.ButtonGlygh.None; - m_sucettePos = m_moveObject[num].posCurrent; - m_sucetteType = m_moveObject[num].type; - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - m_blupiAction = 49; - m_blupiPhase = 0; - m_blupiCloud = false; - m_blupiHide = false; - m_blupiFocus = false; - PlaySound(50, tinyPoint3); - } - if (m_moveObject[num].type == 40 && !m_blupiHide && m_blupiFocus) - { - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - m_blupiInvert = true; - m_blupiTimeShield = 100; - m_blupiPosMagic = m_blupiPos; - m_jauges[1].SetHide(false); - PlaySound(66, tinyPoint3); - ObjectStart(m_blupiPos, 41, -60); - ObjectStart(m_blupiPos, 41, 60); - ObjectStart(m_blupiPos, 41, 10); - ObjectStart(m_blupiPos, 41, -10); - } - if (ButtonPressed == Def.ButtonGlygh.PlayAction && m_moveObject[num].type == 30 && !m_blupiShield && !m_blupiCloud && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus) - { - ButtonPressed = Def.ButtonGlygh.None; - m_sucettePos = m_moveObject[num].posCurrent; - m_sucetteType = m_moveObject[num].type; - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - m_blupiAction = 55; - m_blupiPhase = 0; - m_blupiShield = false; - m_blupiPower = false; - m_blupiJumpAie = false; - m_blupiFocus = false; - PlaySound(57, tinyPoint3); - } - if (m_moveObject[num].type == 31 && !m_blupiShield && !m_blupiHide && !m_blupiPower && !m_blupiCloud && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus) - { - m_blupiAction = 56; - m_blupiPhase = 0; - m_blupiShield = false; - m_blupiPower = false; - m_blupiJumpAie = false; - m_blupiFocus = false; - m_blupiCloud = true; - m_blupiTimeShield = 100; - PlaySound(58, tinyPoint3); - if (m_blupiHide) - { - m_blupiHide = false; - m_jauges[1].SetHide(true); - } - } - if (m_moveObject[num].type >= 200 && m_moveObject[num].type <= 203 && m_blupiFocus) - { - if (m_moveObject[num].type == 200) - { - if (m_blupiPerso < 5 && ButtonPressed == Def.ButtonGlygh.PlayAction) - { - ButtonPressed = Def.ButtonGlygh.None; - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; - tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; - tinyPoint5.x = 0; - tinyPoint5.y = 438; - VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), tinyPoint5, 108, 4); - } - } - else if (!m_blupiShield && !m_blupiHide && !m_bSuperBlupi) - { - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - BlupiDead(11, 75); - tinyPoint = m_moveObject[num].posCurrent; - tinyPoint.x -= 34; - tinyPoint.y -= 34; - ObjectStart(tinyPoint, 10, 0); - PlaySound(10, m_moveObject[num].posCurrent); - m_decorAction = 1; - m_decorPhase = 0; - } - } - if (m_moveObject[num].type == 55 && m_blupiFocus && m_blupiDynamite == 0 && (m_voyageIcon != 252 || m_voyageChannel != 10) && ButtonPressed == Def.ButtonGlygh.PlayAction) - { - ButtonPressed = Def.ButtonGlygh.None; - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - tinyPoint.x = m_moveObject[num].posCurrent.x - m_posDecor.x; - tinyPoint.y = m_moveObject[num].posCurrent.y - m_posDecor.y; - tinyPoint5.x = 505; - tinyPoint5.y = 414; - VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), tinyPoint5, 252, 10); - m_blupiAction = 86; - m_blupiPhase = 0; - m_blupiFocus = false; - } - if (m_moveObject[num].type == 12 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus && m_blupiAction == 2) - { - tinyPoint3 = m_moveObject[num].posCurrent; - if (m_blupiDir == 1 && m_blupiPos.x > tinyPoint3.x) - { - tinyPoint3.x = m_blupiPos.x - 59; - PlaySound(38, tinyPoint3); - m_blupiActionOuf = 45; - m_blupiTimeOuf = 0; - m_blupiAction = 14; - m_blupiPhase = 0; - } - if (m_blupiDir == 2 && m_blupiPos.x < tinyPoint3.x) - { - tinyPoint3.x = m_blupiPos.x + 55; - PlaySound(38, tinyPoint3); - m_blupiActionOuf = 45; - m_blupiTimeOuf = 0; - m_blupiAction = 14; - m_blupiPhase = 0; - } - if (!TestPushCaisse(num, tinyPoint3, false)) - { - m_blupiPos.x = blupiPos.x; - } - } - if ((m_moveObject[num].type == 7 || m_moveObject[num].type == 21) && m_blupiFocus) - { - if (m_goalPhase == 0) - { - if (m_nbTresor >= m_totalTresor) - { - if (m_moveObject[num].type == 21) - { - m_bFoundCle = true; - } - ByeByeHelico(); - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - PlaySound(14, m_moveObject[num].posCurrent); - m_blupiAction = 13; - m_blupiPhase = 0; - m_blupiFocus = false; - m_blupiFront = true; - m_blupiPos.y = m_moveObject[num].posCurrent.y; - } - else - { - PlaySound(13, m_moveObject[num].posCurrent); - } - m_goalPhase = 50; - } - else - { - m_goalPhase--; - } - } - else - { - m_goalPhase = 0; - } - } - else - { - m_goalPhase = 0; - } - if (m_blupiAction == 14 && m_blupiFocus) - { - num = CaisseInFront(); - if (num != -1) - { - tinyPoint3 = m_moveObject[num].posCurrent; - if (m_blupiDir == 1) - { - tinyPoint3.x = m_blupiPos.x - 59; - } - else - { - tinyPoint3.x = m_blupiPos.x + 55; - } - if (!TestPushCaisse(num, tinyPoint3, false)) - { - m_blupiPos.x = blupiPos.x; - } - } - else - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - } - if (m_blupiAction == 29 && m_blupiFocus) - { - num = CaisseInFront(); - if (num != -1) - { - tinyPoint3 = m_moveObject[num].posCurrent; - if (m_blupiDir == 1) - { - tinyPoint3.x = m_blupiPos.x - 59; - } - else - { - tinyPoint3.x = m_blupiPos.x + 55; - } - if (!TestPushCaisse(num, tinyPoint3, true)) - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - } - else - { - m_blupiAction = 1; - m_blupiPhase = 0; - } - } - if (!m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && m_blupiFocus) - { - if (m_blupiActionOuf == 44 && m_blupiAction == 1) - { - if (m_blupiTimeOuf > 50) - { - m_blupiAction = m_blupiActionOuf; - m_blupiPhase = 0; - PlaySound(46, m_blupiPos); - } - m_blupiActionOuf = 0; - } - if (m_blupiActionOuf == 45 && m_blupiAction == 1) - { - if (m_blupiTimeOuf > 50) - { - m_blupiAction = m_blupiActionOuf; - m_blupiPhase = 0; - } - m_blupiActionOuf = 0; - } - if (m_blupiAction == 45 && m_blupiPhase == 4) - { - PlaySound(46, m_blupiPos); - } - if (m_blupiActionOuf == 65 && m_blupiAction == 1) - { - if (m_blupiTimeOuf > 10 && m_blupiTimeOuf < 50) - { - m_blupiAction = m_blupiActionOuf; - m_blupiPhase = 0; - } - m_blupiActionOuf = 0; - } - if (m_blupiActionOuf == 47 && m_blupiAction == 1) - { - if (m_blupiTimeOuf > 60) - { - m_blupiAction = m_blupiActionOuf; - m_blupiPhase = 0; - PlaySound(48, m_blupiPos); - } - m_blupiActionOuf = 0; - } - if (m_blupiActionOuf == 48 && m_blupiAction == 1) - { - if (m_blupiTimeOuf < 10) - { - m_blupiAction = m_blupiActionOuf; - m_blupiPhase = 0; - PlaySound(49, m_blupiPos); - } - m_blupiActionOuf = 0; - } - if ((m_blupiActionOuf == 63 || m_blupiActionOuf == 64 || m_blupiActionOuf == 83) && m_blupiAction == 1) - { - if (m_blupiTimeOuf < 20) - { - m_blupiAction = m_blupiActionOuf; - m_blupiPhase = 0; - } - m_blupiActionOuf = 0; - } - } - if (m_blupiAction == 2 && m_blupiActionOuf != 63 && m_blupiActionOuf != 64 && m_blupiActionOuf != 83 && !m_blupiSurf && !m_blupiNage) - { - m_blupiActionOuf = 0; - } - if (m_blupiActionOuf != 0) - { - m_blupiTimeOuf++; - } - if (m_blupiTimeMockery > 0) - { - m_blupiTimeMockery--; - } - if (m_blupiAction == 86 && m_blupiPhase == 18) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - if (m_blupiAction == 87 && m_blupiPhase == 26) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - if (m_blupiPos.x - 30 > m_blupiPosHelico.x || m_blupiPos.x + 30 < m_blupiPosHelico.x || m_blupiPos.y - 30 > m_blupiPosHelico.y || m_blupiPos.y + 30 < m_blupiPosHelico.y) - { - m_blupiPosHelico.x = -1; - } - if (m_blupiTimeFire > 0) - { - m_blupiTimeFire--; - } - if (m_blupiAction == 74 && m_blupiPhase == 128) - { - TinyPoint blupiPos2 = default(TinyPoint); - if (SearchTeleporte(m_blupiPos, ref blupiPos2)) - { - m_blupiPos = blupiPos2; - ObjectStart(m_blupiPos, 27, 20); - ObjectStart(m_blupiPos, 27, -20); - } - m_blupiFocus = true; - m_blupiPosHelico = m_blupiPos; - } - if (m_blupiAction == 82 && m_blupiPhase == 10) - { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - if (ButtonPressed == Def.ButtonGlygh.PlayAction && m_blupiAction == 1) - { - m_blupiAction = 84; - m_blupiPhase = 0; - PlaySound(27, m_blupiPos); - } - if ((m_blupiAction == 11 && m_blupiPhase == 70) || (m_blupiAction == 75 && m_blupiPhase == 100) || (m_blupiAction == 76 && m_blupiPhase == 70) || (m_blupiAction == 77 && m_blupiPhase == 110) || (m_blupiAction == 78 && m_blupiPhase == 90) || (m_blupiAction == 79 && m_blupiPhase == 90) || (m_blupiAction == 80 && m_blupiPhase == 90) || (m_blupiAction == 81 && m_blupiPhase == 90) || (m_blupiAction == 24 && m_blupiPhase == 90) || (m_blupiAction == 54 && m_blupiPhase == 100) || (m_blupiAction == 57 && m_blupiPhase == 90)) - { - if (m_nbVies > 0) - { - m_blupiAction = 35; - m_blupiIcon = -1; - m_blupiPhase = 0; - if (m_blupiRestart) - { - m_blupiPos = m_blupiValidPos; - } - TinyPoint posDecor = GetPosDecor(m_blupiPos); - tinyPoint.x = m_blupiPos.x - posDecor.x - 30; - tinyPoint.y = m_blupiPos.y - posDecor.y; - VoyageInit(VoyageGetPosVie(m_nbVies), m_pPixmap->HotSpotToHud(tinyPoint), 48, 2); - } - else - { - m_nbVies = -1; - m_term = -1; - DoorsLost(); - } - m_blupiFront = false; - } - if (m_dimDecor.y == 0) - { - num3 = 480; - } - else - { - num3 = 6400; - } - if (m_blupiPos.y >= num3 + 1 && m_blupiPos.y <= num3 + 40) - { - PlaySound(8, m_blupiPos); - } - if (m_blupiPos.y > num3 + 1000) - { - m_term = -1; - DoorsLost(); - } - if (m_blupiAction == 13 && m_blupiPhase == 40) - { - if (m_bPrivate) - { - m_term = 1; - } - else if (m_mission == 1) - { - m_term = 199; - } - else if (m_mission == 199) - { - m_term = -2; - } - else if (m_bFoundCle) - { - OpenGoldsWin(); - m_term = 1; - } - else - { - OpenDoorsWin(); - m_term = m_mission / 10 * 10; - } - } - if (m_blupiAction == 30 && m_blupiPhase == 30) - { - num = IsWorld(m_blupiPos); - if (num != -1) - { - if (m_mission == 1) - { - m_term = num * 10; - } - else if (num == 199) - { - m_term = 1; - } - else - { - m_term = m_mission / 10 * 10 + num; - } - } - } - if (blupiAction == 63 && m_blupiAction != 63) - { - StopSound(65); - } - if (blupiAction == 64 && m_blupiAction != 64) - { - StopSound(65); - } - if (blupiAction == 83 && m_blupiAction != 83) - { - StopSound(47); - } - if (m_blupiFocus && !m_blupiAir && (!m_blupiHelico || BlupiIsGround()) && (!m_blupiOver || BlupiIsGround()) && !m_blupiBalloon && !m_blupiEcrase && !m_blupiShield && !m_blupiHide && !flag2 && !flag3 && m_blupiTransport == -1 && !IsLave(m_blupiPos) && !IsPiege(m_blupiPos) && !IsGoutte(m_blupiPos, true) && !IsScie(m_blupiPos) && !IsBridge(m_blupiPos, ref tinyPoint) && IsTeleporte(m_blupiPos) == -1 && !IsBlitz(m_blupiPos, true) && !IsTemp(m_blupiPos) && !IsBalleTraj(m_blupiPos) && !IsMoveTraj(m_blupiPos)) - { - if (m_blupiFifoNb > 0) - { - m_blupiValidPos = m_blupiFifoPos[0]; - } - BlupiAddFifo(m_blupiPos); - } - tinyPoint3.x = m_blupiPos.x + 30 + m_scrollAdd.x; - tinyPoint3.y = m_blupiPos.y + 30 + m_scrollAdd.y; - int num28 = Math.Abs(m_scrollPoint.x - tinyPoint3.x); - int num29 = Math.Abs(m_scrollPoint.y - tinyPoint3.y); - num4 = SCROLL_SPEED; - if (num28 > SCROLL_MARGX * 2) - { - num4 += (num28 - SCROLL_MARGX * 2) / 4; - } - if (num29 > SCROLL_MARGY * 2) - { - num4 += (num29 - SCROLL_MARGY * 2) / 4; - } - if (m_scrollPoint.x < tinyPoint3.x) - { - m_scrollPoint.x = m_scrollPoint.x + num4; - if (m_scrollPoint.x >= tinyPoint3.x) - { - m_scrollPoint.x = tinyPoint3.x; - } - } - if (m_scrollPoint.x > tinyPoint3.x) - { - m_scrollPoint.x = m_scrollPoint.x - num4; - if (m_scrollPoint.x <= tinyPoint3.x) - { - m_scrollPoint.x = tinyPoint3.x; - } - } - if (m_scrollPoint.y < tinyPoint3.y) - { - m_scrollPoint.y = m_scrollPoint.y + num4; - if (m_scrollPoint.y >= tinyPoint3.y) - { - m_scrollPoint.y = tinyPoint3.y; - } - } - if (m_scrollPoint.y > tinyPoint3.y) - { - m_scrollPoint.y = m_scrollPoint.y - num4; - if (m_scrollPoint.y <= tinyPoint3.y) - { - m_scrollPoint.y = tinyPoint3.y; - } - } - if (m_blupiAction != 75 && m_blupiAction != 76) - { - m_posDecor = GetPosDecor(m_scrollPoint); - } - if (m_time % 4 == 0) - { - PosSound(m_blupiPos); - } - VoyageStep(); - m_blupiLastSpeedX = m_blupiSpeedX; - m_blupiLastSpeedY = m_blupiSpeedY; - m_lastKeyPress = m_keyPress; -} -*/ - -BOOL CDecor::GetInvincible() +BOOL CDecor::GetSuperBlupi() { return m_bSuperBlupi; } -void CDecor::SetInvincible(BOOL invincible) +void CDecor::SetSuperBlupi(BOOL bSuper) { - m_bSuperBlupi = invincible; + m_bSuperBlupi = bSuper; } -BOOL CDecor::GetShowSecret() +BOOL CDecor::GetDrawSecret() { return m_bDrawSecret; } -void CDecor::SetShowSecret(BOOL secret) +void CDecor::SetDrawSecret(BOOL bDrawSecret) { - m_bDrawSecret = secret; + m_bDrawSecret = bDrawSecret; } -void CDecor::SetAccessBuild(BOOL build) +void CDecor::SetBuildOfficialMissions(BOOL bBuild) { - m_bAccessBuild = build; + m_bBuildOfficialMissions = bBuild; } BOOL CDecor::GetNetPacked() @@ -6175,9 +1420,9 @@ BOOL CDecor::GetNetPacked() return m_bNetPacked; } -void CDecor::SetNetPacked(BOOL net) +void CDecor::SetNetPacked(BOOL bNetPacked) { - m_bNetPacked = net; + m_bNetPacked = bNetPacked; } BOOL CDecor::GetNetMovePredict() @@ -6185,9 +1430,9 @@ BOOL CDecor::GetNetMovePredict() return m_bNetMovePredict; } -void CDecor::SetNetMovePredict(BOOL netmove) +void CDecor::SetNetMovePredict(BOOL bNetMovePredict) { - m_bNetMovePredict = netmove; + m_bNetMovePredict = bNetMovePredict; } BOOL CDecor::GetNetDebug() @@ -6195,7 +1440,23 @@ BOOL CDecor::GetNetDebug() return m_bNetDebug; } -void CDecor::SetMulti(int multi) +void CDecor::SetNetDebug(BOOL bNetDebug) +{ + m_bNetDebug = bNetDebug; + //if (bNetDebug) FUN_2bfb0("debug.txt"); +} + +void CDecor::OutputNetDebug(char* text) +{ + char textbuffer[100]; + + if (!m_bNetDebug) return; + + sprintf(textbuffer, "/ snd=%d(%d)_rcv=%d(%d)", m_netPacketsSent, m_netPacketsSent2, m_netPacketsRecieved, m_netPacketsRecieved2); + // ...? +} + +void CDecor::SetMulti(BOOL multi) { m_bMulti = multi; } @@ -6205,3048 +1466,9 @@ void CDecor::SetTeam(int team) m_team = team; } -void CDecor::MemorizeDoors(BYTE* doors) +POINT CDecor::VoyageGetPosVie(int nbVies) { - int i; - - i = 0; - - do - { - m_doors[i] = doors[i]; - i++; - } while (i < 200); - return; -} - -BOOL CDecor::BlupiIsGround() -{ - if (m_blupiTransport == -1) - { - RECT rect = BlupiRect(m_blupiPos); - rect.top = m_blupiPos.y + 60 - 2; - rect.bottom = m_blupiPos.y + 60 - 1; - return DecorDetect(rect); - } -} - -RECT CDecor::BlupiRect(POINT pos) -{ - RECT result; - if (m_blupiNage || m_blupiSurf) - { - result.left = pos.x + 12; - result.right = pos.x + 60 - 12; - if (m_blupiAction == 1) - { - result.top = pos.y + 5; - result.bottom = pos.y + 60 - 10; - } - else - { - result.top = pos.y + 15; - result.bottom = pos.y + 60 - 10; - } - } - else if (m_blupiJeep) - { - result.left = pos.x + 2; - result.right = pos.x + 60 - 2; - result.top = pos.y + 10; - result.bottom = pos.y + 60 - 2; - } - else if (m_blupiTank) - { - result.left = pos.x + 2; - result.right = pos.x + 60 - 2; - result.top = pos.y + 10; - result.bottom = pos.y + 60 - 2; - } - else if (m_blupiOver) - { - result.left = pos.x + 2; - result.right = pos.x + 60 - 2; - result.top = pos.y + 2; - result.bottom = pos.y + 60 - 2; - } - else if (m_blupiBalloon) - { - result.left = pos.x + 10; - result.right = pos.x + 60 - 10; - result.top = pos.y + 5; - result.bottom = pos.y + 60 - 2; - } - else if (m_blupiEcrase) - { - result.left = pos.x + 5; - result.right = pos.x + 60 - 5; - result.top = pos.y + 39; - result.bottom = pos.y + 60 - 2; - } - else - { - result.left = pos.x + 12; - result.right = pos.x + 60 - 12; - result.top = pos.y + 11; - result.bottom = pos.y + 60 - 2; - } - return result; -} - -void CDecor::BlupiAdjust() -{ - RECT tinyRect = BlupiRect(m_blupiPos); - - if (DecorDetect(tinyRect)) - { - return; - } - for (int i = 0; i < 50; i++) - { - RECT rect = tinyRect; - rect.bottom = rect.top + 2; - rect.left = m_blupiPos.x + 12; - rect.right = m_blupiPos.x + 60 - 12; - if (DecorDetect(rect)) - { - break; - } - tinyRect.top += 2; - tinyRect.bottom += 2; - m_blupiPos.y = m_blupiPos.y + 2; - } - for (int i = 0; i < 50; i++) - { - RECT rect = tinyRect; - rect.right = rect.left + 2; - rect.top = m_blupiPos.y + 11; - rect.bottom = m_blupiPos.y + 60 - 2; - if (DecorDetect(rect)) - { - break; - } - tinyRect.left += 2; - tinyRect.right += 2; - m_blupiPos.x = m_blupiPos.x + 2; - } - for (int i = 0; i < 50; i++) - { - RECT rect = tinyRect; - rect.left = rect.right - 2; - rect.top = m_blupiPos.y + 11; - rect.bottom = m_blupiPos.y + 60 - 2; - if (DecorDetect(rect)) - { - break; - } - tinyRect.left -= 2; - tinyRect.right -= 2; - m_blupiPos.x = m_blupiPos.x - 2; - } - for (int i = 0; i < 50; i++) - { - RECT rect = tinyRect; - rect.right = rect.left + 2; - if (DecorDetect(rect)) - { - break; - } - tinyRect.left += 2; - tinyRect.right += 2; - m_blupiPos.x = m_blupiPos.x + 2; - } - for (int i = 0; i < 50; i++) - { - RECT rect = tinyRect; - rect.left = rect.right - 2; - if (DecorDetect(rect)) - { - return; - } - tinyRect.left -= 2; - tinyRect.right -= 2; - m_blupiPos.x = m_blupiPos.x - 2; - } -} - -BOOL CDecor::BlupiBloque(POINT pos, int dir) -{ - RECT rect = BlupiRect(pos); - rect.top = rect.bottom - 20; - rect.bottom -= 2; - if (dir > 0) - { - rect.left = rect.right - 2; - } - if (dir < 0) - { - rect.right = rect.left + 2; - } - return DecorDetect(rect); -} - -void CDecor::BlupiDead(int action1, int action2) -{ - if (action2 == -1) - { - m_blupiAction = action1; - } - else - { - m_blupiAction = ((rand() % 2 == 0) ? action1 : action2); - } - m_blupiPhase = 0; - m_blupiFocus = FALSE; - m_blupiHelico = FALSE; - m_blupiOver = FALSE; - m_blupiJeep = FALSE; - m_blupiTank = FALSE; - m_blupiSkate = FALSE; - m_blupiNage = FALSE; - m_blupiSurf = FALSE; - m_blupiVent = FALSE; - m_blupiSuspend = FALSE; - m_blupiJumpAie = FALSE; - m_blupiShield = FALSE; - m_blupiPower = FALSE; - m_blupiCloud = FALSE; - m_blupiHide = FALSE; - m_blupiInvert = FALSE; - m_blupiBalloon = FALSE; - m_blupiEcrase = FALSE; - m_blupiRestart = FALSE; - m_blupiActionOuf = 0; - m_jauges[0].SetHide(TRUE); - m_jauges[1].SetHide(TRUE); - StopSound(SOUND_HELICOHIGH); - StopSound(SOUND_HELICOLOW); - StopSound(SOUND_JEEPHIGH); - StopSound(SOUND_JEEPLOW); - - POINT pos; - POINT pos2; - if (m_blupiAction == ACTION_CLEAR2) - { - pos.x = m_blupiPos.x - m_posDecor.x; - pos.y = m_blupiPos.y - m_posDecor.y; - pos2.x = m_blupiPos.x - m_posDecor.x; - pos2.y = m_blupiPos.y - m_posDecor.y - 300; - VoyageInit(m_pPixmap->HotSpotToHud(pos), m_pPixmap->HotSpotToHud(pos2), 230, 10); - PlaySound(SOUND_ANGEL, m_blupiPos); - } - if (m_blupiAction == ACTION_CLEAR3) - { - pos.x = m_blupiPos.x - m_posDecor.x; - pos.y = m_blupiPos.y - m_posDecor.y; - pos2.x = m_blupiPos.x - m_posDecor.x; - pos2.y = m_blupiPos.y - m_posDecor.y - 2000; - VoyageInit(m_pPixmap->HotSpotToHud(pos), m_pPixmap->HotSpotToHud(pos2), 40, 10); - PlaySound(SOUND_ANGEL, m_blupiPos); - } - if (m_blupiAction == ACTION_CLEAR4) - { - ObjectStart(m_blupiPos, TYPE_INVERTSTART, -70); - ObjectStart(m_blupiPos, TYPE_INVERTSTART, 20); - ObjectStart(m_blupiPos, TYPE_INVERTSTART, -20); - PlaySound(SOUND_SCIE, m_blupiPos); - } -} - -POINT CDecor::GetPosDecor(POINT pos) -{ - POINT result; - if (m_dimDecor.x == 0) - { - result.x = 0; - } - else - { - result.x = pos.x - LXIMAGE / 2; - result.x = (result.x < 0); - result.x = (result.x > 5760) - LXIMAGE; - } - if (m_dimDecor.y == 0) - { - result.y = 0; - } - else - { - result.y = pos.y - LYIMAGE / 2; - result.y = (result.y < 0); - result.y = (result.y > 5920) - LYIMAGE / 2; - } - return result; -} - -void CDecor::BlupiAddFifo(POINT pos) -{ - if (m_blupiFifoNb < 10) - { - if (m_blupiFifoNb > 0 && pos.x == m_blupiFifoPos[m_blupiFifoNb - 1].x && pos.y == m_blupiFifoPos[m_blupiFifoNb - 1].y) - { - return; - } - m_blupiFifoPos[m_blupiFifoNb] = pos; - m_blupiFifoNb++; - return; - } - else - { - if (pos.x == m_blupiFifoPos[9].x && pos.y == m_blupiFifoPos[9].y) - { - return; - } - for (int i = 0; i < 9; i++) - { - m_blupiFifoPos[i] = m_blupiFifoPos[i + 1]; - } - m_blupiFifoPos[9] = pos; - return; - } -} - -BOOL CDecor::DecorDetect(RECT rect) -{ - return DecorDetect(rect, TRUE); -} - -BOOL CDecor::DecorDetect(RECT rect, BOOL bCaisse) -{ - m_detectIcon = -1; - if (rect.left < 0 || rect.top < 0) - { - return TRUE; - } - int num; - if (m_dimDecor.x == 0) - { - num = 640; - } - else - { - num = 6400; - } - if (rect.right > num) - { - return TRUE; - } - if (m_blupiHelico || - m_blupiOver || - m_blupiBalloon || - m_blupiEcrase || - m_blupiNage || - m_blupiSurf) - { - if (m_dimDecor.y == 0) - { - num = 480; - } - else - { - num = 6400; - } - if (rect.bottom > num) - { - return TRUE; - } - } - int num2 = rect.left / 16; - int num3 = (rect.right + 16 - 1) / 16; - int num4 = rect.top / 16; - int num5 = (rect.bottom + 16 - 1) / 16; - RECT src; - for (int i = num4; i <= num5; i++) - { - for (int j = num2; j <= num3; j++) - { - int num6 = j / 4; - int num7 = i / 4; - if (num6 >= 0 && num6 < 100 && num7 >= 0 && num7 < 100) - { - int icon = m_decor[num6, num7]->icon; - if (icon >= 0 && icon < MAXQUART && (!m_blupiHelico || icon != 214) && (m_blupiOver || icon != 214) && (icon != 324 || m_time / 4 % 20 < 18)) - { - num6 = j % 4; - num7 = i % 4; - if (table_decor_quart[icon * 16 + num7 * 4 + num6] != 0) - { - src.left = j * 16; - src.right = src.left + 16; - src.top = i * 16; - src.bottom = src.top + 16; - RECT tinyRect; - if (IntersectRect(tinyRect, src, rect)) - { - m_detectIcon = icon; - return TRUE; - } - } - - } - } - } - } - if (!bCaisse) - { - return FALSE; - } - for (int k = 0; k < m_nbRankCaisse; k++) - { - int num8 = m_rankCaisse[k]; - src.left = m_moveObject[num8]->posCurrent.x; - src.right = m_moveObject[num8]->posCurrent.x + 64; - src.top = m_moveObject[num8]->posCurrent.y; - src.bottom = m_moveObject[num8]->posCurrent.y + 64; - RECT tinyRect; - if (IntersectRect(tinyRect, src, rect)) - { - m_detectIcon = m_moveObject[num8]->icon; - return TRUE; - } - } - return FALSE; -} - -BOOL CDecor::TestPath(RECT rect, POINT start, POINT end) -{ - int num = abs(end.x - start.x); - int num2 = abs(end.y - start.y); - - POINT tinyPoint = start; - if (num > num2) - { - RECT rect2; - if (end.x > start.x) - { - for (int i = 0; i <= num; i++) - { - int j = i * (end.y - start.y) / num; - rect2.left = rect.left + i; - rect2.right = rect.right + i; - rect2.top = rect.top + j; - rect2.bottom = rect.bottom + j; - if (DecorDetect(rect2)) - { - end = tinyPoint; - return FALSE; - } - tinyPoint.x = start.x + i; - tinyPoint.y = start.y + j; - } - } - if (end.x < start.x) - { - for (int i = 0; i >= -num; i--) - { - int j = i * (start.y - end.y) / num; - rect2.left = rect.left + i; - rect2.right = rect.right + i; - rect2.top = rect.top + j; - rect2.bottom = rect.bottom + j; - if (DecorDetect(rect2)) - { - end = tinyPoint; - return FALSE; - } - tinyPoint.x = start.x + i; - tinyPoint.y = start.y + j; - } - } - } - else - { - RECT rect2; - if (end.y > start.y) - { - for (int j = 0; j <= num2; j++) - { - int i = j * (end.x - start.x) / num2; - rect2.left = rect.left + i; - rect2.right = rect.right + i; - rect2.top = rect.top + j; - rect2.bottom = rect.bottom + j; - if (DecorDetect(rect2)) - { - end = tinyPoint; - return FALSE; - } - tinyPoint.x = start.x + i; - tinyPoint.y = start.y + j; - } - } - if (end.y < start.y) - { - for (int j = 0; j >= -num2; j--) - { - int i = j * (start.x - end.x) / num2; - rect2.left = rect.left + i; - rect2.right = rect.right + i; - rect2.top = rect.top + j; - rect2.bottom = rect.bottom + j; - if (DecorDetect(rect2)) - { - end = tinyPoint; - return FALSE; - } - tinyPoint.x = start.x + i; - tinyPoint.y = start.y + j; - } - } - } - return TRUE; -} - -void CDecor::MoveObjectPlouf(POINT pos) -{ - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i]. == 14) - { - return; - } - } - pos.y -= 45; - PlaySound(23, pos); - ObjectStart(pos, 14, 0); -} - -void CDecor::MoveObjectTiplouf(POINT pos) -{ - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i].type == 35) - { - return; - } - } - if (m_blupiDir == 2) - { - pos.x += 5; - } - else - { - pos.x -= 5; - } - pos.y -= 45; - PlaySound(64, pos); - ObjectStart(pos, 35, 0); -} - -void CDecor::MoveObjectBlup(POINT pos) -{ - PlaySound(24, pos); - pos.y -= 20; - int num = 0; - POINT tinyPoint = pos; - while (tinyPoint.y > 0) - { - int icon = m_decor[(tinyPoint.x + 16) / 64, tinyPoint.y / 64]->icon; - if (icon != 91 && icon != 92) - { - break; - } - num++; - tinyPoint.y -= 64; - } - num--; - if (num <= 0) - { - return; - } - int num2 = MoveObjectFree(); - if (num2 == -1) - { - return; - } - m_moveObject[num2]->type = 15; - m_moveObject[num2]->phase = 0; - m_moveObject[num2]->posCurrent.x = pos.x; - m_moveObject[num2]->posCurrent.y = pos.y; - m_moveObject[num2]->posStart = m_moveObject[num2]->posCurrent; - m_moveObject[num2]->posEnd.x = pos.x; - m_moveObject[num2]->posEnd.y = pos.y - num * 64; - m_moveObject[num2]->timeStopStart = 0; - m_moveObject[num2]->stepAdvance = num * 10; - m_moveObject[num2]->step = 2; - m_moveObject[num2]->time = 0; - MoveObjectStepIcon(num2); -} - - -void CDecor::ActiveSwitch(BOOL bState, POINT cel) -{ - POINT pos; - pos.x = cel.x * 64; - pos.y = cel.y * 64; - ModifDecor(pos, bState ? 384 : 385); - PlaySound(bState ? 77 : 76, pos); - cel.x -= 20; - for (int i = 0; i < 41; i++) - { - if (cel.x >= 0 && cel.x < 100 && m_decor[cel.x, cel.y]->icon == (bState ? 379 : 378)) - { - pos.x = cel.x * 64; - pos.y = cel.y * 64; - ModifDecor(pos, bState ? 378 : 379); - } - cel.x++; - } -} - -int CDecor::IsWorld(POINT pos) -{ - pos.x += 30; - pos.y += 30; - if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) - { - return -1; - } - int icon = m_decor[pos.x / 64, pos.y / 64]->icon; - if (icon >= 158 && icon <= 165) - { - return icon - 158 + 1; - } - if (icon >= 166 && icon <= 173) - { - return icon - 166 + 1; - } - if (icon == 309 || icon == 310) - { - return 9; - } - if (icon >= 411 && icon <= 415) - { - return icon - 411 + 10; - } - if (icon >= 416 && icon <= 420) - { - return icon - 416 + 10; - } - if (icon >= 174 && icon <= 181) - { - return icon - 174 + 1; - } - if (icon == 184) - { - return 199; - } - return -1; -} - -int CDecor::GetTypeBarre(POINT pos) -{ - POINT pos2 = pos; - pos.x += 30; - pos.y += 22; - if (pos.y % 64 > 44) - { - return 0; - } - if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) - { - return 0; - } - int icon = m_decor[pos.x / 64, pos.y / 64]->icon; - if (icon != 138 && icon != 202) - { - return 0; - } - if (pos.y >= 6336) - { - return 1; - } - icon = m_decor[pos.x / 64, pos.y / 64 + 1]->icon; - if (IsPassIcon(icon)) - { - return 2; - } - RECT rect = BlupiRect(pos2); - rect.top = pos2.y + 60 - 2; - rect.bottom = pos2.y + 60 - 1; - if (DecorDetect(rect, TRUE)) - { - return 2; - } - return 1; -} - -BOOL CDecor::IsLave(POINT pos) -{ - pos.x += 30; - return pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 68; -} - -BOOL CDecor::IsPiege(POINT pos) -{ - pos.x += 30; - pos.y += 60; - return pos.x % 64 >= 15 && pos.x % 64 <= 49 && pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 373; -} - -BOOL CDecor::IsGoutte(POINT pos, BOOL bAlways) -{ - pos.x += 30; - if (pos.x % 64 < 15 || pos.x % 64 > 49) - { - return FALSE; - } - if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) - { - return FALSE; - } - int icon = m_decor[pos.x / 64, pos.y / 64]->icon; - if (bAlways) - { - return icon == 404 || icon == 410; - } - return icon == 404; -} - -BOOL CDecor::IsScie(POINT pos) -{ - pos.x += 30; - return pos.x % 64 >= 4 && pos.x % 64 <= 60 && pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 378; -} - -BOOL CDecor::IsSwitch(POINT pos, POINT celSwitch) -{ - pos.x += 30; - if (pos.x % 64 < 4 || pos.x % 64 > 60) - { - return FALSE; - } - if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) - { - return FALSE; - } - celSwitch.x = pos.x / 64; - celSwitch.y = pos.y / 64; - return m_decor[pos.x / 64, pos.y / 64]->icon == 384 || m_decor[pos.x / 64, pos.y / 64]->icon == 385; -} - -BOOL CDecor::IsEcraseur(POINT pos) -{ - if (m_time / 3 % 10 > 2) - { - return FALSE; - } - pos.x += 30; - return pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 317; -} - -BOOL CDecor::IsBlitz(POINT pos, BOOL bAlways) -{ - pos.x += 30; - if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) - { - return FALSE; - } - POINT tinyPoint; - tinyPoint.x = pos.x / 64; - tinyPoint.y = pos.y / 64; - return m_decor[tinyPoint.x, tinyPoint.y]->icon == 305 && (bAlways || BlitzActif(tinyPoint.x, tinyPoint.y)); -} - -BOOL CDecor::IsRessort(POINT pos) -{ - pos.x += 30; - pos.y += 60; - return pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 211; -} - -BOOL CDecor::IsTemp(POINT pos) -{ - pos.x += 30; - pos.y += 60; - return pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 324; -} - -BOOL CDecor::IsBridge(POINT pos, POINT celBridge) -{ - pos.x += 30; - pos.y += 60; - if (pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 364) - { - celBridge.x = pos.x / 64; - celBridge.y = pos.y / 64; - return TRUE; - } - pos.y -= 60; - if (pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon == 364) - { - celBridge.x = pos.x / 64; - celBridge.y = pos.y / 64; - return TRUE; - } - return FALSE; - -} - -int CDecor::IsDoor(POINT pos, POINT celPorte) -{ - int num; - if (m_blupiDir == 1) - { - num = -60; - } - else - { - num = 60; - } - pos.x += 30; - for (int i = 0; i < 2; i++) - { - if (pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / 64, pos.y / 64]->icon >= 334 && m_decor[pos.x / 64, pos.y / 64]->icon <= 336) - { - celPorte.x = pos.x / 64; - celPorte.y = pos.y / 64; - return m_decor[pos.x / 64, pos.y / 64]->icon; - } - pos.x += num; - } - return -1; -} - -int CDecor::IsTeleporte(POINT pos) -{ - if (pos.x % 64 > 6) - { - return -1; - } - pos.x += 30; - pos.y -= 60; - if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) - { - return -1; - } - if (m_decor[pos.x / 64, pos.y / 64]->icon >= 330 && m_decor[pos.x / 64, pos.y / 64]->icon <= 333) - { - return m_decor[pos.x / 64, pos.y / 64]->icon; - } - return -1; -} - -BOOL CDecor::SearchTeleporte(POINT pos, POINT newpos) -{ - int num = IsTeleporte(pos); - if (num == -1) - { - return FALSE; - } - for (int i = 0; i < 100; i++) - { - for (int j = 0; j < 100; j++) - { - if (num == m_decor[i][j]->icon) - { - newpos.x = i * 64; - newpos.y = j * 64 + 60; - if (newpos.x < pos.x - 40 || newpos.x > pos.x + 40 || newpos.y < pos.y - 40 || newpos.y > pos.y + 40) - { - return TRUE; - } - } - } - } - return FALSE; -} - -BOOL CDecor::IsNormalJump(POINT pos) -{ - pos.x += 32; - pos.y -= 32; - if (m_blupiDir == 1) - { - pos.x -= 15; - } - else - { - pos.x += 15; - } - for (int i = 0; i < 2; i++) - { - int num = pos.x / 64; - int num2 = pos.y / 64; - if (num2 < 0) - { - return FALSE; - } - int icon = m_decor[num, num2]->icon; - if (!IsPassIcon(icon)) - { - return FALSE; - } - pos.y -= 64; - } - return TRUE; -} - -BOOL CDecor::IsSurfWater(POINT pos) -{ - if (pos.y % 64 < 64 - BLUPISURF) - { - return FALSE; - } - int icon = m_decor[(pos.x + 30) / 64, pos.y / 64]->icon; - int icon2 = m_decor[(pos.x + 30) / 64, (pos.y + BLUPISURF) / 64]->icon; - return icon != 92 && icon2 == 92; -} - -BOOL CDecor::IsDeepWater(POINT pos) -{ - int num = (pos.x + 30) / 64; - int num2 = pos.y / 64; - if (num < 0 || num >= 100 || num2 < 0 || num2 >= 100) - { - return FALSE; - } - int icon = m_decor[num, num2]->icon; - return icon == 91 || icon == 92; -} - -BOOL CDecor::IsOutWater(POINT pos) -{ - int icon = m_decor[(pos.x + 30) / 64, (pos.y + 30) / 64]->icon; - return icon != 91 && icon != 92 && IsPassIcon(icon); -} - -BOOL CDecor::IsPassIcon(int icon) -{ - if (icon == 324 && m_time / 4 % 20 >= 18) - { - return TRUE; - } - if (icon >= 0 && icon < MAXQUART) - { - for (int i = 0; i < 16; i++) - { - if (table_decor_quart[icon * 16 + i] != 0) - { - return FALSE; - } - } - } - return TRUE; -} - -BOOL CDecor::IsBlocIcon(int icon) -{ - if (icon < 0 || icon >= MAXQUART) - { - return FALSE; - } - if (icon == 324 && m_time / 4 % 20 < 18) - { - return FALSE; - } - for (int i = 0; i < 16; i++) - { - if (table_decor_quart[icon * 16 + i] == 0) - { - return FALSE; - } - } - return FALSE; -} - -void CDecor::FlushBalleTraj() -{ - for (int i = 0; i < 1300; i++) - { - m_balleTraj[i] = 0; - } -} - -void CDecor::SetBalleTraj(POINT pos) -{ - if (pos.x < 0 || pos.x >= 100 || pos.y < 0 || pos.y >= 100) - { - return; - } - int num = pos.y * 13; - num += pos.x / 8; - int num2 = pos.x & 7; - m_balleTraj[num] |= 1 << num2; -} - -BOOL CDecor::IsBalleTraj(POINT pos) -{ - pos.x = (pos.x + 32) / 64; - pos.y = (pos.y + 32) / 64; - if (pos.x < 0 || pos.x >= 100 || pos.y < 0 || pos.y >= 100) - { - return FALSE; - } - int num = pos.y * 13; - num += pos.x / 8; - int num2 = pos.x & 7; - return (m_balleTraj[num] & 1 << num2) != 0; -} - -void CDecor::FlushMoveTraj() -{ - for (int i = 0; i < 1300; i++) - { - m_moveTraj[i] = 0; - } -} - -void CDecor::SetMoveTraj(POINT pos) -{ - - if (pos.x < 0 || pos.x >= 100 || pos.y < 0 || pos.y >= 100) - { - return; - } - int num = pos.y * 13; - num += pos.x / 8; - int num2 = pos.x & 7; - m_moveTraj[num] |= 1 << num2; -} - -BOOL CDecor::IsMoveTraj(POINT pos) -{ - pos.x = (pos.x + 32) / 64; - pos.y = (pos.y + 32) / 64; - if (pos.x < 0 || pos.x >= 100 || pos.y < 0 || pos.y >= 100) - { - return FALSE; - } - int num = pos.y * 13; - num += pos.x / 8; - int num2 = pos.x & 7; - return (m_moveTraj[num] & 1 << num2) != 0; -} - -int CDecor::SearchDistRight(POINT pos, POINT dir, int type) -{ - int num = 0; - if (type == 36 || type == 39 || type == 41 || type == 42 || type == 93) - { - return 500; - } - pos.x = (pos.x + 32) / 64; - pos.y = (pos.y + 32) / 64; - while (pos.x >= 0 && pos.x < 100 && pos.y >= 0 && pos.y < 100 && !IsBlocIcon(m_decor[pos.x, pos.y]->icon)) - { - if (type == 23) - { - SetBalleTraj(pos); - } - num += 64; - pos.x += dir.x; - pos.y += dir.y; - } - if ((type == 34 || type == 38) && num >= 64) - { - num -= 64; - } - if (type == 23 && num >= 10) - { - num -= 10; - } - return num; -} - -BOOL CDecor::IsVentillo(POINT pos) -{ - int num = 0; - BOOL flag = FALSE; - POINT tinyPoint; - pos.x += 30; - pos.y += 30; - if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) - { - return FALSE; - } - int icon = m_decor[pos.x / 64, pos.y / 64]->icon; - if (icon < 126 || icon > 137) - { - return FALSE; - } - if (icon == 126) - { - if (pos.x % 64 <= 16) - { - flag = TRUE; - } - tinyPoint.x = -64; - tinyPoint.y = 0; - num = 110; - } - if (icon == 129) - { - if (pos.x % 64 >= 48) - { - flag = TRUE; - } - tinyPoint.x = 64; - tinyPoint.y = 0; - num = 114; - } - if (icon == 132) - { - if (pos.y % 64 <= 32) - { - flag = TRUE;; - } - tinyPoint.x = 0; - tinyPoint.y = -64; - num = 118; - } - if (icon == 135) - { - if (pos.y % 64 >= 48) - { - flag = TRUE; - } - tinyPoint.x = 0; - tinyPoint.y = 64; - num = 122; - } - if (!flag) - { - return FALSE; - } - ModifDecor(pos, -1); - do - { - pos.x += tinyPoint.x; - pos.y += tinyPoint.y; - if (num != m_decor[pos.x / 64, pos.y / 64]->icon) - { - break; - } - ModifDecor(pos, -1); - } - while (pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400); - return TRUE; -} - -void CDecor::NetStopCloud(int rank) -{ -} - -// Birdlime - -void CDecor::StartSploutchGlu(POINT pos) -{ - POINT pos2; - pos2.x = pos.x; - pos2.y = pos.y; - ObjectStart(pos2, 98, 0); - pos2.x = pos.x + 15; - pos2.y = pos.y + 20; - ObjectStart(pos2, 99, 0); - pos2.x = pos.x - 20; - pos2.y = pos.y + 18; - ObjectStart(pos2, 99, 0); - pos2.x = pos.x + 23; - pos2.y = pos.y - 18; - ObjectStart(pos2, 99, 0); - pos2.x = pos.x - 15; - pos2.y = pos.y - 18; - ObjectStart(pos2, 99, 0); - pos2.x = pos.x + 32; - pos2.y = pos.y + 10; - ObjectStart(pos2, 100, 0); - pos2.x = pos.x - 28; - pos2.y = pos.y + 15; - ObjectStart(pos2, 100, 0); - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - PlaySound(51, pos); -} - -int CDecor::ObjectStart(POINT pos, int type, int speed) -{ - int num = MoveObjectFree(); - if (num == -1) - { - return -1; - } - m_moveObject[num].type = type; - m_moveObject[num].phase = 0; - m_moveObject[num].posCurrent = pos; - m_moveObject[num].posStart = pos; - m_moveObject[num].posEnd = pos; - MoveObjectStopIcon(num); - if (speed != 0) - { - POINT tinyPoint = pos; - int num2 = speed; - int num3 = 0; - if (num2 > 50) - { - num2 -= 50; - POINT dir; - dir.x = 0; - dir.y = 1; - num3 = SearchDistRight(tinyPoint, dir, type); - tinyPoint.y += num3; - } - else if (num < -50) - { - num2 += 50; - POINT dir; - dir.x = 0; - dir.y = -1; - num3 = SearchDistRight(tinyPoint, dir, type); - tinyPoint.y -= num3; - } - else if (num2 > 0) - { - POINT dir; - dir.x = 1; - dir.y = 0; - num3 = SearchDistRight(tinyPoint, dir, type); - tinyPoint.x += num3; - } - else if (num2 < 0) - { - POINT dir; - dir.x = -1; - dir.y = 0; - num3 = SearchDistRight(tinyPoint, dir, type); - tinyPoint.x -= num3; - } - if (num3 == 0) - { - if (type == 23) - { - m_moveObject[num].type = 0; - return num; - } - } - else - { - m_moveObject[num].posEnd = tinyPoint; - m_moveObject[num].timeStopStart = 0; - m_moveObject[num].stepAdvance = abs(num2 * num3 / 64); - m_moveObject[num].step = 2; - m_moveObject[num].time = 0; - } - } - MoveObjectPriority(num); - return num; -} - -BOOL CDecor::ObjectDelete(POINT pos, int type) -{ - int num = MoveObjectSearch(pos, type); - if (num == -1) - { - return FALSE; - } - if (m_moveObject[num].type == 4 || - m_moveObject[num].type == 12 || - m_moveObject[num].type == 16 || - m_moveObject[num].type == 17 || - m_moveObject[num].type == 20 || - m_moveObject[num].type == 40 || - m_moveObject[num].type == 96 || - m_moveObject[num].type == 97) - { - int num2 = 17; - double animationSpeed = 1.0; - if (m_moveObject[num].type == 4) - { - num2 = 7; - } - if (m_moveObject[num].type == 17 || m_moveObject[num].type == 20) - { - num2 = 33; - } - if (m_moveObject[num].type == 40) - { - animationSpeed = 0.5; - } - ByeByeAdd(m_moveObject[num].channel, m_moveObject[num].icon, m_moveObject[num].posCurrent, num2, animationSpeed); - } - m_moveObject[num].type = 0; - return TRUE; -} - -void CDecor::ModifDecor(POINT pos, int icon) -{ - int icon2 = m_decor[pos.x / 64, pos.y / 64]->icon; - if (icon == -1 && icon >= 126 && icon2 <= 137) - { - ByeByeAdd(1, icon2, pos, 17.0, 1.0); - } - m_decor[pos.x / 64, pos.y / 64]->icon = icon; -} - -void CDecor::MoveObjectStep() -{ - m_blupiVector.x = 0; - m_blupiVector.y = 0; - m_blupiTransport = -1; - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i].type != 0) - { - MoveObjectStepLine(i); - MoveObjectStepIcon(i); - if (m_moveObject[i].type == 4 || - m_moveObject[i].type == 33 || - m_moveObject[i].type == 32) - int num = MovePersoDetect(m_moveObject[i].posCurrent); - if (num != -1) - { - POINT posCurrent = m_moveObject[i].posCurrent; - posCurrent.x -= 34; - posCurrent.y -= 34; - ObjectStart(posCurrent, 8, 0); - PlaySound(10, m_moveObject[i].posCurrent); - m_decorAction = 1; - m_decorPhase = 0; - posCurrent = m_moveObject[i].posCurrent; - posCurrent.x += 2; - posCurrent.y += BLUPIOFFY; - ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type); - ObjectStart(posCurrent, 37, 0); - ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - } - if (BlupiElectro(m_moveObject[i].posCurrent)) - { - POINT posCurrent = m_moveObject[i].posCurrent; - posCurrent.x += 2; - posCurrent.y += BLUPIOFFY; - ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type); - ObjectStart(posCurrent, 38, 55); - PlaySound(59, posCurrent); - } - } - } -} - -void CDecor::MoveObjectStepLine(int i) -{ - MoveObject moveObject; - POINT tinyPoint; - BOOL flag = FALSE; - RECT tinyRect; - if (m_moveObject[i].type == 1 || m_moveObject[i].type == 47 || m_moveObject[i].type == 48 && !m_blupiSuspend) - { - RECT src; - src.left = m_blupiPos.x + 20; - src.right = m_blupiPos.x + 60 - 20; - src.top = m_blupiPos.y + 60 - 2; - src.bottom = m_blupiPos.y + 60 - 1; - tinyRect.left = m_moveObject[i].posCurrent.x; - tinyRect.right = m_moveObject[i].posCurrent.x + 64; - tinyRect.top = m_moveObject[i].posCurrent.y; - tinyRect.bottom = m_moveObject[i].posCurrent.y + 16; - RECT tinyRect2; - flag = IntersectRect(tinyRect2, tinyRect, src); - tinyPoint = m_moveObject[i].posCurrent; - } - POINT posCurrent; - if (m_blupiFocus && !m_blupiHide && m_moveObject[i].type == 97) - { - posCurrent = m_moveObject[i].posCurrent; - if (posCurrent.x < m_blupiPos.x) - { - posCurrent.x++; - } - if (posCurrent.x > m_blupiPos.x) - { - posCurrent.x--; - } - if (posCurrent.y < m_blupiPos.y) - { - posCurrent.y++; - } - if (posCurrent.y > m_blupiPos.y) - { - posCurrent.y--; - } - tinyRect.left = posCurrent.x + 10; - tinyRect.right = posCurrent.x + 60 - 10; - tinyRect.top = posCurrent.y + 10; - tinyRect.bottom = posCurrent.y + 60 - 10; - if (TestPath(tinyRect, m_moveObject[i].posCurrent, posCurrent)) - { - m_moveObject[i].posCurrent = posCurrent; - m_moveObject[i].posStart = posCurrent; - m_moveObject[i].posEnd = posCurrent; - } - else - { - ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type); - posCurrent.x -= 34; - posCurrent.y -= 34; - ObjectStart(posCurrent, 9, 0); - PlaySound(10, posCurrent); - m_decorAction = 1; - m_decorPhase = 0; - } - } - if (m_moveObject[i].posStart.x != m_moveObject[i].posEnd.x || m_moveObject[i].posStart.y != m_moveObject[i].posEnd.y) - { - if (m_moveObject[i].step == 1) - { - if (m_moveObject[i].time < m_moveObject[i].timeStopStart) - { - moveObject = m_moveObject; - moveObject[i]->time = moveObject[i]->time + 1; - } - else - { - m_moveObject[i].step = 2; - m_moveObject[i].time = 0; - } - } - else if (m_moveObject[i].step == 2) - { - if (m_moveObject[i].posCurrent.x != m_moveObject[i].posEnd.x || m_moveObject[i].posCurrent.x != m_moveObject[i].posEnd.y) - { - MoveObject[] moveObject2 = m_moveObject; - moveObject2[i]->time = moveObject2[i]->time + 1; - if (m_moveObject[i].stepAdvance != 0) - { - m_moveObject[i].posCurrent.x = (m_moveObject[i].posEnd.x - m_moveObject[i].posStart.x) * m_moveObject[i].time / m_moveObject[i].stepAdvance + m_moveObject[i].posStart.x; - m_moveObject[i].posCurrent.y = (m_moveObject[i].posEnd.y - m_moveObject[i].posStart.y) * m_moveObject[i].time / m_moveObject[i].stepAdvance + m_moveObject[i].posStart.y; - } - - } - else if (m_moveObject[i].type == 15 || m_moveObject[i].type == 23) - { - m_moveObject[i].type = 0; - } - else if (m_moveObject[i].type == 34) - { - m_moveObject[i].posStart = m_moveObject[i].posCurrent; - m_moveObject[i].posEnd = m_moveObject[i].posCurrent; - m_moveObject[i].step = 3; - m_moveObject[i].time = 0; - } - else - { - m_moveObject[i].step = 3; - m_moveObject[i].time = 0; - } - } - else if (m_moveObject[i].step == 3) - { - if (m_moveObject[i].time < m_moveObject[i].timeStopEnd) - { - MoveObject[] moveObject3 = m_moveObject; - moveObject3[i]->time = moveObject3[i]->time + 1; - } - else - { - m_moveObject[i].step = 4; - m_moveObject[i].time = 0; - } - } - else if (m_moveObject[i].step == 4) - { - if (m_moveObject[i].posCurrent.x != m_moveObject[i].posStart.x || m_moveObject[i].posCurrent.y != m_moveObject[i].posStart.y) - { - MoveObject[] moveObject4 = m_moveObject; - moveObject4[i]->time = moveObject4[i]->time + 1; - if (m_moveObject[i].stepRecede != 0) - { - m_moveObject[i].posCurrent.x = (m_moveObject[i].posStart.x - m_moveObject[i].posEnd.x) * - m_moveObject[i].time / m_moveObject[i].stepRecede + m_moveObject[i].posEnd.x; - m_moveObject[i].posCurrent.y = (m_moveObject[i].posStart.y - m_moveObject[i].posEnd.y) * - m_moveObject[i].time / m_moveObject[i].stepRecede + m_moveObject[i].posEnd.y; - } - } - else - { - m_moveObject[i].step = 1; - m_moveObject[i].time = 0; - } - } - } - if (m_moveObject[i].type == 22 && m_moveObject[i].step == 3) - { - m_moveObject[i].type = 0; - } - posCurrent = m_moveObject[i].posCurrent; - if (m_moveObject[i].type == 1 || m_moveObject[i].type == 47 || m_moveObject[i].type == 48) - { - posCurrent.y -= 64; - } - posCurrent.x = (posCurrent.x + 32) / 64; - posCurrent.y = (posCurrent.y + 32) / 64; - SetMoveTraj(posCurrent); - if (flag) - { - m_blupiVector.x = m_moveObject[i].posCurrent.x - tinyPoint.x; - m_blupiVector.y = m_moveObject[i].posCurrent.y - (m_blupiPos.y + 60 - BLUPIFLOOR); - if (m_moveObject[i].type == 47) - { - m_blupiVector.x = m_blupiVector.x + 2; - } - if (m_moveObject[i].type == 48) - { - m_blupiVector.x = m_blupiVector.x - 2; - } - if (m_blupiTimeNoAsc == 0) - { - m_blupiTransport = i; - } - } -} - - -/* -void CDecor::MoveObjectStepIcon(int i) -{ - if (m_moveObject[i]->type == 47) - { - m_moveObject[i]->icon = table_chenille[m_moveObject[i]->phase / 1 % 6]; - } - if (m_moveObject[i]->type == 48) - { - m_moveObject[i]->icon = table_chenillei[m_moveObject[i]->phase / 1 % 6]; - } - if (m_moveObject[i]->type == 2) - { - m_moveObject[i]->icon = 12 + m_moveObject[i]->phase / 2 % 9; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 3) - { - m_moveObject[i]->icon = 48 + m_moveObject[i]->phase / 2 % 9; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 16) - { - m_moveObject[i]->icon = 69 + m_moveObject[i]->phase / 1 % 9; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 96) - { - m_moveObject[i]->icon = table_follow1[m_moveObject[i]->phase / 1 % 26]; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 97) - { - m_moveObject[i]->icon = table_follow2[m_moveObject[i]->phase / 1 % 5]; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 200) - { - m_moveObject[i]->icon = 257 + m_moveObject[i]->phase / 1 % 6; - m_moveObject[i]->channel = 2; - } - if (m_moveObject[i]->type == 201) - { - m_moveObject[i]->icon = 257 + m_moveObject[i]->phase / 1 % 6; - m_moveObject[i]->channel = 11; - } - if (m_moveObject[i]->type == 202) - { - m_moveObject[i]->icon = 257 + m_moveObject[i]->phase / 1 % 6; - m_moveObject[i]->channel = 12; - } - if (m_moveObject[i]->type == 203) - { - m_moveObject[i]->icon = 257 + m_moveObject[i]->phase / 1 % 6; - m_moveObject[i]->channel = 13; - } - if (m_moveObject[i]->type == 55) - { - m_moveObject[i]->icon = 252; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 56) - { - m_moveObject[i]->icon = table_dynamitef[m_moveObject[i]->phase / 1 % 100]; - m_moveObject[i]->channel = 10; - if (m_moveObject[i]->phase == 50) - { - DynamiteStart(i, 0, 0); - } - if (m_moveObject[i]->phase == 53) - { - DynamiteStart(i, -100, 8); - } - if (m_moveObject[i]->phase == 55) - { - DynamiteStart(i, 80, 10); - } - if (m_moveObject[i]->phase == 56) - { - DynamiteStart(i, -15, -100); - } - if (m_moveObject[i]->phase == 59) - { - DynamiteStart(i, 20, 70); - } - if (m_moveObject[i]->phase == 62) - { - DynamiteStart(i, 30, -50); - } - if (m_moveObject[i]->phase == 64) - { - DynamiteStart(i, -40, 30); - } - if (m_moveObject[i]->phase == 67) - { - DynamiteStart(i, -180, 10); - } - if (m_moveObject[i]->phase == 69) - { - DynamiteStart(i, 200, -10); - } - if (m_moveObject[i]->phase >= 70) - { - m_moveObject[i]->type = 0; - } - } - if (m_moveObject[i]->type == 5) - { - if (m_moveObject[i]->phase / 3 % 22 < 11) - { - m_moveObject[i]->icon = m_moveObject[i]->phase / 3 % 11; - } - else - { - m_moveObject[i]->icon = 11 - m_moveObject[i]->phase / 3 % 11; - } - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 6) - { - m_moveObject[i]->icon = 21 + m_moveObject[i]->phase / 4 % 8; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 7) - { - m_moveObject[i]->icon = 29 + m_moveObject[i]->phase / 3 % 8; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 21) - { - m_moveObject[i]->icon = table_cle[m_moveObject[i]->phase / 3 % 12]; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 49) - { - m_moveObject[i]->icon = table_cle1[m_moveObject[i]->phase / 3 % 12]; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 50) - { - m_moveObject[i]->icon = table_cle2[m_moveObject[i]->phase / 3 % 12]; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 51) - { - m_moveObject[i]->icon = table_cle3[m_moveObject[i]->phase / 3 % 12]; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 24) - { - m_moveObject[i]->icon = table_skate[m_moveObject[i]->phase / 1 % 34]; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 25) - { - m_moveObject[i]->icon = table_shield[m_moveObject[i]->phase / 2 % 16]; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 26) - { - m_moveObject[i]->icon = table_power[m_moveObject[i]->phase / 2 % 8]; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 40) - { - m_moveObject[i]->icon = table_invert[m_moveObject[i]->phase / 2 % 20]; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 31) - { - m_moveObject[i]->icon = table_charge[m_moveObject[i]->phase / 2 % 6]; - m_moveObject[i]->channel = 1; - } - if (m_moveObject[i]->type == 27) - { - m_moveObject[i]->icon = table_magictrack[m_moveObject[i]->phase / 1 % 24]; - m_moveObject[i]->channel = 10; - if (m_moveObject[i]->phase >= 24) - { - m_moveObject[i]->type = 0; - } - } - if (m_moveObject[i]->type == 57) - { - m_moveObject[i]->icon = table_shieldtrack[m_moveObject[i]->phase / 1 % 20]; - m_moveObject[i]->channel = 10; - if (m_moveObject[i]->phase >= 20) - { - m_moveObject[i]->type = 0; - } - } - if (m_moveObject[i]->type == 39) - { - m_moveObject[i]->icon = table_tresortrack[m_moveObject[i]->phase / 1 % 11]; - m_moveObject[i]->channel = 10; - if (m_moveObject[i]->phase >= 11) - { - m_moveObject[i]->type = 0; - } - } - if (m_moveObject[i]->type == 58 && m_moveObject[i]->phase >= 20) - { - m_moveObject[i]->type = 0; - } - if (m_moveObject[i]->type == 8) - { - if (m_moveObject[i]->phase >= table_explo1->length) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_explo1[m_moveObject[i]->phase]; - m_moveObject[i]->channel = 9; - } - } - if (m_moveObject[i]->type == 9) - { - if (m_moveObject[i]->phase >= 20) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_explo2[m_moveObject[i]->phase % 20]; - m_moveObject[i]->channel = 9; - } - } - if (m_moveObject[i]->type == 10) - { - if (m_moveObject[i]->phase >= 20) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_explo3[m_moveObject[i]->phase / 1 % 20]; - m_moveObject[i]->channel = 9; - } - } - if (m_moveObject[i]->type == 11) - { - if (m_moveObject[i]->phase >= 9) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_explo4[m_moveObject[i]->phase / 1 % 9]; - m_moveObject[i]->channel = 9; - } - } - if (m_moveObject[i]->type == 90) - { - if (m_moveObject[i]->phase >= 12) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_explo5[m_moveObject[i]->phase / 1 % 12]; - m_moveObject[i]->channel = 9; - } - } - if (m_moveObject[i]->type == 91) - { - if (m_moveObject[i]->phase >= 6) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_explo6[m_moveObject[i]->phase / 1 % 6]; - m_moveObject[i]->channel = 9; - } - } - if (m_moveObject[i]->type == 92) - { - if (m_moveObject[i]->phase >= 128) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_explo7[m_moveObject[i]->phase / 1 % 128]; - m_moveObject[i]->channel = 9; - } - } - if (m_moveObject[i]->type == 93) - { - if (m_moveObject[i]->phase >= 5) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_explo8[m_moveObject[i]->phase / 1 % 5]; - m_moveObject[i]->channel = 9; - } - } - if (m_moveObject[i]->type == 98) - { - if (m_moveObject[i]->phase >= 10) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_sploutch1[m_moveObject[i]->phase / 1 % 10]; - m_moveObject[i]->channel = 9; - } - } - if (m_moveObject[i]->type == 99) - { - if (m_moveObject[i]->phase >= 13) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_sploutch2[m_moveObject[i]->phase / 1 % 13]; - m_moveObject[i]->channel = 9; - } - } - if (m_moveObject[i]->type == 100) - { - if (m_moveObject[i]->phase >= 18) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_sploutch3[m_moveObject[i]->phase / 1 % 18]; - m_moveObject[i]->channel = 9; - } - } - if (m_moveObject[i]->type == 53) - { - if (m_moveObject[i]->phase >= 90) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_tentacule[m_moveObject[i]->phase / 2 % 45]; - m_moveObject[i]->channel = 9; - } - } - TinyPoint pos; - if (m_moveObject[i]->type == 52) - { - if (m_moveObject[i]->phase == 0) - { - PlaySound(72, m_moveObject[i]->posStart); - } - if (m_moveObject[i]->phase == 137) - { - PlaySound(73, m_moveObject[i]->posStart); - } - if (m_moveObject[i]->phase >= 157) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_bridge[m_moveObject[i]->phase / 1 % 157]; - m_moveObject[i]->channel = 1; - pos->X = m_moveObject[i]->posStart->X / 64; - pos->Y = m_moveObject[i]->posStart->Y / 64; - m_decor[pos->X, pos->Y]->icon = m_moveObject[i]->icon; - } - } - if (m_moveObject[i]->type == 36) - { - if (m_moveObject[i]->phase >= 16) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_pollution[m_moveObject[i]->phase / 2 % 8]; - m_moveObject[i]->channel = 10; - } - } - if (m_moveObject[i]->type == 41) - { - if (m_moveObject[i]->phase >= 16) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_invertstart[m_moveObject[i]->phase / 2 % 8]; - m_moveObject[i]->channel = 10; - } - } - if (m_moveObject[i]->type == 42) - { - if (m_moveObject[i]->phase >= 16) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_invertstop[m_moveObject[i]->phase / 2 % 8]; - m_moveObject[i]->channel = 10; - } - } - if (m_moveObject[i]->type == 14) - { - if (m_moveObject[i]->phase >= 14) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_plouf[m_moveObject[i]->phase / 2 % 7]; - m_moveObject[i]->channel = 1; - } - } - if (m_moveObject[i]->type == 35) - { - if (m_moveObject[i]->phase >= 6) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_tiplouf[m_moveObject[i]->phase / 2 % 7]; - m_moveObject[i]->channel = 1; - } - } - if (m_moveObject[i]->type == 15) - { - m_moveObject[i]->icon = table_blup[m_moveObject[i]->phase / 2 % 20]; - m_moveObject[i]->channel = 1; - } - if (m_moveObject[i]->type == 4) - { - if (m_moveObject[i]->posStart->X > m_moveObject[i]->posEnd->X) - { - if (m_moveObject[i]->step == 1) - { - m_moveObject[i]->icon = table_bulldozer_turn2l[m_moveObject[i]->time % 22]; - } - if (m_moveObject[i]->step == 3) - { - m_moveObject[i]->icon = table_bulldozer_turn2r[m_moveObject[i]->time % 22]; - } - if (m_moveObject[i]->step == 2) - { - m_moveObject[i]->icon = table_bulldozer_left[m_moveObject[i]->time % 8]; - } - if (m_moveObject[i]->step == 4) - { - m_moveObject[i]->icon = table_bulldozer_right[m_moveObject[i]->time % 8]; - } - } - else - { - if (m_moveObject[i]->step == 1) - { - m_moveObject[i]->icon = table_bulldozer_turn2r[m_moveObject[i]->time % 22]; - } - if (m_moveObject[i]->step == 3) - { - m_moveObject[i]->icon = table_bulldozer_turn2l[m_moveObject[i]->time % 22]; - } - if (m_moveObject[i]->step == 2) - { - m_moveObject[i]->icon = table_bulldozer_right[m_moveObject[i]->time % 8]; - } - if (m_moveObject[i]->step == 4) - { - m_moveObject[i]->icon = table_bulldozer_left[m_moveObject[i]->time % 8]; - } - } - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 17) - { - if (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x) - { - if (m_moveObject[i]->step == 1) - { - m_moveObject[i]->icon = table_poisson_turn2l[m_moveObject[i]->time % 48]; - } - if (m_moveObject[i]->step == 3) - { - m_moveObject[i]->icon = table_poisson_turn2r[m_moveObject[i]->time % 48]; - } - if (m_moveObject[i]->step == 2) - { - m_moveObject[i]->icon = table_poisson_left[m_moveObject[i]->time % 8]; - } - if (m_moveObject[i]->step == 4) - { - m_moveObject[i]->icon = table_poisson_right[m_moveObject[i]->time % 8]; - } - } - else - { - if (m_moveObject[i]->step == 1) - { - m_moveObject[i]->icon = table_poisson_turn2r[m_moveObject[i]->time % 48]; - } - if (m_moveObject[i]->step == 3) - { - m_moveObject[i]->icon = table_poisson_turn2l[m_moveObject[i]->time % 48]; - } - if (m_moveObject[i]->step == 2) - { - m_moveObject[i]->icon = table_poisson_right[m_moveObject[i]->time % 8]; - } - if (m_moveObject[i]->step == 4) - { - m_moveObject[i]->icon = table_poisson_left[m_moveObject[i]->time % 8]; - } - } - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 20) - { - if (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x) - { - if (m_moveObject[i]->step == 1) - { - m_moveObject[i]->icon = table_oiseau_turn2l[m_moveObject[i]->time % 10]; - } - if (m_moveObject[i]->step == 3) - { - m_moveObject[i]->icon = table_oiseau_turn2r[m_moveObject[i]->time % 10]; - } - if (m_moveObject[i]->step == 2) - { - m_moveObject[i]->icon = table_oiseau_left[m_moveObject[i]->time % 8]; - } - if (m_moveObject[i]->step == 4) - { - m_moveObject[i]->icon = table_oiseau_right[m_moveObject[i]->time % 8]; - } - } - else - { - if (m_moveObject[i]->step == 1) - { - m_moveObject[i]->icon = table_oiseau_turn2r[m_moveObject[i]->time % 10]; - } - if (m_moveObject[i]->step == 3) - { - m_moveObject[i]->icon = table_oiseau_turn2l[m_moveObject[i]->time % 10]; - } - if (m_moveObject[i]->step == 2) - { - m_moveObject[i]->icon = table_oiseau_right[m_moveObject[i]->time % 8]; - } - if (m_moveObject[i]->step == 4) - { - m_moveObject[i]->icon = table_oiseau_left[m_moveObject[i]->time % 8]; - } - } - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 44) - { - if (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x) - { - if (m_moveObject[i]->step == 1) - { - m_moveObject[i]->icon = table_guepe_turn2l[m_moveObject[i]->time % 5]; - } - if (m_moveObject[i]->step == 3) - { - m_moveObject[i]->icon = table_guepe_turn2r[m_moveObject[i]->time % 5]; - } - if (m_moveObject[i]->step == 2) - { - m_moveObject[i]->icon = table_guepe_left[m_moveObject[i]->time % 6]; - } - if (m_moveObject[i]->step == 4) - { - m_moveObject[i]->icon = table_guepe_right[m_moveObject[i]->time % 6]; - } - } - else - { - if (m_moveObject[i]->step == 1) - { - m_moveObject[i]->icon = table_guepe_turn2r[m_moveObject[i]->time % 5]; - } - if (m_moveObject[i]->step == 3) - { - m_moveObject[i]->icon = table_guepe_turn2l[m_moveObject[i]->time % 5]; - } - if (m_moveObject[i]->step == 2) - { - m_moveObject[i]->icon = table_guepe_right[m_moveObject[i]->time % 6]; - } - if (m_moveObject[i]->step == 4) - { - m_moveObject[i]->icon = table_guepe_left[m_moveObject[i]->time % 6]; - } - } - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 54) - { - if (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x) - { - if (m_moveObject[i]->step == 1) - { - m_moveObject[i]->icon = table_creature_turn2[m_moveObject[i]->time % 152]; - } - if (m_moveObject[i]->step == 3) - { - m_moveObject[i]->icon = table_creature_turn2[m_moveObject[i]->time % 152]; - } - if (m_moveObject[i]->step == 2) - { - m_moveObject[i]->icon = table_creature_left[m_moveObject[i]->time % 8]; - } - if (m_moveObject[i]->step == 4) - { - m_moveObject[i]->icon = table_creature_right[m_moveObject[i]->time % 8]; - } - } - else - { - if (m_moveObject[i]->step == 1) - { - m_moveObject[i]->icon = table_creature_turn2[m_moveObject[i]->time % 152]; - } - if (m_moveObject[i]->step == 3) - { - m_moveObject[i]->icon = table_creature_turn2[m_moveObject[i]->time % 152]; - } - if (m_moveObject[i]->step == 2) - { - m_moveObject[i]->icon = table_creature_right[m_moveObject[i]->time % 8]; - } - if (m_moveObject[i]->step == 4) - { - m_moveObject[i]->icon = table_creature_left[m_moveObject[i]->time % 8]; - } - } - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 32) - { - if (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x) - { - if (m_moveObject[i]->step == 1) - { - m_moveObject[i]->icon = table_blupih_turn2l[m_moveObject[i]->time % 26]; - } - if (m_moveObject[i]->step == 3) - { - m_moveObject[i]->icon = table_blupih_turn2r[m_moveObject[i]->time % 26]; - } - if (m_moveObject[i]->step == 2) - { - m_moveObject[i]->icon = table_blupih_left[m_moveObject[i]->time % 8]; - } - if (m_moveObject[i]->step == 4) - { - m_moveObject[i]->icon = table_blupih_right[m_moveObject[i]->time % 8]; - } - } - else - { - if (m_moveObject[i]->step == 1) - { - m_moveObject[i]->icon = table_blupih_turn2r[m_moveObject[i]->time % 26]; - } - if (m_moveObject[i]->step == 3) - { - m_moveObject[i]->icon = table_blupih_turn2l[m_moveObject[i]->time % 26]; - } - if (m_moveObject[i]->step == 2) - { - m_moveObject[i]->icon = table_blupih_right[m_moveObject[i]->time % 8]; - } - if (m_moveObject[i]->step == 4) - { - m_moveObject[i]->icon = table_blupih_left[m_moveObject[i]->time % 8]; - } - } - if ((m_moveObject[i]->step == 1 || m_moveObject[i]->step == 3) && m_moveObject[i]->time == 21) - { - pos.x = m_moveObject[i]->posCurrent.x; - pos.y = m_moveObject[i]->posCurrent.y + 40; - if (ObjectStart(pos, 23, 55) != -1) - { - PlaySound(52, pos); - } - } - } - if (m_moveObject[i]->type == 33) - { - if (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x) - { - if (m_moveObject[i]->step == 1) - { - m_moveObject[i]->icon = table_blupit_turn2l[m_moveObject[i]->time % 24]; - } - if (m_moveObject[i]->step == 3) - { - m_moveObject[i]->icon = table_blupit_turn2r[m_moveObject[i]->time % 24]; - } - if (m_moveObject[i]->step == 2) - { - m_moveObject[i]->icon = table_blupit_left[m_moveObject[i]->time % 8]; - } - if (m_moveObject[i]->step == 4) - { - m_moveObject[i]->icon = table_blupit_right[m_moveObject[i]->time % 8]; - } - } - else - { - if (m_moveObject[i]->step == 1) - { - m_moveObject[i]->icon = table_blupit_turn2r[m_moveObject[i]->time % 24]; - } - if (m_moveObject[i]->step == 3) - { - m_moveObject[i]->icon = table_blupit_turn2l[m_moveObject[i]->time % 24]; - } - if (m_moveObject[i]->step == 2) - { - m_moveObject[i]->icon = table_blupit_right[m_moveObject[i]->time % 8]; - } - if (m_moveObject[i]->step == 4) - { - m_moveObject[i]->icon = table_blupit_left[m_moveObject[i]->time % 8]; - } - } - if ((m_moveObject[i]->step == 1 || m_moveObject[i]->step == 3) && m_moveObject[i]->time == 3) - { - int speed; - if ((m_moveObject[i]->posStart.x < m_moveObject[i]->posEnd.x && m_moveObject[i]->step == 1) || (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x && m_moveObject[i]->step == 3)) - { - pos.x = m_moveObject[i]->posCurrent.x - 30; - pos.y = m_moveObject[i]->posCurrent.x + BLUPIOFFY; - speed = -5; - } - else - { - pos.x = m_moveObject[i]->posCurrent.x + 30; - pos.y = m_moveObject[i]->posCurrent.y + BLUPIOFFY; - speed = 5; - } - if (ObjectStart(pos, 23, speed) != -1) - { - PlaySound(52, pos); - } - } - if ((m_moveObject[i]->step == 1 || m_moveObject[i]->step == 3) && m_moveObject[i]->time == 21) - { - int speed; - if ((m_moveObject[i]->posStart.x < m_moveObject[i]->posEnd.x && m_moveObject[i]->step == 1) || (m_moveObject[i]->posStart.x > m_moveObject[i]->posEnd.x && m_moveObject[i]->step == 3)) - { - pos.x = m_moveObject[i]->posCurrent.x + 30; - pos.y = m_moveObject[i]->posCurrent.y + BLUPIOFFY; - speed = 5; - } - else - { - pos.x = m_moveObject[i]->posCurrent.x - 30; - pos.y = m_moveObject[i]->posCurrent.y + BLUPIOFFY; - speed = -5; - } - if (ObjectStart(pos, 23, speed) != -1) - { - PlaySound(52, pos); - } - } - } - if (m_moveObject[i]->type == 34) - { - m_moveObject[i]->icon = table_glu[m_moveObject[i]->phase / 1 % 25]; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 37) - { - if (m_moveObject[i]->phase >= 70) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_clear[m_moveObject[i]->phase / 1 % 70]; - m_moveObject[i]->channel = 10; - } - } - if (m_moveObject[i]->type == 38) - { - if (m_moveObject[i]->phase >= 90) - { - m_moveObject[i]->type = 0; - } - else - { - m_moveObject[i]->icon = table_electro[m_moveObject[i]->phase / 1 % 90]; - if (m_moveObject[i]->phase < 30) - { - m_moveObject[i]->channel = 12; - } - else - { - m_moveObject[i]->channel = 10; - } - } - } - if (m_moveObject[i]->type == 13) - { - m_moveObject[i]->icon = 68; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 46) - { - m_moveObject[i]->icon = 208; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 19) - { - m_moveObject[i]->icon = 89; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 28) - { - m_moveObject[i]->icon = 167; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 23) - { - m_moveObject[i]->icon = 176; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 29) - { - m_moveObject[i]->icon = 177; - m_moveObject[i]->channel = 10; - } - if (m_moveObject[i]->type == 30) - { - m_moveObject[i]->icon = 178; - m_moveObject[i]->channel = 10; - } - MoveObject[] moveObject = m_moveObject; - moveObject[i]->phase = moveObject[i]->phase + 1; - if (m_moveObject[i]->phase > 32700) - { - m_moveObject[i]->phase = 0; - } -} -*/ - -void CDecor::DynamiteStart(int i, int dx, int dy) -{ - POINT posStart = m_moveObject[i].posStart; - posStart.x -= 34; - posStart.y -= 34; - posStart.x += dx; - posStart.y -= dy; - ObjectStart(posStart, 8, 0); - if (dx == 0 && dy == 0) - { - PlaySound(10, posStart); - m_decorAction = 1; - m_decorPhase = 0; - } - RECT src; - src.left = posStart.x; - src.right = posStart.x + 128; - src.top = posStart.y; - src.bottom = posStart.y + 128; - POINT tinyPoint; - for (int j = 0; j < 2; j++) - { - tinyPoint.x = posStart.x / 64; - for (int k = 0; k < 2; j++) - { - if (tinyPoint.x >= 0 && tinyPoint.x < 100 && tinyPoint.y >= 0 && tinyPoint.y < 100) - { - int icon = m_decor[tinyPoint.x, tinyPoint.y]->icon; - if (icon == 378 || icon == 379 || icon == 404 || icon == 410) - { - POINT pos; - pos.x = tinyPoint.x * 64; - pos.y = tinyPoint.y * 64; - ModifDecor(pos, -1); - } - } - tinyPoint.x++; - } - tinyPoint.y++; - } - for (i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i].type == 2 || m_moveObject[i].type == 3 || m_moveObject[i].type == 96 || m_moveObject[i].type == 97 || m_moveObject[i].type == 4 || - m_moveObject[i].type == 6 || m_moveObject[i].type == 12 || m_moveObject[i].type == 13 || m_moveObject[i].type == 16 || m_moveObject[i].type == 17 || - m_moveObject[i].type == 19 || m_moveObject[i].type == 20 || m_moveObject[i].type == 24 || m_moveObject[i].type == 25 || m_moveObject[i].type == 26 || m_moveObject[i].type == 28 || - m_moveObject[i].type == 30 || m_moveObject[i].type == 32 || m_moveObject[i].type == 33 || m_moveObject[i].type == 34 || m_moveObject[i].type == 40 || m_moveObject[i].type == 44 || - m_moveObject[i].type == 46 || m_moveObject[i].type == 52 || m_moveObject[i].type == 54 || m_moveObject[i].type == 200 || m_moveObject[i].type == 201 || m_moveObject[i].type == 202 || - m_moveObject[i].type == 203) - { - RECT src2; - src2.left = m_moveObject[i].posCurrent.x; - src2.right = m_moveObject[i].posCurrent.x + 60; - src2.top = m_moveObject[i].posCurrent.y; - src2.bottom = m_moveObject[i].posCurrent.y + 20; - RECT tinyRect; - if (IntersectRect(tinyRect, src2, src)) - { - if (m_moveObject[i].type == 12) - { - SearchLinkCaisse(i, TRUE); - for (int l = 0; l < m_nbLinkCaisse; l++) - { - int channel = m_moveObject[m_linkCaisse[l]]->channel; - int icon2 = m_moveObject[m_linkCaisse[l]]->icon; - POINT posCurrent = m_moveObject[m_linkCaisse[l]]->posCurrent; - double num = (double)Random(7, 23); - if (m_random->next(0, 100) % 2 == 0) - { - num = -num; - } - ByeByeAdd(channel, icon2, posCurrent, num, 1.0); - m_moveObject[m_linkCaisse[l]]->type = 0; - } - ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type); - UpdateCaisse(); - } - else - { - ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type); - } - } - } - } - if (m_blupiFocus && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiPos.x > posStart.x - 30 && m_blupiPos.x < posStart.x + 30 + 64 && m_blupiPos.y > posStart.y - 30 && m_blupiPos.y < posStart.y + 30 + 64) - { - BlupiDead(11, -1); - m_blupiAir = TRUE; - } - -} - -int CDecor::AscenseurDetect(RECT rect, POINT oldpos, POINT newpos) -{ - if (m_blupiTimeNoAsc != 0) - { - return -1; - } - int num = newpos.y - oldpos.y; - int num2; - if (num < 0) - { - num2 = -30; - } - else - { - num2 = 30; - } - num = abs(num); - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i].type == 1 || m_moveObject[i].type == 47 || m_moveObject[i].type == 48) - { - RECT src; - src.left = m_moveObject[i]->posCurrent.x; - src.right = m_moveObject[i]->posCurrent.x + 64; - src.top = m_moveObject[i]->posCurrent.y; - src.bottom = m_moveObject[i]->posCurrent.y + 16; - if (num < 30) - { - RECT tinyRect; - if (IntersectRect(tinyRect, src, rect)) - { - return i; - } - } - else - { - RECT src2 = rect; - src2.top -= num / 30 * num2; - src2.bottom -= num / 30 * num2; - for (int j = 0; j <= num / 30; j++) - { - RECT tinyRect; - if (IntersectRect(tinyRect, src, src2)) - { - return i; - } - src2.top += num2; - src2.bottom += num; - } - } - - } - } - return -1; -} - -void CDecor::AscenseurVertigo(int i, BOOL bVertigoLeft, BOOL bVertigoRight) -{ - bVertigoLeft = FALSE; - bVertigoRight = FALSE; - if (m_blupiPos.x + 20 + 4 < m_moveObject[i]->posCurrent.x) - { - bVertigoLeft = TRUE; - } - if (m_blupiPos.x + 60 - 20 - 4 > m_moveObject[i]->posCurrent.x + 64) - { - bVertigoRight = TRUE; - } - if (AscenseurShift(i)) - { - if (bVertigoLeft) - { - bVertigoLeft = FALSE; - bVertigoRight = TRUE; - m_blupiTimeNoAsc = 10; - return; - } - if (bVertigoRight) - { - bVertigoRight = FALSE; - bVertigoLeft = TRUE; - m_blupiTimeNoAsc = 10; - } - } -} - - - -void CDecor::ByeByeHelico() -{ - if (m_blupiHelico) - { - ByeByeAdd(10, 68, m_blupiPos, 7.0, 0.5); - } -} - -void CDecor::ByeByeAdd(ByeByeObject byeByeObject, int channel, int icon, POINT pos, double rotationSpeed, double animationSpeed) -{ - int num = Random(0, 10); - if (Random(0, 1000) % 2 == 0) - { - byeByeObject.speedX = (double)(num + 10); - } - else - { - byeByeObject.speedX = (double)(-(double)(num + 10)); - } - byeByeObjects->add(byeByeObject); -} - -void CDecor::ByeByeStep() -{ - int i = 0; - while (i < byeByeObjects.Count) - { - ByeByeObject byeByeObject = byeByeObjects[i]; - double num = 10.0 - byeByeObject->phase; - if (num > 0.0) - { - byeByeObject.posY -= pow(num, 1.5) * - byeByeObject.animationSpeed; - } - if (num < 0.0) - { - byeByeObject.posY += pow(-num, 1.5) * - byeByeObject.animationSpeed; - } - byeByeObject.posX += byeByeObject.speedX * - byeByeObject.animationSpeed; - if (byeByeObject.speedX > 0.0) - { - byeByeObject.speedX -= byeByeObject.animationSpeed; - } - if (byeByeObject.speedX < 0.0) - { - byeByeObject.speedX += byeByeObject.animationSpeed; - } - byeByeObject.rotation += byeByeObject.rotationSpeed; - byeByeObject.phase += byeByeObject.animationSpeed; - if (byeByeObject.channel == 10 && byeByeObject.icon >= 187 && byeByeObject.icon <= 194) - { - byeByeObject.icon = table_invert[(int)byeByeObject.phase / 2 % 20]; - } - if (byeByeObject.phase > 30.0) - { - byeByeObjects.RemoveAt(i); - } - else - { - i++; - } - } -} - -void CDecor::ByeByeDraw(POINT posDecor) -{ - for (ByeByeObject byeByeObject in byeByeObjects) - { - POINT pos = new POINT; - { - - } - - } -} - -BOOL CDecor::AscenseurShift(int i) -{ - return i != -1 && m_moveObject[i]->icon >= 311 && m_moveObject[i]->icon <= 316; -} - -void CDecor::AscenseurSynchro(int i) -{ - for (i = 0; i < MAXMOVEOBJECT; i++) - { - m_moveObject[i]->posCurrent = m_moveObject[i]->posStart; - m_moveObject[i]->step = 1; - m_moveObject[i]->time = 0; - m_moveObject[i]->phase = 0; - } -} - -int CDecor::CaisseInFront() -{ - POINT tinyPoint; - if (m_blupiDir == 1) - { - tinyPoint.x = m_blupiPos.x + 16 - 32; - tinyPoint.y = m_blupiPos.y; - } - else - { - tinyPoint.x = m_blupiPos.x + 60 - 16 + 32; - tinyPoint.y = m_blupiPos.y; - } - for (int i = 0; i < m_nbRankCaisse; i++) - { - int num = m_rankCaisse[i]; - if (tinyPoint.x > m_moveObject[num]->posCurrent.x && - tinyPoint.x < m_moveObject[num]->posCurrent.x + 64 && - tinyPoint.y > m_moveObject[num]->posCurrent.y && - tinyPoint.y < m_moveObject[num]->posCurrent.y + 64) - { - return num; - } - } - return -1; -} - -int CDecor::CaisseGetMove(int max) -{ - max -= (m_nbLinkCaisse - 1) / 2; - if (max < 1) - { - max = 1; - } - if (m_blupiPower) - { - max *= 2; - } - if (m_blupiPhase < 20) - { - max = max * m_blupiPhase / 20; - if (max == 0) - { - max++; - } - } - return max; -} - -int CDecor::MockeryDetect(POINT pos) -{ - if (m_blupiTimeMockery > 0) - { - return 0; - } - if (m_blupiAir) - { - POINT tinyPoint; - tinyPoint.x = pos.x + 30; - tinyPoint.y = pos.y + 30 + 64; - if (tinyPoint.x >= 0 && tinyPoint.x < 6400 && tinyPoint.y >= 0 && tinyPoint.y < 6400) - { - int icon = m_decor[tinyPoint.x / 64, tinyPoint.y / 64]->icon; - if (icon == 68 || icon == 317) - { - return 64; - } - } - } - RECT src; - src.left = pos.x; - src.right = pos.x + 60; - src.top = pos.y + 11; - src.bottom = pos.y + 60; - if (m_blupiAir) - { - src.bottom += 90; - } - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i]->type == 2 || - m_moveObject[i]->type == 16 || - m_moveObject[i]->type == 96 || - m_moveObject[i]->type == 97 || - m_moveObject[i]->type == 4 || - m_moveObject[i]->type == 20 || - m_moveObject[i]->type == 44 || - m_moveObject[i]->type == 54 || - m_moveObject[i]->type == 23 || - m_moveObject[i]->type == 32 || - m_moveObject[i]->type == 33) - { - RECT src2; - src2.left = m_moveObject[i]->posCurrent.x; - src2.right = m_moveObject[i]->posCurrent.x + 60; - src2.top = m_moveObject[i]->posCurrent.y + 36; - src2.bottom = m_moveObject[i]->posCurrent.y + 60; - RECT tinyRect; - if (IntersectRect(tinyRect, src2, src)) - { - if (m_moveObject[i]->type == 54) - { - return 83; - } - if (m_blupiDir == 2) - { - if (pos.x >= src2.left) - { - return 64; - } - if (m_moveObject[i]->type == 2) - { - return 0; - } - return 63; - } - else - { - if (pos.x < src2.left) - { - return 64; - } - if (m_moveObject[i]->type == 2) - { - return 0; - } - return 63; - } - } - } - } - return 0; -} - -BOOL CDecor::BlupiElectro(POINT pos) -{ - if (m_blupiCloud) - { - return FALSE; - } - RECT src; - src.left = pos.x + 16; - src.right = pos.x + 60 - 16; - src.top = pos.y + 11; - src.bottom = pos.y + 60 - 2; - RECT src2; - src2.left = m_blupiPos.x - 16 - 40; - src2.right = m_blupiPos.x + 60 + 16 + 40; - src2.top = m_blupiPos.y + 11 - 40; - src2.bottom = m_blupiPos.y + 60 - 2 + 40; - RECT tinyRect; - return IntersectRect(tinyRect, src, src2); -} - -void CDecor::MoveObjectFollow(POINT pos) -{ - if (m_blupiHide) - { - return; - } - RECT src = BlupiRect(pos); - src.left = pos.x + 16; - src.right = pos.x + 60 - 16; - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i]->type == 96) - { - RECT src2; - src2.left = m_moveObject[i]->posCurrent.x - 100; - src2.right = m_moveObject[i]->posCurrent.x + 60 + 100; - src2.top = m_moveObject[i]->posCurrent.y - 100; - src2.bottom = m_moveObject[i]->posCurrent.y + 60 + 100; - RECT tinyRect; - if (IntersectRect(tinyRect, src2, src)) - { - m_moveObject[i]->type = 97; - PlaySound(92, m_moveObject[i]->posCurrent); - } - } - } -} - -int CDecor::MoveObjectDetect(POINT pos, BOOL bNear) -{ - RECT src = BlupiRect(pos); - src.left = pos.x + 16; - src.right = pos.x + 60 - 16; - RECT src2; - src2.left = src.left - 20; - src2.right = src.right + 20; - src2.top = src.top - 40; - src2.bottom = src.bottom + 30; - - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i]->type != 0 && - m_moveObject[i]->type != 27 && - m_moveObject[i]->type != 57 && - m_moveObject[i]->type != 39 && - m_moveObject[i]->type != 58 && - m_moveObject[i]->type != 34 && - m_moveObject[i]->type != 37 && - m_moveObject[i]->type != 38 && - (m_blupiAction != 14 && m_blupiAction != 29) || - m_moveObject[i]->type != 12) - { - RECT src3; - - } - } -} - -int CDecor::MoveAscenseurDetect(POINT pos, int height) -{ - if (m_blupiTimeNoAsc != 0) - { - return -1; - } - RECT src; - src.left = pos.x + 12; - src.right = pos.x + 60 - 12; - src.top = pos.y + 60 - 2; - src.bottom = pos.y + 60 + height - 1; - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i]->type == 1 || m_moveObject[i]->type == 47 || m_moveObject[i]->type == 48) - { - RECT src2; - src2.left = m_moveObject[i]->posCurrent.x; - src2.right = m_moveObject[i]->posCurrent.x + 64; - src2.top = m_moveObject[i]->posCurrent.y; - src2.bottom = m_moveObject[i]->posCurrent.y + 16; - RECT tinyRect; - if (IntersectRect(tinyRect, src2, src)) - { - return i; - } - } - } - return -1; -} - -int CDecor::MoveChargeDetect(POINT pos) -{ - RECT src; - src.left = pos.x + 16; - src.right = pos.x + 60 - 16; - src.top = pos.y + 11; - src.bottom = pos.y + 60 - 2; - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i]->type == 31) - { - RECT src2; - src2.left = m_moveObject[i]->posCurrent.x - 10; - src2.right = m_moveObject[i]->posCurrent.x + 60 + 10; - src2.top = m_moveObject[i]->posCurrent.y + 36; - src2.bottom = m_moveObject[i]->posCurrent.y + 60; - RECT tinyRect; - if (IntersectRect(tinyRect, src2, src)) - { - return i; - } - } - } - return -1; -} - -int CDecor::MovePersoDetect(POINT pos) -{ - RECT src; - src.left = pos.x + 16; - src.right = pos.x + 60 - 16; - src.top = pos.y + 11; - src.bottom = pos.y + 60 - 2; - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i]->type >= 200 && m_moveObject[i]->type <= 203) - { - RECT src2; - src2.left = m_moveObject[i]->posCurrent.x - 16; - src2.right = m_moveObject[i]->posCurrent.x + 60 + 16; - src2.top = m_moveObject[i]->posCurrent.y + 36; - src2.bottom = m_moveObject[i]->posCurrent.y + 60; - RECT tinyRect; - if (IntersectRect(tinyRect, src2, src)) - { - return i; - } - } - } - return -1; -} - -int CDecor::MoveObjectDelete(POINT cel) -{ - int result = -1; - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i]->type != 0) - { - if (cel.x == m_moveObject[i]->posStart.x / 64 && cel.y == m_moveObject[i]->posStart.y / 64) - { - result = m_moveObject[i]->type; - m_moveObject[i]->type = 0; - } - else if (cel.x == m_moveObject[i]->posEnd.x / 64 && cel.y == m_moveObject[i]->posEnd.y / 64) - { - result = m_moveObject[i]->type; - m_moveObject[i]->type = 0; - } - } - } - return result; -} - -int CDecor::MoveObjectFree() -{ - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i]->type == 0) - { - m_moveObject[i]->type = 0; - return i; - } - } - return -1; -} - -int CDecor::SortGetType(int type) -{ - if (type == 2 || type == 3 || type == 96 || type == 97) - { - return 1; - } - if (type == 12) - { - return 2; - } - return 3; -} - -void CDecor::MoveObjectSort() -{ - MoveObject src = default(MoveObject); - int num = 0; - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i]->type != 0) - { - MoveObjectCopy(m_moveObject[num++], m_moveObject[i]); - } - } - for (int i = num; i < MAXMOVEOBJECT; i++) - { - m_moveObject[i]->type = 0; - } - if (num <= 1) - { - return; - } - BOOL flag; - do - { - flag = FALSE; - for (int i = 0; i < num - 1; i++) - { - if (SortGetType(m_moveObject[i]->type) > SortGetType(m_moveObject[i + 1]->type)) - { - MoveObjectCopy(src, m_moveObject[i]); - MoveObjectCopy(m_moveObject[i], m_moveObject[i + 1]); - MoveObjectCopy(m_moveObject[i + 1], src); - flag = TRUE; - } - } - } while (flag); - UpdateCaisse(); - m_nbLinkCaisse = 0; -} - -int CDecor::MoveObjectSearch(POINT pos) -{ - return MoveObjectSearch(pos, -1); -} - -int CDecor::MoveObjectSearch(POINT pos, int type) -{ - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - if (m_moveObject[i]->type != 0 && (type == -1 || - m_moveObject[i]->type == type)) - { - if (m_moveObject[i]->type == 23 && - m_moveObject[i]->posStart.x != m_moveObject[i]->posEnd.x) - { - if (m_moveObject[i]->posCurrent.x >= pos.x - 100 && - m_moveObject[i]->posCurrent.x <= pos.x + 100 && - m_moveObject[i]->posCurrent.y == pos.y) - { - return i; - } - } - else if (m_moveObject[i]->type == 23 && - m_moveObject[i]->posStart.y != m_moveObject[i]->posEnd.y) - { - if (m_moveObject[i]->posCurrent.y >= pos.y - 100 && - m_moveObject[i]->posCurrent.y <= pos.y + 100 && - m_moveObject[i]->posCurrent.x == pos.x) - { - return i; - } - } - else if (m_moveObject[i]->posCurrent.x == pos.x && - m_moveObject[i]->posCurrent.y == pos.y) - { - return i; - } - } - } - return -1; + return { nbVies * 20 - 5, 417 }; } void CDecor::VoyageInit(POINT start, POINT end, int icon, int channel) @@ -9319,11 +1541,153 @@ void CDecor::VoyageInit(POINT start, POINT end, int icon, int channel) } } -// Add VoyageStep +void CDecor::VoyageStep() +{ -// Add VoyageDraw +} -BOOL CDecor::IsFloatingObject(int i) +void CDecor::VoyageDraw() +{ + +} + +BOOL CDecor::DrawMap(BOOL bPlay, int team) +{ + +} + +BOOL CDecor::SearchWorld(int world, POINT *blupi, int *dir) +{ + +} + +BOOL CDecor::SearchDoor(int n, POINT *cel, POINT *blupi) +{ + for (int i = 0; i < 100; i++) + { + for (int j = 0; j < 100; j++) + { + int icon = m_decor[i][j].icon; + if (icon >= 174 && icon <= 181 && icon - 174 + 1 == n) + { + if (i > 0 && m_decor[i - 1, j]->icon == 182) + { + cel.x = i - 1; + cel.y = j; + blupi.x = (i - 2) * 64 + 2; + blupi.y = j * 64 + BLUPIOFFY; + return TRUE; + } + if (i > 1 && m_decor[i - 2, j]->icon == 182) + { + cel.x = i - 2; + cel.y = j; + blupi.x = (i - 3) * 64 + 2; + blupi.y = j * 64 + BLUPIOFFY; + return TRUE; + } + if (i < 99 && m_decor[i + 1, j]->icon == 182) + { + cel.x = i + 1; + cel.y = j; + blupi.x = (i + 2) * 64 + 2; + blupi.y = j * 64 + BLUPIOFFY; + return TRUE; + } + if (i < 98 && m_decor[i + 2, j]->icon == 182) + { + cel.x = i + 2; + cel.y = j; + blupi.x = (i + 3) * 64 + 2; + blupi.y = j * 64 + BLUPIOFFY; + return TRUE; + } + } + } + } + return FALSE; +} + +void CDecor::AdaptDoors(BOOL bPrivate, int mission) +{ + +} + +void CDecor::OpenDoorsTresor() +{ + for (int i = 0; i < 100; i++) + { + for (int j = 0; j < 100; j++) + { + int icon = m_decor[i][j].icon; + if (icon >= 421 && icon <= 421 + m_nbTresor - 1) + { + POINT cel; + cel.x = i; + cel.y = j; + OpenDoor(cel); + } + } + } +} + +void CDecor::OpenDoor(POINT cel) +{ + int icon = m_decor[cel.x, cel.y]->icon; + m_decor[cel.x, cel.y]->icon = -1; + int num = MoveObjectFree(); + m_moveObject[num].type = 22; + m_moveObject[num].stepAdvance = 50; + m_moveObject[num].stepRecede = 1; + m_moveObject[num].timeStopStart = 0; + m_moveObject[num].timeStopEnd = 0; + m_moveObject[num].posStart.x = 64 * cel.x; + m_moveObject[num].posStart.y = 64 * cel.y; + m_moveObject[num].posEnd.x = 64 * cel.x; + m_moveObject[num].posEnd.y = 64 * (cel.y - 1); + m_moveObject[num].posCurrent = m_moveObject[num].posStart; + m_moveObject[num].step = 1; + m_moveObject[num].time = 0; + m_moveObject[num].phase = 0; + m_moveObject[num].channel = 1; + m_moveObject[num].icon = icon; + PlaySoundB(33, m_moveObject[num].posStart); +} + +void CDecor::OpenDoorsWin() +{ + m_doors[m_mission + 1] = 1; +} + +void CDecor::OpenGoldsWin() +{ + m_doors[180 + m_mission / 10] = 1; +} + +void CDecor::DoorsLost() +{ + m_nbVies = 3; + // more... +} + +// BOOL CDecor::SearchGold(int n, POINT cel) +{ + for (int i = 99; i >= 0; i--) + { + for (int j = 99; j >= 0; j--) + { + if (m_decor[j][i].icon == 183) + { + cel.x = j; + cel.y = i; + return TRUE; + } + } + } + return FALSE; +} + +// BOOL CDecor::IsFloatingObject(int i) { POINT posCurrent = m_moveObject[i]->posCurrent; int num = (posCurrent.x + 32) / 64; @@ -9332,662 +1696,32 @@ BOOL CDecor::IsFloatingObject(int i) return IsPassIcon(icon); } -// Add IsRightBorder - -BOOL CDecor::IsFromage(int x, int y) +// BOOL CDecor::IsNormalJump(POINT pos) { - if (x < 0 || x >= 100 || y < 0 || y >= 100) + pos.x += 32; + pos.y -= 32; + if (m_blupiDir == 1) { - return FALSE; - } - int icon = m_decor[x, y]->icon; - return (icon >= 246 && icon <= 249) || icon == 339; -} - -BOOL CDecor::IsGrotte(int x, int y) -{ - if (x < 0 || x >= 100 || y < 0 || y >= 100) - { - return FALSE; - } - int icon = m_decor[x, y]->icon; - return icon = 284 || icon == 301 || icon == 337; -} - -void CDecor::AdaptMidBorder(int x, int y) -{ - if (x < 0 || x >= 100 || y < 0 || y >= 100) - { - return; - } - int num = 15; - if (!IsRightBorder(x, y + 1, 0, -1)) - { - num &= -2; - } - if (!IsRightBorder(x, y + 1, 0, 1)) - { - num &= -3; - } - if (!IsRightBorder(x + 1, y, -1, 0)) - { - num &= -5; - } - if (!IsRightBorder(x - 1, y, 1, 0)) - { - num &= -9; - } - int num2 = m_decor[x, y]->icon; - if (num2 == 156) - { - num2 = 35; - } - if (num2 == 252 || num2 == 253) - { - num2 = 251; - } - if (num2 == 255) - { - num2 = 254; - } - if (num2 == 362) - { - num2 = 347; - } - if (num2 == 363) - { - num2 = 348; - } - if (num2 >= 341 && num2 <= 346) - { - num2 = 341; - } - for (int i = 0; i < 144; i++) - { - if (num2 == table_adapt_decor[i]) - { - num2 = table_adapt_decor[i / 16 * 16 + num]; - if (num2 == 35 && m_random->next() % 2 == 0) - { - num2 = 156; - } - if (num2 == 251) - { - num2 = m_random->next(251, 253); - } - if (num2 == 254 && m_random->next() % 2 == 0) - { - num2 = 255; - } - if (num2 == 347 && m_random->next() % 2 == 0) - { - num2 = 362; - } - if (num2 == 348 && m_random->next() % 2 == 0) - { - num2 = 363; - } - if (num2 == 341) - { - num2 = m_random->next(341, 346); - } - m_decor[x, y]->icon = num2; - return; - } - } - num2 = m_decor[x, y]->icon; - if (num2 == -1 || (num2 >= 264 && num2 <= 282)) - { - num = 15; - if (!IsFromage(x, y + 1)) - { - num &= -2; - } - if (!IsFromage(x, y - 1)) - { - num &= -3; - } - if (!IsFromage(x + 1, y)) - { - num &= -5; - } - if (!IsFromage(x - 1, y)) - { - num &= -9; - } - num2 = table_adapt_fromage[num]; - if (num2 == 268 && m_random->next() % 2 == 0) - { - num2 = 279; - } - if (num2 == 269 && m_random->next() % 2 == 0) - { - num2 = 280; - } - if (num2 == 264 && m_random->next() % 2 == 0) - { - num2 = 281; - } - if (num2 == 265 && m_random->next() % 2 == 0) - { - num2 = 282; - } - m_decor[x, y]->icon = num2; - } - num2 = m_decor[x, y]->icon; - if (num2 == -1 || (num2 >= 285 && num2 <= 303 && num2 != 301)) - { - num = 15; - if (!IsGrotte(x, y + 1)) - { - num &= -2; - } - if (!IsGrotte(x, y - 1)) - { - num &= -3; - } - if (!IsGrotte(x + 1, y)) - { - num &= -5; - } - if (!IsGrotte(x - 1, y)) - { - num &= -9; - } - num2 = table_adapt_fromage[num + 16]; - if (num2 == 289 && m_random->next() % 2 == 0) - { - num2 == 300; - } - if (num2 == 285 && m_random->next() % 2 == 0) - { - num2 = 302; - } - if (num2 == 286 && m_random->next() % 2 == 0) - { - num2 = 303; - } - m_decor[x, y]->icon = num2; - } -} - -void CDecor::AdaptBorder(POINT cel) -{ - AdaptMidBorder(cel.x, cel.y); - AdaptMidBorder(cel.x + 1, cel.y); - AdaptMidBorder(cel.x - 1, cel.y); - AdaptMidBorder(cel.x, cel.y + 1); - AdaptMidBorder(cel.x, cel.y - 1); - int icon = m_decor[cel.x, cel.y]->icon; - if (icon != -1 && !IsPassIcon(icon)) - { - MoveObjectDelete(cel); - } - icon = m_decor[cel.x, cel.y]->icon; - if (icon == 304) - { - for (int i = 0; i < 4; i++) - { - cel.y++; - if (cel.y >= 100) - { - break; - } - icon = m_decor[cel.x, cel.y]->icon; - if (icon != -1) - { - break; - } - m_decor[cel.x, cel.y]->icon = 305; - } - } - if (icon == -1) - { - for (int i = 0; i < 4; i++) - { - cel.y++; - if (cel.y >= 100) - { - return; - } - icon = m_decor[cel.x, cel.y]->icon; - if (icon != 305) - { - return; - } - m_decor[cel.x, cel.y]->icon = -1; - } - } -} - -BOOL CDecor::SearchDoor(int n, POINT cel, POINT blupi) -{ - for (int i = 0; i < 100; i++) - { - for (int j = 0; j < 100; j++) - { - int icon = m_decor[i][j].icon; - if (icon >= 174 && icon <= 181 && icon - 174 + 1 == n) - { - if (i > 0 && m_decor[i - 1, j]->icon == 182) - { - cel.x = i - 1; - cel.y = j; - blupi.x = (i - 2) * 64 + 2; - blupi.y = j * 64 + BLUPIOFFY; - return TRUE; - } - if (i > 1 && m_decor[i - 2, j]->icon == 182) - { - cel.x = i - 2; - cel.y = j; - blupi.x = (i - 3) * 64 + 2; - blupi.y = j * 64 + BLUPIOFFY; - return TRUE; - } - if (i < 99 && m_decor[i + 1, j]->icon == 182) - { - cel.x = i + 1; - cel.y = j; - blupi.x = (i + 2) * 64 + 2; - blupi.y = j * 64 + BLUPIOFFY; - return TRUE; - } - if (i < 98 && m_decor[i + 2, j]->icon == 182) - { - cel.x = i + 2; - cel.y = j; - blupi.x = (i + 3) * 64 + 2; - blupi.y = j * 64 + BLUPIOFFY; - return TRUE; - } - } - } - } - return FALSE; -} - -BOOL CDecor::SearchGold(int n, POINT cel) -{ - for (int i = 99; i >= 0; i--) - { - for (int j = 99; j >= 0; j--) - { - if (m_decor[j][i].icon == 183) - { - cel.x = j; - cel.y = i; - return TRUE; - } - } - } - return FALSE; -} - -void CDecor::OpenDoorsTresor() -{ - for (int i = 0; i < 100; i++) - { - for (int j = 0; j < 100; j++) - { - int icon = m_decor[i][j].icon; - if (icon >= 421 && icon <= 421 + m_nbTresor - 1) - { - POINT cel; - cel.x = i; - cel.y = j; - OpenDoor(cel); - } - } - } -} - -void CDecor::OpenDoor(POINT cel) -{ - int icon = m_decor[cel.x, cel.y]->icon; - m_decor[cel.x, cel.y]->icon = -1; - int num = MoveObjectFree(); - m_moveObject[num].type = 22; - m_moveObject[num].stepAdvance = 50; - m_moveObject[num].stepRecede = 1; - m_moveObject[num].timeStopStart = 0; - m_moveObject[num].timeStopEnd = 0; - m_moveObject[num].posStart.x = 64 * cel.x; - m_moveObject[num].posStart.y = 64 * cel.y; - m_moveObject[num].posEnd.x = 64 * cel.x; - m_moveObject[num].posEnd.y = 64 * (cel.y - 1); - m_moveObject[num].posCurrent = m_moveObject[num].posStart; - m_moveObject[num].step = 1; - m_moveObject[num].time = 0; - m_moveObject[num].phase = 0; - m_moveObject[num].channel = 1; - m_moveObject[num].icon = icon; - PlaySound(33, m_moveObject[num].posStart); -} - -void CDecor::OpenDoorsWin() -{ - m_doors[m_mission + 1] = 1; -} - -void CDecor::OpenGoldsWin() -{ - m_doors[180 + m_mission / 10] = 1; -} - -void CDecor::DoorsLost() -{ - m_nbVies = 3; -} - -void CDecor::OutputNetDebug(char* text) -{ - char textbuffer[100]; - - if (m_bNetDebug != FALSE) - { - sprintf(textbuffer, "/ snd=%d(%d)_rcv=%d(%d)", m_netPacketsSent, m_netPacketsSent2, m_netPacketsRecieved, m_netPacketsRecieved2); - - } -} - -void CDecor::InitalizeDoors(GameData gameData) -{ - gameData.GetDoors(m_doors); -} - -void CDecor::GetBlupiInfo(BOOL* bHelico, BOOL* bJeep, BOOL* bSkate, BOOL* bNage) -{ - bHelico = m_blupiHelico; - bJeep = (m_blupiJeep | m_blupiTank); - bSkate = m_blupiSkate; - bNage = (m_blupiNage | m_blupiSurf); -} - -void CDecor::MoveObjectSort() -{ - MoveObject src = default (MoveObject); - int num = 0; - for (int i = 0; i < MAXMOVEOBJECT; i++) - { - - } -} - -char CDecor::GetMissionTitle() -{ - return m_missionTitle; -} - -void CDecor::GetMissionsCleared() -{ - -} - -void CDecor::GetMissionPath(char* str, int user, int mission, BOOL bUser) -{ - if (bUser != 0) - { - sprintf(str, "data\%.3d-%.3d.blp", user, mission); - AddUserPath(str); - return; - } - sprintf(str, "data\world%.3d.blp", mission); - AddUserPath(str); - return; -} - -void CDecor::SetDemoState(BOOL demoState) -{ - m_demoState = demoState; -} - -BOOL CDecor::CurrentWrite(int gamer, int mission, BOOL bUser) -{ - char filename[MAX_PATH]; - FILE* file = NULL; - DescFile* pBuffer = NULL; - int nb, i; - - InitDecor(); - GetMissionPath(filename, gamer, mission, bUser); - - file = fopen(filename, "wb"); - if (file == NULL) goto error; - - pBuffer = (DescFile*)malloc(sizeof(DescFile)); - if (pBuffer == NULL) goto error; - memset(pBuffer, 0, sizeof(DescFile)); - - pBuffer->cameraPos = m_posDecor; - pBuffer->worldDim = m_dimDecor; - pBuffer->music = m_music; - pBuffer->region = m_region; - - for (i = 0; i < MAXBUTTON; i++) - { - pBuffer->ButtonExist[i] = m_buttonExist[i]; - } - for (i = 0; i < 4; i++) - { - pBuffer->memoPos[i] = m_memoPos[i]; - } - -error: - if (pBuffer != NULL) free(pBuffer); - if (file != NULL) fclose(file); - return FALSE; -} - -BOOL CDecor::Read(int gamer, int mission, BOOL bUser) -{ - char filename[MAX_PATH]; - FILE* file = NULL; - DescFile* pBuffer = NULL; - int majRev, minRev; - int nb, i, x, y; - OldBlupi oldBlupi; - - Init(-1, -1); - - if (bUser) - { - sprintf(filename, "data\\user%.3d.blp", rank); - AddUserPath(filename); + pos.x -= 15; } else { - sprintf(filename, "data\\world%.3d.blp", rank); - if (rank < 200) + pos.x += 15; + } + for (int i = 0; i < 2; i++) + { + int num = pos.x / 64; + int num2 = pos.y / 64; + if (num2 < 0) { - AddCDPath(filename); + return FALSE; } - } - - file = fopen(filename, "rb"); - if (file == NULL) goto error; - - pBuffer = (DescFile*)malloc(sizeof(DescFile)); - if (pBuffer == NULL) goto error; - - nb = fread(pBuffer, sizeof(DescFile), 1, file); - if (nb < 1) goto error; - - majRev = pBuffer->majRev; - minRev = pBuffer->minRev; - - if (majRev == 1 && minRev == 0) goto error; - - if (majRev == 1 && minRev == 3) - { - if (pBuffer->nbDecor != MAXCELX * MAXCELY || - pBuffer->lgDecor != sizeof(Cellule) || - pBuffer->nbBlupi != MAXBLUPI || - pBuffer->lgBlupi != sizeof(OldBlupi) || - pBuffer->nbMove != MAXMOVE || - pBuffer->lgMove != sizeof(Move)) goto error; - } - else - { - if (pBuffer->nbDecor != MAXCELX * MAXCELY || - pBuffer->lgDecor != sizeof(Cellule) || - pBuffer->nbBlupi != MAXBLUPI || - pBuffer->lgBlupi != sizeof(Blupi) || - pBuffer->nbMove != MAXMOVE || - pBuffer->lgMove != sizeof(Move)) goto error; - } - - SetCoin(pBuffer->celCoin); - if (bUser) - { - world = pBuffer->world; - time = pBuffer->time; - total = pBuffer->totalTime; - } - m_celHome = pBuffer->celCoin; - m_term = pBuffer->term; - m_music = pBuffer->music; - m_region = pBuffer->region; - - if (bUser) - { - m_skill = pBuffer->skill; - } - - for (i = 0; i < MAXBUTTON; i++) - { - m_buttonExist[i] = pBuffer->buttonExist[i]; - } - - for (i = 0; i < 4; i++) - { - m_memoPos[i] = pBuffer->memoPos[i]; - } - - nb = fread(m_decor, sizeof(Cellule), MAXCELX * MAXCELY / 4, file); - if (nb < MAXCELX * MAXCELY / 4) goto error; - if (majRev == 1 && minRev < 5) - { - for (x = 0; x < MAXCELX / 2; x++) + int icon = m_decor[num, num2]->icon; + if (!IsPassIcon(icon)) { - for (y = 0; y < MAXCELY / 2; y++) - { - if (m_decor[x][y].objectIcon >= 128 && - m_decor[x][y].objectIcon <= 130) - { - m_decor[x][y].objectIcon -= 128 - 17; - } - } + return FALSE; } + pos.y -= 64; } - - if (majRev == 1 && minRev == 3) - { - memset(m_blupi, 0, sizeof(Blupi) * MAXBLUPI); - for (i = 0; i < MAXBLUPI; i++) - { - nb = fread(&oldBlupi, sizeof(OldBlupi), 1, file); - if (nb != 1) goto error; - memcpy(m_blupi + i, &oldBlupi, sizeof(OldBlupi)); - ListFlush(i); - } - } - else - { - nb = fread(m_blupi, sizeof(Blupi), MAXBLUPI, file); - if (nb < MAXBLUPI) goto error; - } - - nb = fread(m_move, sizeof(Move), MAXMOVE, file); - if (nb < MAXMOVE) goto error; - - nb = fread(m_lastDrapeau, sizeof(POINT), MAXLASTDRAPEAU, file); - if (nb < MAXLASTDRAPEAU) - { - InitDrapeau(); - } - - BlupiDeselect(); - - free(pBuffer); - fclose(file); return TRUE; - -error: - if (pBuffer != NULL) free(pBuffer); - if (file != NULL) fclose(file); - - Flush(); - return FALSE; -} - -// Indique si un fichier existe sur disque. - -BOOL CDecor::FileExist(int rank, BOOL bUser, int& world, int& time, int& total) -{ - char filename[MAX_PATH]; - FILE* file = NULL; - DescFile* pBuffer = NULL; - int majRev, minRev; - int nb; - - if (bUser) - { - sprintf(filename, "data\\user%.3d.blp", rank); - AddUserPath(filename); - } - else - { - sprintf(filename, "data\\world%.3d.blp", rank); - if (rank < 200) - { - AddCDPath(filename); - } - } - - file = fopen(filename, "rb"); - if (file == NULL) goto error; - - pBuffer = (DescFile*)malloc(sizeof(DescFile)); - if (pBuffer == NULL) goto error; - - nb = fread(pBuffer, sizeof(DescFile), 1, file); - if (nb < 1) goto error; - - majRev = pBuffer->majRev; - minRev = pBuffer->minRev; - - if (majRev == 1 && minRev == 0) goto error; - - if (majRev == 1 && minRev == 3) - { - if (pBuffer->nbDecor != MAXCELX * MAXCELY || - pBuffer->lgDecor != sizeof(Cellule) || - pBuffer->nbBlupi != MAXBLUPI || - pBuffer->lgBlupi != sizeof(OldBlupi) || - pBuffer->nbMove != MAXMOVE || - pBuffer->lgMove != sizeof(Move)) goto error; - } - else - { - if (pBuffer->nbDecor != MAXCELX * MAXCELY || - pBuffer->lgDecor != sizeof(Cellule) || - pBuffer->nbBlupi != MAXBLUPI || - pBuffer->lgBlupi != sizeof(Blupi) || - pBuffer->nbMove != MAXMOVE || - pBuffer->lgMove != sizeof(Move)) goto error; - } - - world = pBuffer->world; - time = pBuffer->time; - total = pBuffer->totalTime; - - free(pBuffer); - fclose(file); - return TRUE; - -error: - if (pBuffer != NULL) free(pBuffer); - if (file != NULL) fclose(file); - return FALSE; } \ No newline at end of file diff --git a/decor.h b/decor.h index 9f4a6d5..390bc31 100644 --- a/decor.h +++ b/decor.h @@ -3,20 +3,18 @@ #pragma once #include -#include #include "DEF.H" #include "JAUGE.H" #include "SOUND.H" #include "PIXMAP.H" #include "network.h" -#include "jauge.h" -#include "event.h" ///////////////////////////////////////////////////////////////////////////// #define MAXNETMESSAGE 20 #define MAXMOVEOBJECT 200 +#define MAXNOTIF 4 // Descripteur d'une cellule du décor. typedef struct @@ -70,17 +68,11 @@ public: ~CDecor(); // 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, CNetwork *pNetwork); + void Create(HWND hWnd, CSound *pSound, CPixmap *pPixmap, + CNetwork *pNetwork); BOOL LoadImages(); void InitGamer(); - BOOL AddLinkCaisse(int rank); - void InitDecor(int channel, int icon); - void InitAfterBuild(); + void InitDecor(); void SetTime(int time); int GetTime(); void PlayPrepare(BOOL bTest); @@ -90,115 +82,103 @@ public: int GetBlupiChannelStandard(); int GetBlupiChannelActual(); int GetIconPerso(); - BOOL BlitzActif(int celx, int cely); void Build(RECT rect); void DrawInfo(); POINT DecorNextAction(); - void TreatInput(UINT input); - void SetSpeedX(double speed); - void SetSpeedY(double speed); - int SoundEnviron(int sound, int obstacle); - void StopSound(CSound sound); - void AdaptMotorVehicleSound(); - BOOL TestPushCaisse(int i, POINT pos, BOOL bPop); - void SearchLinkCaisse(int rank, BOOL bPop); - void ResetHili(); - BOOL LoadImages(); - BOOL LoadBackgroundImages(); - BOOL TestPushOneCaisse(int i, POINT move, int b); - 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 SetInput(int keys); + void SetJoystickEnable(BOOL bJoystick); + void SetFieldD814(BOOL param_1); + void PlaySoundB(int sound, POINT pos, BOOL bLocal); + void StopSound(int sound); + void AdaptMotorVehicleSound(POINT pos); + void VehicleSoundsPhase(int phase); - 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(); - void GetBlupiInfo(BOOL bHelico, BOOL bJeep, BOOL bSkate, BOOL bNage); - - 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(); - BOOL GetShowSecret(); - BOOL GetNetPacked(); - BOOL GetNetMovePredict(); - UINT GetPhase(); - char GetMissionTitle(); void SetRegion(int region); int GetMusic(); void SetMusic(int music); - void GetDims(POINT* ptr); - void SetDims(POINT dims); + POINT GetDim(); + void SetDim(POINT dim); int GetNbVies(); void SetNbVies(int nbVies); BOOL GetPause(); void SetPause(BOOL bPause); - void GetDoors(int doors); - void InitalizeDoors(); - void SetAllMissions(BOOL CheatDoors); - void CheatAction(int cheat, MoveObject moveObject); - void SetAccessBuild(BOOL build); - void SetNetPacked(BOOL net); - void SetNetMovePredict(BOOL netmove); + void InitializeDoors(GameData *gameData); + void MemorizeDoors(BYTE* doors); + void SetAllMissions(BOOL bAllMissions); + void CheatAction(int cheat); + BOOL GetSuperBlupi(); + void SetSuperBlupi(BOOL bSuperBlupi); + BOOL GetDrawSecret(); + void SetDrawSecret(BOOL bDrawSecret); + void SetBuildOfficialMissions(BOOL bBuildOfficialMissions); + BOOL GetNetPacked(); + void SetNetPacked(BOOL bNetPacked); + BOOL GetNetMovePredict(); + void SetNetMovePredict(BOOL bNetMovePredict); BOOL GetNetDebug(); void SetNetDebug(BOOL bNetDebug); - void UpdateNetDebug(char *str); + void OutputNetDebug(char* text); void SetMulti(BOOL bMulti); void SetTeam(int team); + POINT VoyageGetPosVie(int nbVies); + void VoyageInit(POINT start, POINT end, int icon, int channel); + void VoyageStep(); + void VoyageDraw(); + BOOL DrawMap(BOOL bPlay, int team); + + // DecBlock.cpp + BOOL BlitzActif(int celx, int cely); + int SoundEnviron(int sound, int obstacle); + int IsWorld(POINT pos); + void ActiveSwitch(BOOL bState, POINT cel); + char GetTypeBarre(POINT pos); + BOOL IsLave(POINT pos); + BOOL IsPiege(POINT pos); + BOOL IsGoutte(POINT pos, BOOL bAlways); + BOOL IsScie(POINT pos); + BOOL IsSwitch(POINT pos, POINT celSwitch); + BOOL IsEcraseur(POINT pos); + BOOL IsBlitz(POINT pos, BOOL bAlways); + BOOL IsRessort(POINT pos); + BOOL IsTemp(POINT pos); + BOOL IsBridge(POINT pos, POINT celBridge); + int IsDoor(POINT pos, POINT celPorte); + int IsTeleporte(POINT pos); + BOOL SearchTeleporte(POINT pos, POINT newpos); + BOOL IsSurfWater(POINT pos); + BOOL IsDeepWater(POINT pos); + BOOL IsOutWater(POINT pos); + BOOL IsPassIcon(int icon); + BOOL IsBlocIcon(int icon); + BOOL IsVentillo(POINT pos); + void ModifDecor(POINT pos, int icon, BOOL _foo); + BOOL IsRightBorder(POINT cel, POINT offset); + BOOL IsFromage(int x, int y); + BOOL IsGrotte(int x, int y); + void AdaptMidBorder(int x, int y); + void AdaptBorder(POINT cel); + + // DecDesign.cpp + POINT ScreenPosToCelPos(POINT pos); + void SetCelPosFromScreenPos(POINT pos); + void SetFieldCC38AndStuff(int _foo, int _bar); + void DeleteCel(POINT cel); + void PlaceMenuItem(short *pCel, int *pTable, int lastIndex, BYTE flags, int currentIcon, BOOL bRand); + void PlaceItemFromMenu1(POINT cel, int index, BYTE flags, int currentIcon); + void PlaceItemFromMenu2(POINT cel, int index, BYTE flags, int currentIcon); + void PlaceItemFromMenu3(POINT cel, int index, BYTE flags, int currentIcon); + void PlaceItemFromMenu4(POINT cel, int index, BYTE flags, int currentIcon); + void PlaceItemFromMenu5(POINT cel, int index, BYTE flags, int currentIcon); + void PlaceItemFromMenu6(POINT cel, int index, BYTE flags, int currentIcon); + void PlaceItemFromMenu7(POINT cel, int index, BYTE flags, int currentIcon); + void PlaceItemFromMenu8(POINT cel, int index, BYTE flags, int currentIcon); + void PlaceItemFromMenu9(POINT cel, int index, BYTE flags, int currentIcon); + void PlaceItemFromMenu10(POINT cel, int index, BYTE flags, int currentIcon); + char* GetMissionTitle(); + void SetMissionTitle(char *str); + + // DecBlupi.cpp void BlupiSearchIcon(); BOOL BlupiIsGround(); RECT BlupiRect(POINT pos); @@ -209,31 +189,15 @@ public: POINT GetPosDecor(POINT pos); void BlupiAddFifo(POINT pos); BOOL DecorDetect(RECT rect, BOOL bCaisse); - BOOL TestPath(RECT rect, POINT start, POINT *end); + void GetBlupiInfo(BOOL *pbHelico, BOOL *pbJeep, BOOL *pbSkate, + BOOL *pbNage); + + // DecMove.cpp + BOOL TestPath(RECT rect, POINT start, POINT end); void MoveObjectPollution(); void MoveObjectPlouf(POINT pos); void MoveObjectTiplouf(POINT pos); - int GetBlupiChannelStandard(); void MoveObjectBlup(POINT pos); - void ActiveSwitch(BOOL bState, POINT cel); - BOOL IsLave(POINT pos); - BOOL IsPiege(POINT pos); - BOOL IsGoutte(POINT pos, BOOL bAlways); - BOOL IsScie(POINT pos); - BOOL IsSwitch(POINT pos, POINT *celSwitch); - BOOL IsEcraseur(POINT pos); - BOOL IsBlitz(POINT pos, BOOL bAlways); - BOOL IsRessort(POINT pos); - BOOL IsTemp(POINT pos); - BOOL IsBridge(POINT pos, POINT *celBridge); - int IsDoor(POINT pos, POINT *celPorte); - int IsTeleporte(POINT pos); - BOOL SearchTeleporte(POINT pos, POINT *newpos); - BOOL IsSurfWater(POINT pos); - BOOL IsDeepWater(POINT pos); - BOOL IsOutWater(POINT pos); - BOOL IsPassIcon(int icon); - BOOL IsBlocIcon(int icon); void FlushBalleTraj(); void SetBalleTraj(POINT pos); BOOL IsBalleTraj(POINT pos); @@ -241,28 +205,9 @@ public: void SetMoveTraj(POINT pos); BOOL IsMoveTraj(POINT pos); int SearchDistRight(POINT pos, POINT dir, int type); - BOOL IsVentillo(POINT pos); - void NetStopCloud(int rank); void StartSploutchGlu(POINT pos); - BOOL ObjectStart(POINT pos, int type, int speed, int _foo); - BOOL ObjectDelete(POINT pos, int type, int _foo); - void ModifDecor(POINT pos, int icon, BOOL _foo); - void NetPlaySound(short channel, POINT pos); - void NetStopSound(short channel); - void NetDataFlush(); - void FUN_155e0(byte _foo, short _bar); - void TreatNetData(); - void DoNetSmooth(int player); - void NetFUN_15d50(); - void FUN_15da0(int rank, short phase); - void NetPlayerCollide(POINT pos, int &result); - void NetMessageIndexFlush(); - BOOL NetMessagePush(NetMessage *message); - BOOL NetMessagePop(NetMessage *message); - void NotifFlush(); - void NotifPop(); - void NotifPush(char *str); - void NotifStep(); + BOOL ObjectStart(POINT pos, int type, int speed); + BOOL ObjectDelete(POINT pos, int type); void MoveObjectStep(); void MoveObjectStepLine(int i); void* MoveObjectStepIcon(int i); @@ -271,7 +216,6 @@ public: int AscenseurVertigo(int i, BOOL *bVertigoLeft, BOOL *bVertigoRight); BOOL AscenseurShift(int i); void AscenseurSynchro(int i); - void UpdateCaisse(); BOOL TestPushCaisse(int i, POINT pos, BOOL bPop); BOOL TestPushOneCaisse(int i, POINT move, int b); @@ -286,66 +230,51 @@ public: int MoveAscenseurDetect(POINT pos, int height); int MoveChargeDetect(POINT pos); int MovePersoDetect(POINT pos); - int MoveObjectSomething(POINT pos); + int MoveBalleDetect(POINT pos); int MoveObjectDelete(POINT pos); int MoveObjectFree(); int SortGetType(int type); void MoveObjectSort(); void MoveObjectPriority(int i); int MoveObjectSearch(POINT pos, int type); - void VoyageGetPosVie(POINT *out, int nbVies); - void VoyageInit(POINT start, POINT end, int icon, int channel); - void VoyageStep(); - void VoyageDraw(); - BOOL IsRightBorder(int x, int y, int dx, int dy); - BOOL IsFromage(int x, int y); - BOOL IsGrotte(int x, int y); - void AdaptMidBorder(int x, int y); - void AdaptBorder(POINT cel); - BOOL MultiplayerCameraSomething(int foo, int bar); + + // DecNet.cpp + void NetStopCloud(int rank); + void NetPlaySound(short channel, POINT pos); + void NetStopSound(short channel); + void NetDataFlush(); + void NetFUN_155e0(BYTE _foo, short _bar); + void TreatNetData(); + void DoNetSmooth(int player); + void NetFUN_15d50(); + void FUN_15da0(int rank, short step); + void NetPlayerCollide(POINT pos, int *out); + void NetMessageIndexFlush(); + BOOL NetMessagePush(NetMessage *message); + BOOL NetMessagePop(NetMessage *message); + void NotifFlush(); + void NotifPop(); + void NotifPush(char *str); + void NotifStep(); + + // DecIO.cpp void GetMissionPath(char *out, int gamer, int mission, BOOL bUser); BOOL CurrentWrite(int gamer, int mission, BOOL bUser); BOOL CurrentRead(int gamer, int mission, BOOL bUser); - BOOL MissionPathSomething(int gamer, int mission, BOOL bUser); - BOOL Read(int gamer, int mission, BOOL bUser); - BOOL FUN_1bad0(int foo, int bar, void *baz, void *qux); - BOOL FUN_1c190(int foo, int bar, char *str); + 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 SearchWorld(int world, POINT *blupi, int *dir); BOOL SearchDoor(int n, POINT *cel, POINT *blupi); - BOOL AdaptDoors(BOOL bPrivate, int mission); + void AdaptDoors(BOOL bPrivate, int mission); void OpenDoorsTresor(); void OpenDoor(POINT cel); void OpenDoorsWin(); void OpenGoldsWin(); void DoorsLost(); - void SetMission(int mission); - - // ? - void GetMissionsCleared(); - void SetDemoState(BOOL demoState); - BOOL CurrentWrite(int gamer, int mission, BOOL bUser); - BOOL CurrentRead(int gamer, int mission, BOOL bUser); - void SetJoystickEnable(BOOL bJoystick); - BOOL GetShowSecret(); - - void MemorizeDoors(BYTE* doors); - - - // Network Related Functions - void NetMessageIndexFlush(); - void NotifFlush(); - void NetDataFlush(); - void NetPlaySound(short channel, POINT pos); - void NetStopCloud(int rank); - BOOL NetMessagePush(NetMessage* message); - BOOL DrawMap(BOOL bPlay, int player); - void NetSendData(BYTE bufferSize, UCHAR send); - void NetPlayerCollide(POINT pos, int* out); - void TreatNetData(); - void OutputNetDebug(char* text); - - protected: HWND m_hWnd; CSound* m_pSound; @@ -363,15 +292,12 @@ protected: POINT m_posCelHili; POINT m_dimCelHili; int m_2ndPositionCalculationSlot; - int m_phase; int m_term; int m_music; int m_region; int m_lastRegion; - int m_iconLift; - int m_time; char m_missionTitle[100]; BOOL m_bPause; @@ -392,15 +318,14 @@ protected: int m_blupiTransport; BOOL m_blupiFocus; BOOL m_blupiAir; - BOOL* m_blupiHelico; + BOOL m_blupiHelico; BOOL m_blupiOver; BOOL m_blupiJeep; BOOL m_blupiTank; BOOL m_blupiSkate; BOOL m_blupiNage; BOOL m_blupiSurf; - BOOL m_bInWind; - BOOL m_blupiVent; + BOOL m_blupiVent; BOOL m_blupiSuspend; BOOL m_blupiJumpAie; BOOL m_blupiShield; @@ -429,30 +354,30 @@ protected: POINT m_blupiFifoPos[10]; POINT m_blupiStartPos[4]; int m_blupiStartDir[4]; - int m_D42C; - int m_jaugeSomething1; - int m_jaugeSomething2; - int m_jaugeSomething3; - int m_jaugeSomething4; BOOL m_bMulti; int m_team; int m_netPacketsSent; int m_netPacketsSent2; int m_netPacketsReceived; int m_netPacketsReceived2; - - int unknown[55]; - + POINT m_netPos[MAXNETPLAYER]; + int m_netIcons[MAXNETPLAYER]; + int m_netUnk1[MAXNETPLAYER]; + int m_netUnk2[MAXNETPLAYER]; + int m_netUnk3[MAXNETPLAYER]; + int m_netPlayerPacketsReceived[MAXNETPLAYER]; + int m_netPlayerPacketsReceived2[MAXNETPLAYER]; + int m_netTimeSincePacket[MAXNETPLAYER]; + POINT m_netVitesses[MAXNETPLAYER]; + POINT m_netUnk4[MAXNETPLAYER]; + POINT m_netPacketPos; + int m_netPacketIcon; NetMessage m_netMessages[MAXNETMESSAGE]; - int m_soundEventIndex1; - int m_soundEventIndex2; - - int m_D5DC; - - char m_messages[4][100]; - - int m_D770; - + int m_netMessageIndex1; + int m_netMessageIndex2; + int m_netMessageIndex3; + char m_notifText[4][100]; + int m_notifTime; CJauge m_jauges[2]; int m_blupiLevel; int m_blupiEnergyUnused; @@ -478,9 +403,7 @@ protected: int m_totalTresor; int m_goalPhase; int m_detectIcon; - int m_D8F8; - POINT m_scrollPoint; POINT m_scrollAdd; int m_voyageIcon; @@ -492,9 +415,7 @@ protected: int m_decorAction; int m_decorPhase; int m_lastDecorIndexes[200]; - int reserve[11]; - BYTE dummy[100000]; }; diff --git a/def.h b/def.h index 389390e..1e8acbb 100644 --- a/def.h +++ b/def.h @@ -11,6 +11,7 @@ #define _SE FALSE // TRUE eGames Special Edition #define _NOCD TRUE +#define MAXGAMER 8 #define LXIMAGE 640 // dimensions de la fenêtre de jeu #define LYIMAGE 480 @@ -84,11 +85,23 @@ namespace Ch { }; }; -#define MESS_LOBBY 4 -#define NETEVENTMAX 20 - -#define PK_PLAYSOUND 40 +#define MESS_RESUME 0 +#define MESS_PAUSE 1 +#define MESS_LOBBY 4 +#define MESS_LEAVE 8 +#define MESS_LOST 9 +#define MESS_START 10 +#define MESS_PAUSE2 12 +#define MESS_OBJECTSTART 20 +#define MESS_OBJECTDELETE 21 +#define MESS_MODIFDECOR 30 +#define MESS_PLAYSOUND 40 +#define MESS_STOPSOUND 41 +#define MESS_ASCENSEURSTART 50 +#define MESS_ASCENSEUREND 51 +#define MESS_STOPCLOUD 60 +#define MAXNETMESSAGE 20 // Directions : @@ -676,6 +689,7 @@ namespace Sound { #define KEY_DOWN (1 << 3) #define KEY_JUMP (1 << 4) #define KEY_FIRE (1 << 5) +#define KEY_NONE 0 namespace Key { enum Key { @@ -984,6 +998,8 @@ namespace Key { #define WM_PHASE_DOQUIT 1587 #define WM_PHASE_GAMER 1545 +#define WM_PHASE_CLEARGAMER 1528 + // Types de gestion de la souris. #define MOUSETYPEGRA 1 diff --git a/event.cpp b/event.cpp index 78076cd..b51a570 100644 --- a/event.cpp +++ b/event.cpp @@ -1490,8 +1490,8 @@ CEvent::~CEvent() WriteInfo(); // Read the file "info.blp" } -void CEvent::Create(HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, - CSound *pSound, CMovie *pMovie, CNetwork *pNetwork) +void CEvent::Create(HINSTANCE hInstance, HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, + CSound *pSound, CNetwork *pNetwork, CMovie *pMovie) { HINSTANCE hInstance; POINT pos; @@ -1506,7 +1506,6 @@ void CEvent::Create(HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, m_gamer = 1; ReadInfo(1); - return; } int CEvent::GetButtonIndex(int button) @@ -1664,7 +1663,7 @@ void CEvent::FlushInput() { m_input = 0; - m_pDecor->SetInput(0); + m_pDecor->SetInput(KEY_NONE); return; } @@ -1702,7 +1701,7 @@ BOOL CEvent::CreateButtons() void CEvent::ReadInput() { - BOOL something; + BOOL bCanCrouch; MMRESULT joyPos; int i; UINT keyInput; @@ -1715,33 +1714,29 @@ void CEvent::ReadInput() UINT bJoyID; - if (m_bMulti != FALSE) + if (m_bMulti) { m_pDecor->TreatNetData(); } - if ((m_somethingJoystick == (void*)0) || (m_bDemoPlay != FALSE)) + if (m_somethingJoystick == NULL || m_bDemoPlay) { m_pDecor->SetJoystickEnable(FALSE); } else { m_pDecor->GetBlupiInfo(&bHelicopter, &bCar, &bSkateboard, &bWater); - something = TRUE; + bCanCrouch = TRUE; - if (((bHelicopter != FALSE) || (bCar != FALSE)) || (bSkateboard != FALSE)) + if (bHelicopter || bCar || bSkateboard) { - something = FALSE; + bCanCrouch = FALSE; } bJoyID = m_joyID; - joyInfo = &joy; - for (i != 0; i = 13; i++) - { - joyInfo->dwSize = 0; - joyInfo = (JOYINFOEX*)&joyInfo->dwFlags; - } - joy.dwSize = 52; + ZeroMemory(&joy, sizeof(joy)); + + joy.dwSize = sizeof(JOYINFOEX); joy.dwFlags = 255; joyPos = joyGetPosEx(bJoyID, &joy); @@ -1750,57 +1745,53 @@ void CEvent::ReadInput() { m_input = 0; - if ((int)joy.dwXpos < 16384) + if (joy.dwXpos < 16384) { m_input = KEY_LEFT; } - if ((m_input == KEY_NONE) && ((int)joy.dwYpos < 16384)) + if (m_input == KEY_NONE && joy.dwYpos < 16384) { m_input = KEY_UP; } - if (((m_input == KEY_NONE) || (something)) && (49152 < (int)joy.dwYpos)) + if (m_input == KEY_NONE || joy.dwYpos > 49152) { m_input = m_input | KEY_DOWN; } - if (((BYTE)joy.dwButtons & JOY_BUTTON1) != 0) + if (joy.dwButtons & JOY_BUTTON1) { - m_input = m_input & ~(INPUT_DOWN | INPUT_UP) | KEY_JUMP; + m_input = m_input & ~(KEY_DOWN | KEY_UP) | KEY_JUMP; } - if (((BYTE)joy.dwButtons & JOY_BUTTON2) != 0) + if (joy.dwButtons & JOY_BUTTON2) { - if (bSkateboard == FALSE) - { - keyInput = m_input & ~INPUT_DOWN | KEY_UP | KEY_JUMP; + if (bSkateboard) { + keyInput = m_input & ~(KEY_DOWN | KEY_UP) | KEY_JUMP; } - else - { - keyInput = m_input & ~(INPUT_DOWN | INPUT_UP) | KEY_JUMP; + else { + keyInput = m_input & ~KEY_DOWN | KEY_UP | KEY_JUMP; } m_input = keyInput; } - if (((BYTE)joy.dwButtons & JOY_BUTTON3) != 0) + if (joy.dwButtons & JOY_BUTTON3) { - if (bHelicopter == FALSE) - { - if (bSkateboard == FALSE) - { - keyInput = m_input | KEY_DOWN | KEY_JUMP; - } - else - { - keyInput = m_input & ~(INPUT_DOWN | INPUT_UP) | KEY_JUMP; - } - } - else + if (bHelicopter) { keyInput = m_input | KEY_DOWN; } + else { + if (bSkateboard) { + keyInput = m_input & ~(KEY_DOWN | KEY_UP) | KEY_JUMP; + } + else { + keyInput = m_input | KEY_DOWN | KEY_JUMP; + } + } + m_input = keyInput; - m_input = keyInput & ~INPUT_UP; + m_input = keyInput & ~KEY_UP; } - if (((BYTE)joy.dwButtons & JOY_BUTTON4) != 0) + if (joy.dwButtons & JOY_BUTTON4) { - m_input = m_input & ~(INPUT_DOWN | INPUT_UP) | KEY_FIRE; + m_input = m_input & ~(KEY_DOWN | KEY_UP) | KEY_FIRE; } m_pDecor->SetInput(m_input); m_pDecor->SetJoystickEnable(TRUE); @@ -1819,18 +1810,14 @@ void CEvent::NetSetPause(BOOL bPause, int players) bPause_ = bPause; m_pDecor->SetPause(bPause); - if ((m_phase == WM_PHASE_PLAY) || (m_phase == WM_PHASE_PLAYTEST)) + if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST) { - if (bPause_ == FALSE) - { - m_pSound->RestartMusic(); - } - else - { + if (bPause_) m_pSound->SuspendMusic(); - } + else + m_pSound->RestartMusic(); } - if ((m_bMulti != FALSE) && (players != 0)) + if (m_bMulti && players != 0) { m_pNetwork->Send(&bPause, 3, DPSEND_GUARANTEED); } @@ -1839,91 +1826,73 @@ void CEvent::NetSetPause(BOOL bPause, int players) void CEvent::NetSendLobby() { - int i; NetPlayer* player; NetPlayer* playerPacket; UCHAR packet[132]; CNetwork* pNetwork; - packet._2_2_ = (int*)&m_multi; + packet[2] = *(short*)&m_multi; pNetwork = m_pNetwork; packet[0] = 132; packet[1] = MESS_LOBBY; player = pNetwork->m_players; playerPacket = (NetPlayer*)(packet + 4); - for (i != 0; i = sizeof(NetPlayer); i++) + for (int i = 0; i < sizeof(NetPlayer); i++) { playerPacket = (NetPlayer*)player; player = (NetPlayer*)&player->dpid; playerPacket++; } pNetwork->Send(packet, 132, DPSEND_GUARANTEED); - return; } int CEvent::NetSearchPlayer(DPID dpid) { - int i; - BYTE* pDpid; - - i = 0; - pDpid = (BYTE*)&m_pNetwork->m_players[0].dpid; - - while ((pDpid[-4] == 0 || (dpid != *(DPID*)pDpid))) + for (int i = 0; i < MAXNETPLAYER; i++) { - i++; - pDpid = pDpid + sizeof(NetPlayer); - if (3 < i) - { - return -1; - } + if (m_pNetwork->m_players[i].bIsPresent && m_pNetwork->m_players[0].dpid == dpid) return i; } - return i; + + return -1; } void CEvent::NetStartPlay() { BOOL host; int i; - int* player; + DPID player; char message[2]; char str[52]; CNetwork* pNetwork; OutputNetDebug("CEvent::NetStartPlay"); - host = m_pNetwork->IsHost(); - if (host != FALSE) + if (m_pNetwork->IsHost()) { - message[0] = '\x02'; - message[1] = '\a'; + message[0] = 2; + message[1] = MESS_START; m_pNetwork->Send(message, 2, DPSEND_GUARANTEED); - OutputNetDebug("Sending_MESS_START"); + OutputNetDebug("Sending MESS_START"); } m_pDecor->SetTeam(0); - pNetwork = m_pNetwork; - i = 0; - player = &pNetwork->m_players[0].dpid; - - while ((((NetPlayer*)(player + -1))->bIsPresent == FALSE || (pNetwork->m_dpid != player))) + for (int i = 0; i < MAXNETPLAYER; i++) { - i++; - player = player + 8; - if (3 < i) + if (m_pNetwork->m_players[i].bIsPresent && m_pNetwork->m_players[0].dpid == m_pNetwork->m_dpid) { - m_bMulti = TRUE; - m_bPrivate = FALSE; - m_pDecor->SetMulti(TRUE); + m_pDecor->SetTeam(pNetwork->m_players[i].team); + sprintf(str, "color=%d", m_pNetwork->m_players[i].team); + OutputNetDebug(str); return; } } - m_pDecor->SetTeam((int)pNetwork->m_players[i].team); - sprintf(str, "color=%d", (int)m_pNetwork->m_players[i].team); - OutputNetDebug(str); + + m_bMulti = TRUE; + m_bPrivate = FALSE; + m_pDecor->SetMulti(TRUE); } -void CEvent::NetSend(NetMessageType message, USHORT data) +void CEvent::NetFUN_1d6b0(UINT message, USHORT data) { UCHAR packet[4]; @@ -1936,13 +1905,9 @@ void CEvent::NetSend(NetMessageType message, USHORT data) return; } -void CEvent::NetDraw() +void CEvent::NetDrawMap() { - int player; - - player = NetSearchPlayer(m_pNetwork->m_dpid); - m_pDecor->DrawMap(TRUE, player); - return; + m_pDecor->DrawMap(TRUE, NetSearchPlayer(m_pNetwork->m_dpid)); } void CEvent::ChatSend() @@ -1998,17 +1963,63 @@ void AddCheatCode(char *pDst, char *pSrc) } -void CEvent::DrawTextCenter(int res, int x, int y, int font) +void CEvent::DrawTextCenter(int res, POINT pos, 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::AddPhaseText() +{ + char text[100]; + + + if (m_phase != WM_PHASE_INSERT && m_phase != WM_PHASE_BYE) + { + text[0] = 0; + + if (m_bBuildOfficialMissions) AddCheatCode(text, cheat_code[0]); + if (m_bAllMissions) AddCheatCode(text, cheat_code[1]); + if (m_pDecor->GetSuperBlupi()) AddCheatCode(text, cheat_code[3]); + if (m_pDecor->GetDrawSecret()) AddCheatCode(text, cheat_code[11]); + if (m_pDecor->GetNetPacked()) AddCheatCode(text, cheat_code[19]); + if (m_pDecor->GetNetMovePredict()) AddCheatCode(text, cheat_code[21]); + + m_pDecor->OutputNetDebug(text); + + if (m_phase != WM_PHASE_PLAY && m_phase != WM_PHASE_PLAYTEST && m_phase != WM_PHASE_BUILD) + { + m_pPixmap->DrawPart(-1, CHDECOR, { 2, 2 }, { 2, 2, 302, 14 }, 1, FALSE); + } + DrawTextLeft(m_pPixmap, { 2, 2 }, text, CHLITTLE); + } + if (m_phase == WM_PHASE_INIT) + { + DrawTextB(m_pPixmap, { 414, 446 }, "Version 2.2", FONTLITTLE); + } + if (m_phase == WM_PHASE_GAMER) + { + LoadString(TX_ChoosePlayer@2, text, 100); + DrawTextLeft(m_pPixmap, { LXIMAGE / 2 - GetTextWidth(text, 0) / 2, 26 }, text, FONTRED); + + POINT pos { 110, 69 }; + for (int i = 0; i < MAXGAMER; i++) + { + DrawTextB(m_pPixmap, pos, m_gamerNameList[i], FONTWHITE); + pos.y += DIMBUTTONY; + } + + //SetEnable(WM_PHASE_CLEARGAMER); // TODO + } + if (m_phase == WM_PHASE_CREATE) + { + LoadString(0xFA, text, 100); + // TODO + } +} + BOOL CEvent::DrawButtons() { int i; @@ -2209,11 +2220,9 @@ BOOL CEvent::TextSomething() return 1; } -POINT CEvent::GetLastMousePos(POINT out) +POINT CEvent::GetLastMousePos() { - out.x = m_oldMousePos.x; - out.y = m_oldMousePos.y; - return; + return m_oldMousePos; } BOOL CEvent::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam) @@ -2537,12 +2546,12 @@ int CEvent::GetWorldGroup() void CEvent::SetMission(int index) { - if (m_bPrivate != 0) + if (m_bPrivate) { m_private = index; return; } - if (m_bMulti != 0) + if (m_bMulti) { m_multi = index; return; @@ -3018,7 +3027,7 @@ BOOL CEvent::DemoPlayStart() m_bDemoPlay = TRUE; m_bDemoRec = FALSE; - if (!m_pDecor->Read(header.world, FALSE, world, time, total)) + if (!m_pDecor->CurrentRead(header.world, FALSE, world, time, total)) { DemoPlayStop(); return FALSE; diff --git a/event.h b/event.h index 6c6de15..cd4652a 100644 --- a/event.h +++ b/event.h @@ -61,40 +61,6 @@ typedef struct } DemoEvent; -typedef enum -{ - cheat_cleanall = 2, - cheat_funskate = 6, - cheat_givecopter = 7, - cheat_jeepdrive = 8, - cheat_alltreasure = 9, - cheat_endgoal = 10, - cheat_roundshield = 12, - cheat_quicklollipop = 13, - cheat_tenbombs = 14, - cheat_birdlime = 15, - cheat_drivetank = 16, - cheat_powercharge = 17, - cheat_hidedrink = 18, - cheat_iovercraft = 22, - cheat_udynamite = 23, - cheat_wellkeys = 24 -} -cheat; - -typedef enum -{ - KEY_NONE, - KEY_LEFT, - KEY_RIGHT, - KEY_UP, - KEY_DOWN, - KEY_JUMP, - INPUT_DOWN, - INPUT_UP, - KEY_FIRE -}; - class CEvent { public: @@ -104,7 +70,7 @@ public: void OutputNetDebug(const char* str); POINT GetMousePos(); - void Create(HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, CSound *pSound, CMovie *pMovie, CNetwork *pNetwork); + void Create(HINSTANCE hInstance, HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, CSound *pSound, CNetwork *pNetwork, CMovie *pMovie); void SetFullScreen(BOOL bFullScreen); void SetMouseType(int mouseType); int GetWorld(); @@ -113,7 +79,7 @@ public: int GetImageWorld(); BOOL IsHelpHide(); BOOL ChangePhase(UINT phase); - WMessage GetPhase(); + UINT GetPhase(); void MovieToStart(); BOOL NetworkNuggets(int fuck); void HandleInputs(); @@ -149,7 +115,7 @@ public: void WaitMouse(BOOL bWait); void HideMouse(BOOL bHide); void FillMouse(int bFill); - POINT GetLastMousePos(POINT out); + POINT GetLastMousePos(); BOOL TreatEvent(UINT message, WPARAM wParam, LPARAM lParam); BOOL TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam); @@ -179,10 +145,10 @@ public: void IntroStep(); - void AddPhaseText(); + BOOL AddPhaseText(); void ReadInput(); - void DrawTextCenter(int res, int x, int y, int font=0); + void DrawTextCenter(int res, POINT pos, int font=0); BOOL CreateButtons(); BOOL EventButtons(UINT message, WPARAM wParam, LPARAM lParam); BOOL MouseOnButton(POINT pos); @@ -221,8 +187,8 @@ public: BOOL NetEnumSessions(); int NetSearchPlayer(DPID dpid); void NetStartPlay(); - void NetSend(NetMessageType message, USHORT data); - void NetDraw(); + void NetFUN_1d6b0(UINT message, USHORT data); + void NetDrawMap(); void ChatSend(); void MouseRelease(); @@ -246,7 +212,7 @@ protected: BOOL m_bSchool; BOOL m_bPrivate; BOOL m_bMulti; - BOOL m_bAccessBuild; + BOOL m_bBuildOfficialMissions; BOOL m_bFullScreen; int m_mouseType; HWND m_hWnd; @@ -256,7 +222,7 @@ protected: CMovie* m_pMovie; CNetwork* m_pNetwork; char m_movieToStart[MAX_PATH]; - WMessage m_phaseAfterMovie; + UINT m_phaseAfterMovie; CButton m_buttons[MAXBUTTON]; int m_lastFloor[MAXBUTTON]; int m_lastObject[MAXBUTTON]; @@ -324,7 +290,8 @@ protected: int m_textHiliEnd; int m_textCursorIndex; char m_textInput[100]; - char m_pPlayerName[100]; + char m_gamerName[100]; + char m_gamerNameList[10][100]; int m_lives; int m_multi; HINSTANCE m_hInstance; diff --git a/network.h b/network.h index 0f7c141..65a4646 100644 --- a/network.h +++ b/network.h @@ -7,7 +7,7 @@ ///////////////////////////////////////////////////////////////////////////// #define MAXSESSION 100 -#define MAXPLAYERS 4 +#define MAXNETPLAYER 4 typedef struct { @@ -57,14 +57,14 @@ public: void FreeUnknownList(); BOOL IsHost(); + NetPlayer m_players[4]; + DPID m_dpid; protected: LPDIRECTPLAY2 m_pDP; NamedGUIDList m_providers; NamedGUIDList m_sessions; NamedGUIDList m_unknown; BOOL m_bHost; - DPID m_dpid; - NetPlayer m_players[4]; }; static BOOL EnumProvidersCallback(LPGUID lpguidSP, LPSTR lpSTName, diff --git a/speedyblupi.vcxproj b/speedyblupi.vcxproj index 95cadfd..77477f2 100644 --- a/speedyblupi.vcxproj +++ b/speedyblupi.vcxproj @@ -96,7 +96,7 @@ Windows true - winmm.lib;ddraw.lib;dsound.lib;%(AdditionalDependencies) + winmm.lib;ddraw.lib;dsound.lib;dplay.lib;%(AdditionalDependencies) diff --git a/text.cpp b/text.cpp index 52926f7..2f73063 100644 --- a/text.cpp +++ b/text.cpp @@ -9,10 +9,267 @@ #include "text.h" #include "texttables.h" -#pragma warning (disable: 4996) - ///////////////////////////////////////////////////////////////////////////// +static CharOffset table_offsets[] = +{ + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { ' ', 0, 0, -1, 0, 0 }, + { '!', 0, 0, -1, 0, 0 }, + { '"', 0, 0, -1, 0, 0 }, + { '#', 0, 0, -1, 0, 0 }, + { '$', 0, 0, -1, 0, 0 }, + { '%', 0, 0, -1, 0, 0 }, + { '&', 0, 0, -1, 0, 0 }, + { '\'', 0, 0, -1, 0, 0 }, + { '(', 0, 0, -1, 0, 0 }, + { ')', 0, 0, -1, 0, 0 }, + { '*', 0, 0, -1, 0, 0 }, + { '+', 0, 0, -1, 0, 0 }, + { ',', 0, 0, -1, 0, 0 }, + { '-', 0, 0, -1, 0, 0 }, + { '.', 0, 0, -1, 0, 0 }, + { '/', 0, 0, -1, 0, 0 }, + { '0', 0, 0, -1, 0, 0 }, + { '1', 0, 0, -1, 0, 0 }, + { '2', 0, 0, -1, 0, 0 }, + { '3', 0, 0, -1, 0, 0 }, + { '4', 0, 0, -1, 0, 0 }, + { '5', 0, 0, -1, 0, 0 }, + { '6', 0, 0, -1, 0, 0 }, + { '7', 0, 0, -1, 0, 0 }, + { '8', 0, 0, -1, 0, 0 }, + { '9', 0, 0, -1, 0, 0 }, + { ':', 0, 0, -1, 0, 0 }, + { ';', 0, 0, -1, 0, 0 }, + { '<', 0, 0, -1, 0, 0 }, + { '=', 0, 0, -1, 0, 0 }, + { '>', 0, 0, -1, 0, 0 }, + { '?', 0, 0, -1, 0, 0 }, + { '@', 0, 0, -1, 0, 0 }, + { 'A', 0, 0, -1, 0, 0 }, + { 'B', 0, 0, -1, 0, 0 }, + { 'C', 0, 0, -1, 0, 0 }, + { 'D', 0, 0, -1, 0, 0 }, + { 'E', 0, 0, -1, 0, 0 }, + { 'F', 0, 0, -1, 0, 0 }, + { 'G', 0, 0, -1, 0, 0 }, + { 'H', 0, 0, -1, 0, 0 }, + { 'I', 0, 0, -1, 0, 0 }, + { 'J', 0, 0, -1, 0, 0 }, + { 'K', 0, 0, -1, 0, 0 }, + { 'L', 0, 0, -1, 0, 0 }, + { 'M', 0, 0, -1, 0, 0 }, + { 'N', 0, 0, -1, 0, 0 }, + { 'O', 0, 0, -1, 0, 0 }, + { 'P', 0, 0, -1, 0, 0 }, + { 'Q', 0, 0, -1, 0, 0 }, + { 'R', 0, 0, -1, 0, 0 }, + { 'S', 0, 0, -1, 0, 0 }, + { 'T', 0, 0, -1, 0, 0 }, + { 'U', 0, 0, -1, 0, 0 }, + { 'V', 0, 0, -1, 0, 0 }, + { 'W', 0, 0, -1, 0, 0 }, + { 'X', 0, 0, -1, 0, 0 }, + { 'Y', 0, 0, -1, 0, 0 }, + { 'Z', 0, 0, -1, 0, 0 }, + { '[', 0, 0, -1, 0, 0 }, + { '\\', 0, 0, -1, 0, 0 }, + { ']', 0, 0, -1, 0, 0 }, + { '^', 0, 0, -1, 0, 0 }, + { '_', 0, 0, -1, 0, 0 }, + { '`', 0, 0, -1, 0, 0 }, + { 'a', 0, 0, -1, 0, 0 }, + { 'b', 0, 0, -1, 0, 0 }, + { 'c', 0, 0, -1, 0, 0 }, + { 'd', 0, 0, -1, 0, 0 }, + { 'e', 0, 0, -1, 0, 0 }, + { 'f', 0, 0, -1, 0, 0 }, + { 'g', 0, 0, -1, 0, 0 }, + { 'h', 0, 0, -1, 0, 0 }, + { 'i', 0, 0, -1, 0, 0 }, + { 'j', 0, 0, -1, 0, 0 }, + { 'k', 0, 0, -1, 0, 0 }, + { 'l', 0, 0, -1, 0, 0 }, + { 'm', 0, 0, -1, 0, 0 }, + { 'n', 0, 0, -1, 0, 0 }, + { 'o', 0, 0, -1, 0, 0 }, + { 'p', 0, 0, -1, 0, 0 }, + { 'q', 0, 0, -1, 0, 0 }, + { 'r', 0, 0, -1, 0, 0 }, + { 's', 0, 0, -1, 0, 0 }, + { 't', 0, 0, -1, 0, 0 }, + { 'u', 0, 0, -1, 0, 0 }, + { 'v', 0, 0, -1, 0, 0 }, + { 'w', 0, 0, -1, 0, 0 }, + { 'x', 0, 0, -1, 0, 0 }, + { 'y', 0, 0, -1, 0, 0 }, + { 'z', 0, 0, -1, 0, 0 }, + { '{', 0, 0, -1, 0, 0 }, + { '|', 0, 0, -1, 0, 0 }, + { '}', 0, 0, -1, 0, 0 }, + { '~', 0, 0, -1, 0, 0 }, + { 0x7f, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 0x05, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 0x04, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 0x10, 0, 0, -1, 0, 0 }, + { 'a', 0, 0, 2, 2, 0 }, + { 0x11, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 0x1b, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 0x1d, 0, 0, -1, 0, 0 }, + { 0x13, 0, 0, -1, 0, 0 }, + { 0x12, 0, 0, -1, 0, 0 }, + { 0x15, 0, 0, -1, 0, 0 }, + { 0x14, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 'i', 0, 0, 2, -1, 0 }, + { 0x17, 0, 0, -1, 0, 0 }, + { 0x16, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 'n', 0, 0, '~', -1, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 'o', 0, 0, 2, 1, 0 }, + { 0x18, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 0x1c, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 0x19, 0, 0, -1, 0, 0 }, + { 'u', 0, 0, 2, 2, 0 }, + { 0x1a, 0, 0, -1, 0, 0 }, + { 0x0f, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 }, + { 1, 0, 0, -1, 0, 0 } +}; // Retourne l'offset pour un caract�re donn�. @@ -40,7 +297,7 @@ int GetOffset(char c) // Retourne la longueur d'un caract�re. -int GetCharWidth(char c, int font) +int GetCharWidthB(char c, int font) { static unsigned char table_width[128] = { @@ -76,148 +333,105 @@ int GetCharWidth(char c, int font) } } +void DrawCharSingle(CPixmap *pPixmap, POINT pos, char *pText, int font) +{ + if (font == FONTLITTLE) + { + pPixmap->DrawIcon(-1, CHLITTLE, *pText, pos, 0, FALSE); + } + else + { + pPixmap->DrawIcon(-1, CHTEXT, *pText + font * 128, pos, 0, FALSE); + } +} + +void DrawChar(CPixmap *pPixmap, POINT *pos, char c, int font) +{ + POINT pos2 { table_offsets[c].charOffsetX + pos->x, table_offsets[c].charOffsetY + pos->y }; + DrawCharSingle(pPixmap, pos2, &table_offsets[c].charIcon, font); + if (table_offsets[c].accentIcon != -1) + { + pos2 = { table_offsets[c].accentOffsetX + pos->x, table_offsets[c].accentOffsetY + pos->y }; + DrawCharSingle(pPixmap, pos2, &table_offsets[c].accentIcon, font); + } + pos->x += GetCharWidthB(c, font); +} + +void DrawTextLeft(CPixmap *pPixmap, POINT pos, char *pText, int font) +{ + DrawTextB(pPixmap, pos, pText, font); +} + // Affiche un texte. void DrawTextB(CPixmap *pPixmap, POINT pos, char *pText, int font) { - int rank; - - if ( font == FONTLITTLE ) + while (*pText != 0) { - while ( *pText != 0 ) - { - rank = GetOffset(*pText); - pPixmap->DrawIcon(-1, CHLITTLE, rank, pos); - - pos.x += GetCharWidth(*pText++, font); - } - } - else - { - while ( *pText != 0 ) - { - rank = GetOffset(*pText); - rank += 128*font; - pPixmap->DrawIcon(-1, CHTEXT, rank, pos); - - pos.x += GetCharWidth(*pText++, font); - } + DrawChar(pPixmap, &pos, *pText++, font); } } -void DrawTextLeft(CPixmap* pPixmap, POINT pos, char *text, int font) -{ - DrawTextB(pPixmap, pos, text, font); - return; -} - -/* -void DrawTextNew(CPixmap* pPixmap, POINT pos, char* pText, int font) -{ - char text; - - text = *pText; - - while (text != '\0') - { - pText = pText + 1; - DrawChar(pPixmap, &pos, text, font); - text = *pText; - } -} -*/ - -//Implement later - -void DrawChar(CPixmap* pPixmap, POINT* pos, char c, double size) -{ - POINT pos2; - int num = (int)((short)c * 6); - int num2 = (int)table_char[num]; - pos2.x = pos->x + (int)table_char[num + 1]; - pos2.y = pos->y + (int)table_char[num + 2]; - DrawCharSingle(pPixmap, pos2, num2, size); - num2 = (int)table_char[num + 3]; - if (num2 != -1) - { - pos2.x = pos->x + (int)table_char[num + 4]; - pos2.y = pos->y + (int)table_char[num + 5]; - DrawCharSingle(pPixmap, pos2, num2, size); - } - pos->x += GetCharWidth(c, size); -} - -void DrawCharSingle(CPixmap pPixmap, POINT pos, int rank, double size) -{ - pPixmap.DrawChar(rank, pos, size); -} - -void GetSomethingDrawText(CPixmap* pPixmap, POINT pos, char* pText, int font) -{ - DrawTextNew(pPixmap, pos, pText, font); - return; -} - -// Affiche un texte pench�. +// Affiche un texte penché. void DrawTextPente(CPixmap *pPixmap, POINT pos, char *pText, - int pente, int font) + int pente, int font) { int rank, lg, rel, start; start = pos.y; rel = 0; - while ( *pText != 0 ) + while (*pText != 0) { rank = GetOffset(*pText); - rank += 128*font; + rank += 128 * font; pPixmap->DrawIcon(-1, CHTEXT, rank, pos); - lg = GetCharWidth(*pText++, font); + lg = GetCharWidthB(*pText++, font); rel += lg; pos.x += lg; - pos.y = start + rel/pente; + pos.y = start + rel / pente; } } -// Affiche un pav� de texte. -// Une ligne vide est affich�e avec un demi interligne ! +// Affiche un pavé de texte. +// Une ligne vide est affichée avec un demi interligne ! // Si part != -1, n'affiche que les lignes qui commencent // par "n|", avec n=part. void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText, - int pente, int font, int part) + int pente, int font, int part) { char text[100]; char* pDest; int itl; - if ( font == FONTLITTLE ) itl = DIMLITTLEY; + if (font == FONTLITTLE) itl = DIMLITTLEY; else itl = DIMTEXTY; - while ( *pText != 0 ) + while (*pText != 0) { pDest = text; - while ( *pText != 0 && *pText != '\r' && *pText != '\n' ) + while (*pText != 0 && *pText != '\r' && *pText != '\n') { *pDest++ = *pText++; } *pDest = 0; - if ( *pText == '\r' ) pText ++; // saute '\r' - if ( *pText == '\n' ) pText ++; // saute '\n' + if (*pText == '\r') pText++; // saute '\r' + if (*pText == '\n') pText++; // saute '\n' pDest = text; - if ( text[0] != 0 && text[1] == '|' ) // commence par "n|" ? + if (text[0] != 0 && text[1] == '|') // commence par "n|" ? { - if ( part != -1 && part != text[0]-'0' ) continue; + if (part != -1 && part != text[0] - '0') continue; pDest += 2; // saute "n|" } else { - if ( part != -1 ) continue; + if (part != -1) continue; } - if ( pente == 0 ) + if (pente == 0) { DrawTextB(pPixmap, pos, pDest, font); } @@ -226,19 +440,19 @@ void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText, DrawTextPente(pPixmap, pos, pDest, pente, font); } - if ( pDest[0] == 0 ) // ligne vide ? + if (pDest[0] == 0) // ligne vide ? { - pos.y += itl/2; // descend de 1/2 ligne + pos.y += itl / 2; // descend de 1/2 ligne } else { - pos.y += itl; // passe � la ligne suivante + pos.y += itl; // passe à la ligne suivante } } } -// Affiche un texte centr� pouvant �ventuellement -// contenir plusieurs lignes s�par�es par des '\n'. +// Affiche un texte centré pouvant éventuellement +// contenir plusieurs lignes séparées par des '\n'. void DrawTextCenter(CPixmap *pPixmap, POINT pos, char *pText, int font) { @@ -247,32 +461,32 @@ void DrawTextCenter(CPixmap *pPixmap, POINT pos, char *pText, int font) int itl; POINT start; - if ( font == FONTLITTLE ) itl = DIMLITTLEY; + if (font == FONTLITTLE) itl = DIMLITTLEY; else itl = DIMTEXTY; - while ( *pText != 0 ) + while (*pText != 0) { pDest = text; - while ( *pText != 0 && *pText != '\r' && *pText != '\n' ) + while (*pText != 0 && *pText != '\r' && *pText != '\n') { *pDest++ = *pText++; } *pDest = 0; - if ( *pText == '\r' ) pText ++; // saute '\r' - if ( *pText == '\n' ) pText ++; // saute '\n' + if (*pText == '\r') pText++; // saute '\r' + if (*pText == '\n') pText++; // saute '\n' pDest = text; - start.x = pos.x - GetTextWidth(pDest)/2; + start.x = pos.x - GetTextWidth(pDest) / 2; start.y = pos.y; DrawTextB(pPixmap, start, pDest, font); - if ( pDest[0] == 0 ) // ligne vide ? + if (pDest[0] == 0) // ligne vide ? { - pos.y += itl/2; // descend de 1/2 ligne + pos.y += itl / 2; // descend de 1/2 ligne } else { - pos.y += itl; // passe � la ligne suivante + pos.y += itl; // passe à la ligne suivante } } } @@ -284,40 +498,40 @@ int GetTextHeight(char *pText, int font, int part) char text[100]; char* pDest; int itl; - int h=0; + int h = 0; - if ( font == FONTLITTLE ) itl = DIMLITTLEY; + if (font == FONTLITTLE) itl = DIMLITTLEY; else itl = DIMTEXTY; - while ( *pText != 0 ) + while (*pText != 0) { pDest = text; - while ( *pText != 0 && *pText != '\r' && *pText != '\n' ) + while (*pText != 0 && *pText != '\r' && *pText != '\n') { *pDest++ = *pText++; } *pDest = 0; - if ( *pText == '\r' ) pText ++; // saute '\r' - if ( *pText == '\n' ) pText ++; // saute '\n' + if (*pText == '\r') pText++; // saute '\r' + if (*pText == '\n') pText++; // saute '\n' pDest = text; - if ( text[0] != 0 && text[1] == '|' ) // commence par "n|" ? + if (text[0] != 0 && text[1] == '|') // commence par "n|" ? { - if ( part != -1 && part != text[0]-'0' ) continue; + if (part != -1 && part != text[0] - '0') continue; pDest += 2; // saute "n|" } else { - if ( part != -1 ) continue; + if (part != -1) continue; } - if ( pDest[0] == 0 ) // ligne vide ? + if (pDest[0] == 0) // ligne vide ? { - h += itl/2; // descend de 1/2 ligne + h += itl / 2; // descend de 1/2 ligne } else { - h += itl; // passe � la ligne suivante + h += itl; // passe à la ligne suivante } } @@ -330,72 +544,10 @@ int GetTextWidth(char *pText, int font) { int width = 0; - while ( *pText != 0 ) + while (*pText != 0) { - width += GetCharWidth(*pText++, font); + width += GetCharWidthB(*pText++, font); } return width; } - - -// Retourne la longueur d'un grand chiffre. - -void GetBignumInfo(int num, int &start, int &lg) -{ - static int table[11] = - { - 0,53,87,133,164,217,253,297,340,382,426 - }; - - start = table[num]; - lg = table[num+1]-table[num]; -} - -// Affiche un grand nombre. - -void DrawBignum(CPixmap *pPixmap, POINT pos, int num) -{ - char string[10]; - int i = 0; - int start, lg; - RECT rect; - - sprintf(string, "%d", num); - - rect.top = 0; - rect.bottom = 52; - while ( string[i] != 0 ) - { - GetBignumInfo(string[i]-'0', start, lg); - - rect.left = start; - rect.right = start+lg; - pPixmap->DrawPart(-1, CHBIGNUM, pos, rect); - pos.x += lg+4; - - i ++; - } -} - -// Retourne la longueur d'un grand nombre. - -int GetBignumWidth(int num) -{ - char string[10]; - int i = 0; - int start, lg; - int width = -4; - - sprintf(string, "%d", num); - - while ( string[i] != 0 ) - { - GetBignumInfo(string[i]-'0', start, lg); - width += lg+4; - i ++; - } - - return width; -} - diff --git a/text.h b/text.h index d7d329d..198c653 100644 --- a/text.h +++ b/text.h @@ -19,43 +19,31 @@ typedef struct CharOffset; extern -void DrawTextB(CPixmap *pPixmap, POINT pos, char *pText, int font); +void DrawCharSingle(CPixmap *pPixmap, POINT pos, char *pText, int font); extern -void DrawTextLeft(CPixmap* pPixmap, POINT pos, char *text, int font); +void DrawChar(CPixmap *pPixmap, POINT *pos, char c, int font); extern -void DrawTextNew(CPixmap *pPixmap, POINT pos, char* pText, int font); +void DrawTextLeft(CPixmap *pPixmap, POINT pos, char *pText, int font); extern -void DrawChar(CPixmap* pPixmap, POINT pos, char* pText, double size); - -extern -void DrawCharSingle(CPixmap* pPixmap, POINT pos, int rank, double size); - -extern -void DrawTextNew(CPixmap* pPixmap, POINT pos, char* pText, int font); +void DrawTextB(CPixmap *pPixmap, POINT pos, char *pText, int font = 0); extern void DrawTextPente(CPixmap *pPixmap, POINT pos, char *pText, - int pente, int font=0); + int pente, int font = 0); extern void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText, - int pente, int font=0, int part=-1); + int pente, int font = 0, int part = -1); extern -void DrawTextCenter(CPixmap *pPixmap, POINT pos, char *pText, int font=0); +void DrawTextCenter(CPixmap *pPixmap, POINT pos, char *pText, int font = 0); extern -int GetTextHeight(char *pText, int font=0, int part=-1); +int GetTextHeight(char *pText, int font = 0, int part = -1); extern -int GetTextWidth(char *pText, int font=0); - -extern -void DrawBignum(CPixmap *pPixmap, POINT pos, int num); - -extern -int GetBignumWidth(int num); +int GetTextWidth(char *pText, int font = 0);