From c79cf0e0ddc2f8f3903550c800b74c035d4760d1 Mon Sep 17 00:00:00 2001 From: HMVocaloid <66088611+HMVocaloid@users.noreply.github.com> Date: Fri, 17 May 2024 11:47:48 -0400 Subject: [PATCH] Most Engine Code Most of the engine code (being more or less copy and paste) is done. --- action.h | 16 + blupi.cpp | 155 ++++++ button.cpp | 417 ++++++++++++++++ button.h | 61 +++ ddutil.cpp | 415 +++++++++++++++ ddutil.h | 23 + decor.cpp | 59 +++ event.h | 220 ++++++++ fifo.h | 33 ++ jauge.h | 41 ++ menu.h | 48 ++ misc.h | 19 + movie.cpp | 298 +++++++++++ movie.h | 30 ++ pixmap.cpp | 1414 ++++++++++++++++++++++++++++++++++++++++++++++++++++ pixmap.h | 111 +++++ sound.cpp | 648 ++++++++++++++++++++++++ sound.h | 65 +++ text.cpp | 346 +++++++++++++ text.h | 35 ++ wave.cpp | 270 ++++++++++ wave.h | 14 + 22 files changed, 4738 insertions(+) create mode 100644 action.h create mode 100644 blupi.cpp create mode 100644 button.cpp create mode 100644 button.h create mode 100644 ddutil.cpp create mode 100644 ddutil.h create mode 100644 decor.cpp create mode 100644 event.h create mode 100644 fifo.h create mode 100644 jauge.h create mode 100644 menu.h create mode 100644 misc.h create mode 100644 movie.cpp create mode 100644 movie.h create mode 100644 pixmap.cpp create mode 100644 pixmap.h create mode 100644 sound.cpp create mode 100644 sound.h create mode 100644 text.cpp create mode 100644 text.h create mode 100644 wave.cpp create mode 100644 wave.h diff --git a/action.h b/action.h new file mode 100644 index 0000000..4227fcf --- /dev/null +++ b/action.h @@ -0,0 +1,16 @@ + + +extern +BOOL Action(short action, short direct, + short &phase, short &step, + short &channel, short &icon, POINT &pos, short &posZ, + short &sound); + +extern +BOOL Rotate (short &icon, short direct); + +extern +int GetIconDirect(short icon); + +extern +int GetAmplitude(short action); diff --git a/blupi.cpp b/blupi.cpp new file mode 100644 index 0000000..d65ca4a --- /dev/null +++ b/blupi.cpp @@ -0,0 +1,155 @@ +// blupi.cpp +// + +#define WIN32_LEAN_AND_MEAN + +#include +#include +#include +#include +#include +#include "def.h" +#include "resource.h" +#include "ddutil.h" +#include "pixmap.h" +#include "sound.h" +#include "decor.h" +#include "movie.h" +#include "button.h" +#include "menu.h" +#include "jauge.h" +#include "event.h" +#include "misc.h" + +// Define Globals + +#define NAME "Blupi" +#define TITLE "Eggbert" + + +// Variables Globals + +HWND g_hWnd; // handle � la fen�tre +CEvent* g_pEvent = NULL; +CPixmap* g_pPixmap = NULL; // pixmap principal +CSound* g_pSound = NULL; // sound principal +CMovie* g_pMovie = NULL; // movie principal +CDecor* g_pDecor = NULL; +char g_CDPath[MAX_PATH]; // chemin d'acc�s au CD-Rom +BOOL g_bFullScreen = FALSE; // FALSE si mode de test +int g_speedRate = 1; +int g_timerInterval = 50; // inverval = 50ms +int g_mouseType = MOUSETYPEGRA; +MMRESULT g_updateTimer; // timer g�n�ral +BOOL g_bActive = TRUE; // is application active ? +BOOL g_bTermInit = FALSE; // initialisation en cours + +UINT g_lastPhase = 999; + +int GetNum(char *p) +{ + int n = 0; + + while ( *p >= '0' && *p <= '9' ) + { + n *= 10; + n += (*p++)-'0'; + } + + return n; +} + +BOOL ReadConfig (LPSTR lpCmdLine) +{ + FILE* file = NULL; + char buffer[200]; + char* pText; + int nb; + + file = fopen("data\\config.def", "rb"); + if ( file == NULL ) return FALSE; + nb = fread(buffer, sizeof(char), 200-1 file); + buffer[nb] = 0; + fclose(file); + + +#if 0 + pText = strstr(buffer, "CD-Rom="); + if ( pText == NULL ) + { +#if _DEMO + GetCurrentDirectory(MAX_PATH, g_CDPath); + i = strlen (g_CDPath); + if ( i > 0 && g_CDPath [i-1] != '\\' ) + { + g_CDPath[i++] = '\\'; + g_CDPath[i] = 0; + } +#else + return FALSE; +#endif + } + else + { + pText += 7; + i = 0; + while ( pText[i] != 0 && pText[i] != '\n' && pText[i] != '\r' ) + { + g_CDPath[i] = pText[i]; + i ++; + } + if ( i > 0 && g_CDPath[i-1] != '\\' ) + { + g_CDPath[i++] = '\\'; + } + g_CDPath[i] = 0; // met le terminateur + } + +#if !_DEMO & !_EGAMES + if ( strstr(lpCmdLine, "-nocd") == NULL ) + { + char drive[10]; + + drive[0] = g_CDPath[0]; + drive[1] = ':'; + drive[2] = '\\'; + drive[3] = 0; + nb = GetDriveType(drive); + if ( nb != DRIVE_CDROM ) return FALSE; + } +#endif +#endif + + pText = strstr(buffer, "SpeedRate="); + if ( pText != NULL ) + { + g_speedRate = GetNum(pText+10); + if ( g_speedRate < 1 ) g_speedRate = 1; + if ( g_speedRate > 2 ) g_speedRate = 2; + } + + pText = strstr(buffer, "Timer="); + if ( pText != NULL ) + { + g_timerInterval = GetNum(pText+6); + if ( g_timerInterval < 10 ) g_timerInterval = 10; + if ( g_timerInterval > 1000 ) g_timerInterval = 1000; + } + + pText = strstr(buffer, "FullScreen="); + if ( pText != NULL ) + { + g_bFullScreen = GetNum(pText+11); + if ( g_bFullScreen != 0 ) g_bFullScreen = 1; + } + + pText = strstr(buffer, "MouseType="); + if ( pText != NULL ) + { + g_mouseType = GetNum(pText+10); + if ( g_mouseType < 1 ) g_mouseType = 1; + if ( g_mouseType > 9 ) g_mouseType = 9; + } + + return TRUE; +} \ No newline at end of file diff --git a/button.cpp b/button.cpp new file mode 100644 index 0000000..0e475e5 --- /dev/null +++ b/button.cpp @@ -0,0 +1,417 @@ +// Button.cpp +// + +#include +#include +#include +#include +#include "def.h" +#include "pixmap.h" +#include "sound.h" +#include "decor.h" +#include "button.h" +#include "misc.h" + + + +////////////////////////////////////////////////////////// + +// Constructor + +CButton:CButton() +{ + m_type = 0; + m_bEnable = TRUE; + m_bHide = FALSE; + m_state = 0; + m_mouseState = 0; + m_mbMenu = 0; + m_nbToolTips = 0; + m_selMenu = 0; + m_bMouseDown = FALSE; + m_bMinimizeRedraw = FALSE; + m_bRedraw = FALSE; +} + +// Destructor + +CButton:~CButton() +{ +} + + +// Create a new Button + +BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, + POINT pos, int type, BOOL bMinimizeRedraw, + int *pMenu, int nbMenu, + int *pToolTips, int nbToolTips, + int region, UINT message) +{ + POINT iconDim; + int i, icon; + + static int ttypes[] = + { + DIMBUTTONX,DIMBUTTONY, + }; + + if ( type < 0 || type > 0 ) return FALSE; + + iconDim.x = ttypes[type*2+0]; + iconDim.y = ttypes[type*2+1]; + + m_hWnd = hWnd; + m_pPixmap = pPixmap; + m_pSound = pSound; + m_type = type; + m_bMinimizeRedraw = bMinimizeRedraw; + m_bEnable = TRUE; + m_bHide = FALSE; + m_message = message; + m_pos = pos; + m_dim = iconDim; + m_nbMenu = nbMenu; + m_nbToolTips = nbToolTips; + m_selMenu = 0; + m_state = 0; + m_mouseState = 0; + m_bMouseDown = FALSE; + m_bRedraw = TRUE; + +/* Do we need this yet? +/////////////////////////////////////////////////// + for ( i=0 ; i