From c1ddd3580b58c65f8dce927ef32b63834f2e6764 Mon Sep 17 00:00:00 2001 From: HMVocaloid <66088611+HMVocaloid@users.noreply.github.com> Date: Fri, 17 May 2024 11:57:18 -0400 Subject: [PATCH 1/7] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index e46fcad..b09c60a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ # Speedy Eggbert 2 Source Code Decomp WIP Source Tree for Speedy Eggbert (Blupi) 2 + +With the help of jummy in the Blupi Games Fan Server and his extensive work on Ghidra, we've began to get a bigger understanding on how Speedy Eggbert 2 works. + +Why are we doing this? + As of now (5/17/24), there hasn't been any source code found for SE2. So we are using the released (original) source code from Planet Blupi to compare code and help us with the proccess. From 13aeb2b755cdf88e087f23046c13f30d7552090b Mon Sep 17 00:00:00 2001 From: HMVocaloid <66088611+HMVocaloid@users.noreply.github.com> Date: Fri, 17 May 2024 12:03:16 -0400 Subject: [PATCH 2/7] Update README.md --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index b09c60a..88ccc6e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,4 @@ # Speedy Eggbert 2 Source Code Decomp WIP Source Tree for Speedy Eggbert (Blupi) 2 -With the help of jummy in the Blupi Games Fan Server and his extensive work on Ghidra, we've began to get a bigger understanding on how Speedy Eggbert 2 works. - -Why are we doing this? As of now (5/17/24), there hasn't been any source code found for SE2. So we are using the released (original) source code from Planet Blupi to compare code and help us with the proccess. From 9934543901352af744a9d7c3972a40612e40c555 Mon Sep 17 00:00:00 2001 From: HMVocaloid <66088611+HMVocaloid@users.noreply.github.com> Date: Sun, 19 May 2024 17:10:33 -0400 Subject: [PATCH 3/7] More progress done --- event.cpp | 123 ++++++++++++++ jauge.cpp | 138 ++++++++++++++++ menu.cpp | 464 +++++++++++++++++++++++++++++++++++++++++++++++++++++ misc.cpp | 38 +++++ pixmap.cpp | 3 + 5 files changed, 766 insertions(+) create mode 100644 jauge.cpp create mode 100644 menu.cpp create mode 100644 misc.cpp diff --git a/event.cpp b/event.cpp index 5c65c67..e2f0765 100644 --- a/event.cpp +++ b/event.cpp @@ -1611,3 +1611,126 @@ int CEvent::GetMenu(int button) return m_buttons[index].GetMenu(); } + +void CEvent::SetMenu(int button, int menu) +{ + int index; + + index = GetButtonIndex(button); + if ( index < 0 ) return; + + m_buttons[index].SetMenu(menu); +} + +// Restore the game after activation in fullScreen mode. + +void CEvent::RestoreGame() +{ + int i; + + if ( m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_PLAYTEST) + + HideMouse(FALSE); + WaitMouse(TRUE); + WaitMouse(FALSE); +} +/* +void AddCheatCode(char *pDst, char *pSrc) +{ + int i, j; + + if ( pDst[0] != 0 ) strcat(pDst, " / "); + + i = 0; + j = strlen(pDst); + while ( pSrc[i] != 0 ) + { + pDst[j++] = tolower(pSrc[i++]); + } + pDst[j] = 0; +} +*/ + +void CEvent::DrawTextCenter(int res, int x, int y, int font) +{ + char text[100]; + POINT pos; + + LoadString(res, text, 100); + pos.x = x; + pos.y = y; + ::DrawTextCenter(m_pPixmap, pos, text, font); +} + +BOOL CEvent::DrawButtons() +{ + int i; + int levels[2]; + int types[2]; + int world, time, lg, button, volume, pente, icon; + char res[100]; + char text[100]; + POINT pos; + RECT rect; + BOOL bEnable; + + if ( (m_phase == WM_PHASE_INSERT && m_phase == WM_PHASE_BYE )) + { + m_bChangeCheat = FALSE; + + text[0] = 0; + if ( m_pDecor->GetInvincible() ) + { + AddCheatCode(text, cheat_code[3]); + } + if ( m_pDecor->GetShowSecret() ) + { + AddCheatCode(text, cheat_code[11]); + } + if ( m_pDecor->GetNetPacked() ) + { + AddCheatCode(text, cheat_code[19]); + } + } +} + +void CEvent::MouseSprite(POINT pos) +{ + m_mouseSprite = MousePosToSprite(pos); + + m_pPixmap->SetMousePosSprite(pos, m_mouseSprite, m_bDemoPlay); + ChangeSprite(m_mouseSprite); +} + +void CEvent::WaitMouse(BOOL bWait) +{ + m_bWaitMouse = bWait; + + if ( bWait ) + { + m_mouseSprite = SPRITE_WAIT; + } + else + { + m_mouseSprite = MousePosToSprite(GetMousePos()); + } + m_pPixmap->SetMouseSprite(m_mouseSprite, m_bDemoPlay); + ChangeSprite(m_mouseSprite); +} + +void CEvent::HideMouse(BOOL bHide) +{ + m_bWaitMouse = bHide; + + if ( bHide ) + { + m_mouseSprite = SPRITE_WAIT; + } + else + { + m_mouseSprite = MousePosToSprite(GetMousePos()); + } + m_pPixmap->SetMouseSprite(m_mouseSprite, m_bDemoPlay); + ChangeSprite(m_mouseSprite); +} + diff --git a/jauge.cpp b/jauge.cpp new file mode 100644 index 0000000..90b4260 --- /dev/null +++ b/jauge.cpp @@ -0,0 +1,138 @@ +// Jauge.cpp +// + +#include +#include +#include +#include +#include "def.h" +#include "pixmap.h" +#include "sound.h" +#include "decor.h" +#include "jauge.h" +#include "misc.h" + + + +///////////////////////////////////////////////////////////////// + +// Constructor + +CJauge::CJauge() +{ + m_type = 0; + m_bHide = TRUE; + m_bMinimizeRedraw = FALSE; + m_bRedraw = FALSE; +} + +// Destructor + +CJauge::~CJauge() +{ +} + +// Create a new Button. + +BOOL CJauge::Create(HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, + POINT pos, int type, BOOL bMinimizeRedraw) +{ + m_hWnd = hWnd; + m_pPixmap = pPixmap; + m_pDecor = pDecor; + m_type = type; + m_bMinimizeRedraw = bMinimizeRedraw; + m_bHide = TRUE; + m_pos = pos; + m_dim.x = DIMJAUGEX; + m_dim.y = DIMJAUGEY; + m_level = 0; + m_bRedraw = TRUE; +} + +void CJauge::Draw() +{ + int part; + RECT rect; + + if ( m_bMinimizeRedraw && !m_bRedraw ) return; + m_bRedraw = FALSE; + + if ( m_bHide ) // bouton cach� ? + { + rect.left = m_pos.x; + rect.right = m_pos.x+m_dim.x; + rect.top = m_pos.y; + rect.bottom = m_pos.y+m_dim.y; + m_pPixmap->DrawPart(-1, CHBACK, m_pos, rect, 1); // dessine le fond + return; + } + + part = (m_level*(DIMJAUGEX-6-4))/100; + + rect.left = 0; + rect.right = DIMJAUGEX; + rect.top = DIMJAUGEY*0; + rect.bottom = DIMJAUGEY*1; + m_pPixmap->DrawPart(-1, CHJAUGE, m_pos, rect); // partie noire + + if ( part > 0 ) + { + rect.left = 0; + rect.right = 6+part; + rect.top = DIMJAUGEY*m_type; + rect.bottom = DIMJAUGEY*(m_type+1); + m_pPixmap->DrawPart(-1, CHJAUGE, m_pos, rect); // partie color�e + } +} + +void CJauge::Redraw() +{ + m_bRedraw = TRUE; +} + +void CJauge::SetLevel(int level) +{ + if ( level < 0 ) level = 0; + if ( level > 100 ) level = 100; + + if ( m_level != level ) + { + m_bRedraw = TRUE; + } + + m_level = level; +} + +/* +int CJauge::GetType() +{ + return m_type; +} +*/ + +void CJauge::SetType(int type) +{ + if ( m_type != type ) + { + m_bRedraw = TRUE; + } + + m_type = type; +} + +BOOL CJauge::GetHide() +{ + return m_bHide; +} + +void CJauge::SetHide(BOOL bHide) +{ + if ( m_bHide != bHide ) + { + m_bRedraw = TRUE; + } + + m_bHide = bHide; +} + diff --git a/menu.cpp b/menu.cpp new file mode 100644 index 0000000..2e95ab7 --- /dev/null +++ b/menu.cpp @@ -0,0 +1,464 @@ +// Menu.cpp +// + +#include +#include +#include +#include +#include "def.h" +#include "resource.h" +#include "pixmap.h" +#include "sound.h" +#include "decor.h" +#include "button.h" +#include "menu.h" +#include "text.h" +#include "misc.h" + + +///////////////////////////////////////////////////////////////////////////// + + +#define MARGMENU 0 + + +static short table_button_icon[] = +{ + 24, // go + 40, // stop + 32, // mange + 30, // carry + 31, // depose + 22, // abat + 27, // roc + 28, // cultive + 19, // build1 (cabane) + 25, // build2 (couveuse) + 35, // build3 (laboratoire) + 61, // build4 (mine) + 59, // build5 (usine) + 101, // build6 (t�l�porteur) + 20, // mur + 26, // palis + 42, // abat n + 43, // roc n + 23, // pont + 33, // tour + 34, // boit + 39, // labo + 54, // fleur + 55, // fleur n + 41, // dynamite + 58, // bateau + 60, // djeep + 64, // drapeau + 62, // extrait du fer + 65, // fabrique jeep + 63, // fabrique mine + 83, // fabrique disciple + 100, // repeat + 107, // qarmure + 106, // fabarmure +}; + +void GetText(int rank, char *pBuffer, int lgBuffer) +{ + LoadString(TX_ACTION_GO+rank, pBuffer, lgBuffer); +} + +void GetErr(int rank, char *pBuffer, int lgBuffer) +{ + LoadString(TX_ERROR_MISC+rank, pBuffer, lgBuffer); +} + +///////////////////////////////////////////////////////////////////////////// + +CMenu::CMenu() +{ + m_nbButtons = 0; + m_selRank = -1; +} + +CMenu::~CMenu() +{ +} + +void CMenu::Delete() +{ + m_nbButtons = 0; + m_selRank = -1; +} + +BOOL CMenu::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam) +{ + POINT pos; + + if ( m_nbButtons == 0 ) return FALSE; + + pos = ConvLongToPos(lParam); + + switch( message ) + { + case WM_LBUTTONDOWN: + case WM_RBUTTONDOWN: + if ( MouseDown(pos) ) return TRUE; + break; + + case WM_MOUSEMOVE: + if ( MouseMove(pos) ) return TRUE; + break; + case WM_LBUTTONUP: + case WM_RBUTTONUP: + if ( MouseUp(pos) ) return TRUE; + break; + } + + return FALSE; +} + +int CMenu::Detect(POINT pos) +{ + int rank; + + if ( pos.x < m_pos.x || pos.x > m_pos.x+m_dim.x || + pos.y < m_pos.y || pos.y > m_pos.y+m_dim.y ) return -1; + + rank = (pos.y-m_pos.y)/(DIMBUTTONY+MARGMENU); + rank += ((pos.x-m_pos.x)/(DIMBUTTONX+MARGMENU))*m_nbCel.y; + + if ( rank >= m_nbButtons ) return -1; + return rank; +} + +BOOL CMenu::MouseDown(POINT pos) +{ + return FALSE; +} + +BOOL CMenu::MouseMove(POINT pos) +{ + m_mousePos = pos; + m_selRank = Detect(pos); + + if ( pos.x < m_pos.x-(DIMBUTTONX+MARGMENU) || + pos.x > m_pos.x+m_dim.x+(DIMBUTTONX+MARGMENU) || + pos.y < m_pos.y-(DIMBUTTONY+MARGMENU) || + pos.y > m_pos.y+m_dim.y+(DIMBUTTONY+MARGMENU) ) + { + Delete(); // enl�ve le menu si souris trop loin ! + } + + return FALSE; +} + +BOOL CMenu::MouseUp(POINT pos) +{ + m_mousePos = pos; + m_selRank = Detect(pos); + + return FALSE; +} + +void ChangeSprite(int sprite) +{ + HCURSOR hCursor = nullptr; + + if ( g_mouseType == MOUSETYPEGRA ) return; + if ( g_lastSprite == sprite ) return; + + if ( sprite == SPRITE_ARROW ) hCursor = LoadCursor(g_hInstance, "IDC_ARROW"); + if ( sprite == SPRITE_POINTER ) hCursor = LoadCursor(g_hInstance, "IDC_POINTER"); + if ( sprite == SPRITE_MAP ) hCursor = LoadCursor(g_hInstance, "IDC_MAP"); + if ( sprite == SPRITE_ARROWU ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWU"); + if ( sprite == SPRITE_ARROWD ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWD"); + if ( sprite == SPRITE_ARROWL ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWL"); + if ( sprite == SPRITE_ARROWR ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWR"); + if ( sprite == SPRITE_ARROWUL ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWUL"); + if ( sprite == SPRITE_ARROWUR ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWUR"); + if ( sprite == SPRITE_ARROWDL ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWDL"); + if ( sprite == SPRITE_ARROWDR ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWDR"); + if ( sprite == SPRITE_WAIT ) hCursor = LoadCursor(g_hInstance, "IDC_WAIT"); + if ( sprite == SPRITE_EMPTY ) hCursor = LoadCursor(g_hInstance, "IDC_EMPTY"); + if ( sprite == SPRITE_FILL ) hCursor = LoadCursor(g_hInstance, "IDC_FILL"); + SetCursor(hCursor); + + g_lastSprite = sprite; +} + +POINT ConvLongToPos(LPARAM lParam) +{ + POINT pos; + + pos.x = LOWORD(lParam); + pos.y = HIWORD(lParam); + + return pos; +} + +void InitRandom() +{ + srand(1); +} + +int Random(int min, int max) +{ + long n; + + n = rand(); + n = min+(n%(max-min+1)); + + return (int)n; +} + +void GetCurrentDir(char *pName, int lg) +{ + int i; + + strncpy(pName, _pgmptr, lg-1); + pName[lg-1] = 0; + + lg = strlen(pName); + if ( lg == 0 ) return; + + for ( i=0 ; i 0 ) + { + lg --; + if ( pName[lg] == '\\' ) + { + pName[lg+1] = 0; + break; + } + } + + if ( lg > 6 && strcmp(pName+lg-6, "\\debug\\") == 0 ) + { + pName[lg-5] = 0; // ignore le dossier \debug ! + } +} + +// Add proper dir(s) later + +void AddCDPath(char *pFilename) +{ + char temp[MAX_PATH]; + int lg; + BOOL bDaniel = FALSE; + + if ( g_CDPath[0] == 0 ) return; + + lg = strlen(g_CDPath); + if ( lg > 14 && strstr(g_CDPath+lg-14, "\\daniel\\blupi\\") ) + { + bDaniel = TRUE; + } + +#if _DEMO + strcpy(temp, g_CDPath); + strcat(temp, pFilename); +#else + if ( !bDaniel && + (strstr(pFilename, "image\\") == pFilename || + strstr(pFilename, "movie\\") == pFilename) ) + { + strcpy(temp, g_CDPath); + strcat(temp, "..\\"); + strcat(temp, pFilename); + } + else + { + strcpy(temp, g_CDPath); + strcat(temp, pFilename); + } +#endif + + strcpy(pFilename, temp); +} + +void AddUserPath(char *pFilename) +{ + char temp[MAX_PATH]; + char* pText; + int pos; + char last; + SECURITY_ATTRIBUTES att; + + if ( g_CDPath[0] != 0 ) return; + +#if _EGAMES + strcpy(temp, "c:\\Speedy Eggbert 2\\"); +#else + strcpy(temp, "c:\\Speedy Blupi 2\\"); +#endif + + att.nLength = sizeof(SECURITY_ATTRIBUTES); + att.lpSecurityDescriptor = NULL; + att.bInheritHandle = FALSE; + CreateDirectory(temp, &att); + + pText = strstr(pFilename, "\\"); + if ( pText != NULL ) + { + pos = strlen(temp)+(pText-pFilename)+1; + strcat(temp, pFilename); + last = temp[pos]; + temp[pos] = 0; + CreateDirectory(temp, &att); + temp[pos] = last; + } + else + { + strcat(temp, pFilename); + } + + strcpy(pFilename, temp); +} + +void TraceErrorDD(HRESULT hErr, char *sFile, int nLine) +{ + char dderr[256]; + char err[1024]; + + switch (hErr) + { + case DD_OK : sprintf(dderr, "DD_OK"); break; + case DDERR_ALREADYINITIALIZED : sprintf(dderr, "DDERR_ALREADYINITIALIZED"); break; + case DDERR_CANNOTATTACHSURFACE : sprintf(dderr, "DDERR_CANNOTATTACHSURFACE"); break; + case DDERR_CANNOTDETACHSURFACE : sprintf(dderr, "DDERR_CANNOTDETACHSURFACE"); break; + case DDERR_CURRENTLYNOTAVAIL : sprintf(dderr, "DDERR_CURRENTLYNOTAVAIL"); break; + case DDERR_EXCEPTION : sprintf(dderr, "DDERR_EXCEPTION"); break; + case DDERR_GENERIC : sprintf(dderr, "DDERR_GENERIC"); break; + case DDERR_HEIGHTALIGN : sprintf(dderr, "DDERR_HEIGHTALIGN"); break; + case DDERR_INCOMPATIBLEPRIMARY : sprintf(dderr, "DDERR_INCOMPATIBLEPRIMARY"); break; + case DDERR_INVALIDCAPS : sprintf(dderr, "DDERR_INVALIDCAPS"); break; + case DDERR_INVALIDCLIPLIST : sprintf(dderr, "DDERR_INVALIDCLIPLIST"); break; + case DDERR_INVALIDMODE : sprintf(dderr, "DDERR_INVALIDMODE"); break; + case DDERR_INVALIDOBJECT : sprintf(dderr, "DDERR_INVALIDOBJECT"); break; + case DDERR_INVALIDPARAMS : sprintf(dderr, "DDERR_INVALIDPARAMS"); break; + case DDERR_INVALIDPIXELFORMAT : sprintf(dderr, "DDERR_INVALIDPIXELFORMAT"); break; + case DDERR_INVALIDRECT : sprintf(dderr, "DDERR_INVALIDRECT"); break; + case DDERR_LOCKEDSURFACES : sprintf(dderr, "DDERR_LOCKEDSURFACES"); break; + case DDERR_NO3D : sprintf(dderr, "DDERR_NO3D"); break; + case DDERR_NOALPHAHW : sprintf(dderr, "DDERR_NOALPHAHW"); break; + case DDERR_NOCLIPLIST : sprintf(dderr, "DDERR_NOCLIPLIST"); break; + case DDERR_NOCOLORCONVHW : sprintf(dderr, "DDERR_NOCOLORCONVHW"); break; + case DDERR_NOCOOPERATIVELEVELSET : sprintf(dderr, "DDERR_NOCOOPERATIVELEVELSET"); break; + case DDERR_NOCOLORKEY : sprintf(dderr, "DDERR_NOCOLORKEY"); break; + case DDERR_NOCOLORKEYHW : sprintf(dderr, "DDERR_NOCOLORKEYHW"); break; + case DDERR_NODIRECTDRAWSUPPORT : sprintf(dderr, "DDERR_NODIRECTDRAWSUPPORT"); break; + case DDERR_NOEXCLUSIVEMODE : sprintf(dderr, "DDERR_NOEXCLUSIVEMODE"); break; + case DDERR_NOFLIPHW : sprintf(dderr, "DDERR_NOFLIPHW"); break; + case DDERR_NOGDI : sprintf(dderr, "DDERR_NOGDI"); break; + case DDERR_NOMIRRORHW : sprintf(dderr, "DDERR_NOMIRRORHW"); break; + case DDERR_NOTFOUND : sprintf(dderr, "DDERR_NOTFOUND"); break; + case DDERR_NOOVERLAYHW : sprintf(dderr, "DDERR_NOOVERLAYHW"); break; + case DDERR_NORASTEROPHW : sprintf(dderr, "DDERR_NORASTEROPHW"); break; + case DDERR_NOROTATIONHW : sprintf(dderr, "DDERR_NOROTATIONHW"); break; + case DDERR_NOSTRETCHHW : sprintf(dderr, "DDERR_NOSTRETCHHW"); break; + case DDERR_NOT4BITCOLOR : sprintf(dderr, "DDERR_NOT4BITCOLOR"); break; + case DDERR_NOT4BITCOLORINDEX : sprintf(dderr, "DDERR_NOT4BITCOLORINDEX"); break; + case DDERR_NOT8BITCOLOR : sprintf(dderr, "DDERR_NOT8BITCOLOR"); break; + case DDERR_NOTEXTUREHW : sprintf(dderr, "DDERR_NOTEXTUREHW"); break; + case DDERR_NOVSYNCHW : sprintf(dderr, "DDERR_NOVSYNCHW"); break; + case DDERR_NOZBUFFERHW : sprintf(dderr, "DDERR_NOZBUFFERHW"); break; + case DDERR_NOZOVERLAYHW : sprintf(dderr, "DDERR_NOZOVERLAYHW"); break; + case DDERR_OUTOFCAPS : sprintf(dderr, "DDERR_OUTOFCAPS"); break; + case DDERR_OUTOFMEMORY : sprintf(dderr, "DDERR_OUTOFMEMORY"); break; + case DDERR_OUTOFVIDEOMEMORY : sprintf(dderr, "DDERR_OUTOFVIDEOMEMORY"); break; + case DDERR_OVERLAYCANTCLIP : sprintf(dderr, "DDERR_OVERLAYCANTCLIP"); break; + case DDERR_OVERLAYCOLORKEYONLYONEACTIVE : sprintf(dderr, "DDERR_OVERLAYCOLORKEYONLYONEACTIVE"); break; + case DDERR_PALETTEBUSY : sprintf(dderr, "DDERR_PALETTEBUSY"); break; + case DDERR_COLORKEYNOTSET : sprintf(dderr, "DDERR_COLORKEYNOTSET"); break; + case DDERR_SURFACEALREADYATTACHED : sprintf(dderr, "DDERR_SURFACEALREADYATTACHED"); break; + case DDERR_SURFACEALREADYDEPENDENT : sprintf(dderr, "DDERR_SURFACEALREADYDEPENDENT"); break; + case DDERR_SURFACEBUSY : sprintf(dderr, "DDERR_SURFACEBUSY"); break; + case DDERR_CANTLOCKSURFACE : sprintf(dderr, "DDERR_CANTLOCKSURFACE"); break; + case DDERR_SURFACEISOBSCURED : sprintf(dderr, "DDERR_SURFACEISOBSCURED"); break; + case DDERR_SURFACELOST : sprintf(dderr, "DDERR_SURFACELOST"); break; + case DDERR_SURFACENOTATTACHED : sprintf(dderr, "DDERR_SURFACENOTATTACHED"); break; + case DDERR_TOOBIGHEIGHT : sprintf(dderr, "DDERR_TOOBIGHEIGHT"); break; + case DDERR_TOOBIGSIZE : sprintf(dderr, "DDERR_TOOBIGSIZE"); break; + case DDERR_TOOBIGWIDTH : sprintf(dderr, "DDERR_TOOBIGWIDTH"); break; + case DDERR_UNSUPPORTED : sprintf(dderr, "DDERR_UNSUPPORTED"); break; + case DDERR_UNSUPPORTEDFORMAT : sprintf(dderr, "DDERR_UNSUPPORTEDFORMAT"); break; + case DDERR_UNSUPPORTEDMASK : sprintf(dderr, "DDERR_UNSUPPORTEDMASK"); break; + case DDERR_VERTICALBLANKINPROGRESS : sprintf(dderr, "DDERR_VERTICALBLANKINPROGRESS"); break; + case DDERR_WASSTILLDRAWING : sprintf(dderr, "DDERR_WASSTILLDRAWING"); break; + case DDERR_XALIGN : sprintf(dderr, "DDERR_XALIGN"); break; + case DDERR_INVALIDDIRECTDRAWGUID : sprintf(dderr, "DDERR_INVALIDDIRECTDRAWGUID"); break; + case DDERR_DIRECTDRAWALREADYCREATED : sprintf(dderr, "DDERR_DIRECTDRAWALREADYCREATED"); break; + case DDERR_NODIRECTDRAWHW : sprintf(dderr, "DDERR_NODIRECTDRAWHW"); break; + case DDERR_PRIMARYSURFACEALREADYEXISTS : sprintf(dderr, "DDERR_PRIMARYSURFACEALREADYEXISTS"); break; + case DDERR_NOEMULATION : sprintf(dderr, "DDERR_NOEMULATION"); break; + case DDERR_REGIONTOOSMALL : sprintf(dderr, "DDERR_REGIONTOOSMALL"); break; + case DDERR_CLIPPERISUSINGHWND : sprintf(dderr, "DDERR_CLIPPERISUSINGHWND"); break; + case DDERR_NOCLIPPERATTACHED : sprintf(dderr, "DDERR_NOCLIPPERATTACHED"); break; + case DDERR_NOHWND : sprintf(dderr, "DDERR_NOHWND"); break; + case DDERR_HWNDSUBCLASSED : sprintf(dderr, "DDERR_HWNDSUBCLASSED"); break; + case DDERR_HWNDALREADYSET : sprintf(dderr, "DDERR_HWNDALREADYSET"); break; + case DDERR_NOPALETTEATTACHED : sprintf(dderr, "DDERR_NOPALETTEATTACHED"); break; + case DDERR_NOPALETTEHW : sprintf(dderr, "DDERR_NOPALETTEHW"); break; + case DDERR_BLTFASTCANTCLIP : sprintf(dderr, "DDERR_BLTFASTCANTCLIP"); break; + case DDERR_NOBLTHW : sprintf(dderr, "DDERR_NOBLTHW"); break; + case DDERR_NODDROPSHW : sprintf(dderr, "DDERR_NODDROPSHW"); break; + case DDERR_OVERLAYNOTVISIBLE : sprintf(dderr, "DDERR_OVERLAYNOTVISIBLE"); break; + case DDERR_NOOVERLAYDEST : sprintf(dderr, "DDERR_NOOVERLAYDEST"); break; + case DDERR_INVALIDPOSITION : sprintf(dderr, "DDERR_INVALIDPOSITION"); break; + case DDERR_NOTAOVERLAYSURFACE : sprintf(dderr, "DDERR_NOTAOVERLAYSURFACE"); break; + case DDERR_EXCLUSIVEMODEALREADYSET : sprintf(dderr, "DDERR_EXCLUSIVEMODEALREADYSET"); break; + case DDERR_NOTFLIPPABLE : sprintf(dderr, "DDERR_NOTFLIPPABLE"); break; + case DDERR_CANTDUPLICATE : sprintf(dderr, "DDERR_CANTDUPLICATE"); break; + case DDERR_NOTLOCKED : sprintf(dderr, "DDERR_NOTLOCKED"); break; + case DDERR_CANTCREATEDC : sprintf(dderr, "DDERR_CANTCREATEDC"); break; + case DDERR_NODC : sprintf(dderr, "DDERR_NODC"); break; + case DDERR_WRONGMODE : sprintf(dderr, "DDERR_WRONGMODE"); break; + case DDERR_IMPLICITLYCREATED : sprintf(dderr, "DDERR_IMPLICITLYCREATED"); break; + case DDERR_NOTPALETTIZED : sprintf(dderr, "DDERR_NOTPALETTIZED"); break; + case DDERR_UNSUPPORTEDMODE : sprintf(dderr, "DDERR_UNSUPPORTEDMODE"); break; + case DDERR_NOMIPMAPHW : sprintf(dderr, "DDERR_NOMIPMAPHW"); break; + case DDERR_INVALIDSURFACETYPE : sprintf(dderr, "DDERR_INVALIDSURFACETYPE"); break; + case DDERR_DCALREADYCREATED : sprintf(dderr, "DDERR_DCALREADYCREATED"); break; + case DDERR_CANTPAGELOCK : sprintf(dderr, "DDERR_CANTPAGELOCK"); break; + case DDERR_CANTPAGEUNLOCK : sprintf(dderr, "DDERR_CANTPAGEUNLOCK"); break; + case DDERR_NOTPAGELOCKED : sprintf(dderr, "DDERR_NOTPAGELOCKED"); break; + case DDERR_NOTINITIALIZED : sprintf(dderr, "DDERR_NOTINITIALIZED"); break; + + default : sprintf(dderr, "Unknown Error"); break; + } + sprintf(err, "DirectDraw Error %s in file %s at line %d\n", dderr, sFile, nLine); + OutputDebug(err); +} + +void TraceErrorDS(HRESULT hErr, char *sFile, int nLine) +{ + char dserr[256]; + char err[1024]; + + switch (hErr) + { + case DS_OK : sprintf(dserr, "DD_OK"); break; + case DSERR_ALLOCATED : sprintf(dserr, "DSERR_ALLOCATED"); break; + case DSERR_CONTROLUNAVAIL : sprintf(dserr, "DSERR_CONTROLUNAVAIL"); break; + case DSERR_INVALIDPARAM : sprintf(dserr, "DSERR_INVALIDPARAM"); break; + case DSERR_INVALIDCALL : sprintf(dserr, "DSERR_INVALIDCALL"); break; + case DSERR_GENERIC : sprintf(dserr, "DSERR_GENERIC"); break; + case DSERR_PRIOLEVELNEEDED : sprintf(dserr, "DSERR_PRIOLEVELNEEDED"); break; + case DSERR_OUTOFMEMORY : sprintf(dserr, "DSERR_OUTOFMEMORY"); break; + case DSERR_BADFORMAT : sprintf(dserr, "DSERR_BADFORMAT"); break; + case DSERR_UNSUPPORTED : sprintf(dserr, "DSERR_UNSUPPORTED"); break; + case DSERR_NODRIVER : sprintf(dserr, "DSERR_NODRIVER"); break; + case DSERR_ALREADYINITIALIZED : sprintf(dserr, "DSERR_ALREADYINITIALIZED"); break; + case DSERR_NOAGGREGATION : sprintf(dserr, "DSERR_NOAGGREGATION"); break; + case DSERR_BUFFERLOST : sprintf(dserr, "DSERR_BUFFERLOST"); break; + case DSERR_OTHERAPPHASPRIO : sprintf(dserr, "DSERR_OTHERAPPHASPRIO"); break; + case DSERR_UNINITIALIZED : sprintf(dserr, "DSERR_UNINITIALIZED"); break; + + default : sprintf(dserr, "Unknown Error"); break; + } + sprintf(err, "DirectSound Error %s in file %s at line %d\n", dserr, sFile, nLine); + OutputDebug(err); +} \ No newline at end of file diff --git a/misc.cpp b/misc.cpp new file mode 100644 index 0000000..c939f23 --- /dev/null +++ b/misc.cpp @@ -0,0 +1,38 @@ +// Misc.cpp +// + + +#include +#include +#include +#include +#include "def.h" + + +// Global Variables + +HINSTANCE g_hInstance; +int g_lastSprite = 0; +extern BOOL g_bFullScreen; +extern int g_mouseType; +extern char g_CDPath[MAX_PATH]; + +//Initalize HInstance. + +void InitHInstance(HINSTANCE hInstance) +{ + g_hInstance = hInstance; +} + +void OutputDebug(char *pMessage) +{ +#ifdef _DEBUG + OutputDebugString(pMessage); +#endif +} + +void LoadString(UINT nID, char *pBuffer, int lgBuffer) +{ + LoadString(g_hInstance, nID, pBuffer, lgBuffer); +} + diff --git a/pixmap.cpp b/pixmap.cpp index ed20619..6c0f1c0 100644 --- a/pixmap.cpp +++ b/pixmap.cpp @@ -22,6 +22,9 @@ CPixmap::CPixmap() int i; m_bFullScreen = FALSE; + m_bBenchmarkSuccess = TRUE; + m_bTrueColor = FALSE; + m_bTrueColorDecor = FALSE; m_mouseType = MOUSETYPEGRA; m_bDebug = TRUE; m_bPalette = TRUE; From 3575f029a60e20e1a49f8aae3d57dd7c9c36ad64 Mon Sep 17 00:00:00 2001 From: HMVocaloid <66088611+HMVocaloid@users.noreply.github.com> Date: Mon, 20 May 2024 09:01:51 -0400 Subject: [PATCH 4/7] Update blupi.cpp --- blupi.cpp | 232 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 231 insertions(+), 1 deletion(-) diff --git a/blupi.cpp b/blupi.cpp index d65ca4a..21aea1a 100644 --- a/blupi.cpp +++ b/blupi.cpp @@ -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; -} \ No newline at end of file +} + +// Rewrite Variables + +void UpdateFrame(void) +{ + RECT clip, rcRect; + UINT phase; + POINT posMouse; + int i, term, speed; + + g_pPixmap->MouseBackClear(); // enl�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 ; iBlupiStep(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 �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� + } + + 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; +} From f58de3167ffb94ee3c2f22eb4f383422bf835a72 Mon Sep 17 00:00:00 2001 From: HMVocaloid <66088611+HMVocaloid@users.noreply.github.com> Date: Tue, 21 May 2024 12:47:46 -0400 Subject: [PATCH 5/7] Added decor.h and updated blupi.cpp --- blupi.cpp | 273 ++++++++++++++++++++++- decor.h | 656 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 928 insertions(+), 1 deletion(-) create mode 100644 decor.h diff --git a/blupi.cpp b/blupi.cpp index 21aea1a..6fda44f 100644 --- a/blupi.cpp +++ b/blupi.cpp @@ -169,6 +169,15 @@ BOOL ReadConfig (LPSTR lpCmdLine) if (i == 16) g_bTrueColor = 1; } + pText = strstr(buffer, "TrueColorDecor="); + if ( pText != NULL ) + { + i = GetNum(pText + 15); + if (i == 8) g_bTrueColorDecor = 0; + + if (i == 16) g_bTrueColorDecor = 1; + } + return TRUE; } @@ -187,7 +196,7 @@ void UpdateFrame(void) phase = g_pEvent->GetPhase(); if ( phase == g_lastPhase && - phase == WM_PHASE_PLAY ) + phase == WM_PHASE_PLAY || phase == WM_PHASE_PLAYTEST || phase == WM_PHASE_BUILD ) { //? rcRect.left = POSDRAWX; //? rcRect.top = POSDRAWY; @@ -337,6 +346,160 @@ static void FinishObjects(void) } } +LRESULT CALLBACK WindowProc (HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam) +{ + static HINSTANCE hInstance; + POINT mousePos, totalDim, iconDim; +#if 0 + if ( message != WM_TIMER ) + { + char s[100]; + sprintf(s, "message=%d,%d\n", message, wParam); + OutputDebug(s); + } +#endif + + if ( message == WM_SYSKEYDOWN && wParam == VK_F10 ) + { + message = WM_KEYDOWN; + } + if ( message == WM_SYSKEYUP && wParam == VK_F10 ) + { + message = WM_KEYUP; + } + + if ( g_pEvent != NULL && + g_pEvent->TreatEvent(message, wParam, lParam) ) return 0; + + switch( message ) + { + case WM_SYSCOLORCHANGE: + OutputDebug("Event WM_SYSCOLORCHANGE\n"); + break; + case WM_CREATE: + hInstance = ((LPCREATESTRUCT)lParam)->hInstance; + return 0; + break; + + case WM_ACTIVATEAPP: + g_bActive = (wParam != 0); + if ( g_bActive ) + { + if ( g_bFullScreen ) + { + RestoreGame(); + g_lastPhase = 999; + } + if ( !g_bFullScreen && g_bTermInit ) + { + totalDim.x = 64; + totalDim.y = 66; + iconDim.x = 64; + iconDim.y = 66/2; + g_pPixmap->Cache(CHLITTLE, "image16\\little.blp", totalDim, iconDim, TRUE); + g_pPixmap->SetTransparent(CHLITTLE, RGB(0,0,255)); + + g_pPixmap->SavePalette(); + g_pPixmap->InitSyspallete(); + } + SetWindowText(hWnd, "Blupi"); + if ( g_pSound != NULL ) g_pSound->RestartMusic(); + } + else + { + if ( g_bFullScreen ) + { + FlushGame(); + } + SetWindowText(hWnd, "Blupi -- stop"); + if ( g_pSound != NULL ) g_pSound->SuspendMusic(); + } + return 0; + + case WM_KEYDOWN: + switch( wParam ) + { + case VK_F5: + g_pEvent->SetSpeed(1); + break; + case VK_F6: + g_pEvent->SetSpeed(2); + break; + case VK_F7: + g_pEvent->SetSpeed(4); + break; + case VK_F8: + g_pEvent->SetSpeed(8); + break; + } + break; + + case WM_DISPLAYCHANGE: + OutputDebug("Event WM_DISPLAYCHANGE\n"); + break; + case WM_QUERYNEWPALLETE: + OutputDebug("Event WM_QUERYNEWPALETTE\n"); + break; + case WM_PALETTECHANGED: + OutputDebug("Event WM_PALLETECHANGED\n"); + break; + case MM_MCINOTIFY: + OutputDebug("Event MM_MCINOTIFY\n"); + if ( g_pEvent->IsMovie() ) + { + if ( wParam == MCI_NOTIFY_SUCCESSFUL ) + { + g_pEvent->StopMovie(); + } + } + else + { + g_pSound->SuspendMusic(); + if ( wParam == MCI_NOTIFY_SUCESSFUL ) + { + OutputDebug("Event MCI_NOTIFY_SUCCESSFUL\n"); + g_pSound->RestartMusic(); + } + else + { + char s[50]; + sprintf(s, "wParam=%d\n", wParam); + OutputDebug(s); + } + } + break; + + case WM_LBUTTONDOWN: + GetCursorPos(&mousePos); + ScreenToClient(hWnd, &mousePos); + break; + + case WM_DESTROY: + KillTimer(g_hWnd, 1); + FinishObjects(); + PostQuitMessage(0); + break; + case WM_SETCUROR: +// ChangeSprite(); +// SetCursor(NULL); + return TRUE; + case WM_UPDATE: + if ( !g_pEvent->IsMovie() ) + { + if ( g_bActive ) + { + UpdateFrame(); + } + g_pPixmap->Display(); + } + break; + } + + return DefWindowProc(hWnd, message, wParam, lParam); + +} + BOOL InitFail(char *msg, BOOL bDirectX) { char buffer[100]; @@ -352,6 +515,114 @@ BOOL InitFail(char *msg, BOOL bDirectX) return FALSE; } +static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) +{ + WNDCLASS wc; + POINT totalDim, iconDim; + RECT rcRect; + BOOL bOK; + + bOK = ReadConfig(lpCmdLine); + + InitHInstance(hInstance); + + wc.style = CS_HREDRAW|CS_VREDRAW; + wc.lpfnWndProc = WindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(hInstance, "IDR_MAINFRAME"); + wc.hCursor = LoadCursor(hInstance, "IDC_POINTER"); + wc.hbrBackground = GetStockBrush(BLACK_BRUSH); + wc.lpszMenuMane = NAME; + wc.lpszClassName = NAME; + RegisterClass(&wc); + + if ( g_bFullScreen ) + { + g_hWnd = CreateWindowEx + ( + WS_EX_TOPMOST, + NAME, + TITLE, + WS_POPUP, + 0, 0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + NULL, + NULL, + hInstance, + NULL + ); + } + else + { + int sx, sy; + RECT WindowRect; + + sx = GetSystemMetrics(SM_CXSCREEN); + sy = GetSystemMetrics(SM_CYSCREEN); + + 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); + + g_hWnd = CreateWindow + ( + NAME, + TITLE, + WS_POPUPWINDOW|WS_CAPTION|WS_VISIBLE, + (sx-LXIMAGE)/2, (sy-LYIMAGE)/2, + WindowRect.right - WindowRect.left, + WindowRect.bottom - WindowRect.top, + HWND_DESKTOP, + NULL, + hInstance, + NULL + ); + } + if ( !g_hWnd ) return FALSE; + + ShowWindow(g_hWnd, nCmdShow); + UpdateWindow(g_hWnd); + SetFocus(g_hWnd); + + ChangeSprite(SPRITE_WAIT); + + if ( !bOk ) + { + return InitFail("Game not correctly installed", FALSE); + } + + g_pPixmap = new CPixmap; + if ( g_pPixmap == NULL ) return InitFail("New pixmap", TRUE); + + totalDim.x = LXIMAGE; + totalDim.y = LYIMAGE; + if ( !g_pPixmap->Create(g_hWnd, totalDim, g_bFullScreen, g_mouseType) ) + return InitFail("Create pixmap", TRUE); + + OutputDebug("Image: init\n"); + totalDim.x = LXIMAGE; + totalDim.y = LYIMAGE; + iconDim.x = 0; + iconDim.y = 0; +#if _INTRO + if ( !g_pPixmap->Cache(CHBACK, "image16\\init.blp", totalDim, iconDim, TRUE) ) +#else + if ( !g_pPixmap->Cache(CHBACK, "image16\\init.blp", totalDim, iconDim, TRUE) ) +#endif + return FALSE; + + OutputDebug("SavePalette\n"); + g_pPixmap->SavePalette(); + OutputDebug("InitSysPalette\n"); + g_pPixmap->InitSysPalette(); + + +} + int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { diff --git a/decor.h b/decor.h new file mode 100644 index 0000000..3a58b8d --- /dev/null +++ b/decor.h @@ -0,0 +1,656 @@ +// Decor.h + +#pragma once + +#include + +#include "DEF.H" +#include "SOUND.H" +#include "PIXMAP.H" + +///////////////////////////////////////////////////////////////////////////// + + +#define MAXENERGY 4000 +#define MAXFIRE 400 + +#define ICON_HILI_STAT 112 +#define ICON_HILI_SEL 113 +#define ICON_HILI_ANY 114 +#define ICON_HILI_OP 115 +#define ICON_HILI_GO 117 +#define ICON_HILI_BUILD 118 +#define ICON_HILI_ERR 119 + +// Descripteur d'une cellule du d�cor. +typedef struct +{ + short floorChannel; + short floorIcon; + short objectChannel; + short objectIcon; + short fog; // brouillard + short rankMove; // rang dans m_move + short workBlupi; // rang du blupi travaillant ici + short fire; +} +Cellule; +// Cette structure doit �tre la plus petite possible, car +// il en existe un tableau de 100x100 = 10'000 cellules ! + +// Descripteur d'un blupi anim�. +#define MAXBLUPI 100 +#define MAXUSED 50 +#define MAXLIST 10 + +typedef struct +{ + BOOL bExist; // TRUE -> utilis� + BOOL bHili; // TRUE -> s�lectionn� + + short perso; // personnage, voir (*) + + short goalAction; // action (long terme) + short goalPhase; // phase (long terme) + POINT goalCel; // cellule vis�e (long terme) + POINT passCel; // cellule tranversante + + short energy; // �nergie restante + + POINT cel; // cellule actuelle + POINT destCel; // cellule destination + short action; // action en cours + short aDirect; // direction actuelle + short sDirect; // direction souhait�e + + POINT pos; // position relative � partir de la cellule + short posZ; // d�placement z + short channel; + short lastIcon; + short icon; + short phase; // phase dans l'action + short step; // pas global + short interrupt; // 0=prioritaire, 1=normal, 2=misc + short clipLeft; + + int nbUsed; // nb de points d�j� visit�s + char nextRankUsed; + POINT posUsed[MAXUSED]; + char rankUsed[MAXUSED]; + + short takeChannel; // objet transport� + short takeIcon; + + POINT fix; // point fixe (cultive, pont) + + short jaugePhase; + short jaugeMax; + short stop; // 1 -> devra stopper + short bArrow; // TRUE -> fl�che en dessus de blupi + short bRepeat; // TRUE -> r�p�te l'action + short nLoop; // nb de boucles pour GOAL_OTHERLOOP + short cLoop; // boucle en cours + short vIcon; // ic�ne variable + POINT goalHili; // but vis� + short bMalade; // TRUE -> blupi malade + short bCache; // TRUE -> cach� (pas dessin�) + short vehicule; // v�hicule utilis� par blupi, voir (**) + char busyCount; + char busyDelay; + char clicCount; + char clicDelay; + char reserve2[2]; + short listButton[MAXLIST]; + POINT listCel[MAXLIST]; + short listParam[MAXLIST]; + short repeatLevelHope; + short repeatLevel; + short reserve3[88]; +} +Blupi; + +// (*) Personnages : +// 0 -> blupi +// 1 -> araign�e +// 2 -> virus +// 3 -> tracks +// 4 -> robot +// 5 -> bombe +// 6 -> d�tonnateur de mine (invisible) +// 7 -> �lectro +// 8 -> disciple (robot2) + +// (**) V�hicule : +// 0 -> � pied +// 1 -> en bateau +// 2 -> en jeep +// 3 -> armure + + +// Descripteur d'un d�cor anim�. +#define MAXMOVE 100 +#define MOVEICONNB 1000 + +typedef struct +{ + BOOL bExist; // TRUE -> utilis� + + POINT cel; // cellule du d�cor + short rankBlupi; // blupi travaillant ici + + BOOL bFloor; // TRUE -> floor, FALSE -> object + short channel; + short icon; + short maskChannel; + short maskIcon; + short phase; // phase pour pMoves ou pIcon + short rankMoves; // *nb,dx,dy,... + short rankIcons; // *nb,i,i,... + + short total; // nb total d'�tapes + short delai; // d�lai entre deux pas + short stepY; // pas vertical *100 + + short cTotal; + short cDelai; +} +Move; + + +#define MAXLASTDRAPEAU 50 + +class CDecor +{ +public: + CDecor(); + ~CDecor(); + + // Arrange.cpp + void ArrangeFloor(POINT cel); + void ArrangeMur(POINT cel, int &icon, int index); + void ArrangeBuild(POINT cel, int &channel, int &icon); + void ArrangeObject(POINT cel); + + BOOL ArrangeFillTestFloor(POINT cel1, POINT cel2); + BOOL ArrangeFillTest(POINT pos); + void ArrangeFillPut(POINT pos, int channel, int icon); + void ArrangeFillSearch(POINT pos); + void ArrangeFill(POINT pos, int channel, int icon, BOOL bFloor); + + void ArrangeBlupi(); + + // Obstacle.cpp + void SearchFloor(int rank, int icon, POINT cel, int *pBits); + void SearchObject(int rank, int icon, POINT cel, int *pBits); + void AjustFloor(int rank, int icon, POINT cel, int *pBits); + void AjustObject(int rank, int icon, POINT cel, int *pBits); + BOOL IsFreeDirect(POINT cel, int direct, int rank); + BOOL IsFreeCelObstacle(POINT cel); + BOOL IsFreeCelFloor(POINT cel, int rank); + BOOL IsFreeCelGo(POINT cel, int rank); + BOOL IsFreeCelHili(POINT cel, int rank); + BOOL IsFreeCel(POINT cel, int rank); + BOOL IsFreeCelDepose(POINT cel, int rank); + BOOL IsFreeCelEmbarque(POINT cel, int rank, int &action, POINT &limit); + BOOL IsFreeCelDebarque(POINT cel, int rank, int &action, POINT &limit); + BOOL IsFreeJump(POINT cel, int direct, int rank, int &action); + BOOL IsFreeGlisse(POINT cel, int direct, int rank, int &action); + int DirectSearch(POINT cel, POINT goal); + void FlushUsed(int rank); + void AddUsedPos(int rank, POINT pos); + BOOL IsUsedPos(int rank, POINT pos); + BOOL SearchBestBase(int rank, int &action, POINT &newCel, int &direct); + BOOL SearchBestPass(int rank, int &action); + BOOL IsWorkableObject(POINT cel, int rank); + BOOL SearchOtherObject(int rank, POINT initCel, int action, + int distMax, int channel, + int firstIcon1, int lastIcon1, + int firstIcon2, int lastIcon2, + POINT &foundCel, int &foundIcon); + BOOL SearchOtherDrapeau(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon); + BOOL SearchOtherBateau(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon); + BOOL IsSpiderObject(int icon); + BOOL SearchSpiderObject(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon); + BOOL IsTracksObject(int icon); + BOOL SearchTracksObject(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon); + BOOL IsRobotObject(int icon); + BOOL SearchRobotObject(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon, + int &foundAction); + BOOL IsBombeObject(int icon); + BOOL SearchBombeObject(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon); + BOOL SearchElectroObject(int rank, POINT initCel, int distMax, + POINT &foundCel, int &foundIcon); + BOOL IsUsineBuild(int rank, POINT cel); + BOOL IsUsineFree(int rank, POINT cel); + BOOL IsFireCel(POINT cel); + BOOL IsVirusCel(POINT cel); + int IsBuildPont(POINT &cel, int &iconBuild); + BOOL IsBuildBateau(POINT cel, int &direct); + void InitDrapeau(); + void AddDrapeau(POINT cel); + void SubDrapeau(POINT cel); + BOOL TestDrapeau(POINT cel); + + // DecBlupi.cpp + void BlupiFlush(); + int BlupiCreate(POINT cel, int action, int direct, + int perso, int energy); + BOOL BlupiDelete(POINT cel, int perso=-1); + void BlupiDelete(int rank); + void BlupiKill(int exRank, POINT cel, int type); + BOOL BlupiIfExist(int rank); + void BlupiCheat(int cheat); + void BlupiActualise(int rank); + void BlupiAdaptIcon(int rank); + void BlupiPushFog(int rank); + void BlupiSound(int rank, int sound, POINT pos, BOOL bStop=FALSE); + void BlupiInitAction(int rank, int action, int direct=-1); + void BlupiChangeAction(int rank, int action, int direct=-1); + void ListFlush(int rank); + int ListGetParam(int rank, int button, POINT cel); + BOOL ListPut(int rank, int button, POINT cel, POINT cMem); + void ListRemove(int rank); + int ListSearch(int rank, int button, POINT cel, int &textForButton); + BOOL RepeatAdjust(int rank, int button, POINT &cel, POINT &cMem, + int param, int list); + void GoalStart(int rank, int action, POINT cel); + BOOL GoalNextPhase(int rank); + void SetTotalTime(int total); + int GetTotalTime(); + void GoalInitJauge(int rank); + void GoalInitPassCel(int rank); + void GoalAdjustCel(int rank, int &x, int &y); + BOOL GoalNextOp(int rank, short *pTable); + void GoalUnwork(int rank); + void GoalStop(int rank, BOOL bError=FALSE, BOOL bSound=TRUE); + BOOL BlupiIsGoalUsed(POINT cel); + void BlupiStartStopRayon(int rank, POINT startCel, POINT endCel); + BOOL BlupiRotate(int rank); + BOOL BlupiNextAction(int rank); + void BlupiNextGoal(int rank); + void BlupiStep(BOOL bFirst); + void BlupiGetRect(int rank, RECT &rect); + int GetTargetBlupi(POINT pos); + void BlupiDeselect(); + void BlupiDeselect(int rank); + void BlupiSetArrow(int rank, BOOL bArrow); + void InitOutlineRect(); + void BlupiHiliDown(POINT pos, BOOL bAdd=FALSE); + void BlupiHiliMove(POINT pos, BOOL bAdd=FALSE); + void BlupiHiliUp(POINT pos, BOOL bAdd=FALSE); + void BlupiDrawHili(); + int GetDefButton(POINT cel); + BOOL BlupiGoal(int rank, int button, POINT cel, POINT cMem); + void BlupiGoal(POINT cel, int button); + void BlupiDestCel(int rank); + BOOL IsTracksHere(POINT cel, BOOL bSkipInMove); + BOOL IsBlupiHereEx(POINT cel1, POINT cel2, int exRank, BOOL bSkipInMove); + BOOL IsBlupiHereEx(POINT cel, int exRank, BOOL bSkipInMove); + BOOL IsBlupiHere(POINT cel, BOOL bSkipInMove); + BOOL IsBlupiHere(POINT cel, int direct, BOOL bSkipInMove); + void GetLevelJauge(int *pLevels, int *pTypes); + BOOL IsWorkBlupi(int rank); + void BlupiGetButtons(POINT pos, int &nb, int *pButtons, int *pErrors, int &perso); + void TerminatedInit(); + int IsTerminated(); + Term* GetTerminated(); + + // DecMove.cpp + void MoveFlush(); + int MoveMaxFire(); + void MoveFixInit(); + BOOL MoveCreate(POINT cel, int rankBlupi, BOOL bFloor, + int channel, int icon, + int maskChannel, int maskIcon, + int total, int delai, int stepY, + BOOL bMisc=FALSE, BOOL bNotIfExist=FALSE); + BOOL MoveAddMoves(POINT cel, int rankMoves); + BOOL MoveAddIcons(POINT cel, int rankIcons, BOOL bContinue=FALSE); + BOOL MoveStartFire(POINT cel); + void MoveProxiFire(POINT cel); + void MoveFire(int rank); + void MoveStep(BOOL bFirst); + void MoveFinish(POINT cel); + void MoveFinish(int rankBlupi); + BOOL MoveIsUsed(POINT cel); + BOOL MoveGetObject(POINT cel, int &channel, int &icon); + BOOL MovePutObject(POINT cel, int channel, int icon); + + // DecIO.cpp + BOOL Write(int rank, BOOL bUser, int world, int time, int total); + BOOL Read(int rank, BOOL bUser, int &world, int &time, int &total); + BOOL FileExist(int rank, BOOL bUser, int &world, int &time, int &total); + void Flush(); + + // DecMap.cpp + void MapInitColors(); + POINT ConvCelToMap(POINT cel); + POINT ConvMapToCel(POINT pos); + BOOL MapMove(POINT pos); + void MapPutCel(POINT pos); + BOOL GenerateMap(); + + // DecStat.cpp + void StatisticInit(); + void StatisticUpdate(); + int StatisticGetBlupi(); + int StatisticGetFire(); + void StatisticDraw(); + void GenerateStatictic(); + BOOL StatisticDown(POINT pos, int fwKeys); + BOOL StatisticMove(POINT pos, int fwKeys); + BOOL StatisticUp(POINT pos, int fwKeys); + int StatisticDetect(POINT pos); + + // Chemin.cpp + void CheminMemPos(int exRank); + BOOL CheminTestPos(POINT pos, int &rank); + int CheminARebours(int rank); + void CheminFillTerrain(int rank); + BOOL CheminTestDirection(int rank, int pos, int dir, + int &next, int &li, + int &cout, int &action); + BOOL CheminCherche(int rank, int &action); + BOOL IsCheminFree(int rank, POINT dest, int button); + + // Decor.cpp + void SetShiftOffset(POINT offset); + POINT ConvCelToPos(POINT cel); + POINT ConvPosToCel(POINT pos, BOOL bMap=FALSE); + POINT ConvPosToCel2(POINT pos); + + void Create(HWND hWnd, CSound *pSound, CPixmap *pPixmap); + void Init(int channel, int icon); + void InitAfterBuild(); + void ResetHili(); + BOOL LoadImages(); + void ClearFog(); + void ClearFire(); + void SetBuild(BOOL bBuild); + void EnableFog(BOOL bEnable); + BOOL GetInvincible(); + void SetInvincible(BOOL bInvincible); + BOOL GetSuper(); + void SetSuper(BOOL bSuper); + void FlipOutline(); + BOOL PutFloor(POINT cel, int channel, int icon); + BOOL PutObject(POINT cel, int channel, int icon); + BOOL GetFloor(POINT cel, int &channel, int &icon); + BOOL GetObject(POINT cel, int &channel, int &icon); + BOOL SetFire(POINT cel, BOOL bFire); + + void SetCoin(POINT coin, BOOL bCenter=FALSE); + POINT GetCoin(); + POINT GetHome(); + void MemoPos(int rank, BOOL bRecord); + + void SetTime(int time); + int GetTime(); + + void SetMusic(int music); + int GetMusic(); + + void SetSkill(int skill); + int GetSkill(); + + void SetRegion(int region); + int GetRegion(); + + void SetInfoMode(BOOL bInfo); + BOOL GetInfoMode(); + void SetInfoHeight(int height); + int GetInfoHeight(); + + char* GetButtonExist(); + + void BuildPutBlupi(); + void BuildMoveFloor(int x, int y, POINT pos, int rank); + void BuildMoveObject(int x, int y, POINT pos, int rank); + void BuildGround(RECT clip); + void Build(RECT clip, POINT posMouse); + void NextPhase(int mode); + + int CountFloor(int channel, int icon); + int CelOkForAction(POINT cel, int action, int rank, + int icons[4][4], + POINT &celOutline1, + POINT &celOutline2); + int CelOkForAction(POINT cel, int action, int rank); + int GetHiliRankBlupi(int nb); + void CelHili(POINT pos, int action); + void CelHiliButton(POINT cel, int button); + void CelHiliRepeat(int list); + int GetResHili(POINT posMouse); + void HideTooltips(BOOL bHide); + + void UndoOpen(); + void UndoClose(); + void UndoCopy(); + void UndoBack(); + BOOL IsUndo(); + + +protected: + BOOL GetSeeBits(POINT cel, char *pBits, int index); + int GetSeeIcon(char *pBits, int index); + +protected: + HWND m_hWnd; + CSound* m_pSound; + CPixmap* m_pPixmap; + CNetwork* m_pNetwork; + Object m_objects[100][100]; + Explo m_explos[100][100]; + Perso m_persos[200]; + int m_input; + int m_previousInput; + POINT m_cameraPos; + POINT m_worldDims; + POINT m_selectedCelPos; + WMessage m_phrase; + int m_targetMission; + int m_missionTitle; + int m_nbCases; + int m_caseIndexes[200]; + int m_nbSomethings; + int m_somethingIndexes; + POINT m_pos; + POINT m_safePos; + Action m_action; + int m_direction; + int m_actionFrameCount; + POINT m_velocity; + Icon4 m_blupiIcon; + /* + undefined + undefined + undefined + undefined + */ + IconChannel m_blupiChannel; + POINT m_activeConveyorVelocity; + int m_activeLiftIndex; + BOOL m_bPlayerHasControl; + BOOL m_bIsFalling; + BOOL m_bHelicopter; + BOOL m_bHovercraft; + BOOL m_bJeep; + BOOL m_bTank; + BOOL m_bSkateboard; + BOOL m_bInDeepWater; + BOOL m_bInSurfaceWater; + BOOL m_bInWind; + BOOL m_bIsHangingFromBar; + BOOL m_bHeadache; + BOOL m_bShield; + BOOL m_bLollipop; + BOOL m_bPowercharge; + BOOL m_bInvisible; + BOOL m_bInverter; + BOOL m_bWaspSting; + BOOL m_bCrushed; + BOOL m_bUseSafePosition; + BOOL m_bIsTerminating; + int m_glue; + int m_keys; + int m_personalBombs; + int m_dynamite; + int m_powerEnergy; + int m_queuedActionFrames; + Action m_queuedAction; + int m_nbSafePositions; + POINT m_safePositions[13]; + int m_bMulti; + int m_team; + int m_netPacketsSent; + int m_netPacketsSent2; + int m_netPacketsRecieved; + int m_netPacketsRecieved2; + SoundEvent m_soundEvents[20]; + int m_soundEventIndex1; + char m_messages[4][100]; + int m_air + int m_energyUnused; + BOOL m_bHelicopterFlying; + BOOL m_bHelicopterStationary; + BOOL m_bCarMoving; + BOOL m_bCarStationary; + BOOL m_bWorldComplete; + BOOL m_bPrivate; + BOOL m_AllMissions; + BOOL m_bInvincible; + BOOL m_bShowSecret; + BOOL m_bAccessBuild; + BOOL m_bNetPacked; + BOOL m_bNetMovePredict; + BOOL m_bNetDebug; + int m_mission; + short m_missionsCleared[90]; + short m_worldsCleared[10]; + int m_lives; + int m_chestsCollected; + int m_chestsTotal; + POINT m_cameraTargetPos; + POINT m_cameraTargetOffset; + int m_flyupIcon; + int m_flyupChannel; + int m_flyupFrameCount; + int m_flyupFrameTotal; + POINT m_flyupStartPos; + POINT m_flyupEndPos; + Cellule* m_pUndoDecor; + Cellule m_decor[MAXCELX/2][MAXCELY/2]; + short m_rankBlupi[MAXCELX][MAXCELY]; + Blupi m_blupi[MAXBLUPI]; + Move m_move[MAXMOVE]; + POINT m_celCoin; // cellule sup/gauche + POINT m_celHome; // pour touche Home + POINT m_celHili; + POINT m_celOutline1; + POINT m_celOutline2; + POINT m_shiftOffset; + int m_iconHili[4][4]; + int m_rankHili; // rang du blupi vis� + BOOL m_bHiliRect; + POINT m_p1Hili; // coins rectangle de s�lection + POINT m_p2Hili; + int m_shiftHili; + int m_nbBlupiHili; // nb de blupi s�lectionn�s + int m_rankBlupiHili; // rang blupi s�lectionn� + BOOL m_bFog; // TRUE -> brouillard (jeu) + BOOL m_bBuild; // TRUE -> construction + BOOL m_bInvincible; // TRUE -> cheat code + BOOL m_bSuper; // TRUE -> cheat code + short m_colors[100]; + int m_time; // temps relatif global + int m_timeConst; // temps relatif global constant + int m_timeFlipOutline; // temps quand basculer mode outline + int m_totalTime; // temps total pass� sur une partie + int m_phase; // phase pour la carte + POINT m_celArrow; // cellule avec fl�che + BOOL m_bOutline; + BOOL m_bGroundRedraw; + char m_buttonExist[MAXBUTTON]; + int m_statNb; // nb de statistiques + int m_statFirst; // premi�re statistique visible + int m_bStatUp; // fl�che up statistique + int m_bStatDown; // fl�che down statistique + int m_statHili; // statistique survol�e + BOOL m_bStatRecalc; // TRUE -> recalcule les statistiques + BOOL m_bStatRedraw; // TRUE -> redessine les statistiques + int m_nbStatHach; // nb de hachures + int m_nbStatHachBlupi; // hachures occup�es par blupi + int m_nbStatHachPlanche;// hachures occup�es par planches + int m_nbStatHachTomate; // hachures occup�es par tomates + int m_nbStatHachMetal; // hachures occup�es par m�tal + int m_nbStatHachRobot; // hachures occup�es par robot + int m_nbStatHome; // nb de maisons + int m_nbStatHomeBlupi; // maisons occup�es par blupi + int m_nbStatRobots; // nb d'ennemis + Term m_term; // conditions pour gagner + int m_winCount; // compteur avant gagn� + int m_winLastHachBlupi; // dernier nombre atteint + int m_winLastHachPlanche;// dernier nombre atteint + int m_winLastHachTomate;// dernier nombre atteint + int m_winLastHachMetal; // dernier nombre atteint + int m_winLastHachRobot; // dernier nombre atteint + int m_winLastHome; // dernier nombre atteint + int m_winLastHomeBlupi; // dernier nombre atteint + int m_winLastRobots; // dernier nombre atteint + int m_music; // num�ro musique + int m_region; // num�ro r�gion (*) + int m_lastRegion; // num�ro derni�re r�gion + int m_blupiHere; + POINT m_lastDrapeau[MAXLASTDRAPEAU]; + BOOL m_bHideTooltips; // TRUE -> menu pr�sent + char m_text[50]; + POINT m_textLastPos; + int m_textCount; + int m_skill; + BOOL m_bInfo; + int m_infoHeight; + POINT m_memoPos[4]; + + BYTE m_cheminWork[MAXCELX*MAXCELY]; + int m_cheminNbPos; + POINT m_cheminPos[MAXBLUPI*2]; + int m_cheminRank[MAXBLUPI*2]; + + BOOL m_bFillFloor; + int m_fillSearchChannel; + int m_fillSearchIcon; + int m_fillPutChannel; + int m_fillPutIcon; + char* m_pFillMap; +}; + +// (*) R�gions : +// 0 -> normal +// 1 -> palmier +// 2 -> hiver +// 3 -> sapin + +///////////////////////////////////////////////////////////////////////////// + +POINT GetCel (int x, int y); +POINT GetCel (POINT cel, int x, int y); +BOOL IsValid (POINT cel); +POINT GetVector (int direct); +extern int table_multi_goal[]; +extern short table_actions[];. + + + + + + + + + + From 5d2613d1b2cab102a317cf985783507db1333e49 Mon Sep 17 00:00:00 2001 From: HMVocaloid <66088611+HMVocaloid@users.noreply.github.com> Date: Thu, 23 May 2024 08:58:27 -0400 Subject: [PATCH 6/7] Updated Files --- decor.cpp | 15 + decor.h | 4 +- dplay.h | 2154 +++++++++++++++++++++++++++++++++++++++++++++++++++++ event.cpp | 27 +- 4 files changed, 2198 insertions(+), 2 deletions(-) create mode 100644 dplay.h diff --git a/decor.cpp b/decor.cpp index a7ef3ea..ce7ff78 100644 --- a/decor.cpp +++ b/decor.cpp @@ -56,4 +56,19 @@ CDecor::CDecor() CDecor::~CDecor() { UndoClose(); +} + +void CDecor::SetTime(int time) +{ + m_time = time; +} + +int CDecor::GetTime() +{ + return m_time; +} + +int CDecor::GetTargetLevel(int mission) +{ + m_targetMission = mission; } \ No newline at end of file diff --git a/decor.h b/decor.h index 3a58b8d..6a4f130 100644 --- a/decor.h +++ b/decor.h @@ -407,6 +407,8 @@ public: void SetInfoHeight(int height); int GetInfoHeight(); + int GetTargetLevel(); + char* GetButtonExist(); void BuildPutBlupi(); @@ -515,7 +517,7 @@ protected: SoundEvent m_soundEvents[20]; int m_soundEventIndex1; char m_messages[4][100]; - int m_air + int m_air; int m_energyUnused; BOOL m_bHelicopterFlying; BOOL m_bHelicopterStationary; diff --git a/dplay.h b/dplay.h new file mode 100644 index 0000000..d91c0a5 --- /dev/null +++ b/dplay.h @@ -0,0 +1,2154 @@ +/*==========================================================================; + * + * Copyright (C) 1994-1997 Microsoft Corporation. All Rights Reserved. + * + * File: dplay.h + * Content: DirectPlay include file + * + ***************************************************************************/ + +#ifndef __DPLAY_INCLUDED__ +#define __DPLAY_INCLUDED__ + +#include // for DECLARE_INTERFACE and HRESULT + +/* avoid warnings in MSVC at Level4 */ +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) + + +/* + * Some types + */ + +#ifndef _WIN64 +#define DWORD_PTR DWORD +#endif + +typedef LPVOID (*LPRGLPVOID)[]; +typedef LPRGLPVOID PRGPVOID, LPRGPVOID, PRGLPVOID, PAPVOID, LPAPVOID, PALPVOID, LPALPVOID; + +#define VOL volatile +typedef VOID *VOL LPVOIDV; + + +#define _FACDP 0x877 +#define MAKE_DPHRESULT( code ) MAKE_HRESULT( 1, _FACDP, code ) + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GUIDS used by DirectPlay objects + */ +DEFINE_GUID(IID_IDirectPlay2, 0x2b74f7c0, 0x9154, 0x11cf, 0xa9, 0xcd, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3); +DEFINE_GUID(IID_IDirectPlay2A,0x9d460580, 0xa822, 0x11cf, 0x96, 0xc, 0x0, 0x80, 0xc7, 0x53, 0x4e, 0x82); + +DEFINE_GUID(IID_IDirectPlay3, 0x133efe40, 0x32dc, 0x11d0, 0x9c, 0xfb, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb); +DEFINE_GUID(IID_IDirectPlay3A,0x133efe41, 0x32dc, 0x11d0, 0x9c, 0xfb, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb); + +DEFINE_GUID(IID_IDirectPlay4, 0xab1c530, 0x4745, 0x11d1, 0xa7, 0xa1, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc); +DEFINE_GUID(IID_IDirectPlay4A,0xab1c531, 0x4745, 0x11d1, 0xa7, 0xa1, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc); + +// {D1EB6D20-8923-11d0-9D97-00A0C90A43CB} +DEFINE_GUID(CLSID_DirectPlay,0xd1eb6d20, 0x8923, 0x11d0, 0x9d, 0x97, 0x0, 0xa0, 0xc9, 0xa, 0x43, 0xcb); + +/* + * GUIDS used by Service Providers shipped with DirectPlay + * Use these to identify Service Provider returned by EnumConnections + */ + +// GUID for IPX service provider +// {685BC400-9D2C-11cf-A9CD-00AA006886E3} +DEFINE_GUID(DPSPGUID_IPX, +0x685bc400, 0x9d2c, 0x11cf, 0xa9, 0xcd, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3); + +// GUID for TCP/IP service provider +// 36E95EE0-8577-11cf-960C-0080C7534E82 +DEFINE_GUID(DPSPGUID_TCPIP, +0x36E95EE0, 0x8577, 0x11cf, 0x96, 0xc, 0x0, 0x80, 0xc7, 0x53, 0x4e, 0x82); + +// GUID for Serial service provider +// {0F1D6860-88D9-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPSPGUID_SERIAL, +0xf1d6860, 0x88d9, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +// GUID for Modem service provider +// {44EAA760-CB68-11cf-9C4E-00A0C905425E} +DEFINE_GUID(DPSPGUID_MODEM, +0x44eaa760, 0xcb68, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e); + +/**************************************************************************** + * + * DirectPlay Structures + * + * Various structures used to invoke DirectPlay. + * + ****************************************************************************/ + +#ifndef IDIRECTPLAY2_OR_GREATER +typedef struct IDirectPlay FAR *LPDIRECTPLAY; +#else +typedef struct IUnknown FAR *LPDIRECTPLAY; +#endif + +typedef struct IDirectPlay2 FAR *LPDIRECTPLAY2; +typedef struct IDirectPlay2 FAR *LPDIRECTPLAY2A; +typedef struct IDirectPlay2 IDirectPlay2A; + +typedef struct IDirectPlay3 FAR *LPDIRECTPLAY3; +typedef struct IDirectPlay3 FAR *LPDIRECTPLAY3A; +typedef struct IDirectPlay3 IDirectPlay3A; + +typedef struct IDirectPlay4 FAR *LPDIRECTPLAY4; +typedef struct IDirectPlay4 FAR *LPDIRECTPLAY4A; +typedef struct IDirectPlay4 IDirectPlay4A; + +/* + * DPID + * DirectPlay player and group ID + */ +typedef DWORD DPID, FAR *LPDPID; + +/* + * DPID that system messages come from + */ +#define DPID_SYSMSG 0 + +/* + * DPID representing all players in the session + */ +#define DPID_ALLPLAYERS 0 + +/* + * DPID representing the server player + */ +#define DPID_SERVERPLAYER 1 + + +/* + * DPID representing the maxiumum ID in the range of DPID's reserved for + * use by DirectPlay. + */ +#define DPID_RESERVEDRANGE 100 + +/* + * The player ID is unknown (used with e.g. DPSESSION_NOMESSAGEID) + */ +#define DPID_UNKNOWN 0xFFFFFFFF + +/* + * DPCAPS + * Used to obtain the capabilities of a DirectPlay object + */ +typedef struct +{ + DWORD dwSize; // Size of structure, in bytes + DWORD dwFlags; // DPCAPS_xxx flags + DWORD dwMaxBufferSize; // Maximum message size, in bytes, for this service provider + DWORD dwMaxQueueSize; // Obsolete. + DWORD dwMaxPlayers; // Maximum players/groups (local + remote) + DWORD dwHundredBaud; // Bandwidth in 100 bits per second units; + // i.e. 24 is 2400, 96 is 9600, etc. + DWORD dwLatency; // Estimated latency; 0 = unknown + DWORD dwMaxLocalPlayers; // Maximum # of locally created players allowed + DWORD dwHeaderLength; // Maximum header length, in bytes, on messages + // added by the service provider + DWORD dwTimeout; // Service provider's suggested timeout value + // This is how long DirectPlay will wait for + // responses to system messages +} DPCAPS, FAR *LPDPCAPS; + +/* + * This DirectPlay object is the session host. If the host exits the + * session, another application will become the host and receive a + * DPSYS_HOST system message. + */ +#define DPCAPS_ISHOST 0x00000002 + +/* + * The service provider bound to this DirectPlay object can optimize + * group messaging. + */ +#define DPCAPS_GROUPOPTIMIZED 0x00000008 + +/* + * The service provider bound to this DirectPlay object can optimize + * keep alives (see DPSESSION_KEEPALIVE) + */ +#define DPCAPS_KEEPALIVEOPTIMIZED 0x00000010 + +/* + * The service provider bound to this DirectPlay object can optimize + * guaranteed message delivery. + */ +#define DPCAPS_GUARANTEEDOPTIMIZED 0x00000020 + +/* + * This DirectPlay object supports guaranteed message delivery. + */ +#define DPCAPS_GUARANTEEDSUPPORTED 0x00000040 + +/* + * This DirectPlay object supports digital signing of messages. + */ +#define DPCAPS_SIGNINGSUPPORTED 0x00000080 + +/* + * This DirectPlay object supports encryption of messages. + */ +#define DPCAPS_ENCRYPTIONSUPPORTED 0x00000100 + +/* + * This DirectPlay player was created on this machine + */ +#define DPPLAYERCAPS_LOCAL 0x00000800 + +/* + * Current Open settings supports all forms of Cancel + */ +#define DPCAPS_ASYNCCANCELSUPPORTED 0x00001000 + +/* + * Current Open settings supports CancelAll, but not Cancel + */ +#define DPCAPS_ASYNCCANCELALLSUPPORTED 0x00002000 + +/* + * Current Open settings supports Send Timeouts for sends + */ +#define DPCAPS_SENDTIMEOUTSUPPORTED 0x00004000 + +/* + * Current Open settings supports send priority + */ +#define DPCAPS_SENDPRIORITYSUPPORTED 0x00008000 + +/* + * Current Open settings supports DPSEND_ASYNC flag + */ +#define DPCAPS_ASYNCSUPPORTED 0x00010000 + + +/* + * DPSESSIONDESC2 + * Used to describe the properties of a DirectPlay + * session instance + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // DPSESSION_xxx flags + GUID guidInstance; // ID for the session instance + GUID guidApplication; // GUID of the DirectPlay application. + // GUID_NULL for all applications. + DWORD dwMaxPlayers; // Maximum # players allowed in session + DWORD dwCurrentPlayers; // Current # players in session (read only) + union + { // Name of the session + LPWSTR lpszSessionName; // Unicode + LPSTR lpszSessionNameA; // ANSI + }; + union + { // Password of the session (optional) + LPWSTR lpszPassword; // Unicode + LPSTR lpszPasswordA; // ANSI + }; + DWORD_PTR dwReserved1; // Reserved for future MS use. + DWORD_PTR dwReserved2; + DWORD_PTR dwUser1; // For use by the application + DWORD_PTR dwUser2; + DWORD_PTR dwUser3; + DWORD_PTR dwUser4; +} DPSESSIONDESC2, FAR *LPDPSESSIONDESC2; + +typedef DPSESSIONDESC2 * VOL LPDPSESSIONDESC2_V; + +/* + * LPCDPSESSIONDESC2 + * A constant pointer to DPSESSIONDESC2 + */ +typedef const DPSESSIONDESC2 FAR *LPCDPSESSIONDESC2; + +/* + * Applications cannot create new players in this session. + */ +#define DPSESSION_NEWPLAYERSDISABLED 0x00000001 + +/* + * If the DirectPlay object that created the session, the host, + * quits, then the host will attempt to migrate to another + * DirectPlay object so that new players can continue to be created + * and new applications can join the session. + */ +#define DPSESSION_MIGRATEHOST 0x00000004 + +/* + * This flag tells DirectPlay not to set the idPlayerTo and idPlayerFrom + * fields in player messages. This cuts two DWORD's off the message + * overhead. + */ +#define DPSESSION_NOMESSAGEID 0x00000008 + + +/* + * This flag tells DirectPlay to not allow any new applications to + * join the session. Applications already in the session can still + * create new players. + */ +#define DPSESSION_JOINDISABLED 0x00000020 + +/* + * This flag tells DirectPlay to detect when remote players + * exit abnormally (e.g. their computer or modem gets unplugged) + */ +#define DPSESSION_KEEPALIVE 0x00000040 + +/* + * This flag tells DirectPlay not to send a message to all players + * when a players remote data changes + */ +#define DPSESSION_NODATAMESSAGES 0x00000080 + +/* + * This flag indicates that the session belongs to a secure server + * and needs user authentication + */ +#define DPSESSION_SECURESERVER 0x00000100 + +/* + * This flag indicates that the session is private and requirs a password + * for EnumSessions as well as Open. + */ +#define DPSESSION_PRIVATE 0x00000200 + +/* + * This flag indicates that the session requires a password for joining. + */ +#define DPSESSION_PASSWORDREQUIRED 0x00000400 + +/* + * This flag tells DirectPlay to route all messages through the server + */ +#define DPSESSION_MULTICASTSERVER 0x00000800 + +/* + * This flag tells DirectPlay to only download information about the + * DPPLAYER_SERVERPLAYER. + */ +#define DPSESSION_CLIENTSERVER 0x00001000 + +/* + * This flag tells DirectPlay to use the protocol built into dplay + * for reliability and statistics all the time. When this bit is + * set, only other sessions with this bit set can join or be joined. + */ +#define DPSESSION_DIRECTPLAYPROTOCOL 0x00002000 + +/* + * This flag tells DirectPlay that preserving order of received + * packets is not important, when using reliable delivery. This + * will allow messages to be indicated out of order if preceding + * messages have not yet arrived. Otherwise DPLAY will wait for + * earlier messages before delivering later reliable messages. + */ +#define DPSESSION_NOPRESERVEORDER 0x00004000 + + +/* + * This flag tells DirectPlay to optimize communication for latency + */ +#define DPSESSION_OPTIMIZELATENCY 0x00008000 + +/* + * This flag allows lobby launched games that aren't voice enabled + * to get voice capabilities. + */ +#define DPSESSION_ALLOWVOICERETRO 0x00010000 + +/* + * This flag supresses transmission of session desc changes. + * DPSESSION_NODATAMESSAGES was supposed to do that, but SetSessionDesc + * was ignoring the flag and some apps depended on the broken behavior, this + * flag allows applications to get the right behaviour without breaking apps depending + * on old broken behavior. + */ +#define DPSESSION_NOSESSIONDESCMESSAGES 0x00020000 + +/* + * DPNAME + * Used to hold the name of a DirectPlay entity + * like a player or a group + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // Not used. Must be zero. + union + { // The short or friendly name + LPWSTR lpszShortName; // Unicode + LPSTR lpszShortNameA; // ANSI + }; + union + { // The long or formal name + LPWSTR lpszLongName; // Unicode + LPSTR lpszLongNameA; // ANSI + }; + +} DPNAME, FAR *LPDPNAME; + +/* + * LPCDPNAME + * A constant pointer to DPNAME + */ +typedef const DPNAME FAR *LPCDPNAME; + +/* + * DPCREDENTIALS + * Used to hold the user name and password of a DirectPlay user + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // Not used. Must be zero. + union + { // User name of the account + LPWSTR lpszUsername; // Unicode + LPSTR lpszUsernameA; // ANSI + }; + union + { // Password of the account + LPWSTR lpszPassword; // Unicode + LPSTR lpszPasswordA; // ANSI + }; + union + { // Domain name of the account + LPWSTR lpszDomain; // Unicode + LPSTR lpszDomainA; // ANSI + }; +} DPCREDENTIALS, FAR *LPDPCREDENTIALS; + +typedef const DPCREDENTIALS FAR *LPCDPCREDENTIALS; + +/* + * DPSECURITYDESC + * Used to describe the security properties of a DirectPlay + * session instance + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // Not used. Must be zero. + union + { // SSPI provider name + LPWSTR lpszSSPIProvider; // Unicode + LPSTR lpszSSPIProviderA; // ANSI + }; + union + { // CAPI provider name + LPWSTR lpszCAPIProvider; // Unicode + LPSTR lpszCAPIProviderA; // ANSI + }; + DWORD dwCAPIProviderType; // Crypto Service Provider type + DWORD dwEncryptionAlgorithm; // Encryption Algorithm type +} DPSECURITYDESC, FAR *LPDPSECURITYDESC; + +typedef const DPSECURITYDESC FAR *LPCDPSECURITYDESC; + +/* + * DPACCOUNTDESC + * Used to describe a user membership account + */ +typedef struct +{ + DWORD dwSize; // Size of structure + DWORD dwFlags; // Not used. Must be zero. + union + { // Account identifier + LPWSTR lpszAccountID; // Unicode + LPSTR lpszAccountIDA; // ANSI + }; +} DPACCOUNTDESC, FAR *LPDPACCOUNTDESC; + +typedef const DPACCOUNTDESC FAR *LPCDPACCOUNTDESC; + +/* + * LPCGUID + * A constant pointer to a guid + */ +typedef const GUID FAR *LPCGUID; + +/* + * DPLCONNECTION + * Used to hold all in the informaion needed to connect + * an application to a session or create a session + */ +typedef struct +{ + DWORD dwSize; // Size of this structure + DWORD dwFlags; // Flags specific to this structure + LPDPSESSIONDESC2 lpSessionDesc; // Pointer to session desc to use on connect + LPDPNAME lpPlayerName; // Pointer to Player name structure + GUID guidSP; // GUID of the DPlay SP to use + LPVOID lpAddress; // Address for service provider + DWORD dwAddressSize; // Size of address data +} DPLCONNECTION, FAR *LPDPLCONNECTION; + +/* + * LPCDPLCONNECTION + * A constant pointer to DPLCONNECTION + */ +typedef const DPLCONNECTION FAR *LPCDPLCONNECTION; + +/* + * DPCHAT + * Used to hold the a DirectPlay chat message + */ +typedef struct +{ + DWORD dwSize; + DWORD dwFlags; + union + { // Message string + LPWSTR lpszMessage; // Unicode + LPSTR lpszMessageA; // ANSI + }; +} DPCHAT, FAR * LPDPCHAT; + +/* + * SGBUFFER + * Scatter Gather Buffer used for SendEx + */ +typedef struct +{ + UINT len; // length of buffer data + PUCHAR pData; // pointer to buffer data +} SGBUFFER, *PSGBUFFER, FAR *LPSGBUFFER; + + +/**************************************************************************** + * + * Prototypes for DirectPlay callback functions + * + ****************************************************************************/ + +/* + * Callback for IDirectPlay2::EnumSessions + */ +typedef BOOL (FAR PASCAL * LPDPENUMSESSIONSCALLBACK2)( + LPCDPSESSIONDESC2 lpThisSD, + LPDWORD lpdwTimeOut, + DWORD dwFlags, + LPVOID lpContext ); + +/* + * This flag is set on the EnumSessions callback dwFlags parameter when + * the time out has occurred. There will be no session data for this + * callback. If *lpdwTimeOut is set to a non-zero value and the + * EnumSessionsCallback function returns TRUE then EnumSessions will + * continue waiting until the next timeout occurs. Timeouts are in + * milliseconds. + */ +#define DPESC_TIMEDOUT 0x00000001 + + +/* + * Callback for IDirectPlay2::EnumPlayers + * IDirectPlay2::EnumGroups + * IDirectPlay2::EnumGroupPlayers + */ +typedef BOOL (FAR PASCAL *LPDPENUMPLAYERSCALLBACK2)( + DPID dpId, + DWORD dwPlayerType, + LPCDPNAME lpName, + DWORD dwFlags, + LPVOID lpContext ); + + +/* + * Unicode callback for DirectPlayEnumerate + * This callback prototype will be used if compiling + * for Unicode strings + */ +typedef BOOL (FAR PASCAL * LPDPENUMDPCALLBACK)( + LPGUID lpguidSP, + LPWSTR lpSPName, + DWORD dwMajorVersion, + DWORD dwMinorVersion, + LPVOID lpContext); + +/* + * ANSI callback for DirectPlayEnumerate + * This callback prototype will be used if compiling + * for ANSI strings + */ +typedef BOOL (FAR PASCAL * LPDPENUMDPCALLBACKA)( + LPGUID lpguidSP, + LPSTR lpSPName, + DWORD dwMajorVersion, + DWORD dwMinorVersion, + LPVOID lpContext); + +/* + * Callback for IDirectPlay3(A)::EnumConnections + */ +typedef BOOL (FAR PASCAL * LPDPENUMCONNECTIONSCALLBACK)( + LPCGUID lpguidSP, + LPVOID lpConnection, + DWORD dwConnectionSize, + LPCDPNAME lpName, + DWORD dwFlags, + LPVOID lpContext); + + +/* + * API's + */ + +#ifdef UNICODE +#define DirectPlayEnumerate DirectPlayEnumerateW +#else +#define DirectPlayEnumerate DirectPlayEnumerateA +#endif // UNICODE + +extern HRESULT WINAPI DirectPlayEnumerateA( LPDPENUMDPCALLBACKA, LPVOID ); +extern HRESULT WINAPI DirectPlayEnumerateW( LPDPENUMDPCALLBACK, LPVOID ); +extern HRESULT WINAPI DirectPlayCreate( LPGUID lpGUID, LPDIRECTPLAY *lplpDP, IUnknown *pUnk); + +/**************************************************************************** + * + * IDirectPlay2 (and IDirectPlay2A) Interface + * + ****************************************************************************/ + +#undef INTERFACE +#define INTERFACE IDirectPlay2 +DECLARE_INTERFACE_( IDirectPlay2, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay2 methods ***/ + STDMETHOD(AddPlayerToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(CreateGroup) (THIS_ LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(CreatePlayer) (THIS_ LPDPID,LPDPNAME,HANDLE,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE; + STDMETHOD(DestroyGroup) (THIS_ DPID) PURE; + STDMETHOD(DestroyPlayer) (THIS_ DPID) PURE; + STDMETHOD(EnumGroupPlayers) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroups) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumPlayers) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumSessions) (THIS_ LPDPSESSIONDESC2,DWORD,LPDPENUMSESSIONSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetCaps) (THIS_ LPDPCAPS,DWORD) PURE; + STDMETHOD(GetGroupData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetGroupName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetMessageCount) (THIS_ DPID, LPDWORD) PURE; + STDMETHOD(GetPlayerAddress) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetPlayerCaps) (THIS_ DPID,LPDPCAPS,DWORD) PURE; + STDMETHOD(GetPlayerData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetPlayerName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetSessionDesc) (THIS_ LPVOID,LPDWORD) PURE; + STDMETHOD(Initialize) (THIS_ LPGUID) PURE; + STDMETHOD(Open) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + STDMETHOD(Receive) (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE; + STDMETHOD(Send) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetGroupData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetGroupName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetPlayerData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetPlayerName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetSessionDesc) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; +}; + +/**************************************************************************** + * + * IDirectPlay2 interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay2_AddPlayerToGroup(p,a,b) (p)->lpVtbl->AddPlayerToGroup(p,a,b) +#define IDirectPlay2_Close(p) (p)->lpVtbl->Close(p) +#define IDirectPlay2_CreateGroup(p,a,b,c,d,e) (p)->lpVtbl->CreateGroup(p,a,b,c,d,e) +#define IDirectPlay2_CreatePlayer(p,a,b,c,d,e,f) (p)->lpVtbl->CreatePlayer(p,a,b,c,d,e,f) +#define IDirectPlay2_DeletePlayerFromGroup(p,a,b) (p)->lpVtbl->DeletePlayerFromGroup(p,a,b) +#define IDirectPlay2_DestroyGroup(p,a) (p)->lpVtbl->DestroyGroup(p,a) +#define IDirectPlay2_DestroyPlayer(p,a) (p)->lpVtbl->DestroyPlayer(p,a) +#define IDirectPlay2_EnumGroupPlayers(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d,e) +#define IDirectPlay2_EnumGroups(p,a,b,c,d) (p)->lpVtbl->EnumGroups(p,a,b,c,d) +#define IDirectPlay2_EnumPlayers(p,a,b,c,d) (p)->lpVtbl->EnumPlayers(p,a,b,c,d) +#define IDirectPlay2_EnumSessions(p,a,b,c,d,e) (p)->lpVtbl->EnumSessions(p,a,b,c,d,e) +#define IDirectPlay2_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlay2_GetMessageCount(p,a,b) (p)->lpVtbl->GetMessageCount(p,a,b) +#define IDirectPlay2_GetGroupData(p,a,b,c,d) (p)->lpVtbl->GetGroupData(p,a,b,c,d) +#define IDirectPlay2_GetGroupName(p,a,b,c) (p)->lpVtbl->GetGroupName(p,a,b,c) +#define IDirectPlay2_GetPlayerAddress(p,a,b,c) (p)->lpVtbl->GetPlayerAddress(p,a,b,c) +#define IDirectPlay2_GetPlayerCaps(p,a,b,c) (p)->lpVtbl->GetPlayerCaps(p,a,b,c) +#define IDirectPlay2_GetPlayerData(p,a,b,c,d) (p)->lpVtbl->GetPlayerData(p,a,b,c,d) +#define IDirectPlay2_GetPlayerName(p,a,b,c) (p)->lpVtbl->GetPlayerName(p,a,b,c) +#define IDirectPlay2_GetSessionDesc(p,a,b) (p)->lpVtbl->GetSessionDesc(p,a,b) +#define IDirectPlay2_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlay2_Open(p,a,b) (p)->lpVtbl->Open(p,a,b) +#define IDirectPlay2_Receive(p,a,b,c,d,e) (p)->lpVtbl->Receive(p,a,b,c,d,e) +#define IDirectPlay2_Send(p,a,b,c,d,e) (p)->lpVtbl->Send(p,a,b,c,d,e) +#define IDirectPlay2_SetGroupData(p,a,b,c,d) (p)->lpVtbl->SetGroupData(p,a,b,c,d) +#define IDirectPlay2_SetGroupName(p,a,b,c) (p)->lpVtbl->SetGroupName(p,a,b,c) +#define IDirectPlay2_SetPlayerData(p,a,b,c,d) (p)->lpVtbl->SetPlayerData(p,a,b,c,d) +#define IDirectPlay2_SetPlayerName(p,a,b,c) (p)->lpVtbl->SetPlayerName(p,a,b,c) +#define IDirectPlay2_SetSessionDesc(p,a,b) (p)->lpVtbl->SetSessionDesc(p,a,b) + +#else /* C++ */ + +#define IDirectPlay2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay2_AddRef(p) (p)->AddRef() +#define IDirectPlay2_Release(p) (p)->Release() +#define IDirectPlay2_AddPlayerToGroup(p,a,b) (p)->AddPlayerToGroup(a,b) +#define IDirectPlay2_Close(p) (p)->Close() +#define IDirectPlay2_CreateGroup(p,a,b,c,d,e) (p)->CreateGroup(a,b,c,d,e) +#define IDirectPlay2_CreatePlayer(p,a,b,c,d,e,f) (p)->CreatePlayer(a,b,c,d,e,f) +#define IDirectPlay2_DeletePlayerFromGroup(p,a,b) (p)->DeletePlayerFromGroup(a,b) +#define IDirectPlay2_DestroyGroup(p,a) (p)->DestroyGroup(a) +#define IDirectPlay2_DestroyPlayer(p,a) (p)->DestroyPlayer(a) +#define IDirectPlay2_EnumGroupPlayers(p,a,b,c,d,e) (p)->EnumGroupPlayers(a,b,c,d,e) +#define IDirectPlay2_EnumGroups(p,a,b,c,d) (p)->EnumGroups(a,b,c,d) +#define IDirectPlay2_EnumPlayers(p,a,b,c,d) (p)->EnumPlayers(a,b,c,d) +#define IDirectPlay2_EnumSessions(p,a,b,c,d,e) (p)->EnumSessions(a,b,c,d,e) +#define IDirectPlay2_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlay2_GetMessageCount(p,a,b) (p)->GetMessageCount(a,b) +#define IDirectPlay2_GetGroupData(p,a,b,c,d) (p)->GetGroupData(a,b,c,d) +#define IDirectPlay2_GetGroupName(p,a,b,c) (p)->GetGroupName(a,b,c) +#define IDirectPlay2_GetPlayerAddress(p,a,b,c) (p)->GetPlayerAddress(a,b,c) +#define IDirectPlay2_GetPlayerCaps(p,a,b,c) (p)->GetPlayerCaps(a,b,c) +#define IDirectPlay2_GetPlayerData(p,a,b,c,d) (p)->GetPlayerData(a,b,c,d) +#define IDirectPlay2_GetPlayerName(p,a,b,c) (p)->GetPlayerName(a,b,c) +#define IDirectPlay2_GetSessionDesc(p,a,b) (p)->GetSessionDesc(a,b) +#define IDirectPlay2_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlay2_Open(p,a,b) (p)->Open(a,b) +#define IDirectPlay2_Receive(p,a,b,c,d,e) (p)->Receive(a,b,c,d,e) +#define IDirectPlay2_Send(p,a,b,c,d,e) (p)->Send(a,b,c,d,e) +#define IDirectPlay2_SetGroupData(p,a,b,c,d) (p)->SetGroupData(a,b,c,d) +#define IDirectPlay2_SetGroupName(p,a,b,c) (p)->SetGroupName(a,b,c) +#define IDirectPlay2_SetPlayerData(p,a,b,c,d) (p)->SetPlayerData(a,b,c,d) +#define IDirectPlay2_SetPlayerName(p,a,b,c) (p)->SetPlayerName(a,b,c) +#define IDirectPlay2_SetSessionDesc(p,a,b) (p)->SetSessionDesc(a,b) + +#endif + +/**************************************************************************** + * + * IDirectPlay3 (and IDirectPlay3A) Interface + * + ****************************************************************************/ + +#undef INTERFACE +#define INTERFACE IDirectPlay3 +DECLARE_INTERFACE_( IDirectPlay3, IDirectPlay2 ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay2 methods ***/ + STDMETHOD(AddPlayerToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(CreateGroup) (THIS_ LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(CreatePlayer) (THIS_ LPDPID,LPDPNAME,HANDLE,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE; + STDMETHOD(DestroyGroup) (THIS_ DPID) PURE; + STDMETHOD(DestroyPlayer) (THIS_ DPID) PURE; + STDMETHOD(EnumGroupPlayers) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroups) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumPlayers) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumSessions) (THIS_ LPDPSESSIONDESC2,DWORD,LPDPENUMSESSIONSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetCaps) (THIS_ LPDPCAPS,DWORD) PURE; + STDMETHOD(GetGroupData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetGroupName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetMessageCount) (THIS_ DPID, LPDWORD) PURE; + STDMETHOD(GetPlayerAddress) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetPlayerCaps) (THIS_ DPID,LPDPCAPS,DWORD) PURE; + STDMETHOD(GetPlayerData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetPlayerName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetSessionDesc) (THIS_ LPVOID,LPDWORD) PURE; + STDMETHOD(Initialize) (THIS_ LPGUID) PURE; + STDMETHOD(Open) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + STDMETHOD(Receive) (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE; + STDMETHOD(Send) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetGroupData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetGroupName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetPlayerData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetPlayerName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetSessionDesc) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + /*** IDirectPlay3 methods ***/ + STDMETHOD(AddGroupToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(CreateGroupInGroup) (THIS_ DPID,LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeleteGroupFromGroup) (THIS_ DPID,DPID) PURE; + STDMETHOD(EnumConnections) (THIS_ LPCGUID,LPDPENUMCONNECTIONSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroupsInGroup) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetGroupConnectionSettings)(THIS_ DWORD, DPID, LPVOID, LPDWORD) PURE; + STDMETHOD(InitializeConnection) (THIS_ LPVOID,DWORD) PURE; + STDMETHOD(SecureOpen) (THIS_ LPCDPSESSIONDESC2,DWORD,LPCDPSECURITYDESC,LPCDPCREDENTIALS) PURE; + STDMETHOD(SendChatMessage) (THIS_ DPID,DPID,DWORD,LPDPCHAT) PURE; + STDMETHOD(SetGroupConnectionSettings)(THIS_ DWORD,DPID,LPDPLCONNECTION) PURE; + STDMETHOD(StartSession) (THIS_ DWORD,DPID) PURE; + STDMETHOD(GetGroupFlags) (THIS_ DPID,LPDWORD) PURE; + STDMETHOD(GetGroupParent) (THIS_ DPID,LPDPID) PURE; + STDMETHOD(GetPlayerAccount) (THIS_ DPID, DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(GetPlayerFlags) (THIS_ DPID,LPDWORD) PURE; +}; + +/**************************************************************************** + * + * IDirectPlay3 interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay3_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay3_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlay3_AddPlayerToGroup(p,a,b) (p)->lpVtbl->AddPlayerToGroup(p,a,b) +#define IDirectPlay3_Close(p) (p)->lpVtbl->Close(p) +#define IDirectPlay3_CreateGroup(p,a,b,c,d,e) (p)->lpVtbl->CreateGroup(p,a,b,c,d,e) +#define IDirectPlay3_CreatePlayer(p,a,b,c,d,e,f) (p)->lpVtbl->CreatePlayer(p,a,b,c,d,e,f) +#define IDirectPlay3_DeletePlayerFromGroup(p,a,b) (p)->lpVtbl->DeletePlayerFromGroup(p,a,b) +#define IDirectPlay3_DestroyGroup(p,a) (p)->lpVtbl->DestroyGroup(p,a) +#define IDirectPlay3_DestroyPlayer(p,a) (p)->lpVtbl->DestroyPlayer(p,a) +#define IDirectPlay3_EnumGroupPlayers(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d,e) +#define IDirectPlay3_EnumGroups(p,a,b,c,d) (p)->lpVtbl->EnumGroups(p,a,b,c,d) +#define IDirectPlay3_EnumPlayers(p,a,b,c,d) (p)->lpVtbl->EnumPlayers(p,a,b,c,d) +#define IDirectPlay3_EnumSessions(p,a,b,c,d,e) (p)->lpVtbl->EnumSessions(p,a,b,c,d,e) +#define IDirectPlay3_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlay3_GetMessageCount(p,a,b) (p)->lpVtbl->GetMessageCount(p,a,b) +#define IDirectPlay3_GetGroupData(p,a,b,c,d) (p)->lpVtbl->GetGroupData(p,a,b,c,d) +#define IDirectPlay3_GetGroupName(p,a,b,c) (p)->lpVtbl->GetGroupName(p,a,b,c) +#define IDirectPlay3_GetPlayerAddress(p,a,b,c) (p)->lpVtbl->GetPlayerAddress(p,a,b,c) +#define IDirectPlay3_GetPlayerCaps(p,a,b,c) (p)->lpVtbl->GetPlayerCaps(p,a,b,c) +#define IDirectPlay3_GetPlayerData(p,a,b,c,d) (p)->lpVtbl->GetPlayerData(p,a,b,c,d) +#define IDirectPlay3_GetPlayerName(p,a,b,c) (p)->lpVtbl->GetPlayerName(p,a,b,c) +#define IDirectPlay3_GetSessionDesc(p,a,b) (p)->lpVtbl->GetSessionDesc(p,a,b) +#define IDirectPlay3_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlay3_Open(p,a,b) (p)->lpVtbl->Open(p,a,b) +#define IDirectPlay3_Receive(p,a,b,c,d,e) (p)->lpVtbl->Receive(p,a,b,c,d,e) +#define IDirectPlay3_Send(p,a,b,c,d,e) (p)->lpVtbl->Send(p,a,b,c,d,e) +#define IDirectPlay3_SetGroupData(p,a,b,c,d) (p)->lpVtbl->SetGroupData(p,a,b,c,d) +#define IDirectPlay3_SetGroupName(p,a,b,c) (p)->lpVtbl->SetGroupName(p,a,b,c) +#define IDirectPlay3_SetPlayerData(p,a,b,c,d) (p)->lpVtbl->SetPlayerData(p,a,b,c,d) +#define IDirectPlay3_SetPlayerName(p,a,b,c) (p)->lpVtbl->SetPlayerName(p,a,b,c) +#define IDirectPlay3_SetSessionDesc(p,a,b) (p)->lpVtbl->SetSessionDesc(p,a,b) +#define IDirectPlay3_AddGroupToGroup(p,a,b) (p)->lpVtbl->AddGroupToGroup(p,a,b) +#define IDirectPlay3_CreateGroupInGroup(p,a,b,c,d,e,f) (p)->lpVtbl->CreateGroupInGroup(p,a,b,c,d,e,f) +#define IDirectPlay3_DeleteGroupFromGroup(p,a,b) (p)->lpVtbl->DeleteGroupFromGroup(p,a,b) +#define IDirectPlay3_EnumConnections(p,a,b,c,d) (p)->lpVtbl->EnumConnections(p,a,b,c,d) +#define IDirectPlay3_EnumGroupsInGroup(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupsInGroup(p,a,b,c,d,e) +#define IDirectPlay3_GetGroupConnectionSettings(p,a,b,c,d) (p)->lpVtbl->GetGroupConnectionSettings(p,a,b,c,d) +#define IDirectPlay3_InitializeConnection(p,a,b) (p)->lpVtbl->InitializeConnection(p,a,b) +#define IDirectPlay3_SecureOpen(p,a,b,c,d) (p)->lpVtbl->SecureOpen(p,a,b,c,d) +#define IDirectPlay3_SendChatMessage(p,a,b,c,d) (p)->lpVtbl->SendChatMessage(p,a,b,c,d) +#define IDirectPlay3_SetGroupConnectionSettings(p,a,b,c) (p)->lpVtbl->SetGroupConnectionSettings(p,a,b,c) +#define IDirectPlay3_StartSession(p,a,b) (p)->lpVtbl->StartSession(p,a,b) +#define IDirectPlay3_GetGroupFlags(p,a,b) (p)->lpVtbl->GetGroupFlags(p,a,b) +#define IDirectPlay3_GetGroupParent(p,a,b) (p)->lpVtbl->GetGroupParent(p,a,b) +#define IDirectPlay3_GetPlayerAccount(p,a,b,c,d) (p)->lpVtbl->GetPlayerAccount(p,a,b,c,d) +#define IDirectPlay3_GetPlayerFlags(p,a,b) (p)->lpVtbl->GetPlayerFlags(p,a,b) + +#else /* C++ */ + +#define IDirectPlay3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay3_AddRef(p) (p)->AddRef() +#define IDirectPlay3_Release(p) (p)->Release() +#define IDirectPlay3_AddPlayerToGroup(p,a,b) (p)->AddPlayerToGroup(a,b) +#define IDirectPlay3_Close(p) (p)->Close() +#define IDirectPlay3_CreateGroup(p,a,b,c,d,e) (p)->CreateGroup(a,b,c,d,e) +#define IDirectPlay3_CreatePlayer(p,a,b,c,d,e,f) (p)->CreatePlayer(a,b,c,d,e,f) +#define IDirectPlay3_DeletePlayerFromGroup(p,a,b) (p)->DeletePlayerFromGroup(a,b) +#define IDirectPlay3_DestroyGroup(p,a) (p)->DestroyGroup(a) +#define IDirectPlay3_DestroyPlayer(p,a) (p)->DestroyPlayer(a) +#define IDirectPlay3_EnumGroupPlayers(p,a,b,c,d,e) (p)->EnumGroupPlayers(a,b,c,d,e) +#define IDirectPlay3_EnumGroups(p,a,b,c,d) (p)->EnumGroups(a,b,c,d) +#define IDirectPlay3_EnumPlayers(p,a,b,c,d) (p)->EnumPlayers(a,b,c,d) +#define IDirectPlay3_EnumSessions(p,a,b,c,d,e) (p)->EnumSessions(a,b,c,d,e) +#define IDirectPlay3_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlay3_GetMessageCount(p,a,b) (p)->GetMessageCount(a,b) +#define IDirectPlay3_GetGroupData(p,a,b,c,d) (p)->GetGroupData(a,b,c,d) +#define IDirectPlay3_GetGroupName(p,a,b,c) (p)->GetGroupName(a,b,c) +#define IDirectPlay3_GetPlayerAddress(p,a,b,c) (p)->GetPlayerAddress(a,b,c) +#define IDirectPlay3_GetPlayerCaps(p,a,b,c) (p)->GetPlayerCaps(a,b,c) +#define IDirectPlay3_GetPlayerData(p,a,b,c,d) (p)->GetPlayerData(a,b,c,d) +#define IDirectPlay3_GetPlayerName(p,a,b,c) (p)->GetPlayerName(a,b,c) +#define IDirectPlay3_GetSessionDesc(p,a,b) (p)->GetSessionDesc(a,b) +#define IDirectPlay3_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlay3_Open(p,a,b) (p)->Open(a,b) +#define IDirectPlay3_Receive(p,a,b,c,d,e) (p)->Receive(a,b,c,d,e) +#define IDirectPlay3_Send(p,a,b,c,d,e) (p)->Send(a,b,c,d,e) +#define IDirectPlay3_SetGroupData(p,a,b,c,d) (p)->SetGroupData(a,b,c,d) +#define IDirectPlay3_SetGroupName(p,a,b,c) (p)->SetGroupName(a,b,c) +#define IDirectPlay3_SetPlayerData(p,a,b,c,d) (p)->SetPlayerData(a,b,c,d) +#define IDirectPlay3_SetPlayerName(p,a,b,c) (p)->SetPlayerName(a,b,c) +#define IDirectPlay3_SetSessionDesc(p,a,b) (p)->SetSessionDesc(a,b) +#define IDirectPlay3_AddGroupToGroup(p,a,b) (p)->AddGroupToGroup(a,b) +#define IDirectPlay3_CreateGroupInGroup(p,a,b,c,d,e,f) (p)->CreateGroupInGroup(a,b,c,d,e,f) +#define IDirectPlay3_DeleteGroupFromGroup(p,a,b) (p)->DeleteGroupFromGroup(a,b) +#define IDirectPlay3_EnumConnections(p,a,b,c,d) (p)->EnumConnections(a,b,c,d) +#define IDirectPlay3_EnumGroupsInGroup(p,a,b,c,d,e) (p)->EnumGroupsInGroup(a,b,c,d,e) +#define IDirectPlay3_GetGroupConnectionSettings(p,a,b,c,d) (p)->GetGroupConnectionSettings(a,b,c,d) +#define IDirectPlay3_InitializeConnection(p,a,b) (p)->InitializeConnection(a,b) +#define IDirectPlay3_SecureOpen(p,a,b,c,d) (p)->SecureOpen(a,b,c,d) +#define IDirectPlay3_SendChatMessage(p,a,b,c,d) (p)->SendChatMessage(a,b,c,d) +#define IDirectPlay3_SetGroupConnectionSettings(p,a,b,c) (p)->SetGroupConnectionSettings(a,b,c) +#define IDirectPlay3_StartSession(p,a,b) (p)->StartSession(a,b) +#define IDirectPlay3_GetGroupFlags(p,a,b) (p)->GetGroupFlags(a,b) +#define IDirectPlay3_GetGroupParent(p,a,b) (p)->GetGroupParent(a,b) +#define IDirectPlay3_GetPlayerAccount(p,a,b,c,d) (p)->GetPlayerAccount(a,b,c,d) +#define IDirectPlay3_GetPlayerFlags(p,a,b) (p)->GetPlayerFlags(a,b) + +#endif + +/**************************************************************************** + * + * IDirectPlay4 (and IDirectPlay4A) Interface + * + ****************************************************************************/ + +#undef INTERFACE +#define INTERFACE IDirectPlay4 +DECLARE_INTERFACE_( IDirectPlay4, IDirectPlay3 ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay2 methods ***/ + STDMETHOD(AddPlayerToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(CreateGroup) (THIS_ LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(CreatePlayer) (THIS_ LPDPID,LPDPNAME,HANDLE,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE; + STDMETHOD(DestroyGroup) (THIS_ DPID) PURE; + STDMETHOD(DestroyPlayer) (THIS_ DPID) PURE; + STDMETHOD(EnumGroupPlayers) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroups) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumPlayers) (THIS_ LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(EnumSessions) (THIS_ LPDPSESSIONDESC2,DWORD,LPDPENUMSESSIONSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetCaps) (THIS_ LPDPCAPS,DWORD) PURE; + STDMETHOD(GetGroupData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetGroupName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetMessageCount) (THIS_ DPID, LPDWORD) PURE; + STDMETHOD(GetPlayerAddress) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetPlayerCaps) (THIS_ DPID,LPDPCAPS,DWORD) PURE; + STDMETHOD(GetPlayerData) (THIS_ DPID,LPVOID,LPDWORD,DWORD) PURE; + STDMETHOD(GetPlayerName) (THIS_ DPID,LPVOID,LPDWORD) PURE; + STDMETHOD(GetSessionDesc) (THIS_ LPVOID,LPDWORD) PURE; + STDMETHOD(Initialize) (THIS_ LPGUID) PURE; + STDMETHOD(Open) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + STDMETHOD(Receive) (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE; + STDMETHOD(Send) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetGroupData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetGroupName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetPlayerData) (THIS_ DPID,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(SetPlayerName) (THIS_ DPID,LPDPNAME,DWORD) PURE; + STDMETHOD(SetSessionDesc) (THIS_ LPDPSESSIONDESC2,DWORD) PURE; + /*** IDirectPlay3 methods ***/ + STDMETHOD(AddGroupToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(CreateGroupInGroup) (THIS_ DPID,LPDPID,LPDPNAME,LPVOID,DWORD,DWORD) PURE; + STDMETHOD(DeleteGroupFromGroup) (THIS_ DPID,DPID) PURE; + STDMETHOD(EnumConnections) (THIS_ LPCGUID,LPDPENUMCONNECTIONSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroupsInGroup) (THIS_ DPID,LPGUID,LPDPENUMPLAYERSCALLBACK2,LPVOID,DWORD) PURE; + STDMETHOD(GetGroupConnectionSettings)(THIS_ DWORD, DPID, LPVOID, LPDWORD) PURE; + STDMETHOD(InitializeConnection) (THIS_ LPVOID,DWORD) PURE; + STDMETHOD(SecureOpen) (THIS_ LPCDPSESSIONDESC2,DWORD,LPCDPSECURITYDESC,LPCDPCREDENTIALS) PURE; + STDMETHOD(SendChatMessage) (THIS_ DPID,DPID,DWORD,LPDPCHAT) PURE; + STDMETHOD(SetGroupConnectionSettings)(THIS_ DWORD,DPID,LPDPLCONNECTION) PURE; + STDMETHOD(StartSession) (THIS_ DWORD,DPID) PURE; + STDMETHOD(GetGroupFlags) (THIS_ DPID,LPDWORD) PURE; + STDMETHOD(GetGroupParent) (THIS_ DPID,LPDPID) PURE; + STDMETHOD(GetPlayerAccount) (THIS_ DPID, DWORD, LPVOID, LPDWORD) PURE; + STDMETHOD(GetPlayerFlags) (THIS_ DPID,LPDWORD) PURE; + /*** IDirectPlay4 methods ***/ + STDMETHOD(GetGroupOwner) (THIS_ DPID, LPDPID) PURE; + STDMETHOD(SetGroupOwner) (THIS_ DPID, DPID) PURE; + STDMETHOD(SendEx) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD, DWORD, DWORD, LPVOID, DWORD_PTR *) PURE; + STDMETHOD(GetMessageQueue) (THIS_ DPID, DPID, DWORD, LPDWORD, LPDWORD) PURE; + STDMETHOD(CancelMessage) (THIS_ DWORD, DWORD) PURE; + STDMETHOD(CancelPriority) (THIS_ DWORD, DWORD, DWORD) PURE; +}; + +/**************************************************************************** + * + * IDirectPlayX interface macros (for IDirectPlay4 and beyond) + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlayX_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlayX_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlayX_Release(p) (p)->lpVtbl->Release(p) +#define IDirectPlayX_AddPlayerToGroup(p,a,b) (p)->lpVtbl->AddPlayerToGroup(p,a,b) +#define IDirectPlayX_CancelMessage(p,a,b) (p)->lpVtbl->CancelMessage(p,a,b) +#define IDirectPlayX_CancelPriority(p,a,b,c) (p)->lpVtbl->CancelPriority(p,a,b,c) +#define IDirectPlayX_Close(p) (p)->lpVtbl->Close(p) +#define IDirectPlayX_CreateGroup(p,a,b,c,d,e) (p)->lpVtbl->CreateGroup(p,a,b,c,d,e) +#define IDirectPlayX_CreatePlayer(p,a,b,c,d,e,f) (p)->lpVtbl->CreatePlayer(p,a,b,c,d,e,f) +#define IDirectPlayX_DeletePlayerFromGroup(p,a,b) (p)->lpVtbl->DeletePlayerFromGroup(p,a,b) +#define IDirectPlayX_DestroyGroup(p,a) (p)->lpVtbl->DestroyGroup(p,a) +#define IDirectPlayX_DestroyPlayer(p,a) (p)->lpVtbl->DestroyPlayer(p,a) +#define IDirectPlayX_EnumGroupPlayers(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d,e) +#define IDirectPlayX_EnumGroups(p,a,b,c,d) (p)->lpVtbl->EnumGroups(p,a,b,c,d) +#define IDirectPlayX_EnumPlayers(p,a,b,c,d) (p)->lpVtbl->EnumPlayers(p,a,b,c,d) +#define IDirectPlayX_EnumSessions(p,a,b,c,d,e) (p)->lpVtbl->EnumSessions(p,a,b,c,d,e) +#define IDirectPlayX_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) +#define IDirectPlayX_GetMessageCount(p,a,b) (p)->lpVtbl->GetMessageCount(p,a,b) +#define IDirectPlayX_GetMessageQueue(p,a,b,c,d,e) (p)->lpVtbl->GetMessageQueue(p,a,b,c,d,e) +#define IDirectPlayX_GetGroupData(p,a,b,c,d) (p)->lpVtbl->GetGroupData(p,a,b,c,d) +#define IDirectPlayX_GetGroupName(p,a,b,c) (p)->lpVtbl->GetGroupName(p,a,b,c) +#define IDirectPlayX_GetPlayerAddress(p,a,b,c) (p)->lpVtbl->GetPlayerAddress(p,a,b,c) +#define IDirectPlayX_GetPlayerCaps(p,a,b,c) (p)->lpVtbl->GetPlayerCaps(p,a,b,c) +#define IDirectPlayX_GetPlayerData(p,a,b,c,d) (p)->lpVtbl->GetPlayerData(p,a,b,c,d) +#define IDirectPlayX_GetPlayerName(p,a,b,c) (p)->lpVtbl->GetPlayerName(p,a,b,c) +#define IDirectPlayX_GetSessionDesc(p,a,b) (p)->lpVtbl->GetSessionDesc(p,a,b) +#define IDirectPlayX_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlayX_Open(p,a,b) (p)->lpVtbl->Open(p,a,b) +#define IDirectPlayX_Receive(p,a,b,c,d,e) (p)->lpVtbl->Receive(p,a,b,c,d,e) +#define IDirectPlayX_Send(p,a,b,c,d,e) (p)->lpVtbl->Send(p,a,b,c,d,e) +#define IDirectPlayX_SendEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->SendEx(p,a,b,c,d,e,f,g,h,i) +#define IDirectPlayX_SetGroupData(p,a,b,c,d) (p)->lpVtbl->SetGroupData(p,a,b,c,d) +#define IDirectPlayX_SetGroupName(p,a,b,c) (p)->lpVtbl->SetGroupName(p,a,b,c) +#define IDirectPlayX_SetPlayerData(p,a,b,c,d) (p)->lpVtbl->SetPlayerData(p,a,b,c,d) +#define IDirectPlayX_SetPlayerName(p,a,b,c) (p)->lpVtbl->SetPlayerName(p,a,b,c) +#define IDirectPlayX_SetSessionDesc(p,a,b) (p)->lpVtbl->SetSessionDesc(p,a,b) +#define IDirectPlayX_AddGroupToGroup(p,a,b) (p)->lpVtbl->AddGroupToGroup(p,a,b) +#define IDirectPlayX_CreateGroupInGroup(p,a,b,c,d,e,f) (p)->lpVtbl->CreateGroupInGroup(p,a,b,c,d,e,f) +#define IDirectPlayX_DeleteGroupFromGroup(p,a,b) (p)->lpVtbl->DeleteGroupFromGroup(p,a,b) +#define IDirectPlayX_EnumConnections(p,a,b,c,d) (p)->lpVtbl->EnumConnections(p,a,b,c,d) +#define IDirectPlayX_EnumGroupsInGroup(p,a,b,c,d,e) (p)->lpVtbl->EnumGroupsInGroup(p,a,b,c,d,e) +#define IDirectPlayX_GetGroupConnectionSettings(p,a,b,c,d) (p)->lpVtbl->GetGroupConnectionSettings(p,a,b,c,d) +#define IDirectPlayX_InitializeConnection(p,a,b) (p)->lpVtbl->InitializeConnection(p,a,b) +#define IDirectPlayX_SecureOpen(p,a,b,c,d) (p)->lpVtbl->SecureOpen(p,a,b,c,d) +#define IDirectPlayX_SendChatMessage(p,a,b,c,d) (p)->lpVtbl->SendChatMessage(p,a,b,c,d) +#define IDirectPlayX_SetGroupConnectionSettings(p,a,b,c) (p)->lpVtbl->SetGroupConnectionSettings(p,a,b,c) +#define IDirectPlayX_StartSession(p,a,b) (p)->lpVtbl->StartSession(p,a,b) +#define IDirectPlayX_GetGroupFlags(p,a,b) (p)->lpVtbl->GetGroupFlags(p,a,b) +#define IDirectPlayX_GetGroupParent(p,a,b) (p)->lpVtbl->GetGroupParent(p,a,b) +#define IDirectPlayX_GetPlayerAccount(p,a,b,c,d) (p)->lpVtbl->GetPlayerAccount(p,a,b,c,d) +#define IDirectPlayX_GetPlayerFlags(p,a,b) (p)->lpVtbl->GetPlayerFlags(p,a,b) +#define IDirectPlayX_GetGroupOwner(p,a,b) (p)->lpVtbl->GetGroupOwner(p,a,b) +#define IDirectPlayX_SetGroupOwner(p,a,b) (p)->lpVtbl->SetGroupOwner(p,a,b) + +#else /* C++ */ + +#define IDirectPlayX_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlayX_AddRef(p) (p)->AddRef() +#define IDirectPlayX_Release(p) (p)->Release() +#define IDirectPlayX_AddPlayerToGroup(p,a,b) (p)->AddPlayerToGroup(a,b) +#define IDirectPlayX_CancelMessage(p,a,b) (p)->CancelMessage(a,b) +#define IDirectPlayX_CancelPriority(p,a,b,c) (p)->CancelPriority(a,b,c) +#define IDirectPlayX_Close(p) (p)->Close() +#define IDirectPlayX_CreateGroup(p,a,b,c,d,e) (p)->CreateGroup(a,b,c,d,e) +#define IDirectPlayX_CreatePlayer(p,a,b,c,d,e,f) (p)->CreatePlayer(a,b,c,d,e,f) +#define IDirectPlayX_DeletePlayerFromGroup(p,a,b) (p)->DeletePlayerFromGroup(a,b) +#define IDirectPlayX_DestroyGroup(p,a) (p)->DestroyGroup(a) +#define IDirectPlayX_DestroyPlayer(p,a) (p)->DestroyPlayer(a) +#define IDirectPlayX_EnumGroupPlayers(p,a,b,c,d,e) (p)->EnumGroupPlayers(a,b,c,d,e) +#define IDirectPlayX_EnumGroups(p,a,b,c,d) (p)->EnumGroups(a,b,c,d) +#define IDirectPlayX_EnumPlayers(p,a,b,c,d) (p)->EnumPlayers(a,b,c,d) +#define IDirectPlayX_EnumSessions(p,a,b,c,d,e) (p)->EnumSessions(a,b,c,d,e) +#define IDirectPlayX_GetCaps(p,a,b) (p)->GetCaps(a,b) +#define IDirectPlayX_GetMessageCount(p,a,b) (p)->GetMessageCount(a,b) +#define IDirectPlayX_GetMessageQueue(p,a,b,c,d,e) (p)->GetMessageQueue(a,b,c,d,e) +#define IDirectPlayX_GetGroupData(p,a,b,c,d) (p)->GetGroupData(a,b,c,d) +#define IDirectPlayX_GetGroupName(p,a,b,c) (p)->GetGroupName(a,b,c) +#define IDirectPlayX_GetPlayerAddress(p,a,b,c) (p)->GetPlayerAddress(a,b,c) +#define IDirectPlayX_GetPlayerCaps(p,a,b,c) (p)->GetPlayerCaps(a,b,c) +#define IDirectPlayX_GetPlayerData(p,a,b,c,d) (p)->GetPlayerData(a,b,c,d) +#define IDirectPlayX_GetPlayerName(p,a,b,c) (p)->GetPlayerName(a,b,c) +#define IDirectPlayX_GetSessionDesc(p,a,b) (p)->GetSessionDesc(a,b) +#define IDirectPlayX_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlayX_Open(p,a,b) (p)->Open(a,b) +#define IDirectPlayX_Receive(p,a,b,c,d,e) (p)->Receive(a,b,c,d,e) +#define IDirectPlayX_Send(p,a,b,c,d,e) (p)->Send(a,b,c,d,e) +#define IDirectPlayX_SendEx(p,a,b,c,d,e,f,g,h,i) (p)->SendEx(a,b,c,d,e,f,g,h,i) +#define IDirectPlayX_SetGroupData(p,a,b,c,d) (p)->SetGroupData(a,b,c,d) +#define IDirectPlayX_SetGroupName(p,a,b,c) (p)->SetGroupName(a,b,c) +#define IDirectPlayX_SetPlayerData(p,a,b,c,d) (p)->SetPlayerData(a,b,c,d) +#define IDirectPlayX_SetPlayerName(p,a,b,c) (p)->SetPlayerName(a,b,c) +#define IDirectPlayX_SetSessionDesc(p,a,b) (p)->SetSessionDesc(a,b) +#define IDirectPlayX_AddGroupToGroup(p,a,b) (p)->AddGroupToGroup(a,b) +#define IDirectPlayX_CreateGroupInGroup(p,a,b,c,d,e,f) (p)->CreateGroupInGroup(a,b,c,d,e,f) +#define IDirectPlayX_DeleteGroupFromGroup(p,a,b) (p)->DeleteGroupFromGroup(a,b) +#define IDirectPlayX_EnumConnections(p,a,b,c,d) (p)->EnumConnections(a,b,c,d) +#define IDirectPlayX_EnumGroupsInGroup(p,a,b,c,d,e) (p)->EnumGroupsInGroup(a,b,c,d,e) +#define IDirectPlayX_GetGroupConnectionSettings(p,a,b,c,d) (p)->GetGroupConnectionSettings(a,b,c,d) +#define IDirectPlayX_InitializeConnection(p,a,b) (p)->InitializeConnection(a,b) +#define IDirectPlayX_SecureOpen(p,a,b,c,d) (p)->SecureOpen(a,b,c,d) +#define IDirectPlayX_SendChatMessage(p,a,b,c,d) (p)->SendChatMessage(a,b,c,d) +#define IDirectPlayX_SetGroupConnectionSettings(p,a,b,c) (p)->SetGroupConnectionSettings(a,b,c) +#define IDirectPlayX_StartSession(p,a,b) (p)->StartSession(a,b) +#define IDirectPlayX_GetGroupFlags(p,a,b) (p)->GetGroupFlags(a,b) +#define IDirectPlayX_GetGroupParent(p,a,b) (p)->GetGroupParent(a,b) +#define IDirectPlayX_GetPlayerAccount(p,a,b,c,d) (p)->GetPlayerAccount(a,b,c,d) +#define IDirectPlayX_GetPlayerFlags(p,a,b) (p)->GetPlayerFlags(a,b) +#define IDirectPlayX_GetGroupOwner(p,a,b) (p)->GetGroupOwner(a,b) +#define IDirectPlayX_SetGroupOwner(p,a,b) (p)->SetGroupOwner(a,b) + +#endif + +/**************************************************************************** + * + * EnumConnections API flags + * + ****************************************************************************/ + +/* + * Enumerate Service Providers + */ +#define DPCONNECTION_DIRECTPLAY 0x00000001 + +/* + * Enumerate Lobby Providers + */ +#define DPCONNECTION_DIRECTPLAYLOBBY 0x00000002 + + +/**************************************************************************** + * + * EnumPlayers API flags + * + ****************************************************************************/ + +/* + * Enumerate all players in the current session + */ +#define DPENUMPLAYERS_ALL 0x00000000 +#define DPENUMGROUPS_ALL DPENUMPLAYERS_ALL + + +/* + * Enumerate only local (created by this application) players + * or groups + */ +#define DPENUMPLAYERS_LOCAL 0x00000008 +#define DPENUMGROUPS_LOCAL DPENUMPLAYERS_LOCAL + +/* + * Enumerate only remote (non-local) players + * or groups + */ +#define DPENUMPLAYERS_REMOTE 0x00000010 +#define DPENUMGROUPS_REMOTE DPENUMPLAYERS_REMOTE + +/* + * Enumerate groups along with the players + */ +#define DPENUMPLAYERS_GROUP 0x00000020 + +/* + * Enumerate players or groups in another session + * (must supply lpguidInstance) + */ +#define DPENUMPLAYERS_SESSION 0x00000080 +#define DPENUMGROUPS_SESSION DPENUMPLAYERS_SESSION + +/* + * Enumerate server players + */ +#define DPENUMPLAYERS_SERVERPLAYER 0x00000100 + +/* + * Enumerate spectator players + */ +#define DPENUMPLAYERS_SPECTATOR 0x00000200 + +/* + * Enumerate shortcut groups + */ +#define DPENUMGROUPS_SHORTCUT 0x00000400 + +/* + * Enumerate staging area groups + */ +#define DPENUMGROUPS_STAGINGAREA 0x00000800 + +/* + * Enumerate hidden groups + */ +#define DPENUMGROUPS_HIDDEN 0x00001000 + +/* + * Enumerate the group's owner + */ +#define DPENUMPLAYERS_OWNER 0x00002000 + + +/**************************************************************************** + * + * CreatePlayer API flags + * + ****************************************************************************/ + +/* + * This flag indicates that this player should be designated + * the server player. The app should specify this at CreatePlayer. + */ +#define DPPLAYER_SERVERPLAYER DPENUMPLAYERS_SERVERPLAYER + +/* + * This flag indicates that this player should be designated + * a spectator. The app should specify this at CreatePlayer. + */ +#define DPPLAYER_SPECTATOR DPENUMPLAYERS_SPECTATOR + +/* + * This flag indicates that this player was created locally. + * (returned from GetPlayerFlags) + */ +#define DPPLAYER_LOCAL DPENUMPLAYERS_LOCAL + +/* + * This flag indicates that this player is the group's owner + * (Only returned in EnumGroupPlayers) + */ +#define DPPLAYER_OWNER DPENUMPLAYERS_OWNER + +/**************************************************************************** + * + * CreateGroup API flags + * + ****************************************************************************/ + + +/* + * This flag indicates that the StartSession can be called on the group. + * The app should specify this at CreateGroup, or CreateGroupInGroup. + */ +#define DPGROUP_STAGINGAREA DPENUMGROUPS_STAGINGAREA + +/* + * This flag indicates that this group was created locally. + * (returned from GetGroupFlags) + */ +#define DPGROUP_LOCAL DPENUMGROUPS_LOCAL + +/* + * This flag indicates that this group was created hidden. + */ +#define DPGROUP_HIDDEN DPENUMGROUPS_HIDDEN + + +/**************************************************************************** + * + * EnumSessions API flags + * + ****************************************************************************/ + +/* + * Enumerate sessions which can be joined + */ +#define DPENUMSESSIONS_AVAILABLE 0x00000001 + +/* + * Enumerate all sessions even if they can't be joined. + */ +#define DPENUMSESSIONS_ALL 0x00000002 + + +/* + * Start an asynchronous enum sessions + */ + #define DPENUMSESSIONS_ASYNC 0x00000010 + +/* + * Stop an asynchronous enum sessions + */ + #define DPENUMSESSIONS_STOPASYNC 0x00000020 + +/* + * Enumerate sessions even if they require a password + */ + #define DPENUMSESSIONS_PASSWORDREQUIRED 0x00000040 + +/* + * Return status about progress of enumeration instead of + * showing any status dialogs. + */ + #define DPENUMSESSIONS_RETURNSTATUS 0x00000080 + +/**************************************************************************** + * + * GetCaps and GetPlayerCaps API flags + * + ****************************************************************************/ + +/* + * The latency returned should be for guaranteed message sending. + * Default is non-guaranteed messaging. + */ +#define DPGETCAPS_GUARANTEED 0x00000001 + + +/**************************************************************************** + * + * GetGroupData, GetPlayerData API flags + * Remote and local Group/Player data is maintained separately. + * Default is DPGET_REMOTE. + * + ****************************************************************************/ + +/* + * Get the remote data (set by any DirectPlay object in + * the session using DPSET_REMOTE) + */ +#define DPGET_REMOTE 0x00000000 + +/* + * Get the local data (set by this DirectPlay object + * using DPSET_LOCAL) + */ +#define DPGET_LOCAL 0x00000001 + + +/**************************************************************************** + * + * Open API flags + * + ****************************************************************************/ + +/* + * Join the session that is described by the DPSESSIONDESC2 structure + */ +#define DPOPEN_JOIN 0x00000001 + +/* + * Create a new session as described by the DPSESSIONDESC2 structure + */ +#define DPOPEN_CREATE 0x00000002 + +/* + * Return status about progress of open instead of showing + * any status dialogs. + */ + #define DPOPEN_RETURNSTATUS DPENUMSESSIONS_RETURNSTATUS + + +/**************************************************************************** + * + * DPLCONNECTION flags + * + ****************************************************************************/ + +/* + * This application should create a new session as + * described by the DPSESIONDESC structure + */ +#define DPLCONNECTION_CREATESESSION DPOPEN_CREATE + +/* + * This application should join the session described by + * the DPSESIONDESC structure with the lpAddress data + */ +#define DPLCONNECTION_JOINSESSION DPOPEN_JOIN + +/**************************************************************************** + * + * Receive API flags + * Default is DPRECEIVE_ALL + * + ****************************************************************************/ + +/* + * Get the first message in the queue + */ +#define DPRECEIVE_ALL 0x00000001 + +/* + * Get the first message in the queue directed to a specific player + */ +#define DPRECEIVE_TOPLAYER 0x00000002 + +/* + * Get the first message in the queue from a specific player + */ +#define DPRECEIVE_FROMPLAYER 0x00000004 + +/* + * Get the message but don't remove it from the queue + */ +#define DPRECEIVE_PEEK 0x00000008 + + +/**************************************************************************** + * + * Send API flags + * + ****************************************************************************/ + +/* + * Send the message using a guaranteed send method. + * Default is non-guaranteed. + */ +#define DPSEND_GUARANTEED 0x00000001 + + +/* + * This flag is obsolete. It is ignored by DirectPlay + */ +#define DPSEND_HIGHPRIORITY 0x00000002 + +/* + * This flag is obsolete. It is ignored by DirectPlay + */ +#define DPSEND_OPENSTREAM 0x00000008 + +/* + * This flag is obsolete. It is ignored by DirectPlay + */ +#define DPSEND_CLOSESTREAM 0x00000010 + +/* + * Send the message digitally signed to ensure authenticity. + */ +#define DPSEND_SIGNED 0x00000020 + +/* + * Send the message with encryption to ensure privacy. + */ +#define DPSEND_ENCRYPTED 0x00000040 + +/* + * The message is a lobby system message + */ +#define DPSEND_LOBBYSYSTEMMESSAGE 0x00000080 + + +/* + * Send message asynchronously, must check caps + * before using this flag. It is always provided + * if the protocol flag is set. + */ +#define DPSEND_ASYNC 0x00000200 + +/* + * When an message is completed, don't tell me. + * by default the application is notified with a system message. + */ +#define DPSEND_NOSENDCOMPLETEMSG 0x00000400 + + +/* + * Maximum priority for sends available to applications + */ +#define DPSEND_MAX_PRI 0x0000FFFF +#define DPSEND_MAX_PRIORITY DPSEND_MAX_PRI + + +/**************************************************************************** + * + * SetGroupData, SetGroupName, SetPlayerData, SetPlayerName, + * SetSessionDesc API flags. + * Default is DPSET_REMOTE. + * + ****************************************************************************/ + +/* + * Propagate the data to all players in the session + */ +#define DPSET_REMOTE 0x00000000 + +/* + * Do not propagate the data to other players + */ +#define DPSET_LOCAL 0x00000001 + +/* + * Used with DPSET_REMOTE, use guaranteed message send to + * propagate the data + */ +#define DPSET_GUARANTEED 0x00000002 + +/**************************************************************************** + * + * GetMessageQueue API flags. + * Default is DPMESSAGEQUEUE_SEND + * + ****************************************************************************/ + +/* + * Get Send Queue - requires Service Provider Support + */ +#define DPMESSAGEQUEUE_SEND 0x00000001 + +/* + * Get Receive Queue + */ +#define DPMESSAGEQUEUE_RECEIVE 0x00000002 + + +/**************************************************************************** + * + * Connect API flags + * + ****************************************************************************/ + + +/* + * Start an asynchronous connect which returns status codes + */ +#define DPCONNECT_RETURNSTATUS (DPENUMSESSIONS_RETURNSTATUS) + + +/**************************************************************************** + * + * DirectPlay system messages and message data structures + * + * All system message come 'From' player DPID_SYSMSG. To determine what type + * of message it is, cast the lpData from Receive to DPMSG_GENERIC and check + * the dwType member against one of the following DPSYS_xxx constants. Once + * a match is found, cast the lpData to the corresponding of the DPMSG_xxx + * structures to access the data of the message. + * + ****************************************************************************/ + +/* + * A new player or group has been created in the session + * Use DPMSG_CREATEPLAYERORGROUP. Check dwPlayerType to see if it + * is a player or a group. + */ +#define DPSYS_CREATEPLAYERORGROUP 0x0003 + +/* + * A player has been deleted from the session + * Use DPMSG_DESTROYPLAYERORGROUP + */ +#define DPSYS_DESTROYPLAYERORGROUP 0x0005 + +/* + * A player has been added to a group + * Use DPMSG_ADDPLAYERTOGROUP + */ +#define DPSYS_ADDPLAYERTOGROUP 0x0007 + +/* + * A player has been removed from a group + * Use DPMSG_DELETEPLAYERFROMGROUP + */ +#define DPSYS_DELETEPLAYERFROMGROUP 0x0021 + +/* + * This DirectPlay object lost its connection with all the + * other players in the session. + * Use DPMSG_SESSIONLOST. + */ +#define DPSYS_SESSIONLOST 0x0031 + +/* + * The current host has left the session. + * This DirectPlay object is now the host. + * Use DPMSG_HOST. + */ +#define DPSYS_HOST 0x0101 + +/* + * The remote data associated with a player or + * group has changed. Check dwPlayerType to see + * if it is a player or a group + * Use DPMSG_SETPLAYERORGROUPDATA + */ +#define DPSYS_SETPLAYERORGROUPDATA 0x0102 + +/* + * The name of a player or group has changed. + * Check dwPlayerType to see if it is a player + * or a group. + * Use DPMSG_SETPLAYERORGROUPNAME + */ +#define DPSYS_SETPLAYERORGROUPNAME 0x0103 + +/* + * The session description has changed. + * Use DPMSG_SETSESSIONDESC + */ +#define DPSYS_SETSESSIONDESC 0x0104 + +/* + * A group has been added to a group + * Use DPMSG_ADDGROUPTOGROUP + */ +#define DPSYS_ADDGROUPTOGROUP 0x0105 + +/* + * A group has been removed from a group + * Use DPMSG_DELETEGROUPFROMGROUP + */ +#define DPSYS_DELETEGROUPFROMGROUP 0x0106 + +/* + * A secure player-player message has arrived. + * Use DPMSG_SECUREMESSAGE + */ +#define DPSYS_SECUREMESSAGE 0x0107 + +/* + * Start a new session. + * Use DPMSG_STARTSESSION + */ +#define DPSYS_STARTSESSION 0x0108 + +/* + * A chat message has arrived + * Use DPMSG_CHAT + */ +#define DPSYS_CHAT 0x0109 + +/* + * The owner of a group has changed + * Use DPMSG_SETGROUPOWNER + */ +#define DPSYS_SETGROUPOWNER 0x010A + +/* + * An async send has finished, failed or been cancelled + * Use DPMSG_SENDCOMPLETE + */ +#define DPSYS_SENDCOMPLETE 0x010d + + +/* + * Used in the dwPlayerType field to indicate if it applies to a group + * or a player + */ +#define DPPLAYERTYPE_GROUP 0x00000000 +#define DPPLAYERTYPE_PLAYER 0x00000001 + + +/* + * DPMSG_GENERIC + * Generic message structure used to identify the message type. + */ +typedef struct +{ + DWORD dwType; // Message type +} DPMSG_GENERIC, FAR *LPDPMSG_GENERIC; + +/* + * DPMSG_CREATEPLAYERORGROUP + * System message generated when a new player or group + * created in the session with information about it. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // ID of the player or group + DWORD dwCurrentPlayers; // current # players & groups in session + LPVOID lpData; // pointer to remote data + DWORD dwDataSize; // size of remote data + DPNAME dpnName; // structure with name info + // the following fields are only available when using + // the IDirectPlay3 interface or greater + DPID dpIdParent; // id of parent group + DWORD dwFlags; // player or group flags +} DPMSG_CREATEPLAYERORGROUP, FAR *LPDPMSG_CREATEPLAYERORGROUP; + +/* + * DPMSG_DESTROYPLAYERORGROUP + * System message generated when a player or group is being + * destroyed in the session with information about it. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // player ID being deleted + LPVOID lpLocalData; // copy of players local data + DWORD dwLocalDataSize; // sizeof local data + LPVOID lpRemoteData; // copy of players remote data + DWORD dwRemoteDataSize; // sizeof remote data + // the following fields are only available when using + // the IDirectPlay3 interface or greater + DPNAME dpnName; // structure with name info + DPID dpIdParent; // id of parent group + DWORD dwFlags; // player or group flags +} DPMSG_DESTROYPLAYERORGROUP, FAR *LPDPMSG_DESTROYPLAYERORGROUP; + +/* + * DPMSG_ADDPLAYERTOGROUP + * System message generated when a player is being added + * to a group. + */ +typedef struct +{ + DWORD dwType; // Message type + DPID dpIdGroup; // group ID being added to + DPID dpIdPlayer; // player ID being added +} DPMSG_ADDPLAYERTOGROUP, FAR *LPDPMSG_ADDPLAYERTOGROUP; + +/* + * DPMSG_DELETEPLAYERFROMGROUP + * System message generated when a player is being + * removed from a group + */ +typedef DPMSG_ADDPLAYERTOGROUP DPMSG_DELETEPLAYERFROMGROUP; +typedef DPMSG_DELETEPLAYERFROMGROUP FAR *LPDPMSG_DELETEPLAYERFROMGROUP; + +/* + * DPMSG_ADDGROUPTOGROUP + * System message generated when a group is being added + * to a group. + */ +typedef struct +{ + DWORD dwType; // Message type + DPID dpIdParentGroup; // group ID being added to + DPID dpIdGroup; // group ID being added +} DPMSG_ADDGROUPTOGROUP, FAR *LPDPMSG_ADDGROUPTOGROUP; + +/* + * DPMSG_DELETEGROUPFROMGROUP + * System message generated when a GROUP is being + * removed from a group + */ +typedef DPMSG_ADDGROUPTOGROUP DPMSG_DELETEGROUPFROMGROUP; +typedef DPMSG_DELETEGROUPFROMGROUP FAR *LPDPMSG_DELETEGROUPFROMGROUP; + +/* + * DPMSG_SETPLAYERORGROUPDATA + * System message generated when remote data for a player or + * group has changed. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // ID of player or group + LPVOID lpData; // pointer to remote data + DWORD dwDataSize; // size of remote data +} DPMSG_SETPLAYERORGROUPDATA, FAR *LPDPMSG_SETPLAYERORGROUPDATA; + +/* + * DPMSG_SETPLAYERORGROUPNAME + * System message generated when the name of a player or + * group has changed. + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwPlayerType; // Is it a player or group + DPID dpId; // ID of player or group + DPNAME dpnName; // structure with new name info +} DPMSG_SETPLAYERORGROUPNAME, FAR *LPDPMSG_SETPLAYERORGROUPNAME; + +/* + * DPMSG_SETSESSIONDESC + * System message generated when session desc has changed + */ +typedef struct +{ + DWORD dwType; // Message type + DPSESSIONDESC2 dpDesc; // Session desc +} DPMSG_SETSESSIONDESC, FAR *LPDPMSG_SETSESSIONDESC; + +/* + * DPMSG_HOST + * System message generated when the host has migrated to this + * DirectPlay object. + * + */ +typedef DPMSG_GENERIC DPMSG_HOST; +typedef DPMSG_HOST FAR *LPDPMSG_HOST; + +/* + * DPMSG_SESSIONLOST + * System message generated when the connection to the session is lost. + * + */ +typedef DPMSG_GENERIC DPMSG_SESSIONLOST; +typedef DPMSG_SESSIONLOST FAR *LPDPMSG_SESSIONLOST; + +/* + * DPMSG_SECUREMESSAGE + * System message generated when a player requests a secure send + */ +typedef struct +{ + DWORD dwType; // Message Type + DWORD dwFlags; // Signed/Encrypted + DPID dpIdFrom; // ID of Sending Player + LPVOID lpData; // Player message + DWORD dwDataSize; // Size of player message +} DPMSG_SECUREMESSAGE, FAR *LPDPMSG_SECUREMESSAGE; + +/* + * DPMSG_STARTSESSION + * System message containing all information required to + * start a new session + */ +typedef struct +{ + DWORD dwType; // Message type + LPDPLCONNECTION lpConn; // DPLCONNECTION structure +} DPMSG_STARTSESSION, FAR *LPDPMSG_STARTSESSION; + +/* + * DPMSG_CHAT + * System message containing a chat message + */ +typedef struct +{ + DWORD dwType; // Message type + DWORD dwFlags; // Message flags + DPID idFromPlayer; // ID of the Sending Player + DPID idToPlayer; // ID of the To Player + DPID idToGroup; // ID of the To Group + LPDPCHAT lpChat; // Pointer to a structure containing the chat message +} DPMSG_CHAT, FAR *LPDPMSG_CHAT; + +/* + * DPMSG_SETGROUPOWNER + * System message generated when the owner of a group has changed + */ +typedef struct +{ + DWORD dwType; // Message type + DPID idGroup; // ID of the group + DPID idNewOwner; // ID of the player that is the new owner + DPID idOldOwner; // ID of the player that used to be the owner +} DPMSG_SETGROUPOWNER, FAR *LPDPMSG_SETGROUPOWNER; + +/* + * DPMSG_SENDCOMPLETE + * System message generated when finished with an Async Send message + * + * NOTE SENDPARMS has an overlay for DPMSG_SENDCOMPLETE, don't + * change this message w/o changing SENDPARMS. + */ +typedef struct +{ + DWORD dwType; + DPID idFrom; + DPID idTo; + DWORD dwFlags; + DWORD dwPriority; + DWORD dwTimeout; + LPVOID lpvContext; + DWORD dwMsgID; + HRESULT hr; + DWORD dwSendTime; +} DPMSG_SENDCOMPLETE, *LPDPMSG_SENDCOMPLETE; + +/**************************************************************************** + * + * DIRECTPLAY ERRORS + * + * Errors are represented by negative values and cannot be combined. + * + ****************************************************************************/ +#define DP_OK S_OK +#define DPERR_ALREADYINITIALIZED MAKE_DPHRESULT( 5 ) +#define DPERR_ACCESSDENIED MAKE_DPHRESULT( 10 ) +#define DPERR_ACTIVEPLAYERS MAKE_DPHRESULT( 20 ) +#define DPERR_BUFFERTOOSMALL MAKE_DPHRESULT( 30 ) +#define DPERR_CANTADDPLAYER MAKE_DPHRESULT( 40 ) +#define DPERR_CANTCREATEGROUP MAKE_DPHRESULT( 50 ) +#define DPERR_CANTCREATEPLAYER MAKE_DPHRESULT( 60 ) +#define DPERR_CANTCREATESESSION MAKE_DPHRESULT( 70 ) +#define DPERR_CAPSNOTAVAILABLEYET MAKE_DPHRESULT( 80 ) +#define DPERR_EXCEPTION MAKE_DPHRESULT( 90 ) +#define DPERR_GENERIC E_FAIL +#define DPERR_INVALIDFLAGS MAKE_DPHRESULT( 120 ) +#define DPERR_INVALIDOBJECT MAKE_DPHRESULT( 130 ) +#define DPERR_INVALIDPARAM E_INVALIDARG +#define DPERR_INVALIDPARAMS DPERR_INVALIDPARAM +#define DPERR_INVALIDPLAYER MAKE_DPHRESULT( 150 ) +#define DPERR_INVALIDGROUP MAKE_DPHRESULT( 155 ) +#define DPERR_NOCAPS MAKE_DPHRESULT( 160 ) +#define DPERR_NOCONNECTION MAKE_DPHRESULT( 170 ) +#define DPERR_NOMEMORY E_OUTOFMEMORY +#define DPERR_OUTOFMEMORY DPERR_NOMEMORY +#define DPERR_NOMESSAGES MAKE_DPHRESULT( 190 ) +#define DPERR_NONAMESERVERFOUND MAKE_DPHRESULT( 200 ) +#define DPERR_NOPLAYERS MAKE_DPHRESULT( 210 ) +#define DPERR_NOSESSIONS MAKE_DPHRESULT( 220 ) +#define DPERR_PENDING E_PENDING +#define DPERR_SENDTOOBIG MAKE_DPHRESULT( 230 ) +#define DPERR_TIMEOUT MAKE_DPHRESULT( 240 ) +#define DPERR_UNAVAILABLE MAKE_DPHRESULT( 250 ) +#define DPERR_UNSUPPORTED E_NOTIMPL +#define DPERR_BUSY MAKE_DPHRESULT( 270 ) +#define DPERR_USERCANCEL MAKE_DPHRESULT( 280 ) +#define DPERR_NOINTERFACE E_NOINTERFACE +#define DPERR_CANNOTCREATESERVER MAKE_DPHRESULT( 290 ) +#define DPERR_PLAYERLOST MAKE_DPHRESULT( 300 ) +#define DPERR_SESSIONLOST MAKE_DPHRESULT( 310 ) +#define DPERR_UNINITIALIZED MAKE_DPHRESULT( 320 ) +#define DPERR_NONEWPLAYERS MAKE_DPHRESULT( 330 ) +#define DPERR_INVALIDPASSWORD MAKE_DPHRESULT( 340 ) +#define DPERR_CONNECTING MAKE_DPHRESULT( 350 ) +#define DPERR_CONNECTIONLOST MAKE_DPHRESULT( 360 ) +#define DPERR_UNKNOWNMESSAGE MAKE_DPHRESULT( 370 ) +#define DPERR_CANCELFAILED MAKE_DPHRESULT( 380 ) +#define DPERR_INVALIDPRIORITY MAKE_DPHRESULT( 390 ) +#define DPERR_NOTHANDLED MAKE_DPHRESULT( 400 ) +#define DPERR_CANCELLED MAKE_DPHRESULT( 410 ) +#define DPERR_ABORTED MAKE_DPHRESULT( 420 ) + + +#define DPERR_BUFFERTOOLARGE MAKE_DPHRESULT( 1000 ) +#define DPERR_CANTCREATEPROCESS MAKE_DPHRESULT( 1010 ) +#define DPERR_APPNOTSTARTED MAKE_DPHRESULT( 1020 ) +#define DPERR_INVALIDINTERFACE MAKE_DPHRESULT( 1030 ) +#define DPERR_NOSERVICEPROVIDER MAKE_DPHRESULT( 1040 ) +#define DPERR_UNKNOWNAPPLICATION MAKE_DPHRESULT( 1050 ) +#define DPERR_NOTLOBBIED MAKE_DPHRESULT( 1070 ) +#define DPERR_SERVICEPROVIDERLOADED MAKE_DPHRESULT( 1080 ) +#define DPERR_ALREADYREGISTERED MAKE_DPHRESULT( 1090 ) +#define DPERR_NOTREGISTERED MAKE_DPHRESULT( 1100 ) + +// +// Security related errors +// +#define DPERR_AUTHENTICATIONFAILED MAKE_DPHRESULT( 2000 ) +#define DPERR_CANTLOADSSPI MAKE_DPHRESULT( 2010 ) +#define DPERR_ENCRYPTIONFAILED MAKE_DPHRESULT( 2020 ) +#define DPERR_SIGNFAILED MAKE_DPHRESULT( 2030 ) +#define DPERR_CANTLOADSECURITYPACKAGE MAKE_DPHRESULT( 2040 ) +#define DPERR_ENCRYPTIONNOTSUPPORTED MAKE_DPHRESULT( 2050 ) +#define DPERR_CANTLOADCAPI MAKE_DPHRESULT( 2060 ) +#define DPERR_NOTLOGGEDIN MAKE_DPHRESULT( 2070 ) +#define DPERR_LOGONDENIED MAKE_DPHRESULT( 2080 ) + + +/**************************************************************************** + * + * dplay 1.0 obsolete structures + interfaces + * Included for compatibility only. New apps should + * use IDirectPlay2 + * + ****************************************************************************/ + +// define this to ignore obsolete interfaces and constants +#ifndef IDIRECTPLAY2_OR_GREATER + +#define DPOPEN_OPENSESSION DPOPEN_JOIN +#define DPOPEN_CREATESESSION DPOPEN_CREATE + +#define DPENUMSESSIONS_PREVIOUS 0x00000004 + +#define DPENUMPLAYERS_PREVIOUS 0x00000004 + +#define DPSEND_GUARANTEE DPSEND_GUARANTEED +#define DPSEND_TRYONCE 0x00000004 + +#define DPCAPS_NAMESERVICE 0x00000001 +#define DPCAPS_NAMESERVER DPCAPS_ISHOST +#define DPCAPS_GUARANTEED 0x00000004 + +#define DPLONGNAMELEN 52 +#define DPSHORTNAMELEN 20 +#define DPSESSIONNAMELEN 32 +#define DPPASSWORDLEN 16 +#define DPUSERRESERVED 16 + +#define DPSYS_ADDPLAYER 0x0003 +#define DPSYS_DELETEPLAYER 0x0005 + +#define DPSYS_DELETEGROUP 0x0020 +#define DPSYS_DELETEPLAYERFROMGRP 0x0021 +#define DPSYS_CONNECT 0x484b + +typedef struct +{ + DWORD dwType; + DWORD dwPlayerType; + DPID dpId; + char szLongName[DPLONGNAMELEN]; + char szShortName[DPSHORTNAMELEN]; + DWORD dwCurrentPlayers; +} DPMSG_ADDPLAYER; + +typedef DPMSG_ADDPLAYER DPMSG_ADDGROUP; + +typedef struct +{ + DWORD dwType; + DPID dpIdGroup; + DPID dpIdPlayer; +} DPMSG_GROUPADD; + +typedef DPMSG_GROUPADD DPMSG_GROUPDELETE; +typedef struct +{ + DWORD dwType; + DPID dpId; +} DPMSG_DELETEPLAYER; + +typedef BOOL (PASCAL *LPDPENUMPLAYERSCALLBACK)( + DPID dpId, + LPSTR lpFriendlyName, + LPSTR lpFormalName, + DWORD dwFlags, + LPVOID lpContext ); + +typedef struct +{ + DWORD dwSize; + GUID guidSession; + DWORD_PTR dwSession; + DWORD dwMaxPlayers; + DWORD dwCurrentPlayers; + DWORD dwFlags; + char szSessionName[DPSESSIONNAMELEN]; + char szUserField[DPUSERRESERVED]; + DWORD_PTR dwReserved1; + char szPassword[DPPASSWORDLEN]; + DWORD_PTR dwReserved2; + DWORD_PTR dwUser1; + DWORD_PTR dwUser2; + DWORD_PTR dwUser3; + DWORD_PTR dwUser4; +} DPSESSIONDESC,*LPDPSESSIONDESC; + +typedef BOOL (PASCAL * LPDPENUMSESSIONSCALLBACK)( + LPDPSESSIONDESC lpDPSessionDesc, + LPVOID lpContext, + LPDWORD lpdwTimeOut, + DWORD dwFlags); + +/* + * IDirectPlay + */ +#undef INTERFACE +#define INTERFACE IDirectPlay +DECLARE_INTERFACE_( IDirectPlay, IUnknown ) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + /*** IDirectPlay methods ***/ + STDMETHOD(AddPlayerToGroup) (THIS_ DPID, DPID) PURE; + STDMETHOD(Close) (THIS) PURE; + STDMETHOD(CreatePlayer) (THIS_ LPDPID,LPSTR,LPSTR,LPHANDLE) PURE; + STDMETHOD(CreateGroup) (THIS_ LPDPID,LPSTR,LPSTR) PURE; + STDMETHOD(DeletePlayerFromGroup)(THIS_ DPID,DPID) PURE; + STDMETHOD(DestroyPlayer) (THIS_ DPID) PURE; + STDMETHOD(DestroyGroup) (THIS_ DPID) PURE; + STDMETHOD(EnableNewPlayers) (THIS_ BOOL) PURE; + STDMETHOD(EnumGroupPlayers) (THIS_ DPID, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumGroups) (THIS_ DWORD_PTR, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumPlayers) (THIS_ DWORD_PTR, LPDPENUMPLAYERSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(EnumSessions) (THIS_ LPDPSESSIONDESC,DWORD,LPDPENUMSESSIONSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(GetCaps) (THIS_ LPDPCAPS) PURE; + STDMETHOD(GetMessageCount) (THIS_ DPID, LPDWORD) PURE; + STDMETHOD(GetPlayerCaps) (THIS_ DPID, LPDPCAPS) PURE; + STDMETHOD(GetPlayerName) (THIS_ DPID,LPSTR,LPDWORD,LPSTR,LPDWORD) PURE; + STDMETHOD(Initialize) (THIS_ LPGUID) PURE; + STDMETHOD(Open) (THIS_ LPDPSESSIONDESC) PURE; + STDMETHOD(Receive) (THIS_ LPDPID,LPDPID,DWORD,LPVOID,LPDWORD) PURE; + STDMETHOD(SaveSession) (THIS_ LPSTR) PURE; + STDMETHOD(Send) (THIS_ DPID, DPID, DWORD, LPVOID, DWORD) PURE; + STDMETHOD(SetPlayerName) (THIS_ DPID,LPSTR,LPSTR) PURE; +}; + +/**************************************************************************** + * + * IDirectPlay interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay_AddPlayerToGroup(p,a,b) (p)->lpVtbl->AddPlayerToGroup(p,a,b) +#define IDirectPlay_Close(p) (p)->lpVtbl->Close(p) +#define IDirectPlay_CreateGroup(p,a,b,c) (p)->lpVtbl->CreateGroup(p,a,b,c) +#define IDirectPlay_CreatePlayer(p,a,b,c,d) (p)->lpVtbl->CreatePlayer(p,a,b,c,d) +#define IDirectPlay_DeletePlayerFromGroup(p,a,b) (p)->lpVtbl->DeletePlayerFromGroup(p,a,b) +#define IDirectPlay_DestroyGroup(p,a) (p)->lpVtbl->DestroyGroup(p,a) +#define IDirectPlay_DestroyPlayer(p,a) (p)->lpVtbl->DestroyPlayer(p,a) +#define IDirectPlay_EnableNewPlayers(p,a) (p)->lpVtbl->EnableNewPlayers(p,a) +#define IDirectPlay_EnumGroupPlayers(p,a,b,c,d) (p)->lpVtbl->EnumGroupPlayers(p,a,b,c,d) +#define IDirectPlay_EnumGroups(p,a,b,c,d) (p)->lpVtbl->EnumGroups(p,a,b,c,d) +#define IDirectPlay_EnumPlayers(p,a,b,c,d) (p)->lpVtbl->EnumPlayers(p,a,b,c,d) +#define IDirectPlay_EnumSessions(p,a,b,c,d,e) (p)->lpVtbl->EnumSessions(p,a,b,c,d,e) +#define IDirectPlay_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectPlay_GetMessageCount(p,a,b) (p)->lpVtbl->GetMessageCount(p,a,b) +#define IDirectPlay_GetPlayerCaps(p,a,b) (p)->lpVtbl->GetPlayerCaps(p,a,b) +#define IDirectPlay_GetPlayerName(p,a,b,c,d,e) (p)->lpVtbl->GetPlayerName(p,a,b,c,d,e) +#define IDirectPlay_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#define IDirectPlay_Open(p,a) (p)->lpVtbl->Open(p,a) +#define IDirectPlay_Receive(p,a,b,c,d,e) (p)->lpVtbl->Receive(p,a,b,c,d,e) +#define IDirectPlay_SaveSession(p,a) (p)->lpVtbl->SaveSession(p,a) +#define IDirectPlay_Send(p,a,b,c,d,e) (p)->lpVtbl->Send(p,a,b,c,d,e) +#define IDirectPlay_SetPlayerName(p,a,b,c) (p)->lpVtbl->SetPlayerName(p,a,b,c) + +#else /* C++ */ + +#define IDirectPlay_AddPlayerToGroup(p,a,b) (p)->AddPlayerToGroup(a,b) +#define IDirectPlay_Close(p) (p)->Close() +#define IDirectPlay_CreateGroup(p,a,b,c) (p)->CreateGroup(a,b,c) +#define IDirectPlay_CreatePlayer(p,a,b,c,d) (p)->CreatePlayer(a,b,c,d) +#define IDirectPlay_DeletePlayerFromGroup(p,a,b) (p)->DeletePlayerFromGroup(a,b) +#define IDirectPlay_DestroyGroup(p,a) (p)->DestroyGroup(a) +#define IDirectPlay_DestroyPlayer(p,a) (p)->DestroyPlayer(a) +#define IDirectPlay_EnableNewPlayers(p,a) (p)->EnableNewPlayers(a) +#define IDirectPlay_EnumGroupPlayers(p,a,b,c,d) (p)->EnumGroupPlayers(a,b,c,d) +#define IDirectPlay_EnumGroups(p,a,b,c,d) (p)->EnumGroups(a,b,c,d) +#define IDirectPlay_EnumPlayers(p,a,b,c,d) (p)->EnumPlayers(a,b,c,d) +#define IDirectPlay_EnumSessions(p,a,b,c,d,e) (p)->EnumSessions(a,b,c,d,e) +#define IDirectPlay_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectPlay_GetMessageCount(p,a,b) (p)->GetMessageCount(a,b) +#define IDirectPlay_GetPlayerCaps(p,a,b) (p)->GetPlayerCaps(a,b) +#define IDirectPlay_GetPlayerName(p,a,b,c,d,e) (p)->GetPlayerName(a,b,c,d,e) +#define IDirectPlay_Initialize(p,a) (p)->Initialize(a) +#define IDirectPlay_Open(p,a) (p)->Open(a) +#define IDirectPlay_Receive(p,a,b,c,d,e) (p)->Receive(a,b,c,d,e) +#define IDirectPlay_SaveSession(p,a) (p)->SaveSession(a) +#define IDirectPlay_Send(p,a,b,c,d,e) (p)->Send(a,b,c,d,e) +#define IDirectPlay_SetPlayerName(p,a,b,c) (p)->SetPlayerName(a,b,c) + +#endif + +DEFINE_GUID(IID_IDirectPlay, 0x5454e9a0, 0xdb65, 0x11ce, 0x92, 0x1c, 0x00, 0xaa, 0x00, 0x6c, 0x49, 0x72); + +#endif // IDIRECTPLAY2_OR_GREATER + +/**************************************************************************** + * + * IDirectPlay macros (included regardless of IDIRECTPLAY2_OR_GREATER flag) + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDirectPlay_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectPlay_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectPlay_Release(p) (p)->lpVtbl->Release(p) + +#else + +#define IDirectPlay_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectPlay_AddRef(p) (p)->AddRef() +#define IDirectPlay_Release(p) (p)->Release() + +#endif // IDirectPlay interface macros + +#ifdef __cplusplus +}; +#endif + +/* restore warning settings */ +#if _MSC_VER >= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif + diff --git a/event.cpp b/event.cpp index e2f0765..3bc4ff3 100644 --- a/event.cpp +++ b/event.cpp @@ -1535,7 +1535,7 @@ void CEvent::Create(HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, POINT pos; m_hWnd = hWnd; - m_pPixmap = pPixmapl + m_pPixmap = pPixmap; m_pDecor = pDecor; m_pSound = pSound; m_pMovie = pMovie; @@ -1734,3 +1734,28 @@ void CEvent::HideMouse(BOOL bHide) ChangeSprite(m_mouseSprite); } +/* +void CEvent::SomethingDecor() +{ + m_input = 0; + m_pDecor->TreatEvent(); +} +*/ + +int CEvent::GetWorld() +{ + if ( m_bPrivate ) return m_bPrivate; + if ( m_bMulti ) return m_multi+200; + else return m_mission; +} + +BOOL CEvent::IsPrivate() +{ + return m_bPrivate; +} + +BOOL CEvent::IsMulti() +{ + return m_bMulti; +} + From 6b1d0adf95e9b756836867ffec092729b38afe1a Mon Sep 17 00:00:00 2001 From: HMVocaloid Date: Fri, 24 May 2024 21:17:56 -0400 Subject: [PATCH 7/7] Updated More --- event.cpp | 136 ++++++++++++++++++++++-- jauge.cpp | 9 +- menu.cpp | 302 +----------------------------------------------------- misc.cpp | 119 +++++++++++++++++++++ 4 files changed, 255 insertions(+), 311 deletions(-) diff --git a/event.cpp b/event.cpp index 3bc4ff3..5c9ad12 100644 --- a/event.cpp +++ b/event.cpp @@ -50,17 +50,33 @@ DescInfo; // Toutes les premi�res lettres doivent // �tre diff�rentes ! -static char cheat_code[9][20] = +static char cheat_code[9][35] = { - "VISION", // 0 - "POWER", // 1 - "LONESOME", // 2 - "ALLMISSIONS", // 3 - "QUICK", // 4 - "HELPME", // 5 - "INVINCIBLE", // 6 - "SUPERBLUPI", // 7 - "CONSTRUIRE", // 8 (CPOTUSVJSF) + "XMISSION", // 0 + "OPENDOORS", // 1 + "CLEANALL", // 2 + "MEGABLUPI", // 3 + "LAYEGG", // 4 + "KILLEGG", // 5 + "FUNSKATE", // 6 + "GIVECOPTER", // 7 + "JEEPDRIVE", // 8 (CPOTUSVJSF) + "ALLTREASURE", + "ENDGOAL", + "SHOWSECRET", + "ROUNDSHIELD", + "QUICKLOLLIPOP", + "TENBOMBS", + "BIRDLIME", + "DRIVETANK", + "POWERCHARGE", + "HIDEDRINK", + "NETPACKED", + "ZNETDEBUG", + "YNOSMOOTH", + "IOVERCRAFT", + "UDYNAMITE", + "WELLKEYS", }; @@ -1539,6 +1555,7 @@ void CEvent::Create(HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, m_pDecor = pDecor; m_pSound = pSound; m_pMovie = pMovie; + m_pNetwork = pNetwork; ReadInfo(); } @@ -1634,6 +1651,8 @@ void CEvent::RestoreGame() WaitMouse(TRUE); WaitMouse(FALSE); } + + /* void AddCheatCode(char *pDst, char *pSrc) { @@ -1742,6 +1761,20 @@ void CEvent::SomethingDecor() } */ +BOOL CEvent::MouseOnButton(POINT pos) +{ + int i; + + i = 0; + while ( table[m_index].buttons[i].message != 0 ) + { + if ( m_buttons[i].MouseOnButton(pos) ) return TRUE; + i ++; + } + + return FALSE; +} + int CEvent::GetWorld() { if ( m_bPrivate ) return m_bPrivate; @@ -1759,3 +1792,86 @@ BOOL CEvent::IsMulti() return m_bMulti; } +UINT CDecor::GetPhase() +{ + return m_phase; +} + +void CEvent::TryInsert() +{ + if ( m_tryInsertCount == 0 ) + { + ChangePhase(m_tryPhase); + } + else + { + m_tryInsertCount --; + } +} + +void CEvent::SetSpeed(int speed) +{ + int max; + + if ( m_bSpeed ) max = 2; + + if ( speed > max ) speed = max; + + m_speed = speed; +} + +int CEvent::GetSpeed() +{ + return m_speed; +} + +BOOL CEvent::GetPause() +{ + return m_bPause; +} + +void CEvent::DemoRecStart() +{ + m_pDemoBuffer = (DemoEvent*)malloc(MAXDEMO*sizeof(DemoEvent)); + if ( m_pDemoBuffer == NULL ) return; + memset(m_pDemoBuffer, 0, MAXDEMO*sizeof(DemoEvent)); + + m_demoTime = 0; + m_demoIndex = 0; + m_bDemoRec = TRUE; + m_bDemoPlay = FALSE; + + InitRandom(); + m_pDecor->SetTime(0); + m_speed = 1; +} + +void CEvent::DemoRecStop() +{ + FILE* file = NULL; + DemoHeader header; + + if ( m_bDemoPlay ) return; + + if ( m_pDemoBuffer != NULL ) + { + DeleteFile("data\\demo.3d.blp"); + file = fopen("data\\demo.3d.blp", "wb"); + if ( file != NULL ) + { + memset(&header, 0, sizeof(DemoHeader)); + header.majRev = 1; + header.minRev = 0; + header.bSchool = m_bSchool; + header.bPrivate = m_bPrivate; + fwrite(&header, sizeof(DemoHeader), 1, file); + fwrite(m_pDemoBufferm sizeof(DemoEvent), m_demoIndex, file); + fclose(file); + } + free(m_pDemoBuffer); + m_pDemoBuffer = NULL; + } + + m_bDemoRec = FALSE; + m_demoTime = 0; +} \ No newline at end of file diff --git a/jauge.cpp b/jauge.cpp index 90b4260..6fe1c68 100644 --- a/jauge.cpp +++ b/jauge.cpp @@ -104,12 +104,17 @@ void CJauge::SetLevel(int level) m_level = level; } -/* +int CJauge::GetLevel() +{ + return m_level; +} + + int CJauge::GetType() { return m_type; } -*/ + void CJauge::SetType(int type) { diff --git a/menu.cpp b/menu.cpp index 2e95ab7..7b5843b 100644 --- a/menu.cpp +++ b/menu.cpp @@ -159,306 +159,10 @@ BOOL CMenu::MouseUp(POINT pos) return FALSE; } -void ChangeSprite(int sprite) +void CMenu::Message() { - HCURSOR hCursor = nullptr; - - if ( g_mouseType == MOUSETYPEGRA ) return; - if ( g_lastSprite == sprite ) return; - - if ( sprite == SPRITE_ARROW ) hCursor = LoadCursor(g_hInstance, "IDC_ARROW"); - if ( sprite == SPRITE_POINTER ) hCursor = LoadCursor(g_hInstance, "IDC_POINTER"); - if ( sprite == SPRITE_MAP ) hCursor = LoadCursor(g_hInstance, "IDC_MAP"); - if ( sprite == SPRITE_ARROWU ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWU"); - if ( sprite == SPRITE_ARROWD ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWD"); - if ( sprite == SPRITE_ARROWL ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWL"); - if ( sprite == SPRITE_ARROWR ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWR"); - if ( sprite == SPRITE_ARROWUL ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWUL"); - if ( sprite == SPRITE_ARROWUR ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWUR"); - if ( sprite == SPRITE_ARROWDL ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWDL"); - if ( sprite == SPRITE_ARROWDR ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWDR"); - if ( sprite == SPRITE_WAIT ) hCursor = LoadCursor(g_hInstance, "IDC_WAIT"); - if ( sprite == SPRITE_EMPTY ) hCursor = LoadCursor(g_hInstance, "IDC_EMPTY"); - if ( sprite == SPRITE_FILL ) hCursor = LoadCursor(g_hInstance, "IDC_FILL"); - SetCursor(hCursor); - - g_lastSprite = sprite; -} - -POINT ConvLongToPos(LPARAM lParam) -{ - POINT pos; - - pos.x = LOWORD(lParam); - pos.y = HIWORD(lParam); - - return pos; -} - -void InitRandom() -{ - srand(1); -} - -int Random(int min, int max) -{ - long n; - - n = rand(); - n = min+(n%(max-min+1)); - - return (int)n; -} - -void GetCurrentDir(char *pName, int lg) -{ - int i; - - strncpy(pName, _pgmptr, lg-1); - pName[lg-1] = 0; - - lg = strlen(pName); - if ( lg == 0 ) return; - - for ( i=0 ; i 0 ) - { - lg --; - if ( pName[lg] == '\\' ) - { - pName[lg+1] = 0; - break; - } - } - - if ( lg > 6 && strcmp(pName+lg-6, "\\debug\\") == 0 ) - { - pName[lg-5] = 0; // ignore le dossier \debug ! - } -} - -// Add proper dir(s) later - -void AddCDPath(char *pFilename) -{ - char temp[MAX_PATH]; - int lg; - BOOL bDaniel = FALSE; - - if ( g_CDPath[0] == 0 ) return; - - lg = strlen(g_CDPath); - if ( lg > 14 && strstr(g_CDPath+lg-14, "\\daniel\\blupi\\") ) - { - bDaniel = TRUE; - } - -#if _DEMO - strcpy(temp, g_CDPath); - strcat(temp, pFilename); -#else - if ( !bDaniel && - (strstr(pFilename, "image\\") == pFilename || - strstr(pFilename, "movie\\") == pFilename) ) - { - strcpy(temp, g_CDPath); - strcat(temp, "..\\"); - strcat(temp, pFilename); - } - else - { - strcpy(temp, g_CDPath); - strcat(temp, pFilename); - } -#endif - - strcpy(pFilename, temp); -} - -void AddUserPath(char *pFilename) -{ - char temp[MAX_PATH]; - char* pText; - int pos; - char last; - SECURITY_ATTRIBUTES att; - - if ( g_CDPath[0] != 0 ) return; - -#if _EGAMES - strcpy(temp, "c:\\Speedy Eggbert 2\\"); -#else - strcpy(temp, "c:\\Speedy Blupi 2\\"); -#endif - - att.nLength = sizeof(SECURITY_ATTRIBUTES); - att.lpSecurityDescriptor = NULL; - att.bInheritHandle = FALSE; - CreateDirectory(temp, &att); - - pText = strstr(pFilename, "\\"); - if ( pText != NULL ) - { - pos = strlen(temp)+(pText-pFilename)+1; - strcat(temp, pFilename); - last = temp[pos]; - temp[pos] = 0; - CreateDirectory(temp, &att); - temp[pos] = last; - } - else - { - strcat(temp, pFilename); - } - - strcpy(pFilename, temp); -} - -void TraceErrorDD(HRESULT hErr, char *sFile, int nLine) -{ - char dderr[256]; - char err[1024]; - - switch (hErr) + if ( m_selRank != -1 ) { - case DD_OK : sprintf(dderr, "DD_OK"); break; - case DDERR_ALREADYINITIALIZED : sprintf(dderr, "DDERR_ALREADYINITIALIZED"); break; - case DDERR_CANNOTATTACHSURFACE : sprintf(dderr, "DDERR_CANNOTATTACHSURFACE"); break; - case DDERR_CANNOTDETACHSURFACE : sprintf(dderr, "DDERR_CANNOTDETACHSURFACE"); break; - case DDERR_CURRENTLYNOTAVAIL : sprintf(dderr, "DDERR_CURRENTLYNOTAVAIL"); break; - case DDERR_EXCEPTION : sprintf(dderr, "DDERR_EXCEPTION"); break; - case DDERR_GENERIC : sprintf(dderr, "DDERR_GENERIC"); break; - case DDERR_HEIGHTALIGN : sprintf(dderr, "DDERR_HEIGHTALIGN"); break; - case DDERR_INCOMPATIBLEPRIMARY : sprintf(dderr, "DDERR_INCOMPATIBLEPRIMARY"); break; - case DDERR_INVALIDCAPS : sprintf(dderr, "DDERR_INVALIDCAPS"); break; - case DDERR_INVALIDCLIPLIST : sprintf(dderr, "DDERR_INVALIDCLIPLIST"); break; - case DDERR_INVALIDMODE : sprintf(dderr, "DDERR_INVALIDMODE"); break; - case DDERR_INVALIDOBJECT : sprintf(dderr, "DDERR_INVALIDOBJECT"); break; - case DDERR_INVALIDPARAMS : sprintf(dderr, "DDERR_INVALIDPARAMS"); break; - case DDERR_INVALIDPIXELFORMAT : sprintf(dderr, "DDERR_INVALIDPIXELFORMAT"); break; - case DDERR_INVALIDRECT : sprintf(dderr, "DDERR_INVALIDRECT"); break; - case DDERR_LOCKEDSURFACES : sprintf(dderr, "DDERR_LOCKEDSURFACES"); break; - case DDERR_NO3D : sprintf(dderr, "DDERR_NO3D"); break; - case DDERR_NOALPHAHW : sprintf(dderr, "DDERR_NOALPHAHW"); break; - case DDERR_NOCLIPLIST : sprintf(dderr, "DDERR_NOCLIPLIST"); break; - case DDERR_NOCOLORCONVHW : sprintf(dderr, "DDERR_NOCOLORCONVHW"); break; - case DDERR_NOCOOPERATIVELEVELSET : sprintf(dderr, "DDERR_NOCOOPERATIVELEVELSET"); break; - case DDERR_NOCOLORKEY : sprintf(dderr, "DDERR_NOCOLORKEY"); break; - case DDERR_NOCOLORKEYHW : sprintf(dderr, "DDERR_NOCOLORKEYHW"); break; - case DDERR_NODIRECTDRAWSUPPORT : sprintf(dderr, "DDERR_NODIRECTDRAWSUPPORT"); break; - case DDERR_NOEXCLUSIVEMODE : sprintf(dderr, "DDERR_NOEXCLUSIVEMODE"); break; - case DDERR_NOFLIPHW : sprintf(dderr, "DDERR_NOFLIPHW"); break; - case DDERR_NOGDI : sprintf(dderr, "DDERR_NOGDI"); break; - case DDERR_NOMIRRORHW : sprintf(dderr, "DDERR_NOMIRRORHW"); break; - case DDERR_NOTFOUND : sprintf(dderr, "DDERR_NOTFOUND"); break; - case DDERR_NOOVERLAYHW : sprintf(dderr, "DDERR_NOOVERLAYHW"); break; - case DDERR_NORASTEROPHW : sprintf(dderr, "DDERR_NORASTEROPHW"); break; - case DDERR_NOROTATIONHW : sprintf(dderr, "DDERR_NOROTATIONHW"); break; - case DDERR_NOSTRETCHHW : sprintf(dderr, "DDERR_NOSTRETCHHW"); break; - case DDERR_NOT4BITCOLOR : sprintf(dderr, "DDERR_NOT4BITCOLOR"); break; - case DDERR_NOT4BITCOLORINDEX : sprintf(dderr, "DDERR_NOT4BITCOLORINDEX"); break; - case DDERR_NOT8BITCOLOR : sprintf(dderr, "DDERR_NOT8BITCOLOR"); break; - case DDERR_NOTEXTUREHW : sprintf(dderr, "DDERR_NOTEXTUREHW"); break; - case DDERR_NOVSYNCHW : sprintf(dderr, "DDERR_NOVSYNCHW"); break; - case DDERR_NOZBUFFERHW : sprintf(dderr, "DDERR_NOZBUFFERHW"); break; - case DDERR_NOZOVERLAYHW : sprintf(dderr, "DDERR_NOZOVERLAYHW"); break; - case DDERR_OUTOFCAPS : sprintf(dderr, "DDERR_OUTOFCAPS"); break; - case DDERR_OUTOFMEMORY : sprintf(dderr, "DDERR_OUTOFMEMORY"); break; - case DDERR_OUTOFVIDEOMEMORY : sprintf(dderr, "DDERR_OUTOFVIDEOMEMORY"); break; - case DDERR_OVERLAYCANTCLIP : sprintf(dderr, "DDERR_OVERLAYCANTCLIP"); break; - case DDERR_OVERLAYCOLORKEYONLYONEACTIVE : sprintf(dderr, "DDERR_OVERLAYCOLORKEYONLYONEACTIVE"); break; - case DDERR_PALETTEBUSY : sprintf(dderr, "DDERR_PALETTEBUSY"); break; - case DDERR_COLORKEYNOTSET : sprintf(dderr, "DDERR_COLORKEYNOTSET"); break; - case DDERR_SURFACEALREADYATTACHED : sprintf(dderr, "DDERR_SURFACEALREADYATTACHED"); break; - case DDERR_SURFACEALREADYDEPENDENT : sprintf(dderr, "DDERR_SURFACEALREADYDEPENDENT"); break; - case DDERR_SURFACEBUSY : sprintf(dderr, "DDERR_SURFACEBUSY"); break; - case DDERR_CANTLOCKSURFACE : sprintf(dderr, "DDERR_CANTLOCKSURFACE"); break; - case DDERR_SURFACEISOBSCURED : sprintf(dderr, "DDERR_SURFACEISOBSCURED"); break; - case DDERR_SURFACELOST : sprintf(dderr, "DDERR_SURFACELOST"); break; - case DDERR_SURFACENOTATTACHED : sprintf(dderr, "DDERR_SURFACENOTATTACHED"); break; - case DDERR_TOOBIGHEIGHT : sprintf(dderr, "DDERR_TOOBIGHEIGHT"); break; - case DDERR_TOOBIGSIZE : sprintf(dderr, "DDERR_TOOBIGSIZE"); break; - case DDERR_TOOBIGWIDTH : sprintf(dderr, "DDERR_TOOBIGWIDTH"); break; - case DDERR_UNSUPPORTED : sprintf(dderr, "DDERR_UNSUPPORTED"); break; - case DDERR_UNSUPPORTEDFORMAT : sprintf(dderr, "DDERR_UNSUPPORTEDFORMAT"); break; - case DDERR_UNSUPPORTEDMASK : sprintf(dderr, "DDERR_UNSUPPORTEDMASK"); break; - case DDERR_VERTICALBLANKINPROGRESS : sprintf(dderr, "DDERR_VERTICALBLANKINPROGRESS"); break; - case DDERR_WASSTILLDRAWING : sprintf(dderr, "DDERR_WASSTILLDRAWING"); break; - case DDERR_XALIGN : sprintf(dderr, "DDERR_XALIGN"); break; - case DDERR_INVALIDDIRECTDRAWGUID : sprintf(dderr, "DDERR_INVALIDDIRECTDRAWGUID"); break; - case DDERR_DIRECTDRAWALREADYCREATED : sprintf(dderr, "DDERR_DIRECTDRAWALREADYCREATED"); break; - case DDERR_NODIRECTDRAWHW : sprintf(dderr, "DDERR_NODIRECTDRAWHW"); break; - case DDERR_PRIMARYSURFACEALREADYEXISTS : sprintf(dderr, "DDERR_PRIMARYSURFACEALREADYEXISTS"); break; - case DDERR_NOEMULATION : sprintf(dderr, "DDERR_NOEMULATION"); break; - case DDERR_REGIONTOOSMALL : sprintf(dderr, "DDERR_REGIONTOOSMALL"); break; - case DDERR_CLIPPERISUSINGHWND : sprintf(dderr, "DDERR_CLIPPERISUSINGHWND"); break; - case DDERR_NOCLIPPERATTACHED : sprintf(dderr, "DDERR_NOCLIPPERATTACHED"); break; - case DDERR_NOHWND : sprintf(dderr, "DDERR_NOHWND"); break; - case DDERR_HWNDSUBCLASSED : sprintf(dderr, "DDERR_HWNDSUBCLASSED"); break; - case DDERR_HWNDALREADYSET : sprintf(dderr, "DDERR_HWNDALREADYSET"); break; - case DDERR_NOPALETTEATTACHED : sprintf(dderr, "DDERR_NOPALETTEATTACHED"); break; - case DDERR_NOPALETTEHW : sprintf(dderr, "DDERR_NOPALETTEHW"); break; - case DDERR_BLTFASTCANTCLIP : sprintf(dderr, "DDERR_BLTFASTCANTCLIP"); break; - case DDERR_NOBLTHW : sprintf(dderr, "DDERR_NOBLTHW"); break; - case DDERR_NODDROPSHW : sprintf(dderr, "DDERR_NODDROPSHW"); break; - case DDERR_OVERLAYNOTVISIBLE : sprintf(dderr, "DDERR_OVERLAYNOTVISIBLE"); break; - case DDERR_NOOVERLAYDEST : sprintf(dderr, "DDERR_NOOVERLAYDEST"); break; - case DDERR_INVALIDPOSITION : sprintf(dderr, "DDERR_INVALIDPOSITION"); break; - case DDERR_NOTAOVERLAYSURFACE : sprintf(dderr, "DDERR_NOTAOVERLAYSURFACE"); break; - case DDERR_EXCLUSIVEMODEALREADYSET : sprintf(dderr, "DDERR_EXCLUSIVEMODEALREADYSET"); break; - case DDERR_NOTFLIPPABLE : sprintf(dderr, "DDERR_NOTFLIPPABLE"); break; - case DDERR_CANTDUPLICATE : sprintf(dderr, "DDERR_CANTDUPLICATE"); break; - case DDERR_NOTLOCKED : sprintf(dderr, "DDERR_NOTLOCKED"); break; - case DDERR_CANTCREATEDC : sprintf(dderr, "DDERR_CANTCREATEDC"); break; - case DDERR_NODC : sprintf(dderr, "DDERR_NODC"); break; - case DDERR_WRONGMODE : sprintf(dderr, "DDERR_WRONGMODE"); break; - case DDERR_IMPLICITLYCREATED : sprintf(dderr, "DDERR_IMPLICITLYCREATED"); break; - case DDERR_NOTPALETTIZED : sprintf(dderr, "DDERR_NOTPALETTIZED"); break; - case DDERR_UNSUPPORTEDMODE : sprintf(dderr, "DDERR_UNSUPPORTEDMODE"); break; - case DDERR_NOMIPMAPHW : sprintf(dderr, "DDERR_NOMIPMAPHW"); break; - case DDERR_INVALIDSURFACETYPE : sprintf(dderr, "DDERR_INVALIDSURFACETYPE"); break; - case DDERR_DCALREADYCREATED : sprintf(dderr, "DDERR_DCALREADYCREATED"); break; - case DDERR_CANTPAGELOCK : sprintf(dderr, "DDERR_CANTPAGELOCK"); break; - case DDERR_CANTPAGEUNLOCK : sprintf(dderr, "DDERR_CANTPAGEUNLOCK"); break; - case DDERR_NOTPAGELOCKED : sprintf(dderr, "DDERR_NOTPAGELOCKED"); break; - case DDERR_NOTINITIALIZED : sprintf(dderr, "DDERR_NOTINITIALIZED"); break; - - default : sprintf(dderr, "Unknown Error"); break; + PostMessage(m_hWnd, WM_BUTTON0+m_selRank, 0, 0); } - sprintf(err, "DirectDraw Error %s in file %s at line %d\n", dderr, sFile, nLine); - OutputDebug(err); } - -void TraceErrorDS(HRESULT hErr, char *sFile, int nLine) -{ - char dserr[256]; - char err[1024]; - - switch (hErr) - { - case DS_OK : sprintf(dserr, "DD_OK"); break; - case DSERR_ALLOCATED : sprintf(dserr, "DSERR_ALLOCATED"); break; - case DSERR_CONTROLUNAVAIL : sprintf(dserr, "DSERR_CONTROLUNAVAIL"); break; - case DSERR_INVALIDPARAM : sprintf(dserr, "DSERR_INVALIDPARAM"); break; - case DSERR_INVALIDCALL : sprintf(dserr, "DSERR_INVALIDCALL"); break; - case DSERR_GENERIC : sprintf(dserr, "DSERR_GENERIC"); break; - case DSERR_PRIOLEVELNEEDED : sprintf(dserr, "DSERR_PRIOLEVELNEEDED"); break; - case DSERR_OUTOFMEMORY : sprintf(dserr, "DSERR_OUTOFMEMORY"); break; - case DSERR_BADFORMAT : sprintf(dserr, "DSERR_BADFORMAT"); break; - case DSERR_UNSUPPORTED : sprintf(dserr, "DSERR_UNSUPPORTED"); break; - case DSERR_NODRIVER : sprintf(dserr, "DSERR_NODRIVER"); break; - case DSERR_ALREADYINITIALIZED : sprintf(dserr, "DSERR_ALREADYINITIALIZED"); break; - case DSERR_NOAGGREGATION : sprintf(dserr, "DSERR_NOAGGREGATION"); break; - case DSERR_BUFFERLOST : sprintf(dserr, "DSERR_BUFFERLOST"); break; - case DSERR_OTHERAPPHASPRIO : sprintf(dserr, "DSERR_OTHERAPPHASPRIO"); break; - case DSERR_UNINITIALIZED : sprintf(dserr, "DSERR_UNINITIALIZED"); break; - - default : sprintf(dserr, "Unknown Error"); break; - } - sprintf(err, "DirectSound Error %s in file %s at line %d\n", dserr, sFile, nLine); - OutputDebug(err); -} \ No newline at end of file diff --git a/misc.cpp b/misc.cpp index c939f23..b32b0fc 100644 --- a/misc.cpp +++ b/misc.cpp @@ -36,3 +36,122 @@ void LoadString(UINT nID, char *pBuffer, int lgBuffer) LoadString(g_hInstance, nID, pBuffer, lgBuffer); } +void ChangeSprite(int sprite) +{ + HCURSOR hCursor = nullptr; + + if ( g_mouseType == MOUSETYPEGRA ) return; + if ( g_lastSprite == sprite ) return; + + if ( sprite == SPRITE_ARROW ) hCursor = LoadCursor(g_hInstance, "IDC_ARROW"); + if ( sprite == SPRITE_POINTER ) hCursor = LoadCursor(g_hInstance, "IDC_POINTER"); + if ( sprite == SPRITE_MAP ) hCursor = LoadCursor(g_hInstance, "IDC_MAP"); + if ( sprite == SPRITE_ARROWU ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWU"); + if ( sprite == SPRITE_ARROWD ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWD"); + if ( sprite == SPRITE_ARROWL ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWL"); + if ( sprite == SPRITE_ARROWR ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWR"); + if ( sprite == SPRITE_ARROWUL ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWUL"); + if ( sprite == SPRITE_ARROWUR ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWUR"); + if ( sprite == SPRITE_ARROWDL ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWDL"); + if ( sprite == SPRITE_ARROWDR ) hCursor = LoadCursor(g_hInstance, "IDC_ARROWDR"); + if ( sprite == SPRITE_WAIT ) hCursor = LoadCursor(g_hInstance, "IDC_WAIT"); + if ( sprite == SPRITE_EMPTY ) hCursor = LoadCursor(g_hInstance, "IDC_EMPTY"); + if ( sprite == SPRITE_FILL ) hCursor = LoadCursor(g_hInstance, "IDC_FILL"); + SetCursor(hCursor); + + g_lastSprite = sprite; +} + +POINT ConvLongToPos(LPARAM lParam) +{ + POINT pos; + + pos.x = LOWORD(lParam); + pos.y = HIWORD(lParam); + + return; +} + +void InitRandom() +{ + srand(1); +} + +int Random(int min, int max) +{ + long n; + + n = rand(); + n = min+(n%(max-min+1)); + + return (int)n; +} + +void GetCurrentDir(char *pName, int lg) +{ + int i; + + strncpy(pName, _pgmptr, lg-1); + pName[lg-1] = 0; + + lg = strlen(pName); + if ( lg == 0 ) return; + + for ( i=0 ; i 0 ) + { + lg --; + if ( pName[lg] == '\\' ) + { + pName[lg+1] = 0; + break; + } + } + + if ( lg > 6 && strcmp(pName+lg-6, "\\debug\\") == 0 ) + { + pName[lg-5] = 0; // ignore le dossier \debug ! + } +} + +void AddCDPath(char *pFilename) +{ + char temp[MAX_PATH]; + int lg; + BOOL bDaniel = FALSE; + + if ( g_CDPath[0] == 0 ) return; + + lg = strlen(g_CDPath); + if ( lg > 14 && strstr(g_CDPath+lg-14, "\\daniel\\blupi\\") ) + { + bDaniel = TRUE; + } + +#if _DEMO + strcpy(temp, g_CDPath); + strcat(temp, pFilename); +#else + if ( !bDaniel && + (strstr(pFilename, "image08\\") == pFilename || + strstr(pFilename, "data\\") == pFilename || + strstr(pFilename, "image16\\") == pFilename || + strstr(pFileName, "sound\\")) ) + { + strcpy(temp, g_CDPath); + strcat(temp, "..\\"); + strcat(temp, pFilename); + } + else + { + strcpy(temp, g_CDPath); + strcat(temp, pFilename); + } +#endif + + strcpy(pFilename, temp); +} \ No newline at end of file