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,6 @@
// 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,122 @@
/*=========================================================================
*
* dllcom.cpp : DLL definition
*
*
* Version 1.0
* Creation date 20/05/97 Author : C. Beaudet
* Revision date 20/05/97 Author : Vincent Lhullier
*
* Shaitan
*=======================================================================*/
#include "stdafx.h"
#include "acp_base.h"
#include "afxdllx.h"
#include "ITF.h"
#include "OT_inter.hpp"
/*
*------------------------------------------------------------------------
* Global vars
*------------------------------------------------------------------------
*/
static char *gs_p_szCPAVersion = C_szCPAVersion;
static AFX_EXTENSION_MODULE NEAR extensionDLL = { NULL, NULL };
#ifdef DLL_ONLY_ONE_INSTANCE
static ObjectTableInterface *gs_p_oOTInterface = NULL;
#endif
static CList<CPA_DLLBase*,CPA_DLLBase*> g_oListOfInstances; //private internal
//------------------------------------------------------------------------
// functions that are present in all DLL :
//------------------------------------------------------------------------
//========================================================================
// 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_stOTIdentity.eType = TOOL_DLL; //object DLL type
g_stOTIdentity.csName = C_szDLLObjectTableName; //object DLL name (unique name)
g_stOTIdentity.hModule = NULL; //********************** private internal
g_stOTIdentity.p_oListOfInstances = &g_oListOfInstances; //********************** private internal
return &g_stOTIdentity;
}
//========================================================================
// DLL init 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)
{
if (!AfxInitExtensionModule(extensionDLL, hInstance))
return 0;
}
return 1;
}
//========================================================================
// Get the DLL
//========================================================================
extern "C" CPA_DLLBase __declspec(dllexport) *fn_p_oGetDLL(long lKey)
{
#ifdef DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
if (gs_p_oOTInterface == NULL)
{
gs_p_oOTInterface = new ObjectTableInterface();
ASSERT(gs_p_oOTInterface != NULL);
}
return gs_p_oOTInterface;
break;
default:
return NULL;
}
#else //DLL_ONLY_ONE_INSTANCE
switch(lKey)
{
case 0: // the game world
return new ObjectTableInterface();
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,267 @@
/*=========================================================================
*
* ot_dLoad.cpp : Load dialog - Implementation file
*
*
* Version 1.0
* Creation date 18/08/97
* Revision date
*
* Shaitan
*=======================================================================*/
#include "stdafx.h"
#define HieFriend
#include "acp_base.h"
#include "OT_inter.hpp"
#include "OT_dLoad.hpp"
#include "x:\cpa\main\inc\_editid.h"
//#################################################################################
// OT_DialogLoad dialog
//#################################################################################
/*----------------------------------------
----------------------------------------*/
OT_DialogLoad::OT_DialogLoad(ObjectTableInterface *pOwnerEditor, CWnd* pParent /*=NULL*/)
: CDialog(OT_DialogLoad::IDD, pParent)
{
// init editor
m_pOwnerEditor = pOwnerEditor;
// init icon list
m_oIconList.Create(16, 16, ILC_MASK, 0, 6);
m_oIconList.Add(LoadIcon(pOwnerEditor->GetDLLIdentity()->hModule, MAKEINTRESOURCE(TOT_IDI_FAMILY)));
m_oIconList.Add(LoadIcon(pOwnerEditor->GetDLLIdentity()->hModule, MAKEINTRESOURCE(TOT_IDI_UNLOAD)));
m_oIconList.Add(LoadIcon(pOwnerEditor->GetDLLIdentity()->hModule, MAKEINTRESOURCE(TOT_IDI_OBJTABLE)));
m_oIconList.Add(LoadIcon(pOwnerEditor->GetDLLIdentity()->hModule, MAKEINTRESOURCE(TOT_IDI_UNLOADB)));
m_oIconList.Add(LoadIcon(pOwnerEditor->GetDLLIdentity()->hModule, MAKEINTRESOURCE(TOT_IDI_OBJTABLEB)));
}
/*----------------------------------------
----------------------------------------*/
void OT_DialogLoad::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(OT_DialogLoad)
DDX_Control(pDX, TOT_IDC_TREE, m_cTree);
//}}AFX_DATA_MAP
}
/*----------------------------------------
----------------------------------------*/
BEGIN_MESSAGE_MAP(OT_DialogLoad, CDialog)
//{{AFX_MSG_MAP(OT_DialogLoad)
ON_NOTIFY(TVN_SELCHANGED, TOT_IDC_TREE, OnSelchangeTreeControl)
ON_NOTIFY(NM_RCLICK, TOT_IDC_TREE, OnRightClkTreeControl)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//#################################################################################
// OT_DialogLoad message handlers
//#################################################################################
/*----------------------------------------
----------------------------------------*/
BOOL OT_DialogLoad::OnInitDialog()
{
CPA_BaseObjectList *pListObjects;
EditorObjectTable *pObjTable;
CPA_BaseObject *pObject;
HTREEITEM hFamilyItem, hObjTableItem;
Position Pos;
CString csName;
CDialog::OnInitDialog();
m_hFirstItem = NULL;
m_cTree.DeleteAllItems();
m_cTree.SetImageList(&m_oIconList, TVSIL_NORMAL);
// fill ListBox with invalid Lips Synchros
pListObjects = m_pOwnerEditor->GetInvalidObjectList(C_szObjectTableTypeName);
// only unloaded lips synchro must be dispayed
for (pObject = pListObjects->GetHeadElement(Pos); pObject;
pObject = pListObjects->GetNextElement(Pos))
{
pObjTable = (EditorObjectTable *)pObject;
if (!pObjTable->fn_bIsAvailable())
{
// if necessary, create family item
hFamilyItem = GetCorrespondingItem(pObjTable->GetOwner());
if (!hFamilyItem)
{
hFamilyItem = m_cTree.InsertItem(pObjTable->GetOwner()->GetName(), 0, 0, TVI_ROOT, TVI_SORT);
m_cTree.SetItemData(hFamilyItem, (DWORD) pObjTable->GetOwner());
}
// add lip synchro item
hObjTableItem = m_cTree.InsertItem(pObjTable->GetName(), 1, 1, hFamilyItem, TVI_SORT);
m_cTree.SetItemData(hObjTableItem, (DWORD) pObjTable);
}
}
return TRUE;
}
/*----------------------------------------
----------------------------------------*/
void OT_DialogLoad::OnSelchangeTreeControl (NMHDR* pNMHDR, LRESULT* pResult)
{
CPA_BaseObject *pObject;
HTREEITEM hCurItem;
POSITION pos;
LPNM_TREEVIEW pNMTreeView = (LPNM_TREEVIEW)pNMHDR;
if (pNMTreeView->action)
{
// get selected item
hCurItem = m_cTree.GetSelectedItem();
if (hCurItem != NULL)
{
// get corresponding object
pObject = (CPA_BaseObject *) m_cTree.GetItemData(hCurItem);
// Obj Table => update list
if (pObject->GetType() == C_szObjectTableTypeName)
{
pos = m_oObjectsToLoad.Find(pObject);
// if object is already in the list, remove it
if (pos != NULL)
{
m_oObjectsToLoad.RemoveAt(pos);
m_cTree.SetItemImage(hCurItem, 1, 1);
}
// else add it
else
{
m_oObjectsToLoad.AddTail(pObject);
m_cTree.SetItemImage(hCurItem, 2, 2);
}
// remove selection
m_cTree.SelectItem(NULL);
}
}
}
*pResult = 0;
}
/*----------------------------------------
----------------------------------------*/
void OT_DialogLoad::OnRightClkTreeControl(NMHDR* pNMHDR, LRESULT* pResult)
{
EditorObjectTable *pObjTable = NULL;
EditorObjectTable *pFirstObjTable;
CPA_BaseObject *pObject;
HTREEITEM hCurItem;
POSITION pos;
POINT mousePos;
BOOL bAdd, bPrev;
// get selected item
GetCursorPos(&mousePos);
m_cTree.ScreenToClient(&mousePos);
hCurItem = m_cTree.HitTest(mousePos);
if (hCurItem != NULL)
{
pObject = (CPA_BaseObject *) m_cTree.GetItemData(hCurItem);
// Lip Synchro => update list
if (pObject->GetType() == C_szObjectTableTypeName)
pObjTable = (EditorObjectTable *) pObject;
}
if (!pObjTable)
return;
// first click => get first selected object
if (!m_hFirstItem)
{
// register first item
m_hFirstItem = hCurItem;
m_cTree.SelectItem(m_hFirstItem);
// update icon & state
pFirstObjTable = (EditorObjectTable *) m_cTree.GetItemData(m_hFirstItem);
if (m_oObjectsToLoad.Find(pFirstObjTable) != NULL)
m_cTree.SetItemImage(m_hFirstItem, 3, 3);
else
m_cTree.SetItemImage(m_hFirstItem, 4, 4);
}
// next click => get last selection and update
else
{
pFirstObjTable = (EditorObjectTable *) m_cTree.GetItemData(m_hFirstItem);
if (pObjTable->GetOwner() == pFirstObjTable->GetOwner())
{
bAdd = (m_oObjectsToLoad.Find(pFirstObjTable) == NULL);
bPrev = (pObjTable->GetName() > pFirstObjTable->GetName());
// update all items
while (pObjTable)
{
// update list and icon
pos = m_oObjectsToLoad.Find(pObjTable);
if (bAdd && !pos)
{
m_oObjectsToLoad.AddTail(pObjTable);
m_cTree.SetItemImage(hCurItem, 2, 2);
}
else if (!bAdd && pos)
{
m_oObjectsToLoad.RemoveAt(pos);
m_cTree.SetItemImage(hCurItem, 1, 1);
}
// get previous item
if (pObjTable != pFirstObjTable)
{
if (bPrev)
hCurItem = m_cTree.GetPrevSiblingItem(hCurItem);
else
hCurItem = m_cTree.GetNextSiblingItem(hCurItem);
pObjTable = (EditorObjectTable *) m_cTree.GetItemData(hCurItem);
}
else
pObjTable = NULL;
}
m_hFirstItem = NULL;
m_cTree.SelectItem(m_hFirstItem);
}
}
// *pResult = 0;
}
HTREEITEM OT_DialogLoad::GetCorrespondingItem (CPA_BaseObject *pObject, HTREEITEM hElem)
{
CPA_BaseObject *pData;
HTREEITEM hChild, hResult;
// test hElem name
if (hElem)
{
// get item data
pData = (CPA_BaseObject *) m_cTree.GetItemData(hElem);
// check item data
if (pData == pObject)
return hElem;
}
// test all childs
hChild = (hElem) ? m_cTree.GetChildItem(hElem) : m_cTree.GetRootItem();
while (hChild)
{
hResult = GetCorrespondingItem(pObject, hChild);
if (hResult)
return hResult;
hChild = m_cTree.GetNextSiblingItem(hChild);
}
return NULL;
}

