1
0
mirror of https://github.com/jummy0/sb2-decomp synced 2025-03-14 20:23:30 +01:00

fixed POINT operators and etc

This commit is contained in:
jummy 2024-11-30 20:11:05 -06:00
parent d777318642
commit 80d1a36bd4
9 changed files with 668 additions and 423 deletions

View File

@ -80,10 +80,10 @@
<AdditionalIncludeDirectories>dxsdk3\sdk\inc;bass\inc</AdditionalIncludeDirectories>
<UndefinePreprocessorDefinitions>UNICODE;_UNICODE</UndefinePreprocessorDefinitions>
<PrecompiledHeaderFile />
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<Optimization>Disabled</Optimization>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<IntrinsicFunctions>false</IntrinsicFunctions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>

View File

@ -218,20 +218,20 @@ int CDecor::GetTypeBarre(POINT pos)
BOOL CDecor::IsLave(POINT pos)
{
pos.x += 30;
pos.x += DIMBLUPIX / 2;
return pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 68;
}
BOOL CDecor::IsPiege(POINT pos)
{
pos.x += 30;
pos.y += 60;
pos.x += DIMBLUPIX / 2;
pos.y += DIMBLUPIY;
return pos.x % 64 >= 15 && pos.x % 64 <= 49 && pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 373;
}
BOOL CDecor::IsGoutte(POINT pos, BOOL bAlways)
{
pos.x += 30;
pos.x += DIMBLUPIX / 2;
if (pos.x % 64 < 15 || pos.x % 64 > 49)
{
return FALSE;
@ -250,23 +250,23 @@ BOOL CDecor::IsGoutte(POINT pos, BOOL bAlways)
BOOL CDecor::IsScie(POINT pos)
{
pos.x += 30;
pos.x += DIMBLUPIX / 2;
return pos.x % 64 >= 4 && pos.x % 64 <= 60 && pos.x >= 0 && pos.x < 6400 && pos.y >= 0 && pos.y < 6400 && m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 378;
}
BOOL CDecor::IsSwitch(POINT pos, POINT celSwitch)
BOOL CDecor::IsSwitch(POINT pos, POINT *outCelSwitch)
{
pos.x += 30;
if (pos.x % 64 < 4 || pos.x % 64 > 60)
pos.x += DIMBLUPIX / 2;
if (pos.x % DIMOBJX < 4 || pos.x % DIMOBJX > DIMOBJX - 4)
{
return FALSE;
}
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 FALSE;
}
celSwitch.x = pos.x / DIMOBJX;
celSwitch.y = pos.y / DIMOBJY;
outCelSwitch->x = pos.x / DIMOBJX;
outCelSwitch->y = pos.y / DIMOBJY;
return m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 384 || m_decor[pos.x / DIMOBJX][pos.y / DIMOBJY].icon == 385;
}
@ -372,7 +372,7 @@ int CDecor::IsTeleporte(POINT pos)
return -1;
}
BOOL CDecor::SearchTeleporte(POINT pos, POINT newpos)
BOOL CDecor::SearchTeleporte(POINT pos, POINT *newpos)
{
int num = IsTeleporte(pos);
if (num == -1)
@ -385,9 +385,9 @@ BOOL CDecor::SearchTeleporte(POINT pos, POINT newpos)
{
if (num == m_decor[i][j].icon)
{
newpos.x = i * 64;
newpos.y = j * 64 + 60;
if (newpos.x < pos.x - 40 || newpos.x > pos.x + 40 || newpos.y < pos.y - 40 || newpos.y > pos.y + 40)
newpos->x = i * 64;
newpos->y = j * 64 + 60;
if (newpos->x < pos.x - 40 || newpos->x > pos.x + 40 || newpos->y < pos.y - 40 || newpos->y > pos.y + 40)
{
return TRUE;
}
@ -462,7 +462,7 @@ BOOL CDecor::IsBlocIcon(int icon)
return FALSE;
}
}
return FALSE;
return TRUE;
}
BOOL CDecor::IsVentillo(POINT pos)

File diff suppressed because it is too large Load Diff

View File

