890 lines
27 KiB
C
890 lines
27 KiB
C
/*=========================================================================
|
|
* Input.cpp : Contain the pad structure.
|
|
* This is a part of the Game project.
|
|
*
|
|
* Version 1.0
|
|
* Creation date 22/08/96
|
|
* Revision date
|
|
*
|
|
* That file needs to be compatible for all platforms.
|
|
*
|
|
* (c) Ubi Studios 1996
|
|
*=======================================================================*/
|
|
//#define DEMO
|
|
|
|
#if defined(WIN32)
|
|
#include <stdio.h>
|
|
#endif /* WIN32 */
|
|
|
|
#include "ToolsCPA.h"
|
|
|
|
#include "Macros.h"
|
|
|
|
#include "Actions/AllActs.h"
|
|
|
|
#include "Structur/EngMode.h"
|
|
#include "Structur/ErrGame.h"
|
|
#include "Structur/Input_S.h"
|
|
#include "Structur/StdObjSt.h"
|
|
#include "Structur/Objects.h"
|
|
|
|
#include "Ai\AiBase\WPEngDsp.h"
|
|
|
|
#include "Always.h"
|
|
#include "Basic.h"
|
|
#include "Input.h"
|
|
#include "InitEng.h"
|
|
#include "GameEng.h"
|
|
#include "GamOpt.h"
|
|
#include "ObjInit.h"
|
|
#include "ObjType.h"
|
|
#include "Zemem.h"
|
|
#include "Mainchar.h"
|
|
|
|
#include "prf.h"
|
|
|
|
#if !defined(U64)
|
|
#include "SnapShot.h"
|
|
#endif /* U64 */
|
|
|
|
#ifdef GAME_MENUS
|
|
#endif /* GAME_MENUS */
|
|
|
|
extern BOOL g_bAnimConstantSpeed;
|
|
|
|
#define D_3dData_StructureDefine
|
|
#include "LipsSync.h"
|
|
#include "micros.h"
|
|
#include "actions\3dData.h"
|
|
|
|
#ifdef U64
|
|
#include "u_boot.h"
|
|
#include "u_cfb.h"
|
|
#include "U_zbuf.h"
|
|
#include "GLD/Specif/u_vpt.h" /*AR9810*/
|
|
#endif /*U64*/
|
|
|
|
#ifndef RETAIL
|
|
#include "PlayAnim/interpol/a3x_Mem.h"
|
|
#endif
|
|
|
|
#ifdef GAM_USE_SNA
|
|
#include "SNA\snaglob.h"
|
|
#endif /* GAM_USE_SNA*/
|
|
|
|
/* XB 05/05/99 */
|
|
extern void GAM_fn_vEventuallyRecordDemo(void);
|
|
extern void fn_vSwitchToDemoLevel(void);
|
|
/* End XB 05/05/99 */
|
|
|
|
/**************************************************************************/
|
|
extern GAM_fn_vClearWindowRaster();
|
|
extern unsigned char g_ucZDCVisible;
|
|
extern unsigned char g_ucDisplayBoundingVolumes;
|
|
#if defined(_DEBUG)
|
|
extern unsigned char g_ucWhatDoIDisplay;
|
|
#endif /* _DEBUG */
|
|
|
|
#if !defined(U64) && defined(_DEBUG)
|
|
extern unsigned char g_ucSlowDownEngine;
|
|
extern unsigned char g_ucSlowDownTime;
|
|
#endif /* !U64 && _DEBUG */
|
|
|
|
#if defined(GAM_USE_SCRIPT)
|
|
SCR_tde_Anl_ReturnValue fn_eScriptCallBackIPTLink(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;
|
|
unsigned long ulNumberOfEntry;
|
|
IPT_tdxHandleToEntryElement hCurrentEntry;
|
|
|
|
if (M_IsTitle)
|
|
{
|
|
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,0);
|
|
}
|
|
else if (M_IsEntry)
|
|
{
|
|
if (M_ActionIs(C_Entry_IPTLink))
|
|
{
|
|
if( stricmp(_ap_szParams[0],"ForAllVersion")
|
|
#if defined(WIN32)
|
|
||stricmp(_ap_szParams[0],"ForPc")
|
|
#endif /* WIN32 */
|
|
)
|
|
{
|
|
hCurrentEntry = IPT_fn_hGetEntryActionHandle(_ap_szParams[0]);
|
|
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,unsigned long,ulNumberOfEntry);
|
|
*((IPT_tdxHandleToEntryElement*)&g_st_3DOS_EntryActions+ulNumberOfEntry) = hCurrentEntry;
|
|
ulNumberOfEntry++;
|
|
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,ulNumberOfEntry);
|
|
}
|
|
}
|
|
}
|
|
else if (M_IsEnd)
|
|
{
|
|
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,unsigned long,ulNumberOfEntry);
|
|
if (ulNumberOfEntry!=sizeof(struct tdst_EntryActions_)/sizeof(IPT_tdxHandleToEntryElement))
|
|
M_GameFatalError(E_uwGameScriptBadIPTLinkNumber);
|
|
}
|
|
|
|
return(eReturnValue);
|
|
}
|
|
#endif /* GAM_USE_SCRIPT */
|
|
|
|
/**** Useful for displaying extra datas ****/
|
|
unsigned char g_ucDisplayWaypoints = 0;
|
|
|
|
#if !defined(U64) && defined(_DEBUG)
|
|
unsigned char g_ucDisplayRayTraceSegments = 0;
|
|
short g_wRayTraceSegmentLife[30] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
MTH3D_tdstVector g_stRayTraceSegmentOrigin[30];
|
|
MTH3D_tdstVector g_stRayTraceSegmentEnd[30];
|
|
#endif /* !U64 && _DEBUG */
|
|
|
|
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
|
unsigned char g_ucDisplayBoundingVolumes = 0;
|
|
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
|
|
|
|
|
/* ANNECY CG KEY 4 ACTIVATED GENDOORS 18/06/98 {*/
|
|
unsigned char g_ucDisplayActivatedGendoors;
|
|
#ifndef U64
|
|
extern unsigned char ucIsInitDone;
|
|
extern unsigned char ucIsInitDone4Gendoors;
|
|
#endif
|
|
|
|
#if defined(__cplusplus)
|
|
extern "C"
|
|
{
|
|
#endif /* __cplusplus */
|
|
unsigned char g_ucDisplayCenters;
|
|
#if defined(__cplusplus)
|
|
}
|
|
#endif /* __cplusplus */
|
|
/* } ENDANNECY CG*/
|
|
|
|
|
|
#ifdef PROFILE_IA
|
|
extern void dumpCond();
|
|
extern void dumpFunc();
|
|
extern void dumpProc();
|
|
extern void clearCond();
|
|
extern void clearFunc();
|
|
extern void clearProc();
|
|
#endif /* PROFILE_IA*/
|
|
|
|
|
|
|
|
/****************** FabPerez Cheat Code *****************/
|
|
#if defined(WIN32) && defined(_DEBUG)
|
|
#define D_IPT_Input_StructureDefine
|
|
#include "IPT/IPT_KDef.h"
|
|
#include "IPT/IPT_Str.h"
|
|
#undef D_IPT_Input_StructureDefine
|
|
|
|
extern IPT_tdxHandleToKeyWordElement g_hKeyWordElement;
|
|
extern IPT_tdxHandleToEntryElement g_h_ActualEntryInput;
|
|
extern g_iXValueCheat, g_iYValueCheat;
|
|
|
|
void AnalyseCheatCode(void);
|
|
void fnIncDeltaTime(BOOL INC_DELTA);
|
|
void fnInvertPad(BOOL INVERT_PAD);
|
|
void fnRandomPad(BOOL RANDOM_PAD);
|
|
|
|
#define PRF_C_lMaxNbCheatCodeVariable 4
|
|
#define CHEAT_CODE0 0
|
|
#define CHEAT_CODE_DELTA_TIME 1
|
|
#define CHEAT_CODE_INVERT_PAD 2
|
|
#define CHEAT_CODE_RANDOM_PAD 3
|
|
|
|
BOOL g_CheatCodeActivate = FALSE;
|
|
BOOL a_lCheatCodeVariable[PRF_C_lMaxNbCheatCodeVariable] = {FALSE, FALSE, FALSE, FALSE};
|
|
BOOL IsActiveCheatCode(unsigned long ulCurrentCheatCode);
|
|
void (*a_p_fnCheatCodeFonction[PRF_C_lMaxNbCheatCodeVariable] )(BOOL)= {NULL, fnIncDeltaTime, fnInvertPad, fnRandomPad};
|
|
unsigned long g_ulCurrentCheatCode = 0;
|
|
#endif //(WIN32) &(_DEBUG)
|
|
/****************** Fin FabPerez Cheat Code *****************/
|
|
|
|
|
|
|
|
/****************** FabPerez Cheat Code *****************/
|
|
#if defined(WIN32) && defined(_DEBUG)
|
|
void AnalyseCheatCode(void)
|
|
{
|
|
int i;
|
|
int CurrentCheatCode, PrecedentCheatCode;
|
|
|
|
if(g_ulCurrentCheatCode != 0)
|
|
{
|
|
if(g_ulCurrentCheatCode == PRF_C_lMaxNbCheatCodeVariable || g_ulCurrentCheatCode == 1)
|
|
{
|
|
g_ulCurrentCheatCode = 1;
|
|
CurrentCheatCode = 1;
|
|
PrecedentCheatCode = PRF_C_lMaxNbCheatCodeVariable-1;
|
|
}
|
|
else
|
|
{
|
|
CurrentCheatCode = g_ulCurrentCheatCode;
|
|
PrecedentCheatCode = g_ulCurrentCheatCode-1;
|
|
}
|
|
|
|
a_lCheatCodeVariable[PrecedentCheatCode] = FALSE;
|
|
a_lCheatCodeVariable[CurrentCheatCode] = TRUE;
|
|
}
|
|
else // Desactive tous les CheatCodes
|
|
{
|
|
for(i=1; i < PRF_C_lMaxNbCheatCodeVariable; i++)
|
|
{
|
|
a_lCheatCodeVariable[i] = FALSE;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
BOOL IsActiveCheatCode(unsigned long ulCurrentCheatCode)
|
|
{
|
|
return a_lCheatCodeVariable[ulCurrentCheatCode];
|
|
}
|
|
|
|
void fnInvertPad(BOOL INVERT_PAD)
|
|
{
|
|
if(INVERT_PAD)
|
|
{
|
|
g_iXValueCheat = -g_iXValueCheat;
|
|
g_iYValueCheat = -g_iYValueCheat;
|
|
}
|
|
}
|
|
|
|
void fnRandomPad(BOOL RANDOM_PAD)
|
|
{
|
|
double Test;
|
|
|
|
if(RANDOM_PAD)
|
|
{
|
|
Test = ((double) rand() *2) / ((double) RAND_MAX) ;
|
|
g_iXValueCheat *= Test;
|
|
g_iYValueCheat *= Test;
|
|
}
|
|
}
|
|
|
|
void fnIncDeltaTime(BOOL INC_DELTA)
|
|
{
|
|
u_long ulTmpValue;
|
|
stTimerCount stRealTimeCountTmp;
|
|
unsigned long ulDeltaTime;
|
|
|
|
if(INC_DELTA)
|
|
{
|
|
fn_wTimerRead(g_stEngineStructure.stEngineTimer.sTimerHandle,&stRealTimeCountTmp);
|
|
|
|
if ( stRealTimeCountTmp.m_ulHighPart == g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulHighPart )
|
|
{
|
|
ulDeltaTime = stRealTimeCountTmp.m_ulLowPart - g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart;
|
|
}
|
|
else
|
|
{
|
|
if ( stRealTimeCountTmp.m_ulLowPart >= g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart )
|
|
ulDeltaTime = stRealTimeCountTmp.m_ulLowPart - g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart;
|
|
else
|
|
{
|
|
ulDeltaTime = stRealTimeCountTmp.m_ulLowPart + (0xffffffff - g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart + 1);
|
|
}
|
|
}
|
|
|
|
if ( g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart >= ulDeltaTime )
|
|
g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart -= ulDeltaTime;
|
|
else
|
|
{
|
|
g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart -= ulDeltaTime;
|
|
//g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart += 0xffffffff - ulDeltaTime + 1;
|
|
g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulHighPart--;
|
|
}
|
|
}
|
|
/*
|
|
typedef struct tdstEngineTimerStructure_
|
|
{
|
|
unsigned long ulTrameNumber; // Number of the frame
|
|
short sTimerHandle;
|
|
unsigned long ulCurrentTimerCount; // Current trame timer in msec
|
|
unsigned long ulDeltaTimerCount; //Between two trames in msec
|
|
unsigned long a_ulCounter[C_NumberOfCounter]; // Other frequencies counters
|
|
unsigned long ulUsefulDeltaTime; // computed time in msec
|
|
unsigned long ulPauseTime; // When engine is in pause
|
|
MTH_tdxReal xFrameLength; // frame length in s ( 60Hz -> 1/60 s )
|
|
#ifndef U64
|
|
struct _stTimerCount stRealTimeCount; // Current trame timer in tick
|
|
struct _stTimerCount stPauseTime;
|
|
unsigned long ulTickPerMS;
|
|
#endif // U64
|
|
} tdstEngineTimerStructure;
|
|
|
|
typedef struct _stTimerCount
|
|
{
|
|
u_long m_ulLowPart;
|
|
u_long m_ulHighPart;
|
|
|
|
} stTimerCount
|
|
*/
|
|
}
|
|
#endif //(WIN32) &(_DEBUG)
|
|
/****************** Fin FabPerez Cheat Code *****************/
|
|
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
void fn_vAnalyse3DOSSpecialInputActions(void)
|
|
{
|
|
#if (defined(U64) && (!defined(FINAL_VERSION) || defined(FINAL_VERSION_FOR_TESTERS))) || (!defined(U64) && !defined(FINAL_VERSION) && !defined(RETAIL))
|
|
/*************************************/
|
|
/**** Toggle Solid/Wire rendering ****/
|
|
/*************************************/
|
|
#if !defined(PRESS_DEMO)
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayModeToggle)==IPT_C_TRUE)
|
|
{
|
|
if(g_stEngineStructure.ulDisplayMode & 0x00000004) /*We are in Draw Solid Mode*/
|
|
{
|
|
g_stEngineStructure.ulDisplayMode &= ~0x00000004;
|
|
}
|
|
else
|
|
{
|
|
g_stEngineStructure.ulDisplayMode |= 0x00000004;
|
|
}
|
|
|
|
}
|
|
#endif /* PRESS_DEMO */
|
|
|
|
|
|
/********************************/
|
|
/**** Displays Sectors infos ****/
|
|
/********************************/
|
|
#if !defined(PRESS_DEMO)
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplaySectorInfos)==IPT_C_TRUE)
|
|
{
|
|
/*--- 0 : No display*/
|
|
/*--- 1 : Displays VISIBLE interaction*/
|
|
/*--- 2 : Displays COLLISION interaction*/
|
|
/*--- 3 : Displays ACTIVITY interaction*/
|
|
/*--- 4 : Displays SOUND interaction*/
|
|
g_ucSCTDisplaySectors = (unsigned char) (( g_ucSCTDisplaySectors + 1 ) % 5);
|
|
}
|
|
#endif /* PRESS_DEMO */
|
|
|
|
/****************************/
|
|
/**** Displays WayPoints ****/
|
|
/****************************/
|
|
#if !defined(PRESS_DEMO)
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayWaypoints)==IPT_C_TRUE)
|
|
{
|
|
/* ANNECY AV {*/
|
|
#ifdef GAM_USE_SNA
|
|
if (SNA_fn_ucGetLoadType () != SNA_LOAD_SNAPSHOT) /* Don't show waypoints in binarized version*/
|
|
#endif /* GAM_USE_SNA*/
|
|
/* END ANNECY AV } // (because this needs a script load)*/
|
|
{
|
|
/*--- 0 : No display*/
|
|
/*--- 1 : Displays waypoints*/
|
|
g_ucDisplayWaypoints = (unsigned char)((g_ucDisplayWaypoints + 1) % 2);
|
|
}
|
|
}
|
|
#endif /* PRESS_DEMO */
|
|
|
|
|
|
/************************************/
|
|
/**** Displays RayTrace segments ****/
|
|
/************************************/
|
|
#if !defined(PRESS_DEMO)
|
|
#if !defined(U64) && defined(_DEBUG)
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayRayTraceSegments)==IPT_C_TRUE)
|
|
{
|
|
/*--- 0 : No display*/
|
|
/*--- 1 : Display RayTrace Segments*/
|
|
g_ucDisplayRayTraceSegments = (unsigned char) (( g_ucDisplayRayTraceSegments + 1 ) % 2);
|
|
}
|
|
#endif /* !U64 && _DEBUG */
|
|
#endif /* PRESS_DEMO */
|
|
|
|
|
|
/*******************************************
|
|
* Displays Activated Gendoors 18/06/98 *
|
|
*******************************************/
|
|
#if !defined(PRESS_DEMO)
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayActivatedGendoors)==IPT_C_TRUE)
|
|
{
|
|
g_ucDisplayActivatedGendoors =(unsigned char) ((g_ucDisplayActivatedGendoors + 1) % 2);
|
|
}
|
|
#endif /* PRESS_DEMO */
|
|
|
|
/*******************************************
|
|
* Clear options displayed 20/10/98 *
|
|
*******************************************/
|
|
#if !defined(PRESS_DEMO)
|
|
/* Oliv' - Portage v14*/
|
|
#ifndef U64
|
|
/* EndOfOliv'*/
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hClearOptionsDisplayed)==IPT_C_TRUE)
|
|
{
|
|
#ifdef USE_PROFILER
|
|
unsigned long ulRasterDisplayMode;
|
|
#endif
|
|
|
|
g_ucDisplayActivatedGendoors = 0; /* Clear Gendoors*/
|
|
g_ucDisplayWaypoints = 0; /* Clear WayPoints*/
|
|
#if !defined(U64) && defined(_DEBUG)
|
|
g_ucDisplayRayTraceSegments = 0; /* Clear RayTrace segments*/
|
|
#endif /* !U64 && _DEBUG */
|
|
g_ucZDCVisible = 0; /* Clear Zones*/
|
|
g_ucSCTDisplaySectors = 0; /* Clear Sectors infos*/
|
|
g_ucDisplayBoundingVolumes = 0; /* Clear Bouding Volume*/
|
|
g_stEngineStructure.ulDisplayMode |= 0x00000004; /* Toggle Mode*/
|
|
|
|
/**** Clear rasters ****/
|
|
PRF_fn_vSetIndependantVariable (PRF_C_ulIdpCurrentPage,0);
|
|
|
|
/**** Static/dynamic ****/
|
|
#if defined(_DEBUG)
|
|
g_ucWhatDoIDisplay = 0;
|
|
#endif /* _DEBUG */
|
|
|
|
#ifdef USE_PROFILER
|
|
ulRasterDisplayMode = PRF_fn_lGetIndependantVariable(PRF_C_ulIdpRasterDisplayMode);
|
|
ulRasterDisplayMode &= ~PRF_C_ulShowAll;
|
|
ulRasterDisplayMode |= PRF_C_ulShowAll;
|
|
PRF_fn_vSetIndependantVariable( PRF_C_ulIdpRasterDisplayMode , ulRasterDisplayMode );
|
|
#endif
|
|
}
|
|
/* Oliv' - Portage v14*/
|
|
#endif
|
|
/* EndOfOliv'*/
|
|
#endif /* PRESS_DEMO */
|
|
|
|
|
|
#if !defined(PRESS_DEMO)
|
|
#ifdef PROFILE_IA
|
|
if (GetAsyncKeyState(VK_HOME) & 0x8000)
|
|
{
|
|
clearCond();
|
|
clearFunc();
|
|
clearProc();
|
|
}
|
|
|
|
if (GetAsyncKeyState(VK_INSERT) & 0x8000)
|
|
{
|
|
dumpCond();
|
|
dumpFunc();
|
|
dumpProc();
|
|
}
|
|
#endif /* PROFILE_IA*/
|
|
#endif /* PRESS_DEMO */
|
|
|
|
|
|
#if !defined(U64)
|
|
#ifndef RETAIL
|
|
|
|
#if !defined(PRESS_DEMO)
|
|
#if defined(_DEBUG)
|
|
/*******************/
|
|
/* Slowdown engine */
|
|
/*******************/
|
|
if (GetAsyncKeyState('A') & 0x8001)
|
|
{
|
|
if (g_ucSlowDownEngine)
|
|
{
|
|
if (GetAsyncKeyState (VK_CONTROL) & 0x8000)
|
|
{
|
|
if (g_ucSlowDownTime < 255 - (g_stEngineStructure.stEngineTimer.xFrameLength * 1000)) g_ucSlowDownTime += (g_stEngineStructure.stEngineTimer.xFrameLength * 1000);
|
|
}
|
|
else if (GetAsyncKeyState (VK_SHIFT) & 0x8000)
|
|
{
|
|
if (g_ucSlowDownTime > (g_stEngineStructure.stEngineTimer.xFrameLength * 1000)) g_ucSlowDownTime -= (g_stEngineStructure.stEngineTimer.xFrameLength * 1000);
|
|
else g_ucSlowDownTime = 0;
|
|
}
|
|
else
|
|
{
|
|
g_ucSlowDownEngine = 1 - g_ucSlowDownEngine;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
g_ucSlowDownEngine = 1 - g_ucSlowDownEngine;
|
|
}
|
|
}
|
|
#endif /* _DEBUG */
|
|
#endif /* PRESS_DEMO */
|
|
|
|
/**************************/
|
|
/**** Screen snap shot ****/
|
|
/**************************/
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hScreenSnapShot)==IPT_C_TRUE)
|
|
fn_vGetAndSaveSnapShotOfScreenAsBMP();
|
|
|
|
#if !defined(PRESS_DEMO)
|
|
/* ANNECY AV DEMO {*/
|
|
/**************************/
|
|
/**** Demo Keys ****/
|
|
/**************************/
|
|
{
|
|
static int bRecordKeyPressed = FALSE;
|
|
static int bPlayKeyPressed = FALSE;
|
|
static int bSaveKeyPressed = FALSE;
|
|
static int bLoadKeyPressed = FALSE;
|
|
static int bVCRKeyPressed = FALSE;
|
|
|
|
|
|
if ((GetAsyncKeyState ('E') & 0x8000) && (GetAsyncKeyState (VK_CONTROL) & 0x8000) && (GetAsyncKeyState (VK_SHIFT) & 0x8000))
|
|
{
|
|
if (bRecordKeyPressed == FALSE)
|
|
{
|
|
bRecordKeyPressed = TRUE;
|
|
|
|
fn_vReinitTheMap();
|
|
|
|
if(g_DEMO_KeybTest == DEMO_PLAY) g_DEMO_KeybTest = DEMO_NOTHING;
|
|
else DEMO_fn_vPrepareForWrite ();
|
|
}
|
|
}
|
|
else bRecordKeyPressed = FALSE;
|
|
|
|
if ((GetAsyncKeyState ('L') & 0x8000) && (GetAsyncKeyState (VK_CONTROL) & 0x8000) && (GetAsyncKeyState (VK_SHIFT) & 0x8000))
|
|
{
|
|
if (bPlayKeyPressed == FALSE)
|
|
{
|
|
bPlayKeyPressed = TRUE;
|
|
|
|
fn_vReinitTheMap ();
|
|
DEMO_fn_vSetTestInputDuringDemo (TRUE);
|
|
DEMO_fn_vSetMapToLoadWhenDemoFinished ("");
|
|
DEMO_fn_vPrepareForRead (0);
|
|
}
|
|
}
|
|
else bPlayKeyPressed = FALSE;
|
|
|
|
if ((GetAsyncKeyState ('S') & 0x8000) && (GetAsyncKeyState (VK_CONTROL) & 0x8000) && (GetAsyncKeyState (VK_SHIFT) & 0x8000))
|
|
{
|
|
if (bSaveKeyPressed == FALSE)
|
|
{
|
|
bSaveKeyPressed = TRUE;
|
|
DEMO_fn_vSaveToFile ();
|
|
g_DEMO_KeybTest = DEMO_NOTHING;
|
|
}
|
|
}
|
|
else bSaveKeyPressed = FALSE;
|
|
|
|
if ((GetAsyncKeyState ('C') & 0x8000) && (GetAsyncKeyState (VK_CONTROL) & 0x8000) && (GetAsyncKeyState (VK_SHIFT) & 0x8000))
|
|
{
|
|
if (bLoadKeyPressed == FALSE)
|
|
{
|
|
bLoadKeyPressed = TRUE;
|
|
DEMO_fn_vLoadFromFile ("Demos\\Demo000.Sav");
|
|
}
|
|
}
|
|
else bLoadKeyPressed = FALSE;
|
|
|
|
if ((GetAsyncKeyState ('V') & 0x8000) && (GetAsyncKeyState (VK_CONTROL) & 0x8000) && (GetAsyncKeyState (VK_SHIFT) & 0x8000))
|
|
{
|
|
if (bVCRKeyPressed == FALSE)
|
|
{
|
|
bVCRKeyPressed = TRUE;
|
|
DEMO_fn_vSwitchVCRMode ();
|
|
}
|
|
}
|
|
else bVCRKeyPressed = FALSE;
|
|
}
|
|
#endif /* PRESS_DEMO */
|
|
|
|
#endif /* !RETAIL ? */
|
|
/* END ANNECY AV }*/
|
|
|
|
#endif /*!defined(U64)*/
|
|
|
|
|
|
/****************** FabPerez Cheat Code *****************/
|
|
#if !defined(PRESS_DEMO)
|
|
#if defined(WIN32) && defined(_DEBUG)
|
|
if ((GetAsyncKeyState ('C') & 0x8000) && (GetAsyncKeyState (VK_SHIFT) & 0x8000))
|
|
{
|
|
g_CheatCodeActivate = TRUE;
|
|
++g_ulCurrentCheatCode;
|
|
AnalyseCheatCode();
|
|
}
|
|
else if((GetAsyncKeyState ('C') & 0x8000) && (GetAsyncKeyState (VK_CONTROL) & 0x8000))
|
|
{
|
|
g_CheatCodeActivate = TRUE;
|
|
g_ulCurrentCheatCode = 0;
|
|
AnalyseCheatCode();
|
|
}
|
|
|
|
#endif /*WIN32 _DEBUG*/
|
|
#endif /* PRESS_DEMO */
|
|
/***************** Fin FabPerez Cheat Code *****************/
|
|
|
|
|
|
|
|
/********************/
|
|
/**** Pause Mode ****/
|
|
/********************/
|
|
/* ANNECY AV {*/
|
|
/*
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hPause)==IPT_C_TRUE)
|
|
{
|
|
if (!fn_bIsEngineInPause())
|
|
fn_vSetEngineInPaused();
|
|
else
|
|
fn_vResetEngineFromPaused();
|
|
}
|
|
|
|
if (g_stEngineStructure.eEngineMode==EM_ModePlaying)
|
|
{
|
|
// ************************ Oliv' - Portage v15 : remove 1 warning here
|
|
// *** Display Fix Mode *** Oliv' - Portage v15 : remove 1 warning here
|
|
// ************************ Oliv' - Portage v15 : remove 1 warning here
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayFixMode)==IPT_C_TRUE)
|
|
{
|
|
if (g_stEngineStructure.eDisplayFixMode==DFM_DisplayAll)
|
|
fn_vSetDisplayFixFlag(DFM_DisplayNothing);
|
|
else if (g_stEngineStructure.eDisplayFixMode==DFM_DisplayNothing)
|
|
fn_vSetDisplayFixFlag(DFM_DisplayAll);
|
|
}
|
|
}
|
|
*/
|
|
/* END ANNECY AV }*/
|
|
|
|
/******************************************************/
|
|
/**** Restart map when loaded and when player dead ****/
|
|
/******************************************************/
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hReinitTheMap)==IPT_C_TRUE)
|
|
{
|
|
/*FB101298*/
|
|
#ifndef U64
|
|
if (g_DEMO_KeybTest == DEMO_PLAY) DEMO_fn_vStopWhenPlaying();
|
|
#endif /*U64*/
|
|
/*END FB*/
|
|
if (!g_stEngineStructure.bEngineFrozen)
|
|
fn_vReinitTheMap();
|
|
}
|
|
|
|
#if !defined(PRESS_DEMO)
|
|
/*HP 071098 */
|
|
#ifdef U64
|
|
/* Marc:Begin */
|
|
#ifdef DEMO
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hRecordDemo)==IPT_C_TRUE)
|
|
{
|
|
|
|
char *szName=fn_p_szGetLevelName();
|
|
|
|
GAM_fn_vEventuallyRecordDemo();
|
|
fn_vSetNextLevelName(szName);
|
|
fn_vChangeEngineMode(EM_ModeChangeLevel);
|
|
// fn_vReinitTheMap();
|
|
}
|
|
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hPlayDemo)==IPT_C_TRUE)
|
|
{
|
|
INO_fn_vU64PlayDemo();
|
|
fn_vSwitchToDemoLevel();
|
|
/* GAM_fn_vLaunchDemoMode(); */
|
|
}
|
|
#endif /* DEMO */
|
|
#endif /* U64 */
|
|
#endif /* PRESS_DEMO */
|
|
|
|
|
|
#if !defined(PRESS_DEMO)
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayLight)==IPT_C_TRUE)
|
|
g_bShowLight=(unsigned char)(1-g_bShowLight);
|
|
#endif /* PRESS_DEMO */
|
|
|
|
/* ANNECY AV {*/
|
|
/*
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hTestMemory)==IPT_C_TRUE)
|
|
fn_vGameTestMemory();
|
|
*/
|
|
/* END ANNECY AV }*/
|
|
|
|
/******************************************************/
|
|
/**** change map menu ****/
|
|
/******************************************************/
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hChooseLevel)==IPT_C_TRUE)
|
|
if (g_stEngineStructure.ucNumberOfLevels > 1)
|
|
g_cChooseLevel = 0;
|
|
|
|
if (g_cChooseLevel > -1)
|
|
{
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hChooseLevelUp)==IPT_C_TRUE)
|
|
{
|
|
g_cChooseLevel = (char) ((g_cChooseLevel + 1) % g_stEngineStructure.ucNumberOfLevels);
|
|
}
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hChooseLevelDown)==IPT_C_TRUE)
|
|
{
|
|
g_cChooseLevel = (char)((g_cChooseLevel + g_stEngineStructure.ucNumberOfLevels - 1) % g_stEngineStructure.ucNumberOfLevels);
|
|
}
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hChooseLevelValidate)==IPT_C_TRUE)
|
|
{
|
|
#ifndef U64
|
|
ucIsInitDone4Gendoors = 0;
|
|
ucIsInitDone = 0;
|
|
#endif
|
|
g_ucDisplayActivatedGendoors = 0;
|
|
g_ucDisplayCenters = 0;
|
|
g_ucDisplayWaypoints = 0;
|
|
|
|
GAM_fn_vAskToChangeLevel( g_stEngineStructure.a_szLevelName[ g_cChooseLevel ] , TRUE );
|
|
g_cChooseLevel = -1;
|
|
}
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hChooseLevelInvalidate)==IPT_C_TRUE)
|
|
{
|
|
g_cChooseLevel = -1;
|
|
}
|
|
}
|
|
|
|
/* ANNECY AV {*/
|
|
/*
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hConstantAnimSpeed)==IPT_C_TRUE)
|
|
{
|
|
g_bAnimConstantSpeed=1-g_bAnimConstantSpeed;
|
|
}
|
|
*/
|
|
|
|
#if !defined(PRESS_DEMO)
|
|
/* END ANNECY AV }*/
|
|
#ifndef RETAIL
|
|
/******************************************************/
|
|
/**** Anim Stack Log ****/
|
|
/******************************************************/
|
|
#ifdef GAM_USE_SCRIPT
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hMemoryStackLog)==IPT_C_TRUE) {
|
|
FILE * fLogFile;
|
|
|
|
/* open file in appending mode and add log*/
|
|
fLogFile = fopen("AnimStack.log","a");
|
|
if (fLogFile) {
|
|
fprintf(fLogFile,"=========> MAP : %s\n",g_stEngineStructure.szLevelName);
|
|
fn_vAnimStackLog(fLogFile);
|
|
fclose(fLogFile);
|
|
}
|
|
}
|
|
#endif /* GAM_USE_SCRIPT*/
|
|
#endif /* RETAIL */
|
|
|
|
#endif /* PRESS_DEMO */
|
|
|
|
#endif /* (defined(U64) && (!defined(FINAL_VERSION) || defined(FINAL_VERSION_FOR_TESTERS))) || (!defined(U64) && !defined(FINAL_VERSION) && !defined(RETAIL)) */
|
|
}
|
|
|
|
#define M_SwapFlag(lVar,lFlag) PRF_fn_vSetIndependantVariable( lVar , (PRF_fn_lGetIndependantVariable(lVar) & lFlag) ? (PRF_fn_lGetIndependantVariable(lVar) & ~lFlag) \
|
|
: (PRF_fn_lGetIndependantVariable(lVar) | lFlag) )
|
|
#define M_IsFlag(lVar,lFlag) (PRF_fn_lGetIndependantVariable(lVar) & lFlag ? TRUE : FALSE)
|
|
#define M_SetFlag(lVar,lFlag) PRF_fn_vSetIndependantVariable( lVar , (PRF_fn_lGetIndependantVariable(lVar) | lFlag) )
|
|
|
|
|
|
/**************************************************************************/
|
|
void fn_vEngineReadInput(void)
|
|
{
|
|
if (g_stEngineStructure.eInputMode==IM_Normal)
|
|
{
|
|
IPT_fn_vReadInput();
|
|
fn_vAnalyse3DOSSpecialInputActions();
|
|
|
|
#ifndef U64
|
|
#ifdef USE_PROFILER
|
|
/* page*/
|
|
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpVirtualKey, -1 );
|
|
|
|
#if !defined(PRESS_DEMO)
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayRaster)==IPT_C_TRUE)
|
|
{
|
|
if (! (GetAsyncKeyState( VK_RMENU) & 0x8000))
|
|
{
|
|
if (GetAsyncKeyState (VK_CONTROL) & 0x8000)
|
|
{
|
|
if ( !(GetAsyncKeyState (VK_SHIFT) & 0x8000) )
|
|
PRF_fn_lIncIndependantVariable (PRF_C_ulIdpAdvancedPage, 1); /* Activate/Disactivate advanced raster display mode*/
|
|
else
|
|
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulChangeActor); /* */
|
|
}
|
|
else
|
|
if (GetAsyncKeyState (VK_SHIFT) & 0x8000)
|
|
PRF_fn_lIncIndependantVariable (PRF_C_ulIdpCurrentPage,-1); /* Decreaze raster display mode number*/
|
|
else
|
|
PRF_fn_lIncIndependantVariable (PRF_C_ulIdpCurrentPage, 1); /* Increaze raster display mode number*/
|
|
|
|
/* clear screen*/
|
|
M_SetFlag(PRF_C_ulIdpRasterDisplayMode , PRF_C_ulClearScreen);
|
|
}
|
|
}
|
|
else if ( IPT_fn_bIsValidated(g_st_3DOS_EntryActions.hDisplayRaster) )
|
|
{
|
|
if (GetAsyncKeyState( VK_RMENU ) & 0x8000)
|
|
{
|
|
long lAsyncState;
|
|
|
|
if ( ((lAsyncState = GetAsyncKeyState(VK_RETURN)) & 0x8000) && !(lAsyncState & 1) )
|
|
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpVirtualKey, VK_RETURN );
|
|
if ( ((lAsyncState = GetAsyncKeyState(VK_BACK)) & 0x8000) && !(lAsyncState & 1) )
|
|
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpVirtualKey, VK_BACK );
|
|
/*
|
|
if ( ((lAsyncState = GetAsyncKeyState(VK_LEFT)) & 0x8000) && !(lAsyncState & 1) )
|
|
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpVirtualKey, VK_LEFT );
|
|
if ( ((lAsyncState = GetAsyncKeyState(VK_UP)) & 0x8000) && !(lAsyncState & 1) )
|
|
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpVirtualKey, VK_UP );
|
|
if ( ((lAsyncState = GetAsyncKeyState(VK_RIGHT)) & 0x8000) && !(lAsyncState & 1) )
|
|
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpVirtualKey, VK_RIGHT );
|
|
if ( ((lAsyncState = GetAsyncKeyState(VK_DOWN)) & 0x8000) && !(lAsyncState & 1) )
|
|
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpVirtualKey, VK_DOWN );
|
|
*/
|
|
|
|
}
|
|
}
|
|
|
|
/* mode*/
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayRasterPCU64)==IPT_C_TRUE)
|
|
{
|
|
if (GetAsyncKeyState (VK_CONTROL) & 0x8000)
|
|
{
|
|
if (M_IsFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulVariableMode))
|
|
{
|
|
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulVariableMode); /* Show/hide variable page*/
|
|
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulShowPGMMode); /* Show/hide variable page*/
|
|
}
|
|
else if (M_IsFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulShowPGMMode))
|
|
{
|
|
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulShowPGMMode);
|
|
}
|
|
else
|
|
{
|
|
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulVariableMode); /* Show/hide variable page*/
|
|
}
|
|
}
|
|
else if (GetAsyncKeyState (VK_SHIFT) & 0x8000)
|
|
{
|
|
if( (PRF_fn_lGetIndependantVariable (PRF_C_ulIdpRasterDisplayMode) & PRF_C_ulSuperImposed) )
|
|
GAM_fn_vClearWindowRaster();
|
|
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulSuperImposed); /* Show/hide variable page*/
|
|
}
|
|
else
|
|
{
|
|
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulU64Mode);
|
|
if( !(PRF_fn_lGetIndependantVariable (PRF_C_ulIdpRasterDisplayMode) & PRF_C_ulU64Mode) )
|
|
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulFinalMode);
|
|
}
|
|
/* clear screen*/
|
|
M_SetFlag(PRF_C_ulIdpRasterDisplayMode , PRF_C_ulClearScreen);
|
|
}
|
|
/* collumn*/
|
|
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayRasterMode)==IPT_C_TRUE)
|
|
{
|
|
if (GetAsyncKeyState (VK_CONTROL) & 0x8000) M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulShowMaximum); /* Ctrl +F3 : show/hide max*/
|
|
else if (GetAsyncKeyState (VK_SHIFT) & 0x8000) M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulShowAverage); /* Shift+F3 : show/hide average*/
|
|
else M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulShowCurrent); /* +F3 : show/hide current*/
|
|
|
|
/* clear screen*/
|
|
M_SetFlag(PRF_C_ulIdpRasterDisplayMode , PRF_C_ulClearScreen);
|
|
}
|
|
#endif /* PRESS_DEMO */
|
|
|
|
#endif /* USE_PROFILER */
|
|
#endif /* U64*/
|
|
}
|
|
}
|
|
/**************************************************************************/
|