From ce33104782be82a9ecd9acd45363aa347fd64d41 Mon Sep 17 00:00:00 2001 From: jummy Date: Sat, 5 Oct 2024 17:42:17 -0500 Subject: [PATCH] WE SHMOOVIN' --- src/decblupi.cpp | 2403 ++++++++++++++++++++++------------------------ src/decmove.cpp | 239 ++++- src/decnet.cpp | 8 +- src/decor.cpp | 22 +- src/decor.h | 40 + src/dectables.h | 154 +-- src/def.h | 241 ++--- src/event.cpp | 34 + src/event.h | 2 +- src/network.cpp | 548 ++++++----- src/network.h | 121 ++- 11 files changed, 1982 insertions(+), 1830 deletions(-) diff --git a/src/decblupi.cpp b/src/decblupi.cpp index c798459..4f5eb2c 100644 --- a/src/decblupi.cpp +++ b/src/decblupi.cpp @@ -136,7 +136,7 @@ void CDecor::BlupiSearchIcon() num3 = 52; } } - + // more...? } BOOL CDecor::BlupiIsGround() @@ -217,6 +217,7 @@ RECT CDecor::BlupiRect(POINT pos) return result; } +// prevent blupi from getting stuck in blocks void CDecor::BlupiAdjust() { RECT tinyRect = BlupiRect(m_blupiPos); @@ -313,192 +314,179 @@ BOOL CDecor::BlupiBloque(POINT pos, int dir) /* void CDecor::BlupiStep() { - RECT blupiRect, rect1; + RECT blupiRect, rect; + BOOL flag; + POINT point; + int num; BlupiAdjust(); - POINT blupiEndPos = m_blupiPos + m_blupiVector; + POINT adjustPos = m_blupiPos + m_blupiVector; if (m_blupiVector.x != 0 || m_blupiVector.y != 0) { blupiRect = BlupiRect(m_blupiPos); - rect1.top = m_blupiPos.y + 11; - rect1.left = m_blupiPos.x; - rect1.right = - rect1.bottom = m_blupiPos.x + 58; - TestPath(rect1, m_blupiPos, &blupiEndPos); + rect.top = m_blupiPos.y + 11; + rect.left = m_blupiPos.x; + rect.right = + rect.bottom = m_blupiPos.x + 58; + TestPath(rect, m_blupiPos, &adjustPos); } m_blupiVent = FALSE; if (m_blupiTransport == -1) { if (!m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus) { - int object = m_decor[(blupiEndPos.x + 32) / 64][(blupiEndPos.y + 32) / 64].icon; - if (object == 110) blupiEndPos.x -= 9; // left wind - if (object == 114) blupiEndPos.x += 9; // right - if (object == 118) blupiEndPos.y -= 9; // up - if (object == 122) blupiEndPos.y += 9; // down + int object = m_decor[(adjustPos.x + 32) / 64][(adjustPos.y + 32) / 64].icon; + if (object == 110) adjustPos.x -= 9; // left wind + if (object == 114) adjustPos.x += 9; // right + if (object == 118) adjustPos.y -= 9; // up + if (object == 122) adjustPos.y += 9; // down if (object >= 110 && object <= 125) { m_blupiVent = TRUE; - rect1.top = m_blupiPos.y + 11; - rect1.left = m_blupiPos.x + 12; - rect1.right = m_blupiPos.x + 48; - rect1.bottom = m_blupiPos.y + 58; - TestPath(rect1, m_blupiPos, &blupiEndPos); + rect.top = m_blupiPos.y + 11; + rect.left = m_blupiPos.x + 12; + rect.right = m_blupiPos.x + 48; + rect.bottom = m_blupiPos.y + 58; + TestPath(rect, m_blupiPos, &adjustPos); + } + if (object >= 110 && object <= 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, &adjustPos); } } + m_blupiVent = FALSE; } } */ // handle Blupi's movement and current state. // currently derived from winphone code +/**/ void CDecor::BlupiStep() { - int m_blupiSpeedX = 0; // - int m_blupiSpeedY = 0; // lol. lmao even + BOOL bNear; + BOOL bStopJumpH = FALSE; + int icon; POINT tinyPoint; POINT tinyPoint2 = m_blupiPos; // = m_blupiPos ? BlupiAdjust(); //m_blupiLastPos = m_blupiPos; - POINT adjustPos = m_blupiPos; + POINT end = m_blupiPos; BOOL flag = m_blupiAir; - int blupiAction = m_blupiAction; + int lastBlupiAction = m_blupiAction; BOOL flag2 = FALSE; BOOL flag3 = FALSE; - adjustPos.x += m_blupiVector.x; - adjustPos.y += m_blupiVector.y; + end.x += m_blupiVector.x; + end.y += m_blupiVector.y; 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 + 58; - TestPath(rect, m_blupiPos, &adjustPos); + rect.bottom = m_blupiPos.y + DIMBLUPIY - 2; + TestPath(rect, m_blupiPos, &end); } m_blupiVent = FALSE; int num; if (m_blupiTransport == -1 && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus) { - num = m_decor[(adjustPos.x + 30) / 64][(adjustPos.y + 30) / 64].icon; + num = m_decor[(end.x + DIMBLUPIX / 2) / DIMOBJX][(end.y + DIMBLUPIY / 2) / DIMOBJY].icon; if (num == 110) { - adjustPos.x -= 9; + end.x -= 9; } if (num == 114) { - adjustPos.x += 9; + end.x += 9; } if (num == 118) { - adjustPos.y -= 20; + end.y -= 20; } if (num == 122) { - adjustPos.y += 20; + end.y += 20; } if (num >= 110 && num <= 125) { m_blupiVent = TRUE; rect.left = m_blupiPos.x + 12; - rect.right = m_blupiPos.x + 60 - 12; + rect.right = m_blupiPos.x + DIMBLUPIX - 12; rect.top = m_blupiPos.y + 11; - rect.bottom = m_blupiPos.y + 60 - 2; - TestPath(rect, m_blupiPos, &adjustPos); + rect.bottom = m_blupiPos.y + DIMBLUPIY - 2; + TestPath(rect, m_blupiPos, &end); } } m_blupiVent = FALSE; if (m_blupiTransport == -1) { - rect = BlupiRect(adjustPos); - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60 - 1; + rect = BlupiRect(end); + rect.top = end.y + DIMBLUPIY - 2; + rect.bottom = end.y + DIMBLUPIY - 1; flag = !DecorDetect(rect); } else { flag = FALSE; } - rect = BlupiRect(adjustPos); - rect.top = adjustPos.y + 10; - rect.bottom = adjustPos.y + 20; - BOOL flag5 = DecorDetect(rect); + rect = BlupiRect(end); + rect.top = end.y + 10; + rect.bottom = end.y + 20; 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 && flag5 && m_blupiFocus) + if (!m_blupiAir && + !IsBlupiMotorVehicle() && + !m_blupiBalloon && + !m_blupiEcrase && + !m_blupiNage && + !m_blupiSurf && + !m_blupiSuspend && + m_blupiFocus && + DecorDetect(rect)) { if (m_blupiFocus) { - m_blupiAction = 5; + m_blupiAction = ACTION_AIR; m_blupiPhase = 0; } m_blupiVitesse.y = 1; - m_blupiAir = true; - flag = true; + m_blupiAir = TRUE; + flag = TRUE; } - if (!m_blupiNage && !m_blupiSurf && !m_blupiSuspend && !m_blupiAir && IsRessort(adjustPos)) + if (!m_blupiNage && + !m_blupiSurf && + !m_blupiSuspend && + !m_blupiAir && + IsRessort(end)) { - if ((m_blupiHelico || m_blupiOver) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + if (IsBlupiVehicle() && + !m_blupiShield && + !m_blupiHide && + !m_bSuperBlupi) { - m_blupiHelico = false; - m_blupiOver = false; - tinyPoint.x = adjustPos.x - 34; - tinyPoint.y = adjustPos.y - 34; - ObjectStart(tinyPoint, 9, 0); + m_blupiHelico = FALSE; + m_blupiOver = FALSE; + m_blupiJeep = FALSE; + m_blupiTank = FALSE; + m_blupiSkate = FALSE; + tinyPoint.x = end.x - 34; + tinyPoint.y = end.y - 34; + ObjectStart(tinyPoint, TYPE_EXPLO2, 0); m_decorAction = 1; m_decorPhase = 0; - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); - PlaySound(10, m_blupiPos); + StopVehicleSound(); + PlaySound(SOUND_BOUM, m_blupiPos); } - if (m_blupiJeep && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + if (m_blupiFocus && !IsDeadAction(m_blupiAction)) { - m_blupiJeep = false; - tinyPoint.x = adjustPos.x - 34; - tinyPoint.y = adjustPos.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 = adjustPos.x - 34; - tinyPoint.y = adjustPos.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 = adjustPos.x - 34; - tinyPoint.y = adjustPos.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_blupiAction = ACTION_AIR; m_blupiPhase = 0; } - if ((m_keyPress & KEY_LEFT) != 0 && m_blupiFocus) + if (m_keyPress & KEY_LEFT && m_blupiFocus) { m_blupiVitesse.y = (m_blupiPower ? -25 : -19); } @@ -506,149 +494,158 @@ void CDecor::BlupiStep() { m_blupiVitesse.y = (m_blupiPower ? -16 : -10); } - m_blupiAir = true; - flag = true; - PlaySound(41, adjustPos); + m_blupiAir = TRUE; + flag = TRUE; + PlaySound(SOUND_RESSORT, end); } - if ((m_keyPress & KEY_LEFT) != 0 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + if (m_keyPress & KEY_LEFT && + !IsBlupiMotorVehicle() && + !m_blupiBalloon && + !m_blupiEcrase && + !m_blupiNage && + !m_blupiSurf && + !m_blupiSuspend + && m_blupiFocus) { - if (m_blupiAction != 4 && m_blupiAction != 3 && !m_blupiAir) + if (m_blupiAction != ACTION_JUMP && + m_blupiAction != ACTION_TURN && + !m_blupiAir) { - m_blupiAction = 4; + m_blupiAction = ACTION_JUMP; m_blupiPhase = 0; } - if (m_blupiAction == 4 && m_blupiPhase == 3) + if (m_blupiAction == ACTION_JUMP && m_blupiPhase == 3) { - m_blupiAction = 5; + m_blupiAction = ACTION_AIR; m_blupiPhase = 0; if (m_blupiSkate) { - PlaySound(1, adjustPos); + PlaySound(SOUND_JUMP1, end); m_blupiVitesse.y = (m_blupiPower ? -17 : -13); } else - { - PlaySound(1, adjustPos); + { if (m_keyPress & KEY_UP) { + PlaySound(SOUND_JUMP2, end); m_blupiVitesse.y = (m_blupiPower ? -26 : -16); } else { + PlaySound(SOUND_JUMP1, end); m_blupiVitesse.y = (m_blupiPower ? -16 : -12); } } - m_blupiAir = true; - flag = true; + m_blupiAir = TRUE; + flag = TRUE; } } if (m_blupiAir) { - if (flag5 && m_blupiVitesse.y < 0) + if (DecorDetect(rect) && m_blupiVitesse.y < 0) { - if (m_blupiVitesse.y < -14 && 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) + if (m_blupiVitesse.y < -14 && !IsDeadAction(m_blupiAction) && !m_blupiSkate) { - m_blupiJumpAie = true; - PlaySound(40, adjustPos); + m_blupiJumpAie = TRUE; + PlaySound(SOUND_JUMPAIE, end); } else { - PlaySound(SoundEnviron(4, detectIcon), adjustPos); + PlaySound(SoundEnviron(SOUND_JUMPTOC, detectIcon), end); } m_blupiVitesse.y = 1; } - adjustPos.y += (int)(m_blupiVitesse.y * 2); + end.y += m_blupiVitesse.y * 2; if (m_blupiVitesse.y < 20) { m_blupiVitesse.y += 2; } - rect = BlupiRect(adjustPos); - rect.top = adjustPos.y + 60 - 30; - rect.bottom = adjustPos.y + 60 - 1; + rect = BlupiRect(end); + rect.top = end.y + DIMBLUPIY - 30; + rect.bottom = end.y + DIMBLUPIY - 1; if (m_blupiVitesse.y >= 0 && DecorDetect(rect)) { - adjustPos.y = adjustPos.y / 32 * 32 + BLUPIOFFY; - if (!IsRessort(adjustPos)) + end.y = end.y / 32 * 32 + BLUPIOFFY; + if (!IsRessort(end)) { - PlaySound(SoundEnviron(3, m_detectIcon), adjustPos); + PlaySound(SoundEnviron(SOUND_JUMPEND, m_detectIcon), end); } if (m_blupiFocus) { if (m_blupiVitesse.y > 20) { - m_blupiAction = 61; + m_blupiAction = ACTION_STOPJUMP; // ?? } else { - m_blupiAction = 61; + m_blupiAction = ACTION_STOPJUMP; } m_blupiPhase = 0; } - m_blupiAir = false; + m_blupiAir = FALSE; if (m_blupiJumpAie) { - m_blupiJumpAie = false; - m_blupiAction = 36; + m_blupiJumpAie = FALSE; + m_blupiAction = ACTION_JUMPAIE; m_blupiPhase = 0; } } - rect.left = adjustPos.x + 20; - rect.right = adjustPos.x + 60 - 20; - rect.top = adjustPos.y + 60 - 33; - rect.bottom = adjustPos.y + 60 - 1; - num = AscenseurDetect(rect, m_blupiPos, adjustPos); - if (m_blupiVitesse.y >= 0 && num != -1) + rect.left = end.x + 20; + rect.right = end.x + DIMBLUPIX - 20; + rect.top = end.y + DIMBLUPIY - 33; + rect.bottom = end.y + DIMBLUPIY - 1; + icon = AscenseurDetect(rect, m_blupiPos, end); + if (m_blupiVitesse.y >= 0 && icon != -1) { - m_blupiTransport = num; - flag = false; - PlaySound(3, adjustPos); - adjustPos.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY; + m_blupiTransport = icon; + flag = FALSE; + PlaySound(SOUND_JUMPEND, end); + end.y = m_moveObject[num].posCurrent.y - DIMOBJY + BLUPIOFFY; if (m_blupiFocus) { if (m_blupiVitesse.y > 20) { - m_blupiAction = 61; + m_blupiAction = ACTION_STOPJUMP; // ??? } else { - m_blupiAction = 61; + m_blupiAction = ACTION_STOPJUMP; } m_blupiPhase = 0; } - m_blupiAir = false; + m_blupiAir = FALSE; if (m_blupiJumpAie) { - m_blupiJumpAie = false; - m_blupiAction = 36; + m_blupiJumpAie = FALSE; + m_blupiAction = ACTION_JUMPAIE; 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, adjustPos); - } - if (m_blupiAction == 58) + } // if (m_blupiAir) + + switch (m_blupiAction) { + case ACTION_JUMPAIE: + if (m_blupiPhase == 30) StopBlupi(TRUE); + break; + case ACTION_CHARGE: + if (m_blupiPhase == 64) + { + StopBlupi(TRUE); + m_blupiCloud = TRUE; + m_blupiTimeShield = 100; + m_jauges[JAUGE_POWER].SetHide(FALSE); + PlaySound(ACTION_DRINK, end); + } + break; + case ACTION_HELICOGLU: if (m_blupiPhase == 8) { tinyPoint.x = m_blupiPos.x; tinyPoint.y = m_blupiPos.y + 40; if (m_blupiVitesse.y > 0) { - tinyPoint.y += (int)(m_blupiVitesse.y * 4); + tinyPoint.y += m_blupiVitesse.y * 4; } m_blupiVitesse.y -= 10; if (ObjectStart(tinyPoint, 23, 55) != -1) @@ -658,274 +655,366 @@ void CDecor::BlupiStep() m_blupiBullet--; } } - if (m_blupiPhase == 14) + if (m_blupiPhase == 14) StopBlupi(TRUE); + break; + case ACTION_OUF1a: + case ACTION_OUF1b: + if (m_blupiPhase == 29) StopBlupi(TRUE); + break; + case ACTION_OUF2: + if (m_blupiPhase == 32) StopBlupi(TRUE); + break; + case ACTION_OUF3: + if (m_blupiPhase == 34) StopBlupi(TRUE); + break; + case ACTION_OUF4: + if (m_blupiPhase == 40) { - 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(adjustPos, &flag6); - if (num != -1 && !flag6 && adjustPos.y - BLUPIFLOOR == m_moveObject[num].posCurrent.y) - { - if (m_blupiDir == 2 && adjustPos.x < m_moveObject[num].posCurrent.x) + StopBlupi(TRUE); + icon = MoveObjectDetect(end, &bNear); + if (icon != -1 && !bNear && end.y - BLUPIFLOOR == m_moveObject[num].posCurrent.y) { - tinyPoint.x = adjustPos.x - 16; - tinyPoint.y = adjustPos.y; - int num2 = MoveObjectDetect(tinyPoint, &flag6); - if (num2 == -1) + if (m_blupiDir == DIR_RIGHT && end.x < m_moveObject[num].posCurrent.x) { - m_blupiAction = 9; - m_blupiPhase = 0; + tinyPoint.x = end.x - 16; + tinyPoint.y = end.y; + int num2 = MoveObjectDetect(tinyPoint, &bNear); + if (num2 == -1) + { + m_blupiAction = ACTION_RECEDE; + m_blupiPhase = 0; + } } - } - if (m_blupiDir == 1 && adjustPos.x > m_moveObject[num].posCurrent.x) - { - tinyPoint.x = adjustPos.x + 16; - tinyPoint.y = adjustPos.y; - int num2 = MoveObjectDetect(tinyPoint, &flag6); - if (num2 == -1) + if (m_blupiDir == DIR_LEFT && end.x > m_moveObject[num].posCurrent.x) { - m_blupiAction = 9; - m_blupiPhase = 0; + tinyPoint.x = end.x + 16; + tinyPoint.y = end.y; + int num2 = MoveObjectDetect(tinyPoint, &bNear); + if (num2 == -1) + { + m_blupiAction = ACTION_RECEDE; + 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) - { + break; + case ACTION_OUF5: + if (m_blupiPhase == 4) PlaySound(SOUND_OUF2, m_blupiPos); + if (m_blupiPhase == 44) StopBlupi(TRUE); + break; + case ACTION_MOCKERY: if (m_blupiPhase == 1) { - PlaySound(65, m_blupiPos); + PlaySound(SOUND_MOCKERY, 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 == 92) StopBlupi(TRUE); + break; + case ACTION_MOCKERYi: if (m_blupiPhase == 6) { - PlaySound(65, m_blupiPos); + PlaySound(SOUND_MOCKERY, m_blupiPos); m_blupiTimeMockery = 300; } - if (m_blupiPhase == 104) + if (m_blupiPhase == 104) StopBlupi(TRUE); + break; + case ACTION_MOCKERYp: + if (m_blupiPhase == 4) PlaySound(SOUND_OUF2, m_blupiPos); + if (m_blupiPhase == 60) StopBlupi(TRUE); + break; + case ACTION_NON: + if (m_blupiPhase == 18) StopBlupi(TRUE); + break; + case ACTION_STOPMARCH: + if (m_blupiPhase == 3) StopBlupi(); + break; + case ACTION_STOPJUMP: + if (m_blupiPhase == 5) StopBlupi(); + break; + case ACTION_STOPJUMPh: + if (m_blupiPhase == 2) { - m_blupiAction = 1; + m_blupiAction = ACTION_AIR; m_blupiPhase = 0; - m_blupiFocus = true; + m_blupiVitesse.y = -12; + m_blupiAir = TRUE; + bStopJumpH = TRUE; } - } - if (m_blupiAction == 83) - { - if (m_blupiPhase == 4) + case ACTION_SUCETTE: + if (m_blupiPhase == 32) { - PlaySound(47, m_blupiPos); + //ObjectStart(m_sucettePos, m_sucetteType, 0); // respawn item (winphone behavior) + StopBlupi(TRUE); + m_blupiPower = TRUE; + m_blupiTimeShield = 100; + m_blupiPosMagic = m_blupiPos; + m_jauges[JAUGE_POWER].SetHide(FALSE); + PlaySound(SOUND_STARTPOWER, end); } - if (m_blupiPhase == 60) + case ACTION_DRINK: + if (m_blupiPhase == 36) { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; + //ObjectStart(m_sucettePos, m_sucetteType, 0); // respawn item (winphone behavior) + StopBlupi(TRUE); + m_blupiHide = TRUE; + m_blupiTimeShield = 100; + m_blupiPosMagic = m_blupiPos; + m_jauges[JAUGE_POWER].SetHide(FALSE); + PlaySound(SOUND_STARTHIDE, end); } } - if (m_blupiAction == 84 && m_blupiPhase == 18) + + if (m_keyPress & KEY_UP && + !(m_lastKeyPress & KEY_UP) && + IsBlupiStanding() && + m_blupiAction != ACTION_UP && + m_blupiFocus) { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; - } - if (m_blupiAction == 60 && m_blupiPhase == 3) - { - m_blupiAction = 1; + m_blupiAction = ACTION_UP; m_blupiPhase = 0; } - if (m_blupiAction == 61 && m_blupiPhase == 5) + + if (!(m_keyPress & (KEY_UP | KEY_DOWN)) && + m_lastKeyPress & KEY_UP && + IsBlupiStanding() && + m_blupiFocus) { - m_blupiAction = 1; + StopBlupi(); + } + + if (m_keyPress & KEY_DOWN && + !(m_lastKeyPress & KEY_DOWN) && + IsBlupiStanding() && + m_blupiAction != ACTION_DOWN && + m_blupiAction != ACTION_STOPPOP && + m_blupiFocus) + { + m_blupiAction = ACTION_DOWN; m_blupiPhase = 0; } - if (m_blupiAction == 62 && m_blupiPhase == 2) + + if ( !(m_keyPress & KEY_JUMP) && + IsBlupiStanding() && + m_blupiAction != ACTION_DOWN && + m_blupiAction != ACTION_STOPPOP && + m_blupiFocus) { - m_blupiAction = 5; - m_blupiPhase = 0; - m_blupiVitesse.y = -12; - m_blupiAir = true; - flag = true; - } - if (m_blupiAction == 49 && m_blupiPhase == 32) - { - //ObjectStart(m_sucettePos, m_sucetteType, 0); // respawn item (winphone behavior) - 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, adjustPos); - } - if (m_blupiAction == 55 && m_blupiPhase == 36) - { - //ObjectStart(m_sucettePos, m_sucetteType, 0); // respawn item (winphone behavior) - 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, adjustPos); - } - if ( 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_blupiAction = ACTION_DOWN; m_blupiPhase = 0; } - if (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) + if (!(m_keyPress & KEY_DOWN) && + m_lastKeyPress & KEY_DOWN && + IsBlupiStanding() && + m_blupiFocus) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } - if ( 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_keyPress & KEY_LEFT) == 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_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) + if (m_blupiAction == ACTION_UP && m_blupiPhase == 4) { m_scrollAdd.y = -150; - PlaySound(21, adjustPos); + PlaySound(SOUND_LOOKUP, end); } - if (m_blupiAction == 6 && m_blupiPhase == 4) + if (m_blupiAction == ACTION_DOWN && m_blupiPhase == 4) { m_scrollAdd.y = 150; - PlaySound(7, adjustPos); + PlaySound(SOUND_DOWN, end); } - if (!m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + if (!IsBlupiVehicle() && + !m_blupiBalloon && + !m_blupiEcrase && + !m_blupiNage && + !m_blupiSurf && + !m_blupiSuspend + && m_blupiFocus) { - if ( (m_keyPress & KEY_LEFT) == 0 && m_blupiAction != 28 && m_blupiDir == 1 && (num = CaisseInFront()) != -1) + if (m_keyPress & KEY_DOWN && + !(m_keyPress & (KEY_JUMP | KEY_LEFT | KEY_RIGHT)) && + m_blupiAction != ACTION_STOPPOP && + m_blupiDir == DIR_LEFT && + (num = CaisseInFront()) != -1) { - adjustPos.x = m_moveObject[num].posCurrent.x + 64 - 5; - m_blupiAction = 28; + end.x = m_moveObject[num].posCurrent.x + 64 - 5; + m_blupiAction = ACTION_STOPPOP; m_blupiPhase = 0; m_scrollAdd.y = 0; - PlaySound(39, adjustPos); + PlaySound(SOUND_POP, end); } - if ( (m_keyPress & KEY_LEFT) == 0 && m_blupiAction != 29 && m_blupiDir == 1 && CaisseInFront() != -1) + if (m_keyPress & (KEY_DOWN | KEY_RIGHT) && + !(m_keyPress & KEY_JUMP) && + m_blupiAction != ACTION_POP && + m_blupiDir == DIR_LEFT && + CaisseInFront() != -1) { - m_blupiAction = 29; + m_blupiAction = ACTION_POP; m_blupiPhase = 0; m_scrollAdd.y = 0; - PlaySound(39, adjustPos); + PlaySound(SOUND_POP, end); } - if ( (m_keyPress & KEY_LEFT) == 0 && m_blupiAction != 28 && m_blupiDir == 2 && (num = CaisseInFront()) != -1) + if (m_keyPress & KEY_DOWN && + !(m_keyPress & (KEY_JUMP | KEY_LEFT | KEY_RIGHT)) && + m_blupiAction != ACTION_STOPPOP && + m_blupiDir == DIR_RIGHT && + (num = CaisseInFront()) != -1) { - adjustPos.x = m_moveObject[num].posCurrent.x - 60 + 5; - m_blupiAction = 28; + end.x = m_moveObject[num].posCurrent.x - DIMBLUPIX + 5; + m_blupiAction = ACTION_STOPPOP; m_blupiPhase = 0; m_scrollAdd.y = 0; - PlaySound(39, adjustPos); + PlaySound(SOUND_POP, end); } - if ((m_keyPress & KEY_LEFT) == 0 && m_blupiAction != 29 && m_blupiDir == 2 && CaisseInFront() != -1) + if (m_keyPress & (KEY_DOWN | KEY_LEFT) && + !(m_keyPress & KEY_JUMP) && + m_blupiAction != ACTION_POP && + m_blupiDir == DIR_RIGHT && + CaisseInFront() != -1) { - m_blupiAction = 29; + m_blupiAction = ACTION_POP; m_blupiPhase = 0; m_scrollAdd.y = 0; - PlaySound(39, adjustPos); + PlaySound(SOUND_POP, end); } - if (m_blupiAction == 29 && m_blupiActionOuf != 47) + if (m_blupiAction == ACTION_POP && m_blupiActionOuf != ACTION_OUF3) { - m_blupiActionOuf = 47; + m_blupiActionOuf = ACTION_OUF3; m_blupiTimeOuf = 0; } } - if (m_blupiAction != 28 && m_blupiAction != 29 && m_blupiFocus) + if (m_blupiAction != ACTION_STOPPOP && + m_blupiAction != ACTION_POP && + m_blupiFocus) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } int num3; int num4; - if (m_blupiFocus) + if (m_keyPress & KEY_LEFT && 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) || abs(m_blupiVitesse.x) <= 8)) + if (m_blupiDir == DIR_RIGHT && + m_blupiAction != ACTION_TURN && + m_blupiAction != ACTION_TURNAIR && + m_blupiAction != ACTION_UP && + m_blupiAction != ACTION_DOWN && + m_blupiAction != ACTION_POP && + ((!m_blupiJeep && !m_blupiTank && !m_blupiSkate) || abs(m_blupiVitesse.x) <= 8)) { if (m_blupiAir) { - PlaySound(5, adjustPos); - m_blupiAction = 59; + PlaySound(SOUND_TURN, end); + m_blupiAction = ACTION_TURNAIR; m_blupiPhase = 0; - m_blupiDir = 1; + m_blupiDir = DIR_LEFT; } else { - PlaySound(5, adjustPos); - m_blupiAction = 3; + PlaySound(SOUND_TURN, end); + m_blupiAction = ACTION_TURN; 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) + if (m_blupiDir == DIR_LEFT && + m_blupiAction != ACTION_MARCH && + m_blupiAction != ACTION_PUSH && + m_blupiAction != ACTION_JUMP && + m_blupiAction != ACTION_UP && + m_blupiAction != ACTION_DOWN && + m_blupiAction != ACTION_POP && + !m_blupiAir) { - m_blupiAction = 2; + m_blupiAction = ACTION_MARCH; 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_blupiDir == DIR_LEFT && + m_blupiAction != ACTION_TURN && + m_blupiAction != ACTION_JUMP && + m_blupiAction != ACTION_UP && + m_blupiAction != ACTION_DOWN && + m_blupiAction != ACTION_POP && + !IsBlupiVehicle() && + !m_blupiBalloon && + !m_blupiEcrase && + !m_blupiNage && + !m_blupiSurf && + !m_blupiSuspend) { - if (m_blupiAction == 14) + if (m_blupiAction == ACTION_PUSH) { - adjustPos.x -= CaisseGetMove(5); + end.x -= CaisseGetMove(5); + } + else + { + num3 = m_blupiPhase; + if (m_blupiPhase > 3 || m_blupiAir) + { + m_blupiPhase = 3; + } + num4 = table_vitesse_march[num3]; + if (m_blupiPower) + { + num4 *= 3; + num4 /= 2; + } + end.x += num4; + } + } + if (m_blupiDir == DIR_RIGHT && m_blupiAction == ACTION_POP) + { + end.x -= CaisseGetMove(3); + } + } // if (m_keyPress & KEY_LEFT && m_blupiFocus) + + if (m_keyPress & KEY_RIGHT && m_blupiFocus) + { + if (m_blupiDir == DIR_LEFT && + m_blupiAction != ACTION_TURN && + m_blupiAction != ACTION_TURNAIR && + m_blupiAction != ACTION_UP && + m_blupiAction != ACTION_DOWN && + m_blupiAction != ACTION_POP && + ((!m_blupiJeep && !m_blupiTank && !m_blupiSkate) || abs(m_blupiVitesse.x) <= 8)) + { + if (m_blupiAir) + { + PlaySound(SOUND_TURN, end); + m_blupiAction = ACTION_TURNAIR; + m_blupiPhase = 0; + m_blupiDir = DIR_RIGHT; + } + else + { + PlaySound(SOUND_TURN, end); + m_blupiAction = ACTION_TURN; + m_blupiPhase = 0; + } + } + if (m_blupiDir == DIR_RIGHT && + m_blupiAction != ACTION_MARCH && + m_blupiAction != ACTION_PUSH && + m_blupiAction != ACTION_JUMP && + m_blupiAction != ACTION_UP && + m_blupiAction != ACTION_DOWN && + m_blupiAction != ACTION_POP && + !m_blupiAir) + { + m_blupiAction = ACTION_MARCH; + m_blupiPhase = 0; + } + if (m_blupiDir == DIR_RIGHT && + m_blupiAction != ACTION_TURN && + m_blupiAction != ACTION_JUMP && + m_blupiAction != ACTION_UP && + m_blupiAction != ACTION_DOWN && + m_blupiAction != ACTION_POP && + !IsBlupiVehicle() && + !m_blupiBalloon && + !m_blupiEcrase && + !m_blupiNage && + !m_blupiSurf && + !m_blupiSuspend) + { + if (m_blupiAction == ACTION_PUSH) + { + end.x += CaisseGetMove(5); } else { @@ -940,435 +1029,272 @@ void CDecor::BlupiStep() num4 *= 3; num4 /= 2; } - //tinyPoint3.x += Misc.Speed(m_blupiSpeedX, num4); + end.x += num4; } } - if (m_blupiDir == 2 && m_blupiAction == 29) + if (m_blupiDir == DIR_LEFT && m_blupiAction == ACTION_POP) { - adjustPos.x -= CaisseGetMove(3); + end.x += CaisseGetMove(3); } - } - if (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) || abs(m_blupiVitesse.x) <= 8)) - { - if (m_blupiAir) - { - PlaySound(5, adjustPos); - m_blupiAction = 59; - m_blupiPhase = 0; - m_blupiDir = 2; - } - else - { - PlaySound(5, adjustPos); - 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) - { - adjustPos.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; - } - } - } - if (m_blupiDir == 1 && m_blupiAction == 29) - { - adjustPos.x += CaisseGetMove(3); - } - } + } // if (m_keyPress & KEY_RIGHT && m_blupiFocus) + if (m_blupiHelico) { - if (m_blupiAction == 3 && m_blupiPhase == 10) + if (m_blupiAction == ACTION_TURN && m_blupiPhase == 10) { - m_blupiAction = 2; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } + m_blupiAction = ACTION_MARCH; + if (m_blupiDir == DIR_LEFT) m_blupiDir = DIR_RIGHT; + else m_blupiDir = DIR_LEFT; } } else if (m_blupiOver) { - if (m_blupiAction == 3 && m_blupiPhase == 7) + if (m_blupiAction == ACTION_TURN && m_blupiPhase == 7) { - m_blupiAction = 2; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } + m_blupiAction = ACTION_MARCH; + if (m_blupiDir == DIR_LEFT) m_blupiDir = DIR_RIGHT; + else m_blupiDir = DIR_LEFT; } } else if (m_blupiJeep) { - if (m_blupiAction == 3 && m_blupiPhase == 7) + if (m_blupiAction == ACTION_TURN && m_blupiPhase == 7) { - m_blupiAction = 1; - m_blupiPhase = 0; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } + StopBlupi(); + if (m_blupiDir == DIR_LEFT) m_blupiDir = DIR_RIGHT; + else m_blupiDir = DIR_LEFT; } } else if (m_blupiTank) { - if (m_blupiAction == 3 && m_blupiPhase == 12) + if (m_blupiAction == ACTION_TURN && m_blupiPhase == 12) { - m_blupiAction = 1; - m_blupiPhase = 0; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } + StopBlupi(); + if (m_blupiDir == DIR_LEFT) m_blupiDir = DIR_RIGHT; + else m_blupiDir = DIR_LEFT; } } else if (m_blupiSkate) { - if (m_blupiAction == 3 && m_blupiPhase == 14) + if (m_blupiAction == ACTION_TURN && m_blupiPhase == 14) { - m_blupiAction = 1; - m_blupiPhase = 0; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } + StopBlupi(); + if (m_blupiDir == DIR_LEFT) m_blupiDir = DIR_RIGHT; + else m_blupiDir = DIR_LEFT; } } else if (m_blupiNage || m_blupiSurf) { - if (m_blupiAction == 3 && m_blupiPhase == 10) + if (m_blupiAction == ACTION_TURN && m_blupiPhase == 10) { - m_blupiAction = 2; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } + m_blupiAction = ACTION_MARCH; + if (m_blupiDir == DIR_LEFT) m_blupiDir = DIR_RIGHT; + else m_blupiDir = DIR_LEFT; } } else if (m_blupiSuspend) { - if (m_blupiAction == 3 && m_blupiPhase == 10) + if (m_blupiAction == ACTION_TURN && m_blupiPhase == 10) { - m_blupiAction = 1; - m_blupiPhase = 0; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } + StopBlupi(); + if (m_blupiDir == DIR_LEFT) m_blupiDir = DIR_RIGHT; + else m_blupiDir = DIR_LEFT; } } else { - if (m_blupiAction == 3 && m_blupiPhase == 6) + if (m_blupiAction == ACTION_TURN && m_blupiPhase == 6) { - m_blupiAction = 1; - m_blupiPhase = 0; - if (m_blupiDir == 1) - { - m_blupiDir = 2; - } - else - { - m_blupiDir = 1; - } + StopBlupi(); + if (m_blupiDir == DIR_LEFT) m_blupiDir = DIR_RIGHT; + else m_blupiDir = DIR_LEFT; } - if (m_blupiAction == 59 && m_blupiPhase == 6) + if (m_blupiAction == ACTION_TURNAIR && m_blupiPhase == 6) { - m_blupiAction = 5; + m_blupiAction = ACTION_AIR; m_blupiPhase = 0; } } - if (!m_blupiSuspend && m_blupiAction == 4 && m_blupiPhase == 3) + + if (!m_blupiSuspend && m_blupiAction == ACTION_JUMP && m_blupiPhase == 3) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } - if (m_blupiSpeedX == 0 && m_blupiSpeedY == 0 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && m_blupiFocus) + + if (!(m_keyPress & (KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN)) && + !IsBlupiVehicle() && + !m_blupiBalloon && + !m_blupiEcrase && + !m_blupiNage && + !m_blupiSurf && + m_blupiFocus) { - if (m_blupiAction == 14 || m_blupiAction == 7) + if (m_blupiAction == ACTION_PUSH || m_blupiAction == ACTION_UP) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } - if (m_blupiAction == 2) + if (m_blupiAction == ACTION_MARCH) { if (m_blupiSuspend || m_blupiPhase < 10) { - m_blupiAction = 1; + StopBlupi(); } else { - m_blupiAction = 60; + m_blupiAction = ACTION_STOPMARCH; + m_blupiPhase = 0; } - m_blupiPhase = 0; } - if (m_blupiAction == 6) + if (m_blupiAction == ACTION_DOWN) { - m_blupiAction = 1; - m_blupiPhase = 0; - PlaySound(20, adjustPos); + StopBlupi(); + PlaySound(ACTION_UP, end); } m_scrollAdd.y = 0; - if (blupiAction == 14) + if (lastBlupiAction == ACTION_PUSH) { - StopSound(38); + StopSound(SOUND_PUSH); } - if (blupiAction == 29 || blupiAction == 28) + if (lastBlupiAction == ACTION_POP || lastBlupiAction == ACTION_STOPPOP) { - StopSound(39); + StopSound(SOUND_POP); } } - if (!m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && m_blupiFocus) + if (!m_blupiBalloon && + !m_blupiEcrase && + !m_blupiJeep && + !m_blupiTank && + !m_blupiSkate && + !m_blupiNage && + !m_blupiSurf && + m_blupiFocus) { - if (m_blupiAction == 9 && m_blupiDir == 1) + if (m_blupiAction == ACTION_RECEDE && m_blupiDir == DIR_LEFT) { - adjustPos.x += 4; + end.x += 4; } - if (m_blupiAction == 9 && m_blupiDir == 2) + if (m_blupiAction == ACTION_RECEDE && m_blupiDir == DIR_RIGHT) { - adjustPos.x -= 4; + end.x -= 4; } - if (m_blupiAction == 10 && m_blupiDir == 1) + if (m_blupiAction == ACTION_ADVANCE && m_blupiDir == DIR_LEFT) { - adjustPos.x -= 4; + end.x -= 4; } - if (m_blupiAction == 10 && m_blupiDir == 2) + if (m_blupiAction == ACTION_ADVANCE && m_blupiDir == DIR_RIGHT) { - adjustPos.x += 4; + end.x += 4; } } - if ((m_keyPress & -3) == 0 && m_blupiSpeedX == 0 && m_blupiSpeedY == 0 && (m_blupiJeep || m_blupiTank || m_blupiSkate) && m_blupiFocus) + + if (!(m_keyPress & (KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN | KEY_JUMP))) { - if (m_blupiAction == 10 && m_blupiDir == 1) + if ((m_blupiJeep || m_blupiTank || m_blupiSkate) && m_blupiFocus) { - adjustPos.x -= 5; + if (m_blupiAction == ACTION_ADVANCE && m_blupiDir == DIR_LEFT) + { + end.x -= 5; + } + if (m_blupiAction == ACTION_ADVANCE && m_blupiDir == DIR_RIGHT) + { + end.x += 5; + } } - if (m_blupiAction == 10 && m_blupiDir == 2) + if ((m_blupiNage || m_blupiSurf) && + m_blupiFocus && + m_blupiAction == ACTION_MARCH) { - adjustPos.x += 5; + StopBlupi(); } } - if ((m_keyPress & -3) == 0 && m_blupiNage && m_blupiFocus && m_blupiAction == 2) + if (m_blupiHelico && (m_blupiFocus || m_blupiAction == ACTION_HELICOGLU)) { - m_blupiAction = 1; - m_blupiPhase = 0; - } - if ((m_keyPress & -3) == 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 & KEY_RIGHT) != 0 && m_blupiTimeFire == 0 && m_blupiAction != 3 && m_blupiAction != 58 && flag) + if (m_keyPress & KEY_FIRE && + m_blupiTimeFire == 0 && + m_blupiAction != ACTION_TURN && + m_blupiAction != ACTION_HELICOGLU && + flag) { if (m_blupiBullet == 0) { - PlaySound(53, m_blupiPos); + PlaySound(SOUND_FIREKO, m_blupiPos); } else { - m_blupiAction = 58; + m_blupiAction = ACTION_HELICOGLU; m_blupiPhase = 0; - m_blupiFocus = false; + m_blupiFocus = FALSE; } } ////m_blupiMotorHigh = flag4; - if (m_blupiAction != 3 && m_blupiAction != 58) + if (m_blupiAction != ACTION_TURN && m_blupiAction != ACTION_HELICOGLU) { - if (flag) + if (bStopJumpH) { - m_blupiAction = 2; + m_blupiAction = ACTION_MARCH; } else { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); m_blupiVitesse.y = 0; } } + if (m_keyPress & (KEY_UP | KEY_JUMP)) { - if (m_blupiSpeedY <= -1 || (m_keyPress & KEY_LEFT) != 0) - { - if (m_blupiVitesse.y > -10) - { - m_blupiVitesse.y -= 0.5; - } - } - else if (m_blupiSpeedY >= 1) - { - if (m_blupiVitesse.y < 12) - { - m_blupiVitesse.y += 0.5; - } - } - else - { - if (m_blupiVitesse.y > 1) - { - m_blupiVitesse.y -= 1; - } - if (m_blupiVitesse.y < 1) - { - m_blupiVitesse.y += 1; - } - } - adjustPos.y += (int)m_blupiVitesse.y; + if (m_blupiVitesse.y > -10) m_blupiVitesse.y -= 2; } - if (FALSE) + else if (m_keyPress & KEY_DOWN) { - if (m_blupiSpeedX <= -1) - { - int num5 = (int)(m_blupiSpeedX * 12); - if (m_blupiVitesse.x > num5) - { - m_blupiVitesse.x -= 0.5; - } - tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x; - tinyPoint.y = adjustPos.y; - if (BlupiBloque(tinyPoint, -1)) - { - m_blupiVitesse.x = 0; - } - } - else if (m_blupiSpeedX >= 1) - { - int num6 = (int)(m_blupiSpeedX * 12); - if (m_blupiVitesse.x < num6) - { - m_blupiVitesse.x += 0.5; - } - tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x; - tinyPoint.y = adjustPos.y; - if (BlupiBloque(tinyPoint, 1)) - { - m_blupiVitesse.x = 0; - } - } - else - { - if (m_blupiVitesse.x > 0) - { - m_blupiVitesse.x -= 2; - if (m_blupiVitesse.x < 0) - { - m_blupiVitesse.x = 0; - } - } - if (m_blupiVitesse.x < 0) - { - m_blupiVitesse.x += 2; - if (m_blupiVitesse.x > 0) - { - m_blupiVitesse.x = 0; - } - } - } - adjustPos.x += (int)m_blupiVitesse.x; + if (m_blupiVitesse.y < 12) m_blupiVitesse.y += 2; } else { - if (m_blupiSpeedX <= -1) - { - int num7 = (int)(m_blupiSpeedX * 16); - if (m_blupiVitesse.x > num7) - { - m_blupiVitesse.x -= 1; - } - tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x; - tinyPoint.y = adjustPos.y; - if (BlupiBloque(tinyPoint, -1)) - { - m_blupiVitesse.x = 0; - } - } - else if (m_blupiSpeedX >= 1) - { - int num8 = (int)(m_blupiSpeedX * 16); - if (m_blupiVitesse.x < num8) - { - m_blupiVitesse.x += 1; - } - tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x; - tinyPoint.y = adjustPos.y; - if (BlupiBloque(tinyPoint, 1)) - { - m_blupiVitesse.x = 0; - } - } - else - { - if (m_blupiVitesse.x > 0) - { - m_blupiVitesse.x -= 2; - if (m_blupiVitesse.x < 0) - { - m_blupiVitesse.x = 0; - } - } - if (m_blupiVitesse.x < 0) - { - m_blupiVitesse.x += 2; - if (m_blupiVitesse.x > 0) - { - m_blupiVitesse.x = 0; - } - } - } - adjustPos.x += (int)m_blupiVitesse.x; + if (m_blupiVitesse.y > 1) m_blupiVitesse.y -= 1; + if (m_blupiVitesse.y < 1) m_blupiVitesse.y += 1; } + end.y += m_blupiVitesse.y; + + if (m_keyPress & KEY_LEFT) + { + if (m_blupiVitesse.x > -16) + { + m_blupiVitesse.x -= 2; + } + if (BlupiBloque({ end.x + m_blupiVitesse.x, end.y }, -1)) + { + m_blupiVitesse.x = 0; + } + } + else if (m_keyPress & KEY_RIGHT) + { + if (m_blupiVitesse.x < 16) + { + m_blupiVitesse.x += 2; + } + if (BlupiBloque({ end.x + m_blupiVitesse.x, end.y }, -1)) + { + m_blupiVitesse.x = 0; + } + } + else + { + if (m_blupiVitesse.x > 0) + { + m_blupiVitesse.x -= 2; + if (m_blupiVitesse.x < 0) m_blupiVitesse.x = 0; + } + if (m_blupiVitesse.x < 0) + { + m_blupiVitesse.x += 2; + if (m_blupiVitesse.x > 0) m_blupiVitesse.x = 0; + } + } + end.x += m_blupiVitesse.x; + MoveObjectPollution(); - if ( !flag && m_blupiTransport == -1) + + if ( !flag2 && m_blupiTransport == -1) { rect.left = m_blupiPos.x + 20; @@ -1386,11 +1312,9 @@ void CDecor::BlupiStep() 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_blupiHelico = FALSE; + StopBlupi(TRUE); m_blupiPosHelico = m_blupiPos; - m_blupiFocus = true; StopSound(16); StopSound(18); PlaySound(17, m_blupiPos); @@ -1400,32 +1324,31 @@ void CDecor::BlupiStep() if (m_blupiOver && (m_blupiFocus || m_blupiAction == 58)) { ////m_blupiMotorHigh = flag4; - if (m_blupiAction != 3) + if (m_blupiAction != ACTION_TURN) { if (flag) { - m_blupiAction = 2; + m_blupiAction = ACTION_MARCH; } else { if (m_blupiAction != 1) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } m_blupiVitesse.y = 0; } } - rect = BlupiRect(adjustPos); - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60 + OVERHEIGHT - 1; + rect = BlupiRect(end); + rect.top = end.y + 60 - 2; + rect.bottom = end.y + 60 + OVERHEIGHT - 1; bool flag7 = !DecorDetect(rect); num = MoveAscenseurDetect(m_blupiPos, OVERHEIGHT); if (num != -1) { - flag7 = false; + flag7 = FALSE; } - if (((m_keyPress & KEY_LEFT) != 0) && !flag7) + if (m_keyPress & KEY_JUMP && !flag7) { if (m_blupiVitesse.y == 0 && num != -1) { @@ -1436,7 +1359,7 @@ void CDecor::BlupiStep() m_blupiVitesse.y -= 1; } } - else if (m_blupiSpeedY > 0) + else if (m_keyPress & KEY_DOWN) { if (m_blupiVitesse.y < 12) { @@ -1447,30 +1370,28 @@ void CDecor::BlupiStep() { m_blupiVitesse.y += 1; } - adjustPos.y += (int)m_blupiVitesse.y; - if (m_blupiSpeedX < 0 && flag) + end.y += (int)m_blupiVitesse.y; + if (m_keyPress & KEY_LEFT && flag) { - int num9 = (int)(m_blupiSpeedX * 12); - if (m_blupiVitesse.x > num9) + if (m_blupiVitesse.x > -12) { m_blupiVitesse.x -= 1; } - tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x; - tinyPoint.y = adjustPos.y; + tinyPoint.x = end.x + m_blupiVitesse.x; + tinyPoint.y = end.y; if (BlupiBloque(tinyPoint, -1)) { m_blupiVitesse.x = 0; } } - else if (m_blupiSpeedX > 0 && flag) + else if (m_keyPress & KEY_RIGHT && flag) { - int num10 = (int)(m_blupiSpeedX * 12); - if (m_blupiVitesse.x < num10) + if (m_blupiVitesse.x < 12) { m_blupiVitesse.x += 1; } - tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x; - tinyPoint.y = adjustPos.y; + tinyPoint.x = end.x + m_blupiVitesse.x; + tinyPoint.y = end.y; if (BlupiBloque(tinyPoint, 1)) { m_blupiVitesse.x = 0; @@ -1487,8 +1408,10 @@ void CDecor::BlupiStep() m_blupiVitesse.x += 1; } } - adjustPos.x += (int)m_blupiVitesse.x; + end.x += m_blupiVitesse.x; + MoveObjectPollution(); + if ( !flag && m_blupiTransport == -1) { @@ -1507,11 +1430,9 @@ void CDecor::BlupiStep() 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_blupiOver = FALSE; + StopBlupi(TRUE); m_blupiPosHelico = m_blupiPos; - m_blupiFocus = true; StopSound(16); StopSound(18); PlaySound(17, m_blupiPos); @@ -1520,14 +1441,14 @@ void CDecor::BlupiStep() } if (m_blupiBalloon && m_blupiFocus) { - if ((m_keyPress & KEY_LEFT) != 0) + if (m_keyPress & KEY_JUMP) { if (m_blupiVitesse.y > -5 && m_time % 6 == 0) { m_blupiVitesse.y -= 1; } } - else if (m_blupiSpeedY > 0) + else if (m_keyPress & KEY_DOWN) { if (m_blupiVitesse.y < 0 && m_time % 6 == 0) { @@ -1538,30 +1459,28 @@ void CDecor::BlupiStep() { m_blupiVitesse.y -= 1; } - adjustPos.y += (int)m_blupiVitesse.y; - if (m_blupiSpeedX < 0) + end.y += (int)m_blupiVitesse.y; + if (m_keyPress & KEY_LEFT) { - int num11 = (int)(m_blupiSpeedX * 10); - if (m_blupiVitesse.x > num11) + if (m_blupiVitesse.x > -10) { m_blupiVitesse.x -= 1; } - tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x; - tinyPoint.y = adjustPos.y; + tinyPoint.x = end.x + m_blupiVitesse.x; + tinyPoint.y = end.y; if (BlupiBloque(tinyPoint, -1)) { m_blupiVitesse.x = 0; } } - else if (m_blupiSpeedX > 0) + else if (m_keyPress & KEY_RIGHT) { - int num12 = (int)(m_blupiSpeedX * 10); - if (m_blupiVitesse.x < num12) + if (m_blupiVitesse.x < 10) { m_blupiVitesse.x += 1; } - tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x; - tinyPoint.y = adjustPos.y; + tinyPoint.x = end.x + m_blupiVitesse.x; + tinyPoint.y = end.y; if (BlupiBloque(tinyPoint, 1)) { m_blupiVitesse.x = 0; @@ -1586,7 +1505,7 @@ void CDecor::BlupiStep() } } } - adjustPos.x += (int)m_blupiVitesse.x; + end.x += (int)m_blupiVitesse.x; } if (m_blupiEcrase && m_blupiFocus) { @@ -1601,7 +1520,7 @@ void CDecor::BlupiStep() { m_blupiVitesse.y = 0; } - adjustPos.y += (int)m_blupiVitesse.y; + end.y += (int)m_blupiVitesse.y; if (flag) { num3 = 7; @@ -1610,28 +1529,28 @@ void CDecor::BlupiStep() { num3 = 4; } - num3 = (int)(num3 * m_blupiSpeedX); - if (m_blupiSpeedX < 0) + if (m_keyPress & KEY_LEFT) num3 = -num3; + if (m_keyPress & KEY_LEFT) { if (m_blupiVitesse.x > num3) { m_blupiVitesse.x -= 1; } - tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x; - tinyPoint.y = adjustPos.y; + tinyPoint.x = end.x + (int)m_blupiVitesse.x; + tinyPoint.y = end.y; if (BlupiBloque(tinyPoint, -1)) { m_blupiVitesse.x = 0; } } - else if (m_blupiSpeedX > 0) + else if (m_keyPress & KEY_RIGHT) { if (m_blupiVitesse.x < num3) { m_blupiVitesse.x += 1; } - tinyPoint.x = adjustPos.x + (int)m_blupiVitesse.x; - tinyPoint.y = adjustPos.y; + tinyPoint.x = end.x + (int)m_blupiVitesse.x; + tinyPoint.y = end.y; if (BlupiBloque(tinyPoint, 1)) { m_blupiVitesse.x = 0; @@ -1658,23 +1577,21 @@ void CDecor::BlupiStep() } if (m_blupiVitesse.x == 0 && !flag) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } - adjustPos.x += (int)m_blupiVitesse.x; + end.x += (int)m_blupiVitesse.x; } if (m_blupiJeep && m_blupiFocus) { if (m_blupiVitesse.x == 0 && m_blupiAction == 2) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } //m_blupiMotorHigh = (m_blupiAction != 1); - rect = BlupiRect(adjustPos); + rect = BlupiRect(end); rect.right -= 40; - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60 - 1; + rect.top = end.y + 60 - 2; + rect.bottom = end.y + 60 - 1; bool flag8 = !DecorDetect(rect); rect.left += 40; rect.right += 40; @@ -1694,20 +1611,20 @@ void CDecor::BlupiStep() } m_blupiVitesse.y = 0; } - adjustPos.y += (int)m_blupiVitesse.y; + end.y += (int)m_blupiVitesse.y; if (m_blupiTransport == -1) { - rect.left = adjustPos.x + 20; - rect.right = adjustPos.x + 60 - 20; - rect.top = adjustPos.y + 60 - 35; - rect.bottom = adjustPos.y + 60 - 1; - num = AscenseurDetect(rect, m_blupiPos, adjustPos); + rect.left = end.x + 20; + rect.right = end.x + 60 - 20; + rect.top = end.y + 60 - 35; + rect.bottom = end.y + 60 - 1; + num = AscenseurDetect(rect, m_blupiPos, end); if (m_blupiVitesse.y >= 0 && num != -1) { m_blupiTransport = num; - flag = false; - PlaySound(3, adjustPos); - adjustPos.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY; + flag2 = FALSE; + PlaySound(3, end); + end.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY; } } if (flag8 && !flag9) @@ -1726,18 +1643,16 @@ void CDecor::BlupiStep() m_blupiVitesse.x += 1; } } - else if (m_blupiSpeedX < 0) + else if (m_keyPress & KEY_LEFT) { - int num15 = (int)(m_blupiSpeedX * 20); - if (m_blupiVitesse.x > num15) + if (m_blupiVitesse.x > -20) { m_blupiVitesse.x -= 1; } } - else if (m_blupiSpeedX > 0) + else if (m_keyPress & KEY_RIGHT) { - int num16 = (int)(m_blupiSpeedX * 20); - if (m_blupiVitesse.x < num16) + if (m_blupiVitesse.x < 20) { m_blupiVitesse.x += 1; } @@ -1765,16 +1680,15 @@ void CDecor::BlupiStep() { m_blupiVitesse.x = 0; } - adjustPos.x += (int)m_blupiVitesse.x; + end.x += (int)m_blupiVitesse.x; MoveObjectPollution(); if ( !flag && m_blupiTransport == -1) { 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_blupiJeep = FALSE; + StopBlupi(); m_blupiPosHelico = m_blupiPos; StopSound(29); StopSound(31); @@ -1785,10 +1699,9 @@ void CDecor::BlupiStep() { if (m_blupiAction == 53 && m_blupiPhase == 6) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } - if ((m_keyPress & KEY_RIGHT) != 0 && m_blupiTimeFire == 0 && m_blupiAction != 3) + if ((m_keyPress & KEY_FIRE) != 0 && m_blupiTimeFire == 0 && m_blupiAction != ACTION_TURN) { if (m_blupiBullet == 0) { @@ -1796,7 +1709,7 @@ void CDecor::BlupiStep() } else { - if (m_blupiDir == 1) + if (m_blupiDir == DIR_LEFT) { tinyPoint.x = m_blupiPos.x - 35; tinyPoint.y = m_blupiPos.y; @@ -1822,8 +1735,7 @@ void CDecor::BlupiStep() } if (m_blupiVitesse.x == 0 && m_blupiAction == 2) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } //m_blupiMotorHigh = (m_blupiAction != 1); if (flag) @@ -1841,34 +1753,32 @@ void CDecor::BlupiStep() } m_blupiVitesse.y = 0; } - adjustPos.y += (int)m_blupiVitesse.y; + end.y += (int)m_blupiVitesse.y; if (m_blupiTransport == -1) { - rect.left = adjustPos.x + 20; - rect.right = adjustPos.x + 60 - 20; - rect.top = adjustPos.y + 60 - 35; - rect.bottom = adjustPos.y + 60 - 1; - num = AscenseurDetect(rect, m_blupiPos, adjustPos); + rect.left = end.x + 20; + rect.right = end.x + 60 - 20; + rect.top = end.y + 60 - 35; + rect.bottom = end.y + 60 - 1; + num = AscenseurDetect(rect, m_blupiPos, end); if (m_blupiVitesse.y >= 0 && num != -1) { m_blupiTransport = num; - flag = false; - PlaySound(3, adjustPos); - adjustPos.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY; + flag = FALSE; + PlaySound(3, end); + end.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY; } } - if (m_blupiSpeedX < 0) + if (m_keyPress & KEY_LEFT) { - int num17 = (int)(m_blupiSpeedX * 12); - if (m_blupiVitesse.x > num17) + if (m_blupiVitesse.x > -12) { m_blupiVitesse.x -= 1; } } - else if (m_blupiSpeedX > 0) + else if (m_keyPress & KEY_RIGHT) { - int num18 = (int)(m_blupiSpeedX * 12); - if (m_blupiVitesse.x < num18) + if (m_blupiVitesse.x < 12) { m_blupiVitesse.x += 1; } @@ -1896,7 +1806,7 @@ void CDecor::BlupiStep() { m_blupiVitesse.x = 0; } - adjustPos.x += (int)m_blupiVitesse.x; + end.x += (int)m_blupiVitesse.x; MoveObjectPollution(); if ( !flag && m_blupiTransport == -1) { @@ -1904,9 +1814,8 @@ void CDecor::BlupiStep() tinyPoint.x = m_blupiPos.x; tinyPoint.y = m_blupiPos.y; ObjectStart(tinyPoint, 28, 0); - m_blupiTank = false; - m_blupiAction = 1; - m_blupiPhase = 0; + m_blupiTank = FALSE; + StopBlupi(); m_blupiPosHelico = m_blupiPos; StopSound(29); StopSound(31); @@ -1917,21 +1826,18 @@ void CDecor::BlupiStep() { if (m_blupiVitesse.x == 0 && m_blupiAction == 2) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } - if (m_blupiSpeedX < 0) + if (m_keyPress & KEY_LEFT) { - int num19 = (int)(m_blupiSpeedX * 15); - if (m_blupiVitesse.x > num19) + if (m_blupiVitesse.x > -15) { m_blupiVitesse.x -= 1; } } - else if (m_blupiSpeedX > 0) + else if (m_keyPress & KEY_RIGHT) { - int num20 = (int)(m_blupiSpeedX * 15); - if (m_blupiVitesse.x < num20) + if (m_blupiVitesse.x < 15) { m_blupiVitesse.x += 1; } @@ -1959,14 +1865,14 @@ void CDecor::BlupiStep() { m_blupiVitesse.x = 0; } - adjustPos.x += (int)m_blupiVitesse.x; + end.x += (int)m_blupiVitesse.x; if ( !flag && !m_blupiAir && m_blupiTransport == -1 && m_blupiVitesse.x < 8) { - m_blupiSkate = false; + m_blupiSkate = FALSE; m_blupiAction = 43; m_blupiPhase = 0; - m_blupiFocus = false; + m_blupiFocus = FALSE; m_blupiPosHelico = m_blupiPos; } } @@ -1974,7 +1880,7 @@ void CDecor::BlupiStep() { if (m_blupiPhase == 8) { - num = MoveObjectDetect(m_blupiPos, &flag6); + num = MoveObjectDetect(m_blupiPos, &bNear); if (num != -1) { ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); @@ -1982,9 +1888,7 @@ void CDecor::BlupiStep() } if (m_blupiPhase == 20) { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; + StopBlupi(TRUE); } } if (m_blupiAction == 43) @@ -1997,16 +1901,14 @@ void CDecor::BlupiStep() } if (m_blupiPhase == 20) { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; + StopBlupi(TRUE); } } if (m_blupiNage && m_blupiFocus) { if (m_blupiTransport == -1) { - if ((m_keyPress & KEY_LEFT) != 0) + if ((m_keyPress & KEY_JUMP) != 0) { if (m_blupiVitesse.y > -5) { @@ -2037,20 +1939,18 @@ void CDecor::BlupiStep() m_blupiVitesse.y += 1; } } - adjustPos.y += (int)m_blupiVitesse.y; + end.y += (int)m_blupiVitesse.y; } - if (m_blupiSpeedX < 0) + if (m_keyPress & KEY_LEFT) { - int num21 = (int)(m_blupiSpeedX * 8); - if (m_blupiVitesse.x > num21) + if (m_blupiVitesse.x > -8) { m_blupiVitesse.x -= 1; } } - else if (m_blupiSpeedX > 0) + else if (m_keyPress & KEY_RIGHT) { - int num22 = (int)(m_blupiSpeedX * 8); - if (m_blupiVitesse.x < num22) + if (m_blupiVitesse.x < 8) { m_blupiVitesse.x += 1; } @@ -2075,10 +1975,10 @@ void CDecor::BlupiStep() } } num = table_vitesse_nage[m_blupiPhase % 14 / 2]; - adjustPos.x += (int)(m_blupiVitesse.x * num / 7); + end.x += (int)(m_blupiVitesse.x * num / 7); if (m_time % 70 == 0 || m_time % 70 == 28) { - MoveObjectBlup(adjustPos); + MoveObjectBlup(end); } if (m_time % 5 == 0) { @@ -2088,36 +1988,36 @@ void CDecor::BlupiStep() } if (m_blupiLevel == 25) { - //m_jauges[0].SetMode(1); + //m_jauges[JAUGE_AIR].SetMode(1); } - m_jauges[0].SetLevel(m_blupiLevel); + m_jauges[JAUGE_AIR].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_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, adjustPos); + m_jauges[JAUGE_AIR].SetHide(TRUE); + m_jauges[JAUGE_POWER].SetHide(TRUE); + PlaySound(26, end); } } } @@ -2125,14 +2025,14 @@ void CDecor::BlupiStep() { if (m_blupiTransport == -1) { - if ((m_keyPress & KEY_LEFT) != 0) + if (m_keyPress & KEY_JUMP) { if (m_blupiVitesse.y > -5) { m_blupiVitesse.y -= 1; } } - else if (m_blupiSpeedY > 0) + else if (m_keyPress & KEY_DOWN) { if (m_blupiVitesse.y < 5) { @@ -2150,26 +2050,24 @@ void CDecor::BlupiStep() m_blupiVitesse.y += 1; } } - adjustPos.y += (int)m_blupiVitesse.y; - adjustPos.y += BLUPISURF; - if (adjustPos.y % 64 > 30) + end.y += (int)m_blupiVitesse.y; + end.y += BLUPISURF; + if (end.y % 64 > 30) { - adjustPos.y += 64 - adjustPos.y % 64; + end.y += 64 - end.y % 64; } - adjustPos.y -= BLUPISURF; + end.y -= BLUPISURF; } - if (m_blupiSpeedX < 0) + if (m_keyPress & KEY_LEFT) { - int num23 = (int)(m_blupiSpeedX * 8); - if (m_blupiVitesse.x > num23) + if (m_blupiVitesse.x > -8) { m_blupiVitesse.x -= 1; } } - else if (m_blupiSpeedX > 0) + else if (m_keyPress & KEY_RIGHT) { - int num24 = (int)(m_blupiSpeedX * 8); - if (m_blupiVitesse.x < num24) + if (m_blupiVitesse.x < 8) { m_blupiVitesse.x += 1; } @@ -2194,67 +2092,63 @@ void CDecor::BlupiStep() } } num = table_vitesse_surf[m_blupiPhase % 12 / 2]; - adjustPos.x += (int)(m_blupiVitesse.x * num / 10); + end.x += (int)(m_blupiVitesse.x * num / 10); } POINT tinyPoint4; if (m_blupiSuspend && m_blupiFocus) { - if (m_blupiSpeedX < 0 && m_blupiAction == 2) + if (m_keyPress & KEY_LEFT && m_blupiAction == 2) { - int num25 = (int)(m_blupiSpeedX * 5); - adjustPos.x += num25; + end.x -= 5; } - if (m_blupiSpeedX > 0 && m_blupiAction == 2) + if (m_keyPress & KEY_RIGHT && m_blupiAction == 2) { - int num26 = (int)(m_blupiSpeedX * 5); - adjustPos.x += num26; + end.x += 5; } - num = GetTypeBarre(adjustPos); + num = GetTypeBarre(end); if (num == 2) { - tinyPoint4.x = adjustPos.x; - tinyPoint4.y = adjustPos.y / 64 * 64 + BLUPIOFFY; + tinyPoint4.x = end.x; + tinyPoint4.y = end.y / 64 * 64 + BLUPIOFFY; rect = BlupiRect(tinyPoint4); - if (!DecorDetect(rect, true)) + if (!DecorDetect(rect, TRUE)) { - m_blupiSuspend = false; - m_blupiAction = 1; - m_blupiPhase = 0; - adjustPos = tinyPoint4; - m_blupiPos = adjustPos; + m_blupiSuspend = FALSE; + StopBlupi(); + end = tinyPoint4; + m_blupiPos = end; } } - if ((m_blupiSpeedY > 0 && m_blupiPhase > 5) || num == 0) + if ((m_keyPress & KEY_DOWN && m_blupiPhase > 5) || num == 0) { - m_blupiSuspend = false; - m_blupiAir = true; + m_blupiSuspend = FALSE; + m_blupiAir = TRUE; m_blupiAction = 5; - adjustPos.y = adjustPos.y; + end.y = end.y; m_blupiVitesse.y = 0; m_blupiNoBarre = 5; m_blupiActionOuf = 65; m_blupiTimeOuf = 0; } - if (((m_keyPress & KEY_LEFT) != 0 || m_blupiSpeedY < 0) && m_blupiAction != 4 && m_blupiAction != 3) + if ((m_keyPress & KEY_JUMP || m_keyPress & KEY_UP) && m_blupiAction != ACTION_JUMP && m_blupiAction != ACTION_TURN) { m_blupiAction = 4; m_blupiPhase = 0; } - if ((m_keyPress & KEY_LEFT) == 0 && m_blupiSpeedY == 0 && m_blupiAction == 4) + if (!(m_keyPress & KEY_JUMP) && !(m_keyPress & (KEY_UP | KEY_DOWN)) && m_blupiAction == 4) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } if (m_blupiAction == 4 && m_blupiPhase == 10) { - m_blupiSuspend = false; - m_blupiAir = true; + m_blupiSuspend = FALSE; + m_blupiAir = TRUE; m_blupiAction = 5; m_blupiPhase = 0; - adjustPos.y -= 2; + end.y -= 2; m_blupiVitesse.y = -11; m_blupiNoBarre = 5; - PlaySound(35, adjustPos); + PlaySound(35, end); } } if ( !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiTank && !m_blupiJeep && !m_blupiSkate /*&& !flag4*/ && m_blupiTransport == -1 && m_blupiFocus) @@ -2262,47 +2156,47 @@ void CDecor::BlupiStep() if (m_blupiDynamite > 0) { - rect.left = adjustPos.x + 18; - rect.right = adjustPos.x + 20; - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60; + rect.left = end.x + 18; + rect.right = end.x + 20; + rect.top = end.y + 60 - 2; + rect.bottom = end.y + 60; flag2 = !DecorDetect(rect); - rect.left = adjustPos.x + 60 - 20; - rect.right = adjustPos.x + 60 - 18; - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60; + rect.left = end.x + 60 - 20; + rect.right = end.x + 60 - 18; + rect.top = end.y + 60 - 2; + rect.bottom = end.y + 60; flag3 = !DecorDetect(rect); - if (!flag2 && !flag3 && ObjectStart(adjustPos, 56, 0) != -1) + if (!flag2 && !flag3 && ObjectStart(end, 56, 0) != -1) { m_blupiAction = 87; m_blupiPhase = 0; - m_blupiFocus = false; - PlaySound(61, adjustPos); + m_blupiFocus = FALSE; + PlaySound(61, end); m_blupiDynamite--; } } else if (m_blupiPerso > 0) { - num = MoveObjectDetect(adjustPos, &flag6); + num = MoveObjectDetect(end, &bNear); if (num == -1 || m_moveObject[num].type != 200) { - rect.left = adjustPos.x + 18; - rect.right = adjustPos.x + 20; - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60; + rect.left = end.x + 18; + rect.right = end.x + 20; + rect.top = end.y + 60 - 2; + rect.bottom = end.y + 60; flag2 = !DecorDetect(rect); - rect.left = adjustPos.x + 60 - 20; - rect.right = adjustPos.x + 60 - 18; - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60; + rect.left = end.x + 60 - 20; + rect.right = end.x + 60 - 18; + rect.top = end.y + 60 - 2; + rect.bottom = end.y + 60; flag3 = !DecorDetect(rect); - num = MoveChargeDetect(adjustPos); - if (num == -1 && !flag2 && !flag3 && ObjectStart(adjustPos, 200, 0) != -1) + num = MoveChargeDetect(end); + if (num == -1 && !flag2 && !flag3 && ObjectStart(end, 200, 0) != -1) { m_blupiAction = 46; m_blupiPhase = 0; - m_blupiFocus = false; - PlaySound(61, adjustPos); + m_blupiFocus = FALSE; + PlaySound(61, end); m_blupiPerso--; } } @@ -2310,43 +2204,43 @@ void CDecor::BlupiStep() { m_blupiAction = 47; m_blupiPhase = 0; - PlaySound(27, adjustPos); + PlaySound(27, end); } } } rect = BlupiRect(m_blupiPos); - tinyPoint4 = adjustPos; - TestPath(rect, m_blupiPos, &adjustPos); - if (flag && m_blupiPos.x == adjustPos.x && m_blupiPos.x != tinyPoint4.x) + tinyPoint4 = end; + TestPath(rect, m_blupiPos, &end); + if (flag && m_blupiPos.x == end.x && m_blupiPos.x != tinyPoint4.x) { - adjustPos.y = tinyPoint4.y; - TestPath(rect, m_blupiPos, &adjustPos); + end.y = tinyPoint4.y; + TestPath(rect, m_blupiPos, &end); } - if (m_blupiVent && m_blupiPos.y == adjustPos.y && m_blupiPos.y != tinyPoint4.y) + if (m_blupiVent && m_blupiPos.y == end.y && m_blupiPos.y != tinyPoint4.y) { - adjustPos.x = tinyPoint4.x; - TestPath(rect, m_blupiPos, &adjustPos); + end.x = tinyPoint4.x; + TestPath(rect, m_blupiPos, &end); } - if (m_blupiTransport != -1 && m_blupiPos.x == adjustPos.x && m_blupiPos.x != tinyPoint4.x) + if (m_blupiTransport != -1 && m_blupiPos.x == end.x && m_blupiPos.x != tinyPoint4.x) { - adjustPos.y = tinyPoint4.y; - TestPath(rect, m_blupiPos, &adjustPos); + end.y = tinyPoint4.y; + TestPath(rect, m_blupiPos, &end); } if (m_blupiHelico || m_blupiOver || m_blupiBalloon || m_blupiEcrase || m_blupiJeep || m_blupiTank || m_blupiSkate || m_blupiNage) { - if (m_blupiPos.x == adjustPos.x && m_blupiPos.x != tinyPoint4.x) + if (m_blupiPos.x == end.x && m_blupiPos.x != tinyPoint4.x) { - adjustPos.y = tinyPoint4.y; - TestPath(rect, m_blupiPos, &adjustPos); + end.y = tinyPoint4.y; + TestPath(rect, m_blupiPos, &end); } - else if (m_blupiPos.y == adjustPos.y && m_blupiPos.y != tinyPoint4.y) + else if (m_blupiPos.y == end.y && m_blupiPos.y != tinyPoint4.y) { - adjustPos.x = tinyPoint4.x; - TestPath(rect, m_blupiPos, &adjustPos); + end.x = tinyPoint4.x; + TestPath(rect, m_blupiPos, &end); } } POINT blupiPos = m_blupiPos; - m_blupiPos = adjustPos; + m_blupiPos = end; 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) @@ -2355,18 +2249,18 @@ void CDecor::BlupiStep() } else { - rect.left = adjustPos.x + 24; - rect.right = adjustPos.x + 26; - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60; + rect.left = end.x + 24; + rect.right = end.x + 26; + rect.top = end.y + 60 - 2; + rect.bottom = end.y + 60; flag2 = !DecorDetect(rect); - rect.left = adjustPos.x + 60 - 26; - rect.right = adjustPos.x + 60 - 24; - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60; + rect.left = end.x + 60 - 26; + rect.right = end.x + 60 - 24; + rect.top = end.y + 60 - 2; + rect.bottom = end.y + 60; flag3 = !DecorDetect(rect); } - if (m_blupiDir == 1 && flag2 && !flag3) + if (m_blupiDir == DIR_LEFT && flag2 && !flag3) { if (m_blupiHelico || m_blupiOver || AscenseurShift(m_blupiTransport)) { @@ -2375,12 +2269,12 @@ void CDecor::BlupiStep() } else { - PlaySound(6, adjustPos); + PlaySound(6, end); m_blupiAction = 8; m_blupiPhase = 0; } } - if (m_blupiDir == 2 && !flag2 && flag3) + if (m_blupiDir == DIR_RIGHT && !flag2 && flag3) { if (m_blupiHelico || m_blupiOver || AscenseurShift(m_blupiTransport)) { @@ -2389,16 +2283,16 @@ void CDecor::BlupiStep() } else { - PlaySound(6, adjustPos); + PlaySound(6, end); m_blupiAction = 8; m_blupiPhase = 0; } } - if (m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && (flag2 || flag3)) + if (m_blupiAction != ACTION_VERTIGO && m_blupiAction != ACTION_ADVANCE && m_blupiAction != ACTION_RECEDE && (flag2 || flag3)) { if (!m_blupiHelico && !m_blupiOver) { - PlaySound(6, adjustPos); + PlaySound(6, end); } m_blupiAction = 10; m_blupiPhase = 0; @@ -2412,15 +2306,15 @@ void CDecor::BlupiStep() } else { - rect.left = adjustPos.x + 2; - rect.right = adjustPos.x + 18; - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60; + rect.left = end.x + 2; + rect.right = end.x + 18; + rect.top = end.y + 60 - 2; + rect.bottom = end.y + 60; flag2 = !DecorDetect(rect); - rect.left = adjustPos.x + 60 - 18; - rect.right = adjustPos.x + 60 - 2; - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60; + rect.left = end.x + 60 - 18; + rect.right = end.x + 60 - 2; + rect.top = end.y + 60 - 2; + rect.bottom = end.y + 60; flag3 = !DecorDetect(rect); } if (flag2 && !flag3) @@ -2442,15 +2336,15 @@ void CDecor::BlupiStep() } else { - rect.left = adjustPos.x + 2; - rect.right = adjustPos.x + 18; - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60; + rect.left = end.x + 2; + rect.right = end.x + 18; + rect.top = end.y + 60 - 2; + rect.bottom = end.y + 60; flag2 = !DecorDetect(rect); - rect.left = adjustPos.x + 60 - 18; - rect.right = adjustPos.x + 60 - 2; - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60; + rect.left = end.x + 60 - 18; + rect.right = end.x + 60 - 2; + rect.top = end.y + 60 - 2; + rect.bottom = end.y + 60; flag3 = !DecorDetect(rect); } if (flag2 && !flag3) @@ -2472,15 +2366,15 @@ void CDecor::BlupiStep() } else { - rect.left = adjustPos.x + 12; - rect.right = adjustPos.x + 19; - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60; + rect.left = end.x + 12; + rect.right = end.x + 19; + rect.top = end.y + 60 - 2; + rect.bottom = end.y + 60; flag2 = !DecorDetect(rect); - rect.left = adjustPos.x + 60 - 19; - rect.right = adjustPos.x + 60 - 12; - rect.top = adjustPos.y + 60 - 2; - rect.bottom = adjustPos.y + 60; + rect.left = end.x + 60 - 19; + rect.right = end.x + 60 - 12; + rect.top = end.y + 60 - 2; + rect.bottom = end.y + 60; flag3 = !DecorDetect(rect); } if (flag2 && !flag3) @@ -2503,8 +2397,7 @@ void CDecor::BlupiStep() } if (m_blupiAction == 9 && m_blupiPhase == 3) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); m_blupiActionOuf = 0; } num3 = 5; @@ -2522,8 +2415,7 @@ void CDecor::BlupiStep() } if (m_blupiAction == 10 && m_blupiPhase == num3) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } } BlupiSearchIcon(); @@ -2535,13 +2427,13 @@ void CDecor::BlupiStep() } if (m_blupiTimeShield == 0) { - m_blupiShield = false; - m_jauges[1].SetHide(true); + m_blupiShield = FALSE; + m_jauges[JAUGE_POWER].SetHide(TRUE); } else if (m_time % 5 == 0) { m_blupiTimeShield--; - m_jauges[1].SetLevel(m_blupiTimeShield); + m_jauges[JAUGE_POWER].SetLevel(m_blupiTimeShield); } } if (m_blupiPower) @@ -2552,13 +2444,13 @@ void CDecor::BlupiStep() } if (m_blupiTimeShield == 0) { - m_blupiPower = false; - m_jauges[1].SetHide(true); + m_blupiPower = FALSE; + m_jauges[JAUGE_POWER].SetHide(TRUE); } else if (m_time % 3 == 0) { m_blupiTimeShield--; - m_jauges[1].SetLevel(m_blupiTimeShield); + m_jauges[JAUGE_POWER].SetLevel(m_blupiTimeShield); } } if (m_blupiCloud) @@ -2569,13 +2461,13 @@ void CDecor::BlupiStep() } if (m_blupiTimeShield == 0) { - m_blupiCloud = false; - m_jauges[1].SetHide(true); + m_blupiCloud = FALSE; + m_jauges[JAUGE_POWER].SetHide(TRUE); } else if (m_time % 4 == 0) { m_blupiTimeShield--; - m_jauges[1].SetLevel(m_blupiTimeShield); + m_jauges[JAUGE_POWER].SetLevel(m_blupiTimeShield); } } if (m_blupiHide) @@ -2586,21 +2478,21 @@ void CDecor::BlupiStep() } if (m_blupiTimeShield == 0) { - m_blupiHide = false; - m_jauges[1].SetHide(true); + m_blupiHide = FALSE; + m_jauges[JAUGE_POWER].SetHide(TRUE); } else if (m_time % 4 == 0) { m_blupiTimeShield--; - m_jauges[1].SetLevel(m_blupiTimeShield); + m_jauges[JAUGE_POWER].SetLevel(m_blupiTimeShield); } } if (m_blupiInvert) { if (m_blupiTimeShield == 0) { - m_blupiInvert = false; - m_jauges[1].SetHide(true); + m_blupiInvert = FALSE; + m_jauges[JAUGE_POWER].SetHide(TRUE); tinyPoint.x = m_blupiPos.x; tinyPoint.y = m_blupiPos.y + 100; ObjectStart(tinyPoint, 42, -60); @@ -2613,20 +2505,20 @@ void CDecor::BlupiStep() tinyPoint.x = m_blupiPos.x + 100; tinyPoint.y = m_blupiPos.y; ObjectStart(tinyPoint, 42, -10); - PlaySound(67, adjustPos); + PlaySound(67, end); } else if (m_time % 3 == 0) { m_blupiTimeShield--; - m_jauges[1].SetLevel(m_blupiTimeShield); + m_jauges[JAUGE_POWER].SetLevel(m_blupiTimeShield); } } if (m_blupiBalloon) { if (m_blupiTimeShield == 0) { - m_blupiBalloon = false; - m_jauges[1].SetHide(true); + m_blupiBalloon = FALSE; + m_jauges[JAUGE_POWER].SetHide(TRUE); tinyPoint.x = m_blupiPos.x - 34; tinyPoint.y = m_blupiPos.y - 34; ObjectStart(tinyPoint, 91, 0); @@ -2635,16 +2527,16 @@ void CDecor::BlupiStep() else if (m_time % 2 == 0) { m_blupiTimeShield--; - m_jauges[1].SetLevel(m_blupiTimeShield); + m_jauges[JAUGE_POWER].SetLevel(m_blupiTimeShield); } } if (m_blupiEcrase) { if (m_blupiTimeShield == 0) { - m_blupiEcrase = false; - m_blupiAir = true; - m_jauges[1].SetHide(true); + m_blupiEcrase = FALSE; + m_blupiAir = TRUE; + m_jauges[JAUGE_POWER].SetHide(TRUE); ObjectStart(m_blupiPos, 41, -60); ObjectStart(m_blupiPos, 41, 60); ObjectStart(m_blupiPos, 41, 10); @@ -2657,7 +2549,7 @@ void CDecor::BlupiStep() else if (m_time % 2 == 0) { m_blupiTimeShield--; - m_jauges[1].SetLevel(m_blupiTimeShield); + m_jauges[JAUGE_POWER].SetLevel(m_blupiTimeShield); } } if (m_blupiPower && abs(m_blupiPos.x - m_blupiPosMagic.x) + abs(m_blupiPos.y - m_blupiPosMagic.y) >= 40) @@ -2716,23 +2608,19 @@ void CDecor::BlupiStep() } if (m_blupiHelico && m_blupiPos.y > 2 && m_blupiFocus && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) { - rect = BlupiRect(adjustPos); - rect.top = adjustPos.y + 4; - rect.bottom = adjustPos.y + 20; + rect = BlupiRect(end); + rect.top = end.y + 4; + rect.bottom = end.y + 20; if (DecorDetect(rect)) { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiHelico = false; + StopBlupi(); + 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); + StopVehicleSound(); PlaySound(10, m_blupiPos); } } @@ -2742,11 +2630,10 @@ void CDecor::BlupiStep() { m_scrollAdd.x = 0; m_scrollAdd.y = 0; - m_blupiAir = false; - m_blupiNage = false; - m_blupiSurf = true; - m_blupiAction = 1; - m_blupiPhase = 0; + m_blupiAir = FALSE; + m_blupiNage = FALSE; + m_blupiSurf = TRUE; + StopBlupi(); m_blupiVitesse.x = 0; m_blupiVitesse.y = 0; MoveObjectPlouf(m_blupiPos); @@ -2757,43 +2644,42 @@ void CDecor::BlupiStep() } if (m_blupiCloud) { - m_blupiCloud = false; - m_jauges[1].SetHide(true); + m_blupiCloud = FALSE; + m_jauges[JAUGE_POWER].SetHide(TRUE); } } if (!m_blupiNage && !IsSurfWater(m_blupiPos) && IsDeepWater(m_blupiPos)) { if (!m_blupiSurf) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); m_blupiVitesse.x = 0; m_blupiVitesse.y = 0; MoveObjectPlouf(m_blupiPos); } - m_blupiAir = false; - m_blupiSurf = false; - m_blupiNage = true; + 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); + m_jauges[JAUGE_AIR].SetLevel(m_blupiLevel); + //m_jauges[JAUGE_AIR].SetMode(2); + m_jauges[JAUGE_AIR].SetHide(FALSE); } if (m_blupiNage && IsSurfWater(m_blupiPos)) { - m_blupiAir = false; - m_blupiNage = false; - m_blupiSurf = true; + m_blupiAir = FALSE; + m_blupiNage = FALSE; + m_blupiSurf = TRUE; PlaySound(25, m_blupiPos); - m_jauges[0].SetHide(true); + m_jauges[JAUGE_AIR].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 & KEY_LEFT) != 0) + if ((m_blupiSurf || m_blupiNage) && (m_blupiPos.y % 64 == 64 - BLUPISURF || m_blupiPos.y % 64 == 32) && IsOutWater(tinyPoint4) && (m_keyPress & KEY_JUMP) != 0) { - m_blupiNage = false; - m_blupiSurf = false; - m_blupiAir = true; + m_blupiNage = FALSE; + m_blupiSurf = FALSE; + m_blupiAir = TRUE; m_blupiAction = 5; m_blupiPhase = 0; m_blupiVitesse.x = 0; @@ -2807,7 +2693,7 @@ void CDecor::BlupiStep() } MoveObjectTiplouf(m_blupiPos); PlaySound(22, m_blupiPos); - m_jauges[0].SetHide(true); + m_jauges[JAUGE_AIR].SetHide(TRUE); } if ((m_blupiSurf || m_blupiNage) && IsOutWater(m_blupiPos)) { @@ -2820,43 +2706,42 @@ void CDecor::BlupiStep() else { m_blupiTransport = -1; - m_blupiNage = false; - m_blupiSurf = false; - m_blupiAir = true; + 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; m_blupiVitesse.y = -10; PlaySound(22, m_blupiPos); - m_jauges[0].SetHide(true); + m_jauges[JAUGE_AIR].SetHide(TRUE); } } else if (m_blupiVitesse.y > 0) { - m_blupiNage = false; - m_blupiSurf = false; - m_blupiAir = false; + 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; m_blupiVitesse.y = 0; PlaySound(22, m_blupiPos); - m_jauges[0].SetHide(true); + m_jauges[JAUGE_AIR].SetHide(TRUE); } else { - m_blupiNage = false; - m_blupiSurf = false; - m_blupiAir = false; - m_blupiAction = 1; - m_blupiPhase = 0; + m_blupiNage = FALSE; + m_blupiSurf = FALSE; + m_blupiAir = FALSE; + StopBlupi(); m_blupiPos.y = m_blupiPos.y - 10; m_blupiVitesse.x = 0; m_blupiVitesse.y = 0; PlaySound(22, m_blupiPos); - m_jauges[0].SetHide(true); + m_jauges[JAUGE_AIR].SetHide(TRUE); } } if ((m_blupiSurf || m_blupiNage) && m_blupiActionOuf != 44) @@ -2868,22 +2753,18 @@ void CDecor::BlupiStep() if ((m_blupiHelico || m_blupiOver || m_blupiJeep || m_blupiTank || m_blupiSkate) && m_blupiFocus && (IsSurfWater(m_blupiPos) || IsDeepWater(m_blupiPos))) { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiHelico = false; - m_blupiOver = false; - m_blupiJeep = false; - m_blupiTank = false; - m_blupiSkate = false; + StopBlupi(); + 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); + StopVehicleSound(); 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) @@ -2891,13 +2772,12 @@ void CDecor::BlupiStep() tinyPoint4.x = m_blupiPos.x; tinyPoint4.y = (m_blupiPos.y + 22) / 64 * 64 + BLUPISUSPEND; rect = BlupiRect(tinyPoint4); - if (!DecorDetect(rect, true)) + if (!DecorDetect(rect, TRUE)) { m_blupiPos = tinyPoint4; - m_blupiSuspend = true; - m_blupiAir = false; - m_blupiAction = 1; - m_blupiPhase = 0; + m_blupiSuspend = TRUE; + m_blupiAir = FALSE; + StopBlupi(); m_blupiActionOuf = 0; PlaySound(34, m_blupiPos); } @@ -2917,110 +2797,100 @@ void CDecor::BlupiStep() ObjectStart(tinyPoint, 11, 0); m_decorAction = 2; m_decorPhase = 0; - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); + StopVehicleSound(); PlaySound(10, m_blupiPos); } - if (m_blupiAction != 30 && m_blupiFocus) + if (m_blupiAction != ACTION_STOPTANK && m_blupiFocus) { num = IsWorld(m_blupiPos); if (num != -1) { - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); + StopVehicleSound(); PlaySound(32, m_blupiPos); m_blupiAction = 30; m_blupiPhase = 0; - m_blupiFocus = false; - m_blupiFront = true; + m_blupiFocus = FALSE; + m_blupiFront = TRUE; } } - int num27 = MoveObjectDetect(m_blupiPos, &flag6); + int num27 = MoveObjectDetect(m_blupiPos, &bNear); 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 (m_blupiAction != 11 && m_blupiAction != 75 && m_blupiAction != 76 && m_blupiAction != 77 && m_blupiAction != 78 && m_blupiAction != 79 && m_blupiAction != ACTION_CLEAR7 && m_blupiAction != ACTION_CLEAR8) { if (IsLave(m_blupiPos) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) { BlupiDead(76, -1); - m_blupiRestart = true; + m_blupiRestart = TRUE; m_blupiPos.y = m_blupiPos.y / DIMOBJY * 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; + 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) + 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; + 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; + m_blupiFront = TRUE; + m_blupiRestart = TRUE; + m_blupiAir = TRUE; } - if ( (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) + if ( (num27 == -1 || !bNear) && IsSwitch(m_blupiPos, tinyPoint) && !m_blupiOver && !m_blupiBalloon && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiFocus) { ActiveSwitch(m_decor[tinyPoint.x][tinyPoint.y].icon == 385, tinyPoint); m_blupiAction = 82; m_blupiPhase = 0; - m_blupiFocus = false; + m_blupiFocus = FALSE; m_blupiVitesse.x = 0; m_blupiVitesse.y = 0; } - if (IsBlitz(m_blupiPos, false) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) + if (IsBlitz(m_blupiPos, FALSE) && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) { BlupiDead(11, -1); - m_blupiRestart = true; - m_blupiAir = true; + m_blupiRestart = TRUE; + m_blupiAir = TRUE; m_blupiPos.y = m_blupiPos.y / DIMOBJY * 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; + StopBlupi(); m_blupiVitesse.x = 0; m_blupiVitesse.y = 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_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); + m_jauges[JAUGE_POWER].SetHide(FALSE); if (!m_blupiJeep && !m_blupiTank) { - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); + StopVehicleSound(); } PlaySound(70, m_blupiPos); ObjectStart(m_blupiPos, 41, -60); @@ -3039,7 +2909,7 @@ void CDecor::BlupiStep() m_blupiPhase = 0; m_blupiVitesse.x = 0; m_blupiVitesse.y = 0; - m_blupiFocus = false; + m_blupiFocus = FALSE; m_blupiPos.x = m_blupiPos.x / DIMOBJX * 64; PlaySound(71, m_blupiPos); tinyPoint.x = m_blupiPos.x; @@ -3075,26 +2945,26 @@ void CDecor::BlupiStep() } 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) + if (num != -1 && !bNear && 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 (num != -1 && bNear) { if (m_moveObject[num].type == 13 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) { ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); m_scrollAdd.x = 0; m_scrollAdd.y = 0; - m_blupiAir = false; - m_blupiHelico = true; + m_blupiAir = FALSE; + m_blupiHelico = TRUE; m_blupiVitesse.x = 0; if (m_blupiCloud || m_blupiHide) { - m_blupiCloud = false; - m_blupiHide = false; - m_jauges[1].SetHide(true); + m_blupiCloud = FALSE; + m_blupiHide = FALSE; + m_jauges[JAUGE_POWER].SetHide(TRUE); } } if (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) @@ -3102,14 +2972,14 @@ void CDecor::BlupiStep() ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); m_scrollAdd.x = 0; m_scrollAdd.y = 0; - m_blupiAir = false; - m_blupiOver = true; + m_blupiAir = FALSE; + m_blupiOver = TRUE; m_blupiVitesse.x = 0; if (m_blupiCloud || m_blupiHide) { - m_blupiCloud = false; - m_blupiHide = false; - m_jauges[1].SetHide(true); + m_blupiCloud = FALSE; + m_blupiHide = FALSE; + m_jauges[JAUGE_POWER].SetHide(TRUE); } } if (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) @@ -3117,16 +2987,15 @@ void CDecor::BlupiStep() 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; + StopBlupi(); + m_blupiAir = FALSE; + m_blupiJeep = TRUE; m_blupiVitesse.x = 0; if (m_blupiCloud || m_blupiHide) { - m_blupiCloud = false; - m_blupiHide = false; - m_jauges[1].SetHide(true); + m_blupiCloud = FALSE; + m_blupiHide = FALSE; + m_jauges[JAUGE_POWER].SetHide(TRUE); } } if ( 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) @@ -3135,16 +3004,15 @@ void CDecor::BlupiStep() 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; + StopBlupi(); + m_blupiAir = FALSE; + m_blupiTank = TRUE; m_blupiVitesse.x = 0; if (m_blupiCloud || m_blupiHide) { - m_blupiCloud = false; - m_blupiHide = false; - m_jauges[1].SetHide(true); + m_blupiCloud = FALSE; + m_blupiHide = FALSE; + m_jauges[JAUGE_POWER].SetHide(TRUE); } } if (m_moveObject[num].type == 29 && m_blupiFocus && m_blupiBullet < 10) @@ -3169,23 +3037,23 @@ void CDecor::BlupiStep() 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_blupiFocus = FALSE; + m_blupiAir = FALSE; + m_blupiSkate = TRUE; m_blupiVitesse.x = 0; if (m_blupiCloud || m_blupiHide) { - m_blupiCloud = false; - m_blupiHide = false; - m_jauges[1].SetHide(true); + m_blupiCloud = FALSE; + m_blupiHide = FALSE; + m_jauges[JAUGE_POWER].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_blupiBalloon = FALSE; + m_blupiAir = TRUE; m_blupiTimeShield = 0; - m_jauges[1].SetHide(true); + m_jauges[JAUGE_POWER].SetHide(TRUE); m_decorAction = 0; tinyPoint.x = m_blupiPos.x - 34; tinyPoint.y = m_blupiPos.y - 34; @@ -3201,7 +3069,7 @@ void CDecor::BlupiStep() { if (m_blupiHelico || m_blupiOver || m_blupiBalloon || m_blupiEcrase) { - m_blupiAir = true; + m_blupiAir = TRUE; } BlupiDead(11, 75); } @@ -3227,45 +3095,38 @@ void CDecor::BlupiStep() } if (!m_blupiJeep && !m_blupiTank) { - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); + StopVehicleSound(); } PlaySound(10, m_moveObject[num].posCurrent); } if (m_moveObject[num].type == 44 && m_blupiFocus && !m_blupiBalloon && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); m_blupiVitesse.x = 0; m_blupiVitesse.y = 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_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); + m_jauges[JAUGE_POWER].SetHide(FALSE); if (!m_blupiJeep && !m_blupiTank) { - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); + StopVehicleSound(); } PlaySound(40, m_moveObject[num].posCurrent); tinyPoint.x = m_blupiPos.x - 34; @@ -3282,31 +3143,28 @@ void CDecor::BlupiStep() ObjectStart(tinyPoint, 53, 0); m_blupiAction = 54; m_blupiPhase = 0; - m_blupiSuspend = false; - m_blupiJumpAie = false; - m_blupiFocus = false; - m_blupiRestart = true; + m_blupiSuspend = FALSE; + m_blupiJumpAie = FALSE; + m_blupiFocus = FALSE; + m_blupiRestart = TRUE; if (flag) { - m_blupiAir = true; + 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; + 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); + StopVehicleSound(); PlaySound(10, m_moveObject[num].posCurrent); m_decorAction = 1; m_decorPhase = 0; @@ -3315,39 +3173,39 @@ void CDecor::BlupiStep() { PlaySound(51, m_moveObject[num].posCurrent); } - m_blupiCloud = false; - m_blupiHide = false; - m_jauges[1].SetHide(true); + m_blupiCloud = FALSE; + m_blupiHide = FALSE; + m_jauges[JAUGE_POWER].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) + if (m_moveObject[num].type == 23 && !m_blupiShield && !m_blupiHide && !m_bSuperBlupi && m_blupiAction != 13 && m_blupiAction != ACTION_BYE && m_blupiAction != 11 && m_blupiAction != 75 && m_blupiAction != 76 && m_blupiAction != 77 && m_blupiAction != 78 && m_blupiAction != 79 && m_blupiAction != ACTION_CLEAR7 && m_blupiAction != ACTION_CLEAR8 && m_blupiAction != ACTION_GLU && m_blupiAction != ACTION_ELECTRO && m_blupiAction != ACTION_HIDE) { 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; + m_blupiSuspend = FALSE; + m_blupiJumpAie = FALSE; + m_blupiFocus = FALSE; + m_blupiRestart = TRUE; if (flag) { - m_blupiAir = true; + 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; + 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); + m_blupiCloud = FALSE; + m_blupiHide = FALSE; + m_jauges[JAUGE_POWER].SetHide(TRUE); } if (m_moveObject[num].type == 5) { @@ -3415,13 +3273,13 @@ void CDecor::BlupiStep() 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_blupiShield = TRUE; + m_blupiPower = FALSE; + m_blupiCloud = FALSE; + m_blupiHide = FALSE; m_blupiTimeShield = 100; m_blupiPosMagic = m_blupiPos; - m_jauges[1].SetHide(false); + m_jauges[JAUGE_POWER].SetHide(FALSE); } if ( m_moveObject[num].type == 26 && !m_blupiShield && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && m_blupiFocus) { @@ -3429,19 +3287,19 @@ void CDecor::BlupiStep() 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, adjustPos); + m_blupiCloud = FALSE; + m_blupiHide = FALSE; + m_blupiFocus = FALSE; + PlaySound(50, end); } if (m_moveObject[num].type == 40 && !m_blupiHide && m_blupiFocus) { ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type); - m_blupiInvert = true; + m_blupiInvert = TRUE; m_blupiTimeShield = 100; m_blupiPosMagic = m_blupiPos; - m_jauges[1].SetHide(false); - PlaySound(66, adjustPos); + m_jauges[JAUGE_POWER].SetHide(FALSE); + PlaySound(66, end); ObjectStart(m_blupiPos, 41, -60); ObjectStart(m_blupiPos, 41, 60); ObjectStart(m_blupiPos, 41, 10); @@ -3453,27 +3311,27 @@ void CDecor::BlupiStep() 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, adjustPos); + m_blupiShield = FALSE; + m_blupiPower = FALSE; + m_blupiJumpAie = FALSE; + m_blupiFocus = FALSE; + PlaySound(57, end); } 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_blupiShield = FALSE; + m_blupiPower = FALSE; + m_blupiJumpAie = FALSE; + m_blupiFocus = FALSE; + m_blupiCloud = TRUE; m_blupiTimeShield = 100; - PlaySound(58, adjustPos); + PlaySound(58, end); if (m_blupiHide) { - m_blupiHide = false; - m_jauges[1].SetHide(true); + m_blupiHide = FALSE; + m_jauges[JAUGE_POWER].SetHide(TRUE); } } if (m_moveObject[num].type >= 200 && m_moveObject[num].type <= 203 && m_blupiFocus) @@ -3515,30 +3373,30 @@ void CDecor::BlupiStep() ////VoyageInit(m_pPixmap->HotSpotToHud(tinyPoint), tinyPoint5, 252, 10); m_blupiAction = 86; m_blupiPhase = 0; - m_blupiFocus = false; + 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) { - adjustPos = m_moveObject[num].posCurrent; - if (m_blupiDir == 1 && m_blupiPos.x > adjustPos.x) + end = m_moveObject[num].posCurrent; + if (m_blupiDir == DIR_LEFT && m_blupiPos.x > end.x) { - adjustPos.x = m_blupiPos.x - 59; - PlaySound(38, adjustPos); + end.x = m_blupiPos.x - 59; + PlaySound(38, end); m_blupiActionOuf = 45; m_blupiTimeOuf = 0; m_blupiAction = 14; m_blupiPhase = 0; } - if (m_blupiDir == 2 && m_blupiPos.x < adjustPos.x) + if (m_blupiDir == DIR_RIGHT && m_blupiPos.x < end.x) { - adjustPos.x = m_blupiPos.x + 55; - PlaySound(38, adjustPos); + end.x = m_blupiPos.x + 55; + PlaySound(38, end); m_blupiActionOuf = 45; m_blupiTimeOuf = 0; m_blupiAction = 14; m_blupiPhase = 0; } - if (!TestPushCaisse(num, adjustPos, false)) + if (!TestPushCaisse(num, end, FALSE)) { m_blupiPos.x = blupiPos.x; } @@ -3551,17 +3409,14 @@ void CDecor::BlupiStep() { if (m_moveObject[num].type == 21) { - m_bFoundCle = true; + m_bFoundCle = TRUE; } - StopSound(16); - StopSound(18); - StopSound(29); - StopSound(31); + StopVehicleSound(); PlaySound(14, m_moveObject[num].posCurrent); m_blupiAction = 13; m_blupiPhase = 0; - m_blupiFocus = false; - m_blupiFront = true; + m_blupiFocus = FALSE; + m_blupiFront = TRUE; m_blupiPos.y = m_moveObject[num].posCurrent.y; } else @@ -3589,24 +3444,23 @@ void CDecor::BlupiStep() num = CaisseInFront(); if (num != -1) { - adjustPos = m_moveObject[num].posCurrent; - if (m_blupiDir == 1) + end = m_moveObject[num].posCurrent; + if (m_blupiDir == DIR_LEFT) { - adjustPos.x = m_blupiPos.x - 59; + end.x = m_blupiPos.x - 59; } else { - adjustPos.x = m_blupiPos.x + 55; + end.x = m_blupiPos.x + 55; } - if (!TestPushCaisse(num, adjustPos, false)) + if (!TestPushCaisse(num, end, FALSE)) { m_blupiPos.x = blupiPos.x; } } else { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } } if (m_blupiAction == 29 && m_blupiFocus) @@ -3614,25 +3468,23 @@ void CDecor::BlupiStep() num = CaisseInFront(); if (num != -1) { - adjustPos = m_moveObject[num].posCurrent; - if (m_blupiDir == 1) + end = m_moveObject[num].posCurrent; + if (m_blupiDir == DIR_LEFT) { - adjustPos.x = m_blupiPos.x - 59; + end.x = m_blupiPos.x - 59; } else { - adjustPos.x = m_blupiPos.x + 55; + end.x = m_blupiPos.x + 55; } - if (!TestPushCaisse(num, adjustPos, true)) + if (!TestPushCaisse(num, end, TRUE)) { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } } else { - m_blupiAction = 1; - m_blupiPhase = 0; + StopBlupi(); } } if (!m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && m_blupiFocus) @@ -3713,15 +3565,11 @@ void CDecor::BlupiStep() } if (m_blupiAction == 86 && m_blupiPhase == 18) { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; + StopBlupi(TRUE); } if (m_blupiAction == 87 && m_blupiPhase == 26) { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; + StopBlupi(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) { @@ -3740,16 +3588,14 @@ void CDecor::BlupiStep() ObjectStart(m_blupiPos, 27, 20); ObjectStart(m_blupiPos, 27, -20); } - m_blupiFocus = true; + m_blupiFocus = TRUE; m_blupiPosHelico = m_blupiPos; } if (m_blupiAction == 82 && m_blupiPhase == 10) { - m_blupiAction = 1; - m_blupiPhase = 0; - m_blupiFocus = true; + StopBlupi(TRUE); } - if ( m_blupiAction == 1) + if (m_keyPress & KEY_FIRE && m_blupiAction == 1) { m_blupiAction = 84; m_blupiPhase = 0; @@ -3777,7 +3623,7 @@ void CDecor::BlupiStep() m_term = -1; DoorsLost(); } - m_blupiFront = false; + m_blupiFront = FALSE; } if (m_dimDecor.y == 0) { @@ -3840,19 +3686,19 @@ void CDecor::BlupiStep() } } } - if (blupiAction == 63 && m_blupiAction != 63) + if (lastBlupiAction == 63 && m_blupiAction != 63) { StopSound(65); } - if (blupiAction == 64 && m_blupiAction != 64) + if (lastBlupiAction == 64 && m_blupiAction != 64) { StopSound(65); } - if (blupiAction == 83 && m_blupiAction != 83) + if (lastBlupiAction == 83 && m_blupiAction != ACTION_MOCKERYp) { 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, tinyPoint) && IsTeleporte(m_blupiPos) == -1 && !IsBlitz(m_blupiPos, true) && !IsTemp(m_blupiPos) && !IsBalleTraj(m_blupiPos) && !IsMoveTraj(m_blupiPos)) + 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, tinyPoint) && IsTeleporte(m_blupiPos) == -1 && !IsBlitz(m_blupiPos, TRUE) && !IsTemp(m_blupiPos) && !IsBalleTraj(m_blupiPos) && !IsMoveTraj(m_blupiPos)) { if (m_blupiFifoNb > 0) { @@ -3860,10 +3706,10 @@ void CDecor::BlupiStep() } BlupiAddFifo(m_blupiPos); } - adjustPos.x = m_blupiPos.x + 30 + m_scrollAdd.x; - adjustPos.y = m_blupiPos.y + 30 + m_scrollAdd.y; - int num28 = abs(m_scrollPoint.x - adjustPos.x); - int num29 = abs(m_scrollPoint.y - adjustPos.y); + end.x = m_blupiPos.x + 30 + m_scrollAdd.x; + end.y = m_blupiPos.y + 30 + m_scrollAdd.y; + int num28 = abs(m_scrollPoint.x - end.x); + int num29 = abs(m_scrollPoint.y - end.y); num4 = SCROLL_SPEED; if (num28 > SCROLL_MARGX * 2) { @@ -3873,36 +3719,36 @@ void CDecor::BlupiStep() { num4 += (num29 - SCROLL_MARGY * 2) / 4; } - if (m_scrollPoint.x < adjustPos.x) + if (m_scrollPoint.x < end.x) { m_scrollPoint.x = m_scrollPoint.x + num4; - if (m_scrollPoint.x >= adjustPos.x) + if (m_scrollPoint.x >= end.x) { - m_scrollPoint.x = adjustPos.x; + m_scrollPoint.x = end.x; } } - if (m_scrollPoint.x > adjustPos.x) + if (m_scrollPoint.x > end.x) { m_scrollPoint.x = m_scrollPoint.x - num4; - if (m_scrollPoint.x <= adjustPos.x) + if (m_scrollPoint.x <= end.x) { - m_scrollPoint.x = adjustPos.x; + m_scrollPoint.x = end.x; } } - if (m_scrollPoint.y < adjustPos.y) + if (m_scrollPoint.y < end.y) { m_scrollPoint.y = m_scrollPoint.y + num4; - if (m_scrollPoint.y >= adjustPos.y) + if (m_scrollPoint.y >= end.y) { - m_scrollPoint.y = adjustPos.y; + m_scrollPoint.y = end.y; } } - if (m_scrollPoint.y > adjustPos.y) + if (m_scrollPoint.y > end.y) { m_scrollPoint.y = m_scrollPoint.y - num4; - if (m_scrollPoint.y <= adjustPos.y) + if (m_scrollPoint.y <= end.y) { - m_scrollPoint.y = adjustPos.y; + m_scrollPoint.y = end.y; } } if (m_blupiAction != 75 && m_blupiAction != 76) @@ -3919,6 +3765,7 @@ void CDecor::BlupiStep() } + void CDecor::BlupiDead(int action1, int action2) { if (action2 == -1) @@ -3950,8 +3797,8 @@ void CDecor::BlupiDead(int action1, int action2) m_blupiEcrase = FALSE; m_blupiRestart = FALSE; m_blupiActionOuf = 0; - m_jauges[0].SetHide(TRUE); - m_jauges[1].SetHide(TRUE); + m_jauges[JAUGE_AIR].SetHide(TRUE); + m_jauges[JAUGE_POWER].SetHide(TRUE); StopSound(SOUND_HELICOHIGH); StopSound(SOUND_HELICOLOW); StopSound(SOUND_JEEPHIGH); diff --git a/src/decmove.cpp b/src/decmove.cpp index 04eb61f..7cd19b0 100644 --- a/src/decmove.cpp +++ b/src/decmove.cpp @@ -8,6 +8,56 @@ void CDecor::MoveObjectPollution() { + POINT blupiPos = m_blupiPos; + POINT pos; + BOOL bPollution; + pos = { 0, 0 }; + int num = 20; + bPollution = FALSE; + if (m_blupiAction == 3) + { + return; + } + if (m_blupiHelico) + { + if (m_blupiVitesse.y < -5.0) + { + if (m_time % 20 != 0 && + m_time % 20 != 2 && + m_time % 20 != 5 && + m_time % 20 != 8 && + m_time % 20 != 10 && + m_time % 20 != 11 && + m_time % 20 != 16 && + m_time % 20 != 18) + { + return; + } + } + else if (m_blupiVitesse.x == 0.0) + { + if (m_time % 50 != 0 && + m_time % 50 != 12 && + m_time % 50 != 30) + { + return; + } + } + else if (m_time % 20 != 0 && + m_time % 20 != 3 && + m_time % 20 != 5 && + m_time % 20 != 11 && + m_time % 20 != 15) + { + return; + } + pos.x = 22; + bPollution = TRUE; + } + if (m_blupiOver) + { + // more + } } void CDecor::MoveObjectPlouf(POINT pos) @@ -386,7 +436,7 @@ void CDecor::MoveObjectStepLine(int i) MoveObject moveObject; POINT tinyPoint; BOOL flag = FALSE; - RECT tinyRect; + RECT tinyRect { 0, 0, 0, 0 }; if (m_moveObject[i].type == 1 || m_moveObject[i].type == 47 || m_moveObject[i].type == 48 && !m_blupiSuspend) { RECT src; @@ -1458,7 +1508,7 @@ void CDecor::DynamiteStart(int i, int dx, int dy) 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; + RECT tinyRect { 0, 0, 0, 0 }; if (IntersectRect(&tinyRect, &src2, &src)) { if (m_moveObject[i].type == 12) @@ -1522,7 +1572,7 @@ int CDecor::AscenseurDetect(RECT rect, POINT oldpos, POINT newpos) src.bottom = m_moveObject[i].posCurrent.y + 16; if (num < 30) { - RECT tinyRect; + RECT tinyRect { 0, 0, 0, 0 }; if (IntersectRect(&tinyRect, &src, &rect)) { return i; @@ -1535,7 +1585,7 @@ int CDecor::AscenseurDetect(RECT rect, POINT oldpos, POINT newpos) src2.bottom -= num / 30 * num2; for (int j = 0; j <= num / 30; j++) { - RECT tinyRect; + RECT tinyRect { 0, 0, 0, 0 }; if (IntersectRect(&tinyRect, &src, &src2)) { return i; @@ -1639,8 +1689,34 @@ BOOL CDecor::TestPushCaisse(int i, POINT pos, BOOL bPop) BOOL CDecor::TestPushOneCaisse(int i, POINT move, int b) { - // TODO - return FALSE; + int num; + RECT rect; + num = m_moveObject[i].posCurrent.x + move.x; + rect.left = num; + rect.right = num + 64; + rect.top = m_moveObject[i].posCurrent.y; + rect.bottom = m_moveObject[i].posCurrent.y + 64; + if (DecorDetect(rect, FALSE)) + { + return FALSE; + } + if (m_moveObject[i].posCurrent.y != b) + { + return TRUE; + } + rect.left = num; + rect.right = num + 20; + rect.top = m_moveObject[i].posCurrent.y + 64; + rect.bottom = m_moveObject[i].posCurrent.y + 64 + 2; + if (!DecorDetect(rect)) + { + return FALSE; + } + rect.left = num + 64 - 20; + rect.right = num + 64; + rect.top = m_moveObject[i].posCurrent.y + 64; + rect.bottom = m_moveObject[i].posCurrent.y + 64 + 2; + return DecorDetect(rect); } void CDecor::SearchLinkCaisse(int rank, BOOL bPop) @@ -1677,7 +1753,7 @@ void CDecor::SearchLinkCaisse(int rank, BOOL bPop) src2.top = m_moveObject[num2].posCurrent.y - 1; src2.right = src2.left + 64 + 1; src2.bottom = src2.top + 64 + 1; - RECT tinyRect; + RECT tinyRect { 0,0,0,0 }; if (IntersectRect(&tinyRect, &src2, &src) && AddLinkCaisse(num2)) { flag = TRUE; @@ -1800,7 +1876,7 @@ int CDecor::MockeryDetect(POINT pos) 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; + RECT tinyRect{ 0,0,0,0 }; if (IntersectRect(&tinyRect, &src2, &src)) { if (m_moveObject[i].type == 54) @@ -1839,10 +1915,9 @@ int CDecor::MockeryDetect(POINT pos) BOOL CDecor::BlupiElectro(POINT pos) { - if (m_blupiCloud) - { - return FALSE; - } + if (m_phase == WM_PHASE_BUILD) return FALSE; + if (!m_blupiCloud) return FALSE; + RECT src; src.left = pos.x + 16; src.right = pos.x + 60 - 16; @@ -1853,7 +1928,7 @@ BOOL CDecor::BlupiElectro(POINT pos) 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; + RECT tinyRect{ 0,0,0,0 }; return IntersectRect(&tinyRect, &src, &src2); } @@ -1875,7 +1950,7 @@ void CDecor::MoveObjectFollow(POINT pos) 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; + RECT tinyRect { 0, 0, 0, 0 }; if (IntersectRect(&tinyRect, &src2, &src)) { m_moveObject[i].type = 97; @@ -1910,9 +1985,64 @@ int CDecor::MoveObjectDetect(POINT pos, BOOL* pbNear) m_moveObject[i].type != 12) { RECT src3; - // TODO + src3.left = m_moveObject[i].posCurrent.x + 16; + src3.right = m_moveObject[i].posCurrent.x + 60 - 16; + src3.top = m_moveObject[i].posCurrent.y + 36; + src3.bottom = m_moveObject[i].posCurrent.y + 60; + if (m_moveObject[i].type == 3) + { + if (m_blupiAction == 6) + { + //goto IL_427; + } + src3.top = m_moveObject[i].posCurrent.y; + src3.bottom = m_moveObject[i].posCurrent.y + 69 - 36; + } + if (m_moveObject[i].type == 12) + { + src3.left = m_moveObject[i].posCurrent.x - 16; + src3.right = m_moveObject[i].posCurrent.x + 64 + 16; + src3.top = m_moveObject[i].posCurrent.y; + src3.bottom = m_moveObject[i].posCurrent.y + 64; + if (m_blupiDir == 1) + { + src3.left += 20; + } + else + { + src3.right -= 20; + } + } + if (m_moveObject[i].type == 17 || + m_moveObject[i].type == 20 || + m_moveObject[i].type == 44 || + m_moveObject[i].type == 54) + { + src3.top = m_moveObject[i].posCurrent.y + 16; + src3.bottom = m_moveObject[i].posCurrent.y + 60 - 16; + } + if (m_moveObject[i].type == 23) + { + src3.left = m_moveObject[i].posCurrent.x + 24; + src3.right = m_moveObject[i].posCurrent.x + 64 - 24; + src3.top = m_moveObject[i].posCurrent.y + 10; + src3.bottom = m_moveObject[i].posCurrent.y + 60 - 32; + } + RECT rect; + rect = { 0, 0, 0, 0 }; + if (IntersectRect(&rect, &src3, &src)) + { + *pbNear = TRUE; + return i; + } + if (m_moveObject[i].type == 2 && IntersectRect(&rect, &src3, &src2)) + { + *pbNear = FALSE; + return i; + } } } + *pbNear = FALSE; return -1; } @@ -1936,7 +2066,7 @@ int CDecor::MoveAscenseurDetect(POINT pos, int height) 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; + RECT tinyRect { 0, 0, 0, 0 }; if (IntersectRect(&tinyRect, &src2, &src)) { return i; @@ -1962,7 +2092,7 @@ int CDecor::MoveChargeDetect(POINT pos) 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; + RECT tinyRect { 0, 0, 0, 0 }; if (IntersectRect(&tinyRect, &src2, &src)) { return i; @@ -1975,6 +2105,7 @@ int CDecor::MoveChargeDetect(POINT pos) int CDecor::MovePersoDetect(POINT pos) { RECT src; + if (m_phase == WM_PHASE_BUILD) return -1; src.left = pos.x + 16; src.right = pos.x + 60 - 16; src.top = pos.y + 11; @@ -1988,7 +2119,7 @@ int CDecor::MovePersoDetect(POINT pos) 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; + RECT tinyRect { 0, 0, 0, 0 }; if (IntersectRect(&tinyRect, &src2, &src)) { return i; @@ -2000,8 +2131,36 @@ int CDecor::MovePersoDetect(POINT pos) int CDecor::MoveBalleDetect(POINT pos) { - // TODO - return -1; + RECT rcSrc1, rcSrc2; + tagRECT rcDst; + int i; + if (m_phase == WM_PHASE_BUILD) + return -1; + rcSrc2.right = pos.x + 44; + rcSrc2.left = pos.x + 20; + rcSrc2.top = pos.y + 10; + rcSrc2.bottom = pos.y + 28; + for (i = 0; i < MAXMOVEOBJECT - 1; i++) + { + if (m_moveObject->type == TYPE_BULLDOZER || + m_moveObject->type == TYPE_POISSON || + m_moveObject->type == TYPE_OISEAU || + m_moveObject->type == TYPE_GUEPE || + m_moveObject->type == TYPE_BLUPIHELICO || + m_moveObject->type == TYPE_BLUPITANK) + { + rcSrc1.right = m_moveObject->posCurrent.x + 44; + rcSrc1.left = m_moveObject->posCurrent.x + 16; + rcSrc1.bottom = m_moveObject->posCurrent.y + 50; + rcSrc1.top = m_moveObject->posCurrent.y + 16; + rcDst = { 0, 0, 0, 0 }; + if (IntersectRect(&rcDst, &rcSrc1, &rcSrc2)) + break; + } + if (i >= 200) + return -1; + } + return i; } int CDecor::MoveObjectDelete(POINT cel) @@ -2041,11 +2200,14 @@ int CDecor::MoveObjectFree() int CDecor::SortGetType(int type) { - if (type == 2 || type == 3 || type == 96 || type == 97) + if (type == TYPE_BOMBEDOWN || + type == TYPE_BOMBEUP || + type == TYPE_BOMBEFOLLOW1 || + type == TYPE_BOMBEFOLLOW2) { return 1; } - if (type == 12) + if (type == TYPE_CAISSE) { return 2; } @@ -2092,7 +2254,40 @@ void CDecor::MoveObjectSort() void CDecor::MoveObjectPriority(int i) { + MoveObject src; + int j; + if (i == 0) + { + return; + } + if (m_moveObject[i].type != 23) + { + return; + } + j = 0; + while (j < MAXMOVEOBJECT) + { + if (m_moveObject[j].type != 23) + { + if (j > i) + { + return; + } + MoveObjectCopy(src, m_moveObject[i]); + MoveObjectCopy(m_moveObject[i], m_moveObject[j]); + MoveObjectCopy(m_moveObject[j], src); + if (m_moveObject[i].type == 12 || m_moveObject[j].type == 12) + { + UpdateCaisse(); + } + return; + } + else + { + j++; + } + } } int CDecor::MoveObjectSearch(POINT pos, int type) diff --git a/src/decnet.cpp b/src/decnet.cpp index 3ea01eb..51b6f7e 100644 --- a/src/decnet.cpp +++ b/src/decnet.cpp @@ -106,11 +106,17 @@ void CDecor::FUN_15da0(int index, short step) void CDecor::NetPlayerCollide(POINT pos, int* out) { + int i; tagRECT rect1; RECT rect2; RECT rect3; - //TODO + rect2.right = pos.x + 44; + rect2.left = pos.x + 16; + rect2.top = pos.y + 11; + rect2.bottom = pos.y + 58; + + // more } void CDecor::NetMessageIndexFlush() diff --git a/src/decor.cpp b/src/decor.cpp index 407eea7..b8451ab 100644 --- a/src/decor.cpp +++ b/src/decor.cpp @@ -297,12 +297,12 @@ void CDecor::PlayPrepare(BOOL bTest) m_moveObject[i].type = 0; } - if ((m_bMulti) && - (m_moveObject[i].type == TYPE_CAISSE) || - (m_moveObject[i].type == TYPE_GOAL) || - (m_moveObject[i].type == TYPE_CLE) || - (m_moveObject[i].type == TYPE_BLUPIHELICO) || - (m_moveObject[i].type == TYPE_BLUPITANK)) + if (m_bMulti && + (m_moveObject[i].type == TYPE_CAISSE || + m_moveObject[i].type == TYPE_GOAL || + m_moveObject[i].type == TYPE_CLE || + m_moveObject[i].type == TYPE_BLUPIHELICO || + m_moveObject[i].type == TYPE_BLUPITANK)) { m_moveObject[i].type = 0; } @@ -388,16 +388,16 @@ void CDecor::MoveStep() } if (m_keyPress & KEY_DOWN) { m_posDecor.y += 50; - int max = (m_dimDecor.y > 0) ? (m_dimDecor.y - LYIMAGE) : 0; + int max = (m_dimDecor.y > 0) ? (MAXCELY * DIMOBJY - LYIMAGE) : 0; if (m_posDecor.y > max) { m_posDecor.y = max; } m_posCelHili.x = -1; } if (m_keyPress & KEY_UP) { - m_posDecor.x -= 50; - if (m_posDecor.x < 0) { - m_posDecor.x = 0; + m_posDecor.y -= 50; + if (m_posDecor.y < 0) { + m_posDecor.y = 0; } m_posCelHili.x = -1; } @@ -1667,6 +1667,8 @@ void CDecor::DoorsLost() // more... } + + // Winphone functions, likely unnecessary /* BOOL CDecor::SearchGold(int n, POINT cel) diff --git a/src/decor.h b/src/decor.h index e1232ce..4a2ce1e 100644 --- a/src/decor.h +++ b/src/decor.h @@ -421,6 +421,11 @@ public: inline BOOL IsValidCel(POINT cel); inline void MoveObjectCopy(MoveObject src, MoveObject dest); inline void StopVehicleSound(); + inline BOOL IsDeadAction(int action); + inline void StopBlupi(BOOL bFocus = FALSE); + inline BOOL IsBlupiVehicle(); + inline BOOL IsBlupiMotorVehicle(); + inline BOOL IsBlupiStanding(); protected: HWND m_hWnd; @@ -586,4 +591,39 @@ inline void CDecor::StopVehicleSound() StopSound(SOUND_HELICOLOW); StopSound(SOUND_JEEPHIGH); StopSound(SOUND_JEEPLOW); +} + +inline BOOL CDecor::IsDeadAction(int action) +{ + return action == ACTION_CLEAR1 || (action >= ACTION_CLEAR2 && action <= ACTION_CLEAR8); +} + +inline void CDecor::StopBlupi(BOOL bSetFocus) +{ + m_blupiAction = ACTION_STOP; + m_blupiPhase = 0; + if (bSetFocus) m_blupiFocus = TRUE; +} + +inline BOOL CDecor::IsBlupiVehicle() +{ + return m_blupiHelico || m_blupiOver || m_blupiJeep || m_blupiTank || m_blupiSkate; +} + +inline BOOL CDecor::IsBlupiMotorVehicle() +{ + return m_blupiHelico || m_blupiOver || m_blupiJeep || m_blupiTank; +} + +inline BOOL CDecor::IsBlupiStanding() +{ + return !(m_blupiAction == ACTION_TURN || + m_blupiAction == ACTION_JUMP || + m_blupiAction == ACTION_AIR || + m_blupiAction == ACTION_VERTIGO || + m_blupiAction == ACTION_ADVANCE || + m_blupiAction == ACTION_RECEDE) && + !IsBlupiVehicle() && + !(m_blupiAir || m_blupiBalloon || m_blupiEcrase || + m_blupiNage || m_blupiSurf || m_blupiSuspend); } \ No newline at end of file diff --git a/src/dectables.h b/src/dectables.h index 9990daa..e1d8368 100644 --- a/src/dectables.h +++ b/src/dectables.h @@ -23,30 +23,33 @@ extern int table_vitesse_surf[] 0, 2, 5, 8, 3, 0 }; -extern int table_bulldozer_left[8]{ 66, 66, 67, 67, 66, 66, 65, 65 }; +extern int table_bulldozer_left[]{ 8, 66, 66, 67, 67, 66, 66, 65, 65 }; -extern int table_bulldozer_right[8]{ 58, 58, 57, 57, 58, 58, 59, 59 }; +extern int table_bulldozer_right[]{ 8, 58, 58, 57, 57, 58, 58, 59, 59 }; -extern int table_bulldozer_turn2l[22] +extern int table_bulldozer_turn2l[] { + 22, 58, 59, 59, 59, 60, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 64, 65, 65, 65, 66, 66, 66 }; -extern int table_bulldozer_turn2r[22] +extern int table_bulldozer_turn2r[] { + 22, 66, 65, 65, 65, 64, 64, 64, 63, 63, 62, 62, 61, 61, 60, 60, 60, 59, 59, 59, 58, 58, 58 }; -extern int table_poisson_left[8]{ 82, 82, 81, 81, 82, 82, 83, 83 }; +extern int table_poisson_left[]{ 8, 82, 82, 81, 81, 82, 82, 83, 83 }; -extern int table_poisson_right[8]{ 79, 79, 78, 78, 79, 79, 80, 80 }; +extern int table_poisson_right[]{ 8, 79, 79, 78, 78, 79, 79, 80, 80 }; -extern int table_poisson_turn2l[48] +extern int table_poisson_turn2l[] { + 48, 79, 79, 80, 80, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 83, 83, 82, 82, 83, 83, 88, 88, 87, 87, 86, 86, 85, 85, 84, 84, @@ -54,8 +57,9 @@ extern int table_poisson_turn2l[48] 86, 86, 87, 87, 88, 88, 83, 83 }; -extern int table_poisson_turn2r[48] +extern int table_poisson_turn2r[] { + 48, 82, 82, 83, 83, 88, 88, 87, 87, 86, 86, 85, 85, 84, 84, 79, 79, 79, 79, 80, 80, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, @@ -63,28 +67,29 @@ extern int table_poisson_turn2r[48] 86, 86, 85, 85, 84, 84, 79, 79 }; -extern int table_oiseau_left[8]{ 98, 99, 100, 101, 102, 103, 104, 105 }; +extern int table_oiseau_left[]{ 8, 98, 99, 100, 101, 102, 103, 104, 105 }; -extern int table_oiseau_right[8]{ 90, 91, 92, 93, 94, 95, 96, 97 }; +extern int table_oiseau_right[]{ 8, 90, 91, 92, 93, 94, 95, 96, 97 }; -extern int table_oiseau_turn2l[10]{ 106, 107, 108, 109, 110, 111, 112, 113, 105, 105 }; +extern int table_oiseau_turn2l[]{ 10, 106, 107, 108, 109, 110, 111, 112, 113, 105, 105 }; -extern int table_oiseau_turn2r[10]{ 114, 115, 116, 117, 118, 119, 120, 121, 97, 97 }; +extern int table_oiseau_turn2r[]{ 10, 114, 115, 116, 117, 118, 119, 120, 121, 97, 97 }; -extern int table_guepe_left[6]{ 195, 196, 197, 198, 197, 196 }; +extern int table_guepe_left[]{ 6, 195, 196, 197, 198, 197, 196 }; -extern int table_guepe_right[6]{ 199, 200, 201, 202, 201, 200 }; +extern int table_guepe_right[]{ 6, 199, 200, 201, 202, 201, 200 }; -extern int table_guepe_turn2l[5]{ 207, 206, 205, 204, 203 }; +extern int table_guepe_turn2l[]{ 5, 207, 206, 205, 204, 203 }; -extern int table_guepe_turn2r[5]{ 203, 204, 205, 206, 207 }; +extern int table_guepe_turn2r[]{ 5, 203, 204, 205, 206, 207 }; -extern int table_creature_left[8]{ 247, 248, 249, 250, 251, 250, 249, 248 }; +extern int table_creature_left[]{ 8, 247, 248, 249, 250, 251, 250, 249, 248 }; -extern int table_creature_right[8]{ 247, 248, 249, 250, 251, 250, 249, 248 }; +extern int table_creature_right[]{ 8, 247, 248, 249, 250, 251, 250, 249, 248 }; -extern int table_creature_turn2[152] +extern int table_creature_turn2[] { + 152, 244, 244, 244, 244, 244, 244, 244, 244, 243, 243, 242, 242, 242, 242, 242, 242, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 246, 246, 246, 246, @@ -103,74 +108,83 @@ extern int table_creature_turn2[152] 244, 244 }; -extern int table_blupih_left[8]{ 66, 67, 68, 67, 66, 69, 70, 69 }; +extern int table_blupih_left[]{ 8, 66, 67, 68, 67, 66, 69, 70, 69 }; -extern int table_blupih_right[8]{ 61, 62, 63, 62, 61, 64, 65, 64 }; +extern int table_blupih_right[]{ 8, 61, 62, 63, 62, 61, 64, 65, 64 }; -extern int table_blupih_turn2l[26] +extern int table_blupih_turn2l[] { + 26, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 68, 68, 275, 275, 271, 271, 271, 271, 272, 272, 273, 273, 273, 273, 275, 275 }; -extern int table_blupih_turn2r[26] +extern int table_blupih_turn2r[] { + 26, 75, 75, 74, 74, 73, 73, 72, 72, 71, 71, 63, 63, 274, 274, 271, 271, 271, 271, 272, 272, 273, 273, 273, 273, 274, 274 }; -extern int table_blupit_left[8]{ 249, 249, 250, 250, 249, 249, 248, 248 }; +extern int table_blupit_left[]{ 8, 249, 249, 250, 250, 249, 249, 248, 248 }; -extern int table_blupit_right[8]{ 238, 238, 237, 237, 238, 238, 239, 239 }; +extern int table_blupit_right[]{ 8, 238, 238, 237, 237, 238, 238, 239, 239 }; -extern int table_blupit_turn2l[24] +extern int table_blupit_turn2l[] { + 24, 238, 238, 251, 251, 238, 238, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 249, 249, 252, 252, 249, 249 }; -extern int table_blupit_turn2r[24] +extern int table_blupit_turn2r[] { + 24, 249, 249, 252, 252, 249, 249, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 238, 238, 251, 251, 238, 238 }; -extern int table_explo1[39] +extern int table_explo1[] { + 39, 0, 0, 1, 1, 2, 2, 3, 3, 4, 3, 4, 4, 3, 4, 3, 3, 4, 4, 5, 5, 4, 5, 6, 5, 6, 6, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11 }; -extern int table_explo2[20] +extern int table_explo2[] { + 20, 12, -1, 13, 14, -1, 15, 13, -1, 14, 15, 12, -1, 13, 15, 14, 14, -1, 14, 15, 13 }; -extern int table_explo3[20] +extern int table_explo3[] { + 20, 32, 32, 34, 34, 32, 32, 34, 34, 32, 32, 34, 34, 32, 32, 35, 35, 32, 32, 35, 35 }; -extern int table_explo4[9]{ 12, 13, 14, 15, 7, 8, 9, 10, 11 }; +extern int table_explo4[]{ 9, 12, 13, 14, 15, 7, 8, 9, 10, 11 }; -extern int table_explo5[12] +extern int table_explo5[] { + 12, 54, -1, 55, -1, 56, -1, 57, -1, 58, -1, 59, -1 }; -extern int table_explo6[6]{ 54, 55, 56, 57, 58, 59 }; +extern int table_explo6[]{ 6, 54, 55, 56, 57, 58, 59 }; -extern int table_explo7[128] +extern int table_explo7[] { + 128, 60, 61, -1, 63, 64, 65, 62, 64, 62, 60, 62, -1, 65, -1, 60, 65, 63, 61, 62, -1, 64, 65, -1, 62, 64, 61, 62, 63, -1, 65, @@ -186,24 +200,27 @@ extern int table_explo7[128] -1, 61, -1, -1, -1, 60, -1, -1 }; -extern int table_explo8[5]{ 7, 8, 9, 10, 11 }; +extern int table_explo8[]{ 5, 7, 8, 9, 10, 11 }; -extern int table_sploutch1[10]{ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; +extern int table_sploutch1[]{ 10, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; -extern int table_sploutch2[13] +extern int table_sploutch2[] { + 13, -1, -1, -1, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; -extern int table_sploutch3[18] +extern int table_sploutch3[] { + 18, -1, -1, -1, -1, -1, -1, -1, -1, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; -extern int table_tentacule[45] +extern int table_tentacule[] { + 45, 86, 85, 84, 83, 84, 85, 86, -1, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 70, 70, 70, 71, 72, @@ -211,8 +228,9 @@ extern int table_tentacule[45] 83, 84, 85, 86, -1 }; -extern int table_bridge[157] +extern int table_bridge[] { + 157, 365, 366, 365, 366, 365, 366, 365, 366, 365, 366, 365, 366, 365, 366, 365, 366, 367, 367, 368, 368, 369, 369, 370, 370, 371, 371, 372, 372, -1, -1, @@ -231,51 +249,57 @@ extern int table_bridge[157] 367, 367, 366, 366, 365, 365, 364 }; -extern int table_pollution[8]{ 179, 180, 181, 182, 183, 184, 185, 186 }; +extern int table_pollution[]{ 8, 179, 180, 181, 182, 183, 184, 185, 186 }; -extern int table_invertstart[8]{ 179, 180, 181, 182, 183, 184, 185, 186 }; +extern int table_invertstart[]{ 8, 179, 180, 181, 182, 183, 184, 185, 186 }; -extern int table_invertstop[8]{ 186, 185, 184, 183, 182, 181, 180, 179 }; +extern int table_invertstop[]{ 8, 186, 185, 184, 183, 182, 181, 180, 179 }; -extern int table_invertpanel[8]{ 187, 188, 189, 190, 191, 192, 193, 194 }; +extern int table_invertpanel[]{ 8, 187, 188, 189, 190, 191, 192, 193, 194 }; -extern int table_plouf[7]{ 99, 100, 101, 102, 101, 100, 99 }; +extern int table_plouf[]{ 7, 99, 100, 101, 102, 101, 100, 99 }; -extern int table_tiplouf[3]{ 244, 99, 244 }; +extern int table_tiplouf[]{ 3, 244, 99, 244 }; -extern int table_blup[20] +extern int table_blup[] { + 20, 103, 104, 105, 106, 104, 103, 106, 105, 103, 104, 103, 105, 106, 103, 105, 106, 103, 104, 106, 105 }; -extern int table_follow1[26] +extern int table_follow1[] { + 26, 256, 256, 256, 257, 257, 258, 259, 260, 261, 262, 263, 264, 264, 265, 265, 265, 264, 264, 263, 262, 261, 260, 259, 258, 257, 257 }; -extern int table_follow2[5]{ 256, 258, 260, 262, 264 }; +extern int table_follow2[]{ 5, 256, 258, 260, 262, 264 }; -extern int table_cle[12] +extern int table_cle[] { + 12, 122, 123, 124, 125, 126, 127, 128, 127, 126, 125, 124, 123 }; -extern int table_cle1[12] +extern int table_cle1[] { + 12, 209, 210, 211, 212, 213, 214, 215, 214, 213, 212, 211, 210 }; -extern int table_cle2[12] +extern int table_cle2[] { + 12, 220, 221, 222, 221, 220, 219, 218, 217, 216, 217, 218, 219 }; -extern int table_cle3[12] +extern int table_cle3[] { + 12, 229, 228, 227, 226, 225, 224, 223, 224, 225, 226, 227, 228 }; @@ -315,8 +339,9 @@ extern int table_decor_action[] 0 }; -extern int table_dynamitef[100] +extern int table_dynamitef[] { + 100, 253, 252, 254, 252, 252, 255, 252, 254, 253, 252, 253, 254, 255, 252, 255, 253, 252, 254, 252, 255, 253, 254, 252, 253, 255, 254, 255, 252, 253, 254, @@ -329,23 +354,26 @@ extern int table_dynamitef[100] 255, 253, 253, 254, 255, 254, 252, 253, 254, 255 }; -extern int table_skate[34] +extern int table_skate[] { + 34, 129, 129, 129, 129, 130, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 134, 135, 135, 135, 135, 134, 134, 134, 133, 133, 132, 132, 131, 131, 131, 130, 130, 130, 130 }; -extern int table_glu[25] +extern int table_glu[] { + 25, 168, 168, 169, 169, 170, 170, 171, 171, 170, 170, 169, 169, 168, 168, 169, 169, 169, 168, 168, 169, 169, 170, 170, 169, 168 }; -extern int table_clear[70] +extern int table_clear[] { + 70, 40, 40, 40, 40, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 40, 40, @@ -355,8 +383,9 @@ extern int table_clear[70] 47, 47, 46, 46, 47, 47, 46, 46, 47, 47 }; -extern int table_electro[90] +extern int table_electro[] { + 90, 266, 267, 266, 267, 266, 267, 266, 267, 266, 267, 266, 267, 266, 267, 266, 267, 266, 267, 266, 267, 266, 267, 266, 267, 266, 267, 266, 267, 266, 267, @@ -368,11 +397,11 @@ extern int table_electro[90] 46, 46, 47, 47, 46, 46, 47, 47, 46, 46 }; -extern int table_chenille[6]{ 311, 312, 313, 314, 315, 316 }; +extern int table_chenille[]{ 6, 311, 312, 313, 314, 315, 316 }; -extern int table_chenillei[6]{ 316, 315, 314, 313, 312, 311 }; +extern int table_chenillei[]{ 6, 316, 315, 314, 313, 312, 311 }; -extern int table_adapt_decor[144] +extern int table_adapt_decor[] { 153, 147, 148, 146, 40, 151, 150, 144, 39, 152, 149, 145, 38, 36, 37, 35, 153, 147, 148, 146, @@ -391,8 +420,9 @@ extern int table_adapt_decor[144] 251, 250, 256, 250 }; -extern int table_adapt_fromage[32] +extern int table_adapt_fromage[] { + 32 -1, 265, 264, 268, 267, 273, 271, 275, 266, 272, 270, 274, 269, 277, 276, 278, -1, 286, 285, 289, 288, 294, 292, 296, 287, 293, 291, 295, 290, 298, diff --git a/src/def.h b/src/def.h index 5bc12b6..6da8df9 100644 --- a/src/def.h +++ b/src/def.h @@ -114,42 +114,42 @@ enum { // Actions : -#define ACTION_STOP 1 -#define ACTION_MARCH 2 +#define ACTION_STOP 1 // stand still +#define ACTION_MARCH 2 // walk #define ACTION_TURN 3 -#define ACTION_JUMP 4 +#define ACTION_JUMP 4 // beginning to jump #define ACTION_AIR 5 -#define ACTION_DOWN 6 -#define ACTION_UP 7 -#define ACTION_VERTIGO 8 -#define ACTION_RECEDE 9 -#define ACTION_ADVANCE 10 +#define ACTION_DOWN 6 // look down +#define ACTION_UP 7 // look up +#define ACTION_VERTIGO 8 // "whoops" +#define ACTION_RECEDE 9 // back away from edge +#define ACTION_ADVANCE 10 // walk forward away from edge #define ACTION_CLEAR1 11 #define ACTION_SET 12 #define ACTION_WIN 13 -#define ACTION_PUSH 14 +#define ACTION_PUSH 14 // pushing a case #define ACTION_STOPHELICO 15 #define ACTION_MARCHHELICO 16 #define ACTION_TURNHELICO 17 -#define ACTION_STOPNAGE 18 -#define ACTION_MARCHNAGE 19 -#define ACTION_TURNNAGE 20 -#define ACTION_STOPSURF 21 -#define ACTION_MARCHSURF 22 -#define ACTION_TURNSURF 23 +#define ACTION_STOPNAGE 18 // stopped in deep water +#define ACTION_MARCHNAGE 19 // swimming in deep water +#define ACTION_TURNNAGE 20 // turning in deep water +#define ACTION_STOPSURF 21 // stopped on water surface +#define ACTION_MARCHSURF 22 // swimming at water surface +#define ACTION_TURNSURF 23 // turning at water surface #define ACTION_DROWN 24 #define ACTION_STOPJEEP 25 #define ACTION_MARCHJEEP 26 #define ACTION_TURNJEEP 27 -#define ACTION_STOPPOP 28 -#define ACTION_POP 29 -#define ACTION_BYE 30 -#define ACTION_STOPSUSPEND 31 -#define ACTION_MARCHSUSPEND 32 -#define ACTION_TURNSUSPEND 33 -#define ACTION_JUMPSUSPEND 34 -#define ACTION_HIDE 35 -#define ACTION_JUMPAIE 36 +#define ACTION_STOPPOP 28 // pulling a case, stopped +#define ACTION_POP 29 // pulling a case +#define ACTION_BYE 30 // "au au" +#define ACTION_STOPSUSPEND 31 // stopped on bars +#define ACTION_MARCHSUSPEND 32 // moving on bars +#define ACTION_TURNSUSPEND 33 // turning on bars +#define ACTION_JUMPSUSPEND 34 // pulling up from bars +#define ACTION_HIDE 35 // invisible +#define ACTION_JUMPAIE 36 // headache #define ACTION_STOPSKATE 37 #define ACTION_MARCHSKATE 38 #define ACTION_TURNSKATE 39 @@ -160,14 +160,14 @@ enum { #define ACTION_OUF1a 44 #define ACTION_OUF1b 45 #define ACTION_OUF2 46 -#define ACTION_OUF3 47 +#define ACTION_OUF3 47 // stop moving case "gahh...!" #define ACTION_OUF4 48 -#define ACTION_SUCETTE 49 +#define ACTION_SUCETTE 49 // eating lollipop #define ACTION_STOPTANK 50 #define ACTION_MARCHTANK 51 #define ACTION_TURNTANK 52 #define ACTION_FIRETANK 53 -#define ACTION_GLU 54 +#define ACTION_GLU 54 // glued #define ACTION_DRINK 55 #define ACTION_CHARGE 56 #define ACTION_ELECTRO 57 @@ -179,10 +179,10 @@ enum { #define ACTION_MOCKERY 63 #define ACTION_MOCKERYi 64 #define ACTION_OUF5 65 -#define ACTION_BALLOON 66 -#define ACTION_STOPOVER 67 -#define ACTION_MARCHOVER 68 -#define ACTION_TURNOVER 69 +#define ACTION_BALLOON 66 // stung by wasp +#define ACTION_STOPOVER 67 // stopped in hovercraft +#define ACTION_MARCHOVER 68 // moving in hovercraft +#define ACTION_TURNOVER 69 // turning in hovercraft #define ACTION_RECEDEq 70 #define ACTION_ADVANCEq 71 #define ACTION_STOPECRASE 72 @@ -197,7 +197,7 @@ enum { #define ACTION_CLEAR8 81 #define ACTION_SWITCH 82 #define ACTION_MOCKERYp 83 -#define ACTION_NON 84 +#define ACTION_NON 84 // can't place personal bomb #define ACTION_SLOWDOWNSKATE 85 #define ACTION_TAKEDYNAMITE 86 #define ACTION_PUTDYNAMITE 87 @@ -213,9 +213,9 @@ enum { // Types : -#define TYPE_ASCENSEUR 1 -#define TYPE_BOMBEDOWN 2 -#define TYPE_BOMBEUP 3 +#define TYPE_ASCENSEUR 1 // lift +#define TYPE_BOMBEDOWN 2 // floor bomb +#define TYPE_BOMBEUP 3 // hanging bomb #define TYPE_BULLDOZER 4 #define TYPE_TRESOR 5 #define TYPE_EGG 6 @@ -229,61 +229,61 @@ enum { #define TYPE_PLOUF 14 #define TYPE_BLUP 15 #define TYPE_BOMBEMOVE 16 -#define TYPE_POISSON 17 +#define TYPE_POISSON 17 // fish #define TYPE_TOMATES 18 // unused #define TYPE_JEEP 19 -#define TYPE_OISEAU 20 -#define TYPE_CLE 21 +#define TYPE_OISEAU 20 // bird +#define TYPE_CLE 21 // gold key #define TYPE_DOOR 22 -#define TYPE_BALLE 23 +#define TYPE_BALLE 23 // glue ball #define TYPE_SKATE 24 #define TYPE_SHIELD 25 -#define TYPE_POWER 26 -#define TYPE_MAGICTRACK 27 +#define TYPE_POWER 26 // lollipop +#define TYPE_MAGICTRACK 27 // sparkles #define TYPE_TANK 28 #define TYPE_BULLET 29 #define TYPE_DRINK 30 -#define TYPE_CHARGE 31 +#define TYPE_CHARGE 31 // charging device #define TYPE_BLUPIHELICO 32 #define TYPE_BLUPITANK 33 #define TYPE_GLU 34 #define TYPE_TIPLOUF 35 #define TYPE_POLLUTION 36 -#define TYPE_CLEAR 37 -#define TYPE_ELECTRO 38 -#define TYPE_TRESORTRACK 39 +#define TYPE_CLEAR 37 // burned blupi +#define TYPE_ELECTRO 38 // shocked blupi +#define TYPE_TRESORTRACK 39 // sparkles #define TYPE_INVERT 40 #define TYPE_INVERTSTART 41 #define TYPE_INVERTSTOP 42 -#define TYPE_GUEPE 44 -#define TYPE_OVER 46 -#define TYPE_ASCENSEURs 47 -#define TYPE_ASCENSEURsi 48 -#define TYPE_CLE1 49 -#define TYPE_CLE2 50 -#define TYPE_CLE3 51 -#define TYPE_BRIDGE 52 -#define TYPE_TENTACULE 53 -#define TYPE_CREATURE 54 +#define TYPE_GUEPE 44 // wasp +#define TYPE_OVER 46 // hovercraft +#define TYPE_ASCENSEURs 47 // conveyor belt right +#define TYPE_ASCENSEURsi 48 // conveyor belt left +#define TYPE_CLE1 49 // red key +#define TYPE_CLE2 50 // green key +#define TYPE_CLE3 51 // blue key +#define TYPE_BRIDGE 52 // fragile bridge +#define TYPE_TENTACULE 53 // slime tentacle effect +#define TYPE_CREATURE 54 // moving slime creature #define TYPE_DYNAMITE 55 -#define TYPE_DYNAMITEf 56 -#define TYPE_SHIELDTRACK 57 -#define TYPE_HIDETRACK 58 +#define TYPE_DYNAMITEf 56 // lit dynamite +#define TYPE_SHIELDTRACK 57 // particles +#define TYPE_HIDETRACK 58 // particles #define TYPE_EXPLO5 90 #define TYPE_EXPLO6 91 #define TYPE_EXPLO7 92 #define TYPE_EXPLO8 93 #define TYPE_EXPLO9 94 #define TYPE_EXPLO10 95 -#define TYPE_BOMBEFOLLOW1 96 -#define TYPE_BOMBEFOLLOW2 97 -#define TYPE_SPLOUTCH1 98 -#define TYPE_SPLOUTCH2 99 -#define TYPE_SPLOUTCH3 100 -#define TYPE_BOMBEPERSO1 200 -#define TYPE_BOMBEPERSO2 201 -#define TYPE_BOMBEPERSO3 202 -#define TYPE_BOMBEPERSO4 203 +#define TYPE_BOMBEFOLLOW1 96 // homing bomb, stopped +#define TYPE_BOMBEFOLLOW2 97 // homing bomb, moving +#define TYPE_SPLOUTCH1 98 // particles +#define TYPE_SPLOUTCH2 99 // particles +#define TYPE_SPLOUTCH3 100 // particles +#define TYPE_BOMBEPERSO1 200 // player 1 personal bomb (yellow) +#define TYPE_BOMBEPERSO2 201 // player 2 personal bomb (orange) +#define TYPE_BOMBEPERSO3 202 // player 3 personal bomb (blue) +#define TYPE_BOMBEPERSO4 203 // player 4 personal bomb (green) // Steps : @@ -297,15 +297,15 @@ enum { // Sons : #define SOUND_CLICK 0 -#define SOUND_JUMP1 1 -#define SOUND_JUMP2 2 -#define SOUND_JUMPEND 3 -#define SOUND_JUMPTOC 4 +#define SOUND_JUMP1 1 // medium jump +#define SOUND_JUMP2 2 // high jump +#define SOUND_JUMPEND 3 // step on stone +#define SOUND_JUMPTOC 4 // hit stone #define SOUND_TURN 5 -#define SOUND_VERTIGO 6 -#define SOUND_DOWN 7 +#define SOUND_VERTIGO 6 // "whoops" +#define SOUND_DOWN 7 // look down #define SOUND_FALL 8 -#define SOUND_NEW 9 +#define SOUND_NEW 9 // respawn #define SOUND_BOUM 10 #define SOUND_TRESOR 11 #define SOUND_EGG 12 @@ -316,79 +316,79 @@ enum { #define SOUND_HELICOSTOP 17 #define SOUND_HELICOLOW 18 #define SOUND_LASTTRESOR 19 -#define SOUND_UP 20 +#define SOUND_UP 20 // partially unused sound when pressing left+right+down #define SOUND_LOOKUP 21 -#define SOUND_JUMP0 22 +#define SOUND_JUMP0 22 // low jump #define SOUND_PLOUF 23 #define SOUND_BLUP 24 -#define SOUND_SURF 25 +#define SOUND_SURF 25 // inhale #define SOUND_DROWN 26 #define SOUND_ERROR 27 #define SOUND_JEEPSTART 28 #define SOUND_JEEPHIGH 29 #define SOUND_JEEPSTOP 30 #define SOUND_JEEPLOW 31 -#define SOUND_BYE 32 -#define SOUND_DOOR 33 -#define SOUND_SUSPENDTOC 34 -#define SOUND_SUSPENDJUMP 35 +#define SOUND_BYE 32 // "au au" +#define SOUND_DOOR 33 // door creak +#define SOUND_SUSPENDTOC 34 // grab bar +#define SOUND_SUSPENDJUMP 35 // pull up from bar #define SOUND_SINGE 36 #define SOUND_PATIENT 37 -#define SOUND_PUSH 38 -#define SOUND_POP 39 -#define SOUND_JUMPAIE 40 -#define SOUND_RESSORT 41 +#define SOUND_PUSH 38 // pushing crate +#define SOUND_POP 39 // pulling crate +#define SOUND_JUMPAIE 40 // headache "aie" +#define SOUND_RESSORT 41 // spring #define SOUND_STARTSHIELD 42 #define SOUND_STOPSHIELD 43 -#define SOUND_STARTPOWER 44 -#define SOUND_STOPPOWER 45 -#define SOUND_OUF1 46 -#define SOUND_OUF2 47 -#define SOUND_OUF3 48 -#define SOUND_OUF4 49 -#define SOUND_SUCETTE 50 -#define SOUND_GLU 51 -#define SOUND_FIREOK 52 -#define SOUND_FIREKO 53 +#define SOUND_STARTPOWER 44 // lollipop activate +#define SOUND_STOPPOWER 45 // lollipop deactivate +#define SOUND_OUF1 46 // exit water "phew" +#define SOUND_OUF2 47 // scared "huaaaahhhhh--!" +#define SOUND_OUF3 48 // stop moving case "gahh...!" +#define SOUND_OUF4 49 // shriek, heartbeat +#define SOUND_SUCETTE 50 // lick lollipop +#define SOUND_GLU 51 // buaaaaaaaaaaaah +#define SOUND_FIREOK 52 +#define SOUND_FIREKO 53 // ratchet #define SOUND_TAKEGLU 54 #define SOUND_STARTCLOUD 55 #define SOUND_STOPCLOUD 56 #define SOUND_DRINK 57 #define SOUND_CHARGE 58 #define SOUND_ELECTRO 59 -#define SOUND_PERSOTAKE 60 -#define SOUND_PERSOPOSE 61 +#define SOUND_PERSOTAKE 60 // "wow!" +#define SOUND_PERSOPOSE 61 // *evil laugh* #define SOUND_STARTHIDE 62 #define SOUND_STOPHIDE 63 -#define SOUND_TIPLOUF 64 +#define SOUND_TIPLOUF 64 // light splash #define SOUND_MOCKERY 65 #define SOUND_INVERTSTART 66 #define SOUND_INVERTSTOP 67 -#define SOUND_OVERSTOP 68 -#define SOUND_BLITZ 69 +#define SOUND_OVERSTOP 68 // hovercraft stall +#define SOUND_BLITZ 69 // lightning buzz #define SOUND_ECRASE 70 #define SOUND_TELEPORTE 71 -#define SOUND_BRIDGE1 72 -#define SOUND_BRIDGE2 73 -#define SOUND_ANGEL 74 -#define SOUND_SCIE 75 +#define SOUND_BRIDGE1 72 // bridge fall +#define SOUND_BRIDGE2 73 // bridge appear +#define SOUND_ANGEL 74 // "uie uie uie, aie aie aie" +#define SOUND_SCIE 75 // saw #define SOUND_SWITCHOFF 76 #define SOUND_SWITCHON 77 -#define SOUND_JUMPENDb 78 -#define SOUND_JUMPTOCb 79 -#define SOUND_JUMPENDm 80 -#define SOUND_JUMPTOCm 81 -#define SOUND_JUMPENDg 82 -#define SOUND_JUMPTOCg 83 -#define SOUND_JUMPENDo 84 -#define SOUND_JUMPTOCo 85 -#define SOUND_JUMPENDk 86 -#define SOUND_JUMPTOCk 87 -#define SOUND_JUMPENDf 88 -#define SOUND_JUMPTOCf 89 -#define SOUND_JUMPENDh 90 -#define SOUND_JUMPTOCh 91 -#define SOUND_FOLLOW 92 +#define SOUND_JUMPENDb 78 // step on wood +#define SOUND_JUMPTOCb 79 // hit wood +#define SOUND_JUMPENDm 80 // step on metal +#define SOUND_JUMPTOCm 81 // hit metal +#define SOUND_JUMPENDg 82 // step on cave +#define SOUND_JUMPTOCg 83 // hit cave +#define SOUND_JUMPENDo 84 // step on slime +#define SOUND_JUMPTOCo 85 // hit slime +#define SOUND_JUMPENDk 86 // step on plastic +#define SOUND_JUMPTOCk 87 // hit plastic +#define SOUND_JUMPENDf 88 // step on cheese +#define SOUND_JUMPTOCf 89 // hit cheese +#define SOUND_JUMPENDh 90 // step on grass +#define SOUND_JUMPTOCh 91 // hit grass +#define SOUND_FOLLOW 92 // homing bomb "be-be-beep" #define SOUND_MOVIE 99 // @@ -1190,6 +1190,9 @@ namespace Object { #define CLE_GREEN (1 << 1) #define CLE_BLUE (1 << 2) +#define JAUGE_AIR 0 +#define JAUGE_POWER 1 + // helpers for POINT POINT operator+(POINT p, const POINT& a) diff --git a/src/event.cpp b/src/event.cpp index 59d79ba..e3b421a 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -2440,6 +2440,8 @@ BOOL CEvent::DrawButtons() BOOL bEnable; int phase; + + if (m_phase != WM_PHASE_INSERT && m_phase != WM_PHASE_BYE) { m_bChangeCheat = FALSE; @@ -2528,6 +2530,38 @@ BOOL CEvent::DrawButtons() PutTextInputBox({ 320, 232 }); } + /* + // TEMP DEBUG + if (m_keyPress & KEY_LEFT) + { + DrawTextLeft(m_pPixmap, { LXIMAGE - 30, 15 }, "<", 0); + } + if (m_keyPress & KEY_RIGHT) + { + DrawTextLeft(m_pPixmap, { LXIMAGE - 10, 15 }, ">", 0); + } + if (m_keyPress & KEY_UP) + { + DrawTextLeft(m_pPixmap, { LXIMAGE - 20, 5 }, "^", 0); + } + if (m_keyPress & KEY_DOWN) + { + DrawTextLeft(m_pPixmap, { LXIMAGE - 20, 15 }, "v", 0); + } + if (m_keyPress & KEY_FIRE) + { + DrawTextLeft(m_pPixmap, { LXIMAGE - 60, 15 }, "F", 0); + } + if (m_keyPress & KEY_JUMP) + { + DrawTextLeft(m_pPixmap, { LXIMAGE - 50, 15 }, "J", 0); + } + sprintf(res, "%d", m_keyPress); + DrawTextLeft(m_pPixmap, { LXIMAGE - 60, 30 }, res, 0); + sprintf(res, "demoTime %d", m_demoTime); + DrawTextLeft(m_pPixmap, { 60, 0 }, res, m_demoTime % 20 < 10 ? FONTGOLD : FONTWHITE); + if (m_demoTime % 20 == 0 && m_demoTime > 0) m_pSound->PlayImage(93, { 320, 240 }); + */ if (m_phase == WM_PHASE_PLAY && m_phase == WM_PHASE_PLAYTEST && m_phase == WM_PHASE_BUILD) m_pPixmap->DrawPart(-1, 0, pos, rect, 1, 0); diff --git a/src/event.h b/src/event.h index e8827d5..60974ff 100644 --- a/src/event.h +++ b/src/event.h @@ -90,7 +90,7 @@ public: void SetState(int button, int state); BOOL GetEnable(int button); void SetEnable(int button, int bEnable); - void SetSomething(int button, int bSomething); + void SetIconMenu(int button, int bSomething); BOOL GetHide(int button); void SetHide(int button, BOOL bHide); int GetMenu(int button); diff --git a/src/network.cpp b/src/network.cpp index 6988126..fcd63bb 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -10,161 +10,208 @@ // a0f94abe-11c3-d111-be62-0040f6944838 #define APP_GUID { 0xbe4af9a0, 0xc311, 0x11d1, { 0xbe, 0x62, 0x00, 0x40, 0xf6, 0x94, 0x48, 0x38 } }; -extern "C" { - CNetwork::CNetwork() +CNetwork::CNetwork() +{ + m_pDP = NULL; + m_dpid = 0; + m_bHost = FALSE; + m_providers.nb = 0; + m_providers.pList = NULL; + m_sessions.nb = 0; + m_sessions.pList = NULL; + m_unknown.nb = 0; + m_unknown.pList = NULL; +} + +CNetwork::~CNetwork() +{ + FreeProviderList(); + FreeSessionList(); + FreeUnknownList(); + if (m_pDP) m_pDP->Release(); +} + +static BOOL EnumProvidersCallback(LPGUID lpguidSP, LPSTR lpSPName, + DWORD dwMajorVersion, DWORD dwMinorVersion, NamedGUIDList* lpContext) +{ + if (lpContext->nb < MAXSESSION) { - m_pDP = NULL; - m_dpid = 0; - m_bHost = FALSE; - m_providers.nb = 0; - m_providers.pList = NULL; - m_sessions.nb = 0; - m_sessions.pList = NULL; - m_unknown.nb = 0; - m_unknown.pList = NULL; + lpContext->pList[lpContext->nb]->guid = *lpguidSP; + strcpy(lpContext->pList[lpContext->nb]->name, lpSPName); + lpContext->nb++; } + return TRUE; +} - CNetwork::~CNetwork() - { - FreeProviderList(); - FreeSessionList(); - FreeUnknownList(); - if (m_pDP) m_pDP->Release(); - } +BOOL CNetwork::EnumProviders() +{ + FreeProviderList(); + m_providers.nb = 0; + m_providers.pList = (NamedGUID(*)[MAXSESSION]) malloc(MAXSESSION * sizeof(NamedGUID)); - static BOOL EnumProvidersCallback(LPGUID lpguidSP, LPSTR lpSPName, - DWORD dwMajorVersion, DWORD dwMinorVersion, NamedGUIDList* lpContext) - { - if (lpContext->nb < MAXSESSION) - { - lpContext->pList[lpContext->nb]->guid = *lpguidSP; - strcpy(lpContext->pList[lpContext->nb]->name, lpSPName); - lpContext->nb++; - } - return TRUE; - } - - BOOL CNetwork::EnumProviders() - { - FreeProviderList(); - m_providers.nb = 0; - m_providers.pList = (NamedGUID(*)[MAXSESSION]) malloc(MAXSESSION * sizeof(NamedGUID)); - - if (!m_providers.pList) return FALSE; + if (!m_providers.pList) return FALSE; #ifdef _UNICODE - if (DirectPlayEnumerate((LPDPENUMDPCALLBACK)EnumProvidersCallback, &m_providers) != DP_OK) + if (DirectPlayEnumerate((LPDPENUMDPCALLBACK)EnumProvidersCallback, &m_providers) != DP_OK) #else - if (DirectPlayEnumerate((LPDPENUMDPCALLBACKA)EnumProvidersCallback, &m_providers) != DP_OK) + if (DirectPlayEnumerate((LPDPENUMDPCALLBACKA)EnumProvidersCallback, &m_providers) != DP_OK) #endif + { + FreeProviderList(); + return FALSE; + } + return TRUE; +} + +int CNetwork::GetNbProviders() +{ + return m_providers.nb; +} + +char* CNetwork::GetProviderName(int index) +{ + if (index >= m_providers.nb) return NULL; + return m_providers.pList[index]->name; +} + +BOOL CNetwork::CreateProvider(int index) +{ + LPDIRECTPLAY lpDP; + BOOL bOK = FALSE; + + if (index >= m_providers.nb) return FALSE; + + if (DirectPlayCreate(&m_providers.pList[index]->guid, &lpDP, 0) == DP_OK) + { + if (lpDP->QueryInterface(IID_IDirectPlay2A, (LPVOID*)&m_pDP) == DP_OK) { - FreeProviderList(); - return FALSE; + return TRUE; } - return TRUE; } - int CNetwork::GetNbProviders() + if (lpDP) lpDP->Release(); + return FALSE; +} + +void CNetwork::FreeProviderList() +{ + if (m_providers.pList) free(m_providers.pList); // wrong + + m_providers.nb = 0; + m_providers.pList = NULL; +} + + +static BOOL EnumSessionsCallback(LPDPSESSIONDESC2 lpThisSD, + LPDWORD lpdwTimeOut, DWORD dwFlags, NamedGUIDList* lpContext) +{ + if (dwFlags & DPESC_TIMEDOUT) return FALSE; + + if (lpContext->nb < MAXSESSION) { - return m_providers.nb; + lpContext->pList[lpContext->nb]->guid = lpThisSD->guidInstance; + strcpy(lpContext->pList[lpContext->nb]->name, lpThisSD->lpszSessionNameA); + lpContext->nb++; } + return TRUE; +} - char* CNetwork::GetProviderName(int index) +BOOL CNetwork::EnumSessions() +{ + DPSESSIONDESC2 desc; + + FreeSessionList(); + m_sessions.nb = 0; + m_sessions.pList = (NamedGUID(*)[MAXSESSION]) malloc(MAXSESSION * sizeof(NamedGUID)); + + if (!m_sessions.pList) return FALSE; + + ZeroMemory(&desc, sizeof(desc)); + + desc.guidApplication = APP_GUID; + desc.dwSize = sizeof(desc); + + if (m_pDP->EnumSessions(&desc, 0, (LPDPENUMSESSIONSCALLBACK2)EnumSessionsCallback, &m_sessions, DPENUMSESSIONS_AVAILABLE) != DP_OK) { - if (index >= m_providers.nb) return NULL; - return m_providers.pList[index]->name; - } - - BOOL CNetwork::CreateProvider(int index) - { - LPDIRECTPLAY lpDP; - BOOL bOK = FALSE; - - if (index >= m_providers.nb) return FALSE; - - if (DirectPlayCreate(&m_providers.pList[index]->guid, &lpDP, 0) == DP_OK) - { - if (lpDP->QueryInterface(IID_IDirectPlay2A, (LPVOID*)&m_pDP) == DP_OK) - { - return TRUE; - } - } - - if (lpDP) lpDP->Release(); + FreeSessionList(); return FALSE; } - void CNetwork::FreeProviderList() - { - if (m_providers.pList) free(m_providers.pList); // wrong + return TRUE; +} - m_providers.nb = 0; - m_providers.pList = NULL; +char* CNetwork::GetSessionName(int index) +{ + if (index >= m_sessions.nb) return NULL; + return m_sessions.pList[index]->name; +} + +BOOL CNetwork::JoinSession(int index, char* pPlayerName) +{ + DPNAME name; + DPSESSIONDESC2 desc; + HRESULT hr; + + if (index > m_sessions.nb) return FALSE; + + ZeroMemory(&desc, sizeof(desc)); + + desc.guidInstance = m_sessions.pList[index]->guid; + + hr = m_pDP->Open(&desc, DPOPEN_OPENSESSION); + if (hr != DP_OK) + { + TraceErrorDP(hr); + return FALSE; } - - static BOOL EnumSessionsCallback(LPDPSESSIONDESC2 lpThisSD, - LPDWORD lpdwTimeOut, DWORD dwFlags, NamedGUIDList* lpContext) + name.dwSize = sizeof(name); + name.dwFlags = 0; + name.lpszShortNameA = pPlayerName; + name.lpszLongNameA = NULL; + hr = m_pDP->CreatePlayer(&m_dpid, &name, NULL, NULL, 0, 0); + if (hr != DP_OK) { - if (dwFlags & DPESC_TIMEDOUT) return FALSE; - - if (lpContext->nb < MAXSESSION) - { - lpContext->pList[lpContext->nb]->guid = lpThisSD->guidInstance; - strcpy(lpContext->pList[lpContext->nb]->name, lpThisSD->lpszSessionNameA); - lpContext->nb++; - } + TraceErrorDP(hr); + m_pDP->Close(); + return FALSE; + } + else + { + m_bHost = FALSE; return TRUE; } +} - BOOL CNetwork::EnumSessions() +void CNetwork::FreeSessionList() +{ + if (m_sessions.pList) free(m_sessions.pList); + + m_sessions.nb = 0; + m_sessions.pList = NULL; +} + +BOOL CNetwork::CreateSession(char* pSessionName, char* pPlayerName) +{ + DPNAME name; + DPSESSIONDESC2 desc; + HRESULT hr; + + ZeroMemory(&desc, sizeof(desc)); + + desc.guidApplication = APP_GUID; + desc.lpszSessionNameA = pSessionName; + desc.dwSize = sizeof(desc); + desc.dwFlags = DPSESSION_KEEPALIVE | DPSESSION_MIGRATEHOST; + desc.dwMaxPlayers = MAXPLAYERS; + + hr = m_pDP->Open(&desc, DPOPEN_CREATE); + if (hr != DP_OK) { - DPSESSIONDESC2 desc; - - FreeSessionList(); - m_sessions.nb = 0; - m_sessions.pList = (NamedGUID(*)[MAXSESSION]) malloc(MAXSESSION * sizeof(NamedGUID)); - - if (!m_sessions.pList) return FALSE; - - ZeroMemory(&desc, sizeof(desc)); - - desc.guidApplication = APP_GUID; - desc.dwSize = sizeof(desc); - - if (m_pDP->EnumSessions(&desc, 0, (LPDPENUMSESSIONSCALLBACK2)EnumSessionsCallback, &m_sessions, DPENUMSESSIONS_AVAILABLE) != DP_OK) - { - FreeSessionList(); - return FALSE; - } - - return TRUE; + TraceErrorDP(hr); + return FALSE; } - - char* CNetwork::GetSessionName(int index) + else { - if (index >= m_sessions.nb) return NULL; - return m_sessions.pList[index]->name; - } - - BOOL CNetwork::JoinSession(int index, char* pPlayerName) - { - DPNAME name; - DPSESSIONDESC2 desc; - HRESULT hr; - - if (index > m_sessions.nb) return FALSE; - - ZeroMemory(&desc, sizeof(desc)); - - desc.guidInstance = m_sessions.pList[index]->guid; - - hr = m_pDP->Open(&desc, DPOPEN_OPENSESSION); - if (hr != DP_OK) - { - TraceErrorDP(hr); - return FALSE; - } - name.dwSize = sizeof(name); name.dwFlags = 0; name.lpszShortNameA = pPlayerName; @@ -178,168 +225,119 @@ extern "C" { } else { - m_bHost = FALSE; + m_bHost = TRUE; return TRUE; } } +} - void CNetwork::FreeSessionList() +BOOL CNetwork::Send(LPVOID lpData, DWORD dwDataSize, DWORD dwFlags) +{ + HRESULT hr; + + if (!m_pDP) return FALSE; + + if (hr = m_pDP->Send(m_dpid, 0, !!dwFlags, lpData, dwDataSize), hr != DP_OK) { - if (m_sessions.pList) free(m_sessions.pList); + TraceErrorDP(hr); + return FALSE; + } + return TRUE; +} - m_sessions.nb = 0; - m_sessions.pList = NULL; +BOOL CNetwork::Receive(LPVOID pDest, DWORD dwDataSize, LPDWORD lpdwPlayer) +{ + DPID from = 0, to = 0; + DWORD dataSize = 500; + char dataBuffer[500]; + HRESULT hr; + + hr = m_pDP->Receive(&from, &to, DPRECEIVE_ALL, dataBuffer, &dataSize); + if (hr != DP_OK) + { + if (hr != DPERR_NOMESSAGES) TraceErrorDP(hr); + return FALSE; } - BOOL CNetwork::CreateSession(char* pSessionName, char* pPlayerName) + ZeroMemory(pDest, dwDataSize); + + *lpdwPlayer = -1; + for (int i = 0; i < MAXPLAYERS; i++) { - DPNAME name; - DPSESSIONDESC2 desc; - HRESULT hr; - - ZeroMemory(&desc, sizeof(desc)); - - desc.guidApplication = APP_GUID; - desc.lpszSessionNameA = pSessionName; - desc.dwSize = sizeof(desc); - desc.dwFlags = DPSESSION_KEEPALIVE | DPSESSION_MIGRATEHOST; - desc.dwMaxPlayers = MAXPLAYERS; - - hr = m_pDP->Open(&desc, DPOPEN_CREATE); - if (hr != DP_OK) + if (m_players[i].bIsPresent && from == i) { - TraceErrorDP(hr); - return FALSE; - } - else - { - name.dwSize = sizeof(name); - name.dwFlags = 0; - name.lpszShortNameA = pPlayerName; - name.lpszLongNameA = NULL; - hr = m_pDP->CreatePlayer(&m_dpid, &name, NULL, NULL, 0, 0); - if (hr != DP_OK) - { - TraceErrorDP(hr); - m_pDP->Close(); - return FALSE; - } - else - { - m_bHost = TRUE; - return TRUE; - } + *lpdwPlayer = i; + break; } } - BOOL CNetwork::Send(LPVOID lpData, DWORD dwDataSize, DWORD dwFlags) + return TRUE; +} + +BOOL CNetwork::Close() +{ + return m_pDP->Close() == DP_OK; +} + +void CNetwork::FreeUnknownList() +{ + if (m_unknown.pList) free(m_unknown.pList); + + m_unknown.nb = 0; + m_unknown.pList = NULL; +} + +BOOL CNetwork::IsHost() +{ + return m_bHost; +} + +void TraceErrorDP(HRESULT hErr) +{ + char dperr[256]; + char err[1024]; + + switch (hErr) { - HRESULT hr; + case DPERR_OUTOFMEMORY: sprintf(dperr, "DPERR_OUTOFMEMORY"); break; + case DPERR_UNSUPPORTED: sprintf(dperr, "DPERR_UNSUPPORTED"); break; + case DPERR_NOINTERFACE: sprintf(dperr, "DPERR_NOINTERFACE"); break; + case DPERR_GENERIC: sprintf(dperr, "DPERR_GENERIC"); break; + case DPERR_INVALIDPARAMS: sprintf(dperr, "DPERR_INVALIDPARAMS"); break; + case DPERR_ACTIVEPLAYERS: sprintf(dperr, "DPERR_ACTIVEPLAYERS"); break; + case DPERR_ACCESSDENIED: sprintf(dperr, "DPERR_ACCESSDENIED"); break; + case DPERR_CANTADDPLAYER: sprintf(dperr, "DPERR_CANTADDPLAYER"); break; + case DPERR_CANTCREATEPLAYER: sprintf(dperr, "DPERR_CANTCREATEPLAYER"); break; + case DPERR_CANTCREATEGROUP: sprintf(dperr, "DPERR_CANTCREATEGROUP"); break; + case DPERR_CANTCREATESESSION: sprintf(dperr, "DPERR_CANTCREATESESSION"); break; + case DPERR_CAPSNOTAVAILABLEYET: sprintf(dperr, "DPERR_CAPTSNOTAVAILABLEYET"); break; + case DPERR_ALREADYINITIALIZED: sprintf(dperr, "DPERR_ALREADYINITIALIZED"); break; + case DPERR_INVALIDFLAGS: sprintf(dperr, "DPERR_INVALIDFLAGS"); break; + case DPERR_EXCEPTION: sprintf(dperr, "DPERR_EXCEPTION"); break; + case DPERR_INVALIDPLAYER: sprintf(dperr, "DPERR_INVALIDPLAYER"); break; + case DPERR_INVALIDOBJECT: sprintf(dperr, "DPERR_INVALIDOBJECT"); break; + case DPERR_NOCONNECTION: sprintf(dperr, "DPERR_NOCONNECTION"); break; + case DPERR_NONAMESERVERFOUND: sprintf(dperr, "DPERR_NONAMESERVERFOUND"); break; + case DPERR_NOMESSAGES: sprintf(dperr, "DPERR_NOMESSAGES"); break; + case DPERR_NOSESSIONS: sprintf(dperr, "DPERR_NOSESSIONS"); break; + case DPERR_NOPLAYERS: sprintf(dperr, "DPERR_NOPLAYERS"); break; + case DPERR_TIMEOUT: sprintf(dperr, "DPERR_TIMEOUT"); break; + case DPERR_SENDTOOBIG: sprintf(dperr, "DPERR_SENDTOOBIG"); break; + case DPERR_BUSY: sprintf(dperr, "DPERR_BUSY"); break; + case DPERR_UNAVAILABLE: sprintf(dperr, "DPERR_UNAVAILABLE"); break; + case DPERR_PLAYERLOST: sprintf(dperr, "DPERR_PLAYERLOST"); break; + case DPERR_USERCANCEL: sprintf(dperr, "DPERR_USERCANCEL"); break; + case DPERR_BUFFERTOOLARGE: sprintf(dperr, "DPERR_BUFFERTOOLARGE"); break; + case DPERR_SESSIONLOST: sprintf(dperr, "DPERR_SESSIONLOST"); break; + case DPERR_APPNOTSTARTED: sprintf(dperr, "DPERR_APPNOTSTARTED"); break; + case DPERR_CANTCREATEPROCESS: sprintf(dperr, "DPERR_CANTCREATEPROCESS"); break; + case DPERR_UNKNOWNAPPLICATION: sprintf(dperr, "DPERR_UNKNOWNAPPLICATION"); break; + case DPERR_INVALIDINTERFACE: sprintf(dperr, "DPERR_INVALIDINTERFACE"); break; + case DPERR_NOTLOBBIED: sprintf(dperr, "DPERR_NOTLOBBIED"); break; + case DP_OK: sprintf(dperr, "DP_OK"); break; - if (!m_pDP) return FALSE; - - if (hr = m_pDP->Send(m_dpid, 0, !!dwFlags, lpData, dwDataSize), hr != DP_OK) - { - TraceErrorDP(hr); - return FALSE; - } - return TRUE; - } - - BOOL CNetwork::Receive(LPVOID pDest, DWORD dwDataSize, LPDWORD lpdwPlayer) - { - DPID from = 0, to = 0; - DWORD dataSize = 500; - char dataBuffer[500]; - HRESULT hr; - - hr = m_pDP->Receive(&from, &to, DPRECEIVE_ALL, dataBuffer, &dataSize); - if (hr != DP_OK) - { - if (hr != DPERR_NOMESSAGES) TraceErrorDP(hr); - return FALSE; - } - - ZeroMemory(pDest, dwDataSize); - - *lpdwPlayer = -1; - for (int i = 0; i < MAXPLAYERS; i++) - { - if (m_players[i].bIsPresent && from == i) - { - *lpdwPlayer = i; - break; - } - } - - return TRUE; - } - - BOOL CNetwork::Close() - { - return m_pDP->Close() == DP_OK; - } - - void CNetwork::FreeUnknownList() - { - if (m_unknown.pList) free(m_unknown.pList); - - m_unknown.nb = 0; - m_unknown.pList = NULL; - } - - BOOL CNetwork::IsHost() - { - return m_bHost; - } - - void TraceErrorDP(HRESULT hErr) - { - char dperr[256]; - char err[1024]; - - switch (hErr) - { - case DPERR_OUTOFMEMORY: sprintf(dperr, "DPERR_OUTOFMEMORY"); break; - case DPERR_UNSUPPORTED: sprintf(dperr, "DPERR_UNSUPPORTED"); break; - case DPERR_NOINTERFACE: sprintf(dperr, "DPERR_NOINTERFACE"); break; - case DPERR_GENERIC: sprintf(dperr, "DPERR_GENERIC"); break; - case DPERR_INVALIDPARAMS: sprintf(dperr, "DPERR_INVALIDPARAMS"); break; - case DPERR_ACTIVEPLAYERS: sprintf(dperr, "DPERR_ACTIVEPLAYERS"); break; - case DPERR_ACCESSDENIED: sprintf(dperr, "DPERR_ACCESSDENIED"); break; - case DPERR_CANTADDPLAYER: sprintf(dperr, "DPERR_CANTADDPLAYER"); break; - case DPERR_CANTCREATEPLAYER: sprintf(dperr, "DPERR_CANTCREATEPLAYER"); break; - case DPERR_CANTCREATEGROUP: sprintf(dperr, "DPERR_CANTCREATEGROUP"); break; - case DPERR_CANTCREATESESSION: sprintf(dperr, "DPERR_CANTCREATESESSION"); break; - case DPERR_CAPSNOTAVAILABLEYET: sprintf(dperr, "DPERR_CAPTSNOTAVAILABLEYET"); break; - case DPERR_ALREADYINITIALIZED: sprintf(dperr, "DPERR_ALREADYINITIALIZED"); break; - case DPERR_INVALIDFLAGS: sprintf(dperr, "DPERR_INVALIDFLAGS"); break; - case DPERR_EXCEPTION: sprintf(dperr, "DPERR_EXCEPTION"); break; - case DPERR_INVALIDPLAYER: sprintf(dperr, "DPERR_INVALIDPLAYER"); break; - case DPERR_INVALIDOBJECT: sprintf(dperr, "DPERR_INVALIDOBJECT"); break; - case DPERR_NOCONNECTION: sprintf(dperr, "DPERR_NOCONNECTION"); break; - case DPERR_NONAMESERVERFOUND: sprintf(dperr, "DPERR_NONAMESERVERFOUND"); break; - case DPERR_NOMESSAGES: sprintf(dperr, "DPERR_NOMESSAGES"); break; - case DPERR_NOSESSIONS: sprintf(dperr, "DPERR_NOSESSIONS"); break; - case DPERR_NOPLAYERS: sprintf(dperr, "DPERR_NOPLAYERS"); break; - case DPERR_TIMEOUT: sprintf(dperr, "DPERR_TIMEOUT"); break; - case DPERR_SENDTOOBIG: sprintf(dperr, "DPERR_SENDTOOBIG"); break; - case DPERR_BUSY: sprintf(dperr, "DPERR_BUSY"); break; - case DPERR_UNAVAILABLE: sprintf(dperr, "DPERR_UNAVAILABLE"); break; - case DPERR_PLAYERLOST: sprintf(dperr, "DPERR_PLAYERLOST"); break; - case DPERR_USERCANCEL: sprintf(dperr, "DPERR_USERCANCEL"); break; - case DPERR_BUFFERTOOLARGE: sprintf(dperr, "DPERR_BUFFERTOOLARGE"); break; - case DPERR_SESSIONLOST: sprintf(dperr, "DPERR_SESSIONLOST"); break; - case DPERR_APPNOTSTARTED: sprintf(dperr, "DPERR_APPNOTSTARTED"); break; - case DPERR_CANTCREATEPROCESS: sprintf(dperr, "DPERR_CANTCREATEPROCESS"); break; - case DPERR_UNKNOWNAPPLICATION: sprintf(dperr, "DPERR_UNKNOWNAPPLICATION"); break; - case DPERR_INVALIDINTERFACE: sprintf(dperr, "DPERR_INVALIDINTERFACE"); break; - case DPERR_NOTLOBBIED: sprintf(dperr, "DPERR_NOTLOBBIED"); break; - case DP_OK: sprintf(dperr, "DP_OK"); break; - - default: sprintf(dperr, "Unknown Error"); break; - } - sprintf(err, "DirectPlay Error %s\n", dperr); - OutputDebug(err); + default: sprintf(dperr, "Unknown Error"); break; } + sprintf(err, "DirectPlay Error %s\n", dperr); + OutputDebug(err); } \ No newline at end of file diff --git a/src/network.h b/src/network.h index 7243894..7d62056 100644 --- a/src/network.h +++ b/src/network.h @@ -9,74 +9,71 @@ #define MAXSESSION 100 #define MAXPLAYERS 4 -extern "C" { +typedef struct +{ + char bIsPresent; + char ready; + char unk_2; + char unk_3; + DPID dpid; + short team; + char name[22]; +} +NetPlayer; - typedef struct - { - char bIsPresent; - char ready; - char unk_2; - char unk_3; - DPID dpid; - short team; - char name[22]; - } - NetPlayer; +typedef struct +{ + GUID guid; + char name[100]; +} +NamedGUID; - typedef struct - { - GUID guid; - char name[100]; - } - NamedGUID; +typedef struct +{ + int nb; + NamedGUID (*pList)[MAXSESSION]; +} +NamedGUIDList; - typedef struct - { - int nb; - NamedGUID(*pList)[MAXSESSION]; - } - NamedGUIDList; +class CNetwork +{ +public: + CNetwork(); + ~CNetwork(); - class CNetwork - { - public: - CNetwork(); - ~CNetwork(); + BOOL EnumProviders(); + BOOL GetNbProviders(); + char* GetProviderName(int index); + BOOL CreateProvider(int index); + void FreeProviderList(); + BOOL EnumSessions(); + char* GetSessionName(int index); + BOOL JoinSession(int index, char* pPlayerName); + void FreeSessionList(); + BOOL CreateSession(char* pSessionName, char* pPlayerName); + BOOL Send(LPVOID lpData, DWORD dwDataSize, DWORD dwFlags); + BOOL Receive(LPVOID pDest, DWORD dwDataSize, LPDWORD lpdwPlayer); + BOOL Close(); + void FreeUnknownList(); + BOOL IsHost(); - BOOL EnumProviders(); - BOOL GetNbProviders(); - char* GetProviderName(int index); - BOOL CreateProvider(int index); - void FreeProviderList(); - BOOL EnumSessions(); - char* GetSessionName(int index); - BOOL JoinSession(int index, char* pPlayerName); - void FreeSessionList(); - BOOL CreateSession(char* pSessionName, char* pPlayerName); - BOOL Send(LPVOID lpData, DWORD dwDataSize, DWORD dwFlags); - BOOL Receive(LPVOID pDest, DWORD dwDataSize, LPDWORD lpdwPlayer); - BOOL Close(); - void FreeUnknownList(); - BOOL IsHost(); + NetPlayer m_players[4]; + DPID m_dpid; - NetPlayer m_players[4]; - DPID m_dpid; +protected: + LPDIRECTPLAY2 m_pDP; + NamedGUIDList m_providers; + NamedGUIDList m_sessions; + NamedGUIDList m_unknown; + BOOL m_bHost; + +// NetPlayer m_players[4]; +}; - protected: - LPDIRECTPLAY2 m_pDP; - NamedGUIDList m_providers; - NamedGUIDList m_sessions; - NamedGUIDList m_unknown; - BOOL m_bHost; +static BOOL EnumProvidersCallback(LPGUID lpguidSP, LPSTR lpSTName, + DWORD dwMajorVersion, DWORD dwMinorVersion, NamedGUIDList* lpContext); - // NetPlayer m_players[4]; - }; +static BOOL EnumSessionsCallback(LPDPSESSIONDESC2 lpThisSD, + LPDWORD lpdwTimeOut, DWORD dwFlags, NamedGUIDList* lpContext); - static BOOL EnumProvidersCallback(LPGUID lpguidSP, LPSTR lpSTName, - DWORD dwMajorVersion, DWORD dwMinorVersion, NamedGUIDList* lpContext); - - static BOOL EnumSessionsCallback(LPDPSESSIONDESC2 lpThisSD, - LPDWORD lpdwTimeOut, DWORD dwFlags, NamedGUIDList* lpContext); - - void TraceErrorDP(HRESULT hErr); -} \ No newline at end of file +void TraceErrorDP(HRESULT hErr); \ No newline at end of file