1
0
mirror of https://github.com/jummy0/sb2-decomp synced 2025-03-15 04:24:48 +01:00
This commit is contained in:
jummy 2024-11-08 14:19:37 -06:00
parent 42b0b3660c
commit a2acad0c2a
8 changed files with 27 additions and 43 deletions

View File

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

View File

@ -33,7 +33,7 @@
#define TITLE "Blupi" #define TITLE "Blupi"
#endif #endif
#define MMTIMER FALSE #define MMTIMER TRUE
#define THREAD FALSE #define THREAD FALSE
// Variables Globals // Variables Globals
@ -456,7 +456,7 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT message,
} }
g_pPixmap->Display(); g_pPixmap->Display();
} }
if (g_something > 0) g_something--; if (g_timer > 0) g_timer--;
break; break;
case WM_SYSCOLORCHANGE: case WM_SYSCOLORCHANGE:
OutputDebug("Event WM_SYSCOLORCHANGE\n"); OutputDebug("Event WM_SYSCOLORCHANGE\n");
@ -595,9 +595,6 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT message,
void CALLBACK TimerStep(UINT wTimerID, UINT msg, void CALLBACK TimerStep(UINT wTimerID, UINT msg,
DWORD dwUser, DWORD dw1, DWORD dw2) DWORD dwUser, DWORD dw1, DWORD dw2)
{ {
char buf[20];
sprintf(buf, "%d", wTimerID);
OutputDebug(buf);
if (g_bActive && g_timer == 0) if (g_bActive && g_timer == 0)
{ {
g_timer = 1; g_timer = 1;

View File

@ -3878,11 +3878,7 @@ void CDecor::BlupiStep()
m_lastKeyPress = m_keyPress; m_lastKeyPress = m_keyPress;
// DEBUG v // DEBUG v
sprintf(m_notifText[0], "blupiAction %d", m_blupiAction); sprintf(m_notifText[0], "time %d", m_time);
sprintf(m_notifText[1], "blupiIcon %d", m_blupiIcon);
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; m_notifTime = 200;
// DEBUG ^ // DEBUG ^
} }

View File

@ -694,12 +694,12 @@ void CDecor::Build(RECT rect)
} }
} }
tinyPoint.x = 0 - posDecor.x % 64; tinyPoint.x = 0 - posDecor.x % 64;
for (i = posDecor.x / 64; i < posDecor.x / 64 + LXIMAGE / 64 + 2; i++) for (i = posDecor.x / DIMOBJX; i < posDecor.x / DIMOBJX + LXIMAGE / DIMOBJX + 2; i++)
{ {
tinyPoint.y = 0 - posDecor.y % 64; tinyPoint.y = 0 - posDecor.y % 64;
for (j = posDecor.y / 64; j < posDecor.y / 64 + LYIMAGE / 64 + 2; j++) for (j = posDecor.y / DIMOBJY; j < posDecor.y / DIMOBJY + LYIMAGE / DIMOBJY + 2; j++)
{ {
if (i >= 0 && i < 100 && j >= 0 && j < 100 && m_decor[i][j].icon != -1) if (i >= 0 && i < MAXCELX && j >= 0 && j < MAXCELY && m_decor[i][j].icon != -1)
{ {
int num2 = m_decor[i][j].icon; int num2 = m_decor[i][j].icon;
pos = tinyPoint; pos = tinyPoint;
@ -799,32 +799,29 @@ void CDecor::Build(RECT rect)
m_pPixmap->QuickIcon(1, num2, pos); m_pPixmap->QuickIcon(1, num2, pos);
} }
} }
tinyPoint.y += 64; tinyPoint.y += DIMOBJY;
} }
tinyPoint.x += 64; tinyPoint.x += DIMOBJX;
} }
for (i = 0; i < MAXMOVEOBJECT; i++) 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 - 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))
{ {
tinyPoint.x = 0 + m_moveObject[i].posCurrent.x - posDecor.x; tinyPoint = m_moveObject[i].posCurrent - posDecor;
tinyPoint.y = 0 + m_moveObject[i].posCurrent.y - posDecor.y;
m_pPixmap->QuickIcon(m_moveObject[i].channel, m_moveObject[i].icon, tinyPoint); m_pPixmap->QuickIcon(m_moveObject[i].channel, m_moveObject[i].icon, tinyPoint);
} }
////debug ////debug
if (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) if (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)
{ {
char str[20]; char str[50];
sprintf(str, "#%d", i); sprintf(str, "[%d]: %d", i, m_moveObject[i].type);
DrawText(m_pPixmap, posDecor - m_moveObject[i].posCurrent, str, FONTWHITE); DrawText(m_pPixmap, m_moveObject[i].posCurrent - posDecor, str, FONTLITTLE);
DrawText(m_pPixmap, posDecor - m_moveObject[i].posCurrent + POINT(0, 10), m_moveObject[i].type ? debugMobTypeNames[m_moveObject[i].type] : "-", FONTWHITE);
} }
//// ////
} }
if (m_blupiFront) if (m_blupiFront)
{ {
tinyPoint.x = 0 + m_blupiPos.x - posDecor.x; tinyPoint = m_blupiPos - posDecor;
tinyPoint.y = 0 + m_blupiPos.y - posDecor.y;
m_pPixmap->QuickIcon(m_blupiChannel, m_blupiIcon, tinyPoint); m_pPixmap->QuickIcon(m_blupiChannel, m_blupiIcon, tinyPoint);
} }
DrawInfo(); DrawInfo();
@ -1066,7 +1063,7 @@ void CDecor::PlaySound(int sound, POINT pos, BOOL bLocal)
{ {
if (!bLocal) NetPlaySound(sound, pos); if (!bLocal) NetPlaySound(sound, pos);
m_pSound->PlayImage(sound, pos - m_posDecor, -1); m_pSound->PlayImage(sound, POINT(pos.x - m_posDecor.x, pos.y - m_posDecor.y), -1);
switch (sound) { switch (sound) {
case SOUND_HELICOHIGH: case SOUND_HELICOHIGH:
@ -1111,7 +1108,7 @@ void CDecor::StopSound(int sound)
void CDecor::AdaptMotorVehicleSound(POINT pos) void CDecor::AdaptMotorVehicleSound(POINT pos)
{ {
POINT blupiPos = pos - m_posDecor; POINT blupiPos = POINT(pos.x - m_posDecor.x, pos.y - m_posDecor.y);
if (m_bHelicoMarch) m_pSound->PlayImage(SOUND_HELICOHIGH, blupiPos); if (m_bHelicoMarch) m_pSound->PlayImage(SOUND_HELICOHIGH, blupiPos);
if (m_bHelicoStop) m_pSound->PlayImage(SOUND_HELICOLOW, blupiPos); if (m_bHelicoStop) m_pSound->PlayImage(SOUND_HELICOLOW, blupiPos);

View File

@ -576,7 +576,7 @@ 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 *dest, MoveObject *src)
{ {
memcpy(dest, src, sizeof(dest)); memcpy(dest, src, sizeof(dest));
} }

View File

@ -1329,7 +1329,7 @@ POINT operator+(POINT p, const POINT& a)
POINT operator-(POINT p, const POINT& a) POINT operator-(POINT p, const POINT& a)
{ {
return POINT( a.x - p.x, a.y - p.y ); return POINT( p.x - a.x, p.y - a.y );
} }
POINT operator*(POINT p, const POINT& a) POINT operator*(POINT p, const POINT& a)

View File

@ -2909,20 +2909,7 @@ BOOL CEvent::DrawButtons()
// now that the decomp is looking convincingly like the retail game, // now that the decomp is looking convincingly like the retail game,
// we should clearly differentiate the two when sharing WIP screenshots/videos to reduce confusion. // we should clearly differentiate the two when sharing WIP screenshots/videos to reduce confusion.
{ {
POINT debugMousePos = GetMousePos(); DrawTextLeft(m_pPixmap, POINT(LXIMAGE - GetTextWidth("DECOMP -- " __DATE__), 0), "DECOMP -- " __DATE__, FONTGOLD);
int debugTextY;
if (debugMousePos.x > LXIMAGE - GetTextWidth("WORK IN PROGRESS") && debugMousePos.x < LXIMAGE && debugMousePos.y < 36 && debugMousePos.y >= 0)
{
debugTextY = 40;
}
else
{
debugTextY = 0;
}
DrawTextLeft(m_pPixmap, POINT(LXIMAGE - GetTextWidth("DECOMPILATION"), debugTextY), "DECOMPILATION", FONTGOLD);
DrawTextLeft(m_pPixmap, POINT(LXIMAGE - GetTextWidth("WORK IN PROGRESS"), debugTextY + 11), "WORK IN PROGRESS", FONTGOLD);
DrawTextLeft(m_pPixmap, POINT(LXIMAGE - GetTextWidth(__DATE__ " " __TIME__), debugTextY + 22), __DATE__ " " __TIME__, FONTGOLD);
} }
/////// ///////
@ -3339,7 +3326,7 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam)
m_keyPress |= KEY_JUMP; m_keyPress |= KEY_JUMP;
break; break;
case VK_PAUSE: case VK_PAUSE:
NetSetPause((m_pDecor->GetPause()), TRUE); NetSetPause(!m_pDecor->GetPause(), TRUE);
break; break;
case VK_LEFT: case VK_LEFT:
m_keyPress |= KEY_LEFT; m_keyPress |= KEY_LEFT;

View File

@ -276,7 +276,7 @@ CSound::CSound()
m_bEnable = FALSE; m_bEnable = FALSE;
m_bState = FALSE; m_bState = FALSE;
m_MidiDeviceID = 0; m_hBassStream = NULL;
m_music = 0; m_music = 0;
m_audioVolume = 20; m_audioVolume = 20;
m_midiVolume = 15; m_midiVolume = 15;
@ -642,6 +642,7 @@ void CSound::SetCDAudio(BOOL bCDAudio)
BOOL CSound::PlayCDAudio(HWND hWnd, int track) BOOL CSound::PlayCDAudio(HWND hWnd, int track)
{ {
/*
MCIERROR dwReturn; MCIERROR dwReturn;
MCI_PLAY_PARMS mciPlayParms; MCI_PLAY_PARMS mciPlayParms;
MCI_SET_PARMS mciSetParms; MCI_SET_PARMS mciSetParms;
@ -710,6 +711,8 @@ BOOL CSound::PlayCDAudio(HWND hWnd, int track)
m_music = track; m_music = track;
return TRUE; return TRUE;
*/
return FALSE;
} }
#endif #endif