Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS

Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
This commit is contained in:
Cyd
2026-06-24 21:28:16 -05:00
commit 2b8ca921cb
66341 changed files with 7923174 additions and 0 deletions
@@ -0,0 +1,300 @@
// CameraStateEngine.cpp ********************************************//
// Copyright Microsoft Corporation, 2001 //
// Created Owner Modification //
// -------- ------ ------------- //
// 3/7/2001 sdemar class definition for spectator state engine //
//*******************************************************************//
#include "CameraStateEngine.h"
using namespace MSRSpectator;
#include "SpectatorDebug.h"
#include <stdlib.h>
#include <string>
#include <iostream>
using namespace std;
#include "MW4.hpp"
#include "MWApplication.hpp"
#include "GameOS\GameOS.hpp"
#include "Mech.hpp"
CCameraStateEngine::CCameraStateEngine()
:
m_cameraState(STATE_STD_OBSERVERMODE),
m_cameraDist(NO_RANGE),
m_fSelectState(false),
m_distanceBetween(0.0f),
m_fNewShot(true),
m_fPrevWasOverShoulder(false)
{
m_stateTimer.Initialize(3);
m_dampTimer.Expire();
}
CCameraStateEngine::~CCameraStateEngine()
{
// stubbed
}
void CCameraStateEngine::TestInstance(void) const
{
// stubbed, required for Check_Object()
}
void CCameraStateEngine::ForceStateChange()
{
m_stateTimer.Expire();
m_fSelectState = true;
NullSpectatorState();
}
void CCameraStateEngine::NullSpectatorState()
{
if (m_stateTimer.CheckExpired())
m_stateTimer.Initialize(1.5);
m_cameraState = STATE_STD_OBSERVERMODE;
m_cameraDist = NO_RANGE;
}
void CCameraStateEngine::BumpStateTimer(double addAmt)
{
double timeRemaining = m_stateTimer.GetTimeRemaining();
if (timeRemaining > 0.0 && timeRemaining < addAmt)
m_stateTimer.Initialize(timeRemaining + addAmt);
else
m_stateTimer.Initialize(addAmt);
m_fSelectState = false;
}
double CCameraStateEngine::GetDampTimerRemaining()
{
return m_dampTimer.GetTimeRemaining();
}
void CCameraStateEngine::InitDampTimer(double inTime)
{
m_dampTimer.Initialize(inTime);
}
void CCameraStateEngine::ExpireDampTimer()
{
m_dampTimer.Expire();
}
int CCameraStateEngine::GetCameraStateToExecute(bool& stateChanged, int& cameraDist)
{
// NOTE, normally in a state engine, code would execute here per state.
// However we want to keep the game specific code in the game components.
// In our case that is camera work. So all we do here is monitor the
// state timer condition as to whether its time for a new state.
if (m_stateTimer.CheckExpired())
{
m_fSelectState = true;
}
stateChanged = m_fSelectState;
// And we return the camera state to the game engine so it can deal with
// executing the current MW4 Spectator specific cameras.
// NOTE: We execute once more on current camera because we may need to store
// game parameters to transition between this and the upcoming camera.
cameraDist = m_cameraDist;
return m_cameraState;
}
void CCameraStateEngine::StateTransitionExecute(bool fIsSamePairing, float distanceBetween)
{
// Here is where we do some basic camera choosing based on distance. We also
// randomly choose between cameras good at a given distance to break things up
// a little more. Since we are depending on indeterminate action you will adjust this
// section as appropriate for the kind of action you will encounter in your game.
// If the spectator mode ever becomes a cached-time process this section will change
// dramatically as you will be able to include logic for predictive decision making.
// Such as being able to look ahead in the data stream to see an event of interest about to
// happen somewhere in the world. In those situations you may want to deliberately move
// or place a camera before the event occurs to get a more interesting shot.
if (m_fSelectState == true)
{
m_fSelectState = false;
if (distanceBetween <= MAX_SIDE_DIST)
{
if (rand() % 3 == 0)
{ // 33.3%
m_stateTimer.Initialize(1.5);
m_cameraState = STATE_FIXED_TRACKING_SHOT;
m_cameraDist = MEDIUMSHOT;
}
else
{ // 66.6%
m_stateTimer.Initialize(2.0);
m_cameraState = STATE_SIDE_SHOT;
m_cameraDist = NO_RANGE;
}
}
else if ((MAX_SIDE_DIST < distanceBetween) && (distanceBetween <= 210.0f))
{
// over shoulder shots require some attention. Its possible for our hero
// to be engaging two or more enemys in random order. To keep the camera
// from radically jogging from one to another enemy, we use a transitioning
// shot.
if (m_fPrevWasOverShoulder || ((rand() % 3) != 0))
{ // 66.6%
m_fPrevWasOverShoulder = false;
m_stateTimer.Initialize(1.0);
m_cameraState = STATE_FRONT_SHOT;
m_cameraDist = CLOSESHOT;
}
else
{ // 33.3%
m_fPrevWasOverShoulder = true;
m_stateTimer.Initialize(3.0);
m_cameraState = STATE_OVERSHOULDER_SHOT;
m_cameraDist = MEDIUMSHOT;
}
}
else if ((210.0f < distanceBetween) && (distanceBetween <= 290.0f))
{
int cameraState, cameraDist;
do {
switch(rand() % 3) {
case 0:
cameraState = STATE_FRONT_SHOT;
break;
case 1:
cameraState = STATE_OVERSHOULDER_SHOT;
break;
default:
cameraState = STATE_FIXED_TRACKING_SHOT;
break;
}
switch(rand() % 3) {
case 0:
cameraDist = CLOSESHOT;
break;
case 1:
cameraDist = MEDIUMSHOT;
break;
default:
cameraDist = LONGSHOT;
break;
}
} while(((cameraState == m_cameraState) && (cameraDist == m_cameraDist)) || ((cameraState == STATE_OVERSHOULDER_SHOT) && m_fPrevWasOverShoulder));
switch(cameraState) {
default:
m_fPrevWasOverShoulder = false;
m_stateTimer.Initialize(2.0);
break;
case STATE_STD_OBSERVERMODE:
m_fPrevWasOverShoulder = true;
m_stateTimer.Initialize(3.0);
break;
}
m_cameraState = cameraState;
//m_cameraDist = cameraDist;
if (cameraState == STATE_FRONT_SHOT) {
m_cameraDist = MEDIUMSHOT;
} else {
m_cameraDist = LONGSHOT;
}
}
else
{
int cameraState, cameraDist;
do {
switch(rand() % 3) {
case 0:
cameraState = STATE_FRONT_SHOT;
break;
case 1:
cameraState = STATE_OVERSHOULDER_SHOT;
break;
case 2:
cameraState = STATE_FIXED_TRACKING_SHOT;
default:
cameraState = STATE_STD_OBSERVERMODE;
break;
}
if (cameraState == STATE_STD_OBSERVERMODE) {
cameraDist = NO_RANGE;
} else {
switch(rand() % 3) {
case 0:
cameraDist = CLOSESHOT;
break;
case 1:
cameraDist = MEDIUMSHOT;
break;
default:
cameraDist = LONGSHOT;
break;
}
}
} while(((cameraState == m_cameraState) && (cameraDist == m_cameraDist)) || ((cameraState == STATE_OVERSHOULDER_SHOT) && m_fPrevWasOverShoulder));
switch(cameraState) {
default:
m_fPrevWasOverShoulder = false;
m_stateTimer.Initialize(1.5);
break;
case STATE_FIXED_TRACKING_SHOT:
m_fPrevWasOverShoulder = false;
m_stateTimer.Initialize(2.0);
break;
case STATE_STD_OBSERVERMODE:
m_fPrevWasOverShoulder = true;
m_stateTimer.Initialize(3.0);
break;
}
m_cameraState = cameraState;
//m_cameraDist = cameraDist;
switch (cameraState)
{
case STATE_FIXED_TRACKING_SHOT:
m_cameraDist = LONGSHOT;
break;
case STATE_FRONT_SHOT:
m_cameraDist = CLOSESHOT;
break;
case STATE_OVERSHOULDER_SHOT:
m_cameraDist = CLOSESHOT;
break;
case STATE_STD_OBSERVERMODE:
m_cameraDist = NO_RANGE;
break;
}
}
}
}
bool CCameraStateEngine::GetIsTimeToSelectNewShot()
{
return m_fSelectState;
}
bool CCameraStateEngine::fIsValidSideDistance(float dist) const
{
return (dist >= 4.0f && dist <= MAX_SIDE_DIST);
}
@@ -0,0 +1,85 @@
// CameraStateEngine.h **********************************************//
// Created Owner Modification //
// Copyright Microsoft Corporation, 2002 //
// -------- ------ ------------- //
// 3/7/2002 sdemar provides FSM for spectator camera mgt //
//*******************************************************************//
#if !defined(MSR_CAMERA_STATE_ENGINE_)
#define MSR_CAMERA_STATE_ENGINE_
#include "SpectatorTimer.hpp"
#include "MW4\MW4Headers.hpp"
#include "Adept\GlobalPointerManager.hpp"
using namespace Adept;
#include <GameOS\GameOS.hpp>
//**************************************************
namespace MSRSpectator
{
class CCameraStateEngine
{
public:
// public methods
CCameraStateEngine(); // ctor
~CCameraStateEngine(); // dtor
int GetCameraStateToExecute(bool& stateChanged, int& cameraDist); // returns camera shot specific state to game engine
void StateTransitionExecute(bool fIsSamePairing, float distanceBetween); // fIsSamePairing is an overide condition for overShoulder stuff
bool GetIsTimeToSelectNewShot(); // gets boolean if new shot initialized
void ForceStateChange(); // triggers an overidden state change for special cases
void BumpStateTimer(double addAmt); // when transitioning in overshoulder shots, may need to add time to complete transition
double GetDampTimerRemaining(); // returns the amount of time remaining for current camera transition
void InitDampTimer(double); // initializes the current camera transition timer
void ExpireDampTimer(); // expires the current camera transition timer
bool fIsValidSideDistance(float dist) const; // true if distance value legal for side camera aspect view
void NullSpectatorState(); // shifts camera state to std observermode when no enemy of interest
static CCameraStateEngine* GetInstance() // required to support MW4's global pointer manager
{
return reinterpret_cast<CCameraStateEngine*>( GlobalPointers::GetGlobalPointer(CameraStateEnginePointerIndex));
};
void TestInstance(void) const; // required to support MW4'S Check_Object()
// public data
enum // exposed state constants
{
STATE_FRONT_SHOT,
STATE_OVERSHOULDER_SHOT,
STATE_FIXED_TRACKING_SHOT,
STATE_SIDE_SHOT,
STATE_STD_OBSERVERMODE,
STATE_DEATH_SEQUENCE_START,
STATE_DEATH_SEQUENCE_TRANS,
STATE_DEATH_SEQUENCE_SHOT,
};
enum
{
NO_RANGE = -1,
CLOSESHOT = 0,
MEDIUMSHOT = 1,
LONGSHOT = 2,
};
private:
// private data
CSpectatorTimer m_stateTimer; // determines when to transition to new camera state
CSpectatorTimer m_dampTimer; // used for camera damping transitions in overshoulder shots
int m_cameraState; // current camera state
int m_cameraDist;
bool m_fSelectState; // true if need to get new state
bool m_fNewShot; // true only when shot is first initialized
bool m_fPrevWasOverShoulder; // true if last camera was an over shoulder shot type
float m_distanceBetween; // distance between entities, used to determine camera shots
enum {MAX_SIDE_DIST = 90}; // maximum distance between hero and enemy for side shots
char bigThing[256]; // MW4 memory allocation doesn't like small things
};
}
#endif // !defined(MSR_CAMERA_STATE_ENGINE_)
@@ -0,0 +1,151 @@
# Microsoft Developer Studio Project File - Name="MSRSpectator" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=MSRSpectator - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "MSRSpectator.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "MSRSpectator.mak" CFG="MSRSpectator - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "MSRSpectator - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "MSRSpectator - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "MSRSpectator - Win32 Profile" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "MSRSpectator - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\Content" /I "." /I "..\..\Code" /I "..\..\Libraries" /I "..\..\..\CoreTech\Libraries" /I "..\..\Libraries\stlport" /I "..\MW4" /I "..\..\..\CoreTech\Libraries\GameOS" /D "_MBCS" /D "_LIB" /D "NDEBUG" /D "WIN32" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"../../../rel.bin\MSRSpectator.lib"
!ELSEIF "$(CFG)" == "MSRSpectator - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\Content" /I "." /I "..\..\Code" /I "..\..\Libraries" /I "..\..\..\CoreTech\Libraries" /I "..\..\Libraries\stlport" /I "..\MW4" /I "..\..\..\CoreTech\Libraries\GameOS" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"../../../dbg.bin\MSRSpectator.lib"
!ELSEIF "$(CFG)" == "MSRSpectator - Win32 Profile"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "MSRSpectator___Win32_Profile"
# PROP BASE Intermediate_Dir "MSRSpectator___Win32_Profile"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "MSRSpectator___Win32_Profile"
# PROP Intermediate_Dir "MSRSpectator___Win32_Profile"
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\Content" /I "." /I "..\..\Code" /I "..\..\Libraries" /I "..\..\..\CoreTech\Libraries" /I "..\..\Libraries\stlport" /I "..\MW4" /I "..\..\..\CoreTech\Libraries\GameOS" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\Content" /I "." /I "..\..\Code" /I "..\..\Libraries" /I "..\..\..\CoreTech\Libraries" /I "..\..\Libraries\stlport" /I "..\MW4" /I "..\..\..\CoreTech\Libraries\GameOS" /D "LAB_ONLY" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"../../../rel.bin\MSRSpectator.lib"
# ADD LIB32 /nologo /out:"../../../rel.bin\MSRSpectator.lib"
!ENDIF
# Begin Target
# Name "MSRSpectator - Win32 Release"
# Name "MSRSpectator - Win32 Debug"
# Name "MSRSpectator - Win32 Profile"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\CameraStateEngine.cpp
# End Source File
# Begin Source File
SOURCE=.\SpectatorDebug.cpp
# End Source File
# Begin Source File
SOURCE=.\SpectatorStateEngine.cpp
# End Source File
# Begin Source File
SOURCE=.\SpectatorTimer.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\CameraStateEngine.h
# End Source File
# Begin Source File
SOURCE=.\SpectatorDebug.h
# End Source File
# Begin Source File
SOURCE=.\SpectatorStateEngine.hpp
# End Source File
# Begin Source File
SOURCE=.\SpectatorTimer.hpp
# End Source File
# End Group
# End Target
# End Project
@@ -0,0 +1,57 @@
// SpectatorDebug.cpp ***********************************************//
// Copyright Microsoft Corporation, 2001 //
// Created Owner Modification //
// -------- ------ ------------- //
// 3/29/2001 sdemar provide some output window debugging //
//*******************************************************************//
#include "SpectatorDebug.h"
#include <stdlib.h>
#include <string>
using namespace std;
extern "C" void __stdcall OutputDebugStringA( const char * String );
void SpecDebug1(const char* x)
{
#if _DEBUG
OutputDebugStringA(x);
OutputDebugStringA("\n");
#endif
}
void SpecDebug2(const char* x, const char* y)
{
#if _DEBUG
OutputDebugStringA(x);
OutputDebugStringA(y);
OutputDebugStringA("\n");
#endif
}
void SpecDebugInt(const char* x, int y)
{
#if _DEBUG
OutputDebugStringA(x);
char num[80];
_itoa( y, num, 10 );
OutputDebugStringA(num);
OutputDebugStringA("\n");
#endif
}
void SpecDebugFlt(const char* x, double y)
{
#if _DEBUG
OutputDebugStringA(x);
char num[80];
_gcvt( y, 12, num );
OutputDebugStringA(num);
OutputDebugStringA("\n");
#endif
}
@@ -0,0 +1,17 @@
// SpectatorDebug.h *************************************************//
// Created Owner Modification //
// Copyright Microsoft Corporation, 2002 //
// -------- ------ ------------- //
// 3/25/2002 sdemar provides debug messaging //
//*******************************************************************//
#if !defined(MSR_SPECTATOR_DEBUG_)
#define MSR_SPECTATOR_DEBUG_
// general purpose IDE output window functions
void SpecDebug1(const char* x); // outputs a string, inserts newline at end
void SpecDebug2(const char* x, const char* y); // outputs 2 strings, inserts newline at end
void SpecDebugInt(const char* x, int y); // outputs string and integer, inserts newline at end
void SpecDebugFlt(const char* x, double y); // outputs string and scalar, inserts newline at end
#endif // !defined(MSR_SPECTATOR_DEBUG_)
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,208 @@
// CSpectatorStateEngine.hpp *****************************************//
// Created Owner Modification //
// Copyright Microsoft Corporation, 2001 //
// -------- ------ ------------- //
// 12/12/2001 sdemar provides FSM for spectator camera mgt //
//*******************************************************************//
#if !defined(MSR_SPECTATOR_STATE_ENGINE_)
#define MSR_SPECTATOR_STATE_ENGINE_
#include "SpectatorTimer.hpp"
#include "MW4\MW4Headers.hpp"
#include <MW4\Mech.hpp>
// #include "MWApplication.hpp"
// #include <MW4\MW4.hpp>
#include "Adept\GlobalPointerManager.hpp"
using namespace Adept;
#include <GameOS\GameOS.hpp>
//**************************************************
namespace MSRSpectator
{
class CSpectatorStateEngine
{
public:
CSpectatorStateEngine(); // ctor
~CSpectatorStateEngine(); // dtor
static void DeleteInstance(CSpectatorStateEngine* p); // will call delete
void InitStateEngine(double delay); // clears all states for new run of game
void DumpData() const; // output stored object data
bool SpectatorExecute(); // main state engine execution tests
void UpdateOldState(); // stores current state as previous if state changes
int GetCurState() const; // returns the current state
bool SetLeader(Replicator* rep); // stores the currents points leader entity Replicator
// returns true is new leader set
void SetAttack(Replicator* inflicting, Replicator* victim); // sets who's attacking who
bool HasHero(Replicator** rep) const; // returns true if m_entityA exists, sets rep to m_entityA
bool HeroHasEngaged(Replicator** rep) const; // returns true if m_entityB exists, sets rep to m_entityB
bool HasThirdParty(Replicator** rep) const; // returns true if m_entityC exists, sets rep to m_entityC
bool HasInflicting(Replicator** rep) const; // returns the current inflicting party
bool fInDyingSequence(); // returns true if m_curState = DYING
void SignalReSpawning(Mech* curSpawn); // sets m_fIsDying to false when Mech request respawn
bool GetIsReSpawning() const; // returns true if m_fIsDying is false
void GetCurReSpawn(Mech** aMech); // returns most recently respawned mech
void ClearReSpawn(); // sets m_fIsResurrecting false
bool fTimeEnoughForNewShot(); // retruns true if m_shotTransTimer is expired, resets timer
void UpdateShotTimer(); // resets shot timer
void InitDeathDelayTimer(); // initializes death sequence camera delay till transition timer
void InitDeathTransTimer(); // intializes death sequence camera transition duration timer
void ExpireDeathTimer(); // expires death sequence timer
double GetDeathTransTimeRemaining(); // returns time remaining in death camera transition timer
double GetDeathDelayTimeRemaining(); // returns time remaining in death camera transition delay timer
static CSpectatorStateEngine* GetInstance() // required to support MW4's global pointer manager
{
return reinterpret_cast<CSpectatorStateEngine*>( GlobalPointers::GetGlobalPointer(SpectatorStateEnginePointerIndex));
};
void TestInstance(void) const; // required to support MW4'S Check_Object()
// external data retrieval (using Options.INI in MW4 directory)
void LoadOptionsINI(NotationFile* optionsINI);
void LoadINIData(const char* szData, int targetMember );
const char* GetStringINIData(int dataMember) const;
const float GetFloatINIData(int dataMember) const;
const int GetIntINIData(int dataMember) const;
Replicator* GetEntityA() const; // returns current entity A replicator
Replicator* GetEntityKiller() const; // returns current entity killer replicator
bool fIsSamePairing(Replicator* hero, Replicator* enemy); // true if replicators are sames as last state cycle
bool CSpectatorStateEngine::GetPrevHero(Replicator** prevHero) const; // returns hero replicator of previous conflict
bool CSpectatorStateEngine::GetPrevEnemy(Replicator** prevEnemy) const; // returns enemy replicator of previous conflict
// data
enum { // exposed constants for our states
STATE_ERR = -1,
UNINITIALIZED = 0,
DYING,
RESET,
SOLE,
DUO,
MULTI
};
// INI data fields. Used to import camera data externally to quickly adjust cameras
// Constants for identifying data fields to populate in INI reads
enum {
DATA_TEST,
HUD_NAME_DISPLAY,
HUD_CHAT_DISPLAY,
OVER_SHOULDER_HERO_OFFSET_X,
OVER_SHOULDER_HERO_OFFSET_Y,
OVER_SHOULDER_HERO_OFFSET_Z,
OVER_SHOULDER_ENEMY_OFFSET_X,
OVER_SHOULDER_ENEMY_OFFSET_Y,
OVER_SHOULDER_ENEMY_OFFSET_Z,
SIDE_SHOT_DELTA_X,
SIDE_SHOT_DELTA_Y,
SIDE_SHOT_HEAD_Y,
FRTSHOT_HEAD_Y,
FRTSHOT_CAM_Y,
FRTSHOT_DIST,
FIXED_TRACK_X,
FIXED_TRACK_Y,
FIXED_TRACK_Z,
DEATH_SEQUENCE_X,
DEATH_SEQUENCE_Y,
DEATH_SEQUENCE_Z,
DEATH_ANIM_DELAY,
DEATH_ANIM_DUR
};
private:
int m_curState; // our current engine state
int m_prevState; // state prior to current state
#if 0 // test values for quickly running FSM validation tests
enum
{
IDLE_TIMER_DUR = 1, // seconds duration for idle timer
MULTI_TIMER_DUR = 2, // seconds duration for multi timer
STALL_TIMER_DUR = 1, // seconds duration to stall between re-entering a multi state
DEATH_TIMER_DUR = 2 // seconds duration for death sequence
};
#else // real world FSM state timer values
enum
{
IDLE_TIMER_DUR = 20, // seconds duration for idle timer
MULTI_TIMER_DUR = 4, // seconds duration for multi timer
STALL_TIMER_DUR = 2, // seconds duration to stall between re-entering a multi state
DEATH_TIMER_DUR = 4 // seconds duration for death sequence
};
#endif
Replicator* m_entityA; // current center of focus combatant
Replicator* m_entityB; // current focust of conflict for A
Replicator* m_entityC; // current third party conflict for A
Replicator* m_entityPointLeader; // current highest point leader, used in RESET state
Replicator* m_entityTargeted; // A's currently fired upon enemy, NULL if not close
Replicator* m_entityInflicting; // enemy inflicting damage on A, NULL if non
Replicator* m_entityKiller; // enemy who just kille A, will be next A soon
Replicator* m_entityCurHero; // hero last time through camera updates
Replicator* m_entityCurEnemy; // enemy last time through camera updates
Replicator* m_entityPrevHero; // hero prior to current previous hero
Replicator* m_entityPrevEnemy; // enemy prior to current previous enemy
Mech* m_curMechReSpawned; // most recent respawning mech
bool m_fIsDisabled; // true if player is overheated, etc
bool m_fIsDying; // true if player is in death sequence
bool m_fIsResurrecting; // true if mech has generated a respawn request to the game
bool m_fEnemyDying; // true if enemy is in death sequence
CSpectatorTimer m_idleTimer; // timer object used to measure inactivity of A
CSpectatorTimer m_multiTimer; // timer object used to measure third party engagement
CSpectatorTimer m_stallTimer; // timer object used to put space between times of re-entering multi states
CSpectatorTimer m_deathTimer; // timer object used to hold final camera during hero death sequence
CSpectatorTimer m_shotTransTimer; // timer object used to pace shot changes
CSpectatorTimer m_watchBDieTimer; // timer object used to delay looking away from killed enemy
CSpectatorTimer m_targetedTimer; // timer object used to delay between aquiring enemies, keeps camera from jumping too much
CSpectatorTimer m_deathTransDelayTimer; // timer object used to delay death camera trans start
CSpectatorTimer m_deathTransTimer; // timer object used to track death camera trans progress
CSpectatorTimer m_testTimer; // debug test timer
char* m_dataTest;
// interface overides
int m_allowHudNameDisplay;
int m_allowHudChatDisplay;
// point data for camera adjustments, loaded from options.ini
float m_overShoulderHeroOffset_x;
float m_overShoulderHeroOffset_y;
float m_overShoulderHeroOffset_z;
float m_overShoulderEnemyOffset_x;
float m_overShoulderEnemyOffset_y;
float m_overShoulderEnemyOffset_z;
float m_sideShotDelta_X;
float m_sideShotDelta_Y;
float m_sideShotHead_Y;
float m_FrtShot_HeadY;
float m_FrtShot_CamY;
float m_FrtShot_Dist;
float m_FixedTrack_X;
float m_FixedTrack_Y;
float m_FixedTrack_Z;
float m_DeathSeq_X;
float m_DeathSeq_Y;
float m_DeathSeq_Z;
float m_DeathAnimDelay;
float m_DeathAnimDur;
// private methods
void GetCurGameData(); // gathers game data for combatant evaluations
int ResetSpectator(); // clears states back to choose new A player
bool A_DisabledStateChange(); // handles disabled player conditions, returns true if state conditions valid
bool A_DyingStateChange(); // handles dying player conditions, returns true if state conditions valid
bool A_ShootingStateChange(); // handles A shooting-at conditions, returns true if state conditions valid
char bigThing[256]; // MW4 memory allocation doesn't like small things
};
}
#endif // !defined(MSR_SPECTATOR_STATE_ENGINE_)
@@ -0,0 +1,75 @@
// SpectatorTimer.cpp ***********************************************//
// Created Owner Modification //
// Copyright Microsoft Corporation, 2001 //
// -------- ------ ------------- //
// 12/12/2001 sdemar definition of timer object for state engine //
//*******************************************************************//
#include "SpectatorTimer.hpp"
#include "MW4.hpp" // gos_GetElapsedTime()
#define SMALL_TIME_VALUE 0.00001
CSpectatorTimer::CSpectatorTimer() :
m_expireTime(gos_GetElapsedTime()),
m_startTime(m_expireTime),
m_fIsExpired(true)
{
}
CSpectatorTimer::~CSpectatorTimer()
{
// stubbed
}
void CSpectatorTimer::Initialize(const double duration)
{
// gos_GetElapsedTime() returns a formatted double as seconds elapsed
m_startTime = gos_GetElapsedTime();
m_expireTime = duration + m_startTime/*gos_GetElapsedTime() don't use this...*/;
// insure that an expired duration was not used
#if 1
CheckExpired();
#else
if (m_expireTime > gos_GetElapsedTime()) {
m_fIsExpired = false;
} else {
m_fIsExpired = true;
}
#endif
}
bool CSpectatorTimer::CheckExpired(double& dblElapsed/* = *(double*)0*/)
{
if (&dblElapsed)
dblElapsed = GetTimeRemaining();
else
GetTimeRemaining();
return m_fIsExpired;
}
double CSpectatorTimer::GetTimeRemaining()
{
double elapsedTime;
elapsedTime = m_expireTime - gos_GetElapsedTime();
if (elapsedTime <= SMALL_TIME_VALUE)
{
elapsedTime = -SMALL_TIME_VALUE;
m_fIsExpired = true;
}
return elapsedTime;
}
void CSpectatorTimer::Expire(void)
{
m_startTime = m_expireTime = gos_GetElapsedTime();
m_fIsExpired = true;
}
@@ -0,0 +1,29 @@
// SpectatorTimer.hpp ***********************************************//
// Created Owner Modification //
// Copyright Microsoft Corporation, 2001 //
// -------- ------ ------------- //
// 12/12/2001 sdemar provides timer objects for state engine //
//*******************************************************************//
#if !defined(CSPECTATOR_TIMER_MSR_)
#define CSPECTATOR_TIMER_MSR_
// #include "MW4\MW4.hpp" // gos_GetElapsedTime()
class CSpectatorTimer
{
public:
CSpectatorTimer(); // ctor
~CSpectatorTimer(); // dtor
double GetTimeRemaining(void);
bool CheckExpired(double& dblElapsed = *(double*)0); // return: expired? dblElapsed: seconds remaing in timer
void Initialize(const double duration); // intializes timer to new duration
void Expire(void); // sets timer to 0.0
private:
double m_startTime, m_expireTime;
bool m_fIsExpired;
};
#endif // !defined(CSPECTATOR_TIMER_MSR_)