CVarConsole

This commit is contained in:
Sergeanur
2021-01-02 11:38:54 +02:00
parent e7c46ac658
commit 42e4a068bb
20 changed files with 1009 additions and 10 deletions

View File

@ -4,6 +4,7 @@
#include "Pad.h"
#include "Clock.h"
#include "Stats.h"
#include "VarConsole.h"
// --MIAMI: File done
@ -20,6 +21,10 @@ uint32 CClock::ms_nMillisecondsPerGameMinute;
uint32 CClock::ms_nLastClockTick;
bool CClock::ms_bClockHasBeenStored;
#ifndef MASTER
bool gbFreezeTime;
#endif
void
CClock::Initialise(uint32 scale)
{
@ -31,6 +36,10 @@ CClock::Initialise(uint32 scale)
ms_nLastClockTick = CTimer::GetTimeInMilliseconds();
ms_bClockHasBeenStored = false;
debug("CClock ready\n");
#ifndef MASTER
VarConsole.Add("Time (hour of day)", &ms_nGameClockHours, 1, 0, 23, true);
VarConsole.Add("Freeze time", &gbFreezeTime, true);
#endif
}
void
@ -50,6 +59,10 @@ CClock::Update(void)
}
}
#ifndef MASTER
else if (gbFreezeTime)
ms_nLastClockTick = CTimer::GetTimeInMilliseconds();
#endif
else if(CTimer::GetTimeInMilliseconds() - ms_nLastClockTick > ms_nMillisecondsPerGameMinute || gbFastTime)
{
ms_nGameClockMinutes++;

View File

@ -96,6 +96,7 @@
#include "postfx.h"
#include "custompipes.h"
#include "screendroplets.h"
#include "VarConsole.h"
#ifdef USE_TEXTURE_POOL
#include "TexturePools.h"
#endif
@ -113,6 +114,10 @@ char CGame::aDatFile[32];
bool CGame::russianGame = false;
bool CGame::japaneseGame = false;
#endif
#ifndef MASTER
CVector CGame::PlayerCoords;
bool8 CGame::VarUpdatePlayerCoords;
#endif
int gameTxdSlot;
@ -557,6 +562,16 @@ bool CGame::Initialise(const char* datFile)
#ifdef USE_TEXTURE_POOL
_TexturePoolsUnknown(true);
#endif
#ifndef MASTER
PlayerCoords = FindPlayerCoors();
VarConsole.Add("X PLAYER COORD", &PlayerCoords.x, 10.0f, -10000.0f, 10000.0f, true);
VarConsole.Add("Y PLAYER COORD", &PlayerCoords.y, 10.0f, -10000.0f, 10000.0f, true);
VarConsole.Add("Z PLAYER COORD", &PlayerCoords.z, 10.0f, -10000.0f, 10000.0f, true);
VarConsole.Add("UPDATE PLAYER COORD", &VarUpdatePlayerCoords, true);
#endif
DMAudio.SetStartingTrackPositions(true);
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
return true;
@ -837,6 +852,12 @@ void CGame::Process(void)
CWindModifiers::Number = 0;
if (!CTimer::GetIsPaused())
{
#ifndef MASTER
if (VarUpdatePlayerCoords) {
FindPlayerPed()->Teleport(PlayerCoords);
VarUpdatePlayerCoords = false;
}
#endif
CSprite2d::SetRecipNearClip();
CSprite2d::InitPerFrame();
CFont::InitPerFrame();

View File

@ -48,6 +48,11 @@ public:
static bool playingIntro;
static char aDatFile[32];
#ifndef MASTER
static CVector PlayerCoords;
static bool8 VarUpdatePlayerCoords;
#endif
static bool InitialiseOnceBeforeRW(void);
static bool InitialiseRenderWare(void);
static void ShutdownRenderWare(void);

View File

@ -36,6 +36,7 @@
#include "MemoryHeap.h"
#include "Font.h"
#include "Frontend.h"
#include "VarConsole.h"
//--MIAMI: file done (possibly bugs)
@ -82,6 +83,12 @@ CEntity *pIslandLODbeachEntity;
int32 islandLODmainland;
int32 islandLODbeach;
#ifndef MASTER
bool gbPrintStats;
bool gbPrintVehiclesInMemory; // TODO
bool gbPrintStreamingBuffer; // TODO
#endif
bool
CStreamingInfo::GetCdPosnAndSize(uint32 &posn, uint32 &size)
{
@ -237,8 +244,14 @@ CStreaming::Init2(void)
pIslandLODbeachEntity = nil;
islandLODmainland = -1;
islandLODbeach = -1;
CModelInfo::GetModelInfo("IslandLODmainland", &islandLODmainland);
CModelInfo::GetModelInfo("IslandLODbeach", &islandLODbeach);
CModelInfo::GetModelInfo("IslandLODmainland", &islandLODmainland);
CModelInfo::GetModelInfo("IslandLODbeach", &islandLODbeach);
#ifndef MASTER
VarConsole.Add("Streaming Debug", &gbPrintStats, true);
VarConsole.Add("Streaming Vehicle Debug", &gbPrintVehiclesInMemory, true);
VarConsole.Add("Printf Streaming Buffer contents", &gbPrintStreamingBuffer, true);
#endif
}
void

View File

@ -79,6 +79,10 @@ typedef int64_t int64;
// hardcode ucs-2
typedef uint16_t wchar;
typedef uint8 bool8;
typedef uint16 bool16;
typedef uint32 bool32;
#if defined(_MSC_VER)
typedef ptrdiff_t ssize_t;
#endif

View File

@ -72,6 +72,7 @@
#include "postfx.h"
#include "custompipes.h"
#include "screendroplets.h"
#include "VarConsole.h"
GlobalScene Scene;
@ -133,6 +134,9 @@ bool gbNewRenderer;
#define CLEARMODE (rwCAMERACLEARZ)
#endif
bool bDisplayNumPfAtomicsRendered = false;
bool bDisplayPosn = false;
void
ValidateVersion()
{
@ -473,6 +477,11 @@ Initialise3D(void *param)
{
PUSH_MEMID(MEMID_RENDER);
#ifndef MASTER
VarConsole.Add("Display number of atomics rendered", &bDisplayNumPfAtomicsRendered, true);
VarConsole.Add("Display posn and framerate", &bDisplayPosn, true);
#endif
if (RsRwInitialize(param))
{
POP_MEMID();
@ -1008,7 +1017,6 @@ return;
void
DisplayGameDebugText()
{
static bool bDisplayPosn = false;
static bool bDisplayCheatStr = false; // custom
#ifndef FINAL
@ -1382,6 +1390,10 @@ RenderMenus(void)
{
FrontEndMenuManager.DrawFrontEnd();
}
#ifndef MASTER
else
VarConsole.Check();
#endif
}
void

View File

@ -647,7 +647,7 @@ extern bool gbRenderWorld2;
#endif
DebugMenuAddVar("Render", "Drunkness", &CMBlur::Drunkness, nil, 0.05f, 0, 1.0f);
#ifndef MASTER
DebugMenuAddVarBool8("Render", "Occlusion debug", &bDisplayOccDebugStuff, nil);
DebugMenuAddVarBool8("Render", "Occlusion debug", &bDispayOccDebugStuff, nil);
#endif
#ifdef EXTENDED_PIPELINES
static const char *vehpipenames[] = { "MatFX", "Neo" };