Initial commit: ROW Client source code

Game client codebase including:
- CharacterActionControl: Character and creature management
- GlobalScript: Network, items, skills, quests, utilities
- RYLClient: Main client application with GUI and event handlers
- Engine: 3D rendering engine (RYLGL)
- MemoryManager: Custom memory allocation
- Library: Third-party dependencies (DirectX, boost, etc.)
- Tools: Development utilities

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-29 16:24:34 +09:00
commit e067522598
5135 changed files with 1745744 additions and 0 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

View File

@@ -0,0 +1,221 @@
//-----------------------------------------------------------------------------
// File: DDutil.cpp
//
// Desc: Routines for loading bitmap and palettes from resources
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#undef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#include <ddraw.h>
#include "ddutil.h"
//-----------------------------------------------------------------------------
// Name: DDUtil_CopyBitmap()
// Desc: Draw a bitmap into a DirectDrawSurface
//-----------------------------------------------------------------------------
HRESULT DDUtil_CopyBitmap( LPDIRECTDRAWSURFACE pdds, HBITMAP hbm, int x, int y,
int dx, int dy )
{
HDC hdcImage;
HDC hdc;
BITMAP bm;
DDSURFACEDESC ddsd;
HRESULT hr;
if( hbm == NULL || pdds == NULL )
return E_FAIL;
// Make sure this surface is restored.
pdds->Restore();
// Select bitmap into a memoryDC so we can use it.
hdcImage = CreateCompatibleDC(NULL);
if( !hdcImage )
{
OutputDebugString( TEXT("CreateCompatibleDC() failed\n") );
return E_FAIL;
}
SelectObject( hdcImage, hbm );
// Get size of the bitmap
GetObject( hbm, sizeof(bm), &bm ); // get size of bitmap
dx = dx == 0 ? bm.bmWidth : dx; // use the passed size, unless zero
dy = dy == 0 ? bm.bmHeight : dy;
// Gt size of surface.
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH;
pdds->GetSurfaceDesc(&ddsd);
if( SUCCEEDED( hr = pdds->GetDC(&hdc) ) )
{
StretchBlt( hdc, 0, 0, ddsd.dwWidth, ddsd.dwHeight, hdcImage,
x, y, dx, dy, SRCCOPY);
pdds->ReleaseDC( hdc );
}
DeleteDC( hdcImage );
return hr;
}
//-----------------------------------------------------------------------------
// Name: DDUtil_LoadPalette()
// Desc: Create a DirectDraw palette object from a bitmap resoure
// If the resource does not exist or NULL is passed create a
// default 332 palette.
//-----------------------------------------------------------------------------
LPDIRECTDRAWPALETTE DDUtil_LoadPalette( LPDIRECTDRAW pDD, TCHAR* strBitmap )
{
LPDIRECTDRAWPALETTE pddPalette;
int i;
int n;
HANDLE fh;
HRSRC h;
LPBITMAPINFOHEADER lpbi;
PALETTEENTRY ape[256];
RGBQUAD* prgb;
DWORD dwRead;
// Build a 332 palette as the default.
for( i=0; i<256; i++ )
{
ape[i].peRed = (BYTE)(((i >> 5) & 0x07) * 255 / 7);
ape[i].peGreen = (BYTE)(((i >> 2) & 0x07) * 255 / 7);
ape[i].peBlue = (BYTE)(((i >> 0) & 0x03) * 255 / 3);
ape[i].peFlags = (BYTE)0;
}
// Gt a pointer to the bitmap resource.
if( strBitmap && ( h = FindResource( NULL, strBitmap, RT_BITMAP ) ) )
{
lpbi = (LPBITMAPINFOHEADER)LockResource( LoadResource( NULL, h ) );
if( NULL == lpbi )
OutputDebugString(TEXT("lock resource failed\n"));
prgb = (RGBQUAD*)((BYTE*)lpbi + lpbi->biSize);
if (lpbi == NULL || lpbi->biSize < sizeof(BITMAPINFOHEADER))
n = 0;
else if (lpbi->biBitCount > 8)
n = 0;
else if (lpbi->biClrUsed == 0)
n = 1 << lpbi->biBitCount;
else
n = lpbi->biClrUsed;
// A DIB color table has its colors stored BGR not RGB, so flip them
for(i=0; i<n; i++ )
{
ape[i].peRed = prgb[i].rgbRed;
ape[i].peGreen = prgb[i].rgbGreen;
ape[i].peBlue = prgb[i].rgbBlue;
ape[i].peFlags = 0;
}
}
else if( strBitmap && ( fh = CreateFile( strBitmap, GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL ) ) != INVALID_HANDLE_VALUE )
{
BITMAPFILEHEADER bf;
BITMAPINFOHEADER bi;
ReadFile( fh, &bf, sizeof(bf), &dwRead, NULL );
ReadFile( fh, &bi, sizeof(bi), &dwRead, NULL );
ReadFile( fh, ape, sizeof(ape), &dwRead, NULL );
CloseHandle( fh );
if( bi.biSize != sizeof(BITMAPINFOHEADER) )
n = 0;
else if( bi.biBitCount > 8 )
n = 0;
else if( bi.biClrUsed == 0 )
n = 1 << bi.biBitCount;
else
n = bi.biClrUsed;
// A DIB color table has its colors stored BGR not RGB so flip them
for(i=0; i<n; i++ )
{
BYTE r = ape[i].peRed;
ape[i].peRed = ape[i].peBlue;
ape[i].peBlue = r;
}
}
pDD->CreatePalette( DDPCAPS_8BIT, ape, &pddPalette, NULL );
return pddPalette;
}
//-----------------------------------------------------------------------------
// Name: DDUtil_ColorMatch()
// Desc: Convert a RGB color to a pysical color. We do this by leting GDI
// SetPixel() do the color matching.
//-----------------------------------------------------------------------------
DWORD DDUtil_ColorMatch( LPDIRECTDRAWSURFACE pdds, COLORREF rgb )
{
DDSURFACEDESC ddsd;
COLORREF rgbT;
HDC hdc;
DWORD dw = CLR_INVALID;
HRESULT hr;
// Wse GDI SetPixel to color match for us
if( rgb != CLR_INVALID && SUCCEEDED( pdds->GetDC(&hdc) ) )
{
rgbT = GetPixel( hdc, 0, 0 ); // Save current pixel value
SetPixel( hdc, 0, 0, rgb ); // Set our value
pdds->ReleaseDC( hdc );
}
// Now lock the surface so we can read back the converted color
ddsd.dwSize = sizeof(ddsd);
while( ( hr = pdds->Lock( NULL, &ddsd, 0, NULL ) ) == DDERR_WASSTILLDRAWING )
{}
if( SUCCEEDED(hr) )
{
dw = *(DWORD *)ddsd.lpSurface; // get DWORD
dw &= (1 << ddsd.ddpfPixelFormat.dwRGBBitCount)-1; // mask it to bpp
pdds->Unlock(NULL);
}
// Now put the color that was there back.
if( rgb != CLR_INVALID && SUCCEEDED( pdds->GetDC(&hdc) ) )
{
SetPixel( hdc, 0, 0, rgbT );
pdds->ReleaseDC( hdc );
}
return dw;
}
//-----------------------------------------------------------------------------
// Name: DDUtil_SetColorKey()
// Desc: Set a color key for a surface, given a RGB. If you pass CLR_INVALID as
// the color key, the pixel in the upper-left corner will be used.
//-----------------------------------------------------------------------------
HRESULT DDUtil_SetColorKey( LPDIRECTDRAWSURFACE pdds, COLORREF rgb )
{
DDCOLORKEY ddck;
ddck.dwColorSpaceLowValue = DDUtil_ColorMatch( pdds, rgb );
ddck.dwColorSpaceHighValue = ddck.dwColorSpaceLowValue;
return pdds->SetColorKey( DDCKEY_SRCBLT, &ddck );
}

View File

@@ -0,0 +1,18 @@
//-----------------------------------------------------------------------------
// File: DDutil.h
//
// Desc: Routines for loading bitmap and palettes from resources
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#include <tchar.h>
LPDIRECTDRAWPALETTE DDUtil_LoadPalette( LPDIRECTDRAW pDD, TCHAR* strBitmap );
HRESULT DDUtil_CopyBitmap( LPDIRECTDRAWSURFACE pdds, HBITMAP hbm,
int x, int y, int dx, int dy );
DWORD DDUtil_ColorMatch( LPDIRECTDRAWSURFACE pdds, COLORREF rgb );
HRESULT DDUtil_SetColorKey( LPDIRECTDRAWSURFACE pdds, COLORREF rgb );

View File

