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

More progress done

This commit is contained in:
HMVocaloid 2024-05-19 17:10:33 -04:00
parent 4c9a91f51d
commit 9934543901
5 changed files with 766 additions and 0 deletions

123
event.cpp
View File

@ -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);
}

138
jauge.cpp Normal file
View File

@ -0,0 +1,138 @@
// Jauge.cpp
//
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <ddraw.h>
#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<63> ?
{
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<6F>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;
}

464
menu.cpp Normal file
View File

@ -0,0 +1,464 @@
// Menu.cpp
//
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <ddraw.h>
#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<EFBFBD>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<6E>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<lg ; i++ )
{
pName[i] = tolower(pName[i]);
}
while ( lg > 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);
}

38
misc.cpp Normal file
View File

@ -0,0 +1,38 @@
// Misc.cpp
//
#include <dsound.h>
#include <ddraw.h>
#include <stdio.h>
#include <stdlib.h>
#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);
}

View File

@ -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;