@ -13,13 +13,13 @@ void CDecor::MoveObjectPollution()
BOOL bPollution;
int num = 20;
bPollution = FALSE;
if (m_blupiAction == 3)
if (m_blupiAction == ACTION_TURN)
{
return;
}
if (m_blupiHelico)
{
if (m_blupiVitesse.y < -5.0)
if (m_blupiVitesse.y < -5)
{
if (m_time % 20 != 0 &&
m_time % 20 != 2 &&
@ -33,7 +33,7 @@ void CDecor::MoveObjectPollution()
return;
}
}
else if (m_blupiVitesse.x == 0.0)
else if (m_blupiVitesse.x == 0)
{
if (m_time % 50 != 0 &&
m_time % 50 != 12 &&
@ -63,26 +63,26 @@ void CDecor::MoveObjectPlouf(POINT pos)
{
for (int i = 0; i < MAXMOVEOBJECT; i++)
{
if (m_moveObject[i].type == 14)
if (m_moveObject[i].type == TYPE_PLOUF)
{
return;
}
}
pos.y -= 45;
PlaySound(23, pos);
ObjectStart(pos, 14, 0);
PlaySound(SOUND_PLOUF, pos);
ObjectStart(pos, TYPE_PLOUF, 0);
}
void CDecor::MoveObjectTiplouf(POINT pos)
{
for (int i = 0; i < MAXMOVEOBJECT; i++)
{
if (m_moveObject[i].type == 35)
if (m_moveObject[i].type == TYPE_TIPLOUF)
{
return;
}
}
if (m_blupiDir == 2)
if (m_blupiDir == DIR_RIGHT)
{
pos.x += 5;
}
@ -91,13 +91,13 @@ void CDecor::MoveObjectTiplouf(POINT pos)
pos.x -= 5;
}
pos.y -= 45;
PlaySound(64, pos);
ObjectStart(pos, 35, 0);
PlaySound(SOUND_TIPLOUF, pos);
ObjectStart(pos, TYPE_TIPLOUF, 0);
}
void CDecor::MoveObjectBlup(POINT pos)
{
PlaySound(24, pos);
PlaySound(SOUND_BLUP, pos);
pos.y -= 20;
int num = 0;
POINT tinyPoint = pos;
@ -121,7 +121,7 @@ void CDecor::MoveObjectBlup(POINT pos)
{
return;
}
m_moveObject[num2].type = 15;
m_moveObject[num2].type = TYPE_BLUP;
m_moveObject[num2].phase = 0;
m_moveObject[num2].posCurrent.x = pos.x;
m_moveObject[num2].posCurrent.y = pos.y;
@ -130,7 +130,7 @@ void CDecor::MoveObjectBlup(POINT pos)
m_moveObject[num2].posEnd.y = pos.y - num * DIMOBJY;
m_moveObject[num2].timeStopStart = 0;
m_moveObject[num2].stepAdvance = num * 10;
m_moveObject[num2].step = 2;
m_moveObject[num2].step = STEP_ADVANCE;
m_moveObject[num2].time = 0;
MoveObjectStepIcon(num2);
}
@ -138,32 +138,29 @@ void CDecor::MoveObjectBlup(POINT pos)
void CDecor::FlushBalleTraj()
{
for (int i = 0; i < 1300; i++)
{
m_balleTraj[i] = 0;
}
ZeroMemory(m_balleTraj, sizeof(m_balleTraj));
}
void CDecor::SetBalleTraj(POINT pos)
void CDecor::SetBalleTraj(POINT cel)
{
if (pos.x < 0 || pos.x >= 100 || pos.y < 0 || pos.y >= 100)
{
return;
}
int num = pos.y * 13;
num += pos.x / 8;
int num2 = pos.x & 7;
if (!IsValidCel(cel)) return;
int num = cel.y * TRAJBYTEX;
num += cel.x / 8;
int num2 = cel.x & 7;
m_balleTraj[num] |= 1 << num2;
}
BOOL CDecor::IsBalleTraj(POINT pos)
{
POINT cel;
pos.x = (pos.x + DIMOBJX / 2) / DIMOBJX;
pos.y = (pos.y + DIMOBJY / 2) / DIMOBJY;
if (!IsValidCel(pos)) return FALSE;
int num = pos.y * 13;
num += pos.x / 8;
int num2 = pos.x & 7;
cel.x = pos.x / DIMOBJX;
cel.y = pos.y / DIMOBJY;
if (!IsValidCel(cel)) return FALSE;
int num = cel.y * TRAJBYTEX;
num += cel.x / 8;
int num2 = cel.x & 7;
return (m_balleTraj[num] & 1 << num2) != 0;
}
@ -172,57 +169,59 @@ void CDecor::FlushMoveTraj()
memset(m_moveTraj, 0, sizeof(m_moveTraj));
}
void CDecor::SetMoveTraj(POINT pos)
void CDecor::SetMoveTraj(POINT cel)
{
if (pos.x < 0 || pos.x >= 100 || pos.y < 0 || pos.y >= 100)
{
return;
}
int num = pos.y * 13;
num += pos.x / 8;
int num2 = pos.x & 7;
if (!IsValidCel(cel)) return;
int num = cel.y * TRAJBYTEX;
num += cel.x / 8;
int num2 = cel.x & 7;
m_moveTraj[num] |= 1 << num2;
}
BOOL CDecor::IsMoveTraj(POINT pos)
{
pos.x = (pos.x + 32) / 64;
pos.y = (pos.y + 32) / 64;
if (pos.x < 0 || pos.x >= 100 || pos.y < 0 || pos.y >= 100)
{
return FALSE;
}
int num = pos.y * 13;
num += pos.x / 8;
int num2 = pos.x & 7;
POINT cel;
pos.x = (pos.x + DIMOBJX / 2) / DIMOBJX;
pos.y = (pos.y + DIMOBJY / 2) / DIMOBJY;
cel.x = pos.x / DIMOBJX;
cel.y = pos.y / DIMOBJY;
if (!IsValidCel(cel)) return FALSE;
int num = cel.y * TRAJBYTEX;
num += cel.x / 8;
int num2 = cel.x & 7;
return (m_moveTraj[num] & 1 << num2) != 0;
}
int CDecor::SearchDistRight(POINT pos, POINT dir, int type)
{
POINT cel;
int num = 0;
if (type == 36 || type == 39 || type == 41 || type == 42 || type == 93)
if (type == TYPE_POLLUTION ||
type == TYPE_TRESORTRACK ||
type == TYPE_INVERTSTART ||
type == TYPE_INVERTSTOP ||
type == TYPE_INVERTSPIN ||
type == TYPE_EXPLO8)
{
return 500;
}
pos.x = (pos.x + 32) / 64;
pos.y = (pos.y + 32) / 64;
while (pos.x >= 0 && pos.x < 100 && pos.y >= 0 && pos.y < 100 && !IsBlocIcon(m_decor[pos.x][pos.y].icon))
cel.x = (pos.x + DIMOBJX / 2) / DIMOBJX;
cel.y = (pos.y + DIMOBJY / 2) / DIMOBJY;
while (IsValidCel(cel) && !IsBlocIcon(m_decor[cel.x][cel.y].icon))
{
if (type == 23)
if (type == TYPE_BALLE)
{
SetBalleTraj(pos);
SetBalleTraj(cel);
}
num += 64;
pos.x += dir.x;
pos.y += dir.y;
num += DIMOBJX;
cel += dir;
}
if ((type == 34 || type == 38) && num >= 64)
if ((type == TYPE_GLU || type == TYPE_ELECTRO) && num >= DIMOBJX)
{
num -= 64;
num -= DIMOBJX;
}
if (type == 23 && num >= 10)
if (type == TYPE_BALLE && num >= 10)
{
num -= 10;
}
@ -235,30 +234,27 @@ void CDecor::StartSploutchGlu(POINT pos)
POINT pos2;
pos2.x = pos.x;
pos2.y = pos.y;
ObjectStart(pos2, 98, 0);
ObjectStart(pos2, TYPE_SPLOUTCH1, 0);
pos2.x = pos.x + 15;
pos2.y = pos.y + 20;
ObjectStart(pos2, 99, 0);
ObjectStart(pos2, TYPE_SPLOUTCH2, 0);
pos2.x = pos.x - 20;
pos2.y = pos.y + 18;
ObjectStart(pos2, 99, 0);
ObjectStart(pos2, TYPE_SPLOUTCH2, 0);
pos2.x = pos.x + 23;
pos2.y = pos.y - 18;
ObjectStart(pos2, 99, 0);
ObjectStart(pos2, TYPE_SPLOUTCH2, 0);
pos2.x = pos.x - 15;
pos2.y = pos.y - 18;
ObjectStart(pos2, 99, 0);
ObjectStart(pos2, TYPE_SPLOUTCH2, 0);
pos2.x = pos.x + 32;
pos2.y = pos.y + 10;
ObjectStart(pos2, 100, 0);
ObjectStart(pos2, TYPE_SPLOUTCH3, 0);
pos2.x = pos.x - 28;
pos2.y = pos.y + 15;
ObjectStart(pos2, 100, 0);
StopSound(16);
StopSound(18);
StopSound(29);
StopSound(31);
PlaySound(51, pos);
ObjectStart(pos2, TYPE_SPLOUTCH3, 0);
StopVehicleSound();
PlaySound(SOUND_GLU, pos);
}
BOOL CDecor::ObjectStart(POINT pos, int type, int speed)
@ -330,7 +326,7 @@ BOOL CDecor::ObjectStart(POINT pos, int type, int speed, BOOL bMulti)
{
m_moveObject[num].posEnd = tinyPoint;
m_moveObject[num].timeStopStart = 0;
m_moveObject[num].stepAdvance = abs(dist * num2 / 64);
m_moveObject[num].stepAdvance = abs(dist * num2 / DIMOBJX);
m_moveObject[num].step = STEP_ADVANCE;
m_moveObject[num].time = 0;
}
@ -400,7 +396,7 @@ void CDecor::MoveObjectStep()
posCurrent.x += 2;
posCurrent.y += BLUPIOFFY;
ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type);
ObjectStart(posCurrent, 37, 0);
ObjectStart(posCurrent, TYPE_CLEAR, 0);
ObjectDelete(m_moveObject[num].posCurrent, m_moveObject[num].type);
}
if (BlupiElectro(m_moveObject[i].posCurrent))
@ -409,8 +405,8 @@ void CDecor::MoveObjectStep()
posCurrent.x += 2;
posCurrent.y += BLUPIOFFY;
ObjectDelete(m_moveObject[i].posCurrent, m_moveObject[i].type);
ObjectStart(posCurrent, 38, 55);
PlaySound(59, posCurrent);
ObjectStart(posCurrent, TYPE_ELECTRO, 55);
PlaySound(SOUND_ELECTRO, posCurrent);
}
}
}
@ -503,9 +499,7 @@ void CDecor::MoveObjectStepLine(int i)
m_moveObject[i].time ++;
if (m_moveObject[i].stepAdvance != 0)
{
//m_moveObject[i].posCurrent = (m_moveObject[i].posEnd - m_moveObject[i].posStart) * m_moveObject[i].time / m_moveObject[i].stepAdvance + m_moveObject[i].posStart;
m_moveObject[i].posCurrent.x = (m_moveObject[i].posEnd.x - m_moveObject[i].posStart.x) * m_moveObject[i].time / m_moveObject[i].stepAdvance + m_moveObject[i].posStart.x;
m_moveObject[i].posCurrent.y = (m_moveObject[i].posEnd.y - m_moveObject[i].posStart.y) * m_moveObject[i].time / m_moveObject[i].stepAdvance + m_moveObject[i].posStart.y;
m_moveObject[i].posCurrent = (m_moveObject[i].posEnd - m_moveObject[i].posStart) * m_moveObject[i].time / m_moveObject[i].stepAdvance + m_moveObject[i].posStart;
}
}
@ -545,11 +539,7 @@ void CDecor::MoveObjectStepLine(int i)
m_moveObject[i].time ++;
if (m_moveObject[i].stepRecede != 0)
{
//m_moveObject[i].posCurrent = (m_moveObject[i].posStart - m_moveObject[i].posEnd) * m_moveObject[i].time / m_moveObject[i].stepRecede + m_moveObject[i].posEnd;
m_moveObject[i].posCurrent.x = (m_moveObject[i].posStart.x - m_moveObject[i].posEnd.x) *
m_moveObject[i].time / m_moveObject[i].stepRecede + m_moveObject[i].posEnd.x;
m_moveObject[i].posCurrent.y = (m_moveObject[i].posStart.y - m_moveObject[i].posEnd.y) *
m_moveObject[i].time / m_moveObject[i].stepRecede + m_moveObject[i].posEnd.y;
m_moveObject[i].posCurrent = (m_moveObject[i].posStart - m_moveObject[i].posEnd) * m_moveObject[i].time / m_moveObject[i].stepRecede + m_moveObject[i].posEnd;
}
}
else
@ -798,7 +788,7 @@ void CDecor::MoveObjectStepIcon(int i)
}
if (m_moveObject[i].type == TYPE_EXPLO1)
{
if (m_moveObject[i].phase >= table_explo1[0])
if (m_moveObject[i].phase >= 36)
{
m_moveObject[i].type = 0;
}
@ -1112,7 +1102,7 @@ void CDecor::MoveObjectStepIcon(int i)
}
m_moveObject[i].channel = CHELEMENT;
}
if (m_moveObject[i].type == 20)
if (m_moveObject[i].type == TYPE_OISEAU)
{
if (m_moveObject[i].posStart.x > m_moveObject[i].posEnd.x)
{
@ -1202,11 +1192,11 @@ void CDecor::MoveObjectStepIcon(int i)
{
if (m_moveObject[i].step == STEP_STOPSTART)
{
m_moveObject[i].icon = table_creature_turn2[m_moveObject[i].time % 152];
m_moveObject[i].icon = table_creature_turn2[m_moveObject[i].time % 200];
}
if (m_moveObject[i].step == STEP_STOPEND)
{
m_moveObject[i].icon = table_creature_turn2[m_moveObject[i].time % 152];
m_moveObject[i].icon = table_creature_turn2[m_moveObject[i].time % 200];
}
if (m_moveObject[i].step == STEP_ADVANCE)
{
@ -1221,11 +1211,11 @@ void CDecor::MoveObjectStepIcon(int i)
{
if (m_moveObject[i].step == STEP_STOPSTART)
{
m_moveObject[i].icon = table_creature_turn2[m_moveObject[i].time % 152];
m_moveObject[i].icon = table_creature_turn2[m_moveObject[i].time % 200];
}
if (m_moveObject[i].step == STEP_STOPEND)
{
m_moveObject[i].icon = table_creature_turn2[m_moveObject[i].time % 152];
m_moveObject[i].icon = table_creature_turn2[m_moveObject[i].time % 200];
}
if (m_moveObject[i].step == STEP_ADVANCE)
{
@ -1457,7 +1447,7 @@ void CDecor::DynamiteStart(int i, int dx, int dy)
ObjectStart(posStart, TYPE_EXPLO1, 0);
if (dx == 0 && dy == 0)
{
PlaySound(10, posStart);
PlaySound(SOUND_BOUM, posStart);
m_decorAction = 1;
m_decorPhase = 0;
}
@ -1495,7 +1485,7 @@ void CDecor::DynamiteStart(int i, int dx, int dy)
m_moveObject[i].type == TYPE_BOMBEFOLLOW1 ||
m_moveObject[i].type == TYPE_BOMBEFOLLOW2 ||
m_moveObject[i].type == TYPE_BULLDOZER ||
m_moveObject[i].type == TYPE_EGG |
m_moveObject[i].type == TYPE_EGG ||
m_moveObject[i].type == TYPE_CAISSE ||
m_moveObject[i].type == TYPE_HELICO ||
m_moveObject[i].type == TYPE_BOMBEMOVE ||
@ -1852,7 +1842,7 @@ int CDecor::MockeryDetect(POINT pos)
int icon = m_decor[tinyPoint.x / DIMOBJX][tinyPoint.y / DIMOBJY].icon;
if (icon == 68 || icon == 317)
{
return 64;
return ACTION_MOCKERYi;
}
}
}
@ -1889,31 +1879,31 @@ int CDecor::MockeryDetect(POINT pos)
{
if (m_moveObject[i].type == TYPE_CREATURE)
{
return 83;
return ACTION_MOCKERYp;
}
if (m_blupiDir == DIR_RIGHT)
{
if (pos.x >= src2.left)
{
return 64;
return ACTION_MOCKERYi;
}
if (m_moveObject[i].type == TYPE_BOMBEDOWN)
{
return 0;
}
return 63;
return ACTION_MOCKERY;
}
else
{
if (pos.x < src2.left)
{
return 64;
return ACTION_MOCKERYi;
}
if (m_moveObject[i].type == TYPE_BOMBEDOWN)
{
return 0;
}
return 63;
return ACTION_MOCKERY;
}
}
}
@ -1949,7 +1939,7 @@ void CDecor::MoveObjectFollow(POINT pos)
src.right = pos.x + DIMBLUPIX - 16;
for (int i = 0; i < MAXMOVEOBJECT; i++)
{
if (m_moveObject[i].type == 96)
if (m_moveObject[i].type == TYPE_BOMBEFOLLOW1)
{
RECT src2;
src2.left = m_moveObject[i].posCurrent.x - 100;
@ -1999,18 +1989,18 @@ int CDecor::MoveObjectDetect(POINT pos, BOOL* pbNear)
{
if (m_blupiAction == ACTION_DOWN)
{
//goto IL_427;
continue;
}
src3.top = m_moveObject[i].posCurrent.y;
src3.bottom = m_moveObject[i].posCurrent.y + 69 - 36;
}
if (m_moveObject[i].type == TYPE_HELICO)
if (m_moveObject[i].type == TYPE_CAISSE)
{
src3.left = m_moveObject[i].posCurrent.x - 16;
src3.right = m_moveObject[i].posCurrent.x + DIMOBJX + 16;
src3.top = m_moveObject[i].posCurrent.y;
src3.bottom = m_moveObject[i].posCurrent.y + DIMOBJY;
if (m_blupiDir == 1)
if (m_blupiDir == DIR_LEFT)
{
src3.left += 20;
}
@ -2030,7 +2020,7 @@ int CDecor::MoveObjectDetect(POINT pos, BOOL* pbNear)
if (m_moveObject[i].type == TYPE_BALLE)
{
src3.left = m_moveObject[i].posCurrent.x + 24;
src3.right = m_moveObject[i].posCurrent.x + DIMOBJX - 24;
src3.right = m_moveObject[i].posCurrent.x + DIMBLUPIX - 24;
src3.top = m_moveObject[i].posCurrent.y + 10;
src3.bottom = m_moveObject[i].posCurrent.y + DIMBLUPIY - 32;
}
@ -2141,7 +2131,7 @@ int CDecor::MoveBalleDetect(POINT pos)
int i;
if (m_phase == WM_PHASE_BUILD)
return -1;
rcSrc2.right = pos.x + 44;
rcSrc2.right = pos.x + DIMBLUPIX - 16;
rcSrc2.left = pos.x + 20;
rcSrc2.top = pos.y + 10;
rcSrc2.bottom = pos.y + 28;
@ -2154,9 +2144,9 @@ int CDecor::MoveBalleDetect(POINT pos)
m_moveObject->type == TYPE_BLUPIHELICO ||
m_moveObject->type == TYPE_BLUPITANK)
{
rcSrc1.right = m_moveObject->posCurrent.x + 44;
rcSrc1.right = m_moveObject->posCurrent.x + DIMBLUPIX - 16;
rcSrc1.left = m_moveObject->posCurrent.x + 16;
rcSrc1.bottom = m_moveObject->posCurrent.y + 50;
rcSrc1.bottom = m_moveObject->posCurrent.y + DIMBLUPIY - 10;
rcSrc1.top = m_moveObject->posCurrent.y + 16;
rcDst = RECT( 0, 0, 0, 0 );
if (IntersectRect(&rcDst, &rcSrc1, &rcSrc2))
@ -2219,7 +2209,7 @@ int CDecor::SortGetType(int type)
void CDecor::MoveObjectSort()
{
MoveObject src;
MoveObject dst;
int i;
int num = 0;
@ -2246,9 +2236,9 @@ void CDecor::MoveObjectSort()
{
if (SortGetType(m_moveObject[i].type) > SortGetType(m_moveObject[i + 1].type))
{
MoveObjectCopy(&src, &m_moveObject[i]);
MoveObjectCopy(&dst, &m_moveObject[i]);
MoveObjectCopy(&m_moveObject[i], &m_moveObject[i + 1]);
MoveObjectCopy(&m_moveObject[i + 1], &src);
MoveObjectCopy(&m_moveObject[i + 1], &dst);
flag = TRUE;
}
}
@ -2260,25 +2250,21 @@ void CDecor::MoveObjectSort()
void CDecor::MoveObjectPriority(int rank)
{
MoveObject tempMob;
if (rank != 0)
int i;
if (rank)
{
if (m_moveObject[rank].type == TYPE_BALLE)
for (i = 0; i < MAXMOVEOBJECT; i++)
{
int i = 0;
for (int i = 0; i < MAXMOVEOBJECT; i++)
if (m_moveObject[i].type == TYPE_BALLE) return;
}
if (i <= rank)
{
MoveObjectCopy(&tempMob, &m_moveObject[rank]);
MoveObjectCopy(&m_moveObject[rank], &m_moveObject[i]);
MoveObjectCopy(&m_moveObject[i], &tempMob);
if (m_moveObject[rank].type == TYPE_CAISSE || m_moveObject[i].type == TYPE_CAISSE)
{
if (m_moveObject[i].type != TYPE_BALLE) break;
}
if (i <= rank)
{
MoveObjectCopy(&tempMob, &m_moveObject[rank]);
MoveObjectCopy(&m_moveObject[rank], &m_moveObject[i]);
MoveObjectCopy(&m_moveObject[i], &tempMob);
if (m_moveObject[rank].type == TYPE_CAISSE || tempMob.type == TYPE_CAISSE)
{
UpdateCaisse();
}
UpdateCaisse();
}
}
}

View File

@ -75,10 +75,10 @@ void CDecor::Create(HWND hWnd, CSound* pSound, CPixmap* pPixmap, CNetwork* pNetw
m_bJeepStop = FALSE;
InitDecor();
m_jauges[0].Create(m_hWnd, m_pPixmap, m_pSound, POINT( 169, 450 ), 1, FALSE);
m_jauges[0].SetHide(TRUE);
m_jauges[1].Create(m_hWnd, m_pPixmap, m_pSound, POINT( 171, 450 ), 3, FALSE);
m_jauges[1].SetHide(TRUE);
m_jauges[JAUGE_AIR].Create(m_hWnd, m_pPixmap, m_pSound, POINT( 169, 450 ), 1, FALSE);
m_jauges[JAUGE_AIR].SetHide(TRUE);
m_jauges[JAUGE_POWER].Create(m_hWnd, m_pPixmap, m_pSound, POINT( 171, 450 ), 3, FALSE);
m_jauges[JAUGE_POWER].SetHide(TRUE);
NetMessageIndexFlush();
NotifFlush();
}
@ -332,8 +332,8 @@ void CDecor::PlayPrepare(BOOL bTest)
NetDataFlush();
NotifFlush();
m_voyageIcon = -1;
m_jauges[0].SetHide(TRUE);
m_jauges[1].SetHide(TRUE);
m_jauges[JAUGE_AIR].SetHide(TRUE);
m_jauges[JAUGE_POWER].SetHide(TRUE);
m_bFoundCle = FALSE;
m_term = 0;
m_time = 0;
@ -582,13 +582,13 @@ void CDecor::Build(RECT rect)
tinyPoint.x += 2;
tinyPoint.y += BLUPIOFFY;
}
if (m_moveObject[i].type == 54)
if (m_moveObject[i].type == TYPE_CREATURE)
{
tinyPoint.y += BLUPIOFFY;
}
// get the winphone opacity stuff out of here
m_pPixmap->QuickIcon(m_moveObject[i].channel, m_moveObject[i].icon, tinyPoint);
if (m_moveObject[i].type == 30)
if (m_moveObject[i].type == TYPE_DRINK)
{
for (int L = 0; L < sizeof(table_drinkoffset) / sizeof(int); L++)
{
@ -599,7 +599,7 @@ void CDecor::Build(RECT rect)
m_pPixmap->QuickIcon(10, rank, pos2);
}
}
if (m_bDrawSecret && m_moveObject[i].type == 12 && m_moveObject[i].icon != 32 && m_moveObject[i].icon != 33 && m_moveObject[i].icon != 34)
if (m_bDrawSecret && m_moveObject[i].type == TYPE_CAISSE && m_moveObject[i].icon != 32 && m_moveObject[i].icon != 33 && m_moveObject[i].icon != 34)
{
m_pPixmap->QuickIcon(1, 214, tinyPoint);
}
@ -686,17 +686,23 @@ void CDecor::Build(RECT rect)
}
for (int num3 = 0; num3 < MAXMOVEOBJECT; num3++)
{
if ((m_moveObject[num3].type == 1 || m_moveObject[num3].type == 47 || m_moveObject[num3].type == 48) && 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)
if ((m_moveObject[num3].type == TYPE_ASCENSEUR ||
m_moveObject[num3].type == TYPE_ASCENSEURs ||
m_moveObject[num3].type == TYPE_ASCENSEURsi) &&
m_moveObject[num3].posCurrent.x >= posDecor.x - DIMOBJX &&
m_moveObject[num3].posCurrent.y >= posDecor.y - DIMOBJY &&
m_moveObject[num3].posCurrent.x <= posDecor.x + LXIMAGE &&
m_moveObject[num3].posCurrent.y <= posDecor.y + LYIMAGE)
{
tinyPoint.x = 0 + m_moveObject[num3].posCurrent.x - posDecor.x;
tinyPoint.y = 0 + m_moveObject[num3].posCurrent.y - posDecor.y;
m_pPixmap->QuickIcon(m_moveObject[num3].channel, m_moveObject[num3].icon, tinyPoint);
}
}
tinyPoint.x = 0 - posDecor.x % 64;
tinyPoint.x = 0 - posDecor.x % DIMOBJX;
for (i = posDecor.x / DIMOBJX; i < posDecor.x / DIMOBJX + LXIMAGE / DIMOBJX + 2; i++)
{
tinyPoint.y = 0 - posDecor.y % 64;
tinyPoint.y = 0 - posDecor.y % DIMOBJY;
for (j = posDecor.y / DIMOBJY; j < posDecor.y / DIMOBJY + LYIMAGE / DIMOBJY + 2; j++)
{
if (i >= 0 && i < MAXCELX && j >= 0 && j < MAXCELY && m_decor[i][j].icon != -1)
@ -805,7 +811,15 @@ void CDecor::Build(RECT rect)
}
for (i = 0; i < MAXMOVEOBJECT; i++)
{
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))
if (m_moveObject[i].type != 0 &&
m_moveObject[i].posCurrent.x >= posDecor.x - DIMOBJX &&
m_moveObject[i].posCurrent.y >= posDecor.y - DIMOBJY &&
m_moveObject[i].posCurrent.x <= posDecor.x + LXIMAGE &&
m_moveObject[i].posCurrent.y <= posDecor.y + LYIMAGE &&
((m_moveObject[i].type >= TYPE_EXPLO1 && m_moveObject[i].type <= TYPE_EXPLO3) ||
(m_moveObject[i].type >= TYPE_EXPLO5 && m_moveObject[i].type <= TYPE_EXPLO10) ||
(m_moveObject[i].type >= TYPE_SPLOUTCH1 && m_moveObject[i].type <= TYPE_SPLOUTCH3) ||
m_moveObject[i].type == TYPE_TENTACULE))
{
tinyPoint = m_moveObject[i].posCurrent - posDecor;
m_pPixmap->QuickIcon(m_moveObject[i].channel, m_moveObject[i].icon, tinyPoint);
@ -1056,7 +1070,7 @@ void CDecor::SetJoystickEnable(BOOL bJoystick)
void CDecor::SetDemoPlay(BOOL param)
{
m_bD814 = param;
m_bDemoPlay = param;
}
void CDecor::PlaySound(int sound, POINT pos, BOOL bLocal)
@ -1354,7 +1368,7 @@ void CDecor::CheatAction(int cheat)
m_blupiHide = FALSE;
m_blupiTimeShield = 100;
m_blupiPosMagic = m_blupiPos;
m_jauges[1].SetHide(FALSE);
m_jauges[JAUGE_POWER].SetHide(FALSE);
break;
case 13: // quicklollipop
m_blupiAction = ACTION_SUCETTE;
@ -1450,7 +1464,7 @@ void CDecor::CheatAction(int cheat)
}
if (!m_blupiShield && !m_blupiHide && !m_blupiCloud && !m_blupiPower)
{
m_jauges[1].SetHide(TRUE);
m_jauges[JAUGE_POWER].SetHide(TRUE);
}
if (!m_blupiHelico && !m_blupiOver)
{
@ -1647,13 +1661,13 @@ void CDecor::VoyageStep()
++m_nbVies;
v17.y = y;
v17.x = m_voyageEnd.x;
m_pSound->PlayImage(3, v17, -1);
m_pSound->PlayImage(SOUND_JUMPEND, v17, -1);
}
if (m_voyageIcon == 6 && m_voyageChannel == 10)
{
++m_nbTresor;
CDecor::OpenDoorsTresor();
m_pSound->PlayImage(3, m_voyageEnd, -1);
m_pSound->PlayImage(SOUND_JUMPEND, m_voyageEnd, -1);
}
if (m_voyageIcon == 215 && m_voyageChannel == 10)
{
@ -1662,47 +1676,47 @@ void CDecor::VoyageStep()
m_blupiCle |= CLE_RED;
v16.y = m_voyageEnd.y;
v16.x = x;
m_pSound->PlayImage(3, v16, -1);
m_pSound->PlayImage(SOUND_JUMPEND, v16, -1);
}
if (m_voyageIcon == 222 && m_voyageChannel == 10)
if (m_voyageIcon == 222 && m_voyageChannel == CHELEMENT)
{
v7 = m_voyageEnd.x;
m_blupiCle |= CLE_GREEN;
v15.y = m_voyageEnd.y;
v15.x = v7;
m_pSound->PlayImage(3, v15, -1);
m_pSound->PlayImage(SOUND_JUMPEND, v15, -1);
}
if (m_voyageIcon == 229 && m_voyageChannel == 10)
if (m_voyageIcon == 229 && m_voyageChannel == CHELEMENT)
{
v8 = m_voyageEnd.y;
m_blupiCle |= CLE_BLUE;
v14.y = v8;
v14.x = m_voyageEnd.x;
m_pSound->PlayImage(3, v14, -1);
m_pSound->PlayImage(SOUND_JUMPEND, v14, -1);
}
if (m_voyageIcon == GetIconPerso() && m_voyageChannel == 4)
if (m_voyageIcon == GetIconPerso() && m_voyageChannel == CHBUTTON)
{
v9 = m_voyageEnd.x;
++m_blupiPerso;
v13.y = m_voyageEnd.y;
v13.x = v9;
m_pSound->PlayImage(3, v13, -1);
m_pSound->PlayImage(SOUND_JUMPEND, v13, -1);
}
if (m_voyageIcon == 252 && m_voyageChannel == 10)
if (m_voyageIcon == 252 && m_voyageChannel == CHELEMENT)
{
v11 = m_voyageEnd.x;
++m_blupiDynamite;
v12.y = m_voyageEnd.y;
v12.x = v11;
m_pSound->PlayImage(3, v12, -1);
m_pSound->PlayImage(SOUND_JUMPEND, v12, -1);
}
if (m_voyageIcon == 177 && m_voyageChannel == 10)
if (m_voyageIcon == 177 && m_voyageChannel == CHELEMENT)
{
m_pSound->PlayImage(3, m_voyageEnd, -1);
m_pSound->PlayImage(SOUND_JUMPEND, m_voyageEnd, -1);
}
m_voyageIcon = -1;
}
else if (!(m_time % 2) && m_voyageIcon >= 230 && m_voyageIcon <= 241 && m_voyageChannel == 10)
else if (!(m_time % 2) && m_voyageIcon >= 230 && m_voyageIcon <= 241 && m_voyageChannel == CHELEMENT)
{
m_voyageIcon = m_voyageIcon + 1;
if (m_voyageIcon + 1 > 241)
@ -1762,7 +1776,7 @@ void CDecor::VoyageDraw()
}
v11.y = v10 + v8;
v11.x = pos;
ObjectStart(v11, 93, v9, 1);
ObjectStart(v11, TYPE_EXPLO8, v9, TRUE);
}
}
}
@ -1948,7 +1962,7 @@ void CDecor::OpenDoor(POINT cel)
m_moveObject[num].phase = 0;
m_moveObject[num].channel = CHOBJECT;
m_moveObject[num].icon = icon;
PlaySound(33, m_moveObject[num].posStart, FALSE);
PlaySound(SOUND_DOOR, m_moveObject[num].posStart, FALSE);
}
void CDecor::OpenDoorsWin()

View File

@ -291,7 +291,7 @@ public:
BOOL IsPiege(POINT pos);
BOOL IsGoutte(POINT pos, BOOL bAlways);
BOOL IsScie(POINT pos);
BOOL IsSwitch(POINT pos, POINT celSwitch);
BOOL IsSwitch(POINT pos, POINT *outCelSwitch);
BOOL IsEcraseur(POINT pos);
BOOL IsBlitz(POINT pos, BOOL bAlways);
BOOL IsRessort(POINT pos);
@ -299,7 +299,7 @@ public:
BOOL IsBridge(POINT pos, POINT *outCelBridge);
int IsDoor(POINT pos, POINT *outCelPorte);
int IsTeleporte(POINT pos);
BOOL SearchTeleporte(POINT pos, POINT newpos);
BOOL SearchTeleporte(POINT pos, POINT *newpos);
BOOL IsSurfWater(POINT pos);
BOOL IsDeepWater(POINT pos);
BOOL IsOutWater(POINT pos);
@ -561,7 +561,7 @@ protected:
BOOL m_bNetMovePredict; // ynosmooth
BOOL m_bNetDebug; // znetdebug
BOOL m_bJoystick;
int m_bD814;
int m_bDemoPlay;
int m_mission;
BYTE m_doors[200];
int m_nbVies;

View File

@ -87,22 +87,73 @@ extern int table_creature_right[] = { 247, 248, 249, 250, 251, 250, 249, 248 };
extern int table_creature_turn2[] =
{
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,
246, 246, 245, 245, 244, 244, 243, 243, 242, 242,
242, 242, 242, 242, 243, 243, 244, 244, 245, 245,
246, 246, 246, 246, 246, 246, 245, 245, 244, 244,
243, 243, 242, 242, 242, 242, 243, 243, 244, 244,
245, 245, 246, 246, 246, 246, 245, 245, 244, 244,
243, 243, 242, 242, 243, 243, 244, 244, 245, 245,
246, 246, 245, 245, 244, 244, 243, 243, 242, 242,
242, 242, 243, 243, 244, 244, 245, 245, 246, 246,
246, 246, 245, 245, 244, 244, 243, 243, 242, 242,
242, 242, 242, 242, 243, 243, 244, 244, 245, 245,
246, 246, 246, 246, 246, 246, 245, 245, 244, 244,
244, 244, 244, 244, 244, 244, 244, 244, 244, 244,
244, 244
0xF4, 0xF4, 0xF4,
0xF4, 0xF4, 0xF4,
0xF4, 0xF4, 0xF3,
0xF3, 0xF2, 0xF2,
0xF2, 0xF2, 0xF2,
0xF2, 0xF2, 0xF2,
0xF3, 0xF3, 0xF4,
0xF4, 0xF5, 0xF5,
0xF6, 0xF6, 0xF6,
0xF6, 0xF6, 0xF6,
0xF6, 0xF6, 0xF5,
0xF5, 0xF4, 0xF4,
0xF3, 0xF3, 0xF2,
0xF2, 0xF2, 0xF2,
0xF2, 0xF2, 0xF3,
0xF3, 0xF4, 0xF4,
0xF5, 0xF5, 0xF6,
0xF6, 0xF6, 0xF6,
0xF6, 0xF6, 0xF5,
0xF5, 0xF4, 0xF4,
0xF3, 0xF3, 0xF2,
0xF2, 0xF2, 0xF2,
0xF3, 0xF3, 0xF4,
0xF4, 0xF5, 0xF5,
0xF6, 0xF6, 0xF6,
0xF6, 0xF5, 0xF5,
0xF4, 0xF4, 0xF3,
0xF3, 0xF2, 0xF2,
0xF3, 0xF3, 0xF4,
0xF4, 0xF5, 0xF5,
0xF6, 0xF6, 0xF5,
0xF5, 0xF4, 0xF4,
0xF3, 0xF3, 0xF2,
0xF2, 0xF3, 0xF3,
0xF4, 0xF4, 0xF5,
0xF5, 0xF6, 0xF6,
0xF5, 0xF5, 0xF4,
0xF4, 0xF4, 0xF4,
0xF7, 0xF7, 0xF8,
0xF8, 0xF9, 0xF9,
0xFA, 0xFA, 0xFB,
0xFB, 0xFA, 0xFA,
0xF9, 0xF9, 0xF8,
0xF8, 0xF2, 0xF2,
0xF3, 0xF3, 0xF4,
0xF4, 0xF5, 0xF5,
0xF6, 0xF6, 0xF5,
0xF5, 0xF4, 0xF4,
0xF3, 0xF3, 0xF2,
0xF2, 0xF2, 0xF2,
0xF3, 0xF3, 0xF4,
0xF4, 0xF5, 0xF5,
0xF6, 0xF6, 0xF6,
0xF6, 0xF5, 0xF5,
0xF4, 0xF4, 0xF3,
0xF3, 0xF2, 0xF2,
0xF2, 0xF2, 0xF2,
0xF2, 0xF3, 0xF3,
0xF4, 0xF4, 0xF5,
0xF5, 0xF6, 0xF6,
0xF6, 0xF6, 0xF6,
0xF6, 0xF5, 0xF5,
0xF4, 0xF4, 0xF4,
0xF4, 0xF4, 0xF4,
0xF4, 0xF4, 0xF4,
0xF4, 0xF4, 0xF4,
0xF4, 0xF4
};
extern int table_blupih_left[] = { 66, 67, 68, 67, 66, 69, 70, 69 };
@ -499,7 +550,7 @@ extern int table_decor_ventb[] = { 122, 123, 124, 125 };
extern int table_marine[] =
{
0, 2, 5, 8, 3, 0
0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xcf, 0xce, 0xcd, 0xcc, 0xcb
};
extern int table_36418[] = { 10, 2, 3, 4, 5, 6, 7, 8, 9, 1, 11, 12, 13, 14 };

View File

@ -5,6 +5,7 @@
#define DEF_H
#include <windows.h>
#include <cmath> // ceil
// prevent WinAPI from overriding our functions
#undef PlaySound
@ -73,6 +74,8 @@
#define DIMDECORX 640
#define DIMDECORY 480
#define TRAJBYTEX ceil(MAXCELX / 8.0) // bytes to store one row of traj data
enum {
CHBACK = 0,
CHOBJECT,
@ -367,6 +370,7 @@ static char debugMobTypeNames[204][20] =
#define TYPE_INVERT 40
#define TYPE_INVERTSTART 41
#define TYPE_INVERTSTOP 42
#define TYPE_INVERTSPIN 43
#define TYPE_GUEPE 44 // wasp
#define TYPE_OVER 46 // hovercraft
#define TYPE_ASCENSEURs 47 // conveyor belt right
@ -1357,32 +1361,32 @@ POINT operator/(POINT p, const int& a)
return POINT( p.x / a, p.y / a );
}
POINT operator+=(POINT p, const POINT& a)
POINT& operator+=(POINT& p, const POINT& a)
{
return POINT( p.x += a.x, p.y += a.y );
}
POINT operator-=(POINT p, const POINT& a)
POINT& operator-=(POINT& p, const POINT& a)
{
return POINT( p.x -= a.x, p.y -= a.y );
}
POINT operator*=(POINT p, const POINT& a)
POINT& operator*=(POINT& p, const POINT& a)
{
return POINT( p.x *= a.x, p.y *= a.y );
}
POINT operator/=(POINT p, const POINT& a)
POINT& operator/=(POINT& p, const POINT& a)
{
return POINT( p.x /= a.x, p.y /= a.y );
}
POINT operator*=(POINT p, const int& a)
POINT& operator*=(POINT& p, const int& a)
{
return POINT( p.x *= a, p.y *= a );
}
POINT operator/=(POINT p, const int& a)
POINT& operator/=(POINT& p, const int& a)
{
return POINT( p.x /= a, p.y /= a );
}

View File

@ -2300,7 +2300,7 @@ void CEvent::ChatPush(char *str)
pText = this->m_chatZone[i];
LABEL_5:
strcpy(pText, str);
m_pSound->PlayImage(11, POINT( LXIMAGE / 2, LYIMAGE / 2 ), -1);
m_pSound->PlayImage(SOUND_TRESOR, POINT( LXIMAGE / 2, LYIMAGE / 2 ), -1);
}
void CEvent::ChatFlush()
@ -5305,7 +5305,7 @@ void CEvent::DemoRecEvent()
if (m_bDemoRec)
{
m_pDemoBuffer[m_demoIndex].time = m_demoTime;
m_pDemoBuffer[m_demoIndex].input == m_keyPress;
m_pDemoBuffer[m_demoIndex].input = m_keyPress;
m_demoIndex++;
if (m_demoIndex > MAXDEMO)
{