diff --git a/src/Components/Modules/ClientCommand.cpp b/src/Components/Modules/ClientCommand.cpp index 8cc40d1c..060fb81f 100644 --- a/src/Components/Modules/ClientCommand.cpp +++ b/src/Components/Modules/ClientCommand.cpp @@ -180,7 +180,7 @@ namespace Components ClientCommand::Add("entitycount", []([[maybe_unused]] Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params) { - Logger::Print("Entity count = %i\n", *Game::level_num_entities); + Logger::Print("Entity count = %i\n", Game::level->num_entities); }); // Also known as: "vis" @@ -243,7 +243,7 @@ namespace Components ClientCommand::Add("g_testCmd", []([[maybe_unused]] Game::gentity_s* ent, [[maybe_unused]] Command::ServerParams* params) { assert(ent != nullptr); - ent->client->ps.stunTime = 1000 + *Game::level_time; // 1000 is the default test stun time + ent->client->ps.stunTime = 1000 + Game::level->time; // 1000 is the default test stun time }); } diff --git a/src/Components/Modules/Script.cpp b/src/Components/Modules/Script.cpp index bbe73384..798a2541 100644 --- a/src/Components/Modules/Script.cpp +++ b/src/Components/Modules/Script.cpp @@ -607,7 +607,7 @@ namespace Components return; } - Logger::Print(*Game::level_scriptPrintChannel, "%s", str); + Logger::Print(Game::level->scriptPrintChannel, "%s", str); } }); diff --git a/src/Game/Functions.cpp b/src/Game/Functions.cpp index 6e2ff06e..61cc42f2 100644 --- a/src/Game/Functions.cpp +++ b/src/Game/Functions.cpp @@ -460,10 +460,6 @@ namespace Game gentity_t* g_entities = reinterpret_cast(0x18835D8); - int* level_num_entities = reinterpret_cast(0x1A831B0); - int* level_time = reinterpret_cast(0x1A83554); - int* level_scriptPrintChannel = reinterpret_cast(0x1A860FC); - netadr_t* connectedHost = reinterpret_cast(0xA1E888); SOCKET* ip_socket = reinterpret_cast(0x64A3008); @@ -538,6 +534,8 @@ namespace Game vec3_t* CorrectSolidDeltas = reinterpret_cast(0x739BB8); // Count 26 + level_locals_t* level = reinterpret_cast(0x1A831A8); + void Sys_LockRead(FastCriticalSection* critSect) { InterlockedIncrement(&critSect->readCount); diff --git a/src/Game/Functions.hpp b/src/Game/Functions.hpp index 80610630..a3913310 100644 --- a/src/Game/Functions.hpp +++ b/src/Game/Functions.hpp @@ -1036,10 +1036,6 @@ namespace Game constexpr auto ENTITYNUM_NONE = MAX_GENTITIES - 1; extern gentity_t* g_entities; - extern int* level_num_entities; - extern int* level_time; - extern int* level_scriptPrintChannel; - extern netadr_t* connectedHost; extern SOCKET* ip_socket; @@ -1117,6 +1113,8 @@ namespace Game extern FastCriticalSection* db_hashCritSect; + extern level_locals_t* level; + void Sys_LockRead(FastCriticalSection* critSect); void Sys_UnlockRead(FastCriticalSection* critSect); diff --git a/src/Game/Structs.hpp b/src/Game/Structs.hpp index e1561338..e4cee00b 100644 --- a/src/Game/Structs.hpp +++ b/src/Game/Structs.hpp @@ -7282,6 +7282,139 @@ namespace Game TempPriority tempPriority; }; + struct trigger_info_t + { + unsigned __int16 entnum; + unsigned __int16 otherEntnum; + int useCount; + int otherUseCount; + }; + + struct com_parse_mark_t + { + int lines; + const char* text; + int ungetToken; + int backup_lines; + const char* backup_text; + }; + + struct cached_tag_mat_t + { + int time; + int entnum; + unsigned __int16 name; + float tagMat[4][3]; + }; + + struct Turret + { + bool inuse; + int flags; + int fireTime; + float arcmin[2]; + float arcmax[2]; + float dropPitch; + int stance; + int prevStance; + int fireSndDelay; + float userOrigin[3]; + float playerSpread; + int state; + EntHandle target; + float targetOffset[3]; + EntHandle manualTarget; + float manualTargetOffset[3]; + int targetTime; + int stateChangeTime; + int modeChangeTime; + float maxRangeSquared; + int prevTargetIndex; + team_t eTeam; + int convergenceTime[2]; + float targetPos[3]; + float missOffsetNormalized[3]; + float scanSpeed; + float scanDecelYaw; + int scanPauseTime; + bool triggerDown; + float heatLevel; + int heatPenaltyEndTime; + float barrelRollRate; + int autoRotationStopDelay; + int lastAutoRotationRequestTime; + unsigned __int8 fireSnd; + unsigned __int8 fireSndPlayer; + unsigned __int8 stopSnd; + unsigned __int8 stopSndPlayer; + unsigned __int8 scanSnd; + }; + + static_assert(sizeof(Turret) == 0xC4); + + struct level_locals_t + { + gclient_s* clients; + gentity_s* gentities; + int num_entities; + gentity_s* firstFreeEnt; + gentity_s* lastFreeEnt; + Turret* turrets; + void* logFile; + int initializing; + int clientIsSpawning; + objective_t objectives[32]; + int maxclients; + int framenum; + int time; + int previousTime; + int frametime; + int startTime; + int teamScores[4]; + int lastTeammateHealthTime; + int bUpdateScoresForIntermission; + bool teamHasRadar[4]; + bool teamRadarBlocked[4]; + int manualNameChange; + int numConnectedClients; + int sortedClients[18]; + char voteString[1024]; + char voteDisplayString[1024]; + int voteTime; + int voteExecuteTime; + int voteYes; + int voteNo; + int numVotingClients; + SpawnVar spawnVar; + int savepersist; + EntHandle droppedWeaponCue[32]; + float fFogOpaqueDist; + float fFogOpaqueDistSqrd; + int currentPlayerClone; + trigger_info_t pendingTriggerList[256]; + trigger_info_t currentTriggerList[256]; + int pendingTriggerListSize; + int currentTriggerListSize; + int finished; + int bPlayerIgnoreRadiusDamage; + int bPlayerIgnoreRadiusDamageLatched; + int registerWeapons; + int bRegisterItems; + int currentEntityThink; + void* openScriptIOFileHandles[1]; + char* openScriptIOFileBuffers[1]; + com_parse_mark_t currentScriptIOLineMark[1]; + cached_tag_mat_t cachedTagMat; + int scriptPrintChannel; + float compassMapUpperLeft[2]; + float compassMapWorldSize[2]; + float compassNorth[2]; + void* vehicles; + int hudElemLastAssignedSoundID; + }; + + static_assert(sizeof(level_locals_t) == 0x2F78); + #pragma endregion #ifndef IDA