@@ -0,0 +1,169 @@
//-----------------------------------------------------------------------------
// File: DIUtil.cpp
//
// Desc: Input routines
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#include "duel.h"
#include "diutil.h"
#include "gameproc.h"
//-----------------------------------------------------------------------------
// Globals
//-----------------------------------------------------------------------------
static LPDIRECTINPUT g_pDI; // DirectInput interface
static LPDIRECTINPUTDEVICE g_pdidKeyboard; // Keyboard device interface
static BOOL g_bKeyboardAcquired; // Whether eyboard is acquired
//-----------------------------------------------------------------------------
// Name: DIUtil_InitInput()
// Desc: Initialize DirectInput objects & devices
//-----------------------------------------------------------------------------
HRESULT DIUtil_InitInput( HWND hWnd )
{
// Create DI object
HINSTANCE hInst;
#ifdef _WIN64
hInst = (HINSTANCE)GetWindowLongPtr( hWnd, GWLP_HINSTANCE );
#else
hInst = (HINSTANCE)GetWindowLong( hWnd, GWL_HINSTANCE );
#endif
if( FAILED( DirectInputCreate( hInst, DIRECTINPUT_VERSION, &g_pDI, NULL ) ) )
{
ShowError(IDS_DINPUT_ERROR_DIC);
return E_FAIL;
}
// Create keyboard device
if( FAILED( g_pDI->CreateDevice( GUID_SysKeyboard, &g_pdidKeyboard, NULL ) ) )
{
ShowError(IDS_DINPUT_ERROR_CD);
return E_FAIL;
}
// Tell DirectInput that we want to receive data in keyboard format
if( FAILED( g_pdidKeyboard->SetDataFormat( &c_dfDIKeyboard) ) )
{
ShowError(IDS_DINPUT_ERROR_DF);
return E_FAIL;
}
// Set cooperative level
if( FAILED( g_pdidKeyboard->SetCooperativeLevel( hWnd,
DISCL_NONEXCLUSIVE | DISCL_FOREGROUND ) ) )
{
ShowError(IDS_DINPUT_ERROR_SP);
return E_FAIL;
}
// try to acquire the keyboard
if( SUCCEEDED( g_pdidKeyboard->Acquire() ) )
g_bKeyboardAcquired = TRUE;
else
g_bKeyboardAcquired = FALSE;
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: DIUtil_ReadKeys()
// Desc: Use DirectInput to read game-play keys
//-----------------------------------------------------------------------------
VOID DIUtil_ReadKeys( DWORD* pdwKeys )
{
BYTE rgbKeybd[256];
DWORD dwKeys = 0L;
HRESULT hr;
hr = g_pdidKeyboard->GetDeviceState( sizeof(rgbKeybd), rgbKeybd );
if( FAILED(hr) )
{
if( hr == DIERR_INPUTLOST )
{
// We lost control of the keyboard, reacquire
if( SUCCEEDED( g_pdidKeyboard->Acquire() ) )
g_bKeyboardAcquired = TRUE;
else
g_bKeyboardAcquired = FALSE;
}
// Failed to read the keyboard, just return
return;
}
// check & update key states
if( rgbKeybd[DIK_NUMPAD5] & 0x80 )
dwKeys |= KEY_STOP;
if( (rgbKeybd[DIK_NUMPAD2] & 0x80) || (rgbKeybd[DIK_DOWN] & 0x80) )
dwKeys |= KEY_DOWN;
if( (rgbKeybd[DIK_NUMPAD4] & 0x80) || (rgbKeybd[DIK_LEFT] & 0x80) )
dwKeys |= KEY_LEFT;
if( (rgbKeybd[DIK_NUMPAD6] & 0x80) || (rgbKeybd[DIK_RIGHT] & 0x80) )
dwKeys |= KEY_RIGHT;
if( (rgbKeybd[DIK_NUMPAD8] & 0x80) || (rgbKeybd[DIK_UP] & 0x80) )
dwKeys |= KEY_UP;
if( rgbKeybd[DIK_SPACE] & 0x80 )
dwKeys |= KEY_FIRE;
// Return the keys
(*pdwKeys) = dwKeys;
}
//-----------------------------------------------------------------------------
// Name: DIUtil_CleanupInput()
// Desc: Cleans up DirectInput objects
//-----------------------------------------------------------------------------
VOID DIUtil_CleanupInput()
{
if(g_bKeyboardAcquired)
{
g_pdidKeyboard->Unacquire();
g_bKeyboardAcquired = FALSE;
}
if( g_pdidKeyboard )
g_pdidKeyboard->Release();
if( g_pDI )
g_pDI->Release();
}
//-----------------------------------------------------------------------------
// Name: DIUtil_ReacquireInputDevices()
// Desc: Reacquires DirectInput devices as needed
//-----------------------------------------------------------------------------
HRESULT DIUtil_ReacquireInputDevices()
{
g_bKeyboardAcquired = FALSE;
if( NULL == g_pdidKeyboard )
return E_FAIL;
g_pdidKeyboard->Acquire();
g_bKeyboardAcquired = TRUE;
return S_OK;
}

View File

@@ -0,0 +1,24 @@
//-----------------------------------------------------------------------------
// File: DIUtil.h
//
// Desc: Input routines
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#ifndef DIUTIL_H
#define DIUTIL_H
#define DIRECTINPUT_VERSION 0x700
#include <dinput.h>
HRESULT DIUtil_InitInput( HWND hWnd );
VOID DIUtil_ReadKeys( DWORD* pdwKey );
VOID DIUtil_CleanupInput();
HRESULT DIUtil_ReacquireInputDevices();
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,425 @@
//-----------------------------------------------------------------------------
// File: DPUtil.cpp
//
// Desc: Communication routines
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#include "duel.h"
#include "DPUtil.h"
#include "lobby.h"
//-----------------------------------------------------------------------------
// Globals
//-----------------------------------------------------------------------------
extern GUID g_AppGUID; // Duel's guid
extern DPLCONNECTION* g_pDPLConnection; // Connection settings
extern BOOL g_bUseProtocol; // DirectPlay Protocol messaging
extern BOOL g_bAsyncSupported; // Asynchronous sends supported
DPSESSIONDESC2* g_pdpsd; // Durrent session description
LPDIRECTPLAY4 g_pDP = NULL; // DPlay object pointer
//-----------------------------------------------------------------------------
// Name: CheckCaps()
// Desc: Helper function to check for certain Capabilities
//-----------------------------------------------------------------------------
VOID CheckCaps()
{
HRESULT hr;
DPCAPS dpcaps;
ZeroMemory( &dpcaps, sizeof(DPCAPS) );
dpcaps.dwSize = sizeof(DPCAPS);
if( NULL == g_pDP )
return;
// The caps we are checking do not differ for guaranteed msg
hr = g_pDP->GetCaps( &dpcaps, 0 );
if( FAILED(hr) )
return;
// Determine if Aync messages are supported.
g_bAsyncSupported = (dpcaps.dwFlags & DPCAPS_ASYNCSUPPORTED) != 0;
// Diagnostic traces of caps supported
if( g_bAsyncSupported )
{
TRACE(_T("Capabilities supported: Async %s %s %s\n"),
(dpcaps.dwFlags & DPCAPS_SENDPRIORITYSUPPORTED ? _T("SendPriority") : _T("")),
(dpcaps.dwFlags & DPCAPS_SENDTIMEOUTSUPPORTED ? _T("SendTimeout") : _T("")),
(dpcaps.dwFlags & DPCAPS_ASYNCCANCELSUPPORTED
? _T("AsyncCancel")
: (dpcaps.dwFlags & DPCAPS_ASYNCCANCELALLSUPPORTED
? _T("AsyncCancelAll") : _T("")))
);
}
else
TRACE(_T("CheckCaps - Async not supported\n"));
}
//-----------------------------------------------------------------------------
// Name: DPUtil_FreeDirectPlay()
// Desc: Wrapper for DirectPlay Close API
//-----------------------------------------------------------------------------
HRESULT DPUtil_FreeDirectPlay()
{
if( NULL == g_pDP )
return E_FAIL;
return g_pDP->Close();
}
//-----------------------------------------------------------------------------
// Name: DPUtil_InitDirectPlay()
// Desc: Wrapper for DirectPlay Create API. Retrieves a DirectPlay4/4A
// interface based on the UNICODE flag
//-----------------------------------------------------------------------------
HRESULT DPUtil_InitDirectPlay( VOID* pCon )
{
HRESULT hr;
// Create a DirectPlay4(A) interface
#ifdef UNICODE
hr = CoCreateInstance( CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER,
IID_IDirectPlay4, (VOID**)&g_pDP );
#else
hr = CoCreateInstance( CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER,
IID_IDirectPlay4A, (VOID**)&g_pDP );
#endif
if( FAILED(hr) )
return hr;
// Initialize w/address
if( pCon )
{
hr = g_pDP->InitializeConnection( pCon, 0 );
if( FAILED(hr) )
{
g_pDP->Release();
g_pDP = NULL;
return hr;
}
}
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: DPUtil_CreatePlayer()
// Desc: Wrapper for DirectPlay CreatePlayer API.
//-----------------------------------------------------------------------------
HRESULT DPUtil_CreatePlayer( DPID* ppidID, TCHAR* strPlayerName, HANDLE hEvent,
VOID* pData, DWORD dwDataSize )
{
if( NULL == g_pDP )
return E_FAIL;
DPNAME dpname;
ZeroMemory( &dpname, sizeof(DPNAME) );
dpname.dwSize = sizeof(DPNAME);
#ifdef UNICODE
dpname.lpszShortName = strPlayerName;
#else
dpname.lpszShortNameA = strPlayerName;
#endif
return g_pDP->CreatePlayer( ppidID, &dpname, hEvent, pData, dwDataSize, 0 );
}
//-----------------------------------------------------------------------------
// Name: DPUtil_CreateSession()
// Desc: Wrapper for DirectPlay CreateSession API.Uses the global application
// guid.
//-----------------------------------------------------------------------------
HRESULT DPUtil_CreateSession( TCHAR* strSessionName )
{
if( NULL == g_pDP )
return DPERR_NOINTERFACE;
DPSESSIONDESC2 dpDesc;
ZeroMemory( &dpDesc, sizeof(dpDesc) );
dpDesc.dwSize = sizeof(dpDesc);
dpDesc.dwFlags = DPSESSION_MIGRATEHOST | DPSESSION_KEEPALIVE;
if( g_bUseProtocol )
dpDesc.dwFlags |= DPSESSION_DIRECTPLAYPROTOCOL;
#ifdef UNICODE
dpDesc.lpszSessionName = strSessionName;
#else
dpDesc.lpszSessionNameA = strSessionName;
#endif
// Set the application guid
dpDesc.guidApplication = g_AppGUID;
HRESULT hr = g_pDP->Open( &dpDesc, DPOPEN_CREATE );
// Check for Async message support
if( SUCCEEDED(hr) )
CheckCaps();
return hr;
}
//-----------------------------------------------------------------------------
// Name: DPUtil_DestroyPlayer()
// Desc: Wrapper for DirectPlay DestroyPlayer API.
//-----------------------------------------------------------------------------
HRESULT DPUtil_DestroyPlayer( DPID pid )
{
if( NULL == g_pDP )
return E_FAIL;
return g_pDP->DestroyPlayer( pid );
}
//-----------------------------------------------------------------------------
// Name: DPUtil_EnumPlayers()
// Desc: Wrapper for DirectPlay API EnumPlayers
//-----------------------------------------------------------------------------
HRESULT DPUtil_EnumPlayers( GUID* pSessionGuid,
LPDPENUMPLAYERSCALLBACK2 pEnumCallback,
VOID* pContext, DWORD dwFlags )
{
if( NULL == g_pDP )
return E_FAIL;
return g_pDP->EnumPlayers( pSessionGuid, pEnumCallback, pContext, dwFlags );
}
//-----------------------------------------------------------------------------
// Name: DPUtil_EnumSessions()
// Desc: Wrapper for DirectPlay EnumSessions API.
//-----------------------------------------------------------------------------
HRESULT DPUtil_EnumSessions( DWORD dwTimeout,
LPDPENUMSESSIONSCALLBACK2 pEnumCallback,
VOID* pContext, DWORD dwFlags )
{
if( NULL == g_pDP )
return E_FAIL;
DPSESSIONDESC2 dpDesc;
ZeroMemory( &dpDesc, sizeof(dpDesc) );
dpDesc.dwSize = sizeof(dpDesc);
dpDesc.guidApplication = g_AppGUID;
return g_pDP->EnumSessions( &dpDesc, dwTimeout, pEnumCallback,
pContext, dwFlags );
}
//-----------------------------------------------------------------------------
// Name: DPUtil_GetPlayerLocalData()
// Desc: Wrapper for DirectPlay GetPlayerData API.
//-----------------------------------------------------------------------------
HRESULT DPUtil_GetPlayerLocalData( DPID pid, VOID* pData, DWORD* pdwDataSize )
{
if( NULL == g_pDP )
return E_FAIL;
HRESULT hr = g_pDP->GetPlayerData( pid, pData, pdwDataSize, DPGET_LOCAL );
if( FAILED(hr) )
TRACE( TEXT("Get Player local data failed for id %d\n"), pid );
return hr;
}
//-----------------------------------------------------------------------------
// Name: DPUtil_GetSessionDesc()
// Desc: Wrapper for DirectPlay GetSessionDesc API.
//-----------------------------------------------------------------------------
HRESULT DPUtil_GetSessionDesc()
{
DWORD dwSize;
HRESULT hr;
// Free old session desc, if any
if( g_pdpsd )
free( g_pdpsd );
g_pdpsd = NULL;
if( NULL == g_pDP )
return E_FAIL;
// First get the size for the session desc
hr = g_pDP->GetSessionDesc( NULL, &dwSize );
if( DPERR_BUFFERTOOSMALL == hr )
{
// Allocate memory for it
g_pdpsd = (DPSESSIONDESC2*)malloc( dwSize );
if( NULL == g_pdpsd )
return E_OUTOFMEMORY;
// Now get the session desc
hr = g_pDP->GetSessionDesc( g_pdpsd, &dwSize );
}
return hr;
}
//-----------------------------------------------------------------------------
// Name: DPUtil_IsDPlayInitialized()
// Desc: Returns TRUE if a DirectPlay interface exists, otherwise FALSE.
//-----------------------------------------------------------------------------
BOOL DPUtil_IsDPlayInitialized()
{
return( g_pDP ? TRUE : FALSE );
}
//-----------------------------------------------------------------------------
// Name: DPUtil_OpenSession()
// Desc: Wrapper for DirectPlay OpenSession API.
//-----------------------------------------------------------------------------
HRESULT DPUtil_OpenSession( GUID* pSessionGUID )
{
if( NULL == g_pDP)
return DPERR_NOINTERFACE;
DPSESSIONDESC2 dpDesc;
ZeroMemory( &dpDesc, sizeof(dpDesc) );
dpDesc.dwSize = sizeof(dpDesc);
if( g_bUseProtocol )
dpDesc.dwFlags = DPSESSION_DIRECTPLAYPROTOCOL;
// Set the session guid
if( pSessionGUID )
dpDesc.guidInstance = (*pSessionGUID);
// Set the application guid
dpDesc.guidApplication = g_AppGUID;
// Open it
HRESULT hr = g_pDP->Open( &dpDesc, DPOPEN_JOIN );
// Check for Async message support
if( SUCCEEDED(hr) )
CheckCaps();
return hr;
}
//-----------------------------------------------------------------------------
// Name: DPUtil_Receive()
// Desc: Wrapper for DirectPlay Receive API
//-----------------------------------------------------------------------------
HRESULT DPUtil_Receive( DPID* pidFrom, DPID* pidTo, DWORD dwFlags, VOID* pData,
DWORD* pdwDataSize )
{
if( NULL == g_pDP )
return E_FAIL;
return g_pDP->Receive( pidFrom, pidTo, dwFlags, pData, pdwDataSize );
}
//-----------------------------------------------------------------------------
// Name: DPUtil_Release()
// Desc: Wrapper for DirectPlay Release API.
//-----------------------------------------------------------------------------
HRESULT DPUtil_Release()
{
if( NULL == g_pDP )
return E_FAIL;
// Free session desc, if any
if( g_pdpsd )
free( g_pdpsd );
g_pdpsd = NULL;
// Free connection settings structure, if any (lobby stuff)
if( g_pDPLConnection )
delete[] g_pDPLConnection;
g_pDPLConnection = NULL;
// Release dplay
HRESULT hr = g_pDP->Release();
g_pDP = NULL;
return hr;
}
//-----------------------------------------------------------------------------
// Name: DPUtil_Send()
// Desc: Wrapper for DirectPlay Send[Ex] API.
//-----------------------------------------------------------------------------
HRESULT DPUtil_Send( DPID idFrom, DPID idTo, DWORD dwFlags, VOID* pData,
DWORD dwDataSize )
{
if( NULL == g_pDP )
return DPERR_NOINTERFACE;
if (dwFlags & DPSEND_ASYNC)
// We don't specify a priority or timeout. Would have to check
// GetCaps() first to see if they were supported
return g_pDP->SendEx( idFrom, idTo, dwFlags, pData, dwDataSize,
0, 0, NULL, NULL );
else
return g_pDP->Send( idFrom, idTo, dwFlags, pData, dwDataSize );
}
//-----------------------------------------------------------------------------
// Name: DPUtil_SetPlayerLocalData()
// Desc: Wrapper for DirectPlay SetPlayerData API
//-----------------------------------------------------------------------------
HRESULT DPUtil_SetPlayerLocalData( DPID pid, VOID* pData, DWORD dwSize )
{
if( NULL == g_pDP )
return E_FAIL;
HRESULT hr = g_pDP->SetPlayerData( pid, pData, dwSize, DPSET_LOCAL );
if( FAILED(hr) )
TRACE( TEXT("Set Player local data failed for id %d\n"), pid );
return hr;
}

View File

@@ -0,0 +1,41 @@
//-----------------------------------------------------------------------------
// File: DPUtil.h
//
// Desc: Communication routines include file
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#define IDIRECTPLAY2_OR_GREATER
#include <dplay.h>
//-----------------------------------------------------------------------------
// Prototypes
//-----------------------------------------------------------------------------
HRESULT DPUtil_FreeDirectPlay();
HRESULT DPUtil_InitDirectPlay( VOID* pCon );
HRESULT DPUtil_CreatePlayer( DPID* ppidID, LPTSTR pPlayerName, HANDLE hEvent,
VOID* pData, DWORD dwDataSize );
HRESULT DPUtil_CreateSession( TCHAR* strSessionName );
HRESULT DPUtil_DestroyPlayer( DPID pid );
HRESULT DPUtil_EnumPlayers( GUID* pSessionGuid,
LPDPENUMPLAYERSCALLBACK2 lpEnumCallback,
VOID* pContext, DWORD dwFlags );
HRESULT DPUtil_EnumSessions( DWORD dwTimeout,
LPDPENUMSESSIONSCALLBACK2 lpEnumCallback,
VOID* pContext, DWORD dwFlags );
HRESULT DPUtil_GetSessionDesc();
BOOL DPUtil_IsDPlayInitialized();
HRESULT DPUtil_OpenSession( GUID* pSessionGuid );
HRESULT DPUtil_Receive( DPID* pidFrom, DPID* pidTo, DWORD dwFlags, VOID* pData,
DWORD* pdwDataSize );
HRESULT DPUtil_Release();
HRESULT DPUtil_Send( DPID idFrom, DPID idTo, DWORD dwFlags, VOID* pData,
DWORD dwDataSize );
HRESULT DPUtil_SetPlayerLocalData( DPID pid, VOID* pData, DWORD dwSize );
HRESULT DPUtil_GetPlayerLocalData( DPID pid, VOID* pData, DWORD* pdwDataSize );

View File

@@ -0,0 +1,465 @@
//-----------------------------------------------------------------------------
// File: dsutil.cpp
//
// Desc: Routines for dealing with sounds from resources
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#include <windows.h>
#include <mmsystem.h>
#include <dsound.h>
#include "dsutil.h"
//-----------------------------------------------------------------------------
// Globals
//-----------------------------------------------------------------------------
LPDIRECTSOUND g_pDS = NULL;
//-----------------------------------------------------------------------------
// Name: DSUtil_LoadSoundBuffer()
// Desc:
//-----------------------------------------------------------------------------
LPDIRECTSOUNDBUFFER DSUtil_LoadSoundBuffer( LPDIRECTSOUND pDS, LPCTSTR strName )
{
LPDIRECTSOUNDBUFFER pDSB = NULL;
DSBUFFERDESC dsbd;
BYTE* pbWaveData;
ZeroMemory( &dsbd, sizeof(dsbd) );
dsbd.dwSize = sizeof(dsbd);
dsbd.dwFlags = DSBCAPS_STATIC|DSBCAPS_CTRLPAN|DSBCAPS_CTRLVOLUME|
DSBCAPS_CTRLFREQUENCY|DSBCAPS_CTRLPOSITIONNOTIFY;
if( SUCCEEDED( DSUtil_GetWaveResource( NULL, strName, &dsbd.lpwfxFormat,
&pbWaveData, &dsbd.dwBufferBytes ) ) )
{
if( SUCCEEDED( pDS->CreateSoundBuffer( &dsbd, &pDSB, NULL ) ) )
{
if( FAILED( DSUtil_FillSoundBuffer( pDSB, pbWaveData,
dsbd.dwBufferBytes ) ) )
{
pDSB->Release();
pDSB = NULL;
}
}
else
{
pDSB = NULL;
}
}
return pDSB;
}
//-----------------------------------------------------------------------------
// Name: DSUtil_ReloadSoundBuffer()
// Desc:
//-----------------------------------------------------------------------------
HRESULT DSUtil_ReloadSoundBuffer( LPDIRECTSOUNDBUFFER pDSB, LPCTSTR strName )
{
BYTE* pbWaveData;
DWORD cbWaveSize;
if( FAILED( DSUtil_GetWaveResource( NULL, strName, NULL, &pbWaveData,
&cbWaveSize ) ) )
return E_FAIL;
if( FAILED( pDSB->Restore() ) )
return E_FAIL;
if( FAILED( DSUtil_FillSoundBuffer( pDSB, pbWaveData, cbWaveSize ) ) )
return E_FAIL;
return S_OK;
}
//-----------------------------------------------------------------------------
// Name:
// Desc:
//-----------------------------------------------------------------------------
HRESULT DSUtil_GetWaveResource( HMODULE hModule, LPCTSTR strName,
WAVEFORMATEX** ppWaveHeader, BYTE** ppbWaveData,
DWORD* pcbWaveSize )
{
HRSRC hResInfo;
HGLOBAL hResData;
VOID* pvRes;
if( NULL == ( hResInfo = FindResource( hModule, strName, TEXT("WAVE") ) ) )
{
if( NULL == ( hResInfo = FindResource( hModule, strName, TEXT("WAV") ) ) )
return E_FAIL;
}
if( NULL == ( hResData = LoadResource( hModule, hResInfo ) ) )
return E_FAIL;
if( NULL == ( pvRes = LockResource( hResData ) ) )
return E_FAIL;
if( FAILED( DSUtil_ParseWaveResource( pvRes, ppWaveHeader, ppbWaveData,
pcbWaveSize ) ) )
return E_FAIL;
return S_OK;
}
//-----------------------------------------------------------------------------
// Name:
// Desc:
//-----------------------------------------------------------------------------
SoundObject* DSUtil_CreateSound( LPCTSTR strName, DWORD dwNumConcurrentBuffers )
{
SoundObject* pSound = NULL;
LPWAVEFORMATEX pWaveHeader;
BYTE* pbData;
DWORD cbData;
if( NULL == g_pDS )
return NULL;
if( dwNumConcurrentBuffers < 1 )
dwNumConcurrentBuffers = 1;
if( SUCCEEDED( DSUtil_GetWaveResource( NULL, strName, &pWaveHeader,
&pbData, &cbData ) ) )
{
pSound = new SoundObject;
pSound->dwNumBuffers = dwNumConcurrentBuffers;
pSound->pbWaveData = pbData;
pSound->cbWaveSize = cbData;
pSound->dwCurrent = 0;
pSound->pdsbBuffers = new LPDIRECTSOUNDBUFFER[dwNumConcurrentBuffers+1];
pSound->pdsbBuffers[0] = DSUtil_LoadSoundBuffer( g_pDS, strName );
for( DWORD i=1; i<pSound->dwNumBuffers; i++ )
{
if( FAILED( g_pDS->DuplicateSoundBuffer( pSound->pdsbBuffers[0],
&pSound->pdsbBuffers[i] ) ) )
{
pSound->pdsbBuffers[i] = DSUtil_LoadSoundBuffer( g_pDS, strName );
if( NULL == pSound->pdsbBuffers[i] )
{
DSUtil_DestroySound( pSound );
pSound = NULL;
break;
}
}
}
}
return pSound;
}
//-----------------------------------------------------------------------------
// Name: DSUtil_DestroySound()
// Desc:
//-----------------------------------------------------------------------------
VOID DSUtil_DestroySound( SoundObject* pSound )
{
if( pSound )
{
for( DWORD i=0; i<pSound->dwNumBuffers; i++ )
{
if( pSound->pdsbBuffers[i] )
pSound->pdsbBuffers[i]->Release();
}
delete pSound->pdsbBuffers;
delete pSound;
}
}
//-----------------------------------------------------------------------------
// Name:
// Desc:
//-----------------------------------------------------------------------------
LPDIRECTSOUNDBUFFER DSUtil_GetFreeSoundBuffer( SoundObject* pSound )
{
HRESULT hr;
DWORD dwStatus;
if( NULL == pSound )
return NULL;
LPDIRECTSOUNDBUFFER pDSB = pSound->pdsbBuffers[pSound->dwCurrent];
if( NULL == pDSB )
return NULL;
hr = pDSB->GetStatus( &dwStatus );
if( FAILED(hr) )
dwStatus = 0;
if( dwStatus & DSBSTATUS_PLAYING )
{
if( pSound->dwNumBuffers <= 1 )
return NULL;
if( ++pSound->dwCurrent >= pSound->dwNumBuffers )
pSound->dwCurrent = 0;
pDSB = pSound->pdsbBuffers[pSound->dwCurrent];
hr = pDSB->GetStatus( &dwStatus);
if( FAILED(hr) )
dwStatus = 0;
if( dwStatus & DSBSTATUS_PLAYING )
{
pDSB->Stop();
pDSB->SetCurrentPosition( 0 );
}
}
if( dwStatus & DSBSTATUS_BUFFERLOST )
{
if( FAILED( pDSB->Restore() ) )
return NULL;
if( FAILED( DSUtil_FillSoundBuffer( pDSB, pSound->pbWaveData,
pSound->cbWaveSize ) ) )
return NULL;
}
return pDSB;
}
//-----------------------------------------------------------------------------
// Name: DSUtil_PlaySound()
// Desc:
//-----------------------------------------------------------------------------
HRESULT DSUtil_PlaySound( SoundObject* pSound, DWORD dwPlayFlags )
{
if( NULL == pSound )
return E_FAIL;
if( !(dwPlayFlags & DSBPLAY_LOOPING) || (pSound->dwNumBuffers == 1) )
{
LPDIRECTSOUNDBUFFER pDSB = DSUtil_GetFreeSoundBuffer( pSound );
if( pDSB )
{
if( SUCCEEDED( pDSB->Play( 0, 0, dwPlayFlags ) ) )
return S_OK;
}
}
return E_FAIL;
}
//-----------------------------------------------------------------------------
// Name: DSUtil_StopSound()
// Desc:
//-----------------------------------------------------------------------------
HRESULT DSUtil_StopSound( SoundObject* pSound )
{
if( NULL == pSound )
return E_FAIL;
for( DWORD i=0; i<pSound->dwNumBuffers; i++ )
{
pSound->pdsbBuffers[i]->Stop();
pSound->pdsbBuffers[i]->SetCurrentPosition( 0 );
}
return S_OK;
}
//-----------------------------------------------------------------------------
// Name:
// Desc:
//-----------------------------------------------------------------------------
HRESULT DSUtil_FillSoundBuffer( LPDIRECTSOUNDBUFFER pDSB, BYTE* pbWaveData,
DWORD dwWaveSize )
{
VOID* pMem1;
VOID* pMem2;
DWORD dwSize1;
DWORD dwSize2;
if( NULL == pDSB || NULL == pbWaveData || 0 == dwWaveSize )
return E_FAIL;
if( FAILED( pDSB->Lock( 0, dwWaveSize, &pMem1, &dwSize1, &pMem2,
&dwSize2, 0 ) ) )
return E_FAIL;
if( 0 != dwSize1 ) CopyMemory( pMem1, pbWaveData, dwSize1 );
if( 0 != dwSize2 ) CopyMemory( pMem2, pbWaveData+dwSize1, dwSize2 );
pDSB->Unlock( pMem1, dwSize1, pMem2, dwSize2);
return S_OK;
}
//-----------------------------------------------------------------------------
// Name:
// Desc:
//-----------------------------------------------------------------------------
HRESULT DSUtil_ParseWaveResource( VOID* pvRes, WAVEFORMATEX** ppWaveHeader,
BYTE** ppbWaveData, DWORD* pcbWaveSize )
{
DWORD* pdw;
DWORD* pdwEnd;
DWORD dwRiff;
DWORD dwType;
DWORD dwLength;
if( ppWaveHeader )
*ppWaveHeader = NULL;
if( ppbWaveData )
*ppbWaveData = NULL;
if( pcbWaveSize )
*pcbWaveSize = 0;
pdw = (DWORD*)pvRes;
dwRiff = *pdw++;
dwLength = *pdw++;
dwType = *pdw++;
if( dwRiff != mmioFOURCC('R', 'I', 'F', 'F') )
return E_FAIL;
if( dwType != mmioFOURCC('W', 'A', 'V', 'E') )
return E_FAIL;
pdwEnd = (DWORD *)((BYTE *)pdw + dwLength-4);
while( pdw < pdwEnd )
{
dwType = *pdw++;
dwLength = *pdw++;
if( dwType == mmioFOURCC('f', 'm', 't', ' ') )
{
if (ppWaveHeader && !*ppWaveHeader)
{
if( dwLength < sizeof(WAVEFORMAT) )
return E_FAIL;
*ppWaveHeader = (WAVEFORMATEX*)pdw;
if( (!ppbWaveData || *ppbWaveData) &&
(!pcbWaveSize || *pcbWaveSize) )
{
return S_OK;
}
}
}
if( dwType == mmioFOURCC('d', 'a', 't', 'a') )
{
if( (ppbWaveData && !*ppbWaveData) ||
(pcbWaveSize && !*pcbWaveSize) )
{
if( ppbWaveData )
*ppbWaveData = (BYTE*)pdw;
if( pcbWaveSize )
*pcbWaveSize = dwLength;
if( !ppWaveHeader || *ppWaveHeader )
return S_OK;
}
}
pdw = (DWORD*)( (BYTE*)pdw + ((dwLength+1)&~1) );
}
return E_FAIL;
}
//-----------------------------------------------------------------------------
// Name: DSUtil_PlayPannedSound()
// Desc: Play a sound, but first set the panning according to where the
// object is on the screen. fScreenXPos is between -1.0f (left) and
// 1.0f (right).
//-----------------------------------------------------------------------------
VOID DSUtil_PlayPannedSound( SoundObject* pSound, FLOAT fScreenXPos )
{
LPDIRECTSOUNDBUFFER pDSB = DSUtil_GetFreeSoundBuffer( pSound );
if( pDSB )
{
pDSB->SetPan( (LONG)( 10000L * fScreenXPos ) );
pDSB->Play( 0, 0, 0 );
}
}
//-----------------------------------------------------------------------------
// Name: DSUtil_InitDirectSound()
// Desc:
//-----------------------------------------------------------------------------
HRESULT DSUtil_InitDirectSound( HWND hWnd )
{
if( FAILED( DirectSoundCreate( NULL, &g_pDS, NULL ) ) )
return E_FAIL;
if( FAILED( g_pDS->SetCooperativeLevel( hWnd, DSSCL_NORMAL ) ) )
{
g_pDS->Release();
g_pDS = NULL;
return E_FAIL;
}
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: DSUtil_FreeDirectSound()
// Desc:
//-----------------------------------------------------------------------------
VOID DSUtil_FreeDirectSound()
{
if( g_pDS )
g_pDS->Release();
g_pDS = NULL;
}

View File

@@ -0,0 +1,152 @@
//-----------------------------------------------------------------------------
// File: dsutil.cpp
//
// Desc: Routines for dealing with sounds from resources
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#ifndef DSUTIL_H
#define DSUTIL_H
//-----------------------------------------------------------------------------
// Helper routines
//-----------------------------------------------------------------------------
HRESULT DSUtil_FillSoundBuffer( LPDIRECTSOUNDBUFFER pDSB, BYTE* pbWaveData,
DWORD dwWaveSize );
HRESULT DSUtil_ParseWaveResource( VOID* pvRes, WAVEFORMATEX** ppWaveHeader,
BYTE** ppbWaveData, DWORD* pdwWaveSize );
//-----------------------------------------------------------------------------
// Name: DSUtil_LoadSoundBuffer()
// Desc: Loads an IDirectSoundBuffer from a Win32 resource in the current
// application.
//-----------------------------------------------------------------------------
LPDIRECTSOUNDBUFFER DSUtil_LoadSoundBuffer( LPDIRECTSOUND* pDS,
LPCTSTR strName );
//-----------------------------------------------------------------------------
// Name: DSUtil_ReloadSoundBuffer()
// Desc: Reloads an IDirectSoundBuffer from a Win32 resource in the current
// application. normally used to handle a DSERR_BUFFERLOST error.
//-----------------------------------------------------------------------------
HRESULT DSUtil_ReloadSoundBuffer( LPDIRECTSOUNDBUFFER pDSB, LPCTSTR strName );
//-----------------------------------------------------------------------------
// Name: DSUtil_GetWaveResource()
// Desc: Finds a WAV resource in a Win32 module.
//-----------------------------------------------------------------------------
HRESULT DSUtil_GetWaveResource( HMODULE hModule, LPCTSTR strName,
WAVEFORMATEX** ppWaveHeader, BYTE** ppbWaveData,
DWORD* pdwWaveSize );
//-----------------------------------------------------------------------------
// Name: DSUtil_InitDirectSound()
// Desc:
//-----------------------------------------------------------------------------
HRESULT DSUtil_InitDirectSound( HWND hWnd );
//-----------------------------------------------------------------------------
// Name: DSUtil_FreeDirectSound()
// Desc:
//-----------------------------------------------------------------------------
VOID DSUtil_FreeDirectSound();
//-----------------------------------------------------------------------------
// Name: struct SoundObject
// Desc: Used to manage individual sounds which need to be played multiple
// times concurrently. A SoundObject represents a queue of
// IDirectSoundBuffer objects which all refer to the same buffer memory.
//-----------------------------------------------------------------------------
struct SoundObject
{
BYTE* pbWaveData; // Ptr into wave resource (for restore)
DWORD cbWaveSize; // Size of wave data (for restore)
DWORD dwNumBuffers; // Number of sound buffers.
DWORD dwCurrent; // Current sound buffer
LPDIRECTSOUNDBUFFER* pdsbBuffers; // List of sound buffers
};
//-----------------------------------------------------------------------------
// Name: DSUtil_CreateSound()
// Desc: Loads a SoundObject from a Win32 resource in the current application.
//-----------------------------------------------------------------------------
SoundObject* DSUtil_CreateSound( LPCTSTR strName, DWORD dwNumBuffers );
//-----------------------------------------------------------------------------
// Name: DSUtil_DestroySound()
// Desc: Frees a SoundObject and releases all of its buffers.
//-----------------------------------------------------------------------------
VOID DSUtil_DestroySound( SoundObject* pSound );
//-----------------------------------------------------------------------------
// Name: DSUtil_PlayPannedSound()
// Desc: Play a sound, but first set the panning according to where the
// object is on the screen. fScreenXPos is between -1.0f (left) and
// 1.0f (right).
//-----------------------------------------------------------------------------
VOID DSUtil_PlayPannedSound( SoundObject* pSound, FLOAT fScreenXPos );
//-----------------------------------------------------------------------------
// Name: DSUtil_PlaySound()
// Desc: Plays a buffer in a SoundObject.
//-----------------------------------------------------------------------------
HRESULT DSUtil_PlaySound( SoundObject* pSound, DWORD dwPlayFlags );
//-----------------------------------------------------------------------------
// Name: DSUtil_StopSound()
// Desc: Stops one or more buffers in a SoundObject.
//-----------------------------------------------------------------------------
HRESULT DSUtil_StopSound( SoundObject* pSound );
//-----------------------------------------------------------------------------
// Name: DSUtil_GetFreeSoundBuffer()
// Desc: Returns one of the cloned buffers that is not currently playing
//-----------------------------------------------------------------------------
LPDIRECTSOUNDBUFFER DSUtil_GetFreeSoundBuffer( SoundObject* pSound );
#endif // DSUTIL_H

View File

@@ -0,0 +1,690 @@
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
!IF "$(CFG)" == ""
CFG=duel - Win32 Debug
!MESSAGE No configuration specified. Defaulting to duel - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "duel - Win32 Release" && "$(CFG)" != "duel - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE on this makefile
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "duel.mak" CFG="duel - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "duel - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "duel - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
################################################################################
# Begin Project
# PROP Target_Last_Scanned "duel - Win32 Debug"
MTL=mktyplib.exe
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "duel - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
OUTDIR=.\Release
INTDIR=.\Release
ALL : "$(OUTDIR)\duel.exe"
CLEAN :
-@erase "$(INTDIR)\ddutil.obj"
-@erase "$(INTDIR)\diutil.obj"
-@erase "$(INTDIR)\dputil.obj"
-@erase "$(INTDIR)\dsutil.obj"
-@erase "$(INTDIR)\duel.obj"
-@erase "$(INTDIR)\duel.res"
-@erase "$(INTDIR)\gameproc.obj"
-@erase "$(INTDIR)\gfx.obj"
-@erase "$(INTDIR)\lobby.obj"
-@erase "$(INTDIR)\util.obj"
-@erase "$(INTDIR)\wizard.obj"
-@erase "$(OUTDIR)\duel.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)/duel.pch" /YX /Fo"$(INTDIR)/" /c
CPP_OBJS=.\Release/
CPP_SBRS=.\.
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /win32
MTL_PROJ=/nologo /D "NDEBUG" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
RSC_PROJ=/l 0x409 /fo"$(INTDIR)/duel.res" /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/duel.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib ole32.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib winmm.lib dplayx.lib ddraw.lib dinput.lib dsound.lib /nologo /subsystem:windows /machine:I386
# SUBTRACT LINK32 /nodefaultlib
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib ole32.lib comdlg32.lib\
advapi32.lib shell32.lib uuid.lib comctl32.lib winmm.lib dplayx.lib ddraw.lib\
dinput.lib dsound.lib /nologo /subsystem:windows /incremental:no\
/pdb:"$(OUTDIR)/duel.pdb" /machine:I386 /out:"$(OUTDIR)/duel.exe"
LINK32_OBJS= \
"$(INTDIR)\ddutil.obj" \
"$(INTDIR)\diutil.obj" \
"$(INTDIR)\dputil.obj" \
"$(INTDIR)\dsutil.obj" \
"$(INTDIR)\duel.obj" \
"$(INTDIR)\duel.res" \
"$(INTDIR)\gameproc.obj" \
"$(INTDIR)\gfx.obj" \
"$(INTDIR)\lobby.obj" \
"$(INTDIR)\util.obj" \
"$(INTDIR)\wizard.obj"
"$(OUTDIR)\duel.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
OUTDIR=.\Debug
INTDIR=.\Debug
ALL : "$(OUTDIR)\duel.exe" "$(OUTDIR)\duel.bsc"
CLEAN :
-@erase "$(INTDIR)\ddutil.obj"
-@erase "$(INTDIR)\ddutil.sbr"
-@erase "$(INTDIR)\diutil.obj"
-@erase "$(INTDIR)\diutil.sbr"
-@erase "$(INTDIR)\dputil.obj"
-@erase "$(INTDIR)\dputil.sbr"
-@erase "$(INTDIR)\dsutil.obj"
-@erase "$(INTDIR)\dsutil.sbr"
-@erase "$(INTDIR)\duel.obj"
-@erase "$(INTDIR)\duel.res"
-@erase "$(INTDIR)\duel.sbr"
-@erase "$(INTDIR)\gameproc.obj"
-@erase "$(INTDIR)\gameproc.sbr"
-@erase "$(INTDIR)\gfx.obj"
-@erase "$(INTDIR)\gfx.sbr"
-@erase "$(INTDIR)\lobby.obj"
-@erase "$(INTDIR)\lobby.sbr"
-@erase "$(INTDIR)\util.obj"
-@erase "$(INTDIR)\util.sbr"
-@erase "$(INTDIR)\vc40.idb"
-@erase "$(INTDIR)\vc40.pdb"
-@erase "$(INTDIR)\wizard.obj"
-@erase "$(INTDIR)\wizard.sbr"
-@erase "$(OUTDIR)\duel.bsc"
-@erase "$(OUTDIR)\duel.exe"
-@erase "$(OUTDIR)\duel.ilk"
-@erase "$(OUTDIR)\duel.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /c
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
/FR"$(INTDIR)/" /Fp"$(INTDIR)/duel.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
CPP_OBJS=.\Debug/
CPP_SBRS=.\Debug/
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /win32
MTL_PROJ=/nologo /D "_DEBUG" /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
RSC_PROJ=/l 0x409 /fo"$(INTDIR)/duel.res" /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/duel.bsc"
BSC32_SBRS= \
"$(INTDIR)\ddutil.sbr" \
"$(INTDIR)\diutil.sbr" \
"$(INTDIR)\dputil.sbr" \
"$(INTDIR)\dsutil.sbr" \
"$(INTDIR)\duel.sbr" \
"$(INTDIR)\gameproc.sbr" \
"$(INTDIR)\gfx.sbr" \
"$(INTDIR)\lobby.sbr" \
"$(INTDIR)\util.sbr" \
"$(INTDIR)\wizard.sbr"
"$(OUTDIR)\duel.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
$(BSC32) @<<
$(BSC32_FLAGS) $(BSC32_SBRS)
<<
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib ole32.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib winmm.lib dplayx.lib ddraw.lib dinput.lib dsound.lib /nologo /subsystem:windows /debug /machine:I386
# SUBTRACT LINK32 /nodefaultlib
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib ole32.lib comdlg32.lib\
advapi32.lib shell32.lib uuid.lib comctl32.lib winmm.lib dplayx.lib ddraw.lib\
dinput.lib dsound.lib /nologo /subsystem:windows /incremental:yes\
/pdb:"$(OUTDIR)/duel.pdb" /debug /machine:I386 /out:"$(OUTDIR)/duel.exe"
LINK32_OBJS= \
"$(INTDIR)\ddutil.obj" \
"$(INTDIR)\diutil.obj" \
"$(INTDIR)\dputil.obj" \
"$(INTDIR)\dsutil.obj" \
"$(INTDIR)\duel.obj" \
"$(INTDIR)\duel.res" \
"$(INTDIR)\gameproc.obj" \
"$(INTDIR)\gfx.obj" \
"$(INTDIR)\lobby.obj" \
"$(INTDIR)\util.obj" \
"$(INTDIR)\wizard.obj"
"$(OUTDIR)\duel.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
################################################################################
# Begin Target
# Name "duel - Win32 Release"
# Name "duel - Win32 Debug"
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
################################################################################
# Begin Source File
SOURCE=.\wizard.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\ddutil.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\diutil.cpp
DEP_CPP_DIUTI=\
".\diutil.h"\
".\duel.h"\
".\gameproc.h"\
{$(INCLUDE)}"\Dinput.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\diutil.obj" : $(SOURCE) $(DEP_CPP_DIUTI) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\diutil.obj" : $(SOURCE) $(DEP_CPP_DIUTI) "$(INTDIR)"
"$(INTDIR)\diutil.sbr" : $(SOURCE) $(DEP_CPP_DIUTI) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\diutil.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\dputil.cpp
DEP_CPP_DPUTI=\
".\dputil.h"\
".\duel.h"\
".\lobby.h"\
{$(INCLUDE)}"\dplobby.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\dputil.obj" : $(SOURCE) $(DEP_CPP_DPUTI) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\dputil.obj" : $(SOURCE) $(DEP_CPP_DPUTI) "$(INTDIR)"
"$(INTDIR)\dputil.sbr" : $(SOURCE) $(DEP_CPP_DPUTI) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\dputil.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\dsutil.cpp
DEP_CPP_DSUTI=\
".\dsutil.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\dsutil.obj" : $(SOURCE) $(DEP_CPP_DSUTI) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\dsutil.obj" : $(SOURCE) $(DEP_CPP_DSUTI) "$(INTDIR)"
"$(INTDIR)\dsutil.sbr" : $(SOURCE) $(DEP_CPP_DSUTI) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\dsutil.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\duel.cpp
DEP_CPP_DUEL_=\
".\diutil.h"\
".\dputil.h"\
".\dsutil.h"\
".\duel.h"\
".\gameproc.h"\
".\gfx.h"\
".\lobby.h"\
".\wizard.h"\
{$(INCLUDE)}"\Dinput.h"\
{$(INCLUDE)}"\dplobby.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\duel.obj" : $(SOURCE) $(DEP_CPP_DUEL_) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\duel.obj" : $(SOURCE) $(DEP_CPP_DUEL_) "$(INTDIR)"
"$(INTDIR)\duel.sbr" : $(SOURCE) $(DEP_CPP_DUEL_) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\duel.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\duel.rc
DEP_RSC_DUEL_R=\
".\Bfire.wav"\
".\csession.bmp"\
".\DUEL.BMP"\
".\duel.ico"\
".\Lboom.wav"\
".\osession.bmp"\
".\player.bmp"\
".\Sboom.wav"\
".\Sbounce.wav"\
".\Sengine.wav"\
".\SPLASH.BMP"\
".\Sstart.wav"\
".\Sstop.wav"\
".\verinfo.h"\
".\verinfo.ver"\
"$(INTDIR)\duel.res" : $(SOURCE) $(DEP_RSC_DUEL_R) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\gameproc.cpp
DEP_CPP_GAMEP=\
".\diutil.h"\
".\dputil.h"\
".\dsutil.h"\
".\duel.h"\
".\gameproc.h"\
".\gfx.h"\
".\lobby.h"\
".\wizard.h"\
{$(INCLUDE)}"\Dinput.h"\
{$(INCLUDE)}"\dplobby.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\gameproc.obj" : $(SOURCE) $(DEP_CPP_GAMEP) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\gameproc.obj" : $(SOURCE) $(DEP_CPP_GAMEP) "$(INTDIR)"
"$(INTDIR)\gameproc.sbr" : $(SOURCE) $(DEP_CPP_GAMEP) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\gameproc.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\gfx.cpp
DEP_CPP_GFX_C=\
".\ddutil.h"\
".\diutil.h"\
".\duel.h"\
".\gfx.h"\
{$(INCLUDE)}"\Dinput.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\gfx.obj" : $(SOURCE) $(DEP_CPP_GFX_C) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\gfx.obj" : $(SOURCE) $(DEP_CPP_GFX_C) "$(INTDIR)"
"$(INTDIR)\gfx.sbr" : $(SOURCE) $(DEP_CPP_GFX_C) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\gfx.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\lobby.cpp
DEP_CPP_LOBBY=\
".\duel.h"\
".\lobby.h"\
{$(INCLUDE)}"\dplobby.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\lobby.obj" : $(SOURCE) $(DEP_CPP_LOBBY) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\lobby.obj" : $(SOURCE) $(DEP_CPP_LOBBY) "$(INTDIR)"
"$(INTDIR)\lobby.sbr" : $(SOURCE) $(DEP_CPP_LOBBY) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\lobby.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\resource.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\util.cpp
DEP_CPP_UTIL_=\
".\duel.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)"
"$(INTDIR)\util.sbr" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\wizard.cpp
DEP_CPP_WIZAR=\
".\dputil.h"\
".\duel.h"\
".\gameproc.h"\
".\lobby.h"\
".\wizard.h"\
{$(INCLUDE)}"\dplobby.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\wizard.obj" : $(SOURCE) $(DEP_CPP_WIZAR) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\wizard.obj" : $(SOURCE) $(DEP_CPP_WIZAR) "$(INTDIR)"
"$(INTDIR)\wizard.sbr" : $(SOURCE) $(DEP_CPP_WIZAR) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\ddutil.cpp
DEP_CPP_DDUTI=\
".\ddutil.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\ddutil.obj" : $(SOURCE) $(DEP_CPP_DDUTI) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\ddutil.obj" : $(SOURCE) $(DEP_CPP_DDUTI) "$(INTDIR)"
"$(INTDIR)\ddutil.sbr" : $(SOURCE) $(DEP_CPP_DDUTI) "$(INTDIR)"
!ENDIF
# End Source File
# End Target
# End Project
################################################################################

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

View File

@@ -0,0 +1,536 @@
//-----------------------------------------------------------------------------
// File: Duel.cpp
//
// Desc: Multi-player game
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#include "duel.h"
#include "gameproc.h"
#include "gfx.h"
#include "DPUtil.h"
#include "diutil.h"
#include "dsutil.h"
#include "lobby.h"
//-----------------------------------------------------------------------------
// Globals
//-----------------------------------------------------------------------------
// This GUID allows DirectPlay to find other instances of the same game on
// the network. So it must be unique for every game, and the same for
// every instance of that game. // {33925241-05F8-11d0-8063-00A0C90AE891}
GUID g_AppGUID = { 0x33925241, 0x5f8, 0x11d0, { 0x80, 0x63, 0x0, 0xa0, 0xc9, 0xa, 0xe8, 0x91 } };
extern DWORD g_dwFrameCount;
extern DWORD g_dwFrameTime;
extern int g_nProgramState;
extern SHIP g_OurShip;
extern DPID g_LocalPlayerDPID;
static BOOL g_bReinitialize; // Used for switching display modes
TCHAR g_strAppName[256] = "Duel"; // The name of the sample
HANDLE g_hDPMessageEvent = NULL; // Not used in this sample, needed for DPConnect.cpp
TCHAR g_strLocalPlayerName[MAX_PLAYER_NAME]; // Local player name
TCHAR g_strSessionName[MAX_SESSION_NAME]; // Default session name
TCHAR g_strPreferredProvider[MAX_SESSION_NAME]; // Default preferred provider
LPDPLCONNECTION g_pDPLConnection = NULL;
LPDIRECTPLAYLOBBY3 g_pDPLobby = NULL;
HWND g_hwndMain; // Main application window handle
HKEY g_hDuelKey = NULL; // Duel registry key handle
HINSTANCE g_hInst; // Application instance handle
BOOL g_bShowFrameCount=TRUE; // Show FPS ?
BOOL g_bIsActive; // Is the application active ?
BOOL g_bHostPlayer; // Are we hosting or joining a game
DWORD g_dwKeys; // User keyboard input
DWORD g_dwOldKeys; // Last frame's keyboard input
BOOL g_bFullscreen=FALSE; // Window or FullScreen mode ?
RECT g_rcWindow; // client rectangle of main window
BOOL g_bReliable; // sends are reliable
BOOL g_bAsync; // asynchronous sends
BOOL g_bAsyncSupported; // asynchronous sends supported
BOOL g_bUseProtocol; // DirectPlay Protocol messaging
//-----------------------------------------------------------------------------
// Function prototypes
//-----------------------------------------------------------------------------
extern int DPConnect_StartDirectPlayConnect( HINSTANCE hInst, BOOL bBackTrack = FALSE );
extern HRESULT DPConnect_CheckForLobbyLaunch( BOOL* pbLaunchedByLobby );
LRESULT CALLBACK MainWndproc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
HRESULT InitApplication( HINSTANCE hInst );
HRESULT ReadRegKey( HKEY hKey, TCHAR* strName, TCHAR* strValue, DWORD dwLength, TCHAR* strDefault );
HRESULT WriteRegKey( HKEY hKey, TCHAR* strName, TCHAR* strValue );
VOID CleanupApplication();
BOOL WasLaunchedByLobby();
BOOL FinishLobbyLaunch();
VOID DoHelp();
//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc:
//-----------------------------------------------------------------------------
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int )
{
MSG msg;
BOOL bLaunchedByLobby;
HRESULT hr;
g_hInst = hInstance;
// Read information from registry
RegCreateKeyEx( HKEY_CURRENT_USER, DUEL_KEY, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
&g_hDuelKey, NULL );
ReadRegKey( g_hDuelKey, "Player Name",
g_strLocalPlayerName, MAX_PLAYER_NAME, "" );
ReadRegKey( g_hDuelKey, "Session Name",
g_strSessionName, MAX_SESSION_NAME, "" );
ReadRegKey( g_hDuelKey, "Preferred Provider",
g_strPreferredProvider, MAX_SESSION_NAME, "" );
CoInitialize( NULL );
if( FAILED( InitApplication( hInstance ) ) )
return 0;
// See if we were launched from a lobby server
hr = DPConnect_CheckForLobbyLaunch( &bLaunchedByLobby );
if( FAILED(hr) )
return 1;
if( bLaunchedByLobby )
{
// Start game
PostMessage( g_hwndMain, UM_LAUNCH, 0, 0 );
g_bIsActive = TRUE;
}
g_dwFrameTime = timeGetTime();
while( TRUE )
{
if( g_bIsActive )
{
// Any windows messages ? (returns immediately)
if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
{
if( !GetMessage( &msg, NULL, 0, 0 ) )
break;
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
{
// Poll our receive queue. Polling is used in the sample only for simplicity.
// Receiving messages using an event is the recommended way.
if( g_nProgramState != PS_SPLASH )
{
ReceiveMessages();
LobbyMessageReceive(LMR_PROPERTIES);
}
// update screen
if( !UpdateFrame() )
ExitGame(); // posts QUIT msg
}
}
else
{
// Any windows messages ? (blocks until a message arrives)
if( !GetMessage( &msg, NULL, 0, 0 ) )
break;
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
CoUninitialize();
// Write information to the registry
WriteRegKey( g_hDuelKey, "Player Name", g_strLocalPlayerName );
WriteRegKey( g_hDuelKey, "Session Name", g_strSessionName );
WriteRegKey( g_hDuelKey, "Preferred Provider", g_strPreferredProvider );
return (int)msg.wParam;
}
//-----------------------------------------------------------------------------
// Name: MainWndproc()
// Desc: Callback for all Windows messages
//-----------------------------------------------------------------------------
LRESULT CALLBACK MainWndproc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
PAINTSTRUCT ps;
HDC hdc;
switch( msg )
{
case WM_SIZE:
case WM_MOVE:
// Get the client rectangle
if( g_bFullscreen )
{
SetRect( &g_rcWindow, 0, 0, GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN) );
}
else
{
GetClientRect( hWnd, &g_rcWindow );
ClientToScreen( hWnd, (POINT*)&g_rcWindow );
ClientToScreen( hWnd, (POINT*)&g_rcWindow+1 );
}
break;
case WM_ACTIVATE:
// Ignore this message during reinitializing graphics
if( g_bReinitialize )
return 0;
// When we are deactivated, although we don't update our screen, we
// still need to to empty our receive queue periodically as
// messages will pile up otherwise. Polling the receive queue
// continuously even when we are deactivated causes our app to
// consume all the CPU time. To avoid hogging the CPU, we block on
// GetMessage() WIN API and setup a timer to wake ourselves up at
// regular intervals to process our messages.
if( LOWORD(wParam) == WA_INACTIVE )
{
// Aeactivated
g_bIsActive = FALSE;
if( PS_ACTIVE == g_nProgramState )
SetTimer( hWnd, RECEIVE_TIMER_ID, RECEIVE_TIMEOUT, NULL );
}
else
{
// Activated
g_bIsActive = TRUE;
if( PS_ACTIVE == g_nProgramState )
KillTimer( hWnd, RECEIVE_TIMER_ID );
}
// set game palette, if activated in game mode
if( g_bIsActive && (g_nProgramState != PS_SPLASH) )
SetGamePalette();
DIUtil_ReacquireInputDevices();
return 0;
case WM_CREATE:
break;
case WM_SYSKEYUP:
switch( wParam )
{
// Handle ALT+ENTER (fullscreen/window mode)
case VK_RETURN:
// Mode switch is allowed only during the game
if( g_nProgramState == PS_ACTIVE )
{
g_bReinitialize = TRUE;
ReleaseLocalData(); //only sound buffers have to be rels'd anyway.
CleanupGameSounds();
DIUtil_CleanupInput();
CleanupGraphics();
DestroyWindow( g_hwndMain );
g_bFullscreen = !g_bFullscreen;
InitGraphics();
DIUtil_InitInput( g_hwndMain );
InitializeGameSounds();
InitLocalSoundData();
g_bReinitialize = FALSE;
}
break;
}
break;
case WM_KEYDOWN:
switch( wParam )
{
case 'a':
case 'A':
// Toggle Async sends on/off
if( g_bAsyncSupported )
{
g_bAsync = !g_bAsync;
UpdateTitle(); // caption bar status
}
break;
case 'r':
case 'R':
// Toggle reliable sends
g_bReliable = !g_bReliable;
UpdateTitle();
break;
case VK_F1:
// Display help
DoHelp();
break;
case VK_F5:
// Toggle frame rate display
g_bShowFrameCount = !g_bShowFrameCount;
if( g_bShowFrameCount )
{
g_dwFrameCount = 0;
g_dwFrameTime = timeGetTime();
}
break;
case VK_RETURN:
// Launch game setup wizard
if( (g_nProgramState == PS_SPLASH) && !g_bFullscreen )
{
int nExitCode;
nExitCode = DPConnect_StartDirectPlayConnect( g_hInst, FALSE );
// Figure out what happened, and post a reflecting message
if( nExitCode == EXITCODE_FORWARD )
PostMessage(g_hwndMain, UM_LAUNCH, 0, 0);
if( nExitCode == EXITCODE_QUIT )
PostMessage(g_hwndMain, UM_ABORT, 0, 0);
if( nExitCode == EXITCODE_LOBBYCONNECT )
PostMessage( g_hwndMain, UM_LAUNCH, 0, 0 );
if( nExitCode == EXITCODE_ERROR )
{
MessageBox( g_hwndMain, TEXT("Mutliplayer connect failed. "
"The sample will now quit."),
TEXT("DirectPlay Sample"), MB_OK | MB_ICONERROR );
PostMessage(g_hwndMain, UM_ABORT, 0, 0);
}
}
break;
case VK_ESCAPE:
case VK_F12:
// Exit the game
ExitGame();
return 0;
}
break;
case WM_ERASEBKGND:
return 1;
case WM_PAINT:
hdc = BeginPaint( hWnd, &ps );
if( g_nProgramState == PS_SPLASH )
{
// Display the splash screen
BltSplashScreen( NULL );
}
EndPaint( hWnd, &ps );
return 1;
case UM_LAUNCH:
case UM_ABORT:
// if we were launched by the lobby and not (failed to finish a lobby launch)
// where wParam is bLobbyLaunched
if( msg == UM_LAUNCH )
{
// Init lobby msg support for reporting score
// Note that we don't release the lobby object
LobbyMessageInit();
// Start the game in rest mode
g_nProgramState = PS_REST;
LaunchGame();
return 1;
}
// Else aborting
ExitGame();
return 1;
case WM_TIMER:
ReceiveMessages();
LobbyMessageReceive( LMR_PROPERTIES );
break;
case WM_DESTROY:
// If g_bReinitialize is TRUE don't quit, we are just switching
// display modes
if( !g_bReinitialize )
{
CleanupApplication();
PostQuitMessage( 0 );
}
return 0;
default:
break;
}
return DefWindowProc( hWnd, msg, wParam, lParam );
}
//-----------------------------------------------------------------------------
// Name: InitApplication()
// Desc: Do that initialization stuff...
//-----------------------------------------------------------------------------
HRESULT InitApplication( HINSTANCE hInst )
{
WNDCLASS wndClass = { CS_DBLCLKS, MainWndproc, 0, 0, hInst,
LoadIcon( hInst, MAKEINTRESOURCE(IDI_MAIN)),
LoadCursor(NULL, IDC_ARROW),
(HBRUSH)GetStockObject(BLACK_BRUSH),
NULL, TEXT("DuelClass") };
RegisterClass( &wndClass );
// Initialize all components
if( FAILED( InitGraphics() ) )
return E_FAIL;
if( FAILED( DIUtil_InitInput( g_hwndMain ) ) )
return E_FAIL;
if( FAILED( InitializeGameSounds() ) )
{
// Can play game without sound. Do not exit
}
// Start in splash mode
g_nProgramState = PS_SPLASH;
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: CleanupApplication()
// Desc: Calls clean up on all components
//-----------------------------------------------------------------------------
VOID CleanupApplication()
{
CleanupComm();
CleanupGameSounds();
CleanupGraphics();
DIUtil_CleanupInput();
DPLobbyRelease(); // in case we were doing lobby messages
}
//-----------------------------------------------------------------------------
// Name: ShowError()
// Desc: Displays error to the user
//-----------------------------------------------------------------------------
VOID ShowError( int iStrID )
{
TCHAR strMsg[MAX_ERRORMSG];
LoadString( g_hInst, iStrID, strMsg, MAX_ERRORMSG );
MessageBox( g_hwndMain, strMsg, TEXT("Duel Message"), MB_OK );
}
//-----------------------------------------------------------------------------
// Name: UpdateTitle()
// Desc: Updates the window title based on application status
//-----------------------------------------------------------------------------
VOID UpdateTitle()
{
// Build the window title
TCHAR strTitle[MAX_WINDOWTITLE] = TEXT("Duel");
// State options in window title
if( g_bHostPlayer | g_bUseProtocol | g_bReliable | g_bAsync )
{
strcat( strTitle, " - |" );
if( g_bHostPlayer )
_tcscat( strTitle, TEXT(" Host |") );
if( g_bUseProtocol )
_tcscat( strTitle, TEXT(" Protocol |") );
if( g_bReliable )
_tcscat( strTitle, TEXT(" Reliable |") );
if( g_bAsync )
_tcscat( strTitle, TEXT(" Async |") );
}
// Change window title
SetWindowText( g_hwndMain, strTitle );
}
//-----------------------------------------------------------------------------
// Name: DoHelp()
// Desc: Display a Help summary in a message box.
//-----------------------------------------------------------------------------
VOID DoHelp()
{
TCHAR strHelpMsg[MAX_HELPMSG];
LoadString( g_hInst, IDS_DUEL_HELP, strHelpMsg, MAX_HELPMSG );
MessageBox( g_hwndMain, strHelpMsg, TEXT("DUEL"), MB_OK );
}
//-----------------------------------------------------------------------------
// Name: ReadRegKey()
// Desc: Read a registry key
//-----------------------------------------------------------------------------
HRESULT ReadRegKey( HKEY hKey, TCHAR* strName, TCHAR* strValue,
DWORD dwLength, TCHAR* strDefault )
{
DWORD dwType;
LONG bResult;
bResult = RegQueryValueEx( hKey, strName, 0, &dwType,
(LPBYTE) strValue, &dwLength );
if ( bResult != ERROR_SUCCESS )
strcpy( strValue, strDefault );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: WriteRegKey()
// Desc: Writes a registry key
//-----------------------------------------------------------------------------
HRESULT WriteRegKey( HKEY hKey, TCHAR* strName, TCHAR* strValue )
{
LONG bResult;
bResult = RegSetValueEx( hKey, strName, 0, REG_SZ,
(LPBYTE) strValue, strlen(strValue) + 1 );
if ( bResult != ERROR_SUCCESS )
return E_FAIL;
return S_OK;
}

View File

@@ -0,0 +1,237 @@
# Microsoft Developer Studio Project File - Name="duel" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=duel - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "duel.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "duel.mak" CFG="duel - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "duel - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "duel - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "duel - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 uuid.lib comctl32.lib dplayx.lib ddraw.lib dinput.lib dsound.lib dxguid.lib dxerr8.lib ole32.lib winmm.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /machine:I386 /stack:0x1f4000,0x1f4000
# SUBTRACT LINK32 /nodefaultlib
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 uuid.lib comctl32.lib dplayx.lib ddraw.lib dinput.lib dsound.lib dxguid.lib dxerr8.lib ole32.lib winmm.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /debug /machine:I386 /stack:0x1f4000,0x1f4000
# SUBTRACT LINK32 /nodefaultlib
!ENDIF
# Begin Target
# Name "duel - Win32 Release"
# Name "duel - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\ddutil.cpp
# End Source File
# Begin Source File
SOURCE=.\ddutil.h
# End Source File
# Begin Source File
SOURCE=.\diutil.cpp
# End Source File
# Begin Source File
SOURCE=.\diutil.h
# End Source File
# Begin Source File
SOURCE=.\dpconnect.cpp
# End Source File
# Begin Source File
SOURCE=.\dputil.cpp
# End Source File
# Begin Source File
SOURCE=.\dputil.h
# End Source File
# Begin Source File
SOURCE=.\dsutil.cpp
# End Source File
# Begin Source File
SOURCE=.\dsutil.h
# End Source File
# Begin Source File
SOURCE=.\duel.cpp
# End Source File
# Begin Source File
SOURCE=.\duel.h
# End Source File
# Begin Source File
SOURCE=.\duel.rc
# End Source File
# Begin Source File
SOURCE=.\gameproc.cpp
# End Source File
# Begin Source File
SOURCE=.\gameproc.h
# End Source File
# Begin Source File
SOURCE=.\gfx.cpp
# End Source File
# Begin Source File
SOURCE=.\gfx.h
# End Source File
# Begin Source File
SOURCE=.\lobby.cpp
# End Source File
# Begin Source File
SOURCE=.\lobby.h
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# Begin Source File
SOURCE=.\util.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\csession.bmp
# End Source File
# Begin Source File
SOURCE=.\DUEL.BMP
# End Source File
# Begin Source File
SOURCE=.\duel.ico
# End Source File
# Begin Source File
SOURCE=.\osession.bmp
# End Source File
# Begin Source File
SOURCE=.\player.bmp
# End Source File
# Begin Source File
SOURCE=.\SPLASH.BMP
# End Source File
# End Group
# Begin Source File
SOURCE=.\Bfire.wav
# End Source File
# Begin Source File
SOURCE=.\Lboom.wav
# End Source File
# Begin Source File
SOURCE=.\Sboom.wav
# End Source File
# Begin Source File
SOURCE=.\Sbounce.wav
# End Source File
# Begin Source File
SOURCE=.\Sengine.wav
# End Source File
# Begin Source File
SOURCE=.\Sstart.wav
# End Source File
# Begin Source File
SOURCE=.\Sstop.wav
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "duel"=.\duel.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,97 @@
//-----------------------------------------------------------------------------
// File: Duel.h
//
// Desc: Duel include file
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#ifndef DUEL_INCLUDED
#define DUEL_INCLUDED
// bcc32 does not support nameless unions in C mode
#if defined(__BORLANDC__) && !defined(__cplusplus)
#define NONAMELESSUNION
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include "resource.h"
#include <wtypes.h>
#include <tchar.h>
//-----------------------------------------------------------------------------
// Application constants
//-----------------------------------------------------------------------------
// Dialog exit codes
#define EXITCODE_FORWARD 1 // Dialog success, so go forward
#define EXITCODE_BACKUP 2 // Dialog canceled, show previous dialog
#define EXITCODE_QUIT 3 // Dialog quit, close app
#define EXITCODE_ERROR 4 // Dialog error, terminate app
#define EXITCODE_LOBBYCONNECT 5 // Dialog connected from lobby, connect success
// User messages
#define UM_LAUNCH WM_USER
#define UM_ABORT WM_USER+1
#define UM_RESTARTTIMER WM_USER+2
// program states
enum{ PS_SPLASH, PS_ACTIVE, PS_REST };
#define MAX_SCREEN_X 639
#define MAX_SCREEN_Y 479
#define MAX_PLAYER_NAME 14
#define MAX_SESSION_NAME 256
#define MAX_SPNAME 50
#define MAX_CLASSNAME 50
#define MAX_WINDOWTITLE 50
#define MAX_ERRORMSG 256
#define MAX_FONTNAME 50
#define MAX_HELPMSG 512
#define RECEIVE_TIMER_ID 1
#define RECEIVE_TIMEOUT 1000 // in milliseconds
#define ENUM_TIMER_ID 2
#define ENUM_TIMEOUT 2000 // in milliseconds
// Default window size
#define MAX_DEFWIN_X 640
#define MAX_DEFWIN_Y 480
// Tree view image info
#define CX_BITMAP 25
#define CY_BITMAP 25
#define NUM_BITMAPS 2
// registry info
#define DUEL_KEY (TEXT("Software\\Microsoft\\Duel"))
//-----------------------------------------------------------------------------
// Prototypes
//-----------------------------------------------------------------------------
VOID ShowError( int err );
VOID UpdateTitle();
// Functions defined in util.c
int randInt( int low, int high );
double randDouble( double low, double high );
#define TRACE dtrace
void dtrace( TCHAR* strFormat, ...);
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -0,0 +1,690 @@
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
!IF "$(CFG)" == ""
CFG=duel - Win32 Debug
!MESSAGE No configuration specified. Defaulting to duel - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "duel - Win32 Release" && "$(CFG)" != "duel - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE on this makefile
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "duel.mak" CFG="duel - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "duel - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "duel - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
################################################################################
# Begin Project
# PROP Target_Last_Scanned "duel - Win32 Debug"
MTL=mktyplib.exe
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "duel - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
OUTDIR=.\Release
INTDIR=.\Release
ALL : "$(OUTDIR)\duel.exe"
CLEAN :
-@erase "$(INTDIR)\ddutil.obj"
-@erase "$(INTDIR)\diutil.obj"
-@erase "$(INTDIR)\dputil.obj"
-@erase "$(INTDIR)\dsutil.obj"
-@erase "$(INTDIR)\duel.obj"
-@erase "$(INTDIR)\duel.res"
-@erase "$(INTDIR)\gameproc.obj"
-@erase "$(INTDIR)\gfx.obj"
-@erase "$(INTDIR)\lobby.obj"
-@erase "$(INTDIR)\util.obj"
-@erase "$(INTDIR)\wizard.obj"
-@erase "$(OUTDIR)\duel.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)/duel.pch" /YX /Fo"$(INTDIR)/" /c
CPP_OBJS=.\Release/
CPP_SBRS=.\.
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /win32
MTL_PROJ=/nologo /D "NDEBUG" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
RSC_PROJ=/l 0x409 /fo"$(INTDIR)/duel.res" /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/duel.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib ole32.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib winmm.lib dplayx.lib ddraw.lib dinput.lib dsound.lib /nologo /subsystem:windows /machine:I386
# SUBTRACT LINK32 /nodefaultlib
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib ole32.lib comdlg32.lib\
advapi32.lib shell32.lib uuid.lib comctl32.lib winmm.lib dplayx.lib ddraw.lib\
dinput.lib dsound.lib /nologo /subsystem:windows /incremental:no\
/pdb:"$(OUTDIR)/duel.pdb" /machine:I386 /out:"$(OUTDIR)/duel.exe"
LINK32_OBJS= \
"$(INTDIR)\ddutil.obj" \
"$(INTDIR)\diutil.obj" \
"$(INTDIR)\dputil.obj" \
"$(INTDIR)\dsutil.obj" \
"$(INTDIR)\duel.obj" \
"$(INTDIR)\duel.res" \
"$(INTDIR)\gameproc.obj" \
"$(INTDIR)\gfx.obj" \
"$(INTDIR)\lobby.obj" \
"$(INTDIR)\util.obj" \
"$(INTDIR)\wizard.obj"
"$(OUTDIR)\duel.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
OUTDIR=.\Debug
INTDIR=.\Debug
ALL : "$(OUTDIR)\duel.exe" "$(OUTDIR)\duel.bsc"
CLEAN :
-@erase "$(INTDIR)\ddutil.obj"
-@erase "$(INTDIR)\ddutil.sbr"
-@erase "$(INTDIR)\diutil.obj"
-@erase "$(INTDIR)\diutil.sbr"
-@erase "$(INTDIR)\dputil.obj"
-@erase "$(INTDIR)\dputil.sbr"
-@erase "$(INTDIR)\dsutil.obj"
-@erase "$(INTDIR)\dsutil.sbr"
-@erase "$(INTDIR)\duel.obj"
-@erase "$(INTDIR)\duel.res"
-@erase "$(INTDIR)\duel.sbr"
-@erase "$(INTDIR)\gameproc.obj"
-@erase "$(INTDIR)\gameproc.sbr"
-@erase "$(INTDIR)\gfx.obj"
-@erase "$(INTDIR)\gfx.sbr"
-@erase "$(INTDIR)\lobby.obj"
-@erase "$(INTDIR)\lobby.sbr"
-@erase "$(INTDIR)\util.obj"
-@erase "$(INTDIR)\util.sbr"
-@erase "$(INTDIR)\vc40.idb"
-@erase "$(INTDIR)\vc40.pdb"
-@erase "$(INTDIR)\wizard.obj"
-@erase "$(INTDIR)\wizard.sbr"
-@erase "$(OUTDIR)\duel.bsc"
-@erase "$(OUTDIR)\duel.exe"
-@erase "$(OUTDIR)\duel.ilk"
-@erase "$(OUTDIR)\duel.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /c
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
/FR"$(INTDIR)/" /Fp"$(INTDIR)/duel.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
CPP_OBJS=.\Debug/
CPP_SBRS=.\Debug/
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /win32
MTL_PROJ=/nologo /D "_DEBUG" /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
RSC_PROJ=/l 0x409 /fo"$(INTDIR)/duel.res" /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/duel.bsc"
BSC32_SBRS= \
"$(INTDIR)\ddutil.sbr" \
"$(INTDIR)\diutil.sbr" \
"$(INTDIR)\dputil.sbr" \
"$(INTDIR)\dsutil.sbr" \
"$(INTDIR)\duel.sbr" \
"$(INTDIR)\gameproc.sbr" \
"$(INTDIR)\gfx.sbr" \
"$(INTDIR)\lobby.sbr" \
"$(INTDIR)\util.sbr" \
"$(INTDIR)\wizard.sbr"
"$(OUTDIR)\duel.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
$(BSC32) @<<
$(BSC32_FLAGS) $(BSC32_SBRS)
<<
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib ole32.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib winmm.lib dplayx.lib ddraw.lib dinput.lib dsound.lib /nologo /subsystem:windows /debug /machine:I386
# SUBTRACT LINK32 /nodefaultlib
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib ole32.lib comdlg32.lib\
advapi32.lib shell32.lib uuid.lib comctl32.lib winmm.lib dplayx.lib ddraw.lib\
dinput.lib dsound.lib /nologo /subsystem:windows /incremental:yes\
/pdb:"$(OUTDIR)/duel.pdb" /debug /machine:I386 /out:"$(OUTDIR)/duel.exe"
LINK32_OBJS= \
"$(INTDIR)\ddutil.obj" \
"$(INTDIR)\diutil.obj" \
"$(INTDIR)\dputil.obj" \
"$(INTDIR)\dsutil.obj" \
"$(INTDIR)\duel.obj" \
"$(INTDIR)\duel.res" \
"$(INTDIR)\gameproc.obj" \
"$(INTDIR)\gfx.obj" \
"$(INTDIR)\lobby.obj" \
"$(INTDIR)\util.obj" \
"$(INTDIR)\wizard.obj"
"$(OUTDIR)\duel.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
################################################################################
# Begin Target
# Name "duel - Win32 Release"
# Name "duel - Win32 Debug"
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
################################################################################
# Begin Source File
SOURCE=.\wizard.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\ddutil.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\diutil.cpp
DEP_CPP_DIUTI=\
".\diutil.h"\
".\duel.h"\
".\gameproc.h"\
{$(INCLUDE)}"\Dinput.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\diutil.obj" : $(SOURCE) $(DEP_CPP_DIUTI) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\diutil.obj" : $(SOURCE) $(DEP_CPP_DIUTI) "$(INTDIR)"
"$(INTDIR)\diutil.sbr" : $(SOURCE) $(DEP_CPP_DIUTI) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\diutil.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\dputil.cpp
DEP_CPP_DPUTI=\
".\dputil.h"\
".\duel.h"\
".\lobby.h"\
{$(INCLUDE)}"\dplobby.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\dputil.obj" : $(SOURCE) $(DEP_CPP_DPUTI) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\dputil.obj" : $(SOURCE) $(DEP_CPP_DPUTI) "$(INTDIR)"
"$(INTDIR)\dputil.sbr" : $(SOURCE) $(DEP_CPP_DPUTI) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\dputil.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\dsutil.cpp
DEP_CPP_DSUTI=\
".\dsutil.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\dsutil.obj" : $(SOURCE) $(DEP_CPP_DSUTI) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\dsutil.obj" : $(SOURCE) $(DEP_CPP_DSUTI) "$(INTDIR)"
"$(INTDIR)\dsutil.sbr" : $(SOURCE) $(DEP_CPP_DSUTI) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\dsutil.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\duel.cpp
DEP_CPP_DUEL_=\
".\diutil.h"\
".\dputil.h"\
".\dsutil.h"\
".\duel.h"\
".\gameproc.h"\
".\gfx.h"\
".\lobby.h"\
".\wizard.h"\
{$(INCLUDE)}"\Dinput.h"\
{$(INCLUDE)}"\dplobby.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\duel.obj" : $(SOURCE) $(DEP_CPP_DUEL_) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\duel.obj" : $(SOURCE) $(DEP_CPP_DUEL_) "$(INTDIR)"
"$(INTDIR)\duel.sbr" : $(SOURCE) $(DEP_CPP_DUEL_) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\duel.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\duel.rc
DEP_RSC_DUEL_R=\
".\Bfire.wav"\
".\csession.bmp"\
".\DUEL.BMP"\
".\duel.ico"\
".\Lboom.wav"\
".\osession.bmp"\
".\player.bmp"\
".\Sboom.wav"\
".\Sbounce.wav"\
".\Sengine.wav"\
".\SPLASH.BMP"\
".\Sstart.wav"\
".\Sstop.wav"\
".\verinfo.h"\
".\verinfo.ver"\
"$(INTDIR)\duel.res" : $(SOURCE) $(DEP_RSC_DUEL_R) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\gameproc.cpp
DEP_CPP_GAMEP=\
".\diutil.h"\
".\dputil.h"\
".\dsutil.h"\
".\duel.h"\
".\gameproc.h"\
".\gfx.h"\
".\lobby.h"\
".\wizard.h"\
{$(INCLUDE)}"\Dinput.h"\
{$(INCLUDE)}"\dplobby.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\gameproc.obj" : $(SOURCE) $(DEP_CPP_GAMEP) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\gameproc.obj" : $(SOURCE) $(DEP_CPP_GAMEP) "$(INTDIR)"
"$(INTDIR)\gameproc.sbr" : $(SOURCE) $(DEP_CPP_GAMEP) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\gameproc.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\gfx.cpp
DEP_CPP_GFX_C=\
".\ddutil.h"\
".\diutil.h"\
".\duel.h"\
".\gfx.h"\
{$(INCLUDE)}"\Dinput.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\gfx.obj" : $(SOURCE) $(DEP_CPP_GFX_C) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\gfx.obj" : $(SOURCE) $(DEP_CPP_GFX_C) "$(INTDIR)"
"$(INTDIR)\gfx.sbr" : $(SOURCE) $(DEP_CPP_GFX_C) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\gfx.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\lobby.cpp
DEP_CPP_LOBBY=\
".\duel.h"\
".\lobby.h"\
{$(INCLUDE)}"\dplobby.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\lobby.obj" : $(SOURCE) $(DEP_CPP_LOBBY) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\lobby.obj" : $(SOURCE) $(DEP_CPP_LOBBY) "$(INTDIR)"
"$(INTDIR)\lobby.sbr" : $(SOURCE) $(DEP_CPP_LOBBY) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\lobby.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\resource.h
!IF "$(CFG)" == "duel - Win32 Release"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\util.cpp
DEP_CPP_UTIL_=\
".\duel.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)"
"$(INTDIR)\util.sbr" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\wizard.cpp
DEP_CPP_WIZAR=\
".\dputil.h"\
".\duel.h"\
".\gameproc.h"\
".\lobby.h"\
".\wizard.h"\
{$(INCLUDE)}"\dplobby.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\wizard.obj" : $(SOURCE) $(DEP_CPP_WIZAR) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\wizard.obj" : $(SOURCE) $(DEP_CPP_WIZAR) "$(INTDIR)"
"$(INTDIR)\wizard.sbr" : $(SOURCE) $(DEP_CPP_WIZAR) "$(INTDIR)"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\ddutil.cpp
DEP_CPP_DDUTI=\
".\ddutil.h"\
!IF "$(CFG)" == "duel - Win32 Release"
"$(INTDIR)\ddutil.obj" : $(SOURCE) $(DEP_CPP_DDUTI) "$(INTDIR)"
!ELSEIF "$(CFG)" == "duel - Win32 Debug"
"$(INTDIR)\ddutil.obj" : $(SOURCE) $(DEP_CPP_DDUTI) "$(INTDIR)"
"$(INTDIR)\ddutil.sbr" : $(SOURCE) $(DEP_CPP_DDUTI) "$(INTDIR)"
!ENDIF
# End Source File
# End Target
# End Project
################################################################################

Binary file not shown.

View File

@@ -0,0 +1,272 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
" \0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_CONNECT_STATUS DIALOG DISCARDABLE 120, 110, 162, 52
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION "Duel Connection Status"
FONT 8, "MS Shell Dlg"
BEGIN
CTEXT "Finding game...",IDC_DUEL_STATUSTEXT,7,7,141,13
DEFPUSHBUTTON "&Cancel",IDC_LOBBYCONNECTCANCEL,52,29,51,14
END
IDD_MULTIPLAYER_GAMES DIALOG DISCARDABLE 0, 0, 282, 140
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Multiplayer Games"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Select Game To Join:",-1,7,15,69,8
LISTBOX IDC_GAMES_LIST,7,24,268,91,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Join",IDC_JOIN,7,119,50,14
DEFPUSHBUTTON "Create",IDC_CREATE,61,119,50,14
PUSHBUTTON "Cancel",IDC_BACK,225,119,50,14
CONTROL "Start Search",IDC_SEARCH_CHECK,"Button",BS_AUTOCHECKBOX |
BS_PUSHLIKE | WS_TABSTOP,220,7,55,14
END
IDD_MULTIPLAYER_CONNECT DIALOG DISCARDABLE 0, 0, 282, 151
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Multiplayer Connect"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Player Name:",IDC_STATIC,7,10,43,8
EDITTEXT IDC_PLAYER_NAME_EDIT,7,22,268,14,ES_AUTOHSCROLL
LTEXT "Connection Type:",IDC_STATIC,7,41,57,8
LISTBOX IDC_CONNECTION_LIST,7,53,268,72,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,171,130,50,14
PUSHBUTTON "Cancel",IDCANCEL,225,130,50,14
END
IDD_MULTIPLAYER_CREATE DIALOG DISCARDABLE 0, 0, 186, 77
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Create Game"
FONT 8, "MS Shell Dlg"
BEGIN
EDITTEXT IDC_EDIT_SESSION_NAME,7,19,172,14,ES_AUTOHSCROLL
CONTROL "Use DirectPlay Protocol",IDC_CHECK_DPLAY_PROTOCOL,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,49,40,91,10
DEFPUSHBUTTON "OK",IDOK,7,56,50,14
PUSHBUTTON "Cancel",IDCANCEL,129,56,50,14
LTEXT "Game Name:",IDC_STATIC,7,7,42,8
END
IDD_LOBBY_WAIT_STATUS DIALOG DISCARDABLE 120, 110, 162, 52
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION "Lobby Connection Status"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "&Cancel",IDC_LOBBYCONNECTCANCEL,55,31,51,14
CTEXT "Finding Game...",IDC_WAIT_TEXT,7,14,141,8
END
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
SPLASH BITMAP MOVEABLE PURE "SPLASH.BMP"
DUEL8 BITMAP MOVEABLE PURE "DUEL.BMP"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MAIN ICON DISCARDABLE "duel.ico"
/////////////////////////////////////////////////////////////////////////////
//
// WAVE
//
SBOUNCE WAVE DISCARDABLE "Sbounce.wav"
LBOOM WAVE DISCARDABLE "Lboom.wav"
SBOOM WAVE DISCARDABLE "Sboom.wav"
BFIRE WAVE DISCARDABLE "Bfire.wav"
SENGINE WAVE DISCARDABLE "Sengine.wav"
SSTART WAVE DISCARDABLE "Sstart.wav"
SSTOP WAVE DISCARDABLE "Sstop.wav"
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_CONNECT_STATUS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 148
TOPMARGIN, 7
BOTTOMMARGIN, 24
END
IDD_MULTIPLAYER_CREATE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
VERTGUIDE, 94
TOPMARGIN, 7
BOTTOMMARGIN, 70
END
IDD_LOBBY_WAIT_STATUS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 148
TOPMARGIN, 7
BOTTOMMARGIN, 45
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_WIZARD_FONTNAME "Times"
IDS_WIZARD_TITLE "Duel Setup"
IDS_WIZARD_TITLE_SP "Communications Channel (Step 2 of 3)"
IDS_WIZARD_TITLE_GS "Game Setup (Step 1 of 3)"
IDS_WIZARD_TITLE_JS "Join Session (Step 3 of 3)"
IDS_WIZARD_TITLE_HS "Host Session (Step 3 of 3)"
IDS_DUEL_HELP "Spacebar\t\t- Fire\nRight Arrow\t- Rotate right\nLeft Arrow\t- Rotate left\nUp Arrow\t\t- Forward\nDown Arrow\t- Backward\nNumPad 5\t- Stop\nA\t\t- Asynchronous Messaging\nR\t\t- Reliable Messaging\nF1\t\t- Help\nF5\t\t- Frames/sec\nESC or F12\t- Quit\n"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DDRAW_ERROR_DDC "DirectDraw create failed"
IDS_DDRAW_ERROR_SCL "SetCooperativeLevel failed"
IDS_DDRAW_ERROR_SDM "SetDisplayMode failed"
IDS_DDRAW_ERROR_CREATESURFACE "IDirectDraw::CreateSurface() failed"
IDS_DDRAW_ERROR_GAS "Backbuffer couldn't be obtained"
IDS_DDRAW_ERROR_CC "CreateClipper failed"
IDS_DDRAW_ERROR_SH "Clipper SetHwnd failed"
IDS_DDRAW_ERROR_SC "Clipper object couldn't be attached to the front buffer"
IDS_DDRAW_ERROR_RS "Surfaces couldn't be restored"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DINPUT_ERROR_DIC "DirectInputCreate failed"
IDS_DINPUT_ERROR_ED "Enum keyboard devices failed"
IDS_DINPUT_ERROR_CD "Create keyboard device failed"
IDS_DINPUT_ERROR_SP "Set non-exclusive mode failed"
IDS_DINPUT_ERROR_A "Keyboard acquire failed"
IDS_DINPUT_ERROR_DF "Set keyboard data format failed"
IDS_DDUTIL_ERROR_LI "LoadImage failed. Handle is NULL."
IDS_DDUTIL_ERROR_DDCB "DDUtil_CopyBitmap failed"
IDS_DDUTIL_ERROR_CCDC "CreateCompatibleDC failed"
IDS_DSOUND_LOADWAVES "Could not load WAVE resource."
IDS_DSOUND_DUPBUF "Could not duplicate a sound buffer for new ship"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DPLAY_ERROR_CP "Player create failed"
IDS_DPLAY_ERROR_JS "Session join failed"
IDS_DPLAY_ERROR_CS "Session create failed"
IDS_DPLAY_ERROR_IDC "DirectPlay object create failed"
IDS_DPLAY_ERROR_SL "You have been disconnected from the session"
IDS_DPLAY_ERROR_GPLD "Get player local data failed"
IDS_DPLAY_ERROR_SPLD "Set player local data failed"
IDS_DPLAY_ERROR_GPRD "Get player remote data failed"
IDS_DPLAY_ERROR_SPRD "Set player remote data failed"
IDS_DPLAY_ERROR_GSD "Get session description failed"
IDS_DPLAY_ERROR_EP "Enumerate players failed"
IDS_DPLAY_ERROR_ES "Enumerate sessions failed"
IDS_DPLAY_ERROR_C "DirectPlay Close failed"
IDS_DPLAY_ERROR_R "DirectPlay Release failed"
IDS_DPLAY_ERROR_DP "Destroy player failed"
IDS_DPLAY_ERROR_CLSID "This application requires DirectPlay 6 or later"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_DPLOBBY_ERROR_R "DirectPlayLobby Release failed"
IDS_DPLOBBY_ERROR_GCS "DirectPlayLobby GetConnectionSettings failed"
IDS_DPLOBBY_ERROR_SCS "DirectPlayLobby SetConnectionSettings failed"
IDS_DPLOBBY_ERROR_C "DirectPlayLobby Create failed"
IDS_DPLOBBY_ERROR_CONNECT "DirectPlayLobby Connect failed"
IDS_WIZARD_ERROR_GSG "Session guid couldn't be obtained from the parent item"
IDS_WIN_ERROR "Windows API failure"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,221 @@
//-----------------------------------------------------------------------------
// File: GameProc.h
//
// Desc: Game processing routines
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#define IDIRECTPLAY2_OR_GREATER
#include <ddraw.h>
#include <dplay.h>
#include <dsound.h>
// align on single byte boundaries
// this is a stop-gap measure until the structures can be re-arranged.
#pragma pack(1)
#define MAX_SHIP_X (MAX_SCREEN_X - 32)
#define MAX_SHIP_Y (MAX_SCREEN_Y - 32)
#define MAX_SHIP_FRAME 40
#define MAX_BULLET_X (MAX_SCREEN_X - 3)
#define MAX_BULLET_Y (MAX_SCREEN_Y - 3)
#define MAX_BULLET_FRAME 400
#define NUM_SHIP_TYPES 4
#define DEF_SHOW_DELAY (2000)
#define MAX_BUFFER_SIZE 256
#define UPDATE_INTERVAL 40 // interval between position updates in milliseconds (25 FPS)
#define SYNC_INTERVAL 1000 // synchronize once every second
#define HIDE_TIMEOUT 5000 // time for which a ship is disabled after a hit
// Keyboard commands
#define KEY_STOP 0x00000001l
#define KEY_DOWN 0x00000002l
#define KEY_LEFT 0x00000004l
#define KEY_RIGHT 0x00000008l
#define KEY_UP 0x00000010l
#define KEY_FIRE 0x00000020l
#define KEY_ENGINEOFF 0x00000040l
// Offsets for the bullet bitmap
#define BULLET_X 304
#define BULLET_Y 0
struct FRAG
{
double dPosX;
double dPosY;
LPDIRECTDRAWSURFACE pdds;
RECT src;
double dVelX;
double dVelY;
BOOL valid;
};
struct SHIP
{
double dPosX, dPosY; // ship x and y position
double dBulletPosX, dBulletPosY; // bullet x and y position
DWORD dwBulletFrame; // bullet frame
char cFrame; // current ship frame
BYTE byType; // ship type
BOOL bEnable; // is this ship active?
BOOL bBulletEnable; // Is there an active bullet?
double dVelX, dVelY; // ship x and y velocity (pixels/millisecond)
double dBulletVelX, dBulletVelY; // bullet x and y velocity (pixels/millisecond)
DWORD dwScore; // current score
DWORD dwLastTick; // most recent time stamp
BOOL bIgnore; // flag used to synchronize ship explosions
int iCountDown; // enable time-out
DWORD dwFrameCount; // number of frames since beginning of time
// DSound members
DWORD dwKeys; // the keyboard state
BOOL bEngineRunning; // These BOOLs keep track of the ship's
BOOL bMoving; // last condition so we can play sounds
BOOL bBounced; // when they change
BOOL bBlockHit;
BOOL bDeath;
BOOL bFiring;
};
struct BLOCKS
{
BYTE bits[30][5];
};
//-----------------------------------------------------------------------------
// communication packet structures
//-----------------------------------------------------------------------------
#define MSG_HOST 0x11 // message containing field layout, sent by host
#define MSG_BLOCKHIT 0x22 // block hit message
#define MSG_SHIPHIT 0x33 // ship hit message
#define MSG_ADDBLOCK 0x44 // add block message
#define MSG_CONTROL 0x55 // game keys message
#define MSG_SYNC 0x66 // synchronization message containing the rendezvous location
struct GENERICMSG
{
BYTE byType;
};
struct OLDHOSTMSG
{
BYTE byType;
BLOCKS Blocks;
};
struct HOSTMSG
{
BYTE byType;
BLOCKS Blocks;
int usedShipTypes[NUM_SHIP_TYPES];
};
struct BLOCKHITMSG
{
BYTE byType;
BYTE byRow;
BYTE byCol;
BYTE byMask;
};
struct SHIPHITMSG
{
BYTE byType;
DPID Id;
};
struct ADDBLOCKMSG
{
BYTE byType;
BYTE byX;
BYTE byY;
};
struct CONTROLMSG
{
BYTE byType;
BYTE byState;
};
struct SYNCMSG
{
BYTE byType;
BYTE byShipType; // this is needed only when sends are unreliable
char cFrame;
double dPosX;
double dPosY;
};
//-----------------------------------------------------------------------------
// Prototypes
//-----------------------------------------------------------------------------
VOID LaunchGame();
VOID ExitGame();
HRESULT InitOurShip();
HRESULT InitLocalSoundData();
BOOL WINAPI SetPlayerLocalSoundDataCB( DPID dpId, DWORD dwPlayerType,
LPCDPNAME pName, DWORD dwFlags,
VOID* pContext );
VOID ReleaseLocalData();
VOID ReleasePlayerLocalSoundData( SHIP* pShip );
BOOL WINAPI ReleasePlayerLocalDataCB( DPID dpId, DWORD dwPlayerType,
LPCDPNAME pName, DWORD dwFlags,
VOID* pContext );
VOID UpdateState( SHIP* pShip, DWORD dwControls );
VOID SendSync( SHIP* pShip );
VOID UpdateDisplayStatus( SHIP* pShip );
VOID UpdatePosition( DPID dpId, SHIP* ship );
BOOL IsHit( int x, int y );
VOID InitField();
BOOL setBlock( int x, int y );
VOID AddFrag( SHIP* pShip, int offX, int offY );
VOID UpdateFragment( int i );
VOID DestroyShip( SHIP* pShip );
VOID DestroyGame();
BOOL UpdateFrame();
VOID ProcessSoundFlags( SHIP* pShip );
BOOL WINAPI RenderPlayerCB( DPID dpId, DWORD dwPlayerType, LPCDPNAME pName,
DWORD dwFlags, VOID* pContext );
BOOL DrawScreen();
BOOL DrawScore();
VOID DrawShip( SHIP* pShip );
VOID DrawBlock( int x, int y );
VOID DrawBullet( SHIP* pShip );
VOID DrawFragments();
VOID DisplayFrameRate();
VOID GetConnection();
HRESULT ReceiveMessages();
VOID DoSystemMessage( DPMSG_GENERIC* pMsg, DWORD dwMsgSize, DPID idFrom,
DPID idTo );
VOID DoApplicationMessage( GENERICMSG* pMsg, DWORD dwMsgSize, DPID idFrom,
DPID idTo );
VOID SendGameMessage( GENERICMSG* pMsg, DPID idTo );
VOID CleanupComm();
HRESULT InitializeGameSounds();
VOID CleanupGameSounds();
// restore default alignment
#pragma pack()

View File

@@ -0,0 +1,534 @@
//-----------------------------------------------------------------------------
// File: gfx.cpp
//
// Desc: Graphics routines
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#include "duel.h"
#include "gfx.h"
#include "diutil.h"
#include "ddutil.h"
//-----------------------------------------------------------------------------
// Globals
//-----------------------------------------------------------------------------
extern BOOL g_bFullscreen; // Window or fullscreen mode ?
extern HWND g_hwndMain; // Main window
extern DWORD g_dwKeys;
extern int g_nProgramState; // Current state of program
extern RECT g_rcWindow; // Client window rectangle
extern HINSTANCE g_hInst; // Application instance handle
LPDIRECTDRAW g_pDD = NULL; // DirectDraw interface
LPDIRECTDRAWPALETTE g_pArtPalette = NULL; // Game screen palette
LPDIRECTDRAWPALETTE g_pSplashPalette = NULL; // Splash screen palette
LPDIRECTDRAWSURFACE g_pddsFrontBuffer = NULL; // primary surface
LPDIRECTDRAWSURFACE g_pddsBackBuffer = NULL; // back buffer for animation
LPDIRECTDRAWSURFACE g_pddsShip[4]; // ship bitmaps
LPDIRECTDRAWSURFACE g_pddsNumbers; // Numbers bitmap
DWORD g_dwFillColor;
//-----------------------------------------------------------------------------
// Name: InitGraphics()
// Desc:
//-----------------------------------------------------------------------------
HRESULT InitGraphics()
{
DDCAPS ddcaps;
HRESULT hr;
DDSURFACEDESC ddsd;
DDSCAPS ddscaps;
// Create a window
g_hwndMain = CreateWindowEx( WS_EX_APPWINDOW, TEXT("DuelClass"),
TEXT("Duel"), WS_POPUP | WS_SYSMENU, 0, 0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
NULL, NULL, g_hInst, NULL );
if( NULL == g_hwndMain )
return E_FAIL;
UpdateWindow( g_hwndMain );
SetFocus( g_hwndMain );
// DDraw stuff begins here
if( FAILED( hr = DirectDrawCreate( NULL, &g_pDD, NULL ) ) )
{
ShowError(IDS_DDRAW_ERROR_DDC);
return E_FAIL;
}
// Set access mode based on fullscreen/window
if( g_bFullscreen )
{
hr = g_pDD->SetCooperativeLevel( g_hwndMain,
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN );
}
else
{
hr = g_pDD->SetCooperativeLevel( g_hwndMain,
DDSCL_NORMAL);
}
if( FAILED(hr) )
{
ShowError(IDS_DDRAW_ERROR_SCL);
return E_FAIL;
}
if( g_bFullscreen )
{
// Set the mode to 640 by 480 by 8
if( FAILED( g_pDD->SetDisplayMode( 640, 480, 8 ) ) )
{
ShowError(IDS_DDRAW_ERROR_SDM);
return E_FAIL;
}
}
else
{
RECT rcWork;
RECT rc;
DWORD dwStyle;
// If we are still a WS_POPUP window we should convert to a
// normal app window so we look like a windows app.
dwStyle = GetWindowStyle(g_hwndMain);
dwStyle &= ~WS_POPUP;
dwStyle |= WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX;
SetWindowLong( g_hwndMain, GWL_STYLE, dwStyle );
// Aet window size
SetRect( &rc, 0, 0, MAX_DEFWIN_X, MAX_DEFWIN_Y );
AdjustWindowRectEx( &rc, GetWindowStyle(g_hwndMain),
GetMenu(g_hwndMain) != NULL,
GetWindowExStyle(g_hwndMain) );
SetWindowPos( g_hwndMain, NULL, 0, 0, rc.right-rc.left,
rc.bottom-rc.top,
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
SetWindowPos( g_hwndMain, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
// Make sure our window does not hang outside of the work area
SystemParametersInfo( SPI_GETWORKAREA, 0, &rcWork, 0 );
GetWindowRect( g_hwndMain, &rc );
if( rc.left < rcWork.left ) rc.left = rcWork.left;
if( rc.top < rcWork.top ) rc.top = rcWork.top;
SetWindowPos( g_hwndMain, NULL, rc.left, rc.top, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
}
// Check the color key hardware capabilities
ddcaps.dwSize = sizeof( ddcaps );
memset( &ddsd, 0, sizeof( ddsd ) );
ddsd.dwSize = sizeof( ddsd );
if( g_bFullscreen )
{
// Create surfaces
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE |
DDSCAPS_FLIP |
DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount = 1;
if( FAILED( hr = g_pDD->CreateSurface( &ddsd, &g_pddsFrontBuffer,
NULL ) ) )
{
ShowError(IDS_DDRAW_ERROR_CREATESURFACE);
return E_FAIL;
}
// Get a pointer to the back buffer
ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
if( FAILED( hr = g_pddsFrontBuffer->GetAttachedSurface( &ddscaps,
&g_pddsBackBuffer ) ) )
{
ShowError(IDS_DDRAW_ERROR_GAS);
return E_FAIL;
}
}
else
{
LPDIRECTDRAWCLIPPER pcClipper;
// Window case, create the primary surface
// and create a backbuffer in offscreen memory
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
if( FAILED( g_pDD->CreateSurface( &ddsd, &g_pddsFrontBuffer, NULL ) ) )
{
ShowError(IDS_DDRAW_ERROR_CREATESURFACE);
return E_FAIL;
}
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
ddsd.dwWidth = MAX_DEFWIN_X;
ddsd.dwHeight = MAX_DEFWIN_Y;
if( FAILED( hr = g_pDD->CreateSurface( &ddsd, &g_pddsBackBuffer, NULL ) ) )
{
ShowError(IDS_DDRAW_ERROR_CREATESURFACE);
return E_FAIL;
}
if( FAILED( hr = g_pDD->CreateClipper( 0, &pcClipper, NULL) ) )
{
ShowError(IDS_DDRAW_ERROR_CC);
return E_FAIL;
}
if( FAILED( hr = pcClipper->SetHWnd( 0, g_hwndMain) ) )
{
pcClipper->Release();
ShowError(IDS_DDRAW_ERROR_SH);
return E_FAIL;
}
if( FAILED( hr = g_pddsFrontBuffer->SetClipper( pcClipper) ) )
{
pcClipper->Release();
ShowError(IDS_DDRAW_ERROR_SC);
return E_FAIL;
}
// Done with clipper
pcClipper->Release();
}
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
ddsd.dwWidth = 320;
ddsd.dwHeight = 128;
for( DWORD i=0; i<4; i++ )
{
if( FAILED( hr = g_pDD->CreateSurface( &ddsd, &g_pddsShip[i], NULL ) ) )
{
ShowError(IDS_DDRAW_ERROR_CREATESURFACE);
return E_FAIL;
}
}
ddsd.dwHeight = 16;
if( FAILED( hr = g_pDD->CreateSurface( &ddsd, &g_pddsNumbers, NULL ) ) )
{
ShowError(IDS_DDRAW_ERROR_CREATESURFACE);
return E_FAIL;
}
if( FAILED( RestoreSurfaces() ) )
{
ShowError(IDS_DDRAW_ERROR_RS);
return E_FAIL;
}
g_dwKeys = 0;
ShowWindow( g_hwndMain, SW_SHOW);
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: CleanupGraphics()
// Desc:
//-----------------------------------------------------------------------------
VOID CleanupGraphics()
{
for( DWORD i=0; i<4; i++ )
if( g_pddsShip[i] )
g_pddsShip[i]->Release();
if( g_pddsNumbers )
g_pddsNumbers->Release();
if( g_pddsFrontBuffer )
g_pddsFrontBuffer->Release();
if( g_pArtPalette )
g_pArtPalette->Release();
if( g_pSplashPalette )
g_pSplashPalette->Release();
if( !g_bFullscreen && g_pddsBackBuffer )
g_pddsBackBuffer->Release();
if( g_pDD )
g_pDD->Release();
}
//-----------------------------------------------------------------------------
// Name: BltSplashScreen()
// Desc:
//-----------------------------------------------------------------------------
HRESULT BltSplashScreen( RECT* prc )
{
HRESULT hr;
HBITMAP hbm;
if( ( g_pddsFrontBuffer == NULL ) || ( g_pSplashPalette == NULL ) ||
( g_pddsBackBuffer == NULL ) )
return E_FAIL;
// Set the palette before loading the splash screen
g_pddsFrontBuffer->SetPalette( g_pSplashPalette );
hbm = (HBITMAP)LoadImage( GetModuleHandle( NULL ), TEXT("SPLASH"),
IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION );
if( NULL == hbm )
return E_FAIL;
// If the surface is lost, DDUtil_CopyBitmap will fail and the surface will
// be restored below.
hr = DDUtil_CopyBitmap( g_pddsBackBuffer, hbm, 0, 0, 0, 0 );
DeleteObject( hbm );
while( 1 )
{
hr = g_pddsFrontBuffer->Blt( &g_rcWindow, g_pddsBackBuffer,
prc, DDBLT_WAIT, NULL);
if( SUCCEEDED(hr) )
return S_OK;
if( hr == DDERR_SURFACELOST )
if( FAILED( RestoreSurfaces() ) )
return E_FAIL;
if( hr != DDERR_WASSTILLDRAWING )
return E_FAIL;
}
}
//-----------------------------------------------------------------------------
// Name: BltNumber()
// Desc:
//-----------------------------------------------------------------------------
HRESULT BltNumber( CHAR* strScore, int x, int y )
{
while( *strScore )
{
RECT src;
src.left = ((*strScore++)-'0')*16;
src.top = 0;
src.right = src.left + 16;
src.bottom = src.top + 16;
BltObject( x, y, g_pddsNumbers, &src, DDBLTFAST_SRCCOLORKEY );
x += 16;
}
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: BltObject()
// Desc:
//-----------------------------------------------------------------------------
HRESULT BltObject( int x, int y, LPDIRECTDRAWSURFACE pdds, RECT* prc,
DWORD flags )
{
if( NULL == pdds )
return E_FAIL;
while( 1 )
{
HRESULT hr = g_pddsBackBuffer->BltFast( x, y, pdds, prc, flags );
if( FAILED(hr) )
{
if( hr == DDERR_WASSTILLDRAWING )
continue;
if( hr == DDERR_SURFACELOST )
if( SUCCEEDED( RestoreSurfaces() ) )
continue;
return E_FAIL;
}
return S_OK;
}
}
//-----------------------------------------------------------------------------
// Name: EraseScreen()
// Desc:
//-----------------------------------------------------------------------------
VOID EraseScreen()
{
// Erase the background
DDBLTFX ddbltfx;
ZeroMemory( &ddbltfx, sizeof(ddbltfx) );
ddbltfx.dwSize = sizeof(ddbltfx);
#ifdef NONAMELESSUNION
ddbltfx.u5.dwFillColor = g_dwFillColor;
#else
ddbltfx.dwFillColor = g_dwFillColor;
#endif
while( 1 )
{
HRESULT hr = g_pddsBackBuffer->Blt( NULL, NULL, NULL,
DDBLT_COLORFILL, &ddbltfx );
if( SUCCEEDED(hr) )
return;
if( hr == DDERR_SURFACELOST )
{
if( FAILED( RestoreSurfaces() ) )
return;
}
if( hr != DDERR_WASSTILLDRAWING )
return;
}
}
//-----------------------------------------------------------------------------
// Name: FlipScreen()
// Desc:
//-----------------------------------------------------------------------------
VOID FlipScreen()
{
// Flip the surfaces
if( g_bFullscreen )
{
while( 1 )
{
HRESULT hr = g_pddsFrontBuffer->Flip( NULL, 0 );
if( hr == DDERR_SURFACELOST )
{
if( FAILED( RestoreSurfaces() ) )
return;
}
if( hr != DDERR_WASSTILLDRAWING )
return;
}
}
else
{
g_pddsFrontBuffer->Blt( &g_rcWindow, g_pddsBackBuffer, NULL,
DDBLT_WAIT, NULL );
}
}
//-----------------------------------------------------------------------------
// Name: RestoreSurfaces()
// Desc:
//-----------------------------------------------------------------------------
HRESULT RestoreSurfaces()
{
HRESULT hr;
HBITMAP hbm;
if( FAILED( hr = g_pddsFrontBuffer->Restore() ) )
return hr;
if( FAILED( hr = g_pddsBackBuffer->Restore() ) )
return hr;
for( DWORD i=0; i<4; i++ )
if( FAILED( hr = g_pddsShip[i]->Restore() ) )
return hr;
// Create and set the palette for the splash bitmap
g_pSplashPalette = DDUtil_LoadPalette( g_pDD, TEXT("SPLASH") );
if( NULL == g_pSplashPalette )
return E_FAIL;
// Create and set the palette for the art bitmap
g_pArtPalette = DDUtil_LoadPalette( g_pDD, TEXT("Duel8") );
if( NULL == g_pArtPalette )
return E_FAIL;
// set the palette before loading the art
g_pddsFrontBuffer->SetPalette( g_pArtPalette );
hbm = (HBITMAP)LoadImage( GetModuleHandle(NULL), TEXT("Duel8"),
IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION );
if( NULL == hbm )
return E_FAIL;
if( FAILED( hr = DDUtil_CopyBitmap( g_pddsShip[0], hbm, 0, 0, 320, 128 ) ) )
{
DeleteObject( hbm );
return E_FAIL;
}
if( FAILED( hr = DDUtil_CopyBitmap( g_pddsShip[1], hbm, 0, 128, 320, 128 ) ) )
{
DeleteObject( hbm );
return E_FAIL;
}
if( FAILED( hr = DDUtil_CopyBitmap( g_pddsShip[2], hbm, 0, 256, 320, 128 ) ) )
{
DeleteObject( hbm );
return E_FAIL;
}
if( FAILED( hr = DDUtil_CopyBitmap( g_pddsShip[3], hbm, 0, 384, 320, 128 ) ) )
{
DeleteObject( hbm );
return E_FAIL;
}
if( FAILED( hr = DDUtil_CopyBitmap( g_pddsNumbers, hbm, 0, 512, 320, 16 ) ) )
{
DeleteObject( hbm );
return E_FAIL;
}
DeleteObject( hbm );
// set colorfill colors and colorkeys according to bitmap contents
g_dwFillColor = DDUtil_ColorMatch( g_pddsShip[0], CLR_INVALID );
DDUtil_SetColorKey( g_pddsShip[0], CLR_INVALID );
DDUtil_SetColorKey( g_pddsShip[1], CLR_INVALID );
DDUtil_SetColorKey( g_pddsShip[2], CLR_INVALID );
DDUtil_SetColorKey( g_pddsShip[3], CLR_INVALID );
DDUtil_SetColorKey( g_pddsNumbers, CLR_INVALID );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: SetGamePalette()
// Desc:
//-----------------------------------------------------------------------------
VOID SetGamePalette()
{
if( g_pddsFrontBuffer )
g_pddsFrontBuffer->SetPalette( g_pArtPalette );
}

View File

@@ -0,0 +1,22 @@
//-----------------------------------------------------------------------------
// File: gfx.h
//
// Desc: Graphics routines
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#include "ddraw.h"
HRESULT InitGraphics();
VOID CleanupGraphics();
HRESULT BltSplashScreen( RECT* prc );
HRESULT BltNumber( CHAR* strScore, int x, int y );
HRESULT BltObject( int x, int y, LPDIRECTDRAWSURFACE pdds, RECT* src,
DWORD dwFlags );
VOID EraseScreen();
VOID FlipScreen();
HRESULT RestoreSurfaces();
VOID SetGamePalette();

Binary file not shown.

View File

@@ -0,0 +1,240 @@
//-----------------------------------------------------------------------------
// File: Lobby.cpp
//
// Desc: DP lobby related routines
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#include "duel.h"
#include "lobby.h"
//-----------------------------------------------------------------------------
// Definitions
//-----------------------------------------------------------------------------
#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
#define TIMERID 1 // Timer ID to use
#define TIMERINTERVAL 250 // Timer interval
//-----------------------------------------------------------------------------
// Globals
//-----------------------------------------------------------------------------
extern LPDIRECTPLAY4 g_pDP; // DirectPlay object pointer
extern LPDPLCONNECTION g_pDPLConnection; // Connection settings
extern LPDIRECTPLAYLOBBY3 g_pDPLobby; // Lobby object pointer
extern BOOL g_bHostPlayer; // Flag indicating if we are hosting
extern HWND g_hwndMain; // Main application window handle
extern HINSTANCE g_hInst; // Application instance handle
BOOL g_bLobbyMsgSupported; // Lobby messages are supported
GUID g_guidPlayer; // This player in this session
//-----------------------------------------------------------------------------
// Name: DPLobbyRelease()
// Desc: Wrapper for DirectPlayLobby Release API
//-----------------------------------------------------------------------------
HRESULT DPLobbyRelease()
{
// Cleanup lobby
SAFE_DELETE_ARRAY( g_pDPLConnection );
SAFE_RELEASE( g_pDPLobby );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: DoingLobbyMessages()
// Desc: Return TRUE if connected to a lobby and messages are supported.
//-----------------------------------------------------------------------------
BOOL DoingLobbyMessages()
{
return( g_pDPLobby && g_bLobbyMsgSupported );
}
//-----------------------------------------------------------------------------
// Name: LobbyMessageInit()
// Desc: Initialize lobby message processing. Must be done while a lobby
// connection is open.
//-----------------------------------------------------------------------------
HRESULT LobbyMessageInit()
{
if( NULL ==g_pDPLobby ) // Not connected to a lobby
return E_FAIL;
g_bLobbyMsgSupported = FALSE; // Until we find out otherwise.
// Find out if lobby messages are supported by the lobby
DPLMSG_GETPROPERTY msgGetProp;
ZeroMemory( &msgGetProp, sizeof(DPLMSG_GETPROPERTY) );
msgGetProp.dwType = DPLSYS_GETPROPERTY;
msgGetProp.dwRequestID = 1; // guidPlayer is not used
msgGetProp.guidPropertyTag = DPLPROPERTY_MessagesSupported;
return g_pDPLobby->SendLobbyMessage( DPLMSG_STANDARD, 0, &msgGetProp,
sizeof(DPLMSG_GETPROPERTY) );
}
//-----------------------------------------------------------------------------
// Name: LobbyMessageReceive()
// Desc: Check for any lobby messages and handle them
// There are two modes:
// LMR_CONNECTIONSETTINGS - Waiting only for settings from a lobby
// LMR_PROPERTIES - Handle property message responses
//-----------------------------------------------------------------------------
HRESULT LobbyMessageReceive( DWORD dwMode )
{
HRESULT hr = NOERROR;
LPVOID lpMsgBuffer = NULL;
DWORD dwBufferSize = 0;
DWORD dwRequiredSize;
DWORD dwMsgFlags;
if( NULL == g_pDPLobby ) // No lobby interface
return DPERR_NOINTERFACE;
while( SUCCEEDED(hr) ) // Get all queued messages
{
dwRequiredSize = dwBufferSize;
hr = g_pDPLobby->ReceiveLobbyMessage( 0, 0, &dwMsgFlags,
lpMsgBuffer, &dwRequiredSize );
if( hr == DPERR_BUFFERTOOSMALL ) // Alloc msg buffer and try again
{
if( NULL == lpMsgBuffer )
lpMsgBuffer = GlobalAllocPtr( GHND, dwRequiredSize );
else
lpMsgBuffer = GlobalReAllocPtr( lpMsgBuffer, dwRequiredSize, 0 );
if( NULL == lpMsgBuffer)
return DPERR_NOMEMORY;
dwBufferSize = dwRequiredSize;
hr = S_OK;
}
else if( SUCCEEDED(hr) && dwRequiredSize >= sizeof(DPLMSG_GENERIC) )
{
// Decode the message
// Are we just looking for the CONNECTIONSETTINGS msg?
if( dwMode == LMR_CONNECTIONSETTINGS )
{
if( (dwMsgFlags & DPLMSG_SYSTEM) &&
((DPLMSG_GENERIC*)lpMsgBuffer)->dwType ==
DPLSYS_NEWCONNECTIONSETTINGS )
break;
else
TRACE(_T("Non CONNECTIONSETTINGS lobby message ignored\n"));
}
// Otherwise we handle only GetProperty responses
else if( (dwMsgFlags & DPLMSG_STANDARD) &&
((DPLMSG_GENERIC*)lpMsgBuffer)->dwType ==
DPLSYS_GETPROPERTYRESPONSE )
{
DPLMSG_GETPROPERTYRESPONSE* lpMsgGPR =
(DPLMSG_GETPROPERTYRESPONSE*)lpMsgBuffer;
if( IsEqualGUID( lpMsgGPR->guidPropertyTag,
DPLPROPERTY_MessagesSupported ) )
{
if( (BOOL)lpMsgGPR->dwPropertyData[0] ) // Supported
{
// So request our player instance guid
DPLMSG_GETPROPERTY msgGetProp;
ZeroMemory(&msgGetProp, sizeof(DPLMSG_GETPROPERTY));
msgGetProp.dwType = DPLSYS_GETPROPERTY;
msgGetProp.dwRequestID = 2;
// guidPlayer is left NULL
msgGetProp.guidPropertyTag = DPLPROPERTY_PlayerGuid;
hr = g_pDPLobby->SendLobbyMessage( DPLMSG_STANDARD, 0,
&msgGetProp,
sizeof(DPLMSG_GETPROPERTY) );
hr = S_OK; // keep fetching messages
}
else // not supported so close up shop
{
TRACE(_T("Lobby Messages not supported\n"));
DPLobbyRelease();
break;
}
}
else if( IsEqualGUID( lpMsgGPR->guidPropertyTag,
DPLPROPERTY_PlayerGuid ) )
{
// Have our player guid, ready to send property msgs
g_guidPlayer = ( (DPLDATA_PLAYERGUID*)
&lpMsgGPR->dwPropertyData)->guidPlayer;
g_bLobbyMsgSupported = TRUE;
}
}
else
TRACE(_T("Unrecognized lobby message ignored\n"));
}
}
if( lpMsgBuffer )
GlobalFreePtr( lpMsgBuffer );
return hr;
}
//-----------------------------------------------------------------------------
// Name: LobbyMessageSetProperty()
// Desc: Send a SetProperty message
//-----------------------------------------------------------------------------
HRESULT LobbyMessageSetProperty( const GUID* pPropTagGUID, VOID* pData,
DWORD dwDataSize )
{
HRESULT hr;
LPBYTE lpBuffer;
LPDPLMSG_SETPROPERTY lpMsgSP;
DWORD dwMsgSize;
if( NULL == g_pDPLobby )
return DPERR_NOCONNECTION;
if( NULL == g_bLobbyMsgSupported )
return DPERR_UNAVAILABLE;
// Allocate and pack up the message
// Property data starts at dwPropertyData[0] for the size calculation
dwMsgSize = sizeof(DPLMSG_SETPROPERTY) - sizeof(DWORD) + dwDataSize;
lpBuffer = (LPBYTE)GlobalAllocPtr(GHND, dwMsgSize);
if( NULL == lpBuffer )
return (DPERR_NOMEMORY);
lpMsgSP = (LPDPLMSG_SETPROPERTY)lpBuffer;
lpMsgSP->dwType = DPLSYS_SETPROPERTY;
lpMsgSP->dwRequestID = DPL_NOCONFIRMATION;
lpMsgSP->guidPlayer = g_guidPlayer; // player property assumed
lpMsgSP->guidPropertyTag = (*pPropTagGUID);
lpMsgSP->dwDataSize = dwDataSize;
memcpy( lpMsgSP->dwPropertyData, pData, dwDataSize );
hr = g_pDPLobby->SendLobbyMessage( DPLMSG_STANDARD, 0, lpBuffer, dwMsgSize );
GlobalFreePtr( lpBuffer );
return hr;
}

View File

@@ -0,0 +1,33 @@
//-----------------------------------------------------------------------------
// File: Lobby.h
//
// Desc: DP lobby related routines include file
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#define IDIRECTPLAY2_OR_GREATER
#include <dplobby.h>
//-----------------------------------------------------------------------------
// LobbyMessageReceive Modes
//-----------------------------------------------------------------------------
#define LMR_PROPERTIES 0
#define LMR_CONNECTIONSETTINGS 1
//-----------------------------------------------------------------------------
// Prototypes
//-----------------------------------------------------------------------------
HRESULT DPLobbyRelease();
HRESULT DPLobbySetConnectionSettings();
BOOL DoingLobbyMessages();
HRESULT LobbyMessageInit();
HRESULT LobbyMessageReceive( DWORD dwMode );
HRESULT LobbyMessageSetProperty( const GUID* pPropTagGUID, VOID* pData,
DWORD dwDataSize );

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 B

View File

@@ -0,0 +1,51 @@
Duel Sample Game
------------------
This program requires less than 1 Meg of video ram.
The commands which this game recognizes are listed on the opening screen
and in the help dialog (F1).
ENTER - Starts game and multiplayer session setup
LEFT ARROW - Turn left
RIGHT ARROW - Turn right
UP ARROW - Accelerate forward
DOWN ARROW - Accelerate backward
NUMPAD 5 - Stop moving
SPACEBAR - Fire
ESC, F12 - Quit
F1 - Help - list of commands
F5 - toggle frame rate display
To play multiplayer one machine hosts a game, the others join.
To play using TCP/IP over the Internet, the people who are joining the
game must enter the IP address of the machine that hosted the game.
You can find out the IP address of your machine by running "winipcfg".
If you have a net card and a modem installed, you will need to make
sure you read the IP address of the modem connection to the Internet.
The modem will show up as a "PPP Adapter". DirectPlay will not work
through proxies or firewalls.
This game allows the selection of which DirectPlay messaging protocol
is used. The host machine can select the optimized DirectPlay
guaranteed protocol for the game session in the setup wizard. Reliable
and asynchronous messaging, when supported by the service provider or
by using the DirectPlay Protocol, can be toggled on and off with the R
and A keys. The protocol status will be displayed in the caption bar.
Also see the DPLAUNCH sample as an example of lobby launching this game.
Note: MSVC may include older versions of the DirectX header files and
libraries. In order to avoid compile errors, make sure the path to the
latest DirectX header files and libraries are listed BEFORE the MSVC header
files and libraries through the Tools -> Options -> Directories menu.
In order to support multi-byte character sets like Kanji, the dialogs in the
rc file need to be changed to use the "SYSTEM" font and the rc file needs to
be recompiled.

View File

@@ -0,0 +1,84 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by duel.rc
//
#define IDS_WIZARD_FONTNAME 6
#define IDS_WIZARD_TITLE 7
#define IDS_WIZARD_TITLE_SP 8
#define IDS_WIZARD_TITLE_GS 9
#define IDS_WIZARD_TITLE_JS 10
#define IDS_WIZARD_TITLE_HS 11
#define IDS_DUEL_HELP 12
#define IDS_DDRAW_ERROR_DDC 16
#define IDS_DDRAW_ERROR_SCL 17
#define IDS_DDRAW_ERROR_SDM 18
#define IDS_DDRAW_ERROR_CREATESURFACE 19
#define IDS_DDRAW_ERROR_GAS 20
#define IDS_DDRAW_ERROR_CC 21
#define IDS_DDRAW_ERROR_SH 22
#define IDS_DDRAW_ERROR_SC 23
#define IDS_DDRAW_ERROR_CSN 28
#define IDS_DDRAW_ERROR_RS 29
#define IDS_DINPUT_ERROR_DIC 32
#define IDS_DINPUT_ERROR_ED 33
#define IDS_DINPUT_ERROR_CD 34
#define IDS_DINPUT_ERROR_SP 35
#define IDS_DINPUT_ERROR_A 36
#define IDS_DINPUT_ERROR_DF 37
#define IDS_DDUTIL_ERROR_LI 38
#define IDS_DDUTIL_ERROR_DDCB 39
#define IDS_DDUTIL_ERROR_CCDC 40
#define IDS_DSOUND_LOADWAVES 41
#define IDS_DSOUND_DUPBUF 42
#define IDS_DPLAY_ERROR_CP 48
#define IDS_DPLAY_ERROR_JS 49
#define IDS_DPLAY_ERROR_CS 50
#define IDS_DPLAY_ERROR_IDC 51
#define IDS_DPLAY_ERROR_SL 52
#define IDS_DPLAY_ERROR_GPLD 53
#define IDS_DPLAY_ERROR_SPLD 54
#define IDS_DPLAY_ERROR_GPRD 55
#define IDS_DPLAY_ERROR_SPRD 56
#define IDS_DPLAY_ERROR_GSD 57
#define IDS_DPLAY_ERROR_EP 58
#define IDS_DPLAY_ERROR_ES 59
#define IDS_DPLAY_ERROR_C 60
#define IDS_DPLAY_ERROR_R 61
#define IDS_DPLAY_ERROR_DP 62
#define IDS_DPLAY_ERROR_CLSID 63
#define IDS_DPLOBBY_ERROR_R 64
#define IDS_DPLOBBY_ERROR_GCS 66
#define IDS_DPLOBBY_ERROR_SCS 67
#define IDS_DPLOBBY_ERROR_C 68
#define IDS_DPLOBBY_ERROR_CONNECT 69
#define IDS_WIZARD_ERROR_GSG 70
#define IDS_WIN_ERROR 71
#define IDD_MULTIPLAYER_CREATE 104
#define IDI_MAIN 104
#define IDD_CONNECT_STATUS 114
#define IDD_LOBBY_WAIT_STATUS 133
#define IDD_MULTIPLAYER_CONNECT 136
#define IDD_MULTIPLAYER_GAMES 137
#define IDC_PLAYER_NAME_EDIT 1000
#define IDC_GAMES_LIST 1001
#define IDC_JOIN 1002
#define IDC_CREATE 1003
#define IDC_CONNECTION_LIST 1004
#define IDC_BACK 1005
#define IDC_CHECK_DPLAY_PROTOCOL 1006
#define IDC_EDIT_SESSION_NAME 1007
#define IDC_DUEL_STATUSTEXT 1010
#define IDC_SEARCH_CHECK 1013
#define IDC_LOBBYCONNECTCANCEL 1029
#define IDC_WAIT_TEXT 1035
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 138
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1033
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,64 @@
//-----------------------------------------------------------------------------
// File: Util.cpp
//
// Desc: Misc routines
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#include "duel.h"
#include <stdlib.h>
//-----------------------------------------------------------------------------
// Name: randInt()
// Desc: Returns a random integer in the specified range
//-----------------------------------------------------------------------------
int randInt( int low, int high )
{
int range = high - low;
int num = rand() % range;
return( num + low );
}
//-----------------------------------------------------------------------------
// Name: randDouble()
// Desc: Returns a random double in the specified range
//-----------------------------------------------------------------------------
double randDouble( double low, double high )
{
double range = high - low;
double num = range * (double)rand()/(double)RAND_MAX;
return( num + low );
}
//-----------------------------------------------------------------------------
// Name: dtrace()
// Desc: Diagnostic trace to OutputDebugString() (UNICODE supported)
//-----------------------------------------------------------------------------
VOID dtrace( TCHAR* strFormat, ... )
{
int offset = 0;
TCHAR strBuf[256];
va_list ap;
va_start( ap, strFormat );
offset = wsprintf( strBuf, TEXT("DUEL: ") );
offset += wvsprintf( strBuf+offset, strFormat, ap );
OutputDebugString( strBuf );
va_end( ap );
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,51 @@
//-----------------------------------------------------------------------------
// File: Wizard.h
//
// Desc: UI routines
//
// Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#define IDIRECTPLAY2_OR_GREATER
#include <commctrl.h>
#include <dplay.h>
// Structure for the tree control
struct TREEDATA
{
GUID guid; // Session GUID
DWORD dwRefresh; // Used to detect when sessions go away
};
BOOL SetupFonts();
VOID CleanupFonts();
LONG RegSet( const TCHAR* strName, const BYTE* pData, DWORD dwSize );
LONG RegGet( const TCHAR* strName, BYTE* pData, DWORD* pdwDataSize );
DWORD WINAPI DoWizard( VOID* pv );
BOOL CALLBACK DlgProcChooseProvider( HWND hDlg, UINT msg, WPARAM wParam,
LPARAM lParam);
BOOL FAR PASCAL DPEnumConnectionsCallback( const GUID* pguidSP,
VOID* pConnection, DWORD dwSize,
const DPNAME* pName, DWORD dwFlags,
VOID* pContext );
BOOL WINAPI EnumSession( const DPSESSIONDESC2* pDPSessionDesc,
DWORD* pdwTimeOut, DWORD dwFlags, VOID* pContext );
BOOL CALLBACK DlgProcGameSetup( HWND hDlg, UINT msg, WPARAM wParam,
LPARAM lParam );
BOOL WINAPI EnumPlayer( DPID pidID, DWORD dwPlayerType,
const DPNAME* pName, DWORD dwFlags,
VOID* pContext );
BOOL CALLBACK DlgProcJoinSession( HWND hDlg, UINT msg, WPARAM wParam,
LPARAM lParam );
BOOL CALLBACK DlgProcHostSession( HWND hDlg, UINT msg, WPARAM wParam,
LPARAM lParam );
BOOL InitTreeViewImageLists( HWND hwndTV );
HTREEITEM AddItemToTree( HWND hwndTV, TCHAR* strItem, DWORD dwData, int nLevel );
VOID ReleaseSessionData( HWND hWndCtl );
VOID ReleaseSPData();