View File

@@ -0,0 +1,8 @@
LIBRARY
EXPORTS
fn_p_szGetCPAVersion
fn_p_stGetDLLIdentity
fn_p_oGetDLL
fn_vInitDll
SECTIONS
.data READ WRITE

View File

@@ -0,0 +1,429 @@
/*=========================================================================
*
* edit_ot.cpp : ObjectTable Editor Object - inplementation
*
* Version 2.0
* Creation date 07/06/97 Author : Vincent Lhullier
* Revision date 18/08/97 Author : Shaitan
*
* Shaitan
*=======================================================================*/
#define HieFriend
#define D_ObjsTbls_Define
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include <direct.h>
#include "stdafx.h"
#include "acp_base.h"
#include "TFA.h"
#include "x:\cpa\main\inc\_EditID.h"
#include "incGAM.h"
#include "ITF.h"
#include "OT_inter.hpp"
#include "OT_dLoad.hpp"
#include "DPT.h"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#undef HieFriend
#undef D_ObjsTbls_Define
// infos
static CString g_csTOTName = C_szDLLObjectTableName;
static CString g_csTOTAuthor = "Vincent Lhullier & Chantal Oury";
static CString g_csTOTVersion = "V 2.0.1 18/03/98";
static CString g_csTOTFrenchHelpFile = "";
static CString g_csTOTEnglishHelpFile = "";
/*=============================================================================
the DLL global definition
=============================================================================*/
tdstDLLIdentity g_stOTIdentity;
/*=============================================================================
defines
=============================================================================*/
#define C_uiPopupLoad 10
//#################################################################################
// Constructor / Destructor
//#################################################################################
/*===========================================================================
* Description: Constructor
* Creation date: 07/06/97
* Author: Vincent Lhullier
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
ObjectTableInterface::ObjectTableInterface(void)
{
m_p_stDLLIdentity = &g_stOTIdentity;
// Does your DLL can output in main game view ?
m_stBaseDLLDefinition.bCanOutputIn3DView = FALSE;
SetCurrent(FALSE);
SetEditorInfo(g_csTOTName, g_csTOTAuthor, g_csTOTVersion, g_csTOTFrenchHelpFile, g_csTOTEnglishHelpFile);
}
/*===========================================================================
* Description: Destructor
* Creation date: 07/06/97
* Author: Vincent Lhullier
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
ObjectTableInterface::~ObjectTableInterface (void)
{
}
//#################################################################################
// Inits
//#################################################################################
/*===========================================================================
* Description: Inits for Scripts
* Creation date: 07/06/97
* Author: Vincent Lhullier
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
void ObjectTableInterface::fn_vJustAfterRegistered()
{
CString a_csType[] = { C_szObjectTableTypeName };
fn_vRegisterObjectsType ( a_csType , 1 ) ;
EditorObjectTable::StaticInit();
m_lNbUnloaded = 0;
}
/*===========================================================================
* Description: Construct
* Creation date: 18/08/97
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
void ObjectTableInterface::fn_vConstruct(void)
{
// resources
HINSTANCE hOldInst = AfxGetResourceHandle();
AfxSetResourceHandle(m_p_stDLLIdentity->hModule);
// dialog for load
m_pDialogLoad = new OT_DialogLoad(this);
// resources
AfxSetResourceHandle(hOldInst);
}
//#################################################################################
// Loads
//#################################################################################
/*===========================================================================
* Description: Load all object table of a family
* Creation date: 07/06/97
* Author: Vincent Lhullier
*---------------------------------------------------------------------------
* Revision date: 18/08/97 Author: Shaitan
*=========================================================================*/
void ObjectTableInterface::m_fn_vLoadFamilyObjectTables( CPA_Family *p_oFamily )
{
tdxHandleToObjectsTablesList hOTL;
SCR_tdst_Link_Value *p_stLinkValue;
EditorObjectTable *p_oOT;
WIN32_FIND_DATA stFindData;
HANDLE hFind;
char szPath[ MAX_PATH];
char szFileName[SCR_CV_ui_Cfg_MaxLenName];
// construct research path
sprintf(szPath, "%s\\%s\\*.tbl", fn_szGetFamiliesDataPath(), (char *) (LPCTSTR) p_oFamily->GetName() );
// construct one Editor Object Table for each found files
hFind = FindFirstFile( szPath, &stFindData );
if (hFind != INVALID_HANDLE_VALUE)
{
*strrchr( szPath, '*' ) = 0;
do
{
sprintf(szFileName, "%s%s", szPath, stFindData.cFileName );
p_stLinkValue = SCR_fnp_st_Link_SearchKey( &TBL_g_stLinkTable, szFileName );
if (p_stLinkValue != NULL)
hOTL = (tdxHandleToObjectsTablesList) SCR_M_ul_Link_GetValue( p_stLinkValue );
else
hOTL = NULL;
// referenced section name = short name
sprintf(szFileName, "%s\\%s", (char *) (LPCTSTR) p_oFamily->GetName(), stFindData.cFileName );
// build editor object
p_oOT = new EditorObjectTable( this, hOTL, p_oFamily, szFileName );
// only loaded objects are available for other editors
p_oFamily->mfn_vAddObjectTable( p_oOT );
if (!hOTL)
m_lNbUnloaded++;
} while (FindNextFile( hFind, &stFindData ));
// close FindData handle
FindClose(hFind);
}
// Shaitan Correction Anims Specifiques
char szVersion[255];
char szSearchPath[255];
char szRealName[255];
FILE *hIni;
// get info from ini file
hIni = fopen("version.ini", "rt");
if(hIni == NULL)
hIni = fopen("x:\\cpa\\exe\\main\\version.ini", "rt");
if(hIni)
{
fgets(szVersion, 49, hIni);
while(!isalnum(szVersion[strlen(szVersion) - 1]))
szVersion[strlen(szVersion) - 1] = '\0';
fclose(hIni);
}
// if no specific version, no more search
else
return;
char szVersion1[255];
char szVersion2[255];
char *szCut;
int iNumVersion, iNbVersions = 1;
strcpy(szVersion1, szVersion);
szCut = strchr(szVersion1, ',');
if (szCut)
{
strcpy(szVersion2, szCut+1 );
strcpy(szCut, "\0");
iNbVersions = 2;
}
for (iNumVersion = 0; iNumVersion < iNbVersions; iNumVersion++)
{
// build specific path
strcpy(szSearchPath, iNumVersion ? szVersion2 : szVersion1);
strcat(szSearchPath, strchr(fn_szGetFamiliesDataPath(), '\\'));
// construct research path
sprintf(szPath, "%s\\%s\\*.tbl", szSearchPath, (char *) (LPCTSTR) p_oFamily->GetName() );
// construct one Editor Object Table for each found files
hFind = FindFirstFile( szPath, &stFindData );
if (hFind != INVALID_HANDLE_VALUE)
{
*strrchr( szPath, '*' ) = 0;
do
{
BOOL bAlreadyExist;
sprintf(szFileName, "%s%s", szPath, stFindData.cFileName );
// check if this object table was already loaded in another specific directory
if (iNumVersion > 0)
{
WIN32_FIND_DATA stPreviousFindData;
char szPreviousFile[SCR_CV_ui_Cfg_MaxLenName];
// build file name for previous version
strcpy(szPreviousFile, szVersion1);
strcat(szPreviousFile, strstr(szFileName, "\\"));
// check if file was already loaded
bAlreadyExist = (FindFirstFile(szPreviousFile, &stPreviousFindData) != INVALID_HANDLE_VALUE);
//SCR_fn_c_RdL0_IsSectionExists(szPreviousFile);
}
else
bAlreadyExist = FALSE;
if (!bAlreadyExist)
{
// get engine object
strcpy(szRealName, fn_szGetFamiliesDataPath());
strcat(szRealName, szFileName + strlen(szSearchPath));
p_stLinkValue = SCR_fnp_st_Link_SearchKey( &TBL_g_stLinkTable, szRealName );
if (p_stLinkValue != NULL)
hOTL = (tdxHandleToObjectsTablesList) SCR_M_ul_Link_GetValue( p_stLinkValue );
else
hOTL = NULL;
// referenced section name = short name
sprintf(szFileName, "%s\\%s", (char *) (LPCTSTR) p_oFamily->GetName(), stFindData.cFileName );
// build editor object
p_oOT = new EditorObjectTable( this, hOTL, p_oFamily, szFileName );
// only loaded objects are available for other editors
p_oFamily->mfn_vAddObjectTable( p_oOT );
if (!hOTL)
m_lNbUnloaded++;
}
} while (FindNextFile( hFind, &stFindData ));
// close FindData handle
FindClose(hFind);
}
}
}
/*===========================================================================
* Description: Load engine object associated with editor object
* Creation date: 07/06/97
* Author: Vincent Lhullier
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
BOOL ObjectTableInterface::fn_bLoadBaseObject(CPA_BaseObject *p_oObject)
{
((EditorObjectTable *) p_oObject)->fn_vLoadEngineObjectTable();
return TRUE;
}
//#################################################################################
// Tool DLL functions Overload
//#################################################################################
/*===========================================================================
* Description: OnQueryAction => load one LipSync
* Creation date: 07/06/97
* Author: Vincent Lhullier
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
long ObjectTableInterface::OnQueryAction(CPA_EditorBase *p_oSender, WPARAM _wParam, LPARAM _lParam)
{
// EditorObjectTable *p_oOT;
long lResult = 0;
switch (_wParam)
{
/*
case C_uiCreateObjectTable:
tdxHandleToObjectsTablesList hOTL;
char *p_szSectionName;
char szFileName[SCR_CV_ui_Cfg_MaxLenName];
char szActionName[SCR_CV_ui_Cfg_MaxLenName];
char szName[SCR_CV_ui_Cfg_MaxLenName];
hOTL = (tdxHandleToObjectsTablesList) _lParam;
p_szSectionName = SCR_M_p_sz_Link_GetKey(SCR_fnp_st_Link_SearchValue(&TBL_g_stLinkTable, (unsigned long) hOTL));
SCR_fn_v_RdL0_SplitSectionName(p_szSectionName, szFileName, szActionName, szName);
if (p_szSectionName == NULL)
p_oOT = new EditorObjectTable( this, GetMainWorld(), hOTL);
else
{
SCR_fn_v_RdL0_SplitSectionName(p_szSectionName, szFileName, szActionName, szName);
p_oOT = new EditorObjectTable( this, GetMainWorld(), hOTL, szName, szFileName, szActionName);
}
lResult = (long) p_oOT;
break;
case C_uiDeleteObjectTable:
p_oOT = (EditorObjectTable *) _lParam;
delete p_oOT;
break;
*/
case C_uiLoadFamilyObjectTables:
m_fn_vLoadFamilyObjectTables ((CPA_Family *) _lParam);
break;
}
return lResult;
}
/*===========================================================================
* Description: Tools Menu => add entry for load
* Creation date: 18/08/97
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
BOOL ObjectTableInterface::fn_bDefineSubMenu (EDT_SubMenu *p_oEDTSubMenu)
{
//ANNECY Shaitan NewInterface 24/03/98 {
if (p_oEDTSubMenu->GetSubMenuType() == C_SubMenuLoad)
//ENDANNECY Shaitan NewInterface }
{
p_oEDTSubMenu->AddAnEntry(this, "Load Objects Tables", C_uiPopupLoad, FALSE, m_lNbUnloaded > 0);
return TRUE;
}
return FALSE;
}
/*===========================================================================
* Description: Tools Menu => answer to load command
* Creation date: 18/08/97
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
void ObjectTableInterface::_OnSubMenuCommand (EDT_SubMenu *p_oEDTSubMenu, UINT uiMsgID)
{
CPA_List<CPA_BaseObject> *pObjectList;
CPA_BaseObject *pObject;
POSITION pos;
CString csText;
BOOL bRes;
long lNbLoaded = 0;
//ANNECY Shaitan NewInterface 24/03/98 {
if (p_oEDTSubMenu->GetSubMenuType() == C_SubMenuLoad)
//ENDANNECY Shaitan NewInterface }
{
switch (uiMsgID)
{
case C_uiPopupLoad:
if (m_pDialogLoad->DoModal() == IDOK)
{
// get actor editor
CPA_DLLBase *p_oActorDLL = GetMainWorld() -> GetObjectDLLWithName( C_szDLLActorName );
// get list of objects to load
pObjectList = m_pDialogLoad->GetObjectsToLoad();
// load each object
for (pObject = pObjectList->GetHeadElement(pos); pObject;
pObject = pObjectList->GetNextElement(pos))
{
bRes = fn_bLoadBaseObject(pObject);
if (bRes)
{
lNbLoaded++;
// tell actor DLL that Object Tables were loaded
if (p_oActorDLL)
p_oActorDLL -> OnQueryAction( this, C_uiActor_ObjectsTableLoaded, (LPARAM)pObject );
}
}
m_lNbUnloaded -= lNbLoaded;
if (lNbLoaded)
{
csText.Format("%ld Object Tables loaded", lNbLoaded);
M_GetMainWnd()->UpdateStatus((char*)(LPCSTR)csText, C_STATUSPANE_INFOS, C_STATUS_NORMAL);
}
}
break;
}
}
}

View File

@@ -0,0 +1,399 @@
/*=========================================================================
*
* edit_ot.cpp : ObjectTable Editor Object - inplementation
*
* Version 2.0
* Creation date 06/06/97 Author : Vincent Lhullier
* Revision date 18/08/97 Author : Shaitan
*
* Shaitan
*=======================================================================*/
#define D_ObjsTbls_Define
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include "stdafx.h"
#include "acp_base.h"
#include "TFA.h"
#include "incGAM.h"
#include "ITF.h"
#include "incPO.h"
#include "incOPD.h"
#include "TOT.h"
#include "OT_inter.hpp"
#include "incGam.h"
#include "DPT.h"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#undef D_ObjsTbls_Define
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
DeclareTemplateStatic( tdxHandleToObjectsTablesList );
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
void del(tdxHandleToObjectsTablesList h)
{
}
/*===========================================================================
* Description: Static init (engine struct)
* Creation date: 06/06/97
* Author: Vincent Lhullier
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
void EditorObjectTable::StaticInit()
{
CPA_EdMot<tdxHandleToObjectsTablesList>::Init(NULL,NULL,del);
}
/*===========================================================================
* Description: Constructor
* Creation date: 06/06/97
* Author: Vincent Lhullier
*---------------------------------------------------------------------------
* Revision date: 18/08/97 Author: Shaitan
* Revision date: 05/09/97 Author: Vincent Lhullier
*=========================================================================*/
EditorObjectTable::EditorObjectTable (CPA_EditorBase *p_oDLL,
tdxHandleToObjectsTablesList hObjTable,
CPA_SaveObject *p_oOwner,
CString csFileName)
: CPA_SaveObject (p_oDLL, // owner editor
C_szObjectTableTypeName, // type
E_ss_NoSave, // status
p_oOwner, // owner
(hObjTable != NULL), // validity
fn_szGetFamiliesDataPath(), // data path
NULL // callback for save
),
CPA_EdMot<tdxHandleToObjectsTablesList> (hObjTable)
{
unsigned short uwIndex;
//unsigned short uwEndName;
CString csName;
// section object
SetSectionData(this);
// section name
SetReferencedSectionName(csFileName);
// name
uwIndex = csFileName.ReverseFind('\\');
csName = csFileName.Mid(uwIndex + 1);
if (fn_eRename(csName) != E_mc_None)
SetDefaultValidName();
fn_vUpdateSectionName();
// existence
SetExistingSection(TRUE);
// validity
if (hObjTable != NULL)
{
// Shaitan => module list in the level
fn_vLoadUnusedPOsInObjectTable();
// End Shaitan => module list in the level
fn_vCreateEditorPhysicalObjects();
}
SetAvailable(hObjTable!=NULL);
};
/*===========================================================================
* Description: Destructor
* Creation date: 06/06/97
* Author: Vincent Lhullier
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
EditorObjectTable::~EditorObjectTable()
{
}
/*===========================================================================
* Description: Section Name
* => FamilyName / Name.TBL
* Creation date: 18/08/97
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: 05/09/97 Author: Vincent Lhullier
*=========================================================================*/
void EditorObjectTable::fn_vUpdateSectionName (void)
{
CString csSectionName, csFileName;
int iPos;
// get old section name
csSectionName = GetReferencedSectionName();
// build new section name
iPos = csSectionName.ReverseFind('\\');
csFileName = csSectionName.Left(iPos+1) + GetName(); // + ".tbl";
// set new section name
SetReferencedSectionName(csFileName);
}
/*===========================================================================
* Description: Name for dialogs
* => FamilyName + Name
* Creation date: 18/08/97
* Author: Shaitan
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
CString EditorObjectTable::GetNameToDraw (void)
{
CString csName;
csName = (GetOwner()) ? GetOwner()->GetName() : "Unknown";
csName += " " + GetName();
return csName;
}
/*===========================================================================
* Description: Create all editor POs
* Creation date: 06/06/97
* Author: Vincent Lhullier
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
void EditorObjectTable::fn_vCreateEditorPhysicalObjects( void )
{
PO_tdxHandleToPhysicalObject hPO;
CPA_ObjectDLLBase *p_oDLLPO;
tdxHandleToObjectsTableElement hOTElement;
EditorPO *p_oPO;
unsigned short uwIndex;
// Get Physical object DLL
p_oDLLPO = GetMainWorld()->GetObjectDLLWithName(C_szDLLPhysicalObjectName);
if (p_oDLLPO != NULL)
{
// First pass
for (uwIndex = 0 ; uwIndex < GetStruct()->wNumberOfElement; uwIndex ++)
{
hOTElement = fn_d_hGetElementByNumberInObjectsTable( GetStruct(), uwIndex );
// for each po in the object table, create a editor po
if (fn_wObjectsTableGetTypeOfTarget( hOTElement ) == C_wTdO_PhysicalObject )
{
hPO = (PO_tdxHandleToPhysicalObject) fn_hObjectsTableGetTarget( hOTElement );
if (hPO == NULL)
p_oPO = NULL;
else
{
p_oPO = (EditorPO *) p_oDLLPO->OnQueryAction( (CPA_DLLBase *) this, OPD_ActionEncapsulateObject, (LPARAM) hPO );
// update Index
if (p_oPO)
p_oPO -> m_fn_vSetIndexInObjectTable( uwIndex );
}
}
}
// Second pass
for (uwIndex = 0 ; uwIndex < GetStruct()->wNumberOfElement; uwIndex ++)
{
hOTElement = fn_d_hGetElementByNumberInObjectsTable( GetStruct(), uwIndex );
// for each po in the object table, create a editor po
if (fn_wObjectsTableGetTypeOfTarget( hOTElement ) == C_wTdO_PhysicalObject )
{
hPO = (PO_tdxHandleToPhysicalObject) fn_hObjectsTableGetTarget( hOTElement );
p_oDLLPO->OnQueryAction( (CPA_DLLBase *) this, OPD_ActionSecondPass, (LPARAM) hPO );
}
}
}
}
// Shaitan => module list in the level
/*===========================================================================
* Description: Load unused POs of the object table
* Creation date:
* Author:
*---------------------------------------------------------------------------
* Revision date: Author:
*=========================================================================*/
void EditorObjectTable::fn_vLoadUnusedPOsInObjectTable( void )
{
SCR_tdst_Anl_Callback *pCallback;
// if the engine object table is not created, it will be loaded as usual
if (!GetStruct())
return;
// if the family is not optimized, no need to reload
CPA_Family * pFamily = (CPA_Family *) GetOwner();
if (((tdxHandleToFamilyList) pFamily->GetStruct())->ucOptimized == 0)
return;
// first get the engine callback functions for tbl file
pCallback = SCR_fnp_st_RdL0_GetRegisterCallback(C_Section_TBLHeader, SCR_CRC_c_RdL0_ForSection);
SCR_tdpfn_Anl_Callback pHeaderCallback = pCallback->pfn_eCallback;
pCallback = SCR_fnp_st_RdL0_GetRegisterCallback(C_Section_TBLGeneral, SCR_CRC_c_RdL0_ForSection);
SCR_tdpfn_Anl_Callback pTBLCallback = pCallback->pfn_eCallback;
pCallback = SCR_fnp_st_RdL0_GetRegisterCallback(C_Section_EVTGeneral, SCR_CRC_c_RdL0_ForSection);
SCR_tdpfn_Anl_Callback pEVTCallback = pCallback->pfn_eCallback;
// then unregister them
SCR_fn_v_RdL0_DeleteRegisterCallback(C_Section_TBLHeader, SCR_CRC_c_RdL0_ForSection, SCR_CDR_c_RdL0_Match);
SCR_fn_v_RdL0_DeleteRegisterCallback(C_Section_TBLGeneral, SCR_CRC_c_RdL0_ForSection, SCR_CDR_c_RdL0_Match);
SCR_fn_v_RdL0_DeleteRegisterCallback(C_Section_EVTGeneral, SCR_CRC_c_RdL0_ForSection, SCR_CDR_c_RdL0_Match);
// register the new callback
SCR_fn_v_RdL0_RegisterCallback(C_Section_TBLHeader, m_fn_tdeEmtpyCallBack,SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_Section_TBLGeneral, m_fn_tdeCallBackLoadUnusedPOs,SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_Section_EVTGeneral,m_fn_tdeEmtpyCallBack,SCR_CRC_c_RdL0_ForSection);
// then force the script to analyze the section
SCR_M_RdL0_SetContextLong(C_GrandChildContext,0,GetStruct());
SCR_fnp_st_RdL0_AnalyseSection((char *)(LPCTSTR) GetReferencedSectionName(), SCR_CDF_uw_Anl_ForceAnalyse);
// unregister the editor callback
SCR_fn_v_RdL0_DeleteRegisterCallback(C_Section_TBLHeader, SCR_CRC_c_RdL0_ForSection, SCR_CDR_c_RdL0_Match);
SCR_fn_v_RdL0_DeleteRegisterCallback(C_Section_TBLGeneral, SCR_CRC_c_RdL0_ForSection, SCR_CDR_c_RdL0_Match);
SCR_fn_v_RdL0_DeleteRegisterCallback(C_Section_EVTGeneral, SCR_CRC_c_RdL0_ForSection, SCR_CDR_c_RdL0_Match);
// restore the normal loading function
SCR_fn_v_RdL0_RegisterCallback(C_Section_TBLHeader, pHeaderCallback,SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_Section_TBLGeneral, pTBLCallback,SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_Section_EVTGeneral, pEVTCallback,SCR_CRC_c_RdL0_ForSection);
}
// End Shaitan => module list in the level
/*===========================================================================
* Description: Load engine struct
* Creation date: 06/06/97
* Author: Vincent Lhullier
*---------------------------------------------------------------------------
* Revision date: 18/08/97 Author: Shaitan
*=========================================================================*/
void EditorObjectTable::fn_vLoadEngineObjectTable (void)
{
SCR_tdst_Cxt_Values *p_stVal;
tdxHandleToObjectsTablesList hOT;
BOOL bIsLoadingWorld;
if (!fn_bIsAvailable())
{
// loading flag
bIsLoadingWorld = GetEditor()->GetInterface()->fn_bIsLoadingWorld();
GetEditor()->GetInterface()->SetLoadingWorld( TRUE );
// Shaitan => module list in the level
// make sure that all POs will be loaded !
CPA_Family * pFamily = (CPA_Family *) GetOwner();
((tdxHandleToFamilyList) pFamily->GetStruct())->ucOptimized = 0;
// End Shaitan => module list in the level
// load engine struct
p_stVal = SCR_fnp_st_RdL0_AnalyseSection( (char *)(LPCTSTR) GetReferencedSectionName(), SCR_CDF_uw_Anl_Normal );
hOT = (tdxHandleToObjectsTablesList) SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
// update flag
GetEditor()->GetInterface()->SetLoadingWorld(bIsLoadingWorld);
// update engine struct
fn_vUpdateData( hOT );
SetStruct(hOT);
fn_vCreateEditorPhysicalObjects();
// update validity
SetAvailable(TRUE);
// add to family list
// ((CPA_Family *) GetOwner())->mfn_vAddObjectTable(this);
}
}
// Shaitan => module list in the level
/*===========================================================================
* Description: loa unused POs of the object table
* Creation date: 06/06/97
* Author: Vincent Lhullier
*---------------------------------------------------------------------------
* Revision date: 18/08/97 Author: Shaitan
*=========================================================================*/
SCR_tde_Anl_ReturnValue EditorObjectTable::m_fn_tdeCallBackLoadUnusedPOs(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action _eAction)
{
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
tdxHandleToObjectsTablesList h_ObjectsTablesListElement;
PO_tdxHandleToPhysicalObject hPO;
long l_NumberInTable;
if ( M_IsTitle )
{
SCR_M_RdL0_SetContextLong(C_ThisContext,1,atoi(_p_szName));
}
else if ( M_IsEntry )
{
SCR_M_RdL0_GetContextLong(C_ThisContext,0,tdxHandleToObjectsTablesList,h_ObjectsTablesListElement);
SCR_M_RdL0_GetContextLong(C_ThisContext,1,long,l_NumberInTable);
if ( M_ActionIs( C_Entry_PHY ) )
{
PO_tdxHandleToPhysicalObject hPO;
if (!h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target)
{
hPO = CS_fn_xLoadPhysicalObject(_ap_szParams[0]);
if (hPO)
{
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target = hPO;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget = C_wTdO_PhysicalObject;
if (PO_fn_hGetCollideSet (hPO))
{
if (PCS_fn_hGetGeoObjOfPhysicalCollSet (C_ucTypeZdd , PO_fn_hGetCollideSet (hPO))) h_ObjectsTablesListElement->wZDxUsed |= C_wObjectTableHasZdd;
if (PCS_fn_hGetGeoObjOfPhysicalCollSet (C_ucTypeZde , PO_fn_hGetCollideSet (hPO))) h_ObjectsTablesListElement->wZDxUsed |= C_wObjectTableHasZde;
}
}
}
}
if ( M_ActionIs( C_Entry_MIRROR ) )
{
hPO = CS_fn_xFindPhysicalObject(_ap_szParams[0]);
if (!h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target)
{
hPO = CS_fn_xLoadPhysicalObject(_ap_szParams[0]);
if (hPO)
{
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target = hPO;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget = C_wTdO_PhysicalObject;
}
}
}
}
else if( M_IsEnd )
{
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,tdxHandleToObjectsTablesList,h_ObjectsTablesListElement);
}
return ( eReturnValue );
}
// End Shaitan => module list in the level
// Shaitan => module list in the level
/*===========================================================================
* Description: loa unused POs of the object table
* Creation date: 06/06/97
* Author: Vincent Lhullier
*---------------------------------------------------------------------------
* Revision date: 18/08/97 Author: Shaitan
*=========================================================================*/
SCR_tde_Anl_ReturnValue EditorObjectTable::m_fn_tdeEmtpyCallBack(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action _eAction)
{
return ( SCR_ERV_Anl_NormalReturn );
}