1
0
mirror of https://github.com/jummy0/sb2-decomp synced 2025-03-14 20:23:30 +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>
<OptimizeReferences>true</OptimizeReferences>
<ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -134,6 +135,8 @@
<ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>
<AdditionalOptions>/DYNAMICBASE "legacy_stdio_definitions.lib" %(AdditionalOptions) /VERBOSE</AdditionalOptions>
<AdditionalDependencies>dxsdk3/sdk/lib/*.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<TreatLinkerWarningAsErrors>false</TreatLinkerWarningAsErrors>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
</Link>
</ItemDefinitionGroup>
<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);
file = fopen(filename, "rb");
if (file == NULL) {
OutputDebug("CDecor::Read error in fopen\n");
OutputDebug(filename);
goto error;
}
if (file == NULL) goto error;
pBuffer = (DescFile*)malloc(sizeof(DescFile));
if (pBuffer == NULL) {
OutputDebug("CDecor::Read error in malloc\n");
goto error;
}
if (pBuffer == NULL) goto error;
nb = fread(pBuffer, sizeof(DescFile), 1, file);
if (nb < 1) {
OutputDebug("CDecor::Read error in fread\n");
goto error;
}
if (nb < 1) goto error;
majRev = pBuffer->majRev;
minRev = pBuffer->minRev;
@ -146,30 +136,28 @@ BOOL CDecor::Read(int gamer, int mission, BOOL bUser)
startPos = m_blupiStartPos;
blupiPos = pBuffer->blupiPos;
for (i = 0; i < 4; i++)
for (i = 0; i < MAXNETPLAYER; i++)
{
m_blupiStartPos[i] = pBuffer->blupiPos[i];
}
for (i = 0; i < 4; i++)
{
m_blupiStartDir[i] = pBuffer->blupiDir[i];
}
nb = fread(m_decor, sizeof(Cellule), MAXCELX * MAXCELY, file);
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 &&
m_decor[x][y].icon <= 67)
if (m_decor[x][y].icon >= Object::Dream_1 &&
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)
{

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);
POINT posDecor = DecorNextAction();
POINT pos = { posDecor.x * 2 / 3 % LXIMAGE, posDecor.y * 2 / 3 % LYIMAGE };
//TODO: more^
POINT pos = { posDecor.x * 2 / 3 % DIMDECORX, posDecor.y * 2 / 3 % DIMDECORY };
for (int i = 0; i < 2; i++)
for (int i = 0; i < ((DIMDECORX - DIMDECORX / LXIMAGE * LXIMAGE) ? 2 : 1) + LXIMAGE / DIMDECORX; i++)
{
tinyPoint.y = 0;
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.right = LXIMAGE;
rect.bottom = LYIMAGE;
rect.left = i ? 0 : pos.x;
rect.right = DIMDECORX;
rect.bottom = DIMDECORY;
m_pPixmap->DrawPart(-1, CHDECOR, tinyPoint, rect, 1, FALSE);
tinyPoint.y += LYIMAGE - pos.y;
tinyPoint.y = DIMDECORY * (j + 1) - pos.y;
rect.top = 0;
}
tinyPoint.x += LXIMAGE - pos.x;
pos.x = 0;
tinyPoint.x = DIMDECORX * (i + 1) - pos.x;
}
tinyPoint.x = -posDecor.x % DIMOBJX - DIMOBJX;

View File

@ -20,6 +20,7 @@
#define _CD FALSE // if TRUE, require the game CD
#define _BYE !_EGAMES // if TRUE, show exit image (like _INTRO)
#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 MAXNETPLAYER 4
@ -28,8 +29,8 @@
#define MAXNOTIF 5
#define MAXFIFOPOS 10
#define LXIMAGE 640 // dimensions de la fenêtre de jeu
#define LYIMAGE 480
#define LXIMAGE 320 // dimensions de la fenêtre de jeu
#define LYIMAGE 240
#define POSDRAWX 0
#define POSDRAWY 0
@ -61,6 +62,9 @@
#define DIMLITTLEX 16 // dimensions max d'un petit caractère
#define DIMLITTLEY 12
#define DIMDECORX 640
#define DIMDECORY 480
enum {
CHBACK = 0,
CHOBJECT,

View File

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