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

YAYYY YAY YAY! YAYYY!!!

This commit is contained in:
jummy 2024-10-06 12:00:05 -05:00
parent 396d7ce061
commit 43d26ddece
6 changed files with 423 additions and 429 deletions

View File

@ -91,6 +91,7 @@
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration> <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput> <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -134,6 +135,8 @@
<ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput> <ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>
<AdditionalOptions>/DYNAMICBASE "legacy_stdio_definitions.lib" %(AdditionalOptions) /VERBOSE</AdditionalOptions> <AdditionalOptions>/DYNAMICBASE "legacy_stdio_definitions.lib" %(AdditionalOptions) /VERBOSE</AdditionalOptions>
<AdditionalDependencies>dxsdk3/sdk/lib/*.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>dxsdk3/sdk/lib/*.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<TreatLinkerWarningAsErrors>false</TreatLinkerWarningAsErrors>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

View File

@ -113,23 +113,13 @@ 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) { if (file == NULL) goto error;
OutputDebug("CDecor::Read error in fopen\n");
OutputDebug(filename);
goto error;
}
pBuffer = (DescFile*)malloc(sizeof(DescFile)); pBuffer = (DescFile*)malloc(sizeof(DescFile));
if (pBuffer == NULL) { if (pBuffer == NULL) goto error;
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) { if (nb < 1) goto error;
OutputDebug("CDecor::Read error in fread\n");
goto error;
}
majRev = pBuffer->majRev; majRev = pBuffer->majRev;
minRev = pBuffer->minRev; minRev = pBuffer->minRev;
@ -146,30 +136,28 @@ BOOL CDecor::Read(int gamer, int mission, BOOL bUser)
startPos = m_blupiStartPos; startPos = m_blupiStartPos;
blupiPos = pBuffer->blupiPos; blupiPos = pBuffer->blupiPos;
for (i = 0; i < 4; i++) for (i = 0; i < MAXNETPLAYER; i++)
{ {
m_blupiStartPos[i] = pBuffer->blupiPos[i]; m_blupiStartPos[i] = pBuffer->blupiPos[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, file); nb = fread(m_decor, sizeof(Cellule), MAXCELX * MAXCELY, file);
if (nb < MAXCELX * MAXCELY) goto error; if (nb < MAXCELX * MAXCELY) goto error;
for (x = 0; x < MAXCELX / 2; x++) #if !_DREAM
for (x = 0; x < MAXCELX; x++)
{ {
for (y = 0; y < MAXCELY / 2; y++) for (y = 0; y < MAXCELY; y++)
{ {
if (m_decor[x][y].icon >= 48 && if (m_decor[x][y].icon >= Object::Dream_1 &&
m_decor[x][y].icon <= 67) m_decor[x][y].icon <= Object::Dream_20)
{ {
m_decor[x][y].icon -= 128 - 17; m_decor[x][y].icon = Object::KidsSquare_10;
} }
} }
} }
#endif
if (majRev == 1 && minRev >= 1) if (majRev == 1 && minRev >= 1)
{ {

File diff suppressed because it is too large Load Diff

View File

@ -428,24 +428,23 @@ void CDecor::Build(RECT rect)
m_pPixmap->SetClipping(rect); m_pPixmap->SetClipping(rect);
POINT posDecor = DecorNextAction(); POINT posDecor = DecorNextAction();
POINT pos = { posDecor.x * 2 / 3 % LXIMAGE, posDecor.y * 2 / 3 % LYIMAGE }; POINT pos = { posDecor.x * 2 / 3 % DIMDECORX, posDecor.y * 2 / 3 % DIMDECORY };
//TODO: more^
for (int i = 0; i < 2; i++) for (int i = 0; i < ((DIMDECORX - DIMDECORX / LXIMAGE * LXIMAGE) ? 2 : 1) + LXIMAGE / DIMDECORX; i++)
{ {
tinyPoint.y = 0; tinyPoint.y = 0;
rect.top = pos.y; rect.top = pos.y;
for (int j = 0; j < 2; j++) for (int j = 0; j < ((DIMDECORY - DIMDECORY / LYIMAGE * LYIMAGE) ? 2 : 1) + LYIMAGE / DIMDECORY; j++)
{ {
rect.left = pos.x; rect.left = i ? 0 : pos.x;
rect.right = LXIMAGE; rect.right = DIMDECORX;
rect.bottom = LYIMAGE; rect.bottom = DIMDECORY;
m_pPixmap->DrawPart(-1, CHDECOR, tinyPoint, rect, 1, FALSE); m_pPixmap->DrawPart(-1, CHDECOR, tinyPoint, rect, 1, FALSE);
tinyPoint.y += LYIMAGE - pos.y; tinyPoint.y = DIMDECORY * (j + 1) - pos.y;
rect.top = 0; rect.top = 0;
} }
tinyPoint.x += LXIMAGE - pos.x; tinyPoint.x = DIMDECORX * (i + 1) - pos.x;
pos.x = 0;
} }
tinyPoint.x = -posDecor.x % DIMOBJX - DIMOBJX; tinyPoint.x = -posDecor.x % DIMOBJX - DIMOBJX;

View File

@ -20,6 +20,7 @@
#define _CD FALSE // if TRUE, require the game CD #define _CD FALSE // if TRUE, require the game CD
#define _BYE !_EGAMES // if TRUE, show exit image (like _INTRO) #define _BYE !_EGAMES // if TRUE, show exit image (like _INTRO)
#define _LEGACY FALSE // if TRUE, keep broken/quirky legacy code #define _LEGACY FALSE // if TRUE, keep broken/quirky legacy code
#define _DREAM TRUE // if TRUE, allow Dream blocks when loading levels
#define MAXGAMER 8 #define MAXGAMER 8
#define MAXNETPLAYER 4 #define MAXNETPLAYER 4
@ -28,8 +29,8 @@
#define MAXNOTIF 5 #define MAXNOTIF 5
#define MAXFIFOPOS 10 #define MAXFIFOPOS 10
#define LXIMAGE 640 // dimensions de la fenêtre de jeu #define LXIMAGE 320 // dimensions de la fenêtre de jeu
#define LYIMAGE 480 #define LYIMAGE 240
#define POSDRAWX 0 #define POSDRAWX 0
#define POSDRAWY 0 #define POSDRAWY 0
@ -61,6 +62,9 @@
#define DIMLITTLEX 16 // dimensions max d'un petit caractère #define DIMLITTLEX 16 // dimensions max d'un petit caractère
#define DIMLITTLEY 12 #define DIMLITTLEY 12
#define DIMDECORX 640
#define DIMDECORY 480
enum { enum {
CHBACK = 0, CHBACK = 0,
CHOBJECT, CHOBJECT,

View File

@ -1765,8 +1765,6 @@ static Phase table[] =
CEvent::CEvent() CEvent::CEvent()
{ {
int i;
m_somethingJoystick = 0; m_somethingJoystick = 0;
m_bFullScreen = TRUE; m_bFullScreen = TRUE;
m_mouseType = MOUSETYPEGRA; m_mouseType = MOUSETYPEGRA;
@ -1840,8 +1838,6 @@ CEvent::~CEvent()
void CEvent::Create(HINSTANCE hInstance, HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, void CEvent::Create(HINSTANCE hInstance, HWND hWnd, CPixmap *pPixmap, CDecor *pDecor,
CSound *pSound, CNetwork *pNetwork, CMovie *pMovie ) CSound *pSound, CNetwork *pNetwork, CMovie *pMovie )
{ {
POINT pos;
m_hInstance = hInstance; m_hInstance = hInstance;
m_hWnd = hWnd; m_hWnd = hWnd;
m_pPixmap = pPixmap; m_pPixmap = pPixmap;
@ -1989,8 +1985,6 @@ void CEvent::SetMenu(int button, int menu)
void CEvent::RestoreGame() void CEvent::RestoreGame()
{ {
int i;
if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST) if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST)
{ {
HideMouse(FALSE); HideMouse(FALSE);
@ -2088,7 +2082,7 @@ void CEvent::ReadInput()
bJoyID = m_joyID; bJoyID = m_joyID;
joyInfo = &joy; joyInfo = &joy;
for (i != 0; i = 13; i++) for (i = 0; i != 13; i++)
{ {
joyInfo->dwSize = 0; joyInfo->dwSize = 0;
joyInfo = (JOYINFOEX*)&joyInfo->dwFlags; joyInfo = (JOYINFOEX*)&joyInfo->dwFlags;
@ -2378,9 +2372,7 @@ void CEvent::HandleChatBuffer()
void CEvent::OutputNetDebug(const char* str) void CEvent::OutputNetDebug(const char* str)
{ {
char* stream;
FILE* streamf; FILE* streamf;
UINT element;
streamf = (FILE*)m_pDecor->GetNetDebug(); streamf = (FILE*)m_pDecor->GetNetDebug();
@ -2425,19 +2417,12 @@ void CEvent::DrawTextCenter(int res, int x, int y, int font)
BOOL CEvent::DrawButtons() BOOL CEvent::DrawButtons()
{ {
int i; int i;
int levels[2]; int lg, sound;
int types[2];
int world, time, lg, button, volume, pente, icon, sound;
int nice;
BOOL soundEnabled; BOOL soundEnabled;
char res[100]; char res[100];
char textLeft[24];
char text[100]; char text[100];
char (*pText)[100];
POINT pos; POINT pos;
RECT rect; RECT rect;
BOOL bEnable;
int phase;
@ -2641,7 +2626,6 @@ BOOL CEvent::DrawButtons()
} }
if (m_phase == WM_PHASE_READDESIGN) if (m_phase == WM_PHASE_READDESIGN)
{ {
char buff[100];
LoadString(TX_OPENMISS, res, 100); LoadString(TX_OPENMISS, res, 100);
lg = GetTextWidth(res, 0); lg = GetTextWidth(res, 0);
pos.x = 320 - lg / 2; pos.x = 320 - lg / 2;
@ -2934,9 +2918,7 @@ BOOL CEvent::DrawButtons()
void CEvent::PutTextInputBox(POINT pos) void CEvent::PutTextInputBox(POINT pos)
{ {
char textInput[100]; char textInput[100];
char* textConst;
int text; int text;
CPixmap* pPixmap;
int num; int num;
UINT textHili; UINT textHili;
LONG posD; LONG posD;
@ -3039,7 +3021,7 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam)
{ {
POINT pos; POINT pos;
int fwKeys; int fwKeys;
int i, sound; int i;
char c; char c;
BOOL bEnable; BOOL bEnable;
@ -3980,7 +3962,7 @@ void CEvent::FillMouse(int bFill)
BOOL CEvent::EventButtons(UINT message, WPARAM wParam, LPARAM lParam) BOOL CEvent::EventButtons(UINT message, WPARAM wParam, LPARAM lParam)
{ {
POINT pos, test; POINT pos, test;
int i, lg, oldx, sound, res; int i, lg, oldx, res;
UINT uid; UINT uid;
m_textToolTips[0] = 0; m_textToolTips[0] = 0;
@ -4208,14 +4190,11 @@ void CEvent::SomethingUserMissions(char* lpFilename, LPCSTR fileSomething)
BOOL CEvent::ChangePhase(UINT phase) BOOL CEvent::ChangePhase(UINT phase)
{ {
int index, world, time, total, music, i, max, mission; int i, mission;
POINT totalDim, iconDim;
char str[MAX_PATH]; char str[MAX_PATH];
char text[100]; char text[100];
char res[100]; char res[100];
char* pButtonExist; BOOL bEnable;
BOOL bEnable, bHide;
char* playerName;
text[0] = 0; text[0] = 0;
@ -4680,7 +4659,6 @@ BOOL CEvent::ChangePhase(UINT phase)
struct _finddata_t fBuffer; struct _finddata_t fBuffer;
BOOL bDo; BOOL bDo;
char temp[_MAX_FNAME]; char temp[_MAX_FNAME];
char* buff;
m_nbChoices = 0; m_nbChoices = 0;
hFile = _findfirst("\\User\\*.xch", &fBuffer); hFile = _findfirst("\\User\\*.xch", &fBuffer);
@ -4692,7 +4670,6 @@ BOOL CEvent::ChangePhase(UINT phase)
} while (_findnext(hFile, &fBuffer) == 0 && } while (_findnext(hFile, &fBuffer) == 0 &&
m_nbChoices < 100); m_nbChoices < 100);
} }
int f, n;
do do
{ {
bDo = FALSE; bDo = FALSE;
@ -5667,7 +5644,6 @@ BOOL CEvent::OpenMission(char* pMission, char* pFile)
{ {
FILE* file; FILE* file;
FILE* file2; FILE* file2;
UINT nmemb;
int nb; int nb;
char* pBuffer = NULL; char* pBuffer = NULL;
BOOL bMission = TRUE; BOOL bMission = TRUE;
@ -5684,12 +5660,12 @@ BOOL CEvent::OpenMission(char* pMission, char* pFile)
do do
{ {
nb = fread(pBuffer, 1, sizeof(2560), file); nb = fread(pBuffer, 1, sizeof(2560), file);
if (pBuffer[nb] & 32 != 0) break; if (pBuffer[nb] & 32) break;
if (nb <= 0) if (nb <= 0)
bMission = FALSE; bMission = FALSE;
break; break;
fwrite(pBuffer, 1, nb, file2); fwrite(pBuffer, 1, nb, file2);
} while (pBuffer[nb] & 32 != 0); } while (pBuffer[nb] & 32);
return bMission; return bMission;
error: error:
@ -5759,7 +5735,7 @@ BOOL CEvent::CopyMission(char *srcFileName, char *dstFileName)
if (destFile) if (destFile)
{ {
#if _LEGACY and defined(_IOERR) #if _LEGACY && defined(_IOERR)
// original code relies on implementation-specific behavior. // original code relies on implementation-specific behavior.
// incompatible with modern toolsets. // incompatible with modern toolsets.
do do