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

Update blupi.cpp

This commit is contained in:
HMVocaloid 2024-05-20 09:01:51 -04:00
parent 3fcb186787
commit 3575f029a6

232
blupi.cpp
View File

@ -151,5 +151,235 @@ BOOL ReadConfig (LPSTR lpCmdLine)
if ( g_mouseType > 9 ) g_mouseType = 9;
}
pText = strstr(buffer, "TrueColor=");
if ( pText != NULL )
{
i = GetNum(pText + 10);
if (i == 8) g_bTrueColor = 0;
if (i == 16) g_bTrueColor = 1;
g_bTrueColorDecor = g_bTrueColor;
}
pText = strstr(buffer, "TrueColorBack=");
if ( pText != NULL )
{
i = GetNum(pText+14);
if (i == 8) g_bTrueColor = 0;
if (i == 16) g_bTrueColor = 1;
}
return TRUE;
}
}
// Rewrite Variables
void UpdateFrame(void)
{
RECT clip, rcRect;
UINT phase;
POINT posMouse;
int i, term, speed;
g_pPixmap->MouseBackClear(); // enl<6E>ve la souris dans "back"
posMouse = g_pEvent->GetLastMousePos();
phase = g_pEvent->GetPhase();
if ( phase == g_lastPhase &&
phase == WM_PHASE_PLAY )
{
//? rcRect.left = POSDRAWX;
//? rcRect.top = POSDRAWY;
//? rcRect.right = POSDRAWX+DIMDRAWX;
//? rcRect.bottom = POSDRAWY+DIMDRAWY;
//? g_pPixmap->DrawImage(-1, CHBACK, rcRect, 1); // dessine le fond
}
else
{
rcRect.left = 0;
rcRect.top = 0;
rcRect.right = LXIMAGE;
rcRect.bottom = LYIMAGE;
g_pPixmap->DrawImage(-1, CHBACK, rcRect, 1); // dessine le fond
}
if ( phase == WM_PHASE_INTRO1 ||
phase == WM_PHASE_INTRO2 )
{
g_pEvent->IntroStep();
}
if ( phase == WM_PHASE_PLAY )
{
clip.left = POSDRAWX;
clip.top = POSDRAWY+g_pDecor->GetInfoHeight();
clip.right = POSDRAWX+DIMDRAWX;
clip.bottom = POSDRAWY+DIMDRAWY;
if ( g_pEvent->IsShift() ) // shift en cours ?
{
g_pEvent->DecorAutoShift(posMouse);
g_pDecor->Build(clip, posMouse); // construit juste le d<>cor
}
else
{
if ( !g_pEvent->GetPause() )
{
speed = g_pEvent->GetSpeed() * g_speedRate;
for ( i=0 ; i<speed ; i++ )
{
g_pDecor->BlupiStep(i==0); // avance tous les blupi
g_pDecor->MoveStep(i==0); // avance tous les d<>cors
g_pEvent->DemoStep(); // avance enregistrement/reproduction
}
}
g_pEvent->DecorAutoShift(posMouse);
g_pDecor->Build(clip, posMouse); // construit le d<>cor
g_pDecor->NextPhase(1); // refait la carte de temps en temps
}
}
if ( phase == WM_PHASE_BUILD )
{
clip.left = POSDRAWX;
clip.top = POSDRAWY;
clip.right = POSDRAWX+DIMDRAWX;
clip.bottom = POSDRAWY+DIMDRAWY;
g_pEvent->DecorAutoShift(posMouse);
g_pDecor->Build(clip, posMouse); // construit le d<>cor
g_pDecor->NextPhase(-1); // refait la carte chaque fois
}
if ( phase == WM_PHASE_INIT )
{
g_pEvent->DemoStep(); // d<>marre <20>v. d<>mo automatique
}
g_pEvent->DrawButtons();
g_lastPhase = phase;
if ( phase == WM_PHASE_H0MOVIE ||
phase == WM_PHASE_H1MOVIE ||
phase == WM_PHASE_H2MOVIE ||
phase == WM_PHASE_PLAYMOVIE ||
phase == WM_PHASE_WINMOVIE )
{
g_pEvent->MovieToStart(); // fait d<>marrer un film si n<>cessaire
}
if ( phase == WM_PHASE_INSERT )
{
g_pEvent->TryInsert();
}
if ( phase == WM_PHASE_PLAY )
{
term = g_pDecor->IsTerminated();
if ( term == 1 ) g_pEvent->ChangePhase(WM_PHASE_LOST); // perdu
if ( term == 2 ) g_pEvent->ChangePhase(WM_PHASE_WINMOVIE); // gagn<67>
}
g_pPixmap->MouseBackDraw(); // remet la souris dans "back"
}
BOOL RestoreGame()
{
if ( g_pPixmap == NULL ) return FALSE;
g_pEvent->RestoreGame();
return g_pPixmap->Restore();
}
BOOL FlushGame()
{
if ( g_pPixmap == NULL ) return FALSE;
return g_pPixmap->Flush();
}
static void FinishObjects(void)
{
if ( g_pMovie != NULL )
{
g_pEvent->StopMovie();
delete g_pMovie;
g_pMovie = NULL;
}
if ( g_pEvent != NULL )
{
delete g_pEvent;
g_pEvent = NULL;
}
if ( g_pDecor != NULL )
{
delete g_pDecor;
g_pDecor = NULL;
}
if (g_pSound != NULL )
{
g_pSound->StopMusic();
delete g_pSound;
g_pSound = NULL;
}
if ( g_pPixmap != NULL )
{
delete g_pPixmap;
g_pPixmap = NULL;
}
}
BOOL InitFail(char *msg, BOOL bDirectX)
{
char buffer[100];
if ( bDirectX ) strcpy(buffer, "DirectX Init FAILED\n(while ");
else strcpy(buffer, "Error (");
strcat(buffer, msg);
strcat(buffer, ")");
MessageBox(g_hWnd, buffer, TITLE, MB_OK);
FinishObjects();
DestroyWindow(g_hWnd);
return FALSE;
}
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
if ( !DoInit(hInstance, lpCmdLine, nCmdShow) )
{
return FALSE;
}
SetTimer(g_hWnd, 1, g_timerInterval, NULL);
while ( TRUE )
{
if ( PeekMessage(&msg, NULL, 0,0, PM_NOREMOVE) )
{
if ( !GetMessage(&msg, NULL, 0, 0) )
{
return msg.wParam;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
if ( !g_bActive ) WaitMessage();
}
}
return msg.wParam;
}