reman3/Rayman_X/cpa/public/TAC/CPAState.hpp

174 lines
7.3 KiB
C++

/*=============================================================================
*
* Filename: CPAState.hpp
* Version: 2.0 (VSS5)
* Date: 30/12/96
* Author: Marc Trabucato
*
* Description: description of CPA_AnimAction class
*
*===========================================================================*/
#ifndef __CPASTATE_HPP__
#define __CPASTATE_HPP__
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif
/******************************************/
#ifdef ACTIVE_EDITOR
#include "ITF.h"
#include "_ACTypes.hpp"
/*3dos*/
class CPA_State;
class CPA_Animation;
class CPA_Action;
class CPA_Family;
#define C_szStateSectionName "CreateNewState"
typedef struct tdstZAListInfo_
{
CPA_SaveObject *p_oZAList;
CPA_SaveObject *p_oZA;
} tdstZAListInfo;
typedef enum tdeTransitionState_
{
E_ts_Prohibited,
E_ts_Allowed,
/*ANNECY CT 11/02/98{*/
E_ts_Fluid,
/*ENDANNECY CT}*/
E_ts_Unknown
} tdeTransitionState;
typedef struct tdstTransitionStateInfo_
{
CPA_Action *p_oAction;
CPA_State *p_oStateToGo;
tdeTransitionState eState;
} tdstTransitionStateInfo;
typedef struct tdstTSIState_
{
CPA_State *p_oState;
tdstTransitionStateInfo *p_stTSI;
} tdstTSIState;
/*=============================================================================
* class CPA_AnimAction:
=============================================================================*/
class CPA_State : public CPA_SaveObject,
public CPA_EdElement<CPA_State,tdxHandleToState,LST2_M_StaticAnchorTo(tdxHandleToState)*>
{
/* datas*/
protected:
CPA_Animation *m_p_oAnimation;
CPA_State *m_p_oNextState;
BOOL m_bTransitional;
CPA_Action *m_p_oAction;
CPA_SaveObject *m_p_oMecaCard;
BOOL m_bMustRecomputeTransitions;
CPA_List<tdstTransitionStateInfo> m_oListOfTransitionStateInfo;
/* CPA_Ed_1 Mihaela Tancu begin*/
int m_iNumber; /*the number of spaces to put before a transitional state*/
/* CPA_Ed_1 Mihaela Tancu end*/
public:
CPA_List<CPA_State> m_oListOfUsedAsNextState;
CPA_List<CPA_State> m_oListOfUsedAsTransitional;
CPA_List<tdstZAListInfo> m_oListOfUsedOnZAList;
/* methods*/
public:
/* to create a new state or to use an existing engine state*/
CPA_State(CPA_EditorBase *p_oDLL, CPA_BaseObject *_p_oOwnerFamily, tdxHandleToState _hEngineState = NULL,
CPA_Animation *p_oAnimation = NULL, CString _csStateName = "");
~CPA_State(void);
/* CPA_Ed_1 Mihaela Tancu begin*/
/*get and set the number of spaces*/
int mfn_iGetSpaceNumbers () { return m_iNumber;}
void mfn_vSetSpaceNumbers (int _iNb) { m_iNumber = _iNb;}
/*for every transitional state determine the number of spaces before each transitional state*/
void mfn_vObtainSpaceNumbers();
/* CPA_Ed_1 Mihaela Tancu end*/
/* overloaded functions*/
long GetDataType ( void ) { return 0; }
void* GetData ( void ) { return (void*)GetStruct(); }
tdeMissingCriteria fn_eCheckUnicity ( const CString _csNewName ) { return fn_eCheckUnicityWithOwner( _csNewName ); }
void fn_vNotifyRename (void);
/* new functions*/
static void Init();
static void fn_vCallBackSave ( SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName, void *_p_vData, SCR_tde_Ntfy_Action _eAction);
CPA_State* mfn_p_oDuplicateState (void);
void mfn_vInitNextState (void);
void mfn_vInitMechanics (void);
/* set functions*/
void mfn_vSetAnimation (CPA_Animation *_p_oAnimation);
void mfn_vSetNextState (CPA_State *_p_oNextState, BOOL _bPreviousRemoved = FALSE);
void mfn_vSetReplay (unsigned char _ucReplay);
void mfn_vSetSpeed (signed char _cSpeed);
void mfn_vSetTransitional (BOOL _bTransitional , BOOL _bUpdateEngine = TRUE);
void mfn_vSetAction (CPA_Action *_p_oAction) { m_p_oAction = _p_oAction; }
void mfn_vSetMecaCard (CPA_SaveObject *_p_oMeca);
void mfn_vSetProhibitedByDefault (BOOL _bProhibit = FALSE);
void mfn_vSetCustomBits (unsigned char _ucCustomBits);
/* get functions*/
CPA_Family* mfn_p_oGetFamily (void) { return (CPA_Family*)GetOwner(); }
CPA_Action* mfn_p_oGetAction (void) { return m_p_oAction; }
CPA_Animation* mfn_p_oGetAnimation (void) { return m_p_oAnimation; }
CPA_State* mfn_p_oGetNextState (void) { return m_p_oNextState; }
CPA_SaveObject* mfn_p_oGetMecaCard (void) { return m_p_oMecaCard; }
unsigned char mfn_ucGetReplay (void);
signed char mfn_cGetSpeed (void);
BOOL mfn_bGetTransitional (void) { return m_bTransitional; }
BOOL mfn_bIsProhibitedByDefault (void) { return ( GetStruct() -> ucTransitionStatusFlag == C_ucProhibitedState ); }
unsigned char mfn_ucGetCustomBits (void) { return fn_ucGetStateCustomBits( GetStruct() ); }
/* Transitions functions*/
void mfn_vFillTransitionStateList ( void );
void mfn_vSetTransitionStateInfo ( CPA_Action *_p_oAction, tdeTransitionState _eState, CPA_State *_p_oState = NULL, BOOL _bOnInit = FALSE );
BOOL mfn_bUpdateTransitionStateList ( void );
void mfn_vRemoveActionFromTransition ( CPA_Action *_p_oAction );
tdstTransitionStateInfo *mfn_p_stGetTransitionStateInfo ( CPA_Action *_p_oAction );
BOOL mfn_bIsActionProhibited ( CPA_Action *_p_oAction );
tdeTransitionState mfn_eGetTransitionForAction ( CPA_Action *_p_oAction );
/* coherence functions*/
void mfn_vAddOnZAList ( CPA_SaveObject *_p_oZAList, CPA_SaveObject *_p_oZA );
void mfn_vDelOnZAList ( CPA_SaveObject *_p_oZAList );
CPA_SaveObject *mfn_p_oGetZAFromZAList ( CPA_SaveObject *_p_oZAList );
BOOL mfn_bCanUseAsNextState ( CPA_State *_p_oState );
/**/
/**/
protected:
void mfn_vInitAnimation (void);
void SetStruct (tdxHandleToState _hState);
void mfn_vRemoveStateFromTransition (CPA_State *_p_oState);
void mfn_vAddAsNextStateOf (CPA_State *_p_oState);
void mfn_vDelAsNextStateOf (CPA_State *_p_oState);
void mfn_vAddAsTransitionalStateOf (CPA_State *_p_oState);
void mfn_vDelAsTransitionalStateOf (CPA_State *_p_oState);
POSITION mfn_xGetPosOfZAListUsing (CPA_SaveObject *_p_oZAList);
void mfn_vResetTransitionStateInfoList ( void );
};
#endif /* ACTIVE_EDITOR*/
#endif /* __CPASTATE_HPP__*/