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

can you believe it? gaming

This commit is contained in:
jummy 2024-10-06 01:07:18 -05:00
parent ce33104782
commit ae16984db4
18 changed files with 739 additions and 593 deletions

View File

@ -123,36 +123,36 @@ int CDecor::IsWorld(POINT pos)
{ {
pos.x += 30; pos.x += 30;
pos.y += 30; pos.y += 30;
if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400) if (pos.x < 0 || pos.x >= DIMOBJX * MAXCELX || pos.y < 0 || pos.y >= DIMOBJY * MAXCELY)
{ {
return -1; return -1;
} }
int icon = m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon; int icon = m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon;
if (icon >= 158 && icon <= 165) if (icon >= Object::World_1 && icon <= Object::World_8)
{ {
return icon - 158 + 1; return icon - Object::World_1 + 1;
} }
if (icon >= 166 && icon <= 173) if (icon >= Object::WorldDone_1 && icon <= Object::WorldDone_8)
{ {
return icon - 166 + 1; return icon - Object::WorldDone_1 + 1;
} }
if (icon == 309 || icon == 310) if (icon == Object::World_9 || icon == Object::WorldDone_9)
{ {
return 9; return 9;
} }
if (icon >= 411 && icon <= 415) if (icon >= Object::World_10 && icon <= Object::World_14)
{ {
return icon - 411 + 10; return icon - Object::World_10 + 10;
} }
if (icon >= 416 && icon <= 420) if (icon >= Object::WorldDone_10 && icon <= Object::WorldDone_14)
{ {
return icon - 416 + 10; return icon - Object::WorldDone_10 + 10;
} }
if (icon >= 174 && icon <= 181) if (icon >= Object::Level_1 && icon <= Object::Level_8)
{ {
return icon - 174 + 1; return icon - Object::Level_1 + 1;
} }
if (icon == 184) if (icon == Object::WorldBack)
{ {
return 199; return 199;
} }

View File

@ -3,7 +3,7 @@
#include "misc.h" #include "misc.h"
#include "decor.h" #include "decor.h"
#include "misc.h" #include "text.h" // debug
//#include "resource.h" //#include "resource.h"
#include "dectables.h" #include "dectables.h"
@ -36,107 +36,170 @@ void CDecor::GetBlupiInfo(BOOL* bHelico, BOOL* bJeep, BOOL* bSkate, BOOL* bNage)
*bNage = m_blupiNage | m_blupiSurf; *bNage = m_blupiNage | m_blupiSurf;
} }
// set blupi's current graphics icon according to his state
// from ghidra
void CDecor::BlupiSearchIcon() void CDecor::BlupiSearchIcon()
{ {
int num = 0; int phase;
int num2 = 2; int action = m_blupiAction;
int num3 = m_blupiAction; int icon = 2;
if (m_blupiVent && m_blupiHelico && m_blupiOver)
if (m_blupiVent && !m_blupiHelico && !m_blupiOver)
{ {
if (num3 == 1) if (action == 0x1) action = 0x8;
{ if (action == 0x2) action = 0xe;
num3 = 8;
}
if (num3 == 2)
{
num3 = 14;
}
} }
if (m_blupiHelico) if (m_blupiHelico)
{ {
if (num3 == 1) if (action == 0x1) action = 0xf;
{ if (action == 0x2) action = 0x10;
num3 = 15; if (action == 0x3) action = 0x11;
} if (action == 0xa) action = 0xf;
if (num3 == 2) if (action == 0x9) action = 0xf;
{
num3 = 16;
}
if (num3 == 3)
{
num3 = 17;
}
if (num3 == 10)
{
num3 = 15;
}
if (num3 == 9)
{
num3 = 15;
}
} }
if (m_blupiOver) if (m_blupiOver)
{ {
if (num3 == 1) if (action == 0x1) action = 0x43;
{ if (action == 0x2) action = 0x44;
num3 = 67; if (action == 0x3) action = 0x45;
} if (action == 0xa) action = 0x43;
if (num3 == 2) if (action == 0x9) action = 0x43;
{
num3 = 68;
}
if (num3 == 3)
{
num3 = 69;
}
if (num3 == 10)
{
num3 = 67;
}
if (num3 == 9)
{
num3 = 67;
}
} }
if (m_blupiJeep) if (m_blupiJeep)
{ {
if (num3 == 1) if (action == 0x1) action = 0x19;
{ if (action == 0x2) action = 0x1a;
num3 = 25; if (action == 0xa) action = 0x1a;
} if (action == 0x3) action = 0x1b;
if (num3 == 2)
{
num3 = 26;
}
if (num3 == 10)
{
num3 = 26;
}
if (num3 == 3)
{
num3 = 27;
}
} }
if (m_blupiTank) if (m_blupiTank)
{ {
if (num3 == 1) if (action == 0x1) action = 0x32;
if (action == 0x2) action = 0x33;
if (action == 0xa) action = 0x33;
if (action == 0x3) action = 0x34;
}
if (m_blupiSkate)
{
if (action == 0x1) action = 0x25;
if (action == 0x2) action = 0x26;
if (action == 0xa) action = 0x26;
if (action == 0x3) action = 0x27;
if (action == 0x3b) action = 0x27;
if (action == 0x4) action = 0x28;
if (action == 0x5) action = 0x29;
}
if (m_blupiNage)
{
if (action == 0x1) action = 0x12;
if (action == 0x2) action = 0x13;
if (action == 0x3) action = 0x14;
if ((m_blupiVitesse).x == 0)
{ {
num3 = 50; if (action == 0x12) action = 0x15;
} if (action == 0x13) action = 0x16;
if (num3 == 2)
{
num3 = 51;
}
if (num3 == 10)
{
num3 = 51;
}
if (num3 == 3)
{
num3 = 52;
} }
} }
// more...?
if (m_blupiSurf)
{
if (action == 0x1) action = 0x15;
if (action == 0x2) action = 0x16;
if (action == 0x3) action = 0x17;
}
if (m_blupiSuspend)
{
if (action == 0x1) action = 0x1f;
if (action == 0x2) action = 0x20;
if (action == 0x3) action = 0x21;
if (action == 0x4) action = 0x22;
}
if (m_blupiBalloon) action = 0x42;
if (m_blupiEcrase)
{
if (action == 0x1) action = 0x48;
if (action == 0x2) action = 0x49;
if (action == 0x3) action = 0x49;
}
if ((action == 0x1) &&
((((((phase = m_blupiPhase % 330, phase == 0x7d || (phase == 0x81)) || (phase == 0x87)) || (((phase == 0x8b || (phase == 0xd7)) || ((phase == 0xdb || ((phase == 0xe1 || (phase == 0xe5)))))))) ||
((phase == 0xeb || (((phase == 0xef || (phase == 0xf5)) || (phase == 0xf9)))))) || (((phase == 0xff || (phase == 0x103)) || ((phase == 0x109 || (phase == 0x10d))))))))
{
PlaySound(SOUND_PATIENT, m_blupiPos, FALSE);
}
if ((action == 0x1f) && (((phase = m_blupiPhase % 328, phase == 0x76 || (phase == 0xe6)) || (phase == 0x116))))
{
PlaySound(SOUND_SINGE, m_blupiPos, FALSE);
}
if ((((action == 0x15) || (action == 0x16)) && (m_blupiPhase % 0xc == 0)) && (m_blupiSurf))
{
MoveObjectTiplouf(m_blupiPos);
}
for (int i = 0; table_blupi[i] != 0; i += table_blupi[i + 1] + 3)
{
if (action == table_blupi[i])
{
if ((table_blupi[i + 2] == 0 || m_blupiPhase <= table_blupi[i + 2]) && table_blupi[i + 1] != 0)
{
icon = table_blupi[i + 3 + m_blupiPhase % table_blupi[i + 1]];
}
else
{
icon = table_blupi[i + 3 + table_blupi[i + 2]];
}
break;
}
}
if ((action == 0xb || action == 0x4b || action == 0x4c || action == 0x36 || action == 0x39) && icon < 0x10a)
{
m_blupiChannel = 10;
}
else
{
m_blupiChannel = 2;
}
if (m_blupiDir == DIR_LEFT || (m_blupiDir == DIR_RIGHT && m_blupiInvert))
{
if (m_blupiChannel == 2)
{
if (action == 0x1f)
{
if (icon == 0x90)
{
icon = 0x9e;
}
if (icon == 0x8f)
{
icon = 0x91;
}
if (icon == 0x97)
{
icon = 0x92;
}
}
if ((-1 < icon) && (icon < 0x14f))
{
icon = table_mirror[icon];
}
}
if (true && m_blupiChannel == 10 && 0xa7 < icon && icon < 0xac)
{
icon = (icon + 4);
}
}
m_blupiIcon = icon;
m_blupiPhase = m_blupiPhase + 1;
} }
BOOL CDecor::BlupiIsGround() BOOL CDecor::BlupiIsGround()
@ -310,76 +373,22 @@ BOOL CDecor::BlupiBloque(POINT pos, int dir)
return DecorDetect(rect); return DecorDetect(rect);
} }
// rewritten. wip
/*
void CDecor::BlupiStep()
{
RECT blupiRect, rect;
BOOL flag;
POINT point;
int num;
BlupiAdjust();
POINT adjustPos = m_blupiPos + m_blupiVector;
if (m_blupiVector.x != 0 || m_blupiVector.y != 0)
{
blupiRect = BlupiRect(m_blupiPos);
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[(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;
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. // handle Blupi's movement and current state.
// currently derived from winphone code
/**/
void CDecor::BlupiStep() void CDecor::BlupiStep()
{ {
BOOL bNear; BOOL bNear;
BOOL bStopJumpH = FALSE;
int icon; int icon;
POINT tinyPoint; POINT tinyPoint;
POINT tinyPoint2 = m_blupiPos; // = m_blupiPos ? POINT tinyPoint2 = m_blupiPos; // = m_blupiPos ?
BlupiAdjust(); BlupiAdjust();
//m_blupiLastPos = m_blupiPos; //m_blupiLastPos = m_blupiPos;
POINT end = m_blupiPos; POINT end = m_blupiPos;
BOOL flag = m_blupiAir;
int lastBlupiAction = m_blupiAction; int lastBlupiAction = m_blupiAction;
BOOL flag2 = FALSE; BOOL bLastBlupiAir = m_blupiAir;
BOOL flag3 = FALSE; BOOL bAirStart = FALSE;
BOOL bIsOpen = FALSE;
BOOL bIsOpen2 = FALSE;
int num;
end.x += m_blupiVector.x; end.x += m_blupiVector.x;
end.y += m_blupiVector.y; end.y += m_blupiVector.y;
RECT rect; RECT rect;
@ -391,7 +400,6 @@ void CDecor::BlupiStep()
TestPath(rect, m_blupiPos, &end); TestPath(rect, m_blupiPos, &end);
} }
m_blupiVent = FALSE; m_blupiVent = FALSE;
int num;
if (m_blupiTransport == -1 && !m_blupiJeep && !m_blupiTank && !m_blupiSkate if (m_blupiTransport == -1 && !m_blupiJeep && !m_blupiTank && !m_blupiSkate
&& m_blupiFocus) && m_blupiFocus)
{ {
@ -428,11 +436,11 @@ void CDecor::BlupiStep()
rect = BlupiRect(end); rect = BlupiRect(end);
rect.top = end.y + DIMBLUPIY - 2; rect.top = end.y + DIMBLUPIY - 2;
rect.bottom = end.y + DIMBLUPIY - 1; rect.bottom = end.y + DIMBLUPIY - 1;
flag = !DecorDetect(rect); bAirStart = !DecorDetect(rect);
} }
else else
{ {
flag = FALSE; bAirStart = FALSE;
} }
rect = BlupiRect(end); rect = BlupiRect(end);
rect.top = end.y + 10; rect.top = end.y + 10;
@ -446,7 +454,7 @@ void CDecor::BlupiStep()
!m_blupiSurf && !m_blupiSurf &&
!m_blupiSuspend && !m_blupiSuspend &&
m_blupiFocus && m_blupiFocus &&
DecorDetect(rect)) bAirStart)
{ {
if (m_blupiFocus) if (m_blupiFocus)
{ {
@ -455,7 +463,7 @@ void CDecor::BlupiStep()
} }
m_blupiVitesse.y = 1; m_blupiVitesse.y = 1;
m_blupiAir = TRUE; m_blupiAir = TRUE;
flag = TRUE; bLastBlupiAir = TRUE;
} }
if (!m_blupiNage && if (!m_blupiNage &&
!m_blupiSurf && !m_blupiSurf &&
@ -495,10 +503,10 @@ void CDecor::BlupiStep()
m_blupiVitesse.y = (m_blupiPower ? -16 : -10); m_blupiVitesse.y = (m_blupiPower ? -16 : -10);
} }
m_blupiAir = TRUE; m_blupiAir = TRUE;
flag = TRUE; bLastBlupiAir = TRUE;
PlaySound(SOUND_RESSORT, end); PlaySound(SOUND_RESSORT, end);
} }
if (m_keyPress & KEY_LEFT && if (m_keyPress & KEY_JUMP &&
!IsBlupiMotorVehicle() && !IsBlupiMotorVehicle() &&
!m_blupiBalloon && !m_blupiBalloon &&
!m_blupiEcrase && !m_blupiEcrase &&
@ -521,23 +529,28 @@ void CDecor::BlupiStep()
if (m_blupiSkate) if (m_blupiSkate)
{ {
PlaySound(SOUND_JUMP1, end); PlaySound(SOUND_JUMP1, end);
m_blupiVitesse.y = (m_blupiPower ? -17 : -13); m_blupiVitesse.y = (m_blupiPower ? -22 : -16);
} }
else else
{ {
if (m_keyPress & KEY_UP) if (m_keyPress & KEY_UP)
{ {
PlaySound(SOUND_JUMP2, end); PlaySound(SOUND_JUMP2, end);
m_blupiVitesse.y = (m_blupiPower ? -26 : -16); m_blupiVitesse.y = (m_blupiPower ? -26 : -22);
}
else if (m_keyPress & KEY_DOWN)
{
PlaySound(SOUND_JUMP0, end);
m_blupiVitesse.y = (m_blupiPower ? -16 : -12);
} }
else else
{ {
PlaySound(SOUND_JUMP1, end); PlaySound(SOUND_JUMP1, end);
m_blupiVitesse.y = (m_blupiPower ? -16 : -12); m_blupiVitesse.y = (m_blupiPower ? -22 : -16);
} }
} }
m_blupiAir = TRUE; m_blupiAir = TRUE;
flag = TRUE; bLastBlupiAir = TRUE;
} }
} }
if (m_blupiAir) if (m_blupiAir)
@ -598,7 +611,7 @@ void CDecor::BlupiStep()
if (m_blupiVitesse.y >= 0 && icon != -1) if (m_blupiVitesse.y >= 0 && icon != -1)
{ {
m_blupiTransport = icon; m_blupiTransport = icon;
flag = FALSE; bAirStart = FALSE;
PlaySound(SOUND_JUMPEND, end); PlaySound(SOUND_JUMPEND, end);
end.y = m_moveObject[num].posCurrent.y - DIMOBJY + BLUPIOFFY; end.y = m_moveObject[num].posCurrent.y - DIMOBJY + BLUPIOFFY;
if (m_blupiFocus) if (m_blupiFocus)
@ -739,7 +752,7 @@ void CDecor::BlupiStep()
m_blupiPhase = 0; m_blupiPhase = 0;
m_blupiVitesse.y = -12; m_blupiVitesse.y = -12;
m_blupiAir = TRUE; m_blupiAir = TRUE;
bStopJumpH = TRUE; bLastBlupiAir = TRUE;
} }
case ACTION_SUCETTE: case ACTION_SUCETTE:
if (m_blupiPhase == 32) if (m_blupiPhase == 32)
@ -794,7 +807,8 @@ void CDecor::BlupiStep()
m_blupiPhase = 0; m_blupiPhase = 0;
} }
if ( !(m_keyPress & KEY_JUMP) && if (m_keyPress & KEY_DOWN &&
!(m_keyPress & KEY_JUMP) &&
IsBlupiStanding() && IsBlupiStanding() &&
m_blupiAction != ACTION_DOWN && m_blupiAction != ACTION_DOWN &&
m_blupiAction != ACTION_STOPPOP && m_blupiAction != ACTION_STOPPOP &&
@ -884,7 +898,26 @@ void CDecor::BlupiStep()
m_blupiAction != ACTION_POP && m_blupiAction != ACTION_POP &&
m_blupiFocus) m_blupiFocus)
{ {
StopBlupi(); if (m_keyPress & KEY_LEFT && !(m_lastKeyPress & (KEY_LEFT | KEY_RIGHT)) && !m_blupiAir && m_keyPress & (KEY_UP | KEY_DOWN))
{
m_blupiAction = 1;
m_blupiPhase = 0;
}
if (!(m_keyPress & (KEY_LEFT | KEY_RIGHT)) && m_lastKeyPress & KEY_LEFT && m_keyPress & (KEY_UP | KEY_DOWN))
{
m_blupiAction = 1;
m_blupiPhase = 0;
}
if (m_keyPress & KEY_RIGHT && !(m_lastKeyPress & (KEY_LEFT | KEY_RIGHT)) && !m_blupiAir && m_keyPress & (KEY_UP | KEY_DOWN))
{
m_blupiAction = 1;
m_blupiPhase = 0;
}
if (!(m_keyPress & (KEY_LEFT | KEY_RIGHT)) && m_lastKeyPress & KEY_RIGHT && m_keyPress & (KEY_UP | KEY_DOWN))
{
m_blupiAction = 1;
m_blupiPhase = 0;
}
} }
int num3; int num3;
int num4; int num4;
@ -944,9 +977,9 @@ void CDecor::BlupiStep()
else else
{ {
num3 = m_blupiPhase; num3 = m_blupiPhase;
if (m_blupiPhase > 3 || m_blupiAir) if (num3 > 3 || m_blupiAir)
{ {
m_blupiPhase = 3; num3 = 3;
} }
num4 = table_vitesse_march[num3]; num4 = table_vitesse_march[num3];
if (m_blupiPower) if (m_blupiPower)
@ -954,7 +987,7 @@ void CDecor::BlupiStep()
num4 *= 3; num4 *= 3;
num4 /= 2; num4 /= 2;
} }
end.x += num4; end.x -= num4;
} }
} }
if (m_blupiDir == DIR_RIGHT && m_blupiAction == ACTION_POP) if (m_blupiDir == DIR_RIGHT && m_blupiAction == ACTION_POP)
@ -1213,7 +1246,7 @@ void CDecor::BlupiStep()
m_blupiTimeFire == 0 && m_blupiTimeFire == 0 &&
m_blupiAction != ACTION_TURN && m_blupiAction != ACTION_TURN &&
m_blupiAction != ACTION_HELICOGLU && m_blupiAction != ACTION_HELICOGLU &&
flag) bAirStart)
{ {
if (m_blupiBullet == 0) if (m_blupiBullet == 0)
{ {
@ -1226,10 +1259,10 @@ void CDecor::BlupiStep()
m_blupiFocus = FALSE; m_blupiFocus = FALSE;
} }
} }
////m_blupiMotorHigh = flag4; ////m_blupiMotorHigh = bCanUseLift;
if (m_blupiAction != ACTION_TURN && m_blupiAction != ACTION_HELICOGLU) if (m_blupiAction != ACTION_TURN && m_blupiAction != ACTION_HELICOGLU)
{ {
if (bStopJumpH) if (bAirStart)
{ {
m_blupiAction = ACTION_MARCH; m_blupiAction = ACTION_MARCH;
} }
@ -1294,20 +1327,20 @@ void CDecor::BlupiStep()
MoveObjectPollution(); MoveObjectPollution();
if ( !flag2 && m_blupiTransport == -1) if ( m_keyPress & KEY_DOWN && !bAirStart && m_blupiTransport == -1)
{ {
rect.left = m_blupiPos.x + 20; rect.left = m_blupiPos.x + 20;
rect.right = m_blupiPos.x + 22; rect.right = m_blupiPos.x + 22;
rect.top = m_blupiPos.y + 60 - 2; rect.top = m_blupiPos.y + 60 - 2;
rect.bottom = m_blupiPos.y + 60; rect.bottom = m_blupiPos.y + 60;
flag2 = !DecorDetect(rect); bIsOpen = !DecorDetect(rect);
rect.left = m_blupiPos.x + 60 - 22; rect.left = m_blupiPos.x + 60 - 22;
rect.right = m_blupiPos.x + 60 - 20; rect.right = m_blupiPos.x + 60 - 20;
rect.top = m_blupiPos.y + 60 - 2; rect.top = m_blupiPos.y + 60 - 2;
rect.bottom = m_blupiPos.y + 60; rect.bottom = m_blupiPos.y + 60;
flag3 = !DecorDetect(rect); bIsOpen2 = !DecorDetect(rect);
if (!flag2 && !flag3) if (!bIsOpen && !bIsOpen2)
{ {
tinyPoint.x = m_blupiPos.x; tinyPoint.x = m_blupiPos.x;
tinyPoint.y = m_blupiPos.y - BLUPIFLOOR; tinyPoint.y = m_blupiPos.y - BLUPIFLOOR;
@ -1323,10 +1356,10 @@ void CDecor::BlupiStep()
} }
if (m_blupiOver && (m_blupiFocus || m_blupiAction == 58)) if (m_blupiOver && (m_blupiFocus || m_blupiAction == 58))
{ {
////m_blupiMotorHigh = flag4; ////m_blupiMotorHigh = bCanUseLift;
if (m_blupiAction != ACTION_TURN) if (m_blupiAction != ACTION_TURN)
{ {
if (flag) if (bAirStart)
{ {
m_blupiAction = ACTION_MARCH; m_blupiAction = ACTION_MARCH;
} }
@ -1342,13 +1375,13 @@ void CDecor::BlupiStep()
rect = BlupiRect(end); rect = BlupiRect(end);
rect.top = end.y + 60 - 2; rect.top = end.y + 60 - 2;
rect.bottom = end.y + 60 + OVERHEIGHT - 1; rect.bottom = end.y + 60 + OVERHEIGHT - 1;
bool flag7 = !DecorDetect(rect); bIsOpen = !DecorDetect(rect);
num = MoveAscenseurDetect(m_blupiPos, OVERHEIGHT); num = MoveAscenseurDetect(m_blupiPos, OVERHEIGHT);
if (num != -1) if (num != -1)
{ {
flag7 = FALSE; bIsOpen = FALSE;
} }
if (m_keyPress & KEY_JUMP && !flag7) if (m_keyPress & (KEY_JUMP | KEY_UP) && !bIsOpen)
{ {
if (m_blupiVitesse.y == 0 && num != -1) if (m_blupiVitesse.y == 0 && num != -1)
{ {
@ -1370,8 +1403,8 @@ void CDecor::BlupiStep()
{ {
m_blupiVitesse.y += 1; m_blupiVitesse.y += 1;
} }
end.y += (int)m_blupiVitesse.y; end.y += m_blupiVitesse.y;
if (m_keyPress & KEY_LEFT && flag) if (m_keyPress & KEY_LEFT && bAirStart)
{ {
if (m_blupiVitesse.x > -12) if (m_blupiVitesse.x > -12)
{ {
@ -1384,7 +1417,7 @@ void CDecor::BlupiStep()
m_blupiVitesse.x = 0; m_blupiVitesse.x = 0;
} }
} }
else if (m_keyPress & KEY_RIGHT && flag) else if (m_keyPress & KEY_RIGHT && bAirStart)
{ {
if (m_blupiVitesse.x < 12) if (m_blupiVitesse.x < 12)
{ {
@ -1412,20 +1445,20 @@ void CDecor::BlupiStep()
MoveObjectPollution(); MoveObjectPollution();
if ( !flag && m_blupiTransport == -1) if ( !bAirStart && m_blupiTransport == -1)
{ {
rect.left = m_blupiPos.x + 20; rect.left = m_blupiPos.x + 20;
rect.right = m_blupiPos.x + 22; rect.right = m_blupiPos.x + 22;
rect.top = m_blupiPos.y + 60 - 2; rect.top = m_blupiPos.y + 60 - 2;
rect.bottom = m_blupiPos.y + 60; rect.bottom = m_blupiPos.y + 60;
flag2 = !DecorDetect(rect); bIsOpen = !DecorDetect(rect);
rect.left = m_blupiPos.x + 60 - 22; rect.left = m_blupiPos.x + 60 - 22;
rect.right = m_blupiPos.x + 60 - 20; rect.right = m_blupiPos.x + 60 - 20;
rect.top = m_blupiPos.y + 60 - 2; rect.top = m_blupiPos.y + 60 - 2;
rect.bottom = m_blupiPos.y + 60; rect.bottom = m_blupiPos.y + 60;
flag3 = !DecorDetect(rect); bIsOpen2 = !DecorDetect(rect);
if (!flag2 && !flag3) if (!bIsOpen && !bIsOpen2)
{ {
tinyPoint.x = m_blupiPos.x; tinyPoint.x = m_blupiPos.x;
tinyPoint.y = m_blupiPos.y - BLUPIFLOOR; tinyPoint.y = m_blupiPos.y - BLUPIFLOOR;
@ -1441,7 +1474,7 @@ void CDecor::BlupiStep()
} }
if (m_blupiBalloon && m_blupiFocus) if (m_blupiBalloon && m_blupiFocus)
{ {
if (m_keyPress & KEY_JUMP) if (m_keyPress & (KEY_JUMP | KEY_UP))
{ {
if (m_blupiVitesse.y > -5 && m_time % 6 == 0) if (m_blupiVitesse.y > -5 && m_time % 6 == 0)
{ {
@ -1509,7 +1542,7 @@ void CDecor::BlupiStep()
} }
if (m_blupiEcrase && m_blupiFocus) if (m_blupiEcrase && m_blupiFocus)
{ {
if (flag) if (bAirStart)
{ {
if (m_blupiVitesse.y < 2) if (m_blupiVitesse.y < 2)
{ {
@ -1521,7 +1554,7 @@ void CDecor::BlupiStep()
m_blupiVitesse.y = 0; m_blupiVitesse.y = 0;
} }
end.y += (int)m_blupiVitesse.y; end.y += (int)m_blupiVitesse.y;
if (flag) if (bAirStart)
{ {
num3 = 7; num3 = 7;
} }
@ -1575,7 +1608,7 @@ void CDecor::BlupiStep()
} }
} }
} }
if (m_blupiVitesse.x == 0 && !flag) if (m_blupiVitesse.x == 0 && !bAirStart)
{ {
StopBlupi(); StopBlupi();
} }
@ -1592,11 +1625,11 @@ void CDecor::BlupiStep()
rect.right -= 40; rect.right -= 40;
rect.top = end.y + 60 - 2; rect.top = end.y + 60 - 2;
rect.bottom = end.y + 60 - 1; rect.bottom = end.y + 60 - 1;
bool flag8 = !DecorDetect(rect); bIsOpen = !DecorDetect(rect);
rect.left += 40; rect.left += 40;
rect.right += 40; rect.right += 40;
bool flag9 = !DecorDetect(rect); bIsOpen2 = !DecorDetect(rect);
if (flag) if (bAirStart)
{ {
if (m_blupiVitesse.y < 50) if (m_blupiVitesse.y < 50)
{ {
@ -1622,12 +1655,12 @@ void CDecor::BlupiStep()
if (m_blupiVitesse.y >= 0 && num != -1) if (m_blupiVitesse.y >= 0 && num != -1)
{ {
m_blupiTransport = num; m_blupiTransport = num;
flag2 = FALSE; bAirStart = FALSE;
PlaySound(3, end); PlaySound(3, end);
end.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY; end.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY;
} }
} }
if (flag8 && !flag9) if (bIsOpen && !bIsOpen2)
{ {
int num13 = -20; int num13 = -20;
if (m_blupiVitesse.x > num13) if (m_blupiVitesse.x > num13)
@ -1635,7 +1668,7 @@ void CDecor::BlupiStep()
m_blupiVitesse.x -= 1; m_blupiVitesse.x -= 1;
} }
} }
else if (!flag8 && flag9) else if (!bIsOpen && bIsOpen2)
{ {
int num14 = 20; int num14 = 20;
if (m_blupiVitesse.x < num14) if (m_blupiVitesse.x < num14)
@ -1682,7 +1715,7 @@ void CDecor::BlupiStep()
} }
end.x += (int)m_blupiVitesse.x; end.x += (int)m_blupiVitesse.x;
MoveObjectPollution(); MoveObjectPollution();
if ( !flag && m_blupiTransport == -1) if ( !bLastBlupiAir && m_blupiTransport == -1)
{ {
tinyPoint.x = m_blupiPos.x; tinyPoint.x = m_blupiPos.x;
tinyPoint.y = m_blupiPos.y - BLUPIFLOOR; tinyPoint.y = m_blupiPos.y - BLUPIFLOOR;
@ -1701,7 +1734,7 @@ void CDecor::BlupiStep()
{ {
StopBlupi(); StopBlupi();
} }
if ((m_keyPress & KEY_FIRE) != 0 && m_blupiTimeFire == 0 && m_blupiAction != ACTION_TURN) if (m_keyPress & KEY_FIRE && m_blupiTimeFire == 0 && m_blupiAction != ACTION_TURN)
{ {
if (m_blupiBullet == 0) if (m_blupiBullet == 0)
{ {
@ -1738,7 +1771,7 @@ void CDecor::BlupiStep()
StopBlupi(); StopBlupi();
} }
//m_blupiMotorHigh = (m_blupiAction != 1); //m_blupiMotorHigh = (m_blupiAction != 1);
if (flag) if (bAirStart)
{ {
if (m_blupiVitesse.y < 50) if (m_blupiVitesse.y < 50)
{ {
@ -1764,7 +1797,7 @@ void CDecor::BlupiStep()
if (m_blupiVitesse.y >= 0 && num != -1) if (m_blupiVitesse.y >= 0 && num != -1)
{ {
m_blupiTransport = num; m_blupiTransport = num;
flag = FALSE; bAirStart = FALSE;
PlaySound(3, end); PlaySound(3, end);
end.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY; end.y = m_moveObject[num].posCurrent.y - 64 + BLUPIOFFY;
} }
@ -1808,7 +1841,7 @@ void CDecor::BlupiStep()
} }
end.x += (int)m_blupiVitesse.x; end.x += (int)m_blupiVitesse.x;
MoveObjectPollution(); MoveObjectPollution();
if ( !flag && m_blupiTransport == -1) if ( m_keyPress & KEY_DOWN && !bAirStart && m_blupiTransport == -1)
{ {
tinyPoint.x = m_blupiPos.x; tinyPoint.x = m_blupiPos.x;
@ -1866,7 +1899,7 @@ void CDecor::BlupiStep()
m_blupiVitesse.x = 0; m_blupiVitesse.x = 0;
} }
end.x += (int)m_blupiVitesse.x; end.x += (int)m_blupiVitesse.x;
if ( !flag && !m_blupiAir && m_blupiTransport == -1 && m_blupiVitesse.x < 8) if ( m_keyPress & KEY_DOWN && !bAirStart && !m_blupiAir && m_blupiTransport == -1 && m_blupiVitesse.x < 8)
{ {
m_blupiSkate = FALSE; m_blupiSkate = FALSE;
@ -1908,17 +1941,19 @@ void CDecor::BlupiStep()
{ {
if (m_blupiTransport == -1) if (m_blupiTransport == -1)
{ {
if ((m_keyPress & KEY_JUMP) != 0) if (m_keyPress & (KEY_JUMP | KEY_UP))
{ {
if (m_blupiVitesse.y > -5) if (m_blupiVitesse.y > -5)
{ {
m_blupiVitesse.y -= 1; m_blupiVitesse.y -= 1;
} }
} }
else if (m_blupiVitesse.y < 5) else if (m_keyPress & KEY_DOWN)
{ {
m_blupiVitesse.y += 1; if (m_blupiVitesse.y < 5)
{
m_blupiVitesse.y += 1;
}
} }
else else
{ {
@ -2025,7 +2060,7 @@ void CDecor::BlupiStep()
{ {
if (m_blupiTransport == -1) if (m_blupiTransport == -1)
{ {
if (m_keyPress & KEY_JUMP) if (m_keyPress & (KEY_JUMP | KEY_UP))
{ {
if (m_blupiVitesse.y > -5) if (m_blupiVitesse.y > -5)
{ {
@ -2151,7 +2186,16 @@ void CDecor::BlupiStep()
PlaySound(35, end); PlaySound(35, end);
} }
} }
if ( !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiTank && !m_blupiJeep && !m_blupiSkate /*&& !flag4*/ && m_blupiTransport == -1 && m_blupiFocus) if ( !m_blupiHelico &&
!m_blupiOver &&
!m_blupiBalloon &&
!m_blupiEcrase &&
!m_blupiTank &&
!m_blupiJeep &&
!m_blupiSkate &&
!bAirStart &&
m_blupiTransport == -1 &&
m_blupiFocus)
{ {
if (m_blupiDynamite > 0) if (m_blupiDynamite > 0)
{ {
@ -2160,13 +2204,13 @@ void CDecor::BlupiStep()
rect.right = end.x + 20; rect.right = end.x + 20;
rect.top = end.y + 60 - 2; rect.top = end.y + 60 - 2;
rect.bottom = end.y + 60; rect.bottom = end.y + 60;
flag2 = !DecorDetect(rect); bIsOpen = !DecorDetect(rect);
rect.left = end.x + 60 - 20; rect.left = end.x + 60 - 20;
rect.right = end.x + 60 - 18; rect.right = end.x + 60 - 18;
rect.top = end.y + 60 - 2; rect.top = end.y + 60 - 2;
rect.bottom = end.y + 60; rect.bottom = end.y + 60;
flag3 = !DecorDetect(rect); bIsOpen2 = !DecorDetect(rect);
if (!flag2 && !flag3 && ObjectStart(end, 56, 0) != -1) if (!bIsOpen && !bIsOpen2 && ObjectStart(end, 56, 0) != -1)
{ {
m_blupiAction = 87; m_blupiAction = 87;
m_blupiPhase = 0; m_blupiPhase = 0;
@ -2184,14 +2228,14 @@ void CDecor::BlupiStep()
rect.right = end.x + 20; rect.right = end.x + 20;
rect.top = end.y + 60 - 2; rect.top = end.y + 60 - 2;
rect.bottom = end.y + 60; rect.bottom = end.y + 60;
flag2 = !DecorDetect(rect); bIsOpen = !DecorDetect(rect);
rect.left = end.x + 60 - 20; rect.left = end.x + 60 - 20;
rect.right = end.x + 60 - 18; rect.right = end.x + 60 - 18;
rect.top = end.y + 60 - 2; rect.top = end.y + 60 - 2;
rect.bottom = end.y + 60; rect.bottom = end.y + 60;
flag3 = !DecorDetect(rect); bIsOpen2 = !DecorDetect(rect);
num = MoveChargeDetect(end); num = MoveChargeDetect(end);
if (num == -1 && !flag2 && !flag3 && ObjectStart(end, 200, 0) != -1) if (num == -1 && !bIsOpen && !bIsOpen2 && ObjectStart(end, 200, 0) != -1)
{ {
m_blupiAction = 46; m_blupiAction = 46;
m_blupiPhase = 0; m_blupiPhase = 0;
@ -2211,7 +2255,7 @@ void CDecor::BlupiStep()
rect = BlupiRect(m_blupiPos); rect = BlupiRect(m_blupiPos);
tinyPoint4 = end; tinyPoint4 = end;
TestPath(rect, m_blupiPos, &end); TestPath(rect, m_blupiPos, &end);
if (flag && m_blupiPos.x == end.x && m_blupiPos.x != tinyPoint4.x) if (bLastBlupiAir && m_blupiPos.x == end.x && m_blupiPos.x != tinyPoint4.x)
{ {
end.y = tinyPoint4.y; end.y = tinyPoint4.y;
TestPath(rect, m_blupiPos, &end); TestPath(rect, m_blupiPos, &end);
@ -2245,7 +2289,7 @@ void CDecor::BlupiStep()
{ {
if (m_blupiTransport != -1) if (m_blupiTransport != -1)
{ {
AscenseurVertigo(m_blupiTransport, &flag2, &flag3); AscenseurVertigo(m_blupiTransport, &bIsOpen, &bIsOpen2);
} }
else else
{ {
@ -2253,14 +2297,14 @@ void CDecor::BlupiStep()
rect.right = end.x + 26; rect.right = end.x + 26;
rect.top = end.y + 60 - 2; rect.top = end.y + 60 - 2;
rect.bottom = end.y + 60; rect.bottom = end.y + 60;
flag2 = !DecorDetect(rect); bIsOpen = !DecorDetect(rect);
rect.left = end.x + 60 - 26; rect.left = end.x + 60 - 26;
rect.right = end.x + 60 - 24; rect.right = end.x + 60 - 24;
rect.top = end.y + 60 - 2; rect.top = end.y + 60 - 2;
rect.bottom = end.y + 60; rect.bottom = end.y + 60;
flag3 = !DecorDetect(rect); bIsOpen2 = !DecorDetect(rect);
} }
if (m_blupiDir == DIR_LEFT && flag2 && !flag3) if (m_blupiDir == DIR_LEFT && bIsOpen && !bIsOpen2)
{ {
if (m_blupiHelico || m_blupiOver || AscenseurShift(m_blupiTransport)) if (m_blupiHelico || m_blupiOver || AscenseurShift(m_blupiTransport))
{ {
@ -2274,7 +2318,7 @@ void CDecor::BlupiStep()
m_blupiPhase = 0; m_blupiPhase = 0;
} }
} }
if (m_blupiDir == DIR_RIGHT && !flag2 && flag3) if (m_blupiDir == DIR_RIGHT && !bIsOpen && bIsOpen2)
{ {
if (m_blupiHelico || m_blupiOver || AscenseurShift(m_blupiTransport)) if (m_blupiHelico || m_blupiOver || AscenseurShift(m_blupiTransport))
{ {
@ -2288,7 +2332,7 @@ void CDecor::BlupiStep()
m_blupiPhase = 0; m_blupiPhase = 0;
} }
} }
if (m_blupiAction != ACTION_VERTIGO && m_blupiAction != ACTION_ADVANCE && m_blupiAction != ACTION_RECEDE && (flag2 || flag3)) if (m_blupiAction != ACTION_VERTIGO && m_blupiAction != ACTION_ADVANCE && m_blupiAction != ACTION_RECEDE && (bIsOpen || bIsOpen2))
{ {
if (!m_blupiHelico && !m_blupiOver) if (!m_blupiHelico && !m_blupiOver)
{ {
@ -2302,7 +2346,7 @@ void CDecor::BlupiStep()
{ {
if (m_blupiTransport != -1) if (m_blupiTransport != -1)
{ {
AscenseurVertigo(m_blupiTransport, &flag2, &flag3); AscenseurVertigo(m_blupiTransport, &bIsOpen, &bIsOpen2);
} }
else else
{ {
@ -2310,19 +2354,19 @@ void CDecor::BlupiStep()
rect.right = end.x + 18; rect.right = end.x + 18;
rect.top = end.y + 60 - 2; rect.top = end.y + 60 - 2;
rect.bottom = end.y + 60; rect.bottom = end.y + 60;
flag2 = !DecorDetect(rect); bIsOpen = !DecorDetect(rect);
rect.left = end.x + 60 - 18; rect.left = end.x + 60 - 18;
rect.right = end.x + 60 - 2; rect.right = end.x + 60 - 2;
rect.top = end.y + 60 - 2; rect.top = end.y + 60 - 2;
rect.bottom = end.y + 60; rect.bottom = end.y + 60;
flag3 = !DecorDetect(rect); bIsOpen2 = !DecorDetect(rect);
} }
if (flag2 && !flag3) if (bIsOpen && !bIsOpen2)
{ {
m_blupiAction = 10; m_blupiAction = 10;
m_blupiPhase = 0; m_blupiPhase = 0;
} }
if (flag3 && !flag2) if (!bIsOpen && bIsOpen2)
{ {
m_blupiAction = 10; m_blupiAction = 10;
m_blupiPhase = 0; m_blupiPhase = 0;
@ -2332,7 +2376,7 @@ void CDecor::BlupiStep()
{ {
if (m_blupiTransport != -1) if (m_blupiTransport != -1)
{ {
AscenseurVertigo(m_blupiTransport, &flag2, &flag3); AscenseurVertigo(m_blupiTransport, &bIsOpen, &bIsOpen2);
} }
else else
{ {
@ -2340,19 +2384,19 @@ void CDecor::BlupiStep()
rect.right = end.x + 18; rect.right = end.x + 18;
rect.top = end.y + 60 - 2; rect.top = end.y + 60 - 2;
rect.bottom = end.y + 60; rect.bottom = end.y + 60;
flag2 = !DecorDetect(rect); bIsOpen = !DecorDetect(rect);
rect.left = end.x + 60 - 18; rect.left = end.x + 60 - 18;
rect.right = end.x + 60 - 2; rect.right = end.x + 60 - 2;
rect.top = end.y + 60 - 2; rect.top = end.y + 60 - 2;
rect.bottom = end.y + 60; rect.bottom = end.y + 60;
flag3 = !DecorDetect(rect); bIsOpen2 = !DecorDetect(rect);
} }
if (flag2 && !flag3) if (bIsOpen && !bIsOpen2)
{ {
m_blupiAction = 10; m_blupiAction = 10;
m_blupiPhase = 0; m_blupiPhase = 0;
} }
if (flag3 && !flag2) if (!bIsOpen && bIsOpen2)
{ {
m_blupiAction = 10; m_blupiAction = 10;
m_blupiPhase = 0; m_blupiPhase = 0;
@ -2362,7 +2406,7 @@ void CDecor::BlupiStep()
{ {
if (m_blupiTransport != -1) if (m_blupiTransport != -1)
{ {
AscenseurVertigo(m_blupiTransport, &flag2, &flag3); AscenseurVertigo(m_blupiTransport, &bIsOpen, &bIsOpen2);
} }
else else
{ {
@ -2370,19 +2414,19 @@ void CDecor::BlupiStep()
rect.right = end.x + 19; rect.right = end.x + 19;
rect.top = end.y + 60 - 2; rect.top = end.y + 60 - 2;
rect.bottom = end.y + 60; rect.bottom = end.y + 60;
flag2 = !DecorDetect(rect); bIsOpen = !DecorDetect(rect);
rect.left = end.x + 60 - 19; rect.left = end.x + 60 - 19;
rect.right = end.x + 60 - 12; rect.right = end.x + 60 - 12;
rect.top = end.y + 60 - 2; rect.top = end.y + 60 - 2;
rect.bottom = end.y + 60; rect.bottom = end.y + 60;
flag3 = !DecorDetect(rect); bIsOpen2 = !DecorDetect(rect);
} }
if (flag2 && !flag3) if (bIsOpen && !bIsOpen2)
{ {
m_blupiAction = 10; m_blupiAction = 10;
m_blupiPhase = 0; m_blupiPhase = 0;
} }
if (flag3 && !flag2) if (!bIsOpen && bIsOpen2)
{ {
m_blupiAction = 10; m_blupiAction = 10;
m_blupiPhase = 0; m_blupiPhase = 0;
@ -3147,7 +3191,7 @@ void CDecor::BlupiStep()
m_blupiJumpAie = FALSE; m_blupiJumpAie = FALSE;
m_blupiFocus = FALSE; m_blupiFocus = FALSE;
m_blupiRestart = TRUE; m_blupiRestart = TRUE;
if (flag) if (bAirStart)
{ {
m_blupiAir = TRUE; m_blupiAir = TRUE;
} }
@ -3188,7 +3232,7 @@ void CDecor::BlupiStep()
m_blupiJumpAie = FALSE; m_blupiJumpAie = FALSE;
m_blupiFocus = FALSE; m_blupiFocus = FALSE;
m_blupiRestart = TRUE; m_blupiRestart = TRUE;
if (flag) if (bAirStart)
{ {
m_blupiAir = TRUE; m_blupiAir = TRUE;
} }
@ -3667,8 +3711,9 @@ void CDecor::BlupiStep()
m_term = m_mission / 10 * 10; m_term = m_mission / 10 * 10;
} }
} }
if (m_blupiAction == 30 && m_blupiPhase == 30) if (m_blupiAction == ACTION_BYE && m_blupiPhase == 30)
{ {
;
num = IsWorld(m_blupiPos); num = IsWorld(m_blupiPos);
if (num != -1) if (num != -1)
{ {
@ -3698,7 +3743,7 @@ void CDecor::BlupiStep()
{ {
StopSound(47); 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 && !bIsOpen && !bIsOpen2 && 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) if (m_blupiFifoNb > 0)
{ {
@ -3762,6 +3807,15 @@ void CDecor::BlupiStep()
VoyageStep(); VoyageStep();
m_lastKeyPress = m_keyPress; m_lastKeyPress = m_keyPress;
// DEBUG v
sprintf(m_notifText[0], "blupiAction %d", m_blupiAction);
sprintf(m_notifText[1], "blupiPhase %d", m_blupiPhase);
sprintf(m_notifText[2], "blupiPos { %d, %d }", m_blupiPos.x, m_blupiPos.y);
sprintf(m_notifText[3], "blupiVitesse { %d, %d }", m_blupiVitesse.x, m_blupiVitesse.y);
sprintf(m_notifText[4], "time %d", m_time);
m_notifTime = 200;
// DEBUG ^
} }

View File

@ -9,11 +9,11 @@ void CDecor::GetMissionPath(char* str, int user, int mission, BOOL bUser)
{ {
if (bUser != 0) if (bUser != 0)
{ {
sprintf(str, "data\%.3d-%.3d.blp", user, mission); sprintf(str, "data\\%.3d-%.3d.blp", user, mission);
AddUserPath(str); AddUserPath(str);
return; return;
} }
sprintf(str, "data\world%.3d.blp", mission); sprintf(str, "data\\world%.3d.blp", mission);
AddUserPath(str); AddUserPath(str);
return; return;
} }
@ -113,71 +113,86 @@ BOOL CDecor::Read(int gamer, int mission, BOOL bUser)
GetMissionPath(filename, gamer, mission, bUser); GetMissionPath(filename, gamer, mission, bUser);
file = fopen(filename, "rb"); file = fopen(filename, "rb");
if (file == NULL) goto error; if (file == NULL) {
OutputDebug("CDecor::Read error in fopen\n");
OutputDebug(filename);
goto error;
}
pBuffer = (DescFile*)malloc(sizeof(DescFile)); pBuffer = (DescFile*)malloc(sizeof(DescFile));
if (pBuffer == NULL) goto error; if (pBuffer == NULL) {
OutputDebug("CDecor::Read error in malloc\n");
goto error;
}
nb = fread(pBuffer, sizeof(DescFile), 1, file); nb = fread(pBuffer, sizeof(DescFile), 1, file);
if (nb < 1) goto error; if (nb < 1) {
OutputDebug("CDecor::Read error in fread\n");
goto error;
}
majRev = pBuffer->majRev; majRev = pBuffer->majRev;
minRev = pBuffer->minRev; minRev = pBuffer->minRev;
m_posDecor = pBuffer->posDecor; m_posDecor = pBuffer->posDecor;
m_dimDecor = pBuffer->dimDecor; m_dimDecor = pBuffer->dimDecor;
m_music = pBuffer->music; m_music = pBuffer->music;
m_region = pBuffer->region; m_region = pBuffer->region;
if (0 < majRev && minRev > 2) if (majRev >= 1 && minRev >= 3)
{ {
strcpy(m_missionTitle,pBuffer->name); strcpy(m_missionTitle,pBuffer->name);
} }
startDir = m_blupiStartDir; startDir = m_blupiStartDir;
blupiDir = pBuffer->blupiDir; blupiDir = pBuffer->blupiDir;
startPos = m_blupiStartPos; startPos = m_blupiStartPos;
blupiPos = pBuffer->blupiPos; blupiPos = pBuffer->blupiPos;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
m_blupiStartPos[i] = pBuffer->blupiPos[i]; m_blupiStartPos[i] = pBuffer->blupiPos[i];
} }
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
m_blupiStartDir[i] = pBuffer->blupiDir[i]; m_blupiStartDir[i] = pBuffer->blupiDir[i];
} }
nb = fread(m_decor, sizeof(Cellule), MAXCELX * MAXCELY / 4, file); nb = fread(m_decor, sizeof(Cellule), MAXCELX * MAXCELY, file);
if (nb < MAXCELX * MAXCELY / 4) goto error; if (nb < MAXCELX * MAXCELY) goto error;
for (x = 0; x < MAXCELX / 2; x++) for (x = 0; x < MAXCELX / 2; x++)
{
for (y = 0; y < MAXCELY / 2; y++)
{
if (m_decor[x][y].icon >= 48 &&
m_decor[x][y].icon <= 67)
{ {
for (y = 0; y < MAXCELY / 2; y++) m_decor[x][y].icon -= 128 - 17;
{
if (m_decor[x][y].icon >= 48 &&
m_decor[x][y].icon <= 67)
{
m_decor[x][y].icon -= 128 - 17;
}
}
} }
}
}
if (majRev == 1 && minRev <= 1) if (majRev == 1 && minRev >= 1)
{ {
memset(m_moveObject, 0, sizeof(MoveObject)); nb = fread(m_bigDecor, sizeof(Cellule), MAXCELX * MAXCELY, file);
nb = fread(m_moveObject, sizeof(MoveObject), MAXMOVEOBJECT / 2, file); if (nb < MAXCELX * MAXCELY) goto error;
if (nb < MAXMOVEOBJECT / 2) goto error; }
}
else
{
nb = fread(m_moveObject, sizeof(MoveObject), MAXMOVEOBJECT, file);
if (nb < MAXMOVEOBJECT) goto error;
}
free(pBuffer); memset(m_moveObject, 0, sizeof(MoveObject) * MAXMOVEOBJECT);
fclose(file); if (majRev == 1 && minRev >= 2)
return TRUE; {
nb = fread(m_moveObject, sizeof(MoveObject), MAXMOVEOBJECT, file);
if (nb < MAXMOVEOBJECT) goto error;
}
else
{
nb = fread(m_moveObject, sizeof(MoveObject), MAXMOVEOBJECT / 2, file);
if (nb < MAXMOVEOBJECT / 2) goto error;
}
free(pBuffer);
fclose(file);
return TRUE;
error: error:
if (pBuffer != NULL) free(pBuffer); if (pBuffer != NULL) free(pBuffer);
if (file != NULL) fclose(file); if (file != NULL) fclose(file);

View File

@ -2222,7 +2222,7 @@ void CDecor::MoveObjectSort()
{ {
if (m_moveObject[i].type != 0) if (m_moveObject[i].type != 0)
{ {
MoveObjectCopy(m_moveObject[num++], m_moveObject[i]); MoveObjectCopy(&m_moveObject[num++], &m_moveObject[i]);
} }
} }
for (int i = num; i < MAXMOVEOBJECT; i++) for (int i = num; i < MAXMOVEOBJECT; i++)
@ -2241,9 +2241,9 @@ void CDecor::MoveObjectSort()
{ {
if (SortGetType(m_moveObject[i].type) > SortGetType(m_moveObject[i + 1].type)) if (SortGetType(m_moveObject[i].type) > SortGetType(m_moveObject[i + 1].type))
{ {
MoveObjectCopy(src, m_moveObject[i]); MoveObjectCopy(&src, &m_moveObject[i]);
MoveObjectCopy(m_moveObject[i], m_moveObject[i + 1]); MoveObjectCopy(&m_moveObject[i], &m_moveObject[i + 1]);
MoveObjectCopy(m_moveObject[i + 1], src); MoveObjectCopy(&m_moveObject[i + 1], &src);
flag = TRUE; flag = TRUE;
} }
} }
@ -2274,9 +2274,9 @@ void CDecor::MoveObjectPriority(int i)
{ {
return; return;
} }
MoveObjectCopy(src, m_moveObject[i]); MoveObjectCopy(&src, &m_moveObject[i]);
MoveObjectCopy(m_moveObject[i], m_moveObject[j]); MoveObjectCopy(&m_moveObject[i], &m_moveObject[j]);
MoveObjectCopy(m_moveObject[j], src); MoveObjectCopy(&m_moveObject[j], &src);
if (m_moveObject[i].type == 12 || m_moveObject[j].type == 12) if (m_moveObject[i].type == 12 || m_moveObject[j].type == 12)
{ {
UpdateCaisse(); UpdateCaisse();

View File

@ -147,7 +147,7 @@ void CDecor::InitDecor()
m_moveObject[1].stepAdvance = 1; m_moveObject[1].stepAdvance = 1;
m_moveObject[1].timeStopStart = 0; m_moveObject[1].timeStopStart = 0;
m_moveObject[1].timeStopEnd = 0; m_moveObject[1].timeStopEnd = 0;
m_moveObject[1].posStart = { 450, 196 }; m_moveObject[1].posStart = { 322, 196 };
m_moveObject[1].posEnd = m_moveObject[1].posStart; m_moveObject[1].posEnd = m_moveObject[1].posStart;
m_moveObject[1].posCurrent = m_moveObject[1].posStart; m_moveObject[1].posCurrent = m_moveObject[1].posStart;
m_moveObject[1].phase = 0; m_moveObject[1].phase = 0;
@ -155,9 +155,15 @@ void CDecor::InitDecor()
m_moveObject[1].time = 0; m_moveObject[1].time = 0;
m_moveObject[1].channel = CHELEMENT; m_moveObject[1].channel = CHELEMENT;
m_moveObject[1].icon = 29; m_moveObject[1].icon = 29;
//TODO: iterate setting blupi fifo positions for (int i = 0; i < MAXFIFOPOS; i++)
m_blupiStartPos[0] = { 66, 192 + BLUPIOFFY }; {
m_blupiStartDir[0] = DIR_RIGHT; m_blupiFifoPos[i] = { 0, 0 };
}
for (int i = 0; i < MAXNETPLAYER; i++)
{
m_blupiStartPos[i] = { 194, 192 + BLUPIOFFY };
m_blupiStartDir[i] = DIR_RIGHT;
}
m_blupiAction = ACTION_STOP; m_blupiAction = ACTION_STOP;
m_blupiPhase = 0; m_blupiPhase = 0;
m_blupiIcon = 0; m_blupiIcon = 0;
@ -370,35 +376,32 @@ void CDecor::MoveStep()
NotifStep(); NotifStep();
} }
if (m_phase == WM_PHASE_BUILD) { if (m_phase == WM_PHASE_BUILD)
if (m_keyPress & KEY_RIGHT) { {
if (m_keyPress & KEY_RIGHT)
{
m_posDecor.x += 50; m_posDecor.x += 50;
int max = (m_dimDecor.x != 0) ? (MAXCELX * DIMOBJX - LXIMAGE) : 0; int limit = (m_dimDecor.x != 0) ? (MAXCELX * DIMOBJX - LXIMAGE) : 0;
if (m_posDecor.x > max) { if (m_posDecor.x > limit) m_posDecor.x = limit;
m_posDecor.x = max;
}
m_posCelHili.x = -1; m_posCelHili.x = -1;
} }
if (m_keyPress & KEY_LEFT) { if (m_keyPress & KEY_LEFT)
{
m_posDecor.x -= 50; m_posDecor.x -= 50;
if (m_posDecor.x < 0) { if (m_posDecor.x < 0) m_posDecor.x = 0;
m_posDecor.x = 0;
}
m_posCelHili.x = -1; m_posCelHili.x = -1;
} }
if (m_keyPress & KEY_DOWN) { if (m_keyPress & KEY_DOWN)
{
m_posDecor.y += 50; m_posDecor.y += 50;
int max = (m_dimDecor.y > 0) ? (MAXCELY * DIMOBJY - LYIMAGE) : 0; int limit = (m_dimDecor.y > 0) ? (MAXCELY * DIMOBJY - LYIMAGE) : 0;
if (m_posDecor.y > max) { if (m_posDecor.y > limit) m_posDecor.y = limit;
m_posDecor.y = max;
}
m_posCelHili.x = -1; m_posCelHili.x = -1;
} }
if (m_keyPress & KEY_UP) { if (m_keyPress & KEY_UP)
{
m_posDecor.y -= 50; m_posDecor.y -= 50;
if (m_posDecor.y < 0) { if (m_posDecor.y < 0) m_posDecor.y = 0;
m_posDecor.y = 0;
}
m_posCelHili.x = -1; m_posCelHili.x = -1;
} }
} }
@ -499,7 +502,7 @@ void CDecor::Build(RECT rect)
if (m_phase == WM_PHASE_BUILD) if (m_phase == WM_PHASE_BUILD)
{ {
// ... // draw blupi start positions...
} }
if (m_bMulti && m_phase != WM_PHASE_BUILD) if (m_bMulti && m_phase != WM_PHASE_BUILD)
@ -568,24 +571,24 @@ void CDecor::Build(RECT rect)
m_pPixmap->QuickIcon(GetBlupiChannelStandard(), m_blupiIcon, tinyPoint); m_pPixmap->QuickIcon(GetBlupiChannelStandard(), m_blupiIcon, tinyPoint);
} }
for (int num3 = MAXMOVEOBJECT - 1; num3 >= 0; num3--) for (int i = 0; i < MAXMOVEOBJECT; i++)
{ {
if (m_moveObject[num3].type != 0 && m_moveObject[num3].posCurrent.x >= posDecor.x - 64 && m_moveObject[num3].posCurrent.y >= posDecor.y - 64 && m_moveObject[num3].posCurrent.x <= posDecor.x + LXIMAGE && m_moveObject[num3].posCurrent.y <= posDecor.y + LYIMAGE && (m_moveObject[num3].type < 8 || m_moveObject[num3].type > 11) && (m_moveObject[num3].type < 90 || m_moveObject[num3].type > 95) && (m_moveObject[num3].type < 98 || m_moveObject[num3].type > 100) && m_moveObject[num3].type != 53 && m_moveObject[num3].type != 1 && m_moveObject[num3].type != 47 && m_moveObject[num3].type != 48) if (m_moveObject[i].type != 0 && m_moveObject[i].posCurrent.x >= posDecor.x - 64 && m_moveObject[i].posCurrent.y >= posDecor.y - 64 && m_moveObject[i].posCurrent.x <= posDecor.x + LXIMAGE && m_moveObject[i].posCurrent.y <= posDecor.y + LYIMAGE && (m_moveObject[i].type < 8 || m_moveObject[i].type > 11) && (m_moveObject[i].type < 90 || m_moveObject[i].type > 95) && (m_moveObject[i].type < 98 || m_moveObject[i].type > 100) && m_moveObject[i].type != 53 && m_moveObject[i].type != 1 && m_moveObject[i].type != 47 && m_moveObject[i].type != 48)
{ {
tinyPoint.x = m_moveObject[num3].posCurrent.x - posDecor.x; tinyPoint.x = m_moveObject[i].posCurrent.x - posDecor.x;
tinyPoint.y = m_moveObject[num3].posCurrent.y - posDecor.y; tinyPoint.y = m_moveObject[i].posCurrent.y - posDecor.y;
if (m_moveObject[num3].type == TYPE_BULLDOZER || m_moveObject[num3].type == TYPE_BLUPIHELICO || m_moveObject[num3].type == TYPE_BLUPITANK) if (m_moveObject[i].type == TYPE_BULLDOZER || m_moveObject[i].type == TYPE_BLUPIHELICO || m_moveObject[i].type == TYPE_BLUPITANK)
{ {
tinyPoint.x += 2; tinyPoint.x += 2;
tinyPoint.y += BLUPIOFFY; tinyPoint.y += BLUPIOFFY;
} }
if (m_moveObject[num3].type == 54) if (m_moveObject[i].type == 54)
{ {
tinyPoint.y += BLUPIOFFY; tinyPoint.y += BLUPIOFFY;
} }
// get the winphone opacity stuff out of here // get the winphone opacity stuff out of here
m_pPixmap->QuickIcon(m_moveObject[num3].channel, m_moveObject[num3].icon, tinyPoint); m_pPixmap->QuickIcon(m_moveObject[i].channel, m_moveObject[i].icon, tinyPoint);
if (m_moveObject[num3].type == 30) if (m_moveObject[i].type == 30)
{ {
for (int l = 0; l < sizeof(table_drinkoffset) / sizeof(int); l++) for (int l = 0; l < sizeof(table_drinkoffset) / sizeof(int); l++)
{ {
@ -596,7 +599,7 @@ void CDecor::Build(RECT rect)
m_pPixmap->QuickIcon(10, rank, pos2); m_pPixmap->QuickIcon(10, rank, pos2);
} }
} }
if (m_bDrawSecret && m_moveObject[num3].type == 12 && m_moveObject[num3].icon != 32 && m_moveObject[num3].icon != 33 && m_moveObject[num3].icon != 34) if (m_bDrawSecret && m_moveObject[i].type == 12 && m_moveObject[i].icon != 32 && m_moveObject[i].icon != 33 && m_moveObject[i].icon != 34)
{ {
m_pPixmap->QuickIcon(1, 214, tinyPoint); m_pPixmap->QuickIcon(1, 214, tinyPoint);
} }
@ -827,10 +830,12 @@ void CDecor::DrawInfo()
if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST) if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST)
{ {
for (int i = 4; i != 0; i--) { pos = { 10, 10 };
if (m_notifText[i] != '\0') { for (int i = 0; i < MAXNOTIF; i++) {
DrawText(m_pPixmap, { 10, 10 }, m_notifText[i], 0); if (m_notifText[i][0] != '\0') {
DrawText(m_pPixmap, pos, m_notifText[i], FONTWHITE);
} }
pos.y += DIMTEXTY;
} }
if (m_nbVies > 0) { if (m_nbVies > 0) {
@ -1556,12 +1561,49 @@ BOOL CDecor::DrawMap(BOOL bPlay, int team)
return FALSE; return FALSE;
} }
BOOL CDecor::SearchWorld(int world, POINT *blupi, int *dir) BOOL CDecor::SearchWorld(int world, POINT *cel, POINT *newBlupiPos)
{ {
for (int x = 0; x < MAXCELX; x++)
{
for (int y = 0; y < MAXCELY; y++)
{
int icon = m_decor[x][y].icon;
if (icon >= Object::Level_1 && icon <= Object::Level_8)
{
if (world == icon - Object::Level_1 + 1)
{
if (x > 1 && m_decor[x + 1][y].icon == Object::DoorLevel)
{
*cel = { x - 1, y };
*newBlupiPos = { (x - 2) * DIMOBJX + 2, y * DIMOBJY + 6 };
return TRUE;
}
if (x > 2 && m_decor[x + 2][y].icon == Object::DoorLevel)
{
*cel = { x - 2, y };
*newBlupiPos = { (x - 3) * DIMOBJX + 2, y * DIMOBJY + 6 };
return TRUE;
}
if (x < MAXCELX - 1 && m_decor[x - 1][y].icon == Object::DoorLevel)
{
*cel = { x + 1, y };
*newBlupiPos = { (x + 2) * DIMOBJX + 2, y * DIMOBJY + 6 };
return TRUE;
}
if (x < MAXCELX - 2 && m_decor[x + 2][y].icon == Object::DoorLevel)
{
*cel = { x + 2, y };
*newBlupiPos = { (x + 3) * DIMOBJX + 2, y * DIMOBJY + 6 };
return TRUE;
}
}
}
}
}
return FALSE; return FALSE;
} }
BOOL CDecor::SearchDoor(int n, POINT *cel, POINT *blupi) BOOL CDecor::SearchDoor(int n, POINT *cel)
{ {
for (int i = 0; i < 100; i++) for (int i = 0; i < 100; i++)
{ {
@ -1574,32 +1616,24 @@ BOOL CDecor::SearchDoor(int n, POINT *cel, POINT *blupi)
{ {
cel->x = i - 1; cel->x = i - 1;
cel->y = j; cel->y = j;
blupi->x = (i - 2) * 64 + 2;
blupi->y = j * 64 + BLUPIOFFY;
return TRUE; return TRUE;
} }
if (i > 1 && m_decor[i - 2, j]->icon == 182) if (i > 1 && m_decor[i - 2, j]->icon == 182)
{ {
cel->x = i - 2; cel->x = i - 2;
cel->y = j; cel->y = j;
blupi->x = (i - 3) * 64 + 2;
blupi->y = j * 64 + BLUPIOFFY;
return TRUE; return TRUE;
} }
if (i < 99 && m_decor[i + 1, j]->icon == 182) if (i < 99 && m_decor[i + 1, j]->icon == 182)
{ {
cel->x = i + 1; cel->x = i + 1;
cel->y = j; cel->y = j;
blupi->x = (i + 2) * 64 + 2;
blupi->y = j * 64 + BLUPIOFFY;
return TRUE; return TRUE;
} }
if (i < 98 && m_decor[i + 2, j]->icon == 182) if (i < 98 && m_decor[i + 2, j]->icon == 182)
{ {
cel->x = i + 2; cel->x = i + 2;
cel->y = j; cel->y = j;
blupi->x = (i + 3) * 64 + 2;
blupi->y = j * 64 + BLUPIOFFY;
return TRUE; return TRUE;
} }
} }
@ -1610,7 +1644,84 @@ BOOL CDecor::SearchDoor(int n, POINT *cel, POINT *blupi)
void CDecor::AdaptDoors(BOOL bPrivate, int mission) void CDecor::AdaptDoors(BOOL bPrivate, int mission)
{ {
POINT cel;
int index;
int icon;
POINT newPosBlupi;
m_bPrivate = bPrivate;
m_mission = mission;
if (bPrivate == FALSE)
{
if (mission == 1)
{
for (int i = 0; i < 20; ++i)
{
if (SearchDoor(i, &cel))
{
if (!m_doors[180 + i] || m_bCheatDoors)
{
m_decor[cel.x][cel.y].icon = -1;
index = MoveObjectFree();
m_moveObject[index].type = TYPE_DOOR;
m_moveObject[index].stepAdvance = 50;
m_moveObject[index].stepRecede = 1;
m_moveObject[index].timeStopStart = 0;
m_moveObject[index].timeStopEnd = 0;
m_moveObject[index].posStart.x = cel.x * DIMOBJX;
m_moveObject[index].posStart.y = cel.y * DIMOBJY;
m_moveObject[index].posEnd.x = cel.x * DIMOBJX;
m_moveObject[index].posEnd.y = cel.y * DIMOBJY - DIMOBJY;
m_moveObject[index].posCurrent.x = m_moveObject[index].posStart.x;
m_moveObject[index].posCurrent.y = m_moveObject[index].posStart.y;
m_moveObject[index].step = STEP_STOPSTART;
m_moveObject[index].time = 0;
m_moveObject[index].phase = 0;
m_moveObject[index].channel = CHOBJECT;
m_moveObject[index].icon = 0xb7;
PlaySound(SOUND_DOOR, m_moveObject[index].posStart, FALSE);
}
}
}
for (int x = 0; x < MAXCELX; x++)
{
for (int y = 0; y < MAXCELY; y++)
{
int icon = m_decor[x][y].icon;
if (icon >= Object::World_1 && icon <= Object::World_8 && (!m_doors[icon - Object::World_1 + 1] || m_bCheatDoors))
{
m_decor[x][y].icon += 8;
}
if (icon == Object::World_9 && (!m_doors[189] || m_bCheatDoors))
{
m_decor[x][y].icon = Object::WorldDone_9;
}
if (icon >= Object::World_10 && icon <= Object::World_14 && (!m_doors[icon - Object::World_10 + 1] || m_bCheatDoors))
{
m_decor[x][y].icon += 5;
}
}
}
}
else if (mission % 10 == 0)
{
for (int i = 0; i < 10; ++i)
{
if (SearchWorld(i, &cel, &newPosBlupi))
{
if (!m_doors[mission + i] || m_bCheatDoors)
{
OpenDoor(cel);
for (int j = 0; j < MAXNETPLAYER; j++)
{
m_blupiStartPos[i] = newPosBlupi;
m_blupiStartDir[i] = (m_blupiStartPos[i].x < cel.x * DIMOBJX) ? DIR_RIGHT : DIR_LEFT;
}
}
}
}
}
}
} }
void CDecor::OpenDoorsTresor() void CDecor::OpenDoorsTresor()

View File

@ -9,11 +9,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#define MAXNETMESSAGE 20
#define MAXMOVEOBJECT 200
#define MAXNOTIF 4
#define MAXNETPLAYER 4
#define MAXQUART 441 #define MAXQUART 441
#define SCROLL_SPEED 8 #define SCROLL_SPEED 8
#define SCROLL_MARGX 80 #define SCROLL_MARGX 80
@ -147,7 +142,7 @@ typedef struct
int blupiTimeOuf; int blupiTimeOuf;
int blupiActionOuf; int blupiActionOuf;
int blupiFifoNb; int blupiFifoNb;
POINT blupiFifoPos[10]; POINT blupiFifoPos[MAXFIFOPOS];
BOOL blupiInvert; BOOL blupiInvert;
BOOL blupiBalloon; BOOL blupiBalloon;
BOOL blupiOver; BOOL blupiOver;
@ -407,8 +402,8 @@ public:
BOOL CurrentRead(int gamer, int mission, BOOL *pbMission, BOOL *pbPrivate); BOOL CurrentRead(int gamer, int mission, BOOL *pbMission, BOOL *pbPrivate);
BOOL CurrentWrite(int gamer, int mission, char* param3); BOOL CurrentWrite(int gamer, int mission, char* param3);
BOOL SearchWorld(int world, POINT *blupi, int *dir); BOOL SearchWorld(int world, POINT *cel, POINT *newBlupiPos);
BOOL SearchDoor(int n, POINT *cel, POINT *blupi); BOOL SearchDoor(int n, POINT *cel);
void AdaptDoors(BOOL bPrivate, int mission); void AdaptDoors(BOOL bPrivate, int mission);
void OpenDoorsTresor(); void OpenDoorsTresor();
void OpenDoor(POINT cel); void OpenDoor(POINT cel);
@ -419,7 +414,7 @@ public:
BOOL DeleteMission(int user, int mission, BOOL bUser); BOOL DeleteMission(int user, int mission, BOOL bUser);
inline BOOL IsValidCel(POINT cel); inline BOOL IsValidCel(POINT cel);
inline void MoveObjectCopy(MoveObject src, MoveObject dest); inline void MoveObjectCopy(MoveObject *src, MoveObject *dest);
inline void StopVehicleSound(); inline void StopVehicleSound();
inline BOOL IsDeadAction(int action); inline BOOL IsDeadAction(int action);
inline void StopBlupi(BOOL bFocus = FALSE); inline void StopBlupi(BOOL bFocus = FALSE);
@ -528,7 +523,7 @@ protected:
int m_netMessageIndex1; int m_netMessageIndex1;
int m_netMessageIndex2; int m_netMessageIndex2;
int m_netMessageIndex3; int m_netMessageIndex3;
char m_notifText[4][100]; char m_notifText[MAXNOTIF][100];
int m_notifTime; int m_notifTime;
CJauge m_jauges[2]; CJauge m_jauges[2];
int m_blupiLevel; int m_blupiLevel;
@ -580,9 +575,9 @@ inline BOOL CDecor::IsValidCel(POINT cel)
return cel.x >= 0 && cel.x < MAXCELX && cel.y >= 0 && cel.y < MAXCELY; return cel.x >= 0 && cel.x < MAXCELX && cel.y >= 0 && cel.y < MAXCELY;
} }
inline void CDecor::MoveObjectCopy(MoveObject src, MoveObject dest) inline void CDecor::MoveObjectCopy(MoveObject *src, MoveObject *dest)
{ {
memcpy(&dest, &src, sizeof(dest)); memcpy(dest, src, sizeof(dest));
} }
inline void CDecor::StopVehicleSound() inline void CDecor::StopVehicleSound()
@ -607,7 +602,7 @@ inline void CDecor::StopBlupi(BOOL bSetFocus)
inline BOOL CDecor::IsBlupiVehicle() inline BOOL CDecor::IsBlupiVehicle()
{ {
return m_blupiHelico || m_blupiOver || m_blupiJeep || m_blupiTank || m_blupiSkate; return IsBlupiMotorVehicle() || m_blupiSkate;
} }
inline BOOL CDecor::IsBlupiMotorVehicle() inline BOOL CDecor::IsBlupiMotorVehicle()

File diff suppressed because one or more lines are too long

View File

@ -22,6 +22,11 @@
#define _LEGACY FALSE // if TRUE, keep broken/quirky legacy code #define _LEGACY FALSE // if TRUE, keep broken/quirky legacy code
#define MAXGAMER 8 #define MAXGAMER 8
#define MAXNETPLAYER 4
#define MAXNETMESSAGE 20
#define MAXMOVEOBJECT 200
#define MAXNOTIF 5
#define MAXFIFOPOS 10
#define LXIMAGE 640 // dimensions de la fenêtre de jeu #define LXIMAGE 640 // dimensions de la fenêtre de jeu
#define LYIMAGE 480 #define LYIMAGE 480
@ -71,7 +76,8 @@ enum {
CHBLUPI1, CHBLUPI1,
CHBLUPI2, CHBLUPI2,
CHBLUPI3, CHBLUPI3,
CHTEMP CHTEMP,
CHMAX = CHTEMP
}; };
enum { enum {
@ -900,22 +906,22 @@ namespace Object {
RockTriRight_2, RockTriRight_2,
RockSquare_17, RockSquare_17,
GrassSquare_2, GrassSquare_2,
Course_1, World_1,
Course_2, World_2,
Course_3, // 160 World_3, // 160
Course_4, World_4,
Course_5, World_5,
Course_6, World_6,
Course_7, World_7,
Course_8, World_8,
CourseDone_1, WorldDone_1,
CourseDone_2, WorldDone_2,
CourseDone_3, WorldDone_3,
CourseDone_4, WorldDone_4,
CourseDone_5, WorldDone_5,
CourseDone_6, WorldDone_6,
CourseDone_7, WorldDone_7,
CourseDone_8, WorldDone_8,
Level_1, Level_1,
Level_2, Level_2,
Level_3, // 176 Level_3, // 176
@ -926,7 +932,7 @@ namespace Object {
Level_8, Level_8,
DoorLevel, DoorLevel,
DoorCourse, DoorCourse,
CourseBack, WorldBack,
RockSecret, RockSecret,
Facade_1, Facade_1,
Facade_2, Facade_2,
@ -1051,8 +1057,8 @@ namespace Object {
Lightning_2, Lightning_2,
Lightning_3, Lightning_3,
Lightning_4, Lightning_4,
Course_9, World_9,
CourseDone_9, WorldDone_9,
Conveyor_1, Conveyor_1,
Conveyor_2, Conveyor_2,
Conveyor_3, Conveyor_3,
@ -1153,16 +1159,16 @@ namespace Object {
SlimeTrapCeiling_5, SlimeTrapCeiling_5,
SlimeTrapCeiling_6, SlimeTrapCeiling_6,
SlimeTrapCeiling_7, SlimeTrapCeiling_7,
Course_10, World_10,
Course_11, World_11,
Course_12, World_12,
Course_13, World_13,
Course_14, World_14,
CourseDone_10, // 414 WorldDone_10, // 414
CourseDone_11, WorldDone_11,
CourseDone_12, WorldDone_12,
CourseDone_13, WorldDone_13,
CourseDone_14, WorldDone_14,
DoorTreasure_1, DoorTreasure_1,
DoorTreasure_2, DoorTreasure_2,
DoorTreasure_3, DoorTreasure_3,

View File

@ -1767,7 +1767,6 @@ CEvent::CEvent()
{ {
int i; int i;
m_somethingJoystick = 0; m_somethingJoystick = 0;
m_bFullScreen = TRUE; m_bFullScreen = TRUE;
m_mouseType = MOUSETYPEGRA; m_mouseType = MOUSETYPEGRA;
@ -2530,38 +2529,14 @@ BOOL CEvent::DrawButtons()
PutTextInputBox({ 320, 232 }); PutTextInputBox({ 320, 232 });
} }
/*
// TEMP DEBUG // TEMP DEBUG
if (m_keyPress & KEY_LEFT) char str[50];
{ sprintf(str, "m_rankCheat %d (%s)", m_rankCheat, m_rankCheat != -1 ? cheat_code[m_rankCheat] : "...");
DrawTextLeft(m_pPixmap, { LXIMAGE - 30, 15 }, "<", 0); DrawTextLeft(m_pPixmap, { 200, 0 }, str, FONTWHITE);
} sprintf(str, "m_posCheat %d", m_posCheat);
if (m_keyPress & KEY_RIGHT) DrawTextLeft(m_pPixmap, { 200, 20 }, str, FONTWHITE);
{ ///////////////
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) 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); m_pPixmap->DrawPart(-1, 0, pos, rect, 1, 0);
@ -3075,7 +3050,7 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam)
if (m_rankCheat != -1) if (m_rankCheat != -1)
{ {
c = cheat_code[m_rankCheat][m_posCheat]; c = cheat_code[m_rankCheat][m_posCheat];
if (m_posCheat != 0 && m_rankCheat == 1) c++; if (m_posCheat != 0 && m_rankCheat == 0) c++;
if ((char)wParam == c) if ((char)wParam == c)
{ {
m_posCheat++; m_posCheat++;
@ -3375,7 +3350,7 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam)
} }
if (m_phase != WM_PHASE_PLAY && m_phase != WM_PHASE_PLAYTEST) if (m_phase != WM_PHASE_PLAY && m_phase != WM_PHASE_PLAYTEST && m_phase != WM_PHASE_BUILD)
{ {
return FALSE; return FALSE;
} }
@ -3535,7 +3510,7 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam)
case WM_PHASE_DOPLAY: case WM_PHASE_DOPLAY:
m_bPrivate = FALSE; m_bPrivate = FALSE;
m_mission = 1; m_mission = 1;
if (CheckCDForWorld1()) if (CheckWorld1())
{ {
return ChangePhase(WM_PHASE_PLAY); return ChangePhase(WM_PHASE_PLAY);
} }
@ -4110,12 +4085,9 @@ BOOL CEvent::IsMulti()
int CEvent::GetWorldGroup() int CEvent::GetWorldGroup()
{ {
int mission;
m_mission = mission;
if (m_mission % 10 != 0 && m_mission != 99) if (m_mission % 10 != 0 && m_mission != 99)
{ {
m_mission = (mission / 10) * 10; m_mission = (m_mission / 10) * 10;
return -(m_mission >> 31); return -(m_mission >> 31);
} }
m_mission = 1; m_mission = 1;
@ -4379,7 +4351,7 @@ BOOL CEvent::ChangePhase(UINT phase)
m_phase = phase; m_phase = phase;
m_index = SearchPhase(phase); m_index = SearchPhase(phase);
if (table[m_index].bUnk && !CheckCDForWorld1()) if (table[m_index].bUnk && !CheckWorld1())
{ {
m_tryInsertCount = 40; m_tryInsertCount = 40;
m_tryPhase = m_phase; m_tryPhase = m_phase;
@ -5721,10 +5693,24 @@ BOOL CEvent::ClearGamer(int gamer)
return TRUE; return TRUE;
} }
BOOL CEvent::CheckCDForWorld1() BOOL CEvent::CheckWorld1()
{ {
// TODO #if _CD
FILE* file;
char buf[260];
strcpy(buf, "data\\world001.blp");
AddCDPath(buf);
file = fopen(buf, "rb");
if (file)
{
fclose(file);
return TRUE;
}
return FALSE;
#else
return TRUE; return TRUE;
#endif
} }
int CEvent::GameSave(int save) int CEvent::GameSave(int save)

View File

@ -190,7 +190,7 @@ protected:
int GameSave(int save); int GameSave(int save);
void DrawMap(); void DrawMap();
BOOL CheckCDForWorld1(); BOOL CheckWorld1();
void NetAdjustLobbyButtons(); void NetAdjustLobbyButtons();
BOOL CopyMission(char *srcFileName, char *dstFileName); BOOL CopyMission(char *srcFileName, char *dstFileName);

View File

@ -1,16 +1,12 @@
// Misc.cpp // Misc.cpp
// //
#include <dsound.h> #include <dsound.h>
#include <ddraw.h> #include <ddraw.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "def.h" #include "def.h"
#pragma warning (disable : 4996)
// Global Variables // Global Variables
HINSTANCE g_hInstance; HINSTANCE g_hInstance;
@ -120,19 +116,6 @@ void GetCurrentDir(char *pName, int lg)
} }
} }
int Speed(double speed, int max)
{
if (speed > 0.0)
{
return max((int)(speed * (double)max), 1);
}
if (speed < 0.0)
{
return min((int)(speed * (double)max), -1);
}
return 0;
}
void AddCDPath(char *pFilename) void AddCDPath(char *pFilename)
{ {
char temp[MAX_PATH]; char temp[MAX_PATH];
@ -167,12 +150,12 @@ void AddCDPath(char *pFilename)
strcat(temp, pFilename); strcat(temp, pFilename);
} }
#endif #endif
strcpy(pFilename, temp); strcpy(pFilename, temp);
} }
void AddUserPath(char *pFilename) void AddUserPath(char *pFilename)
{ {
#if _CD || _LEGACY
char temp[MAX_PATH]; char temp[MAX_PATH];
char* pText; char* pText;
int pos; int pos;
@ -183,12 +166,12 @@ void AddUserPath(char *pFilename)
strcpy(temp, "c:\\Speedy_Blupi\\"); strcpy(temp, "c:\\Speedy Blupi\\");
att.nLength = sizeof(SECURITY_ATTRIBUTES); att.nLength = sizeof(SECURITY_ATTRIBUTES);
att.lpSecurityDescriptor = NULL; att.lpSecurityDescriptor = NULL;
att.bInheritHandle = FALSE; att.bInheritHandle = FALSE;
CreateDirectoryA(temp, &att); CreateDirectory(temp, &att);
pText = strstr(pFilename, "\\"); pText = strstr(pFilename, "\\");
if ( pText != NULL ) if ( pText != NULL )
@ -206,6 +189,7 @@ void AddUserPath(char *pFilename)
} }
strcpy(pFilename, temp); strcpy(pFilename, temp);
#endif
} }
void TraceErrorDD(HRESULT hErr, const char *sFile, int nLine) void TraceErrorDD(HRESULT hErr, const char *sFile, int nLine)

View File

@ -20,4 +20,4 @@ extern void AddCDPath(char *pFilename);
extern void AddUserPath(char *pFilename); extern void AddUserPath(char *pFilename);
extern void TraceErrorDD(HRESULT hErr, const char *sFile, int nLine); extern void TraceErrorDD(HRESULT hErr, const char *sFile, int nLine);
extern void TraceErrorDS(HRESULT hErr, const char *sFile, int nLine); extern void TraceErrorDS(HRESULT hErr, const char *sFile, int nLine);

View File

@ -6,6 +6,7 @@
#include "dplay.h" #include "dplay.h"
#include "misc.h" #include "misc.h"
#include "network.h" #include "network.h"
#include "def.h"
// a0f94abe-11c3-d111-be62-0040f6944838 // a0f94abe-11c3-d111-be62-0040f6944838
#define APP_GUID { 0xbe4af9a0, 0xc311, 0x11d1, { 0xbe, 0x62, 0x00, 0x40, 0xf6, 0x94, 0x48, 0x38 } }; #define APP_GUID { 0xbe4af9a0, 0xc311, 0x11d1, { 0xbe, 0x62, 0x00, 0x40, 0xf6, 0x94, 0x48, 0x38 } };
@ -202,7 +203,7 @@ BOOL CNetwork::CreateSession(char* pSessionName, char* pPlayerName)
desc.lpszSessionNameA = pSessionName; desc.lpszSessionNameA = pSessionName;
desc.dwSize = sizeof(desc); desc.dwSize = sizeof(desc);
desc.dwFlags = DPSESSION_KEEPALIVE | DPSESSION_MIGRATEHOST; desc.dwFlags = DPSESSION_KEEPALIVE | DPSESSION_MIGRATEHOST;
desc.dwMaxPlayers = MAXPLAYERS; desc.dwMaxPlayers = MAXNETPLAYER;
hr = m_pDP->Open(&desc, DPOPEN_CREATE); hr = m_pDP->Open(&desc, DPOPEN_CREATE);
if (hr != DP_OK) if (hr != DP_OK)
@ -262,7 +263,7 @@ BOOL CNetwork::Receive(LPVOID pDest, DWORD dwDataSize, LPDWORD lpdwPlayer)
ZeroMemory(pDest, dwDataSize); ZeroMemory(pDest, dwDataSize);
*lpdwPlayer = -1; *lpdwPlayer = -1;
for (int i = 0; i < MAXPLAYERS; i++) for (int i = 0; i < MAXNETPLAYER; i++)
{ {
if (m_players[i].bIsPresent && from == i) if (m_players[i].bIsPresent && from == i)
{ {

View File

@ -7,7 +7,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#define MAXSESSION 100 #define MAXSESSION 100
#define MAXPLAYERS 4
typedef struct typedef struct
{ {

View File

@ -311,6 +311,8 @@ void CPixmap::QuickIcon(int channel, int rank, POINT pos)
int num; int num;
RECT rect; RECT rect;
if ((unsigned)channel > CHMAX) return;
if (channel == CHOBJECT) if (channel == CHOBJECT)
{ {
if (table_icon_object[0] <= rank) return; if (table_icon_object[0] <= rank) return;
@ -1275,12 +1277,12 @@ BOOL CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos,
nby = m_totalDim[channel].y / m_iconDim[channel].y; nby = m_totalDim[channel].y / m_iconDim[channel].y;
if (rank < 0 || rank >= nbx * nby) return FALSE; if (rank < 0 || rank >= nbx * nby) return FALSE;
}
rect.left = (rank%nbx)*m_iconDim[channel].x; rect.left = (rank%nbx)*m_iconDim[channel].x;
rect.top = (rank/nbx)*m_iconDim[channel].y; rect.top = (rank / nbx)*m_iconDim[channel].y;
rect.right = rect.left + m_iconDim[channel].x; rect.right = rect.left + m_iconDim[channel].x;
rect.bottom = rect.top + m_iconDim[channel].y; rect.bottom = rect.top + m_iconDim[channel].y;
}
oldColor1 = m_colorSurface[2*channel+0]; oldColor1 = m_colorSurface[2*channel+0];
oldColor2 = m_colorSurface[2*channel+1]; oldColor2 = m_colorSurface[2*channel+1];

View File

@ -8,13 +8,8 @@
#include "def.h" #include "def.h"
#include "resource.h" #include "resource.h"
using namespace std;
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// The following macro are used for proper error handling for DirectSound. // The following macro are used for proper error handling for DirectSound.
#define TRY_DS(exp) { { HRESULT rval = exp; if (rval != DS_OK) { TraceErrorDS(rval, __FILE__, __LINE__); return FALSE; } } } #define TRY_DS(exp) { { HRESULT rval = exp; if (rval != DS_OK) { TraceErrorDS(rval, __FILE__, __LINE__); return FALSE; } } }

View File

@ -0,0 +1,15 @@
# JUMMY WAS HERE
# extract table_blupi from speedy blupi 2.2 english ver
import sys
import io
offset = 0x34560
out = []
with io.open('BLUPI.exe', 'rb') as f:
data = f.read()
for i in range(2842):
out.append (int.from_bytes(data[offset + i * 4 : offset + i * 4 + 4], byteorder='little', signed=True))
with io.open('out.h', 'wb') as f2:
f2.write(bytearray(', '.join(map(str,out)), 'ascii'))

View File

@ -0,0 +1,15 @@
# JUMMY WAS HERE
# extract table_mirror from speedy blupi 2.2 english ver
import sys
import io
offset = 0x37ac8
out = []
with io.open('BLUPI.exe', 'rb') as f:
data = f.read()
for i in range(335):
out.append (int.from_bytes(data[offset + i * 4 : offset + i * 4 + 4], byteorder='little', signed=True))
with io.open('out.h', 'wb') as f2:
f2.write(bytearray(', '.join(map(str,out)), 'ascii'))