From a2acad0c2af230dca4069800bed67a886373a2af Mon Sep 17 00:00:00 2001 From: jummy Date: Fri, 8 Nov 2024 14:19:37 -0600 Subject: [PATCH] luh --- Speedy Eggbert 2 Source.vcxproj | 4 ++++ src/blupi.cpp | 7 ++----- src/decblupi.cpp | 6 +----- src/decor.cpp | 27 ++++++++++++--------------- src/decor.h | 2 +- src/def.h | 2 +- src/event.cpp | 17 ++--------------- src/sound.cpp | 5 ++++- 8 files changed, 27 insertions(+), 43 deletions(-) diff --git a/Speedy Eggbert 2 Source.vcxproj b/Speedy Eggbert 2 Source.vcxproj index 8b4902d..dbe9885 100644 --- a/Speedy Eggbert 2 Source.vcxproj +++ b/Speedy Eggbert 2 Source.vcxproj @@ -80,6 +80,10 @@ dxsdk3\sdk\inc;bass\inc UNICODE;_UNICODE + MaxSpeed + true + Speed + Default Windows diff --git a/src/blupi.cpp b/src/blupi.cpp index a79c135..62f0fae 100644 --- a/src/blupi.cpp +++ b/src/blupi.cpp @@ -33,7 +33,7 @@ #define TITLE "Blupi" #endif -#define MMTIMER FALSE +#define MMTIMER TRUE #define THREAD FALSE // Variables Globals @@ -456,7 +456,7 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, } g_pPixmap->Display(); } - if (g_something > 0) g_something--; + if (g_timer > 0) g_timer--; break; case WM_SYSCOLORCHANGE: OutputDebug("Event WM_SYSCOLORCHANGE\n"); @@ -595,9 +595,6 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, void CALLBACK TimerStep(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2) { - char buf[20]; - sprintf(buf, "%d", wTimerID); - OutputDebug(buf); if (g_bActive && g_timer == 0) { g_timer = 1; diff --git a/src/decblupi.cpp b/src/decblupi.cpp index e76d76d..794e51e 100644 --- a/src/decblupi.cpp +++ b/src/decblupi.cpp @@ -3878,11 +3878,7 @@ void CDecor::BlupiStep() m_lastKeyPress = m_keyPress; // DEBUG v - sprintf(m_notifText[0], "blupiAction %d", m_blupiAction); - 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); + sprintf(m_notifText[0], "time %d", m_time); m_notifTime = 200; // DEBUG ^ } diff --git a/src/decor.cpp b/src/decor.cpp index ee20b2e..4ca950f 100644 --- a/src/decor.cpp +++ b/src/decor.cpp @@ -694,12 +694,12 @@ void CDecor::Build(RECT rect) } } 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; - 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; pos = tinyPoint; @@ -799,32 +799,29 @@ void CDecor::Build(RECT rect) m_pPixmap->QuickIcon(1, num2, pos); } } - tinyPoint.y += 64; + tinyPoint.y += DIMOBJY; } - tinyPoint.x += 64; + tinyPoint.x += DIMOBJX; } 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)) { - tinyPoint.x = 0 + m_moveObject[i].posCurrent.x - posDecor.x; - tinyPoint.y = 0 + m_moveObject[i].posCurrent.y - posDecor.y; + tinyPoint = m_moveObject[i].posCurrent - posDecor; m_pPixmap->QuickIcon(m_moveObject[i].channel, m_moveObject[i].icon, tinyPoint); } ////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) { - char str[20]; - sprintf(str, "#%d", i); - DrawText(m_pPixmap, posDecor - m_moveObject[i].posCurrent, str, FONTWHITE); - DrawText(m_pPixmap, posDecor - m_moveObject[i].posCurrent + POINT(0, 10), m_moveObject[i].type ? debugMobTypeNames[m_moveObject[i].type] : "-", FONTWHITE); + char str[50]; + sprintf(str, "[%d]: %d", i, m_moveObject[i].type); + DrawText(m_pPixmap, m_moveObject[i].posCurrent - posDecor, str, FONTLITTLE); } //// } if (m_blupiFront) { - tinyPoint.x = 0 + m_blupiPos.x - posDecor.x; - tinyPoint.y = 0 + m_blupiPos.y - posDecor.y; + tinyPoint = m_blupiPos - posDecor; m_pPixmap->QuickIcon(m_blupiChannel, m_blupiIcon, tinyPoint); } DrawInfo(); @@ -1066,7 +1063,7 @@ void CDecor::PlaySound(int sound, POINT pos, BOOL bLocal) { 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) { case SOUND_HELICOHIGH: @@ -1111,7 +1108,7 @@ void CDecor::StopSound(int sound) 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_bHelicoStop) m_pSound->PlayImage(SOUND_HELICOLOW, blupiPos); diff --git a/src/decor.h b/src/decor.h index 7c5bce8..281cd3c 100644 --- a/src/decor.h +++ b/src/decor.h @@ -576,7 +576,7 @@ inline BOOL CDecor::IsValidCel(POINT cel) 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)); } diff --git a/src/def.h b/src/def.h index f226412..43ea5b5 100644 --- a/src/def.h +++ b/src/def.h @@ -1329,7 +1329,7 @@ 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) diff --git a/src/event.cpp b/src/event.cpp index 231a450..e7c8248 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -2909,20 +2909,7 @@ BOOL CEvent::DrawButtons() // 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. { - POINT debugMousePos = GetMousePos(); - 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); + DrawTextLeft(m_pPixmap, POINT(LXIMAGE - GetTextWidth("DECOMP -- " __DATE__), 0), "DECOMP -- " __DATE__, FONTGOLD); } /////// @@ -3339,7 +3326,7 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) m_keyPress |= KEY_JUMP; break; case VK_PAUSE: - NetSetPause((m_pDecor->GetPause()), TRUE); + NetSetPause(!m_pDecor->GetPause(), TRUE); break; case VK_LEFT: m_keyPress |= KEY_LEFT; diff --git a/src/sound.cpp b/src/sound.cpp index 2af6137..63d8d35 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -276,7 +276,7 @@ CSound::CSound() m_bEnable = FALSE; m_bState = FALSE; - m_MidiDeviceID = 0; + m_hBassStream = NULL; m_music = 0; m_audioVolume = 20; m_midiVolume = 15; @@ -642,6 +642,7 @@ void CSound::SetCDAudio(BOOL bCDAudio) BOOL CSound::PlayCDAudio(HWND hWnd, int track) { + /* MCIERROR dwReturn; MCI_PLAY_PARMS mciPlayParms; MCI_SET_PARMS mciSetParms; @@ -710,6 +711,8 @@ BOOL CSound::PlayCDAudio(HWND hWnd, int track) m_music = track; return TRUE; + */ + return FALSE; } #endif \ No newline at end of file