Merge pull request #223 from diamante0018/level-local

Add level struct for simpler referencing
This commit is contained in:
Dss0 2022-04-15 13:31:36 +02:00 committed by GitHub
commit 33dae74500
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 140 additions and 11 deletions

View File

@ -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
});
}

View File

@ -607,7 +607,7 @@ namespace Components
return;
}
Logger::Print(*Game::level_scriptPrintChannel, "%s", str);
Logger::Print(Game::level->scriptPrintChannel, "%s", str);
}
});

View File

@ -460,10 +460,6 @@ namespace Game
gentity_t* g_entities = reinterpret_cast<gentity_t*>(0x18835D8);
int* level_num_entities = reinterpret_cast<int*>(0x1A831B0);
int* level_time = reinterpret_cast<int*>(0x1A83554);
int* level_scriptPrintChannel = reinterpret_cast<int*>(0x1A860FC);
netadr_t* connectedHost = reinterpret_cast<netadr_t*>(0xA1E888);
SOCKET* ip_socket = reinterpret_cast<SOCKET*>(0x64A3008);
@ -538,6 +534,8 @@ namespace Game
vec3_t* CorrectSolidDeltas = reinterpret_cast<vec3_t*>(0x739BB8); // Count 26
level_locals_t* level = reinterpret_cast<level_locals_t*>(0x1A831A8);
void Sys_LockRead(FastCriticalSection* critSect)
{
InterlockedIncrement(&critSect->readCount);

View File

@ -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);

View File

@ -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