mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-11-13 06:19:14 +00:00
commit
6579645934
|
@ -11,8 +11,12 @@
|
|||
#include "Frontend.h"
|
||||
#include "Physical.h"
|
||||
#include "ColStore.h"
|
||||
#include "VarConsole.h"
|
||||
|
||||
CPool<ColDef,ColDef> *CColStore::ms_pColPool;
|
||||
#ifndef MASTER
|
||||
bool bDispColInMem;
|
||||
#endif
|
||||
|
||||
void
|
||||
CColStore::Initialise(void)
|
||||
|
@ -20,6 +24,9 @@ CColStore::Initialise(void)
|
|||
if(ms_pColPool == nil)
|
||||
ms_pColPool = new CPool<ColDef,ColDef>(COLSTORESIZE, "CollisionFiles");
|
||||
AddColSlot("generic"); // slot 0. not streamed
|
||||
#ifndef MASTER
|
||||
VarConsole.Add("Display collision in memory", &bDispColInMem, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "Vehicle.h"
|
||||
#include "Wanted.h"
|
||||
#include "World.h"
|
||||
#include "VarConsole.h"
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
|
@ -129,8 +130,15 @@ int32 hGarages = AEHANDLE_NONE;
|
|||
CGarage CGarages::aGarages[NUM_GARAGES];
|
||||
bool CGarages::bCamShouldBeOutisde;
|
||||
|
||||
#ifndef MASTER
|
||||
bool bPrintNearestObject;
|
||||
#endif
|
||||
|
||||
void CGarages::Init(void)
|
||||
{
|
||||
#ifndef MASTER
|
||||
VarConsole.Add("Print nearest object", &bPrintNearestObject, true);
|
||||
#endif
|
||||
CrushedCarId = -1;
|
||||
NumGarages = 0;
|
||||
MessageEndTime = 0;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "Vehicle.h"
|
||||
#include "Wanted.h"
|
||||
#include "World.h"
|
||||
#include "VarConsole.h"
|
||||
|
||||
#define TIME_BETWEEN_SETPIECE_SPAWNS 20000
|
||||
|
||||
|
@ -23,6 +24,9 @@ void CSetPieces::Init(void)
|
|||
{
|
||||
bDebug = false;
|
||||
NumSetPieces = 0;
|
||||
#ifndef MASTER
|
||||
VarConsole.Add("Show set pieces", &bDebug, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CSetPieces::AddOne(uint8 type, CVector2D vTriggerInf, CVector2D vTriggerSup, CVector2D vSpawn1, CVector2D vTarget1, CVector2D vSpawn2, CVector2D vTarget2)
|
||||
|
@ -47,6 +51,9 @@ void CSetPieces::Update(void)
|
|||
int nLast = NumSetPieces * (CTimer::GetFrameCounter() % 8 + 1) / 8;
|
||||
for (int i = nFirst; i < nLast; i++)
|
||||
aSetPieces[i].Update();
|
||||
#ifndef MASTER
|
||||
// TODO: debug code from mobile
|
||||
#endif // !MASTER
|
||||
}
|
||||
|
||||
void CSetPieces::Save(uint8* buf, uint32* size)
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1692,12 +1692,11 @@ void CPad::UpdatePads(void)
|
|||
bUpdate = false;
|
||||
|
||||
if ( bUpdate )
|
||||
{
|
||||
GetPad(0)->Update(0);
|
||||
// GetPad(1)->Update(0); // not in VC
|
||||
}
|
||||
|
||||
#if defined(MASTER) && !defined(XINPUT)
|
||||
#ifndef MASTER
|
||||
GetPad(1)->Update(1);
|
||||
#else
|
||||
GetPad(1)->NewState.Clear();
|
||||
GetPad(1)->OldState.Clear();
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 bDisplayNumOfAtomicsRendered = 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", &bDisplayNumOfAtomicsRendered, 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
|
||||
|
|
|
@ -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" };
|
||||
|
|
|
@ -22,10 +22,14 @@
|
|||
#include "Script.h"
|
||||
#include "Replay.h"
|
||||
#include "PedPlacement.h"
|
||||
#include "VarConsole.h"
|
||||
|
||||
#define PAD_MOVE_TO_GAME_WORLD_MOVE 60.0f
|
||||
|
||||
bool CPlayerPed::bDontAllowWeaponChange;
|
||||
#ifndef MASTER
|
||||
bool CPlayerPed::bDebugPlayerInfo;
|
||||
#endif
|
||||
|
||||
const uint32 CPlayerPed::nSaveStructSize =
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
|
@ -182,6 +186,11 @@ CPlayerPed::SetupPlayerPed(int32 index)
|
|||
|
||||
CWorld::Add(player);
|
||||
player->m_wepAccuracy = 100;
|
||||
|
||||
#ifndef MASTER
|
||||
VarConsole.Add("Debug PlayerPed", &CPlayerPed::bDebugPlayerInfo, true);
|
||||
VarConsole.Add("Tweak Vehicle Handling", &CVehicle::m_bDisplayHandlingInfo, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
|
|
|
@ -46,6 +46,9 @@ public:
|
|||
unsigned int m_nLastBusFareCollected;
|
||||
|
||||
static bool bDontAllowWeaponChange;
|
||||
#ifndef MASTER
|
||||
static bool bDebugPlayerInfo;
|
||||
#endif
|
||||
|
||||
CPlayerPed();
|
||||
~CPlayerPed();
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "Stats.h"
|
||||
#include "main.h"
|
||||
#include "General.h"
|
||||
#include "VarConsole.h"
|
||||
|
||||
// --MIAMI: file done
|
||||
|
||||
|
@ -1760,6 +1761,9 @@ void CHud::Initialise()
|
|||
m_LastWanted = 0;
|
||||
m_LastWeapon = 0;
|
||||
|
||||
#ifndef MASTER
|
||||
VarConsole.Add("Draw HUD", &m_Wants_To_Draw_Hud, false);
|
||||
#endif
|
||||
CTxdStore::PopCurrentTxd();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "Draw.h"
|
||||
#include "Timer.h"
|
||||
#include "RwHelper.h"
|
||||
#include "VarConsole.h"
|
||||
|
||||
int32 COcclusion::NumOccludersOnMap;
|
||||
int16 COcclusion::FarAwayList;
|
||||
|
@ -31,20 +32,20 @@ CVector gOccluderCoorsOnScreen[8];
|
|||
CVector gOccluderCoors[8];
|
||||
|
||||
#ifndef MASTER
|
||||
bool bDisplayOccDebugStuff;
|
||||
bool bDispayOccDebugStuff; // disPAY, yeah
|
||||
#endif
|
||||
|
||||
void
|
||||
COcclusion::Init(void)
|
||||
{
|
||||
NumOccludersOnMap = 0;
|
||||
#ifndef MASTER
|
||||
VarConsole.Add("Occlusion debug", &bDispayOccDebugStuff, true);
|
||||
#endif
|
||||
FarAwayList = -1;
|
||||
NearbyList = -1;
|
||||
ListWalkThroughFA = -1;
|
||||
PreviousListWalkThroughFA = -1;
|
||||
#ifndef MASTER
|
||||
bDisplayOccDebugStuff = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -458,7 +459,7 @@ bool COcclusion::IsPositionOccluded(CVector pos, float side) {
|
|||
RwIm2DVertex vertexbufferT[2];
|
||||
|
||||
void COcclusion::Render() {
|
||||
if (!bDisplayOccDebugStuff || !(CTimer::GetTimeInMilliseconds() & 0x200))
|
||||
if (!bDispayOccDebugStuff || !(CTimer::GetTimeInMilliseconds() & 0x200))
|
||||
return;
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
|
||||
|
|
|
@ -58,5 +58,5 @@ bool CalcScreenCoors(CVector const &in, CVector *out, float *outw, float *outh);
|
|||
bool CalcScreenCoors(CVector const &in, CVector *out);
|
||||
|
||||
#ifndef MASTER
|
||||
extern bool bDisplayOccDebugStuff;
|
||||
extern bool bDispayOccDebugStuff;
|
||||
#endif
|
|
@ -25,6 +25,7 @@
|
|||
#include "CutsceneObject.h"
|
||||
#include "CutsceneShadow.h"
|
||||
#include "Clock.h"
|
||||
#include "VarConsole.h"
|
||||
|
||||
#ifdef DEBUGMENU
|
||||
SETTWEAKPATH("Shadows");
|
||||
|
@ -57,6 +58,9 @@ CStaticShadow CShadows::aStaticShadows [MAX_STATICSHADOWS];
|
|||
CPolyBunch *CShadows::pEmptyBunchList;
|
||||
CPermanentShadow CShadows::aPermanentShadows[MAX_PERMAMENTSHADOWS];
|
||||
|
||||
#ifndef MASTER
|
||||
bool gbCountPolysInShadow;
|
||||
#endif
|
||||
|
||||
void
|
||||
CShadows::Init(void)
|
||||
|
@ -154,6 +158,10 @@ CShadows::Init(void)
|
|||
{
|
||||
aPermanentShadows[i].m_nType = SHADOWTYPE_NONE;
|
||||
}
|
||||
|
||||
#ifndef MASTER
|
||||
VarConsole.Add("Count polys in shadow", &gbCountPolysInShadow, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
786
src/render/VarConsole.cpp
Normal file
786
src/render/VarConsole.cpp
Normal file
|
@ -0,0 +1,786 @@
|
|||
#include "common.h"
|
||||
#include "VarConsole.h"
|
||||
#include "Font.h"
|
||||
#include "Pad.h"
|
||||
|
||||
#define VAR_CONSOLE_PAD 1
|
||||
|
||||
CVarConsole VarConsole;
|
||||
|
||||
void
|
||||
CVarConsole::Initialise()
|
||||
{
|
||||
m_nCountEntries = 0;
|
||||
m_nCurPage = 1;
|
||||
m_bIsOpen = false;
|
||||
m_nCurEntry = 0;
|
||||
m_nFirstEntryOnPage = 0;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Add(char *text, int8 *pVal, uint8 step, int8 min, int8 max, bool8 isVar)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
return;
|
||||
}
|
||||
|
||||
m_aEntries[i].text = text;
|
||||
m_aEntries[i].pInt8Value = pVal;
|
||||
m_aEntries[i].bAllowExceedBounds = isVar;
|
||||
m_aEntries[i].VarType = VCE_TYPE_INT8;
|
||||
m_aEntries[i].I8_step = step;
|
||||
m_aEntries[i].I8_min = min;
|
||||
m_aEntries[i].I8_max = max;
|
||||
m_nCountEntries++;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Add(char *text, int16 *pVal, uint16 step, int16 min, int16 max, bool8 isVar)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
return;
|
||||
}
|
||||
|
||||
m_aEntries[i].text = text;
|
||||
m_aEntries[i].pInt16Value = pVal;
|
||||
m_aEntries[i].bAllowExceedBounds = isVar;
|
||||
m_aEntries[i].VarType = VCE_TYPE_INT16;
|
||||
m_aEntries[i].I16_step = step;
|
||||
m_aEntries[i].I16_min = min;
|
||||
m_aEntries[i].I16_max = max;
|
||||
m_nCountEntries++;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Add(char *text, int32 *pVal, uint32 step, int32 min, int32 max, bool8 isVar)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
return;
|
||||
}
|
||||
|
||||
m_aEntries[i].text = text;
|
||||
m_aEntries[i].pInt32Value = pVal;
|
||||
m_aEntries[i].bAllowExceedBounds = isVar;
|
||||
m_aEntries[i].VarType = VCE_TYPE_INT32;
|
||||
m_aEntries[i].I32_step = step;
|
||||
m_aEntries[i].I32_min = min;
|
||||
m_aEntries[i].I32_max = max;
|
||||
m_nCountEntries++;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Add(char *text, int64 *pVal, uint64 step, int64 min, int64 max, bool8 isVar)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
return;
|
||||
}
|
||||
|
||||
m_aEntries[i].text = text;
|
||||
m_aEntries[i].pInt64Value = pVal;
|
||||
m_aEntries[i].bAllowExceedBounds = isVar;
|
||||
m_aEntries[i].VarType = VCE_TYPE_INT64;
|
||||
m_aEntries[i].I64_step = step;
|
||||
m_aEntries[i].I64_min = min;
|
||||
m_aEntries[i].I64_max = max;
|
||||
m_nCountEntries++;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Add(char *text, uint8 *pVal, uint8 step, int8 min, int8 max, bool8 isVar)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
return;
|
||||
}
|
||||
|
||||
m_aEntries[i].text = text;
|
||||
m_aEntries[i].pUint8Value = pVal;
|
||||
m_aEntries[i].bAllowExceedBounds = isVar;
|
||||
m_aEntries[i].VarType = VCE_TYPE_UINT8;
|
||||
m_aEntries[i].I8_step = step;
|
||||
m_aEntries[i].I8_min = min;
|
||||
m_aEntries[i].I8_max = max;
|
||||
m_nCountEntries++;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Add(char *text, uint16 *pVal, uint16 step, int16 min, int16 max, bool8 isVar)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
return;
|
||||
}
|
||||
|
||||
m_aEntries[i].text = text;
|
||||
m_aEntries[i].pUint16Value = pVal;
|
||||
m_aEntries[i].bAllowExceedBounds = isVar;
|
||||
m_aEntries[i].VarType = VCE_TYPE_UINT16;
|
||||
m_aEntries[i].I16_step = step;
|
||||
m_aEntries[i].I16_min = min;
|
||||
m_aEntries[i].I16_max = max;
|
||||
m_nCountEntries++;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Add(char *text, uint32 *pVal, uint32 step, int32 min, int32 max, bool8 isVar)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
return;
|
||||
}
|
||||
|
||||
m_aEntries[i].text = text;
|
||||
m_aEntries[i].pUint32Value = pVal;
|
||||
m_aEntries[i].bAllowExceedBounds = isVar;
|
||||
m_aEntries[i].VarType = VCE_TYPE_UINT32;
|
||||
m_aEntries[i].I32_step = step;
|
||||
m_aEntries[i].I32_min = min;
|
||||
m_aEntries[i].I32_max = max;
|
||||
m_nCountEntries++;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Add(char *text, uint64 *pVal, uint64 step, int64 min, int64 max, bool8 isVar)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
return;
|
||||
}
|
||||
|
||||
m_aEntries[i].text = text;
|
||||
m_aEntries[i].pUint64Value = pVal;
|
||||
m_aEntries[i].bAllowExceedBounds = isVar;
|
||||
m_aEntries[i].VarType = VCE_TYPE_UINT64;
|
||||
m_aEntries[i].I64_step = step;
|
||||
m_aEntries[i].I64_min = min;
|
||||
m_aEntries[i].I64_max = max;
|
||||
m_nCountEntries++;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Add(char *text, float *pVal, float step, float min, float max, bool8 isVar)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
return;
|
||||
}
|
||||
|
||||
m_aEntries[i].text = text;
|
||||
m_aEntries[i].pFloatValue = pVal;
|
||||
m_aEntries[i].bAllowExceedBounds = isVar;
|
||||
m_aEntries[i].VarType = VCE_TYPE_FLOAT;
|
||||
m_aEntries[i].F_step = step;
|
||||
m_aEntries[i].F_min = min;
|
||||
m_aEntries[i].F_max = max;
|
||||
m_nCountEntries++;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Add(char *text, bool *pVal, bool8 isVar)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
return;
|
||||
}
|
||||
|
||||
m_aEntries[i].text = text;
|
||||
m_aEntries[i].pBoolValue = pVal;
|
||||
m_aEntries[i].bAllowExceedBounds = isVar;
|
||||
m_aEntries[i].VarType = VCE_TYPE_BOOL;
|
||||
m_nCountEntries++;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Add(char *text, bool8 *pVal, bool8 isVar)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
return;
|
||||
}
|
||||
|
||||
m_aEntries[i].text = text;
|
||||
m_aEntries[i].pUint8Value = pVal;
|
||||
m_aEntries[i].bAllowExceedBounds = isVar;
|
||||
m_aEntries[i].VarType = VCE_TYPE_BOOL8;
|
||||
m_nCountEntries++;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Add(char *text, bool16 *pVal, bool8 isVar)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
return;
|
||||
}
|
||||
|
||||
m_aEntries[i].text = text;
|
||||
m_aEntries[i].pUint16Value = pVal;
|
||||
m_aEntries[i].bAllowExceedBounds = isVar;
|
||||
m_aEntries[i].VarType = VCE_TYPE_BOOL16;
|
||||
m_nCountEntries++;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Add(char *text, bool32 *pVal, bool8 isVar)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
return;
|
||||
}
|
||||
|
||||
m_aEntries[i].text = text;
|
||||
m_aEntries[i].pUint32Value = pVal;
|
||||
m_aEntries[i].bAllowExceedBounds = isVar;
|
||||
m_aEntries[i].VarType = VCE_TYPE_BOOL32;
|
||||
m_nCountEntries++;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Add(char *text, void (*pCallback)(void))
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
return;
|
||||
}
|
||||
|
||||
m_aEntries[i].text = text;
|
||||
m_aEntries[i].pCallback = pCallback;
|
||||
m_aEntries[i].VarType = VCE_TYPE_FUNCTION;
|
||||
m_nCountEntries++;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Remove(char *text)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_nCountEntries; i++) {
|
||||
if (m_aEntries[i].text == text)
|
||||
{
|
||||
for (int j = i; j < m_nCountEntries-1; j++)
|
||||
m_aEntries[j] = m_aEntries[j+1];
|
||||
m_nCountEntries--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::SortPages()
|
||||
{
|
||||
m_nNumPages = m_nCountEntries / 30 + 1;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Display()
|
||||
{
|
||||
char s[256];
|
||||
wchar ws[256];
|
||||
|
||||
CFont::SetColor(CRGBA(200, 200, 200, 255));
|
||||
CFont::SetFontStyle(FONT_STANDARD);
|
||||
CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.6f));
|
||||
CFont::SetDropShadowPosition(2);
|
||||
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
|
||||
CFont::SetPropOn();
|
||||
CFont::SetWrapx(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
|
||||
CFont::SetRightJustifyWrap(0.0f);
|
||||
sprintf(s, "PAGE %d", m_nCurPage);
|
||||
AsciiToUnicode(s, ws);
|
||||
CFont::SetRightJustifyOn();
|
||||
CFont::PrintString(SCREEN_SCALE_X(310.0f), SCREEN_SCALE_Y(30.0f), ws);
|
||||
CFont::SetRightJustifyOff();
|
||||
int y = 45;
|
||||
for (int i = m_nFirstEntryOnPage; i < m_nCountEntries && i < m_nFirstEntryOnPage + 30; i++)
|
||||
{
|
||||
switch (m_aEntries[i].VarType)
|
||||
{
|
||||
case VCE_TYPE_INT8:
|
||||
sprintf(s, "(%d) %s:I8:%d", i + 1, m_aEntries[i].text, *m_aEntries[i].pInt8Value);
|
||||
break;
|
||||
case VCE_TYPE_INT16:
|
||||
sprintf(s, "(%d) %s:I16:%d", i + 1, m_aEntries[i].text, *m_aEntries[i].pInt16Value);
|
||||
break;
|
||||
case VCE_TYPE_INT32:
|
||||
sprintf(s, "(%d) %s:I32:%d", i + 1, m_aEntries[i].text, *m_aEntries[i].pInt32Value);
|
||||
break;
|
||||
case VCE_TYPE_INT64:
|
||||
#ifdef FIX_BUGS
|
||||
sprintf(s, "(%d) %s:I64:%lld", i + 1, m_aEntries[i].text, *m_aEntries[i].pInt64Value);
|
||||
#else
|
||||
sprintf(s, "(%d) %s:I64:%d", i + 1, m_aEntries[i].text, (int32)*m_aEntries[i].pInt64Value);
|
||||
#endif
|
||||
break;
|
||||
case VCE_TYPE_UINT8:
|
||||
sprintf(s, "(%d) %s:U8:%d", i + 1, m_aEntries[i].text, *m_aEntries[i].pUint8Value);
|
||||
break;
|
||||
case VCE_TYPE_UINT16:
|
||||
sprintf(s, "(%d) %s:U6:%d", i + 1, m_aEntries[i].text, *m_aEntries[i].pUint16Value);
|
||||
break;
|
||||
case VCE_TYPE_UINT32:
|
||||
sprintf(s, "(%d) %s:U32:%d", i + 1, m_aEntries[i].text, *m_aEntries[i].pUint32Value);
|
||||
break;
|
||||
case VCE_TYPE_UINT64:
|
||||
#ifdef FIX_BUGS
|
||||
sprintf(s, "(%d) %s:U64:%llu", i + 1, m_aEntries[i].text, *m_aEntries[i].pUint64Value);
|
||||
#else
|
||||
sprintf(s, "(%d) %s:U64:%d", i + 1, m_aEntries[i].text, (uint32)*m_aEntries[i].pUint64Value);
|
||||
#endif
|
||||
break;
|
||||
case VCE_TYPE_FLOAT:
|
||||
sprintf(s, "(%d) %s:F:%f", i + 1, m_aEntries[i].text, *m_aEntries[i].pFloatValue);
|
||||
break;
|
||||
case VCE_TYPE_BOOL:
|
||||
if (*m_aEntries[i].pBoolValue)
|
||||
sprintf(s, "(%d) %s:B:TRUE", i + 1, m_aEntries[i].text);
|
||||
else
|
||||
sprintf(s, "(%d) %s:B : FALSE", i + 1, m_aEntries[i].text);
|
||||
break;
|
||||
case VCE_TYPE_BOOL8:
|
||||
if (*m_aEntries[i].pUint8Value == FALSE)
|
||||
sprintf(s, "(%d) %s:B8:FALSE", i + 1, m_aEntries[i].text);
|
||||
else
|
||||
sprintf(s, "(%d) %s:B8:TRUE", i + 1, m_aEntries[i].text);
|
||||
break;
|
||||
case VCE_TYPE_BOOL16:
|
||||
if (*m_aEntries[i].pUint16Value == FALSE)
|
||||
sprintf(s, "(%d) %s:B16:FALSE", i + 1, m_aEntries[i].text);
|
||||
else
|
||||
sprintf(s, "(%d) %s:B16:TRUE", i + 1, m_aEntries[i].text);
|
||||
break;
|
||||
case VCE_TYPE_BOOL32:
|
||||
if (*m_aEntries[i].pUint32Value == FALSE)
|
||||
sprintf(s, "(%d) %s:B32:FALSE", i + 1, m_aEntries[i].text);
|
||||
else
|
||||
sprintf(s, "(%d) %s:B32:TRUE", i + 1, m_aEntries[i].text);
|
||||
break;
|
||||
case VCE_TYPE_FUNCTION:
|
||||
sprintf(s, "(%d) %s:FUNCTION:call this function?", i + 1, m_aEntries[i].text);
|
||||
break;
|
||||
}
|
||||
AsciiToUnicode(s, ws);
|
||||
if (m_nCurEntry == i) {
|
||||
CFont::SetBackgroundOn();
|
||||
#ifdef FIX_BUGS
|
||||
CFont::SetBackgroundColor(CRGBA(128, 128, 128, 128));
|
||||
#endif
|
||||
}
|
||||
#ifdef FIX_BUGS
|
||||
else
|
||||
CFont::SetBackgroundColor(CRGBA(128, 128, 128, 0));
|
||||
#endif
|
||||
|
||||
CFont::SetColor(CRGBA(200, 200, 200, 255));
|
||||
CFont::PrintString(SCREEN_SCALE_X(30.0f), SCREEN_SCALE_Y(y), ws);
|
||||
if (m_nCurEntry == i)
|
||||
CFont::SetBackgroundOff();
|
||||
y += 12;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::ModifyLeft()
|
||||
{
|
||||
CVarConsoleEntry &entry = m_aEntries[m_nCurEntry];
|
||||
switch (entry.VarType)
|
||||
{
|
||||
case VCE_TYPE_INT8:
|
||||
*entry.pInt8Value -= entry.I8_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*entry.pInt8Value < entry.I8_min)
|
||||
*entry.pInt8Value = entry.I8_max;
|
||||
} else {
|
||||
if (*entry.pInt8Value < entry.I8_min)
|
||||
*entry.pInt8Value = entry.I8_min;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_INT16:
|
||||
*entry.pInt16Value -= entry.I16_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*entry.pInt16Value < entry.I16_min)
|
||||
*entry.pInt16Value = entry.I16_max;
|
||||
}
|
||||
else {
|
||||
if (*entry.pInt16Value < entry.I16_min)
|
||||
*entry.pInt16Value = entry.I16_min;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_INT32:
|
||||
*entry.pInt32Value -= entry.I32_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*entry.pInt32Value < entry.I32_min)
|
||||
*entry.pInt32Value = entry.I32_max;
|
||||
}
|
||||
else {
|
||||
if (*entry.pInt32Value < entry.I32_min)
|
||||
*entry.pInt32Value = entry.I32_min;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_INT64:
|
||||
*entry.pInt64Value -= entry.I64_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*entry.pInt64Value < entry.I64_min)
|
||||
*entry.pInt64Value = entry.I64_max;
|
||||
}
|
||||
else {
|
||||
if (*entry.pInt64Value < entry.I64_min)
|
||||
*entry.pInt64Value = entry.I64_min;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_UINT8:
|
||||
*entry.pUint8Value -= entry.I8_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*(int8*)entry.pUint8Value < entry.I8_min)
|
||||
*entry.pUint8Value = entry.I8_max;
|
||||
}
|
||||
else {
|
||||
if (*(int8*)entry.pUint8Value < entry.I8_min)
|
||||
*entry.pUint8Value = entry.I8_min;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_UINT16:
|
||||
*entry.pUint16Value -= entry.I16_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*(int16*)entry.pUint16Value < entry.I16_min)
|
||||
*entry.pUint16Value = entry.I16_max;
|
||||
}
|
||||
else {
|
||||
if (*(int16*)entry.pUint16Value < entry.I16_min)
|
||||
*entry.pUint16Value = entry.I16_min;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_UINT32:
|
||||
*entry.pUint32Value -= entry.I32_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*(int32*)entry.pUint32Value < entry.I32_min)
|
||||
*entry.pUint32Value = entry.I32_max;
|
||||
}
|
||||
else {
|
||||
if (*(int32*)entry.pUint32Value < entry.I32_min)
|
||||
*entry.pUint32Value = entry.I32_min;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_UINT64:
|
||||
*entry.pUint64Value -= entry.I64_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*(int64*)entry.pUint64Value < entry.I64_min)
|
||||
*entry.pUint64Value = entry.I64_max;
|
||||
}
|
||||
else {
|
||||
if (*(int64*)entry.pUint64Value < entry.I64_min)
|
||||
*entry.pUint64Value = entry.I64_min;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_FLOAT:
|
||||
*entry.pFloatValue -= entry.F_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*entry.pFloatValue < entry.F_min)
|
||||
*entry.pFloatValue = entry.F_max;
|
||||
}
|
||||
else {
|
||||
if (*entry.pFloatValue < entry.F_min)
|
||||
*entry.pFloatValue = entry.F_min;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_BOOL:
|
||||
if (entry.bAllowExceedBounds)
|
||||
*entry.pBoolValue ^= true;
|
||||
else
|
||||
*entry.pBoolValue = false;
|
||||
break;
|
||||
case VCE_TYPE_BOOL8:
|
||||
if (entry.bAllowExceedBounds)
|
||||
*entry.pUint8Value = *entry.pUint8Value == false;
|
||||
else
|
||||
*entry.pUint8Value = false;
|
||||
break;
|
||||
case VCE_TYPE_BOOL16:
|
||||
if (entry.bAllowExceedBounds)
|
||||
*entry.pUint16Value = *entry.pUint16Value == false;
|
||||
else
|
||||
*entry.pUint16Value = false;
|
||||
break;
|
||||
case VCE_TYPE_BOOL32:
|
||||
if (entry.bAllowExceedBounds)
|
||||
*entry.pUint32Value = *entry.pUint32Value == false;
|
||||
else
|
||||
*entry.pUint32Value = false;
|
||||
break;
|
||||
case VCE_TYPE_FUNCTION:
|
||||
entry.pCallback();
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::ModifyRight()
|
||||
{
|
||||
CVarConsoleEntry &entry = m_aEntries[m_nCurEntry];
|
||||
switch (entry.VarType)
|
||||
{
|
||||
case VCE_TYPE_INT8:
|
||||
*entry.pInt8Value += entry.I8_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*entry.pInt8Value > entry.I8_max)
|
||||
*entry.pInt8Value = entry.I8_min;
|
||||
}
|
||||
else {
|
||||
if (*entry.pInt8Value > entry.I8_max)
|
||||
*entry.pInt8Value = entry.I8_max;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_INT16:
|
||||
*entry.pInt16Value += entry.I16_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*entry.pInt16Value > entry.I16_max)
|
||||
*entry.pInt16Value = entry.I16_min;
|
||||
}
|
||||
else {
|
||||
if (*entry.pInt16Value > entry.I16_max)
|
||||
*entry.pInt16Value = entry.I16_max;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_INT32:
|
||||
*entry.pInt32Value += entry.I32_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*entry.pInt32Value > entry.I32_max)
|
||||
*entry.pInt32Value = entry.I32_min;
|
||||
}
|
||||
else {
|
||||
if (*entry.pInt32Value > entry.I32_max)
|
||||
*entry.pInt32Value = entry.I32_max;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_INT64:
|
||||
*entry.pInt64Value += entry.I64_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*entry.pInt64Value > entry.I64_max)
|
||||
*entry.pInt64Value = entry.I64_min;
|
||||
}
|
||||
else {
|
||||
if (*entry.pInt64Value > entry.I64_max)
|
||||
*entry.pInt64Value = entry.I64_max;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_UINT8:
|
||||
*entry.pUint8Value += entry.I8_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*entry.pUint8Value > (uint8)entry.I8_max)
|
||||
*entry.pUint8Value = entry.I8_min;
|
||||
}
|
||||
else {
|
||||
if (*entry.pUint8Value > (uint8)entry.I8_max)
|
||||
*entry.pUint8Value = entry.I8_max;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_UINT16:
|
||||
*entry.pUint16Value += entry.I16_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*entry.pUint16Value > (uint16)entry.I16_max)
|
||||
*entry.pUint16Value = entry.I16_min;
|
||||
}
|
||||
else {
|
||||
if (*entry.pUint16Value > (uint16)entry.I16_max)
|
||||
*entry.pUint16Value = entry.I16_max;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_UINT32:
|
||||
*entry.pUint32Value += entry.I32_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*entry.pUint32Value > (uint32)entry.I32_max)
|
||||
*entry.pUint32Value = entry.I32_min;
|
||||
}
|
||||
else {
|
||||
if (*entry.pUint32Value > (uint32)entry.I32_max)
|
||||
*entry.pUint32Value = entry.I32_max;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_UINT64:
|
||||
*entry.pUint64Value += entry.I64_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*entry.pUint64Value > (uint64)entry.I64_max)
|
||||
*entry.pUint64Value = entry.I64_min;
|
||||
}
|
||||
else {
|
||||
if (*entry.pUint64Value > (uint64)entry.I64_max)
|
||||
*entry.pUint64Value = entry.I64_max;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_FLOAT:
|
||||
*entry.pFloatValue += entry.F_step;
|
||||
if (entry.bAllowExceedBounds) {
|
||||
if (*entry.pFloatValue > entry.F_max)
|
||||
*entry.pFloatValue = entry.F_min;
|
||||
}
|
||||
else {
|
||||
if (*entry.pFloatValue > entry.F_max)
|
||||
*entry.pFloatValue = entry.F_max;
|
||||
}
|
||||
break;
|
||||
case VCE_TYPE_BOOL:
|
||||
if (entry.bAllowExceedBounds)
|
||||
*entry.pBoolValue ^= true;
|
||||
else
|
||||
*entry.pBoolValue = true;
|
||||
break;
|
||||
case VCE_TYPE_BOOL8:
|
||||
if (entry.bAllowExceedBounds)
|
||||
*entry.pUint8Value = *entry.pUint8Value == false;
|
||||
else
|
||||
*entry.pUint8Value = true;
|
||||
break;
|
||||
case VCE_TYPE_BOOL16:
|
||||
if (entry.bAllowExceedBounds)
|
||||
*entry.pUint16Value = *entry.pUint16Value == false;
|
||||
else
|
||||
*entry.pUint16Value = true;
|
||||
break;
|
||||
case VCE_TYPE_BOOL32:
|
||||
if (entry.bAllowExceedBounds)
|
||||
*entry.pUint32Value = *entry.pUint32Value == false;
|
||||
else
|
||||
*entry.pUint32Value = true;
|
||||
break;
|
||||
case VCE_TYPE_FUNCTION:
|
||||
entry.pCallback();
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Enter()
|
||||
{
|
||||
m_bIsOpen = true;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Exit()
|
||||
{
|
||||
m_bIsOpen = false;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Input()
|
||||
{
|
||||
if (CPad::GetPad(VAR_CONSOLE_PAD)->GetDPadDownJustDown() || CPad::GetPad(VAR_CONSOLE_PAD)->GetAnaloguePadDown())
|
||||
{
|
||||
m_nCurEntry++;
|
||||
if (m_nCurEntry < m_nCountEntries)
|
||||
{
|
||||
if (m_nCurEntry > m_nFirstEntryOnPage + 29)
|
||||
{
|
||||
m_nFirstEntryOnPage = m_nCurEntry;
|
||||
++m_nCurPage;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nCurEntry = m_nCountEntries - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (CPad::GetPad(VAR_CONSOLE_PAD)->GetDPadUpJustDown() || CPad::GetPad(VAR_CONSOLE_PAD)->GetAnaloguePadUp())
|
||||
{
|
||||
m_nCurEntry--;
|
||||
if (m_nCurEntry < m_nFirstEntryOnPage)
|
||||
{
|
||||
m_nFirstEntryOnPage = m_nCurEntry - 29;
|
||||
--m_nCurPage;
|
||||
}
|
||||
if (m_nFirstEntryOnPage < 0)
|
||||
{
|
||||
m_nCurEntry = 0;
|
||||
m_nFirstEntryOnPage = 0;
|
||||
m_nCurPage = 1;
|
||||
}
|
||||
}
|
||||
if (CPad::GetPad(VAR_CONSOLE_PAD)->GetSquare())
|
||||
ModifyLeft();
|
||||
if (CPad::GetPad(VAR_CONSOLE_PAD)->GetTriangle())
|
||||
ModifyRight();
|
||||
|
||||
if (CPad::GetPad(VAR_CONSOLE_PAD)->GetDPadLeftJustDown() || CPad::GetPad(VAR_CONSOLE_PAD)->GetAnaloguePadLeft())
|
||||
ModifyLeft();
|
||||
|
||||
if (CPad::GetPad(VAR_CONSOLE_PAD)->GetDPadRightJustDown() || CPad::GetPad(VAR_CONSOLE_PAD)->GetAnaloguePadRight())
|
||||
ModifyRight();
|
||||
|
||||
if (CPad::GetPad(VAR_CONSOLE_PAD)->GetLeftShoulder2JustDown())
|
||||
{
|
||||
if (m_nCurPage > 1)
|
||||
{
|
||||
m_nCurPage--;
|
||||
m_nFirstEntryOnPage -= 30;
|
||||
m_nCurEntry = m_nFirstEntryOnPage;
|
||||
if (m_nFirstEntryOnPage < 0)
|
||||
{
|
||||
m_nFirstEntryOnPage = 0;
|
||||
m_nCurEntry = m_nFirstEntryOnPage;
|
||||
m_nCurPage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (CPad::GetPad(VAR_CONSOLE_PAD)->GetRightShoulder2JustDown())
|
||||
{
|
||||
if (m_nCurPage < m_nNumPages)
|
||||
{
|
||||
m_nCurPage++;
|
||||
m_nFirstEntryOnPage += 30;
|
||||
m_nCurEntry = m_nFirstEntryOnPage;
|
||||
if (m_nFirstEntryOnPage >= m_nCountEntries)
|
||||
{
|
||||
m_nFirstEntryOnPage -= 30;
|
||||
m_nCurEntry = m_nFirstEntryOnPage;
|
||||
m_nCurPage--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (CPad::GetPad(VAR_CONSOLE_PAD)->GetRightShoulder1JustDown() && CPad::GetPad(VAR_CONSOLE_PAD)->GetLeftShoulder1JustDown())
|
||||
Exit();
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Process()
|
||||
{
|
||||
Input();
|
||||
SortPages();
|
||||
Display();
|
||||
}
|
||||
|
||||
bool8
|
||||
CVarConsole::Open()
|
||||
{
|
||||
return m_bIsOpen;
|
||||
}
|
||||
|
||||
void
|
||||
CVarConsole::Check()
|
||||
{
|
||||
if (Open())
|
||||
Process();
|
||||
else if (CPad::GetPad(VAR_CONSOLE_PAD)->GetRightShoulder1JustDown() && CPad::GetPad(VAR_CONSOLE_PAD)->GetLeftShoulder1JustDown())
|
||||
Enter();
|
||||
}
|
92
src/render/VarConsole.h
Normal file
92
src/render/VarConsole.h
Normal file
|
@ -0,0 +1,92 @@
|
|||
#pragma once
|
||||
|
||||
enum eVarConsoleEntryType
|
||||
{
|
||||
VCE_TYPE_INT8,
|
||||
VCE_TYPE_INT16,
|
||||
VCE_TYPE_INT32,
|
||||
VCE_TYPE_INT64,
|
||||
VCE_TYPE_UINT8,
|
||||
VCE_TYPE_UINT16,
|
||||
VCE_TYPE_UINT32,
|
||||
VCE_TYPE_UINT64,
|
||||
VCE_TYPE_FLOAT,
|
||||
VCE_TYPE_BOOL,
|
||||
VCE_TYPE_BOOL8,
|
||||
VCE_TYPE_BOOL16,
|
||||
VCE_TYPE_BOOL32,
|
||||
VCE_TYPE_FUNCTION,
|
||||
};
|
||||
|
||||
struct CVarConsoleEntry
|
||||
{
|
||||
char *text;
|
||||
int8 *pInt8Value;
|
||||
int16 *pInt16Value;
|
||||
int32 *pInt32Value;
|
||||
int64 *pInt64Value;
|
||||
uint8 *pUint8Value;
|
||||
uint16 *pUint16Value;
|
||||
uint32 *pUint32Value;
|
||||
uint64 *pUint64Value;
|
||||
float *pFloatValue;
|
||||
bool *pBoolValue;
|
||||
void (*pCallback)(void);
|
||||
int8 I8_step, I8_max, I8_min;
|
||||
int16 I16_step, I16_max, I16_min;
|
||||
int32 I32_step, I32_max, I32_min;
|
||||
int64 I64_step, I64_max, I64_min;
|
||||
float F_step, F_max, F_min;
|
||||
bool8 bAllowExceedBounds;
|
||||
uint8 VarType;
|
||||
};
|
||||
|
||||
|
||||
class CVarConsole
|
||||
{
|
||||
int32 m_nCountEntries;
|
||||
bool8 m_bIsOpen;
|
||||
int32 m_nCurEntry;
|
||||
int32 m_nFirstEntryOnPage;
|
||||
int32 m_nCurPage;
|
||||
int32 m_nNumPages;
|
||||
CVarConsoleEntry m_aEntries[91];
|
||||
public:
|
||||
#ifdef FIX_BUGS
|
||||
CVarConsole() { Initialise(); }
|
||||
#endif
|
||||
void Initialise();
|
||||
void Add(char *text, int8 *pVal, uint8 step, int8 min, int8 max, bool8 isVar);
|
||||
void Add(char *text, int16 *pVal, uint16 step, int16 min, int16 max, bool8 isVar);
|
||||
void Add(char *text, int32 *pVal, uint32 step, int32 min, int32 max, bool8 isVar);
|
||||
void Add(char *text, int64 *pVal, uint64 step, int64 min, int64 max, bool8 isVar);
|
||||
void Add(char *text, uint8 *pVal, uint8 step, int8 min, int8 max, bool8 isVar);
|
||||
void Add(char *text, uint16 *pVal, uint16 step, int16 min, int16 max, bool8 isVar);
|
||||
void Add(char *text, uint32 *pVal, uint32 step, int32 min, int32 max, bool8 isVar);
|
||||
void Add(char *text, uint64 *pVal, uint64 step, int64 min, int64 max, bool8 isVar);
|
||||
void Add(char *text, float *pVal, float step, float min, float max, bool8 isVar);
|
||||
void Add(char *text, bool *pVal, bool8 isVar);
|
||||
void Add(char *text, bool8 *pVal, bool8 isVar);
|
||||
void Add(char *text, bool16 *pVal, bool8 isVar);
|
||||
void Add(char *text, bool32 *pVal, bool8 isVar);
|
||||
void Add(char *text, void (*pVar)(void));
|
||||
|
||||
void Remove(char *text);
|
||||
|
||||
void SortPages();
|
||||
void Display();
|
||||
|
||||
void ModifyLeft();
|
||||
void ModifyRight();
|
||||
|
||||
void Enter();
|
||||
void Exit();
|
||||
|
||||
void Input();
|
||||
void Process();
|
||||
|
||||
bool8 Open();
|
||||
void Check();
|
||||
};
|
||||
|
||||
extern CVarConsole VarConsole;
|
|
@ -48,6 +48,9 @@ bool CVehicle::bAllTaxisHaveNitro;
|
|||
bool CVehicle::m_bDisableMouseSteering = true;
|
||||
bool CVehicle::bDisableRemoteDetonation;
|
||||
bool CVehicle::bDisableRemoteDetonationOnContact;
|
||||
#ifndef MASTER
|
||||
bool CVehicle::m_bDisplayHandlingInfo;
|
||||
#endif
|
||||
|
||||
void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); }
|
||||
void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehiclePool()->New(handle); }
|
||||
|
|
|
@ -402,6 +402,9 @@ public:
|
|||
static bool m_bDisableMouseSteering;
|
||||
static bool bDisableRemoteDetonation;
|
||||
static bool bDisableRemoteDetonationOnContact;
|
||||
#ifndef MASTER
|
||||
static bool m_bDisplayHandlingInfo;
|
||||
#endif
|
||||
};
|
||||
|
||||
void DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle);
|
||||
|
|
Loading…
Reference in a new issue