Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
// stdafx.cpp : source file that includes just the standard includes
// ACPProject.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,206 @@
//#include "ACP_Base.h"
#include <StdAfx.h>
#include "SCR.h"
#include "ITF/cpasaveo.hpp"
#include "acp_base.h" // for CPA_Tooldllb class definition
#include "ITF/tooldllb.hpp" // for CPA_Tooldllb class definition
#include "ITF/cpainter.hpp"
#include "SNInterf.hpp"
#include "TSNEvent.h"
#include "x:\cpa\main\inc\_editid.h"
//-----------------------------------------------------------------------------
// Name : TSN_Event:m_fn_eLoad
//-----------------------------------------------------------------------------
// Description : Script Callback for the event section.
// For each event section found, creates a TSN_Event section,
// sets its section name (with a SndEventM action name),
// and its name for the cpa lists( SetName() entry of SndEventE).
//-----------------------------------------------------------------------------
// Input : usual script callback input params
// Output : SCR_tde_Anl_ReturnValue
//-----------------------------------------------------------------------------
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
//-----------------------------------------------------------------------------
// Modification date : Modification Author :
// Modifications :
//------------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue TSN_Event::m_fn_eLoad(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
TSN_Event *pEvent;
CString csName,csTemp;
int iPos;
tdeMissingCriteria eAns;
SCR_tdst_Sect_Open *pOpenSection;
SND_tdstBlockEvent *pEngineEvent;
switch (cType)
{
case SCR_EA_Anl_BeginSection:// Creation of event :
// Create event:
pEvent=new TSN_Event();
SCR_M_RdL0_SetSectionLong(0,0,(unsigned long)pEvent);
g_poSNDEDITInterface->m_EdiEventList.AddTail(pEvent);
// Transform the SndEventE in SndEventM:
csName=SCR_M_RdL0_GetCompleteSectionNameR(0);
iPos=csName.Find("SndEventE");
if (iPos!=-1) csName.SetAt(iPos+8,'M');
// set the engine event pointer is event is loaded:
pOpenSection=SCR_fnp_st_RdL0_GetOpenSection((char*)(LPCTSTR)csName,0);
if (pOpenSection!=NULL) // engine evnt is loaded
{
pEngineEvent=(SND_tdstBlockEvent *)SCR_M_ul_RdL0_ExtractLongValue(&pOpenSection->stSectionValues,0);
if (pEngineEvent!=pEvent->m_pEngineEvent)
{
pEvent->fn_vUpdateData(pEngineEvent);
pEvent->m_pEngineEvent=pEngineEvent;
}
pEvent->SetAvailable(TRUE);
}
pEvent->SetReferencedSectionName(csName);
break;
case SCR_EA_Anl_Entry:// event data:
SCR_M_RdL0_GetSectionLong(0,0,TSN_Event *,pEvent);
if (strcmp(szAction,"SetName")==0)
{
// Compute csb name, without the '.csb' extension:
csName=SCR_M_RdL0_GetFileNameR(0);
csTemp=csName.Left(csName.GetLength()-4);
// crate event name as registered in name list:
csName.Format("SND_%s_%s",szParams[0],csTemp);
eAns=pEvent->fn_eRename(csName);
if (eAns!=E_mc_None)
{
csTemp.Format("Sound Editor Event Creation error: Name SND_%s incorrect(already exists or syntax incorrect)!",csName);
AfxMessageBox(csTemp);
}
// We have the event group's name: no need to continue this section analysis:
return SCR_ERV_Anl_TerminateCurrentSection;
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
//-----------------------------------------------------------------------------
// Name : TSN_Event:GetData()
//-----------------------------------------------------------------------------
// Description : TSN_Event object constructor.
// Creates a new TSN_Event object, for the event object server
//-----------------------------------------------------------------------------
// Input : void
// Output : void
//-----------------------------------------------------------------------------
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
//-----------------------------------------------------------------------------
// Modification date : Modification Author :
// Modifications :
//------------------------------------------------------------------------------*/
/*
void *TSN_Event::GetData(void)
{
SCR_tdst_Cxt_Values* pContext;
static BOOL bInDataModif=FALSE;
SND_tdstBlockEvent *pNewEvent;
// If we already stocked the event pointer, it is supposed to be good:
if (m_pEngineEvent!=NULL) return(void *)m_pEngineEvent;
if (g_poSNDEDITInterface->GetInterface()->fn_bIsLoadingWorld())
return (void *)m_pEngineEvent;
// This is for fn_vUpdateData, which calls GetData() and must get the old pointer:
if (bInDataModif) return (void *)m_pEngineEvent;
// We never LOAD the data here -> the section must have already be loaded by someone else:
if (SCR_fnp_st_RdL0_GetOpenSection((char*)(LPCTSTR)GetReferencedSectionName(),0)==NULL)
return NULL;
// The event is loaded: get its pointer :
pContext=SCR_fnp_st_RdL0_AnalyseSection(
(char*)(LPCTSTR)GetReferencedSectionName(),SCR_CDF_uw_Anl_Normal);
pNewEvent=(SND_tdstBlockEvent *)SCR_M_ul_RdL0_ExtractLongValue(pContext,0);
if (pNewEvent!=NULL)
{
bInDataModif=TRUE;
fn_vUpdateData(pNewEvent);
m_pEngineEvent=pNewEvent;
bInDataModif=FALSE;
}
return (void *)m_pEngineEvent;
}
*/
void *TSN_Event::GetData(void)
{
return (void *)m_pEngineEvent;
}
//-----------------------------------------------------------------------------
// Name : TSN_Event:TSN_Event()
//-----------------------------------------------------------------------------
// Description : TSN_Event object constructor.
// Creates a new TSN_Event object, for the event object server
//-----------------------------------------------------------------------------
// Input : usual script callback input params
// Output : SCR_tde_Anl_ReturnValue
//-----------------------------------------------------------------------------
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
//-----------------------------------------------------------------------------
// Modification date : Modification Author :
// Modifications :
//------------------------------------------------------------------------------*/
TSN_Event::TSN_Event():
CPA_SaveObject(g_poSNDEDITInterface,C_szSoundEventTypeName,
E_ss_NoSave,
NULL, // pOwner
TRUE, // bAvailaible
"", // p_szDataPath
NULL) // pSaveCallback
{
m_pEngineEvent=NULL;
SetAvailable(FALSE);
}
BOOL TSN_Event::fn_bEngineLoad()
{
SCR_tdst_Cxt_Values* pContext;
SND_tdstBlockEvent *pNewEvent;
// The event is loaded: get its pointer :
pContext=SCR_fnp_st_RdL0_AnalyseSection(
(char*)(LPCTSTR)GetReferencedSectionName(),
SCR_CDF_uw_Anl_Normal);
pNewEvent=(SND_tdstBlockEvent *)SCR_M_ul_RdL0_ExtractLongValue(pContext,0);
if (pNewEvent!=m_pEngineEvent)
{
fn_vUpdateData(pNewEvent);
m_pEngineEvent=pNewEvent;
}
SetAvailable(TRUE);
return TRUE;
}

View File

@@ -0,0 +1,145 @@
#include "StdAfx.h"
#include "LST.hpp"
#include "SCR.h"
#include "SIF.h"
#include "SifLoadS.h"
#include "ITF/cpasaveo.hpp" // For TSN_Event&SIF_InfoValue class definition
#include "acp_base.h" // for CPA_Tooldllb class definition
#include "ITF/tooldllb.hpp" // for CPA_Tooldllb class definition
#include "SNinterf.hpp"
class SIF_InfoValue: public CPA_SaveObject
{
public:
// virtual CString fn_csGetReferencedSectionName (void);
SIF_InfoValue::SIF_InfoValue(
CString _csFileName,CString _csTypeName,CString _csValueName);
virtual void* GetData(void) { return (void*)m_lValue; };
virtual long GetDataType(void) { return -1;}
long m_lValue;
static CPA_List<SIF_InfoValue> m_sObjectList;
static void DeleteAllValues(void);
};
CPA_List<SIF_InfoValue> SIF_InfoValue::m_sObjectList;
SIF_InfoValue::SIF_InfoValue(CString _csFileName,CString _csTypeName,CString _csValueName):
CPA_SaveObject( g_poSNDEDITInterface,
"SIF_"+_csTypeName,
E_ss_NoSave,
NULL, // pOwner
TRUE, // bAvailaible
"",// p_szDataPath
NULL) // pSaveCallback
{
tdeMissingCriteria eAns;
CString csSectionName,csTemp;
// Create and set object name:
eAns=fn_eRename("SIF_"+_csValueName);
if (eAns!=E_mc_None)
{
csTemp.Format("Sound Information Value Creation error: Name SIF_%s incorrect(already exists or syntax incorrect)!",_csValueName);
AfxMessageBox(csTemp);
}
// Create and set section name:
csSectionName=_csFileName+"^Sif_Type:"+_csTypeName+"^Sif_Value:"+_csValueName;
SetReferencedSectionName(csSectionName);
m_lValue=-1;
}
void SIF_InfoValue::DeleteAllValues(void)
{
SIF_InfoValue* pValue;
POSITION Pos=NULL;
while (pValue=m_sObjectList.GetNextElement(Pos)) delete pValue;
}
BOOL TSN_fn_bInitSoundInfos(const char* _szFileName)
{
static BOOL bFirstInit=TRUE;
int iInfoType;
char szCompleteName[256],szFileName[256],szActionName[256],szIdName[256];
CString csSectionName,csValueName;
unsigned int uiPos;
SCR_tdst_Link_Value *p_stValue;
unsigned long ulValue;
char* pszSectionName;
SCR_tdst_Link_Table *pTable;
SIF_InfoValue *pInfoValue;
SCR_fnp_st_RdL0_AnalyseSection((char*)_szFileName, SCR_CDF_uw_Anl_Normal);
// Scan each link table:
for (iInfoType=0;iInfoType<SIF_fn_iGetSoundInfosCount();iInfoType++)
{
pTable=&SIF_fn_pstGetSoundInfosDescriptor(iInfoType)->m_Table;
// Get first element of array :
uiPos = 0;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value,uiPos,p_stValue,
SCR_M_st_Link_GetDynamicArray(pTable));
while(p_stValue) // p_sValue is NULL at the end of the array
{
// Test current retrieved value:
if(SCR_M_e_Link_GetState(p_stValue) != SCR_ELS_Link_Initialized) continue;
// Get section complete name & value:
ulValue=SCR_M_ul_Link_GetValue(p_stValue);
pszSectionName=SCR_M_p_sz_Link_GetKey(p_stValue);
// Transform "ed_main.sif^SIF_Type:Material^SIF_Value:Wood" into:
// File:ed_main.sif / Type: Material /Value: Wood
// Split the section name, first pass:
SCR_fn_v_RdL0_SplitSectionName(pszSectionName,
szFileName,szActionName,szIdName);
// With the example: szFileName="ed_main.sif^SIF_Type:Material",
// szActionName="SIF_Value",szIdName="Wood".
// Save the value name, & second pass:
csValueName=szIdName;
strcpy(szCompleteName,szFileName);
SCR_fn_v_RdL0_SplitSectionName(szCompleteName,
szFileName,szActionName,szIdName);
// With the example: szFileName="ed_main.sif",
// szActionName="SIF_Type",szIdName="Material".
// Create an InfoValue object(Value,Type,File names):
pInfoValue= new SIF_InfoValue(szFileName,szIdName,csValueName);
// Set the handle to the proper value(value init need not call fn_vSetValue()):
pInfoValue->m_lValue=ulValue;
// Get next element :
uiPos++;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value,uiPos,p_stValue,
SCR_M_st_Link_GetDynamicArray(pTable));
}
}
return TRUE;
}
BOOL TSN_fn_bDesInitSoundInfos(void)
{
SIF_InfoValue::DeleteAllValues();
return TRUE;
}

