707 lines
27 KiB
C
707 lines
27 KiB
C
/*=========================================================================
|
||
* PlayEvrs.cpp : This module contain all functions used to play events
|
||
* This is a part of the Game project.
|
||
*
|
||
* Version 1.0
|
||
* Creation date 6/11/96
|
||
* Revision date
|
||
*
|
||
* That file needs to be compatible for all platforms.
|
||
*
|
||
* (c) Ubi Studios 1996
|
||
*=======================================================================*/
|
||
|
||
#if defined (WIN32)
|
||
#include <stdio.h>
|
||
#endif /* WIN32 */
|
||
|
||
#include "ToolsCPA.h"
|
||
/* SOUND 14/02/97*/
|
||
#include "SND.h"
|
||
/* SOUND fin*/
|
||
|
||
#include "Options/Options.h"
|
||
#include "Macros.h"
|
||
|
||
#include "Actions/AllActs.h"
|
||
|
||
#include "Structur/Anim_s.h"
|
||
#include "Structur/MemGame.h"
|
||
#include "Structur/Objects.h"
|
||
#include "Structur/EngMode.h" /* For interpolated animations*/
|
||
#include "Structur/State.h"
|
||
|
||
#include "PlayAnim/PlayEvts.h"
|
||
/* JO 01/07/97*/
|
||
#include "PlayAnim/PlayAnim.h"
|
||
#include "ZeMem.h"
|
||
#include "Micros.h"
|
||
|
||
#include "ia_dnm.h"
|
||
|
||
#include "objinit.h"
|
||
#include "Chanlist.h"
|
||
|
||
|
||
/* For interpolated animations*/
|
||
#include "PlayAnim/Interpol/a3x_intn.h"
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : init animation events for a character
|
||
* this should be called when the anim of a character did change
|
||
* Aim : init the array of activation (there is one activation value for each event
|
||
* of the anim. The event is played when the activation is 0
|
||
*-----------------------------------------------------------------------------
|
||
* Input : object
|
||
* Output : void
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : 16/10/96 Author : blef
|
||
*---------------------------------------------------------------------------*/
|
||
void fn_vInitAllEvents(HIE_tdxHandleToSuperObject p_stSuperObject,unsigned short uwFirstFrame)
|
||
{
|
||
MS_tdxHandleTo3dData h_3dData;
|
||
tdxHandleToState h_State;
|
||
tdstAnim3d * p_stAnim;
|
||
tdstEvent * p_stEvent;
|
||
unsigned char i;
|
||
/* get the anim*/
|
||
h_3dData = M_GetMSHandle( p_stSuperObject, 3dData );
|
||
h_State = fn_h3dDataGetCurrentState(h_3dData);
|
||
if ( h_State == NULL ) return; /* not a good object (camera) ...*/
|
||
p_stAnim = fn_p_stGetAnimInState(h_State);
|
||
/* get the events array*/
|
||
p_stEvent= fn_p_GetEventsAddress( p_stAnim, uwFirstFrame,fn_h3dDataGetCurrentObjectsTable(h_3dData) );
|
||
|
||
/* init all events*/
|
||
if ( p_stEvent != NULL ) {
|
||
/* allocate array of event activation*/
|
||
fn_v3dDataAllocateEventActivation(h_3dData,p_stAnim->ucNumberOfEvents);
|
||
|
||
/* do not start a the first framE*/
|
||
if (uwFirstFrame) {
|
||
/* search next Event to play*/
|
||
for (i = 0;(i < p_stAnim->ucNumberOfEvents) && (p_stEvent[i].uwFrameNumber < uwFirstFrame);i++);
|
||
|
||
fn_v3dDataSetNextEvent(h_3dData,i);
|
||
}
|
||
/* start at first frame*/
|
||
else {
|
||
if ( fn_scGetSpeedInState(h_State) > 0 )
|
||
fn_v3dDataSetNextEvent(h_3dData,0);
|
||
else
|
||
fn_v3dDataSetNextEvent(h_3dData,(unsigned char)(p_stAnim->ucNumberOfEvents - 1));
|
||
}
|
||
|
||
/* fill rest of array of activation*/
|
||
for (i=0; i < p_stAnim->ucNumberOfEvents;i++,p_stEvent++)
|
||
fn_v3dDataSetEventActivationByIndex(h_3dData,i,GAM_fn_ucGetFirstCallOfEvent(p_stEvent));
|
||
}
|
||
}
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : DesInit animation events for a character
|
||
* Should be called when the anim is about to change
|
||
* Do not call if the next anim is the same as the current one
|
||
* If the next anim normally follows the current one, call with
|
||
* bStopEvents set to FALSE.
|
||
* If the next anim interrupt the current one, call with bStopEvents
|
||
* set to TRUE.
|
||
* Never Play are played only when bStopEvents & if are not present
|
||
* in the next state
|
||
*-----------------------------------------------------------------------------
|
||
* Input : object
|
||
the future state
|
||
* bStopEvents must be set to TRUE if we want 'NeverPlay' stop events
|
||
* to be played
|
||
* Output : void
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : 16/10/96 Author : blef
|
||
*-----------------------------------------------------------------------------
|
||
* Modif 08/10/98 : add next in parameter and check for never play in the next state - Carlos Torres
|
||
*-----------------------------------------------------------------------------
|
||
* Modif 25/01/99 : Fix for real time load and short cache - AR
|
||
*---------------------------------------------------------------------------*/
|
||
void fn_vDesInitAllEvents(HIE_tdxHandleToSuperObject p_stSuperObject,tdxHandleToState hNextState,BOOL bStopEvents)
|
||
{
|
||
MS_tdxHandleTo3dData h_3dData;
|
||
tdxHandleToState h_State;
|
||
tdstAnim3d * p_stAnim;
|
||
tdstEvent * p_stEvent;
|
||
int i,j;
|
||
unsigned short uwFrameNumber;
|
||
|
||
/* MR1006*/
|
||
/* fn_vPlayEventsSinceLastOneNoLoop(p_stSuperObject);*/
|
||
/* get the anim*/
|
||
|
||
h_3dData = M_GetMSHandle( p_stSuperObject, 3dData );
|
||
h_State = fn_h3dDataGetCurrentState(h_3dData);
|
||
if ( h_State == NULL )
|
||
return; /* not a good object (camera) ...*/
|
||
p_stAnim = fn_p_stGetAnimInState(h_State);
|
||
|
||
if ((p_stAnim)&&(p_stAnim->ucNumberOfEvents!=0))
|
||
{
|
||
uwFrameNumber=h_3dData->uwCurrentFrame;
|
||
if ( uwFrameNumber >= p_stAnim -> uwNumberOfFrames )
|
||
uwFrameNumber = ( unsigned short ) ( p_stAnim -> uwNumberOfFrames - 1 );
|
||
|
||
/* get the events array*/
|
||
p_stEvent= fn_p_GetEventsAddress( p_stAnim,uwFrameNumber,fn_h3dDataGetCurrentObjectsTable(h_3dData) );
|
||
|
||
/* des-init all events*/
|
||
if ( p_stEvent != NULL )
|
||
{
|
||
if ( bStopEvents )
|
||
{
|
||
tdstAnim3d * p_stNextAnim = NULL;
|
||
tdstEvent * p_stNextEvent = NULL;
|
||
tdstEvent * p_stNextEvent2;
|
||
|
||
/* get next event table*/
|
||
if (hNextState)
|
||
{
|
||
p_stNextAnim = fn_p_stGetAnimInState(hNextState);
|
||
if ((p_stNextAnim)&&(p_stNextAnim->ucNumberOfEvents!=0))
|
||
{
|
||
p_stNextEvent = fn_p_GetEventsAddress(p_stNextAnim,0,fn_h3dDataGetCurrentObjectsTable(h_3dData));
|
||
/* Store events into a temporary array*/
|
||
if(p_stNextEvent!=NULL)
|
||
{
|
||
p_stNextEvent2 = (tdstEvent*)TMP_M_p_Malloc(sizeof(tdstEvent) * p_stNextAnim->ucNumberOfEvents);
|
||
memcpy(p_stNextEvent2,p_stNextEvent,sizeof(tdstEvent) * p_stNextAnim->ucNumberOfEvents);
|
||
p_stNextEvent=p_stNextEvent2;
|
||
|
||
/* Reinit Event pointer (load it in cache if n<>cessary)*/
|
||
p_stEvent = fn_p_GetEventsAddress(p_stAnim,uwFrameNumber,fn_h3dDataGetCurrentObjectsTable(h_3dData));
|
||
|
||
/* play 'NeverPlay' stop events*/
|
||
for (i = 0; i < p_stAnim->ucNumberOfEvents;i++,p_stEvent++)
|
||
{
|
||
int bNeverPlayFound = FALSE;
|
||
|
||
if (GAM_fn_ucGetFirstCallOfEvent(p_stEvent) == C_ucNeverPlay )
|
||
{
|
||
/* search event in next anim */
|
||
/* reinit NextEvent*/
|
||
p_stNextEvent=p_stNextEvent2;
|
||
|
||
for (j = 0;j < p_stNextAnim->ucNumberOfEvents;j++,p_stNextEvent++)
|
||
{
|
||
/* found a never play*/
|
||
if (GAM_fn_ucGetFirstCallOfEvent(p_stNextEvent) == C_ucNeverPlay)
|
||
{
|
||
/* check if is the same never play*/
|
||
if (GAM_fn_p_xGetEventOfEvent(p_stEvent) == GAM_fn_p_xGetEventOfEvent(p_stNextEvent))
|
||
{
|
||
bNeverPlayFound = TRUE;
|
||
break;
|
||
}
|
||
}
|
||
/* no more never play*/
|
||
else
|
||
break;
|
||
}
|
||
|
||
/* this is a 'NeverPlay' stop event, play it*/
|
||
if (!bNeverPlayFound)
|
||
fn_vPlayEvent(p_stEvent,C_ucStopEvent,p_stSuperObject);
|
||
}
|
||
/* all stop event are in the beginnig of the array (ucFrameNumber == 0)*/
|
||
/* so if we find a non 'NeverPlay' event, we can stop*/
|
||
else
|
||
break;
|
||
}
|
||
TMP_M_Free(p_stNextEvent2);
|
||
}
|
||
else
|
||
{
|
||
/* no event into the next anim -> play all neverplay events*/
|
||
/* Reinit Event pointer (load it in cache if n<>cessary)*/
|
||
p_stEvent = fn_p_GetEventsAddress(p_stAnim,0,fn_h3dDataGetCurrentObjectsTable(h_3dData));
|
||
|
||
/* play 'NeverPlay' stop events*/
|
||
for (i = 0; i < p_stAnim->ucNumberOfEvents;i++,p_stEvent++)
|
||
{
|
||
if (GAM_fn_ucGetFirstCallOfEvent(p_stEvent) == C_ucNeverPlay )
|
||
fn_vPlayEvent(p_stEvent,C_ucStopEvent,p_stSuperObject);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
/* no next anim -> play all neverplay events*/
|
||
/* Reinit Event pointer (load it in cache if n<>cessary)*/
|
||
p_stEvent = fn_p_GetEventsAddress(p_stAnim,0,fn_h3dDataGetCurrentObjectsTable(h_3dData));
|
||
|
||
/* play 'NeverPlay' stop events*/
|
||
for (i = 0; i < p_stAnim->ucNumberOfEvents;i++,p_stEvent++)
|
||
{
|
||
if (GAM_fn_ucGetFirstCallOfEvent(p_stEvent) == C_ucNeverPlay )
|
||
fn_vPlayEvent(p_stEvent,C_ucStopEvent,p_stSuperObject);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
fn_v3dDataSetNextEvent(h_3dData,0);
|
||
/* free array of event activation*/
|
||
fn_v3dDataFreeEventActivation(h_3dData);
|
||
}
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : play animation events for a character since the last played
|
||
* call this function if the anim did not restart.
|
||
* If the anim is about to loop, call fn_vPlayLastEventsBeforeRestart
|
||
* for the current anim, then call this function when new current frame
|
||
* has been set.
|
||
*-----------------------------------------------------------------------------
|
||
* Input : object
|
||
* Output : void
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : 16/10/96 Author : blef
|
||
*---------------------------------------------------------------------------*/
|
||
void fn_vPlayEventsSinceLastOneNoLoop( HIE_tdxHandleToSuperObject p_stSuperObject )
|
||
{
|
||
MS_tdxHandleTo3dData h_3dData;
|
||
tdxHandleToState h_State;
|
||
tdstAnim3d * p_stAnim;
|
||
tdstEvent * p_stEvent;
|
||
|
||
/* get the anim*/
|
||
h_3dData = M_GetMSHandle( p_stSuperObject, 3dData );
|
||
h_State = fn_h3dDataGetCurrentState(h_3dData);
|
||
if ( h_State == NULL ) return; /* not a good object (camera) ...*/
|
||
p_stAnim = fn_p_stGetAnimInState(h_State);
|
||
/* get the events array*/
|
||
p_stEvent= fn_p_GetEventsAddress( p_stAnim, h_3dData->uwCurrentFrame,fn_h3dDataGetCurrentObjectsTable(h_3dData) );
|
||
|
||
if ( p_stEvent != NULL )
|
||
{
|
||
if ( fn_scGetSpeedInState(h_State) > 0 )
|
||
{
|
||
/* play events from past frames*/
|
||
while ( fn_uc3dDataGetNextEvent(h_3dData) !=p_stAnim->ucNumberOfEvents && p_stEvent[ fn_uc3dDataGetNextEvent(h_3dData) ].uwFrameNumber <= fn_uw3dDataGetCurrentFrame(h_3dData))
|
||
{
|
||
/* is it time to play event ?*/
|
||
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData)) == 0 )
|
||
{
|
||
/* play the event*/
|
||
fn_vPlayEvent( &p_stEvent[ fn_uc3dDataGetNextEvent(h_3dData) ], C_ucNormal ,p_stSuperObject);
|
||
/* update activation*/
|
||
fn_v3dDataSetEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData),GAM_fn_ucGetPeriodOfEvent(&(p_stEvent[ fn_uc3dDataGetNextEvent(h_3dData) ])));
|
||
}
|
||
else
|
||
{
|
||
/* may be next loop : update activation if not NevrPlay*/
|
||
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData)) != C_ucNeverPlay )
|
||
fn_v3dDataAddEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData),-1);
|
||
}
|
||
/* next event*/
|
||
fn_v3dDataAddNextEvent(h_3dData,1);
|
||
}
|
||
}
|
||
/* reverse play animation*/
|
||
else /* SpeedAnim < 0*/
|
||
{
|
||
/* play events from past frames*/
|
||
while ( fn_uc3dDataGetNextEvent(h_3dData) != 255 && p_stEvent[ fn_uc3dDataGetNextEvent(h_3dData) ].uwFrameNumber >= fn_uw3dDataGetCurrentFrame(h_3dData))
|
||
{
|
||
/* is it time to play event ?*/
|
||
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData)) == 0 )
|
||
{
|
||
fn_vPlayEvent( &p_stEvent[ fn_uc3dDataGetNextEvent(h_3dData) ], C_ucReverse ,p_stSuperObject);
|
||
fn_v3dDataSetEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData),GAM_fn_ucGetPeriodOfEvent(&(p_stEvent[ fn_uc3dDataGetNextEvent(h_3dData) ])));
|
||
}
|
||
else
|
||
{
|
||
/* may be next loop*/
|
||
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData) ) != C_ucNeverPlay )
|
||
fn_v3dDataAddEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData),-1);
|
||
}
|
||
fn_v3dDataAddNextEvent(h_3dData,-1);
|
||
/* we do not loop (unsigned values)*/
|
||
/* if last event has been treated, next event will be 255 and will stop the while*/
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : play all remaining animation events for a character
|
||
* since the last played.
|
||
* Call this function if the anim is about to change
|
||
* then after changing anim (or restarting anim) and setting the
|
||
* current frame, call fn_vPlayEventsSinceLastOneNoLoop
|
||
*-----------------------------------------------------------------------------
|
||
* Input : object
|
||
* Number of complete loops
|
||
* Output : void
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : 16/10/96 Author : blef
|
||
*---------------------------------------------------------------------------*/
|
||
void fn_vPlayLastEventsBeforeRestart( HIE_tdxHandleToSuperObject p_stSuperObject )
|
||
{
|
||
MS_tdxHandleTo3dData h_3dData;
|
||
tdxHandleToState h_State;
|
||
tdstAnim3d * p_stAnim;
|
||
tdstEvent * p_stEvent;
|
||
/*XB980504*/
|
||
/*unsigned*/ char i;
|
||
/*End XB*/
|
||
|
||
/* get the anim*/
|
||
h_3dData = M_GetMSHandle( p_stSuperObject, 3dData );
|
||
h_State = fn_h3dDataGetCurrentState(h_3dData);
|
||
if ( h_State == NULL ) return; /* not a good object (camera) ...*/
|
||
p_stAnim = fn_p_stGetAnimInState(h_State);
|
||
/* get the events array*/
|
||
p_stEvent= fn_p_GetEventsAddress( p_stAnim, h_3dData->uwCurrentFrame-1,fn_h3dDataGetCurrentObjectsTable(h_3dData) );
|
||
/*SEB p_stEvent = p_stAnim->d_stAnimEvent;*/
|
||
|
||
if ( p_stEvent != NULL )
|
||
{
|
||
if ( fn_scGetSpeedInState(h_State) > 0 )
|
||
{
|
||
/* play last frames events*/
|
||
for ( i = fn_uc3dDataGetNextEvent(h_3dData); i < p_stAnim->ucNumberOfEvents; i++ )
|
||
{
|
||
/* is it time to play event ?*/
|
||
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,i) == 0 )
|
||
{
|
||
fn_vPlayEvent( &p_stEvent[ i ], C_ucNormal ,p_stSuperObject);
|
||
fn_v3dDataSetEventActivationByIndex(h_3dData, i, GAM_fn_ucGetPeriodOfEvent(&(p_stEvent[ i ])));
|
||
}
|
||
else
|
||
{
|
||
/* may be next loop*/
|
||
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,i) != C_ucNeverPlay )
|
||
fn_v3dDataAddEventActivationByIndex(h_3dData, i , -1);
|
||
}
|
||
}
|
||
/* set next event if the animation in case the animation is looping*/
|
||
fn_v3dDataSetNextEvent(h_3dData,0);
|
||
}
|
||
else /* SpeedAnim < 0*/
|
||
{
|
||
/* play 'first' frames events*/
|
||
/* this test is here if the last event has been treated (unsigned values)*/
|
||
if ( fn_uc3dDataGetNextEvent(h_3dData) != 255 )
|
||
{
|
||
for ( i = fn_uc3dDataGetNextEvent(h_3dData); i >= 0; i-- )
|
||
{
|
||
/* is it time to play event ?*/
|
||
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,i) == 0 )
|
||
{
|
||
fn_vPlayEvent( &p_stEvent[ i ], C_ucReverse ,p_stSuperObject);
|
||
fn_v3dDataSetEventActivationByIndex(h_3dData, i, GAM_fn_ucGetPeriodOfEvent(&(p_stEvent[ i ])));
|
||
}
|
||
else
|
||
{
|
||
/* may be next loop*/
|
||
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,i) != C_ucNeverPlay )
|
||
fn_v3dDataAddEventActivationByIndex(h_3dData, i , -1);
|
||
}
|
||
}
|
||
}
|
||
/* set next event if the animation in case the animation is looping*/
|
||
fn_v3dDataSetNextEvent(h_3dData,(unsigned char)(p_stAnim->ucNumberOfEvents - 1));
|
||
}
|
||
}
|
||
}
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : play one animation event
|
||
*-----------------------------------------------------------------------------
|
||
* Input : event to be played
|
||
* mode ( normal or reverse )
|
||
* Output : void
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : 16/10/96 Author : blef
|
||
*---------------------------------------------------------------------------*/
|
||
void fn_vPlayEvent( tdstEvent * p_stEvent, unsigned char ucMode ,HIE_tdxHandleToSuperObject p_stSuperObject)
|
||
{
|
||
SND_tduRefEvt SoundEvt;
|
||
|
||
/* switch( p_stEvent->ucTypeOfEvent )
|
||
{
|
||
case C_ucSOUND_EVENT :
|
||
break;
|
||
case C_ucACTION_EVENT :
|
||
break;
|
||
case C_ucGENERATE_EVENT :
|
||
break;
|
||
default :
|
||
break;
|
||
}*/
|
||
/* test events : uses TRACE*/
|
||
#if defined(_DEBUG) && defined(WIN32) && defined(__cplusplus)
|
||
char szType[25];
|
||
char szMode[25];
|
||
#endif /* _DEBUG && WIN32 && __cplusplus */
|
||
/*long lTmpTypeOfMechEvt;*/
|
||
/* LRM_eKindOfRequest eMechEvent;*/
|
||
|
||
switch( GAM_fn_ucGetTypeOfEvent(p_stEvent) )
|
||
{
|
||
case C_ucSOUND_EVENT :
|
||
SoundEvt.pstPtr=(SND_tdstBlockEvent*)GAM_fn_p_xGetEventOfEvent(p_stEvent);
|
||
SND_fn_lSendRequestSound((long)p_stSuperObject,g_lSoundObjectTypeAnim,SoundEvt,0,NULL);
|
||
#if defined(_DEBUG) && defined(WIN32) && defined(__cplusplus)
|
||
strcpy( szType, "SoundEvent");
|
||
#endif /* _DEBUG && WIN32 && __cplusplus */
|
||
break;
|
||
/* MR2803: Add a mechanics event to the LRM list*/
|
||
/* case C_ucMECHANIC_EVENT :
|
||
lTmpTypeOfMechEvt=(long)GAM_fn_p_xGetEventOfEvent(p_stEvent);
|
||
eMechEvent = (LRM_eKindOfRequest)lTmpTypeOfMechEvt;
|
||
if(M_GetMSHandle(p_stSuperObject,Dynam) != NULL )
|
||
LRM_fn_xBoolAddRequest
|
||
(fn_pDynamGetListOfRequests(M_GetMSHandle(p_stSuperObject,Dynam)),
|
||
eMechEvent ,
|
||
fn_h_GetCurrentDNMIdCard(p_stSuperObject));
|
||
if(eMechEvent == LRM_eRequest_Jump)
|
||
LRM_fn_xBoolDelAllRequestsOfThisType(fn_pDynamGetListOfRequests(M_GetMSHandle(p_stSuperObject,Dynam)),
|
||
LRM_eRequest_GoRelative);
|
||
|
||
fn_v3dDataSetNbEngineFrameSinceLastMechEvent(M_GetMSHandle(p_stSuperObject,3dData),0);
|
||
strcpy( szType, "MechanicEvent");
|
||
break;*/
|
||
case C_ucGENERATE_EVENT :
|
||
break;
|
||
/* MR1206*/
|
||
case C_ucGENERIC_EVENT :
|
||
{
|
||
long lEvent;
|
||
unsigned char ucTypeOfEvent;
|
||
/*unsigned short uwChannel;*/
|
||
HIE_tdxHandleToSuperObject hSupObjTakenObject;
|
||
|
||
lEvent=(long)GAM_fn_p_xGetEventOfEvent(p_stEvent);
|
||
ucTypeOfEvent=(unsigned char)(lEvent&0xff);
|
||
/*uwChannel=(unsigned short)(lEvent>>8);*/
|
||
|
||
if ( (ucTypeOfEvent >= C_ucEvent_User0) && (ucTypeOfEvent <= C_ucEvent_User7) )
|
||
|
||
|
||
|
||
|
||
{
|
||
MTH3D_tdstVector stPosition;
|
||
/*get the channel superobject*/
|
||
hSupObjTakenObject = fn_hGetSuperObjectInChannel(fn_h3dDataGetChannelSOList(M_GetMSHandle(p_stSuperObject,3dData)),p_stEvent->uwChannelNumber);
|
||
if ( hSupObjTakenObject )
|
||
{
|
||
unsigned long ulCustomBits = fn_ulStandardGameGetCustomBitsSO(p_stSuperObject);
|
||
|
||
/* check if position have been update by the player*/
|
||
if(!(ulCustomBits & GAM_C_CustBitNeedModuleMatrices))
|
||
{
|
||
fn_vStandardGameSetCustomBitsSO(p_stSuperObject,ulCustomBits|GAM_C_CustBitNeedModuleMatrices);
|
||
PLA_fn_vRefreshGlobalMatrixUnderCharacter(p_stSuperObject);
|
||
fn_vStandardGameSetCustomBitsSO(p_stSuperObject,ulCustomBits);
|
||
}
|
||
|
||
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(hSupObjTakenObject), &stPosition);
|
||
fn_v3dDataSetUserEventFlag
|
||
(
|
||
M_GetMSHandle(p_stSuperObject,3dData),
|
||
(unsigned char) (ucTypeOfEvent - C_ucEvent_User0),
|
||
TRUE,
|
||
&stPosition
|
||
);
|
||
}
|
||
}
|
||
}
|
||
break;
|
||
default :
|
||
break;
|
||
}
|
||
|
||
#if defined(_DEBUG) && defined(WIN32) && defined(__cplusplus)
|
||
switch( ucMode )
|
||
{
|
||
case C_ucNormal :
|
||
strcpy( szMode, "Normal");
|
||
break;
|
||
case C_ucReverse :
|
||
strcpy( szMode, "Reverse");
|
||
break;
|
||
case C_ucStopEvent :
|
||
strcpy( szMode, "Stop");
|
||
break;
|
||
default :
|
||
break;
|
||
}
|
||
|
||
TRACE3( "%s %s %d\n", szType, szMode, (long)p_stEvent->p_xEvent );
|
||
#endif /* _DEBUG && WIN32 && __cplusplus */
|
||
}
|
||
|
||
unsigned short fn_uwGetNbEngineFrameSinceLastMechEvent(HIE_tdxHandleToSuperObject p_stSuperObject)
|
||
{
|
||
return fn_uw3dDataGetNbEngineFrameSinceLastMechEvent(M_GetMSHandle(p_stSuperObject,3dData));
|
||
}
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Get the type of an event (V5 or V6 format)
|
||
*-----------------------------------------------------------------------------
|
||
* Input : _p_stEvent : pointer to the event
|
||
* Output : the type
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : Jan 98 Author : Alain Robin
|
||
*---------------------------------------------------------------------------*/
|
||
unsigned char GAM_fn_ucGetTypeOfEvent(tdstEvent* _p_stEvent)
|
||
{
|
||
return _p_stEvent->p_stfEventInTBL->ucTypeOfEvent;
|
||
}
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Get the pointed event of an event (V5 or V6 format)
|
||
*-----------------------------------------------------------------------------
|
||
* Input : _p_stEvent : pointer to the event
|
||
* Output : the event
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : Jan 98 Author : Alain Robin
|
||
*---------------------------------------------------------------------------*/
|
||
void* GAM_fn_p_xGetEventOfEvent(tdstEvent* _p_stEvent)
|
||
{
|
||
return _p_stEvent->p_stfEventInTBL->p_xEvent;
|
||
}
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Get the address pointed event of an event (V5 or V6 format)
|
||
*-----------------------------------------------------------------------------
|
||
* Input : _p_stEvent : pointer to the event
|
||
* Output : the address
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : Jan 98 Author : Alain Robin
|
||
*---------------------------------------------------------------------------*/
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
||
void** GAM_fn_p_xGetAdressOfEventOfEvent(tdstEvent* _p_stEvent)
|
||
{
|
||
return &(_p_stEvent->p_stfEventInTBL->p_xEvent);
|
||
}
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
||
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Set the pointed event of an event (V5 or V6 format)
|
||
*-----------------------------------------------------------------------------
|
||
* Input : _p_stEvent : pointer to the animation event
|
||
* _p_xRealEvent : pointed event
|
||
* Output :
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : Jan 98 Author : Alain Robin
|
||
*---------------------------------------------------------------------------*/
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
||
void GAM_fn_vSetEventOfEvent(tdstEvent* _p_stEvent,void* _p_xRealEvent)
|
||
{
|
||
_p_stEvent->p_stfEventInTBL->p_xEvent=_p_xRealEvent;
|
||
}
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
||
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Get the first call field of an event (V5 or V6 format)
|
||
*-----------------------------------------------------------------------------
|
||
* Input : _p_stEvent : pointer to the event
|
||
* Output : the first call
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : Jan 98 Author : Alain Robin
|
||
*---------------------------------------------------------------------------*/
|
||
unsigned char GAM_fn_ucGetFirstCallOfEvent(tdstEvent* _p_stEvent)
|
||
{
|
||
return _p_stEvent->p_stfEventInTBL->ucFirstCall;
|
||
}
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Get the first call field of an event (V5 or V6 format)
|
||
*-----------------------------------------------------------------------------
|
||
* Input : _p_stEvent : pointer to the event
|
||
* Output : the first call
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : Jan 98 Author : Alain Robin
|
||
*---------------------------------------------------------------------------*/
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
||
void GAM_fn_vSetFirstCallOfEvent(tdstEvent* _p_stEvent,unsigned char _ucFirstCall)
|
||
{
|
||
_p_stEvent->p_stfEventInTBL->ucFirstCall=_ucFirstCall;
|
||
}
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
||
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Get the period field of an event (V5 or V6 format)
|
||
*-----------------------------------------------------------------------------
|
||
* Input : _p_stEvent : pointer to the event
|
||
* Output : the period
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : Jan 98 Author : Alain Robin
|
||
*---------------------------------------------------------------------------*/
|
||
unsigned char GAM_fn_ucGetPeriodOfEvent(tdstEvent* _p_stEvent)
|
||
{
|
||
return _p_stEvent->p_stfEventInTBL->ucPeriod;
|
||
}
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Get the first call field of an event (V5 or V6 format)
|
||
*-----------------------------------------------------------------------------
|
||
* Input : _p_stEvent : pointer to the event
|
||
* Output : the first call
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : Jan 98 Author : Alain Robin
|
||
*---------------------------------------------------------------------------*/
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
||
void GAM_fn_vSetPeriodOfEvent(tdstEvent* _p_stEvent,unsigned char _ucPeriod)
|
||
{
|
||
_p_stEvent->p_stfEventInTBL->ucPeriod=_ucPeriod;
|
||
}
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
||
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Get the binary event id of an event (V5 or V6 format)
|
||
*-----------------------------------------------------------------------------
|
||
* Input : _p_stEvent : pointer to the event
|
||
* Output : the binary event id
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : Jan 98 Author : Alain Robin
|
||
*---------------------------------------------------------------------------*/
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
||
/*
|
||
unsigned long GAM_fn_ulGetBinaryEventIdOfEvent(tdstEvent* _p_stEvent)
|
||
{
|
||
return _p_stEvent->p_stfEventInTBL->ulBinaryEventId;
|
||
}
|
||
*/
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
||
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Get the first call field of an event (V5 or V6 format)
|
||
*-----------------------------------------------------------------------------
|
||
* Input : _p_stEvent : pointer to the event
|
||
* Output : the first call
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : Jan 98 Author : Alain Robin
|
||
*---------------------------------------------------------------------------*/
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
||
/*
|
||
void GAM_fn_vSetBinaryEventIdOfEvent(tdstEvent* _p_stEvent,unsigned long _ulBinaryEventId)
|
||
{
|
||
_p_stEvent->p_stfEventInTBL->ulBinaryEventId=_ulBinaryEventId;
|
||
}
|
||
*/
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
||
|
||
|