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:
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "AudioScripts"=.\AudioScripts.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on AudioScripts.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=AudioScripts - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to AudioScripts - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "AudioScripts - Win32 Release" && "$(CFG)" != "AudioScripts - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!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 "AudioScripts.mak" CFG="AudioScripts - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "AudioScripts - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AudioScripts - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "AudioScripts - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\AudioScripts.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\AudioScripts.obj"
|
||||
-@erase "$(INTDIR)\AudioScripts.res"
|
||||
-@erase "$(INTDIR)\dmutil.obj"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\AudioScripts.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\common\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\AudioScripts.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\AudioScripts.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\AudioScripts.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=dxerr8.lib winmm.lib dxguid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\AudioScripts.pdb" /machine:I386 /out:"$(OUTDIR)\AudioScripts.exe" /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\AudioScripts.obj" \
|
||||
"$(INTDIR)\dmutil.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\AudioScripts.res"
|
||||
|
||||
"$(OUTDIR)\AudioScripts.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "AudioScripts - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\AudioScripts.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\AudioScripts.obj"
|
||||
-@erase "$(INTDIR)\AudioScripts.res"
|
||||
-@erase "$(INTDIR)\dmutil.obj"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\AudioScripts.exe"
|
||||
-@erase "$(OUTDIR)\AudioScripts.ilk"
|
||||
-@erase "$(OUTDIR)\AudioScripts.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\AudioScripts.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\AudioScripts.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\AudioScripts.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=dxerr8.lib winmm.lib dxguid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\AudioScripts.pdb" /debug /machine:I386 /out:"$(OUTDIR)\AudioScripts.exe" /pdbtype:sept /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\AudioScripts.obj" \
|
||||
"$(INTDIR)\dmutil.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\AudioScripts.res"
|
||||
|
||||
"$(OUTDIR)\AudioScripts.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("AudioScripts.dep")
|
||||
!INCLUDE "AudioScripts.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "AudioScripts.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "AudioScripts - Win32 Release" || "$(CFG)" == "AudioScripts - Win32 Debug"
|
||||
SOURCE=.\AudioScripts.cpp
|
||||
|
||||
"$(INTDIR)\AudioScripts.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\AudioScripts.rc
|
||||
|
||||
"$(INTDIR)\AudioScripts.res" : $(SOURCE) "$(INTDIR)"
|
||||
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\common\src\dmutil.cpp
|
||||
|
||||
"$(INTDIR)\dmutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\common\src\dxutil.cpp
|
||||
|
||||
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,352 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// File: AudioScripts.cpp
|
||||
//
|
||||
// Desc: Plays a script file using DirectMusic
|
||||
//
|
||||
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#define STRICT
|
||||
#include <windows.h>
|
||||
#include <basetsd.h>
|
||||
#include <commdlg.h>
|
||||
#include <objbase.h>
|
||||
#include <stdio.h>
|
||||
#include <dmusicc.h>
|
||||
#include <dmusici.h>
|
||||
#include <dxerr8.h>
|
||||
#include "resource.h"
|
||||
#include <tchar.h>
|
||||
#include "DMUtil.h"
|
||||
#include "DXUtil.h"
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Function-prototypes
|
||||
//-----------------------------------------------------------------------------
|
||||
INT_PTR CALLBACK MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam );
|
||||
HRESULT OnInitDialog( HWND hDlg );
|
||||
HRESULT OnChangeScriptFile( HWND hDlg, TCHAR* strFileName );
|
||||
HRESULT OnCallRoutine( HWND hDlg, TCHAR* strRoutine );
|
||||
HRESULT UpdateVariables( HWND hDlg );
|
||||
HRESULT SetVariable( HWND hDlg, int nIDDlgItem );
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Defines, constants, and global variables
|
||||
//-----------------------------------------------------------------------------
|
||||
CMusicManager* g_pMusicManager = NULL;
|
||||
CMusicScript* g_pMusicScript = NULL;
|
||||
HINSTANCE g_hInst = NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: WinMain()
|
||||
// Desc: Entry point for the application. Since we use a simple dialog for
|
||||
// user interaction we don't need to pump messages.
|
||||
//-----------------------------------------------------------------------------
|
||||
INT APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR pCmdLine,
|
||||
INT nCmdShow )
|
||||
{
|
||||
g_hInst = hInst;
|
||||
|
||||
// Display the main dialog box.
|
||||
DialogBox( hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, MainDlgProc );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: MainDlgProc()
|
||||
// Desc: Handles dialog messages
|
||||
//-----------------------------------------------------------------------------
|
||||
INT_PTR CALLBACK MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
switch( msg )
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
if( FAILED( hr = OnInitDialog( hDlg ) ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("OnInitDialog"), hr );
|
||||
MessageBox( hDlg, "Error initializing DirectMusic. Sample will now exit.",
|
||||
"DirectMusic Sample", MB_OK | MB_ICONERROR );
|
||||
EndDialog( hDlg, 0 );
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch( LOWORD(wParam) )
|
||||
{
|
||||
case IDC_COMBO_SCRIPT:
|
||||
if ( HIWORD(wParam) == CBN_SELCHANGE )
|
||||
{
|
||||
char strFile[MAX_PATH] = "";
|
||||
GetDlgItemText( hDlg, IDC_COMBO_SCRIPT, strFile, MAX_PATH );
|
||||
if( FAILED( hr = OnChangeScriptFile( hDlg, strFile ) ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("OnChangeScriptFile"), hr );
|
||||
MessageBox( hDlg, "Error loading script. Sample will now exit.",
|
||||
"DirectMusic Sample", MB_OK | MB_ICONERROR );
|
||||
EndDialog( hDlg, 0 );
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IDC_BUTTON_ROUTINE1:
|
||||
case IDC_BUTTON_ROUTINE2:
|
||||
case IDC_BUTTON_ROUTINE3:
|
||||
if ( HIWORD(wParam) == BN_CLICKED )
|
||||
{
|
||||
TCHAR pstrRoutine[] = TEXT("RoutineX");
|
||||
pstrRoutine[_tcslen(pstrRoutine) - 1] = '1' + (LOWORD(wParam) - IDC_BUTTON_ROUTINE1);
|
||||
if( FAILED( hr = OnCallRoutine(hDlg, pstrRoutine) ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("OnCallRoutine"), hr );
|
||||
MessageBox( hDlg, "Error calling routine. Sample will now exit.",
|
||||
"DirectMusic Sample", MB_OK | MB_ICONERROR );
|
||||
EndDialog( hDlg, 0 );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_EDIT_VARIABLE1:
|
||||
case IDC_EDIT_VARIABLE2:
|
||||
if ( HIWORD(wParam) == EN_KILLFOCUS )
|
||||
{
|
||||
if( FAILED( hr = SetVariable( hDlg, LOWORD(wParam) ) ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("SetVariable"), hr );
|
||||
MessageBox( hDlg, "Error setting variable. Sample will now exit.",
|
||||
"DirectMusic Sample", MB_OK | MB_ICONERROR );
|
||||
EndDialog( hDlg, 0 );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IDOK:
|
||||
if ( HIWORD(wParam) == BN_CLICKED )
|
||||
{
|
||||
// This is sent by edit boxes to click the default button
|
||||
// (which we don't have) when Enter is pressed.
|
||||
HWND hwndFocus = GetFocus();
|
||||
int nIDDlgItem = 0;
|
||||
if ( hwndFocus == GetDlgItem(hDlg, IDC_EDIT_VARIABLE1) )
|
||||
nIDDlgItem = IDC_EDIT_VARIABLE1;
|
||||
else if ( hwndFocus == GetDlgItem(hDlg, IDC_EDIT_VARIABLE2) )
|
||||
nIDDlgItem = IDC_EDIT_VARIABLE2;
|
||||
|
||||
if ( nIDDlgItem != 0)
|
||||
{
|
||||
if( FAILED( hr = SetVariable( hDlg, nIDDlgItem ) ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("SetVariable"), hr );
|
||||
MessageBox( hDlg, "Error setting variable. Sample will now exit.",
|
||||
"DirectMusic Sample", MB_OK | MB_ICONERROR );
|
||||
EndDialog( hDlg, 0 );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Select the value to show that Enter committed it
|
||||
SendMessage(hwndFocus, EM_SETSEL, 0, -1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog( hDlg, 0 );
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE; // Didn't handle message
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
// Cleanup everything
|
||||
SAFE_DELETE( g_pMusicScript );
|
||||
SAFE_DELETE( g_pMusicManager );
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE; // Didn't handle message
|
||||
}
|
||||
|
||||
return TRUE; // Handled message
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: OnInitDialog()
|
||||
// Desc: Initializes the dialogs (sets up UI controls, etc.)
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT OnInitDialog( HWND hDlg )
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
// Load the icon
|
||||
HICON hIcon = LoadIcon( g_hInst, MAKEINTRESOURCE( IDR_MAINFRAME ) );
|
||||
|
||||
// Set the icon for this dialog.
|
||||
SendMessage( hDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon ); // Set big icon
|
||||
SendMessage( hDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIcon ); // Set small icon
|
||||
|
||||
g_pMusicManager = new CMusicManager();
|
||||
|
||||
if( FAILED( hr = g_pMusicManager->Initialize( hDlg ) ) )
|
||||
return hr;
|
||||
|
||||
// Set the default media path (something like C:\MSSDK\SAMPLES\MULTIMEDIA\MEDIA)
|
||||
// to be used as the search directory for finding DirectMusic content.
|
||||
g_pMusicManager->SetSearchDirectory( DXUtil_GetDXSDKMediaPath() );
|
||||
|
||||
// Fill the dropdown script choices
|
||||
SendDlgItemMessage( hDlg, IDC_COMBO_SCRIPT, CB_ADDSTRING,
|
||||
0, (LPARAM) "ScriptDemoBasic.spt" );
|
||||
SendDlgItemMessage( hDlg, IDC_COMBO_SCRIPT, CB_ADDSTRING,
|
||||
0, (LPARAM) "ScriptDemoBaseball.spt" );
|
||||
|
||||
// Load ScriptDemoBasic
|
||||
OnChangeScriptFile( hDlg, "ScriptDemoBasic.spt" );
|
||||
SendDlgItemMessage( hDlg, IDC_COMBO_SCRIPT, CB_SELECTSTRING,
|
||||
-1, (LPARAM) "ScriptDemoBasic.spt" );
|
||||
|
||||
if( g_pMusicScript )
|
||||
{
|
||||
if( FAILED( hr = UpdateVariables( hDlg ) ) )
|
||||
return hr;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: OnChangeScriptFile()
|
||||
// Desc: Called when the user changes script files from the dropdown.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT OnChangeScriptFile( HWND hDlg, TCHAR* strFileName )
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
// Free any previous script, and make a new one
|
||||
SAFE_DELETE( g_pMusicScript );
|
||||
|
||||
// Have the loader collect any garbage now that the old
|
||||
// script has been released
|
||||
g_pMusicManager->CollectGarbage();
|
||||
|
||||
// Load the script file
|
||||
if( FAILED( hr = g_pMusicManager->CreateScriptFromFile( &g_pMusicScript, strFileName ) ) )
|
||||
return hr;
|
||||
|
||||
// Get and display a string from the script describing itself.
|
||||
// Here we will ignore any errors. The script doesn't have to tell
|
||||
// about itself if it doesn't want to.
|
||||
if( SUCCEEDED( g_pMusicScript->CallRoutine( TEXT("GetAbout") ) ) )
|
||||
{
|
||||
// Scripts are normally designed to return Number and Object variables.
|
||||
// Retrieving a string is rarely used, and requires use of the more complicated
|
||||
// VARIANT data type.
|
||||
VARIANT varValue;
|
||||
VariantInit(&varValue);
|
||||
if( SUCCEEDED( g_pMusicScript->GetScript()->GetVariableVariant( L"About",
|
||||
&varValue, NULL ) ) )
|
||||
{
|
||||
if (varValue.vt == VT_BSTR)
|
||||
{
|
||||
char strAbout[5000] = "";
|
||||
wcstombs( strAbout, varValue.bstrVal, 5000 );
|
||||
strAbout[4999] = '\0';
|
||||
SetDlgItemText( hDlg, IDC_EDIT_ABOUT, strAbout );
|
||||
}
|
||||
|
||||
// The returned VARIANT contains data fields that
|
||||
// must be freed or memory will be leaked
|
||||
VariantClear(&varValue);
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: OnCallRoutine()
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT OnCallRoutine( HWND hDlg, TCHAR* strRoutine )
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if( FAILED( hr = g_pMusicScript->CallRoutine( strRoutine ) ) )
|
||||
return DXTRACE_ERR( TEXT("CallRoutine"), hr );
|
||||
|
||||
if( FAILED( hr = UpdateVariables( hDlg ) ) )
|
||||
return DXTRACE_ERR( TEXT("UpdateVariables"), hr );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: UpdateVariables()
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT UpdateVariables( HWND hDlg )
|
||||
{
|
||||
LONG lVal = 0;
|
||||
HRESULT hr;
|
||||
|
||||
if( FAILED( hr = g_pMusicScript->GetVariableNumber( TEXT("Variable1"), &lVal ) ) )
|
||||
return DXTRACE_ERR( TEXT("GetVariableNumber"), hr );
|
||||
SetDlgItemInt( hDlg, IDC_EDIT_VARIABLE1, lVal, TRUE );
|
||||
|
||||
if( FAILED( hr = g_pMusicScript->GetVariableNumber( TEXT("Variable2"), &lVal ) ) )
|
||||
return DXTRACE_ERR( TEXT("GetVariableNumber"), hr );
|
||||
SetDlgItemInt( hDlg, IDC_EDIT_VARIABLE2, lVal, TRUE );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: SetVariable()
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT SetVariable( HWND hDlg, int nIDDlgItem )
|
||||
{
|
||||
HRESULT hr;
|
||||
BOOL fIntConvertOK = FALSE;
|
||||
int iVal = GetDlgItemInt( hDlg, nIDDlgItem, &fIntConvertOK, TRUE );
|
||||
TCHAR* pstrVariable = (nIDDlgItem == IDC_EDIT_VARIABLE1) ? TEXT("Variable1") : TEXT("Variable2");
|
||||
|
||||
hr = g_pMusicScript->SetVariableNumber( pstrVariable, iVal );
|
||||
if( FAILED(hr) )
|
||||
return hr;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
# Microsoft Developer Studio Project File - Name="AudioScripts" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=AudioScripts - Win32 Debug
|
||||
!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 "AudioScripts.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 "AudioScripts.mak" CFG="AudioScripts - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "AudioScripts - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AudioScripts - 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)" == "AudioScripts - 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 /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\common\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /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 odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 dxerr8.lib winmm.lib dxguid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /stack:0x200000,0x200000
|
||||
|
||||
!ELSEIF "$(CFG)" == "AudioScripts - 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 /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /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 odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 dxerr8.lib winmm.lib dxguid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /stack:0x200000,0x200000
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "AudioScripts - Win32 Release"
|
||||
# Name "AudioScripts - Win32 Debug"
|
||||
# Begin Group "Source"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\AudioScripts.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\AudioScripts.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\directx.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Common"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\src\dmutil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\dmutil.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\src\dxutil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\dxutil.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\readme.txt
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,120 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include <windows.h>
|
||||
#define IDC_STATIC -1
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#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
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_MAIN DIALOG DISCARDABLE 0, 0, 225, 257
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE |
|
||||
WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "DirectMusic Script Demo"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
PUSHBUTTON "E&xit",IDCANCEL,168,7,50,14
|
||||
LTEXT "Script File:",IDC_STATIC,7,10,36,8
|
||||
COMBOBOX IDC_COMBO_SCRIPT,52,8,103,68,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Routine&1",IDC_BUTTON_ROUTINE1,7,25,62,14
|
||||
PUSHBUTTON "Routine&2",IDC_BUTTON_ROUTINE2,81,25,62,14
|
||||
PUSHBUTTON "Routine&3",IDC_BUTTON_ROUTINE3,155,25,62,14
|
||||
EDITTEXT IDC_EDIT_VARIABLE1,48,46,50,14,ES_AUTOHSCROLL |
|
||||
ES_NUMBER
|
||||
LTEXT "Variable1:",IDC_STATIC,7,49,32,8
|
||||
EDITTEXT IDC_EDIT_VARIABLE2,156,46,50,14,ES_AUTOHSCROLL
|
||||
LTEXT "Variable2:",IDC_STATIC,115,49,32,8
|
||||
EDITTEXT IDC_EDIT_ABOUT,7,76,211,172,ES_MULTILINE | ES_READONLY |
|
||||
WS_VSCROLL
|
||||
LTEXT "Script Notes:",IDC_STATIC,7,66,47,8
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_MAIN, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 218
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 248
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include <windows.h>\r\n"
|
||||
"#define IDC_STATIC -1\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDR_MAINFRAME ICON DISCARDABLE "directx.ico"
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,41 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Sample Name: AudioScripts Sample
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// GM/GS® Sound Set Copyright ©1996, Roland Corporation U.S.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
Description
|
||||
===========
|
||||
The AudioScripts sample demonstrates how an application and a DirectMusic
|
||||
script work together. The script reads and writes to variables in the
|
||||
application, and the application calls routines in the script that
|
||||
play segments.
|
||||
|
||||
The sample also demonstrates how waves can be played as variations
|
||||
in a segment.
|
||||
|
||||
Path
|
||||
====
|
||||
Source: DXSDK\Samples\Multimedia\DirectMusic\AudioScripts
|
||||
|
||||
Executable: DXSDK\Samples\Multimedia\DirectMusic\Bin
|
||||
|
||||
User's Guide
|
||||
============
|
||||
Select ScriptDemoBasic.spt from the Script File list box. Play a segment
|
||||
by clicking Routine 1. Click Routine 2 to play an ending and stop playback.
|
||||
Play the segment again and click Routine 3 several times. Note how Variable
|
||||
1 reflects the number of times the button has been clicked, and how the
|
||||
music changes in response to each click.
|
||||
|
||||
Select ScriptDemoBaseball.spt from the list box. Click Routine 1 to play
|
||||
various calls from a vendor. Click Routine 2 to play various musical motifs.
|
||||
Change the score by entering different values in the Variable1 and Variable2
|
||||
text boxes. Click Routine 3 to hear the score. If the score for either team
|
||||
exceeds 10, the crowd roars and then falls silent.
|
||||
@@ -0,0 +1,24 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by AudioScripts.rc
|
||||
//
|
||||
#define IDD_MAIN 101
|
||||
#define IDR_MAINFRAME 102
|
||||
#define IDC_COMBO_SCRIPT 1000
|
||||
#define IDC_EDIT_ABOUT 1001
|
||||
#define IDC_BUTTON_ROUTINE1 2001
|
||||
#define IDC_BUTTON_ROUTINE2 2002
|
||||
#define IDC_BUTTON_ROUTINE3 2003
|
||||
#define IDC_EDIT_VARIABLE1 3001
|
||||
#define IDC_EDIT_VARIABLE2 3002
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 105
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1020
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user