View File

@@ -0,0 +1,132 @@
//
// Common functions for Object DLL capabilities
// C. Beaudet
//
#include "stdafx.h"
#include "afxdllx.h"
#include "ACP_Base.h"
#include "ITF.h"
#include "SNinterf.hpp"
#include "x:\cpa\main\inc\_editid.h"
//------------------------------------------------------------------------
// Global vars
static char *gs_p_szCPAVersion = C_szCPAVersion;
static AFX_EXTENSION_MODULE NEAR extensionDLL = { NULL, NULL };
#ifdef DLL_ONLY_ONE_INSTANCE
static SNDEDIT_Interface g_oSNDEDITInterface;
/*
#else
SNDEDIT_Interface* g_poSNDEDITInterface=NULL;
*/
#endif
//------------------------------------------------------------------------
// functions that are present in all DLL :
//------------------------------------------------------------------------
static CList<CPA_DLLBase*,CPA_DLLBase*> g_oListOfInstances; //private internal
//========================================================================
// Get current CPA version
//========================================================================
/*extern "C"*/ char __declspec(dllexport) *fn_p_szGetCPAVersion(void)
{
return gs_p_szCPAVersion;
}
//========================================================================
// Get type of this DLL
//========================================================================
extern "C" tdstDLLIdentity __declspec(dllexport) *fn_p_stGetDLLIdentity(void)
{
g_stSNDEDITIdentity . eType = TOOL_DLL;
g_stSNDEDITIdentity . csName = C_szDLLSoundName;
g_stSNDEDITIdentity . hModule = NULL;
g_stSNDEDITIdentity . p_oListOfInstances = &g_oListOfInstances;
return &g_stSNDEDITIdentity;
}
//========================================================================
// DLL int function
//========================================================================
extern "C" void __declspec(dllexport) fn_vInitDll(void)
{
new CDynLinkLibrary(extensionDLL);
}
//========================================================================
// DLL entry point
//========================================================================
extern "C" int __stdcall DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
// SND_hGlobalInst=hInstance;
if (!AfxInitExtensionModule(extensionDLL, hInstance))
return 0;
}
return 1;
}
//========================================================================
// Get the DLL
//========================================================================
extern "C" CPA_ToolDLLBase __declspec(dllexport) *fn_p_oGetDLL(long lKey)
{
#ifdef DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
if (g_poSNDEDITInterface == NULL)
{
g_poSNDEDITInterface = new SNDEDIT_Interface();
ASSERT(g_poSNDEDITInterface != NULL);
}
return g_poSNDEDITInterface;
break;
default:
return NULL;
}
#else //DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
/*
ASSERT(g_poSNDEDITInterface==NULL);
g_poSNDEDITInterface=new SNDEDIT_Interface();
return g_poSNDEDITInterface;
*/
return new SNDEDIT_Interface();
break;
default:
return NULL;
}
#endif //DLL_ONLY_ONE_INSTANCE
}
//------------------------------------------------------------------------
// functions that are present in this type of DLL only :
//------------------------------------------------------------------------
#undef DLL_ONLY_ONE_INSTANCE

