From 432e06b45a11a66fdf53c3511656754856003784 Mon Sep 17 00:00:00 2001 From: jummy Date: Sun, 29 Sep 2024 00:58:24 -0500 Subject: [PATCH] a --- src/blupi.cpp | 7 +- src/decblupi.cpp | 87 ++++++------- src/decmove.cpp | 4 - src/decor.cpp | 35 +++--- src/event.cpp | 315 +++++++++++++++++++++++++++++++---------------- src/event.h | 3 +- src/text.h | 2 +- 7 files changed, 276 insertions(+), 177 deletions(-) diff --git a/src/blupi.cpp b/src/blupi.cpp index abc57cf..8ea3d25 100644 --- a/src/blupi.cpp +++ b/src/blupi.cpp @@ -684,7 +684,7 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) wc.hbrBackground = GetStockBrush(BLACK_BRUSH); wc.lpszMenuName = NAME; wc.lpszClassName = NAME; - RegisterClassA(&wc); + RegisterClass(&wc); // Create a window. if (g_bFullScreen) @@ -714,8 +714,9 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) SetRect(&WindowRect, (sx - LXIMAGE) / 2, (sy - LYIMAGE) / 2, (sx + LXIMAGE) / 2, (sy + LYIMAGE) / 2); - AdjustWindowRect(&WindowRect, WS_POPUPWINDOW | WS_CAPTION, TRUE); - WindowRect.top += GetSystemMetrics(SM_CYCAPTION); + //AdjustWindowRect(&WindowRect, WS_POPUPWINDOW | WS_CAPTION, TRUE); // old faulty behavior + //WindowRect.top += GetSystemMetrics(SM_CYCAPTION); + AdjustWindowRect(&WindowRect, WS_POPUPWINDOW | WS_CAPTION, FALSE); // fixed behavior g_hWnd = CreateWindow ( diff --git a/src/decblupi.cpp b/src/decblupi.cpp index 450af53..c798459 100644 --- a/src/decblupi.cpp +++ b/src/decblupi.cpp @@ -7,24 +7,27 @@ //#include "resource.h" #include "dectables.h" +// get the graphics channel corresponding to Blupi's team +// (for Personal bomb, etc) int CDecor::GetBlupiChannelStandard() { if (m_bMulti && m_blupiChannel == CHBLUPI && m_team > 0) { return m_team + CHBLUPI1 - 1; } - else { - return m_blupiChannel; - } + else return m_blupiChannel; } +// get Blupi's current graphics channel +// (changes for certain effects such as burned or glued) int CDecor::GetBlupiChannelActual() { if (m_bMulti && m_team > 0) { return m_team + CHBLUPI1 - 1; } - return CHBLUPI; + else return CHBLUPI; } +// get various flags relating to Blupi's current state void CDecor::GetBlupiInfo(BOOL* bHelico, BOOL* bJeep, BOOL* bSkate, BOOL* bNage) { *bHelico = m_blupiHelico; @@ -150,6 +153,7 @@ BOOL CDecor::BlupiIsGround() } } +// get Blupi's hitbox according to his state RECT CDecor::BlupiRect(POINT pos) { RECT result; @@ -217,7 +221,7 @@ void CDecor::BlupiAdjust() { RECT tinyRect = BlupiRect(m_blupiPos); - if (DecorDetect(tinyRect)) + if (!DecorDetect(tinyRect)) { return; } @@ -227,7 +231,7 @@ void CDecor::BlupiAdjust() rect.bottom = rect.top + 2; rect.left = m_blupiPos.x + 12; rect.right = m_blupiPos.x + 60 - 12; - if (DecorDetect(rect)) + if (!DecorDetect(rect)) { break; } @@ -241,7 +245,7 @@ void CDecor::BlupiAdjust() rect.right = rect.left + 2; rect.top = m_blupiPos.y + 11; rect.bottom = m_blupiPos.y + 60 - 2; - if (DecorDetect(rect)) + if (!DecorDetect(rect)) { break; } @@ -255,7 +259,7 @@ void CDecor::BlupiAdjust() rect.left = rect.right - 2; rect.top = m_blupiPos.y + 11; rect.bottom = m_blupiPos.y + 60 - 2; - if (DecorDetect(rect)) + if (!DecorDetect(rect)) { break; } @@ -267,7 +271,7 @@ void CDecor::BlupiAdjust() { RECT rect = tinyRect; rect.right = rect.left + 2; - if (DecorDetect(rect)) + if (!DecorDetect(rect)) { break; } @@ -279,7 +283,7 @@ void CDecor::BlupiAdjust() { RECT rect = tinyRect; rect.left = rect.right - 2; - if (DecorDetect(rect)) + if (!DecorDetect(rect)) { return; } @@ -345,8 +349,8 @@ void CDecor::BlupiStep() } */ -// derived from winphone code - +// handle Blupi's movement and current state. +// currently derived from winphone code void CDecor::BlupiStep() { int m_blupiSpeedX = 0; // @@ -494,7 +498,7 @@ void CDecor::BlupiStep() m_blupiAction = 5; m_blupiPhase = 0; } - if ((m_keyPress & 1) != 0 && m_blupiFocus) + if ((m_keyPress & KEY_LEFT) != 0 && m_blupiFocus) { m_blupiVitesse.y = (m_blupiPower ? -25 : -19); } @@ -506,7 +510,7 @@ void CDecor::BlupiStep() flag = true; PlaySound(41, adjustPos); } - if ((m_keyPress & 1) != 0 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + if ((m_keyPress & KEY_LEFT) != 0 && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) { if (m_blupiAction != 4 && m_blupiAction != 3 && !m_blupiAir) { @@ -829,7 +833,7 @@ void CDecor::BlupiStep() m_blupiAction = 6; m_blupiPhase = 0; } - if ( (m_keyPress & 1) == 0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 6 && m_blupiAction != 28 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) + if ( (m_keyPress & KEY_LEFT) == 0 && m_blupiAction != 3 && m_blupiAction != 4 && m_blupiAction != 5 && m_blupiAction != 6 && m_blupiAction != 28 && m_blupiAction != 8 && m_blupiAction != 10 && m_blupiAction != 9 && !m_blupiAir && !m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) { m_blupiAction = 6; m_blupiPhase = 0; @@ -851,7 +855,7 @@ void CDecor::BlupiStep() } if (!m_blupiHelico && !m_blupiOver && !m_blupiBalloon && !m_blupiEcrase && !m_blupiJeep && !m_blupiTank && !m_blupiSkate && !m_blupiNage && !m_blupiSurf && !m_blupiSuspend && m_blupiFocus) { - if ( (m_keyPress & 1) == 0 && m_blupiAction != 28 && m_blupiDir == 1 && (num = CaisseInFront()) != -1) + if ( (m_keyPress & KEY_LEFT) == 0 && m_blupiAction != 28 && m_blupiDir == 1 && (num = CaisseInFront()) != -1) { adjustPos.x = m_moveObject[num].posCurrent.x + 64 - 5; m_blupiAction = 28; @@ -859,14 +863,14 @@ void CDecor::BlupiStep() m_scrollAdd.y = 0; PlaySound(39, adjustPos); } - if ( (m_keyPress & 1) == 0 && m_blupiAction != 29 && m_blupiDir == 1 && CaisseInFront() != -1) + if ( (m_keyPress & KEY_LEFT) == 0 && m_blupiAction != 29 && m_blupiDir == 1 && CaisseInFront() != -1) { m_blupiAction = 29; m_blupiPhase = 0; m_scrollAdd.y = 0; PlaySound(39, adjustPos); } - if ( (m_keyPress & 1) == 0 && m_blupiAction != 28 && m_blupiDir == 2 && (num = CaisseInFront()) != -1) + if ( (m_keyPress & KEY_LEFT) == 0 && m_blupiAction != 28 && m_blupiDir == 2 && (num = CaisseInFront()) != -1) { adjustPos.x = m_moveObject[num].posCurrent.x - 60 + 5; m_blupiAction = 28; @@ -874,7 +878,7 @@ void CDecor::BlupiStep() m_scrollAdd.y = 0; PlaySound(39, adjustPos); } - if ((m_keyPress & 1) == 0 && m_blupiAction != 29 && m_blupiDir == 2 && CaisseInFront() != -1) + if ((m_keyPress & KEY_LEFT) == 0 && m_blupiAction != 29 && m_blupiDir == 2 && CaisseInFront() != -1) { m_blupiAction = 29; m_blupiPhase = 0; @@ -1205,7 +1209,7 @@ void CDecor::BlupiStep() } if (m_blupiHelico && (m_blupiFocus || m_blupiAction == 58)) { - if ((m_keyPress & 2) != 0 && m_blupiTimeFire == 0 && m_blupiAction != 3 && m_blupiAction != 58 && flag) + if ((m_keyPress & KEY_RIGHT) != 0 && m_blupiTimeFire == 0 && m_blupiAction != 3 && m_blupiAction != 58 && flag) { if (m_blupiBullet == 0) { @@ -1234,7 +1238,7 @@ void CDecor::BlupiStep() } { - if (m_blupiSpeedY <= -1 || (m_keyPress & 1) != 0) + if (m_blupiSpeedY <= -1 || (m_keyPress & KEY_LEFT) != 0) { if (m_blupiVitesse.y > -10) { @@ -1421,7 +1425,7 @@ void CDecor::BlupiStep() { flag7 = false; } - if (((m_keyPress & 1) != 0) && !flag7) + if (((m_keyPress & KEY_LEFT) != 0) && !flag7) { if (m_blupiVitesse.y == 0 && num != -1) { @@ -1516,7 +1520,7 @@ void CDecor::BlupiStep() } if (m_blupiBalloon && m_blupiFocus) { - if ((m_keyPress & 1) != 0) + if ((m_keyPress & KEY_LEFT) != 0) { if (m_blupiVitesse.y > -5 && m_time % 6 == 0) { @@ -1784,7 +1788,7 @@ void CDecor::BlupiStep() m_blupiAction = 1; m_blupiPhase = 0; } - if ((m_keyPress & 2) != 0 && m_blupiTimeFire == 0 && m_blupiAction != 3) + if ((m_keyPress & KEY_RIGHT) != 0 && m_blupiTimeFire == 0 && m_blupiAction != 3) { if (m_blupiBullet == 0) { @@ -2002,7 +2006,7 @@ void CDecor::BlupiStep() { if (m_blupiTransport == -1) { - if ((m_keyPress & 1) != 0) + if ((m_keyPress & KEY_LEFT) != 0) { if (m_blupiVitesse.y > -5) { @@ -2121,7 +2125,7 @@ void CDecor::BlupiStep() { if (m_blupiTransport == -1) { - if ((m_keyPress & 1) != 0) + if ((m_keyPress & KEY_LEFT) != 0) { if (m_blupiVitesse.y > -5) { @@ -2231,12 +2235,12 @@ void CDecor::BlupiStep() m_blupiActionOuf = 65; m_blupiTimeOuf = 0; } - if (((m_keyPress & 1) != 0 || m_blupiSpeedY < 0) && m_blupiAction != 4 && m_blupiAction != 3) + if (((m_keyPress & KEY_LEFT) != 0 || m_blupiSpeedY < 0) && m_blupiAction != 4 && m_blupiAction != 3) { m_blupiAction = 4; m_blupiPhase = 0; } - if ((m_keyPress & 1) == 0 && m_blupiSpeedY == 0 && m_blupiAction == 4) + if ((m_keyPress & KEY_LEFT) == 0 && m_blupiSpeedY == 0 && m_blupiAction == 4) { m_blupiAction = 1; m_blupiPhase = 0; @@ -2785,7 +2789,7 @@ void CDecor::BlupiStep() } tinyPoint4.x = m_blupiPos.x; tinyPoint4.y = m_blupiPos.y - 60; - if ((m_blupiSurf || m_blupiNage) && (m_blupiPos.y % 64 == 64 - BLUPISURF || m_blupiPos.y % 64 == 32) && IsOutWater(tinyPoint4) && (m_keyPress & 1) != 0) + if ((m_blupiSurf || m_blupiNage) && (m_blupiPos.y % 64 == 64 - BLUPISURF || m_blupiPos.y % 64 == 32) && IsOutWater(tinyPoint4) && (m_keyPress & KEY_LEFT) != 0) { m_blupiNage = false; m_blupiSurf = false; @@ -3985,26 +3989,23 @@ void CDecor::BlupiDead(int action1, int action2) POINT CDecor::GetPosDecor(POINT pos) { POINT result; - if (m_dimDecor.x == 0) - { - result.x = 0; - } - else + + if (this->m_dimDecor.x) { result.x = pos.x - LXIMAGE / 2; - result.x = (result.x < 0); - result.x = (result.x > 5760) - LXIMAGE; + if (result.x < 0) result.x = 0; + if (result.x > MAXCELX * DIMOBJX - LXIMAGE) result.x = MAXCELX * DIMOBJX - LXIMAGE; } - if (m_dimDecor.y == 0) - { - result.y = 0; - } - else + else result.x = 0; + + if (this->m_dimDecor.y) { result.y = pos.y - LYIMAGE / 2; - result.y = (result.y < 0); - result.y = (result.y > 5920) - LYIMAGE / 2; + if (result.y < 0) result.y = 0; + if (result.y > MAXCELY * DIMOBJY - LYIMAGE) result.y = MAXCELY * DIMOBJY - LYIMAGE; } + else result.y = 0; + return result; } diff --git a/src/decmove.cpp b/src/decmove.cpp index bfc3b47..04eb61f 100644 --- a/src/decmove.cpp +++ b/src/decmove.cpp @@ -6,10 +6,6 @@ #include "misc.h" #include "dectables.h" - - - - void CDecor::MoveObjectPollution() { } diff --git a/src/decor.cpp b/src/decor.cpp index 24ad50b..407eea7 100644 --- a/src/decor.cpp +++ b/src/decor.cpp @@ -425,29 +425,30 @@ void CDecor::Build(RECT rect) m_pPixmap->SetClipping(rect); POINT posDecor = DecorNextAction(); - POINT pos = { posDecor.x * 2 / 3 % LXIMAGE, posDecor.y * 2 }; + POINT pos = { posDecor.x * 2 / 3 % LXIMAGE, posDecor.y * 2 / 3 % LYIMAGE }; //TODO: more^ - for (int i = 0; i < 3; i++) + for (int i = 0; i < 2; i++) { tinyPoint.y = 0; + rect.top = pos.y; for (int j = 0; j < 2; j++) { - rect.top = pos.y / 3 % LYIMAGE; rect.left = pos.x; rect.right = LXIMAGE; rect.bottom = LYIMAGE; - m_pPixmap->DrawPart(-1, 3, tinyPoint, rect, 1, 0); - tinyPoint.y += LYIMAGE - rect.top; + m_pPixmap->DrawPart(-1, CHDECOR, tinyPoint, rect, 1, FALSE); + tinyPoint.y += LYIMAGE - pos.y; + rect.top = 0; } tinyPoint.x += LXIMAGE - pos.x; pos.x = 0; } - tinyPoint.x = -posDecor.x % 64 - 64; - for (int i = posDecor.x / 64 - 1; i < posDecor.x / 64 + LXIMAGE / 64 + 3; i++) { - tinyPoint.y = -posDecor.y % 64 + 2 - 64; - for (int j = posDecor.y / 64 - 1; j < posDecor.y / 64 + LYIMAGE / 64 + 2; j++) + tinyPoint.x = -posDecor.x % DIMOBJX - DIMOBJX; + for (int i = posDecor.x / DIMOBJX - 1; i < posDecor.x / DIMOBJX + LXIMAGE / DIMOBJX + 3; i++) { + tinyPoint.y = -posDecor.y % DIMOBJY + 2 - DIMOBJY; + for (int j = posDecor.y / DIMOBJY - 1; j < posDecor.y / DIMOBJY + LYIMAGE / DIMOBJY + 2; j++) { if (i >= 0 && i < MAXCELX && j >= 0 && j < MAXCELY) { @@ -472,16 +473,16 @@ void CDecor::Build(RECT rect) m_pPixmap->QuickIcon(channel, num2, pos); } } - tinyPoint.y += 64; + tinyPoint.y += DIMOBJY; } - tinyPoint.x += 64; + tinyPoint.x += DIMOBJX; } - tinyPoint.x = -posDecor.x % 64; - for (int i = posDecor.x / 64; i < posDecor.x / 64 + LXIMAGE / 64 + 2; i++) + tinyPoint.x = -posDecor.x % DIMOBJX; + for (int i = posDecor.x / DIMOBJX; i < posDecor.x / DIMOBJX + LXIMAGE / DIMOBJX + 2; i++) { - tinyPoint.y = -posDecor.y % 64; - for (int j = posDecor.y / 64; j < posDecor.y / 64 + LYIMAGE / 64 + 2; j++) + tinyPoint.y = -posDecor.y % DIMOBJY; + for (int j = posDecor.y / DIMOBJY; j < posDecor.y / DIMOBJY + LYIMAGE / DIMOBJY + 2; j++) { if (i >= 0 && i < MAXCELX && j >= 0 && j < MAXCELY && m_decor[i][j].icon != -1) { @@ -491,9 +492,9 @@ void CDecor::Build(RECT rect) m_pPixmap->QuickIcon(CHOBJECT, num2, tinyPoint); } } - tinyPoint.y += 64; + tinyPoint.y += DIMOBJY; } - tinyPoint.x += 64; + tinyPoint.x += DIMOBJX; } if (m_phase == WM_PHASE_BUILD) diff --git a/src/event.cpp b/src/event.cpp index 70db0d0..a2dce22 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -2440,11 +2440,11 @@ BOOL CEvent::DrawButtons() BOOL bEnable; int phase; - if ( m_phase != WM_PHASE_INSERT && m_phase != WM_PHASE_BYE ) - { - m_bChangeCheat = FALSE; + if (m_phase != WM_PHASE_INSERT && m_phase != WM_PHASE_BYE) + { + m_bChangeCheat = FALSE; - text[0] = 0; + text[0] = 0; if (m_bBuildOfficialMissions) { AddCheatCode(text, cheat_code[0]); @@ -2453,15 +2453,15 @@ BOOL CEvent::DrawButtons() { AddCheatCode(text, cheat_code[1]); } - if ( m_pDecor->GetSuperBlupi() ) - { - AddCheatCode(text, cheat_code[3]); - } - if ( m_pDecor->GetDrawSecret() ) + if (m_pDecor->GetSuperBlupi()) + { + AddCheatCode(text, cheat_code[3]); + } + if (m_pDecor->GetDrawSecret()) { AddCheatCode(text, cheat_code[11]); } - if ( m_pDecor->GetNetPacked() ) + if (m_pDecor->GetNetPacked()) { AddCheatCode(text, cheat_code[19]); } @@ -2469,58 +2469,34 @@ BOOL CEvent::DrawButtons() { AddCheatCode(text, cheat_code[21]); } + m_pDecor->OutputNetDebug(text); + + if (m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST || m_phase == WM_PHASE_BUILD) + { + DrawTextLeft(m_pPixmap, { 2, 2 }, text, FONTLITTLE); + } + else + { + m_pPixmap->DrawPart(-1, CHBACK, { 2, 2 }, { 2, 2, 302, 14 }, 1, FALSE); + } } - m_pDecor->OutputNetDebug(text); - - phase = m_phase; - - if (phase != WM_PHASE_PLAY && phase != WM_PHASE_PLAYTEST && phase != WM_PHASE_BUILD) - { - rect.right = 302; - rect.left = 2; - rect.top = 2; - rect.bottom = 14; - pos.x = 2; - pos.y = 2; - m_pPixmap->DrawPart(-1, 0, pos, rect, 1, FALSE); - } - pos.x = 2; - pos.y = 2; - DrawTextLeft(m_pPixmap, pos, text, FONTLITTLE); if (m_phase == WM_PHASE_INIT) { DrawText(m_pPixmap, { 414, 446 }, "Version 2.2", FONTLITTLE); } - - for (int i = 0; table[m_index].buttons[i].message != 0; i++) - { - m_buttons[i].Draw(); - } if (m_phase == WM_PHASE_GAMER) { LoadString(TX_CHOOSEGAMER, res, 100); - lg = GetTextWidth(res, 0); - pos.y = 26; - pos.x = LXIMAGE / 2 - lg / 2; - DrawTextLeft(m_pPixmap, pos, res, 1); - int num; - pText = m_gamerNameList; - nice = 69; - for (num = 0; num < 8; num++) + DrawTextLeft(m_pPixmap, { LXIMAGE / 2 - GetTextWidth(res) / 2, 26 }, res, FONTGOLD); + for (i = 0; i < 8; i++) { - pos.x = 110; - pos.y = nice; - DrawText(m_pPixmap, pos, *pText, 0); - nice += 40; - pText++; + DrawText(m_pPixmap, { 110, 69 + i * DIMBUTTONY }, m_gamerNameList[i], FONTWHITE); } - SetEnable(WM_PHASE_CLEARGAMER, (int)(m_filenameBuffer - 1) + m_gamer * 4 + 212); + SetEnable(WM_PHASE_CLEARGAMER, m_gamerExist[m_gamer]); } - - if (m_phase == WM_PHASE_NAMEGAMER) { LoadString(TX_CHOOSEGAMER, res, 100); @@ -2533,9 +2509,8 @@ BOOL CEvent::DrawButtons() pos.x = 320 - lg / 2; pos.y = 190; DrawTextLeft(m_pPixmap, pos, res, 0); - pos.x = 320; - pos.y = 232; - PutTextInputBox(pos); + + PutTextInputBox({ 320, 232 }); } if (m_phase == WM_PHASE_NAMEDESIGN) @@ -2550,9 +2525,8 @@ BOOL CEvent::DrawButtons() pos.x = 320 - lg / 2; pos.y = 190; DrawTextLeft(m_pPixmap, pos, res, 0); - pos.x = 320; - pos.y = 232; - PutTextInputBox(pos); + + PutTextInputBox({ 320, 232 }); } if (m_phase == WM_PHASE_PLAY && m_phase == WM_PHASE_PLAYTEST && m_phase == WM_PHASE_BUILD) @@ -2585,12 +2559,12 @@ BOOL CEvent::DrawButtons() if (m_bDemoRec != 0) { LoadString(TX_DEMOREC, res, 100); - DrawTextLeft(m_pPixmap, pos, res, FONTRED); + DrawTextLeft(m_pPixmap, pos, res, FONTGOLD); } if (m_bDemoPlay != 0) { LoadString(TX_DEMOPLAY, res, 100); - DrawTextLeft(m_pPixmap, pos, res, FONTRED); + DrawTextLeft(m_pPixmap, pos, res, FONTGOLD); } } else @@ -2612,7 +2586,7 @@ BOOL CEvent::DrawButtons() lg = GetTextWidth(res); pos.x = (319 - lg) / 2; pos.y = 103; - DrawTextLeft(m_pPixmap, pos, res, FONTRED); + DrawTextLeft(m_pPixmap, pos, res, FONTGOLD); } if (m_phase == WM_PHASE_MUSIC) { @@ -2620,7 +2594,7 @@ BOOL CEvent::DrawButtons() lg=GetTextWidth(res); pos.x = (320 - lg) / 2; pos.y = 84; - DrawTextLeft(m_pPixmap, pos, res, FONTRED); + DrawTextLeft(m_pPixmap, pos, res, FONTGOLD); } if (m_phase == WM_PHASE_REGION) { @@ -2628,7 +2602,7 @@ BOOL CEvent::DrawButtons() lg = GetTextWidth(res); pos.x = (320 - lg) / 2; pos.y = 26; - DrawTextLeft(m_pPixmap, pos, res, FONTRED); + DrawTextLeft(m_pPixmap, pos, res, FONTGOLD); } if (m_phase == WM_PHASE_LOST || m_phase == WM_PHASE_LOSTDESIGN || m_phase == WM_PHASE_WINMULTI) { @@ -2682,22 +2656,22 @@ BOOL CEvent::DrawButtons() lg = GetTextWidth(res); pos.x = (320 - lg) / 2; pos.y = 20; - DrawTextLeft(m_pPixmap, pos, res, FONTRED); + DrawTextLeft(m_pPixmap, pos, res, FONTGOLD); LoadString(TX_FULL_END2, res, 100); lg = GetTextWidth(res); pos.x = (320 - lg) / 2; pos.y = 40; - DrawTextLeft(m_pPixmap, pos, res, FONTRED); + DrawTextLeft(m_pPixmap, pos, res, FONTGOLD); LoadString(TX_FULL_END3, res, 100); lg = GetTextWidth(res); pos.x = (320 - lg) / 2; pos.y = 430; - DrawTextLeft(m_pPixmap, pos, res, FONTRED); + DrawTextLeft(m_pPixmap, pos, res, FONTGOLD); LoadString(TX_FULL_END4, res, 100); lg = GetTextWidth(res); pos.x = (320 - lg) / 2; pos.y = 450; - DrawTextLeft(m_pPixmap, pos, res, FONTRED); + DrawTextLeft(m_pPixmap, pos, res, FONTGOLD); } if (m_phase == WM_PHASE_INSERT) { @@ -2924,6 +2898,11 @@ BOOL CEvent::DrawButtons() DrawTextLeft(m_pPixmap, pos, res, 0); } + for (int i = 0; table[m_index].buttons[i].message != 0; i++) + { + m_buttons[i].Draw(); + } + return TRUE; } @@ -3189,65 +3168,157 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) m_pSound->SetSuspendSkip(1); return TRUE; } - if (m_phase != WM_PHASE_PLAYTEST) + switch (m_phase) { - if (m_phase != WM_PHASE_SETUP) - { - if (m_phase != WM_PHASE_NAMEGAMER) + case WM_PHASE_PLAY: + if (!m_bPrivate && !m_bMulti) { - if (m_phase == WM_PHASE_NAMEDESIGN) + if (m_mission == 1) { - m_pDecor->SetMissionTitle(m_textInput); - ChangePhase(WM_PHASE_INFO); - return TRUE; + return ChangePhase(WM_PHASE_GAMER); } - if ((m_phase == WM_PHASE_INIT) || (m_phase == WM_PHASE_WINMULTI)) ChangePhase(WM_PHASE_GAMER); return TRUE; - if ((m_phase == WM_PHASE_BUILD) || ((m_phase == WM_PHASE_LOSTDESIGN || m_phase == WM_PHASE_LOST))) ChangePhase(WM_PHASE_INFO); return TRUE; - if (((m_phase != WM_PHASE_INFO) && (m_phase != WM_PHASE_STOP)) && (m_phase != WM_PHASE_HELP)) + if (m_mission % 10 != 0 && m_mission != 10) { - if (m_phase == WM_PHASE_SERVICE) - { - ChangePhase(WM_PHASE_DP_DOSERVICE); - return TRUE; - } - if (m_phase == WM_PHASE_CREATE) - { - ChangePhase(WM_PHASE_DP_DOCREATE); - return TRUE; - } - if (m_phase == WM_PHASE_MULTI) - { - ChatSend(); - return TRUE; - } - if (((m_phase != WM_PHASE_GREAD) && (m_phase != WM_PHASE_GREADp)) || ((m_choiceIndex < 0 || LoadState(m_choiceIndex) == FALSE))) - { - if (m_phase != WM_PHASE_GWRITE) return TRUE; - - if (m_choiceIndex < 0) return TRUE; - - if (SaveState(m_choiceIndex) == FALSE) return TRUE; - } + SetMission(1); + m_phase = WM_PHASE_PLAY; + return ChangePhase(WM_PHASE_PLAY); } } - } + ChangePhase(WM_PHASE_STOP); + return TRUE; + case WM_PHASE_GREADp: + case WM_PHASE_GWRITE: + ChangePhase(WM_PHASE_STOP); + return TRUE; + case WM_PHASE_SETUP: + case WM_PHASE_NAMEGAMER: + case WM_PHASE_CLEARGAMER: + case WM_PHASE_GREAD: + case WM_PHASE_INFO: + case WM_PHASE_LOSTMULTI: + ChangePhase(WM_PHASE_GAMER); + return TRUE; + case WM_PHASE_SETUPp: + case WM_PHASE_HELP: + case WM_PHASE_STOP: + ChangePhase(WM_PHASE_PLAY); + return TRUE; + case WM_PHASE_PLAYTEST: + ChangePhase(WM_PHASE_QUITPLAYTEST); + return TRUE; + case WM_PHASE_LOST: + case WM_PHASE_LOSTDESIGN: + case WM_PHASE_BUILD: + case WM_PHASE_REGION: + case WM_PHASE_NAMEDESIGN: + case WM_PHASE_MUSIC: + case WM_PHASE_READDESIGN: + case WM_PHASE_WRITEDESIGN: + ChangePhase(WM_PHASE_INFO); + return TRUE; + case WM_PHASE_GAMER: + ChangePhase(WM_PHASE_INIT); + return TRUE; + case WM_PHASE_SERVICE: + ChangePhase(WM_PHASE_DP_CANCELSERVICE); + return TRUE; + case WM_PHASE_SESSION: + ChangePhase(WM_PHASE_DP_CANCELSESSION); + return TRUE; + case WM_PHASE_CREATE: + ChangePhase(WM_PHASE_DP_CANCELCREATE); + return TRUE; + case WM_PHASE_MULTI: + ChangePhase(WM_PHASE_DP_CANCELMULTI); + return TRUE; + case WM_PHASE_BYE: + PostMessage(m_hWnd, WM_CLOSE, 0, 0); + return FALSE; + default: + return TRUE; + } + break; + case VK_RETURN: + if (m_bRunMovie) + { + StopMovie(); + m_pSound->SetSuspendSkip(1); + return TRUE; + } + switch (m_phase) + { + case WM_PHASE_PLAYTEST: + ChangePhase(WM_PHASE_QUITPLAYTEST); + return TRUE; + case WM_PHASE_SETUP: + case WM_PHASE_INIT: + case WM_PHASE_LOSTMULTI: + ChangePhase(WM_PHASE_GAMER); + return TRUE; + case WM_PHASE_NAMEGAMER: strcpy(m_gamerName, m_textInput); - + ChangePhase(WM_PHASE_GAMER); + return TRUE; + case WM_PHASE_NAMEDESIGN: + m_pDecor->SetMissionTitle(m_textInput); + ChangePhase(WM_PHASE_INFO); + return TRUE; + case WM_PHASE_INFO: + case WM_PHASE_STOP: + case WM_PHASE_HELP: + case WM_PHASE_SETUPp: + ChangePhase(WM_PHASE_PLAY); + return TRUE; + case WM_PHASE_BUILD: + case WM_PHASE_LOSTDESIGN: + case WM_PHASE_LOST: + ChangePhase(WM_PHASE_INFO); + return TRUE; + case WM_PHASE_SERVICE: + ChangePhase(WM_PHASE_DP_DOSERVICE); + return TRUE; + case WM_PHASE_CREATE: + ChangePhase(WM_PHASE_DP_DOCREATE); + return TRUE; + case WM_PHASE_MULTI: + ChatSend(); + return TRUE; + case WM_PHASE_GREAD: + case WM_PHASE_GREADp: + /* + if (m_choiceIndex >= 0 && FUN_21890(m_choiceIndex)) + { + ChangePhase(WM_PHASE_PLAY); + + } + return TRUE; + */ + case WM_PHASE_GWRITE: + /* + if (m_choiceIndex >= 0 && FUN_218f0(m_choiceIndex)) + { + ChangePhase(WM_PHASE_PLAY); + + } + return TRUE; + */ + default: + return TRUE; } case VK_SHIFT: - m_keyPress | KEY_FIRE; + m_keyPress |= KEY_FIRE; break; case VK_LEFT: - m_keyPress | KEY_LEFT; + m_keyPress |= KEY_LEFT; break; case VK_UP: - m_keyPress | KEY_UP; + m_keyPress |= KEY_UP; break; case VK_RIGHT: - m_keyPress | KEY_RIGHT; + m_keyPress |= KEY_RIGHT; break; case VK_DOWN: - m_keyPress | KEY_DOWN; + m_keyPress |= KEY_DOWN; break; case VK_HOME: return TRUE; @@ -3258,12 +3329,14 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) m_pSound->SetSuspendSkip(1); return TRUE; } + m_keyPress |= KEY_FIRE; + break; case VK_PAUSE: m_bPause = !m_bPause; NetSetPause((m_pDecor->GetPause()), m_bPause); return TRUE; case VK_CONTROL: - m_keyPress | KEY_JUMP; + m_keyPress |= KEY_JUMP; break; } @@ -3272,7 +3345,37 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) { return FALSE; } + + m_pDecor->SetInput(m_keyPress); + return TRUE; + // Unknown Function + case WM_KEYUP: + switch (wParam) + { + case VK_SHIFT: + case VK_SPACE: + m_keyPress &= ~KEY_FIRE; + break; + case VK_CONTROL: + m_keyPress &= ~KEY_JUMP; + break; + case VK_LEFT: + m_keyPress &= ~KEY_LEFT; + break; + case VK_UP: + m_keyPress &= ~KEY_UP; + break; + case VK_RIGHT: + m_keyPress &= ~KEY_RIGHT; + break; + case VK_DOWN: + m_keyPress &= ~KEY_DOWN; + break; + } + + m_pDecor->SetInput(m_keyPress); + return TRUE; case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: @@ -3741,8 +3844,6 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) StartMovie((char*)"movie\\essai.avi"); ChangePhase(WM_PHASE_INIT); break; - m_pDecor->SetInput(m_keyPress); - return TRUE; } return FALSE; diff --git a/src/event.h b/src/event.h index 011af94..e8827d5 100644 --- a/src/event.h +++ b/src/event.h @@ -202,6 +202,7 @@ protected: int m_mission; char m_gamerName[100]; char m_gamerNameList[8][100]; + BOOL m_gamerExist[8]; void* m_somethingJoystick; int m_menuIndex; int m_choiceIndex; @@ -311,8 +312,6 @@ protected: //BOOL m_b6D34; int m_96B4; int m_nbVies; -public: - int m_input; }; extern diff --git a/src/text.h b/src/text.h index 97ede20..247a009 100644 --- a/src/text.h +++ b/src/text.h @@ -3,7 +3,7 @@ #pragma once #define FONTWHITE 0 -#define FONTRED 1 +#define FONTGOLD 1 #define FONTSLIM 2 #define FONTLITTLE 10