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

New day, 50 new code errors

This commit is contained in:
HMVocaloid 2024-06-11 11:38:13 -04:00
parent d6899455df
commit 5575ad5fca
6 changed files with 266 additions and 118 deletions

Binary file not shown.

215
decor.cpp
View File

@ -49,13 +49,11 @@ CDecor::CDecor()
m_bNetMovePredict = TRUE;
m_bNetDebug = FALSE;
m_bMulti = FALSE;
m_team = FALSE;
m_team = 0;
m_netPacketsSent = 0;
m_netPacketsSent2 = 0;
m_netPacketsRecieved = 0;
m_netPacketsRecieved2 = 0;
Init(CHFLOOR, 0);
BlupiFlush();
MoveFlush();
InitDrapeau();
@ -85,12 +83,14 @@ void CDecor::Create(HWND hWnd, CSound* pSound, CPixmap* pPixmap, CNetwork* pNetw
m_jauges->SetHide(TRUE);
}
// The only seemingly sane function.
BOOL CDecor::LoadImages()
{
POINT totalDim, iconDim;
char filename[52];
if (m_lastRegion != m_region) return TRUE;
if (m_lastRegion == m_region) return TRUE;
m_lastRegion = m_region;
totalDim.x = DIMCELX * 2 * 16;
@ -98,8 +98,7 @@ BOOL CDecor::LoadImages()
iconDim.x = DIMCELX * 2;
iconDim.y = DIMCELY * 2;
sprintf(filename, "decor%.3d.blp", m_region);
if (!m_pPixmap->Cache2(CHFLOOR, filename, totalDim, iconDim, FALSE))
return FALSE;
if (!m_pPixmap->Cache2(CHBACK, filename, totalDim, iconDim, FALSE)) return FALSE;
if (m_region == 0)
{
return FALSE;
@ -113,6 +112,8 @@ void CDecor::InitGamer()
}
// The fuck does this even do?
void CDecor::InitDecor(int channel, int icon)
{
int i;
@ -124,6 +125,7 @@ void CDecor::InitDecor(int channel, int icon)
m_music = 1;
m_region = 2;
m_missionTitle[0] = '\0';
m_decorAction = 0;
for (int i = 0; i < 100; i++)
{
for (int j = 0; j < 100; j++)
@ -135,7 +137,7 @@ void CDecor::InitDecor(int channel, int icon)
m_decor[3, 4]->icon = 40;
m_decor[4, 4]->icon = 38;
m_decor[5, 4]->icon = 39;
for (int k = 0; k < Decor.MAXMOVEOBJECT; k++)
for (int k = 0; k < MAXMOVEOBJECT; k++)
{
m_moveObject[k]->type = 0;
}
@ -226,6 +228,8 @@ int CDecor::GetTime()
return m_time;
}
// Basically the same as the other fucking function
void CDecor::PlayPrepare(BOOL bTest)
{
if (bTest)
@ -342,6 +346,8 @@ void CDecor::PlayPrepare(BOOL bTest)
m_scrollPoint.y = m_blupiPos.y + 30 + m_scrollAdd.y;
}
// Sort of makes sense.
void CDecor::BuildPrepare()
{
for (int i = 0; i < MAXMOVEOBJECT; i++)
@ -360,6 +366,8 @@ void CDecor::BuildPrepare()
m_bPause = FALSE;
}
// Fuck this function. That's all I can say.
void CDecor::Build()
{
POINT posDecor = DecorNextAction();
@ -743,7 +751,7 @@ BOOL CDecor::LoadBackgroundImages()
int CDecor::SetBlupiChannel()
{
if ( m_bMulti = 0 ||
m_blupiChannel == ch_blupi00 ||
m_blupiChannel == CHBLUPI ||
m_team > 0);{
return m_team + 10;
}
@ -752,14 +760,14 @@ int CDecor::SetBlupiChannel()
int CDecor::GetBlupiChannel()
{
int m_blupiChannel = CHBLUPI000;
int m_blupiChannel = CHBLUPI;
if ( m_bMulti != 0 ||
m_team > 0);{
return m_team + 10;
}
return CHBLUPI000;
return CHBLUPI;
}
@ -841,7 +849,7 @@ void CDecor::SetPause(BOOL bPause)
m_bPause = bPause;
}
/*
void CDecor::GetDoors(int doors)
{
for (int i = 0; i < m_doors; i++)
@ -849,7 +857,7 @@ void CDecor::GetDoors(int doors)
doors[i] = (int)
}
}
*/
void CDecor::SetAllMissions(BOOL CheatDoors)
{
@ -1386,6 +1394,189 @@ BOOL CDecor::DecorDetect(RECT rect, BOOL bCaisse)
return TRUE;
}
}
int num2 = rect.left / 16;
int num3 = (rect.right + 16 - 1) / 16;
int num4 = rect.top / 16;
int num5 = (rect.bottom + 16 - 1) / 16;
RECT src;
for (int i = num4; i <= num5; i++)
{
for (int j = num2; j <= num3; j++)
{
int num6 = j / 4;
int num7 = i / 4;
if (num6 >= 0 && num6 < 100 && num7 >= 0 && num7 < 100)
{
int icon = m_decor[num6, num7]->icon;
if (icon >= 0 && icon < MAXQUART && (!m_blupiHelico || icon != 214) && (m_blupiOver || icon != 214) && (icon != 324 || m_time / 4 % 20 < 18))
{
num6 = j % 4;
num7 = i % 4;
if (table_decor_quart[icon * 16 + num7 * 4 + num6] != 0)
{
src.left = j * 16;
src.right = src.left + 16;
src.top = i * 16;
src.bottom = src.top + 16;
RECT tinyRect;
if (IntersectRect(out tinyRect, src, rect))
{
m_detectIcon = icon;
return TRUE;
}
}
}
}
}
}
if (!bCaisse)
{
return FALSE;
}
for (int k = 0; k < m_nbRankCaisse; k++)
{
int num8 = m_rankCaisse[k];
src.left = m_moveObject[num8]->posCurrent.x;
src.right = m_moveObject[num8]->posCurrent.x + 64;
src.top = m_moveObject[num8]->posCurrent.y;
src.bottom = m_moveObject[num8]->posCurrent.y + 64;
RECT tinyRect;
if (IntersectRect(out tinyRect, src, rect))
{
m_detectIcon = m_moveObject[num8]->icon;
return TRUE;
}
}
return FALSE;
}
int CDecor::IsWorld(POINT pos)
{
pos.x += 30;
pos.y += 30;
if (pos.x < 0 || pos.x >= 6400 || pos.y < 0 || pos.y >= 6400)
{
return -1;
}
int icon = m_decor[pos.x / 64, pos.y / 64]->icon;
if (icon >= 158 && icon <= 165)
{
return icon - 158 + 1;
}
if (icon >= 166 && icon <= 173)
{
return icon - 166 + 1;
}
if (icon == 309 || icon == 310)
{
return 9;
}
if (icon >= 411 && icon <= 415)
{
return icon - 411 + 10;
}
if (icon >= 416 && icon <= 420)
{
return icon - 416 + 10;
}
if (icon >= 174 && icon <= 181)
{
return icon - 174 + 1;
}
if (icon == 184)
{
return 199;
}
return -1;
}
BOOL CDecor::SearchDoor(int n, POINT cel, POINT blupi)
{
for (int i = 0; i < 100; i++)
{
for (int j = 0; j < 100; j++)
{
int icon = m_decor[i, j]->icon;
if (icon >= 174 && icon <= 181 && icon - 174 + 1 == n)
{
if (i > 0 && m_decor[i - 1, j]->icon == 182)
{
cel.x = i - 1;
cel.y = j;
blupi.x = (i - 2) * 64 + 2;
blupi.y = j * 64 + BLUPIOFFY;
return TRUE;
}
if (i > 1 && m_decor[i - 2, j]->icon == 182)
{
cel.x = i - 2;
cel.y = j;
blupi.x = (i - 3) * 64 + 2;
blupi.y = j * 64 + BLUPIOFFY;
return TRUE;
}
if (i < 99 && m_decor[i + 1, j]->icon == 182)
{
cel.x = i + 1;
cel.y = j;
blupi.x = (i + 2) * 64 + 2;
blupi.y = j * 64 + BLUPIOFFY;
return TRUE;
}
if (i < 98 && m_decor[i + 2, j]->icon == 182)
{
cel.x = i + 2;
cel.y = j;
blupi.x = (i + 3) * 64 + 2;
blupi.y = j * 64 + BLUPIOFF;
return TRUE;
}
}
}
}
return FALSE;
}
void CDecor::OpenDoorsTresor()
{
for (int i = 0; i < 100; i++)
{
for (int j = 0; j < 100; j++)
{
int icon = m_decor[i, j]->icon;
if (icon >= 421 && icon <= 421 + m_nbTresor - 1)
{
POINT cel;
cel.x = i;
cel.y = j;
OpenDoor(cel);
}
}
}
}
void CDecor::OpenDoors(POINT cel)
{
int icon = m_decor[cel.x, cel.y]->icon;
m_decor[cel.x, cel.y]->icon = -1;
int num = MoveObjectFree();
}
void CDecor::OpenDoorsWin()
{
m_doors[m_mission + 1] = 1;
}
void CDecor::OpenGoldsWin()
{
m_doors[180 + m_mission / 10] = 1;
}
void CDecor::DoorsLost()
{
m_nbVies = 3;
}
void CDecor::GetBlupiInfo(BOOL bHelico, BOOL bJeep, BOOL bSkate, BOOL bNage)

View File

@ -566,6 +566,13 @@ public:
void BlupiAddFifo(POINT pos);
BOOL DecorDetect(RECT rect);
BOOL DecorDetect(RECT rect, BOOL bCaisse);
int IsWorld(POINT pos);
BOOL SearchDoor(int n, POINT cel, POINT blupi);
void OpenDoorsTresor();
void OpenDoors(POINT cel);
void OpenDoorsWin();
void OpenGoldsWin();
void DoorsLost();
void GetMissionsCleared();
void SetDemoState(BOOL demoState);
@ -574,7 +581,6 @@ protected:
int GetSeeIcon(char *pBits, int index);
protected:
static int MAXMOVEOBJECT[200];
static int MAXQUART[441];
HWND m_hWnd;
CSound* m_pSound;

161
def.h
View File

@ -37,6 +37,9 @@
#define DIMBLUPIY 60
#define SHIFTBLUPIY 5 // petit d<>calage vers le haut
#define DIMEXPLOX 128
#define DIMEXPLOY 128
#define DIMBUTTONX 40 // dimensions d'un button
#define DIMBUTTONY 40
@ -55,28 +58,23 @@
#define DIMLITTLEY 12
#define CHBACK 0
#define CHBLUPI000
#define CHBLUPI001
#define CHBLUPI002
#define CHBLUPI003
#define CHFLOOR 1
#define CHOBJECT 2
#define CHOBJECTo 3
#define CHBLUPI 4
#define CHHILI 5
#define CHFOG 6
#define CHMASK1 7
#define CHLITTLE 8
#define CHMAP 9
#define CHBUTTON 10
#define CHGROUND 11
#define CHJAUGE 12
#define CHTEXT 13
#define CHBIGNUM 14
#define CHEXPLO
#define CHELEMENT
#define CHOBJECT 1
#define CHBLUPI 2
#define CHDECOR 3
#define CHBUTTON 4
#define CHJAUGE 5
#define CHTEXT 6
#define CHEXPLO 9
#define CHELEMENT 10
#define CHBLUPI1 11
#define CHBLUPI2 12
#define CHBLUPI3 13
#define CHPAD 14
#define CHSPEEDYBLUPI 15
#define CHBLUPIYOUPIE 16
#define CHGEAR 17
#define FOGHIDE 4
#define MAXMOVEOBJECT 200
// Directions :
@ -217,91 +215,44 @@
// Sons :
#define SOUND_CLICK 0
#define SOUND_BOING 1
#define SOUND_OK1 2
#define SOUND_OK2 3
#define SOUND_OK3 4
#define SOUND_GO1 5
#define SOUND_GO2 6
#define SOUND_GO3 7
#define SOUND_TERM1 8
#define SOUND_TERM2 9
#define SOUND_TERM3 10
#define SOUND_COUPTERRE 11
#define SOUND_COUPTOC 12
#define SOUND_SAUT 13
#define SOUND_HOP 14
#define SOUND_SCIE 15
#define SOUND_FEU 16
#define SOUND_BRULE 17
#define SOUND_TCHAO 18
#define SOUND_MANGE 19
#define SOUND_NAISSANCE 20
#define SOUND_A_SAUT 21
#define SOUND_A_HIHI 22
#define SOUND_JUMP1 1
#define SOUND_JUMP2 2
#define SOUND_JUMPEND 3
#define SOUND_JUMPTOC 4
#define SOUND_TURN 5
#define SOUND_VERTIGO 6
#define SOUND_DOWN 7
#define SOUND_FALL 8
#define SOUND_NEW 9
#define SOUND_BOUM 10
#define SOUND_TRESOR 11
#define SOUND_EGG 12
#define SOUND_ENDKO 13
#define SOUND_ENDOK 14
#define SOUND_HELICOSTART 15
#define SOUND_HELICOHIGH 16
#define SOUND_HELICOSTOP 17
#define SOUND_HELICOLOW 18
#define SOUND_LASTTRESOR 19
#define SOUND_UP 20
#define SOUND_LOOKUP 21
#define SOUND_JUMP0 22
#define SOUND_PLOUF 23
#define SOUND_BUT 24
#define SOUND_RAYON1 25
#define SOUND_RAYON2 26
#define SOUND_VIRUS 27
#define SOUND_GLISSE 28
#define SOUND_BOIT 29
#define SOUND_LABO 30
#define SOUND_DYNAMITE 31
#define SOUND_PORTE 32
#define SOUND_FLEUR 33
#define SOUND_T_MOTEUR 34
#define SOUND_T_ECRASE 35
#define SOUND_PIEGE 36
#define SOUND_AIE 37
#define SOUND_A_POISON 38
#define SOUND_R_MOTEUR 39
#define SOUND_R_APLAT 40
#define SOUND_R_ROTATE 41
#define SOUND_R_CHARGE 42
#define SOUND_B_SAUT 43
#define SOUND_BATEAU 44
#define SOUND_JEEP 45
#define SOUND_MINE 46
#define SOUND_USINE 47
#define SOUND_E_RAYON 48
#define SOUND_E_TOURNE 49
#define SOUND_ARROSE 50
#define SOUND_BECHE 51
#define SOUND_D_BOING 52
#define SOUND_D_OK 53
#define SOUND_D_GO 54
#define SOUND_D_TERM 55
#define SOUND_BOING1 56
#define SOUND_BOING2 57
#define SOUND_BOING3 58
#define SOUND_OK4 59
#define SOUND_OK5 60
#define SOUND_OK6 61
#define SOUND_OK1f 62
#define SOUND_OK2f 63
#define SOUND_OK3f 64
#define SOUND_OK1e 65
#define SOUND_OK2e 66
#define SOUND_OK3e 67
#define SOUND_GO4 68
#define SOUND_GO5 69
#define SOUND_GO6 70
#define SOUND_TERM4 71
#define SOUND_TERM5 72
#define SOUND_TERM6 73
#define SOUND_COUPSEC 74
#define SOUND_COUPPIERRE 75
#define SOUND_COUPSOURD 76
#define SOUND_COUPBREF 77
#define SOUND_OPEN 78
#define SOUND_CLOSE 79
#define SOUND_TELEPORTE 80
#define SOUND_ARMUREOPEN 81
#define SOUND_ARMURECLOSE 82
#define SOUND_WIN 83
#define SOUND_LOST 84
#define SOUND_MOVIE 99
#define SOUND_BLUP 24
#define SOUND_SURF 25
#define SOUND_DROWN 26
#define SOUND_ERROR 27
#define SOUND_JEEPSTART 28
#define SOUND_JEEPHIGH 29
#define SOUND_JEEPSTOP 30
#define SOUND_JEEPLOW 31
#define SOUND_BYE 32
#define SOUND_DOOR 33
#define SOUND_SUSPENDTOC 34
#define SOUND_SUSPENDJUMP 35
#define SOUND_SINGE 36
#define SOUND_PATIENT 37
// Boutons (play) :