View File

@@ -0,0 +1,744 @@
//#################################################################################
//
// BASE CLASS OF YOUR DLL interface
//
//#################################################################################
#include "stdafx.h"
#include "SCR.h"
#include "SND.h"
#include "sndld_s.h" // for SND_pstGetEventGroupLinkTable...
#include "sndld_hy.h" // for SND_fn_czGetProjectTitle...
#include "snddbg.h" // for SND_fn_pstGetSelectedResource && SND_fn_bDoesSupervisaterSelectResource
#include "sndres.h" // for tdstBlockResourceMem type use
#include "acp_base.h" // for CPA_Tooldllb class definition
#include "incITF.h" // for CPA_Tooldllb class definition
#include "SNinterf.hpp"
#include "TSNEvent.h"
#include "SIF.h" // Sound info server..
//#include "Sifloads.h" //for SIF_fn_pstGetSoundInfosDescriptor
#include "x:\cpa\main\inc\_editid.h" //Object type names..
/*
#include "ITF/cpasaveo.hpp" // For TSN_Event&SIF_InfoValue class definition
#include "LST/cpalist.hpp" // for the CPA_List defined in the SIF_InfoType object
#include "ITF/CPAProj.hpp" // for M_GetMainWnd()
//static CList<CPA_DLLBase*,CPA_DLLBase*> g_oListOfInstances; //private internal
#define C_lEDST_Active 1
#define C_lEDST_Inactive 0
*/
// the DLL global definition
tdstDLLIdentity g_stSNDEDITIdentity;
SNDEDIT_Interface* g_poSNDEDITInterface=NULL;
//--------------------------------------------------------------------------------
// CONSTRUCTOR.
// You must put here all your DLL interface definitions.
//--------------------------------------------------------------------------------
SNDEDIT_Interface::SNDEDIT_Interface(void)
{
SetEditorInfo( "Sound", "Fr<EFBFBD>d<EFBFBD>ric D<>cr<63>au", "v6.0.0", "","");
// ************************** private internal
m_p_stDLLIdentity = &g_stSNDEDITIdentity;
// Name of your .INI file.
// m_stBaseDLLDefinition.p_cIniName = NULL;
// Does your DLL can output in main game view ?
m_stBaseDLLDefinition.bCanOutputIn3DView = FALSE;
// Does your DLL can be refresh by engine ?
m_stBaseDLLDefinition.bCanBeRefreshedByEngine = FALSE;
m_bEditorEnabled=FALSE;
m_uiTimerId=NULL;
}
SNDEDIT_Interface::~SNDEDIT_Interface(void)
{
POSITION Pos;
TSN_Event *pEvent;
// delete events:
Pos=NULL;
while (pEvent=m_EdiEventList.GetNextElement(Pos)) delete pEvent;
fn_vDestroyResList();
TSN_fn_bDesInitSoundInfos();
}
void SNDEDIT_Interface::fn_vJustAfterRegistered(void)
{
int iTypeNum;
int iNbTypes,iNbInfoTypes;
CString *pa_csTypes;
//*******************************************************
//* Register the CPA_SaveObject types *
//*******************************************************
// Number of CPA_SaveObject types: 1 for sound events + 1 for each info type:
iNbInfoTypes=SIF_fn_iGetSoundInfosCount();
iNbTypes=iNbInfoTypes+1;
pa_csTypes= new CString[iNbTypes];
for (iTypeNum=0;iTypeNum<iNbInfoTypes;iTypeNum++)
pa_csTypes[iTypeNum]=CString("SIF_")+SIF_fn_czGetSoundInfoNameForType(iTypeNum);
pa_csTypes[iNbInfoTypes]=C_szSoundEventTypeName;
fn_vRegisterObjectsType(pa_csTypes, iNbTypes);
delete[] pa_csTypes;
}
void SNDEDIT_Interface::fn_vConstruct(void)
{
ASSERT(g_poSNDEDITInterface==NULL);
g_poSNDEDITInterface=this;
}
void SNDEDIT_Interface::fn_vLevelChanges (void)
{
SCR_tdst_Link_Table *p_stTable;
SCR_tdst_Link_Value *p_stValue;
unsigned int uiPos;
CString csName,csTemp;
SCR_tdst_Anl_Callback *pCallback;
SCR_tdpfn_Anl_Callback pOldSndResM_CB;
SCR_tdpfn_Anl_Callback pOldSndEventM_CB;
static BOOL bFirstLevelChange=TRUE;
if (bFirstLevelChange)
{
// Set the script callback fot the editor event:
SCR_fn_v_RdL0_RegisterCallback("SndEventE",TSN_Event::m_fn_eLoad,SCR_CRC_c_RdL0_ForSection);
bFirstLevelChange=FALSE;
}
else
{
AfxMessageBox(" Sound Editor Error: Second level Change not implemented yet!");
return;
}
// Add a message in the status bar:
M_GetMainWnd()->UpdateStatus("Loading sound data",C_STATUSPANE_INFOS,C_STATUS_NORMAL);
// Save and delete script callbacks on SndResourceM and SndEventM:
pCallback=SCR_fnp_st_RdL0_GetRegisterCallback("SndResourceM",SCR_CRC_c_RdL0_ForSection);
pOldSndResM_CB=pCallback->pfn_eCallback;
pCallback=SCR_fnp_st_RdL0_GetRegisterCallback("SndEventM",SCR_CRC_c_RdL0_ForSection);
pOldSndEventM_CB=pCallback->pfn_eCallback;
SCR_fn_v_RdL0_DeleteRegisterCallback("SndResourceM",SCR_CRC_c_RdL0_ForSection, SCR_CDR_c_RdL0_Match);
SCR_fn_v_RdL0_DeleteRegisterCallback("SndEventM",SCR_CRC_c_RdL0_ForSection, SCR_CDR_c_RdL0_Match);
csName=SND_fn_czGetProjectTitle();
csName+=".sif";
TSN_fn_bInitSoundInfos(csName);
// Scan event groups:
// Get first list element:
uiPos = 0;
p_stTable=SND_pstGetEventGroupLinkTable();
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value,uiPos,p_stValue,
SCR_M_st_Link_GetDynamicArray(p_stTable));
while(p_stValue) // p_sValue is NULL at the end of the array
{
if(SCR_M_e_Link_GetState(p_stValue) != SCR_ELS_Link_Initialized) continue;
// Get event group name:
csName=SCR_M_p_sz_Link_GetKey(p_stValue);
// Update status bar:
csTemp.Format("Loading sound bank: %s",csName);
M_GetMainWnd()->UpdateStatus((char*)(LPCTSTR)csTemp,C_STATUSPANE_INFOS,C_STATUS_NORMAL);
csName+=".csb";
SCR_fnp_st_RdL0_AnalyseSection((char*)(LPCTSTR)csName, SCR_CDF_uw_Anl_Normal);
uiPos++;
SCR_M_DyAr_GetNextElement(SCR_tdst_Link_Value,uiPos,p_stValue,
SCR_M_st_Link_GetDynamicArray(SND_pstGetEventGroupLinkTable()));
}
// Reset the script callbacks we deleted:
unsigned char ucOldMemLevel = SCR_fn_uc_Mem_GetCurrentLevel();
SCR_fn_v_Mem_SetCurrentLevel(0);
SCR_fn_v_RdL0_RegisterCallback("SndResourceM",pOldSndResM_CB,SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback("SndEventM",pOldSndEventM_CB,SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_Mem_SetCurrentLevel(ucOldMemLevel);
// Sound load finished:
M_GetMainWnd()->UpdateStatus("",C_STATUSPANE_INFOS,C_STATUS_NORMAL);
};
void SNDEDIT_Interface::fn_vBeforeEngine()
{
if (!m_bEditorEnabled) return;
ASSERT(m_uiTimerId==NULL);
m_uiTimerId=timeSetEvent(10,10,m_fn_vTimerProc,NULL,TIME_ONESHOT);
ASSERT(m_uiTimerId!=NULL);
}
void SNDEDIT_Interface::fn_vBeforeEditor()
{
char szPath[MAX_PATH];
MMRESULT mReturn;
if (!m_bEditorEnabled) return;
ASSERT(m_uiTimerId!=NULL);
mReturn=timeKillEvent(m_uiTimerId);
ASSERT(mReturn==TIMERR_NOERROR);
m_uiTimerId=NULL;
// Record modified resources:
IResource IRes;
LPDISPATCH lpDispatch;
POSITION Pos;
tdstBlockResourceMem* pResM;
if (m_ModifiedResList.IsEmpty()) return;
Pos=NULL;
while (pResM=m_ModifiedResList.GetNextElement(Pos))
{
// Find corresponding resource in editor:
lpDispatch=m_IEditor.FindResFromEditorId(pResM->Id);
if (lpDispatch!=NULL)
{
IRes.AttachDispatch(lpDispatch);
// Change the volume in the editor:
IRes.SetVolume(pResM->ucVolume);
IRes.DetachDispatch();
}
}
// Open the sound project:
GetTempPath(MAX_PATH,szPath);
strcat(szPath,"\\");
strcat(szPath,"TSltemp.tmp");
SCR_fn_v_SvL1_RegisterNotify(szPath,mfn_vNotificationCallback,NULL,SCR_EA_Ntfy_AddOrRebuildSection);
m_ModifiedResList.RemoveAll();
}
void CALLBACK EXPORT SNDEDIT_Interface::m_fn_vTimerProc(
UINT uID, // event ID
UINT nMsg, // Reserved
DWORD dwUser, // user data
DWORD dw1,DWORD dw2 // Reserved
)
{
IResource IRes;
tdstBlockResourceMem* pResM;
long lTemp;
POSITION Pos=NULL;
BOOL bKeyPressed=FALSE;
if (IPT_fn_bIsJustValidated(g_poSNDEDITInterface->m_hSoundResourceVolumeUp)==IPT_C_TRUE)
{
bKeyPressed=TRUE;
lTemp=1;
}
if (IPT_fn_bIsJustValidated(g_poSNDEDITInterface->m_hSoundResourceVolumeDown)==IPT_C_TRUE)
{
bKeyPressed=TRUE;
lTemp=-1;
}
if (IPT_fn_bIsJustValidated(g_poSNDEDITInterface->m_hSoundResourceVolumeUpFast)==IPT_C_TRUE)
{
bKeyPressed=TRUE;
lTemp=10;
}
if (IPT_fn_bIsJustValidated(g_poSNDEDITInterface->m_hSoundResourceVolumeDownFast)==IPT_C_TRUE)
{
bKeyPressed=TRUE;
lTemp=-10;
}
if (!bKeyPressed) goto procend_label;
if (!SND_fn_bDoesSupervisaterSelectResource()) goto procend_label;
pResM=SND_fn_pstGetSelectedResource();
if (pResM==NULL) goto procend_label;
// Compute new volume and check bounds:
lTemp+=(long)pResM->ucVolume;
if ((lTemp<0)||(lTemp>127)) goto procend_label;
// Change the volume in the game:
pResM->ucVolume=(unsigned char)lTemp;
if (g_poSNDEDITInterface->m_ModifiedResList.Find(pResM)==NULL)
g_poSNDEDITInterface->m_ModifiedResList.AddTail(pResM);
procend_label:
//resend the timer:
if (g_poSNDEDITInterface->m_uiTimerId!=NULL)
{
g_poSNDEDITInterface->m_uiTimerId=timeSetEvent(10,10,m_fn_vTimerProc,NULL,TIME_ONESHOT);
ASSERT(g_poSNDEDITInterface->m_uiTimerId!=NULL);
}
}
BOOL SNDEDIT_Interface::fn_bLoadBaseObject(CPA_BaseObject *p_oObject)
{
TSN_Event *pEvent=(TSN_Event *)p_oObject;
return (pEvent->fn_bEngineLoad());
}
BOOL SNDEDIT_Interface::fn_bDefineSubMenu(EDT_SubMenu *_pSubMenu)
{
switch(_pSubMenu->GetSubMenuType())
{
case C_SubMenuEditor:
break;
case C_SubMenuTool: //AddAnEntry args: Owner,Text,Id,_bCheck,_bEnable.
_pSubMenu->AddAnEntry(this,"Enable Sound Mixing",1,m_bEditorEnabled,TRUE);
break;
}
return TRUE;
}
void SNDEDIT_Interface::_OnSubMenuCommand(EDT_SubMenu *_pSubMenu,UINT uiMsgId)
{
char szName[MAX_PATH],szPath[MAX_PATH];
switch (_pSubMenu->GetSubMenuType())
{
case C_SubMenuEditor:
break;
case C_SubMenuTool:
switch (uiMsgId)
{
case 1:
//***********************************************
//* Initialize sound editor *
//***********************************************
// OLE DLL initailisation:
if (!AfxOleInit())
{
AfxMessageBox("OLE Init failed. Check the OLE DLL versions.");
return;
}
// Sound editor int:
if (!m_IEditor.CreateDispatch(_T("SoundEditor.Document")))
{
AfxMessageBox("Could not load the sound editor");
return;
}
// Open the sound project:
strcpy(szName,SND_fn_czGetProjectTitle());
strcat(szName,".lcb");
SND_fn_vResolveFileName(szName,szPath);
SND_fn_bGetCurrentDirectory(szName,MAX_PATH);
strcat(szName,"\\");
strcat(szName,szPath);
if (!m_IEditor.OpenDocument(szName))
{
AfxMessageBox("Could not open the sound project");
return;
}
// *** Init Sound resource mixing keys //
m_hSoundResourceVolumeUp = IPT_fn_hGetEntryActionHandle("SndResVolumeUp");
m_hSoundResourceVolumeDown= IPT_fn_hGetEntryActionHandle("SndResVolumeDown");
m_hSoundResourceVolumeUpFast= IPT_fn_hGetEntryActionHandle("SndResVolumeUpFast");
m_hSoundResourceVolumeDownFast= IPT_fn_hGetEntryActionHandle("SndResVolumeDownFast");
if (m_hSoundResourceVolumeUp==NULL) return;
if (m_hSoundResourceVolumeDown==NULL) return;
if (m_hSoundResourceVolumeUpFast==NULL) return;
if (m_hSoundResourceVolumeDownFast==NULL) return;
fn_vFillResList();
SND_fn_vSetResNameCallback(fn_czGetResNameFromEdId);
m_bEditorEnabled=TRUE;
break;
}
break;
}
}
void SNDEDIT_Interface::mfn_vNotificationCallback(SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName, void *_pvData, SCR_tde_Ntfy_Action _eAction)
{
char szName[MAX_PATH],szPath[MAX_PATH];
switch (_eAction)
{
case SCR_EA_Ntfy_AddSection:
case SCR_EA_Ntfy_ModifySection:
case SCR_EA_Ntfy_RebuildSection:
case SCR_EA_Ntfy_AddOrModifySection:
case SCR_EA_Ntfy_AddOrRebuildSection:
strcpy(szName,SND_fn_czGetProjectTitle());
strcat(szName,".lcb");
SND_fn_vResolveFileName(szName,szPath);
SND_fn_bGetCurrentDirectory(szName,MAX_PATH);
strcat(szName,"\\");
strcat(szName,szPath);
g_poSNDEDITInterface->m_IEditor.SaveDocument(szName);
break;
case SCR_EA_Ntfy_DeleteIfExists:
case SCR_EA_Ntfy_DeleteSection:
case SCR_EA_Ntfy_Dummy:
break;
}
}
/* OLD FUNCTIONS:
BOOL SNDEDIT_Interface::fn_bDefineSubMenu(EDT_SubMenu *_pSubMenu)
{
switch(_pSubMenu->GetSubMenuType())
{
case C_SubMenuEditor:
if (!fn_bIsCurrentEditor())
_pSubMenu->AddAnEntry(this, "Sound Editor", C_uiOpenID, FALSE);
else
_pSubMenu->AddAnEntry(this, "Sound Editor", C_uiCloseID, TRUE);
break;
case C_SubMenuTool:
if (fn_bIsCurrentEditor())
{
_pSubMenu->AddAnEntry(this,"Save sound data",1,FALSE);
_pSubMenu->AddAnEntry(this,"Dump sound events in map",2,FALSE);
_pSubMenu->AddAnEntry(this,"Check sample<->resource coherence",3,FALSE);
_pSubMenu->AddAnEntry(this,"Load all sound banks",4,FALSE);
}
break;
}
return TRUE;
}
void SNDEDIT_Interface::_OnSubMenuCommand(EDT_SubMenu *_pSubMenu,UINT uiMsgId)
{
CString csDataPath;
CString csLCBName,csSITName;
POSITION Pos;
SND_EventGroup *pGroup;
switch (_pSubMenu->GetSubMenuType())
{
case C_SubMenuEditor:
switch (uiMsgId)
{
case C_uiOpenID:
if (!fn_bIsCurrentEditor())
GetMainWorld()->fn_bActivateEditor(this, NULL);
break;
case C_uiCloseID:
if (fn_bIsCurrentEditor())
GetMainWorld()->fn_bCloseEditor(this);
break;
}
break;
case C_SubMenuTool:
switch (uiMsgId)
{
case 1: // Save Sound data:
// Get the lcb name:
csLCBName="ed_main.lcb";
csSITName="ed_main.sit";
csDataPath=m_Editor.m_fn_csGetSoundDirectory();
csLCBName=csDataPath+"ed_main.lcb";
m_Editor.m_fn_bSaveData((char*)(LPCTSTR)csLCBName);
break;
case 2: // Dump events in map:
m_Editor.m_fn_vDumpEventsInMap();
break;
case 3: //Check sample<->resource coherence:
m_Editor.m_fn_vCheckSampleResCoherence();
break;
case 4: //Load all sound banks:
Pos=NULL;
while (pGroup=m_Editor.m_fn_poGetEventGroupList()->GetNextElement(Pos))
if (!pGroup->fn_bIsLoaded()) pGroup->fn_bLoadData();
break;
}
break;
}
}
void CALLBACK EXPORT SNDEDIT_Interface::m_fn_vTimerProc(HWND hWnd, // handle of CWnd that called SetTimer
UINT nMsg, // WM_TIMER
UINT nIDEvent, // timer identification
DWORD dwTime // system time
)
{
SND_ResourceView *pResView;
SND_EdiRes* pRes;
static SND_EdiRes* s_pEditedRes=NULL;
tdstBlockResourceMem* pResM;
long lTemp;
unsigned long ulEvtGrpId;
POSITION Pos=NULL;
BOOL bKeyPressed=FALSE;
if (IPT_fn_bIsJustValidated(g_poSNDEDITInterface->m_hSoundResourceVolumeUp)==IPT_C_TRUE)
{
bKeyPressed=TRUE;
lTemp=1;
}
if (IPT_fn_bIsJustValidated(g_poSNDEDITInterface->m_hSoundResourceVolumeDown)==IPT_C_TRUE)
{
bKeyPressed=TRUE;
lTemp=-1;
}
if (IPT_fn_bIsJustValidated(g_poSNDEDITInterface->m_hSoundResourceVolumeUpFast)==IPT_C_TRUE)
{
bKeyPressed=TRUE;
lTemp=10;
}
if (IPT_fn_bIsJustValidated(g_poSNDEDITInterface->m_hSoundResourceVolumeDownFast)==IPT_C_TRUE)
{
bKeyPressed=TRUE;
lTemp=-10;
}
if (bKeyPressed)
{
if (SND_fn_bDoesSupervisaterSelectResource())
{
pResM=SND_fn_pstGetSelectedResource();
if (pResM==NULL) return;
if ((s_pEditedRes==NULL)||(s_pEditedRes->GetStruct()!=pResM))
{ // selected resource changed: get new corresponding editor res:
ulEvtGrpId=HIWORD(pResM->Id); // Get event group id:
// Get corresponding event group:
SND_EventGroup* pGroup;
Pos=NULL;
while(pGroup=g_poSNDEDITInterface->m_Editor.m_fn_poGetEventGroupList()->GetNextElement(Pos))
if (pGroup->fn_ulGetId()==ulEvtGrpId) break;
if (pGroup==NULL) return; // event group not found;
// Load event group if not yet loaded:
if (!pGroup->fn_bIsLoaded()) pGroup->fn_bLoadData();
// find resource in the group:
Pos=NULL;
while(s_pEditedRes=pGroup->m_ResList.GetNextElement(Pos))
if (s_pEditedRes->GetStruct()==pResM) break;
if (s_pEditedRes==NULL) return;
}
// Add ltemp to this resource's volume:
lTemp+=(long)s_pEditedRes->m_oBRDisk.ucVolume;
if ((lTemp>=0)&&(lTemp<=127))
{
s_pEditedRes->m_oBRDisk.ucVolume=(unsigned char)lTemp;
s_pEditedRes->GetStruct()->ucVolume=(unsigned char)lTemp;
s_pEditedRes->m_pGroup->fn_vNotifyRebuild();
MessageBeep(MB_ICONEXCLAMATION);
pResView=(SND_ResourceView *)g_poSNDEDITInterface->m_pSplitFrame->m_fn_p_oGetPane(2);
pResView->OnUpdate(0,0,0);
}
}
else
{
pResView=(SND_ResourceView *)g_poSNDEDITInterface->m_pSplitFrame->m_fn_p_oGetPane(2);
while (pRes=pResView->m_EditedResList.GetNextElement(Pos))
{
// Add ltemp to this resource's volume:
lTemp+=(long)pRes->m_oBRDisk.ucVolume;
if ((lTemp>=0)&&(lTemp<=127))
{
pRes->m_oBRDisk.ucVolume=(unsigned char)lTemp;
pRes->GetStruct()->ucVolume=(unsigned char)lTemp;
pRes->m_pGroup->fn_vNotifyRebuild();
MessageBeep(MB_ICONEXCLAMATION);
pResView->OnUpdate(0,0,0);
}
}
}
}
*/
/*
const char * SNDEDIT_Interface::fn_czGetResNameFromEdId(unsigned long _ulId)
{
if (g_poSNDEDITInterface->m_bEditorEnabled==FALSE) return "";
IResource IRes;
LPDISPATCH lpDispatch;
CString csName;
// Find corresponding resource in editor:
lpDispatch=g_poSNDEDITInterface->m_IEditor.FindResFromEditorId(_ulId);
if (lpDispatch==NULL) return "Unknown Id";
IRes.AttachDispatch(lpDispatch);
csName=IRes.GetName();
IRes.DetachDispatch();
return csName;
}
*/
const char * SNDEDIT_Interface::fn_czGetResNameFromEdId(unsigned long _ulId)
{
short wEventGroupId,wResId;
POSITION Pos;
TSN_ResList *pResList;
TSN_Res *pRes;
wEventGroupId=HIWORD(_ulId);
wResId=LOWORD(_ulId);
if (g_poSNDEDITInterface->m_bEditorEnabled==FALSE) return "";
Pos=NULL;
while (pResList=g_poSNDEDITInterface->m_ResListList.GetNextElement(Pos))
if (pResList->m_wId==wEventGroupId) break;
if (pResList==NULL) return "Unknown Id";
Pos=NULL;
while (pRes=pResList->m_ResList.GetNextElement(Pos))
if (pRes->m_wId==wResId) break;
if (pRes==NULL) return "Unknown Id";
return pRes->m_csName;
}
void SNDEDIT_Interface::fn_vFillResList()
{
IEventGroups IGroups;
IEventGroup IGroup;
IResources IResList;
TSN_ResList *pResList;
TSN_Res *pRes;
IResource IRes;
int iNbGroups,iGroupNum,iNbRes,iResNum;
IGroups.AttachDispatch(m_IEditor.GetEventGroups());
iNbGroups=IGroups.GetCount();
for (iGroupNum=0;iGroupNum<iNbGroups;iGroupNum++)
{
IGroup.AttachDispatch(IGroups.Item(iGroupNum));
pResList=new TSN_ResList();
pResList->m_csName=IGroup.GetName();
pResList->m_wId=(short)IGroup.GetId();
m_ResListList.AddTail(pResList);
IResList.AttachDispatch(IGroup.GetResources());
iNbRes=IResList.GetCount();
for (iResNum=0;iResNum<iNbRes;iResNum++)
{
IRes.AttachDispatch(IResList.Item(iResNum));
pRes=new TSN_Res();
pRes->m_csName=IRes.GetName();
pRes->m_wId=(short)IRes.GetId();
pResList->m_ResList.AddTail(pRes);
IRes.DetachDispatch();
}// end group scan
IGroup.DetachDispatch();
}// end group scan
}
void SNDEDIT_Interface::fn_vDestroyResList()
{
POSITION Pos,SubPos;
TSN_ResList *pResList;
TSN_Res *pRes;
Pos=NULL;
while (pResList=m_ResListList.GetNextElement(Pos))
{
SubPos=NULL;
while (pRes=pResList->m_ResList.GetNextElement(SubPos)) delete pRes;
delete pResList;
}
}

View File

@@ -0,0 +1,669 @@
// Machine generated IDispatch wrapper class(es) created with ClassWizard
#include "stdafx.h"
#include "soundeditor.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// ISoundEditor properties
LPDISPATCH ISoundEditor::GetEventGroups()
{
LPDISPATCH result;
GetProperty(0x1, VT_DISPATCH, (void*)&result);
return result;
}
void ISoundEditor::SetEventGroups(LPDISPATCH propVal)
{
SetProperty(0x1, VT_DISPATCH, propVal);
}
long ISoundEditor::GetVersionNumber()
{
long result;
GetProperty(0x2, VT_I4, (void*)&result);
return result;
}
void ISoundEditor::SetVersionNumber(long propVal)
{
SetProperty(0x2, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// ISoundEditor operations
BOOL ISoundEditor::OpenDocument(LPCTSTR csFilename)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x3, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
csFilename);
return result;
}
BOOL ISoundEditor::SaveDocument(LPCTSTR csFilename)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x4, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
csFilename);
return result;
}
BOOL ISoundEditor::AddSoundDirectory(LPCTSTR csPath)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x5, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
csPath);
return result;
}
BOOL ISoundEditor::RebuildBanks()
{
BOOL result;
InvokeHelper(0x6, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL);
return result;
}
BOOL ISoundEditor::SaveLocalizedBanks(LPCTSTR _csDocumentPath, LPCTSTR _csLanguage)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR VTS_BSTR;
InvokeHelper(0x7, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
_csDocumentPath, _csLanguage);
return result;
}
LPDISPATCH ISoundEditor::FindResFromEditorId(long _iId)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_I4;
InvokeHelper(0x8, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
_iId);
return result;
}
/////////////////////////////////////////////////////////////////////////////
// IEventGroup properties
long IEventGroup::GetId()
{
long result;
GetProperty(0x1, VT_I4, (void*)&result);
return result;
}
void IEventGroup::SetId(long propVal)
{
SetProperty(0x1, VT_I4, propVal);
}
CString IEventGroup::GetName()
{
CString result;
GetProperty(0x2, VT_BSTR, (void*)&result);
return result;
}
void IEventGroup::SetName(LPCTSTR propVal)
{
SetProperty(0x2, VT_BSTR, propVal);
}
LPDISPATCH IEventGroup::GetResources()
{
LPDISPATCH result;
GetProperty(0x3, VT_DISPATCH, (void*)&result);
return result;
}
void IEventGroup::SetResources(LPDISPATCH propVal)
{
SetProperty(0x3, VT_DISPATCH, propVal);
}
LPDISPATCH IEventGroup::GetEvents()
{
LPDISPATCH result;
GetProperty(0x4, VT_DISPATCH, (void*)&result);
return result;
}
void IEventGroup::SetEvents(LPDISPATCH propVal)
{
SetProperty(0x4, VT_DISPATCH, propVal);
}
CString IEventGroup::GetFilePath()
{
CString result;
GetProperty(0x5, VT_BSTR, (void*)&result);
return result;
}
void IEventGroup::SetFilePath(LPCTSTR propVal)
{
SetProperty(0x5, VT_BSTR, propVal);
}
long IEventGroup::GetVersionNumber()
{
long result;
GetProperty(0x6, VT_I4, (void*)&result);
return result;
}
void IEventGroup::SetVersionNumber(long propVal)
{
SetProperty(0x6, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// IEventGroup operations
/////////////////////////////////////////////////////////////////////////////
// ISND_EdiBank properties
/////////////////////////////////////////////////////////////////////////////
// ISND_EdiBank operations
/////////////////////////////////////////////////////////////////////////////
// ISND_EdiMap properties
/////////////////////////////////////////////////////////////////////////////
// ISND_EdiMap operations
/////////////////////////////////////////////////////////////////////////////
// IEventGroups properties
long IEventGroups::GetCount()
{
long result;
GetProperty(0x1, VT_I4, (void*)&result);
return result;
}
void IEventGroups::SetCount(long propVal)
{
SetProperty(0x1, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// IEventGroups operations
LPDISPATCH IEventGroups::Item(long Index)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_I4;
InvokeHelper(0x2, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
Index);
return result;
}
LPDISPATCH IEventGroups::FindItem(LPCTSTR csName)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x3, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
csName);
return result;
}
LPDISPATCH IEventGroups::Add(LPCTSTR csName)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x4, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
csName);
return result;
}
BOOL IEventGroups::Remove(LPCTSTR csEventGroupName)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x5, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
csEventGroupName);
return result;
}
LPUNKNOWN IEventGroups::Get_NewEnum()
{
LPUNKNOWN result;
InvokeHelper(0xfffffffc, DISPATCH_PROPERTYGET, VT_UNKNOWN, (void*)&result, NULL);
return result;
}
/////////////////////////////////////////////////////////////////////////////
// IResource properties
CString IResource::GetName()
{
CString result;
GetProperty(0x1, VT_BSTR, (void*)&result);
return result;
}
void IResource::SetName(LPCTSTR propVal)
{
SetProperty(0x1, VT_BSTR, propVal);
}
long IResource::GetVolume()
{
long result;
GetProperty(0x2, VT_I4, (void*)&result);
return result;
}
void IResource::SetVolume(long propVal)
{
SetProperty(0x2, VT_I4, propVal);
}
LPDISPATCH IResource::GetSampleRes()
{
LPDISPATCH result;
GetProperty(0x3, VT_DISPATCH, (void*)&result);
return result;
}
void IResource::SetSampleRes(LPDISPATCH propVal)
{
SetProperty(0x3, VT_DISPATCH, propVal);
}
long IResource::GetType()
{
long result;
GetProperty(0x4, VT_I4, (void*)&result);
return result;
}
void IResource::SetType(long propVal)
{
SetProperty(0x4, VT_I4, propVal);
}
long IResource::GetDataOffset()
{
long result;
GetProperty(0x5, VT_I4, (void*)&result);
return result;
}
void IResource::SetDataOffset(long propVal)
{
SetProperty(0x5, VT_I4, propVal);
}
long IResource::GetDataSize()
{
long result;
GetProperty(0x6, VT_I4, (void*)&result);
return result;
}
void IResource::SetDataSize(long propVal)
{
SetProperty(0x6, VT_I4, propVal);
}
long IResource::GetId()
{
long result;
GetProperty(0x7, VT_I4, (void*)&result);
return result;
}
void IResource::SetId(long propVal)
{
SetProperty(0x7, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// IResource operations
/////////////////////////////////////////////////////////////////////////////
// IResources properties
long IResources::GetCount()
{
long result;
GetProperty(0x1, VT_I4, (void*)&result);
return result;
}
void IResources::SetCount(long propVal)
{
SetProperty(0x1, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// IResources operations
LPDISPATCH IResources::Item(long Index)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_I4;
InvokeHelper(0x2, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
Index);
return result;
}
LPDISPATCH IResources::FindItem(LPCTSTR csName)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x3, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
csName);
return result;
}
LPDISPATCH IResources::Add(LPCTSTR csName)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x4, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
csName);
return result;
}
LPDISPATCH IResources::AddSampleRes(LPCTSTR csName)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x5, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
csName);
return result;
}
BOOL IResources::Remove(LPCTSTR csResName)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x6, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
csResName);
return result;
}
LPUNKNOWN IResources::Get_NewEnum()
{
LPUNKNOWN result;
InvokeHelper(0xfffffffc, DISPATCH_PROPERTYGET, VT_UNKNOWN, (void*)&result, NULL);
return result;
}
/////////////////////////////////////////////////////////////////////////////
// ISampleResource properties
CString ISampleResource::GetFileName()
{
CString result;
GetProperty(0x1, VT_BSTR, (void*)&result);
return result;
}
void ISampleResource::SetFileName(LPCTSTR propVal)
{
SetProperty(0x1, VT_BSTR, propVal);
}
long ISampleResource::GetZipType()
{
long result;
GetProperty(0x2, VT_I4, (void*)&result);
return result;
}
void ISampleResource::SetZipType(long propVal)
{
SetProperty(0x2, VT_I4, propVal);
}
BOOL ISampleResource::GetLoop()
{
BOOL result;
GetProperty(0x3, VT_BOOL, (void*)&result);
return result;
}
void ISampleResource::SetLoop(BOOL propVal)
{
SetProperty(0x3, VT_BOOL, propVal);
}
long ISampleResource::GetStartLoop()
{
long result;
GetProperty(0x4, VT_I4, (void*)&result);
return result;
}
void ISampleResource::SetStartLoop(long propVal)
{
SetProperty(0x4, VT_I4, propVal);
}
long ISampleResource::GetLoopLength()
{
long result;
GetProperty(0x5, VT_I4, (void*)&result);
return result;
}
void ISampleResource::SetLoopLength(long propVal)
{
SetProperty(0x5, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// ISampleResource operations
BOOL ISampleResource::SetSampleData(LPCTSTR csFilename)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x6, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
csFilename);
return result;
}
LPDISPATCH ISampleResource::GetResource()
{
LPDISPATCH result;
InvokeHelper(0x7, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, NULL);
return result;
}
/////////////////////////////////////////////////////////////////////////////
// IEvents properties
long IEvents::GetCount()
{
long result;
GetProperty(0x1, VT_I4, (void*)&result);
return result;
}
void IEvents::SetCount(long propVal)
{
SetProperty(0x1, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// IEvents operations
LPDISPATCH IEvents::Item(long Index)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_I4;
InvokeHelper(0x2, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
Index);
return result;
}
LPDISPATCH IEvents::FindItem(LPCTSTR csName)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x3, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
csName);
return result;
}
LPDISPATCH IEvents::Add(LPCTSTR csName)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x4, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
csName);
return result;
}
LPDISPATCH IEvents::AddPlayEvent(LPDISPATCH Resource)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_DISPATCH;
InvokeHelper(0x5, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
Resource);
return result;
}
LPDISPATCH IEvents::AddStopEvent(LPDISPATCH lpEvent)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_DISPATCH;
InvokeHelper(0x6, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
lpEvent);
return result;
}
BOOL IEvents::Remove(LPCTSTR csEventName)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x7, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
csEventName);
return result;
}
LPUNKNOWN IEvents::Get_NewEnum()
{
LPUNKNOWN result;
InvokeHelper(0xfffffffc, DISPATCH_PROPERTYGET, VT_UNKNOWN, (void*)&result, NULL);
return result;
}
/////////////////////////////////////////////////////////////////////////////
// IEvent properties
long IEvent::GetId()
{
long result;
GetProperty(0x1, VT_I4, (void*)&result);
return result;
}
void IEvent::SetId(long propVal)
{
SetProperty(0x1, VT_I4, propVal);
}
CString IEvent::GetName()
{
CString result;
GetProperty(0x2, VT_BSTR, (void*)&result);
return result;
}
void IEvent::SetName(LPCTSTR propVal)
{
SetProperty(0x2, VT_BSTR, propVal);
}
BOOL IEvent::GetDynamic()
{
BOOL result;
GetProperty(0x3, VT_BOOL, (void*)&result);
return result;
}
void IEvent::SetDynamic(BOOL propVal)
{
SetProperty(0x3, VT_BOOL, propVal);
}
BOOL IEvent::GetStopable()
{
BOOL result;
GetProperty(0x4, VT_BOOL, (void*)&result);
return result;
}
void IEvent::SetStopable(BOOL propVal)
{
SetProperty(0x4, VT_BOOL, propVal);
}
long IEvent::GetType()
{
long result;
GetProperty(0x5, VT_I4, (void*)&result);
return result;
}
void IEvent::SetType(long propVal)
{
SetProperty(0x5, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// IEvent operations
LPDISPATCH IEvent::GetResource()
{
LPDISPATCH result;
InvokeHelper(0x6, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, NULL);
return result;
}

View File

@@ -0,0 +1,123 @@
//BEGIN FS 10/9/98
/*----------------------------------------------------------------------
* Description: callback for .CSB sript file
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:10/9/98
* Modif date:
*----------------------------------------------------------------------*/
int TSN_Event::LoadCSB_File( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char *szSectionName;
result=LDT_GetNextEntry();
while( result==ParseResult_BeginSection )
{
szSectionName=LDT_szGetEntryName();
switch (*(long*)(szSectionName+5/*"SndEv"*/))
{
case 'etne': //"SndEventE"
LDT_LoadSection(NULL);
break;
default:
LDT_SkipSection();
}//end switch
result=LDT_GetNextEntry();
}//end while
return 0;
}
//END FS 10/9/98
//BEGIN FS 10/5/98
/*----------------------------------------------------------------------
* Description: callback for SndEventE section from .CSB sript file
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:10/5/98
* Modif date:
*----------------------------------------------------------------------*/
int TSN_Event::LoadCSB_SndEventE( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char *szEntryName;
TSN_Event *pEvent;
CString csName,csTemp;
int iPos;
tdeMissingCriteria eAns;
char szEntry1[MAX_PATH];
int iLen;
// unsigned long* pOpenSection;
// SCR_tdst_Sect_Open *pOpenSection;
SND_tdstBlockEvent *pEngineEvent;
//Working for BeginSection
// Create event:
pEvent=new TSN_Event();
pLink->pObject=pEvent;
g_poSNDEDITInterface->m_EdiEventList.AddTail(pEvent);
// Transform the SndEventE in SndEventM:
iLen=LDT_ComputeSectionName(pLink,szEntry1);
csName = szEntry1+iLen;
iPos=csName.Find("sndevente");
if (iPos!=-1)
{
csName.SetAt(iPos+8,'m');
}
// set the engine event pointer if event is loaded:
//pEngineEvent=(SND_tdstBlockEvent*)LDT_LoadSection((char*)(LPCTSTR)csName);
LDT_tdst_Link *pLink1 = LDT_GetLink( (char*)(LPCTSTR)csName );
if (pLink1!=NULL)
{
pEngineEvent=(SND_tdstBlockEvent*)pLink1->pObject;
// pEngineEvent=(SND_tdstBlockEvent *)SCR_M_ul_RdL0_ExtractLongValue(&pOpenSection->stSectionValues,0);
if( pEngineEvent !=NULL )
{
if (pEngineEvent!=pEvent->m_pEngineEvent)
{
pEvent->fn_vUpdateData(pEngineEvent);
pEvent->m_pEngineEvent=pEngineEvent;
}
pEvent->SetAvailable(TRUE);
}
}
pEvent->SetReferencedSectionName(csName);
//Working for entries
result=LDT_GetNextEntry();
while( result!=ParseResult_EndSection )
{
szEntryName=LDT_szGetEntryName();
switch (*(long*)(szEntryName))
{
case 'NteS': //"SetName"
// Compute csb name, without the '.csb' extension:
csName=pLink->szFile;
csTemp=csName.Left(csName.GetLength()-4);
// crate event name as registered in name list:
csName.Format("SND_%s_%s",LDT_szGetParam(1),csTemp);
eAns=pEvent->fn_eRename(csName);
if (eAns!=E_mc_None)
{
csTemp.Format("Sound Editor Event Creation error: Name SND_%s incorrect(already exists or syntax incorrect)!",csName);
AfxMessageBox(csTemp);
}
// We have the event group's name: no need to continue this section analysis:
while (LDT_GetNextEntry()!=ParseResult_EndSection);
return 0;
}//end switch
result=LDT_GetNextEntry();
}//end while
return 0;
}
//END FS 10/5/98