/*========================================================================= * IPT_Anal.c : * Analyse entry * * (c) Ubi Studios 1997 *=======================================================================*/ #include #include "IPT_CPA.h" #include "IPT_Hdl.h" #define D_IPT_Input_StructureDefine #include "IPT_KDef.h" #include "IPT_Str.h" #include "ErrIPT.h" #define D_IPT_DefineIsKeyWordValid #include "IPT_Kwan.h" #undef D_IPT_DefineIsKeyWordValid #undef D_IPT_Input_StructureDefine #include "IPT_Hist.h" #include "IPT_Def.h" #include "IPT_Anal.h" /* ANNECY AV DEMO {*/ #ifndef U64 int IPT_g_bAtLeastOneActionIsValidated; #endif /* END ANNECY AV }*/ #ifdef U64 #include "TMP.h" /* for demo player*/ #include "u_dma.h" /* idem*/ #include "Input_s.h" /*************************************************************************/ /* 007*/ #endif #include "acp_driver.h" #ifndef M_CheckPointer #define M_CheckPointer(a) #endif /* M_CheckPointer */ /*#ifdef U64_DEMO_RECORDER unsigned long TabDemoRecord[C_MaxDemoEntry*C_NbCodedEntry]; #else extern char _DemoDataSegmentRomStart[]; extern char _DemoDataSegmentRomEnd[]; unsigned long* TabDemoRecord=NULL; #endif short NbDemoEntry; char IPT_DemoMode = IPT_M_DemoStopMode;*/ /* ANNECY AV {*/ extern IPT_tdxHandleToEntryElement g_h_ActualEntryInput; extern IPT_tdxHandleToKeyWordElement IPT_g_hNextParameter; INLINE unsigned char IPT_fn_bIsEntryActionValid(IPT_tdxHandleToEntryElement _hEntryElement) { g_h_ActualEntryInput = _hEntryElement; /* g_h_ActualEntryInput -> scAnalogicValue = 0;*/ g_h_ActualEntryInput->xAnalogicValue = 0.0f; /* '=' is not an error*/ IPT_g_hNextParameter = &_hEntryElement->d_stKeyWordElementArray[0]; if (IPT_g_hNextParameter!=NULL) return (IPT_fn_bIsKeyWordValid( IPT_g_hNextParameter )); else return (IPT_C_FALSE); } /* END ANNECY AV }*/ /*************************************************************************/ unsigned char IPT_fn_bIsJustValidated(IPT_tdxHandleToEntryElement _hEntryElement) { return((_hEntryElement->lState==1)?IPT_C_TRUE:IPT_C_FALSE); } /*************************************************************************/ unsigned char IPT_fn_bIsValidated(IPT_tdxHandleToEntryElement _hEntryElement) { /*XB*/ M_CheckPointer(_hEntryElement); /*End XB*/ return((_hEntryElement->lState>0)?IPT_C_TRUE:IPT_C_FALSE); } /*************************************************************************/ unsigned char IPT_fn_bIsJustInvalidated(IPT_tdxHandleToEntryElement _hEntryElement) { return((_hEntryElement->lState==-1)?IPT_C_TRUE:IPT_C_FALSE); } /*************************************************************************/ unsigned char IPT_fn_bIsInvalidated(IPT_tdxHandleToEntryElement _hEntryElement) { return((_hEntryElement->lState<0)?IPT_C_TRUE:IPT_C_FALSE); } /*************************************************************************/ long IPT_fn_lGetAnalogicValue(IPT_tdxHandleToEntryElement _hEntryElement) { /* return((long)(_hEntryElement->scAnalogicValue));*/ return((long)(_hEntryElement->xAnalogicValue)); } /*************************************************************************/ void IPT_fn_vReadInput(void) { unsigned long i; IPT_tdxHandleToEntryElement hEntryElement; unsigned char ucIsActionValid; unsigned char ucValid = IPT_C_TRUE; #ifdef USE_DIRECTX //Mouse Read /**** Read the Mouse device ****/ // if (IPT_g_hInputStructure.p_ucValideAndActiveDevice[IPT_E_KeyboardDeviceEvent] == IPT_C_ActivateDevice) if (INO_fn_wReadMouse()== C_wMouseError) { ucValid = IPT_C_FALSE; } #ifdef TEST_MOUSE else { float x,y; int i,j; static int kk=0; if(INO_fn_wRightMouseButtonDown()==C_wMouseTrue) { INO_fn_wGetMousePositionInGldDevice(&x,&y); if(INO_fn_wGetMousePosition(&i,&j)==C_wMouseTrue) { kk++; } else { kk--; } kk++; } } #endif #endif /**** Read the keyboard device ****/ #if (!defined(U64)) if (IPT_g_hInputStructure.p_ucValideAndActiveDevice[IPT_E_KeyboardDeviceEvent] == IPT_C_ActivateDevice) if (fn_wKbReadKeyboard()==C_wKbError) ucValid = IPT_C_FALSE; #endif /* !U64 */ /**** Read the joysticks devices ****/ if (IPT_g_hInputStructure.ucOnePadActivate == IPT_C_ActivateDevice) if (fn_wJoyReadJoystick(C_wJoyReadConnected)==C_wJoyError) ucValid = IPT_C_FALSE; if (ucValid==IPT_C_TRUE) { /**** Historic ****/ IPT_fn_vActualizeHistoric(); #ifndef U64 IPT_g_bAtLeastOneActionIsValidated = FALSE; #endif /**** Actions ****/ for (i=0;ibIsActivate==IPT_C_TRUE) { ucIsActionValid = IPT_fn_bIsEntryActionValid(hEntryElement); if (ucIsActionValid == IPT_C_FALSE) { if (IPT_fn_bIsInvalidated (hEntryElement)) hEntryElement -> lState -= 1; else if (IPT_fn_bIsValidated (hEntryElement)) hEntryElement -> lState = -1; } else { if (IPT_fn_bIsValidated (hEntryElement)) hEntryElement -> lState += 1; else if (IPT_fn_bIsInvalidated (hEntryElement)) hEntryElement -> lState = 1; } } } } }