[Global]: loading init
This commit is contained in:
41
src/Game/Commands.cpp
Normal file
41
src/Game/Commands.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include "STDInc.hpp"
|
||||
|
||||
namespace Game
|
||||
{
|
||||
Game::CmdArgs* cmd_args = reinterpret_cast<Game::CmdArgs*>(0xF789E8);
|
||||
Game::cmd_function_s** cmd_functions_ptr = reinterpret_cast<Game::cmd_function_s**>(0xF78A6C);
|
||||
Game::cmd_function_s* cmd_functions = reinterpret_cast<Game::cmd_function_s*>(0xF78A6C);
|
||||
//-------------------------------------------------
|
||||
Cmd_ExecuteSingleCommand_t Cmd_ExecuteSingleCommand = Cmd_ExecuteSingleCommand_t(0x531380);
|
||||
//-------------------------------------------------
|
||||
void Cbuf_AddText(int localClientNum/*ecx*/, const char* text /*eax*/)
|
||||
{
|
||||
const static uint32_t Cbuf_AddText_func = 0x530320;
|
||||
__asm
|
||||
{
|
||||
mov eax, text;
|
||||
mov ecx, localClientNum;
|
||||
call Cbuf_AddText_func;
|
||||
}
|
||||
}
|
||||
|
||||
void Cmd_AddCommand(const char* name, void(*callback)(), Game::cmd_function_s* data, char)
|
||||
{
|
||||
data->name = name;
|
||||
data->autoCompleteDir = nullptr;
|
||||
data->autoCompleteExt = nullptr;
|
||||
data->function = callback;
|
||||
data->next = *cmd_functions_ptr;
|
||||
*cmd_functions_ptr = data;
|
||||
}
|
||||
|
||||
void Cmd_AddCommand(const char* name, const char* args, const char* description, void(*callback)(), Game::cmd_function_s* data, char)
|
||||
{
|
||||
data->name = name;
|
||||
data->autoCompleteDir = args;
|
||||
data->autoCompleteExt = description;
|
||||
data->function = callback;
|
||||
data->next = *cmd_functions_ptr;
|
||||
*cmd_functions_ptr = data;
|
||||
}
|
||||
}
|
17
src/Game/Commands.hpp
Normal file
17
src/Game/Commands.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
namespace Game
|
||||
{
|
||||
constexpr auto CMD_MAX_NESTING = 8;
|
||||
|
||||
extern Game::CmdArgs* cmd_args;
|
||||
extern Game::cmd_function_s** cmd_functions_ptr;
|
||||
extern Game::cmd_function_s* cmd_functions;
|
||||
//-------------------------------------------------
|
||||
typedef void(*Cmd_ExecuteSingleCommand_t)(int localClientNum, int controllerIndex, const char* cmd);
|
||||
extern Cmd_ExecuteSingleCommand_t Cmd_ExecuteSingleCommand;
|
||||
//-------------------------------------------------
|
||||
void Cbuf_AddText(int localClientNum /*eax*/, const char* text /*ecx*/);
|
||||
void Cmd_AddCommand(const char* name, void(*callback)(), Game::cmd_function_s* data, char);
|
||||
void Cmd_AddCommand(const char* name, const char* args, const char* description, void(*callback)(), Game::cmd_function_s* data, char);
|
||||
}
|
58
src/Game/Common.cpp
Normal file
58
src/Game/Common.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
#include "STDInc.hpp"
|
||||
|
||||
namespace Game
|
||||
{
|
||||
//-------------------------------------------------
|
||||
Com_Printf_t Com_Printf = Com_Printf_t(0x532DB0);
|
||||
Com_Error_t Com_Error = Com_Error_t(0x533580);
|
||||
//-------------------------------------------------
|
||||
|
||||
bool Com_BitCheckAssert(const unsigned int* array, int bitNum, int size)
|
||||
{
|
||||
return ((1 << (bitNum & 0x1F)) & array[bitNum >> 5]) != 0;
|
||||
}
|
||||
|
||||
char* Com_Parse(const char** data_p)
|
||||
{
|
||||
const static uint32_t Com_Parse_func = 0x58F8B0;
|
||||
static char* result{};
|
||||
__asm
|
||||
{
|
||||
mov edi, data_p;
|
||||
call Com_Parse_func;
|
||||
mov result, eax;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//int a1@<ecx>, const char *a2@<edi>, int a3@<esi>
|
||||
void Com_ExecStartupConfigs(int localClientNum, char const* configFile)
|
||||
{
|
||||
const static uint32_t Com_ExecStartupConfigs_func = 0x534A30;
|
||||
__asm
|
||||
{
|
||||
mov esi, localClientNum;
|
||||
mov edi, configFile;
|
||||
call Com_ExecStartupConfigs_func;
|
||||
}
|
||||
}
|
||||
|
||||
int Com_sprintfPos(char* dest/*ecx*/, int destSize /*eax*/, int* destPos, const char* fmt, ...)
|
||||
{
|
||||
int result;
|
||||
const static uint32_t Com_sprintfPos_func = 0x590270;
|
||||
__asm
|
||||
{
|
||||
pushad;
|
||||
mov eax, destSize;
|
||||
mov ecx, dest;
|
||||
push fmt;
|
||||
push destPos;
|
||||
call Com_sprintfPos_func;
|
||||
add esp, 8;
|
||||
mov result, eax;
|
||||
popad;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
16
src/Game/Common.hpp
Normal file
16
src/Game/Common.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
namespace Game
|
||||
{
|
||||
//-------------------------------------------------
|
||||
typedef void(__cdecl* Com_Printf_t)(int, const char*, ...);
|
||||
extern Com_Printf_t Com_Printf;
|
||||
|
||||
typedef void(__cdecl* Com_Error_t)(int code, const char* fmt, ...);
|
||||
extern Com_Error_t Com_Error;
|
||||
//-------------------------------------------------
|
||||
bool Com_BitCheckAssert(const unsigned int* array, int bitNum, int size);
|
||||
char* Com_Parse(const char** data_p);
|
||||
void Com_ExecStartupConfigs(int localClientNum, char const* configFile);
|
||||
int Com_sprintfPos(char* dest, int destSize, int* destPos, const char* fmt, ...);
|
||||
}
|
53
src/Game/Database.cpp
Normal file
53
src/Game/Database.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
#include "STDInc.hpp"
|
||||
|
||||
namespace Game
|
||||
{
|
||||
unsigned int* g_poolSize = reinterpret_cast<unsigned int*>(0x6DEFA0);
|
||||
const char** g_assetNames = (const char**)0x6DF440;
|
||||
XAssetHeader* DB_XAssetPool = reinterpret_cast<XAssetHeader*>(0x6DF200);
|
||||
HANDLE databaseCompletedEvent = reinterpret_cast<HANDLE>(0xFC6308);
|
||||
HANDLE databaseCompletedEvent2 = reinterpret_cast<HANDLE>(0xFC6348);
|
||||
XZoneName* g_zoneNames = reinterpret_cast<XZoneName*>(0xAC3000);
|
||||
//-------------------------------------------------
|
||||
DB_LoadXAssets_t DB_LoadXAssets = (DB_LoadXAssets_t)0x45B990;
|
||||
DB_EnumXAssets_t DB_EnumXAssets = DB_EnumXAssets_t(0x45A8C0);
|
||||
DB_FindXAssetHeader_t DB_FindXAssetHeader = DB_FindXAssetHeader_t(0x45AD10);
|
||||
DB_GetXAssetSizeHandler_t* DB_GetXAssetSizeHandlers = reinterpret_cast<DB_GetXAssetSizeHandler_t*>(0x6DF5F0);
|
||||
DB_XAssetGetNameHandler_t* DB_XAssetGetNameHandler = reinterpret_cast<DB_XAssetGetNameHandler_t*>(0x6DF4D8);
|
||||
DB_BeginRecoverLostDevice_t DB_BeginRecoverLostDevice = DB_BeginRecoverLostDevice_t(0x45B180);
|
||||
DB_EndRecoverLostDevice_t DB_EndRecoverLostDevice = DB_EndRecoverLostDevice_t(0x45B210);
|
||||
DB_IsXAssetDefault_t DB_IsXAssetDefault = DB_IsXAssetDefault_t(0x45B040);
|
||||
//-------------------------------------------------
|
||||
XAssetHeader DB_ReallocXAssetPool(XAssetType type, unsigned int new_size)
|
||||
{
|
||||
const XAssetHeader pool_entry =
|
||||
{
|
||||
Utils::Memory::GetAllocator()->allocate(new_size * DB_GetXAssetSizeHandlers[type]())
|
||||
};
|
||||
|
||||
DB_XAssetPool[type] = pool_entry;
|
||||
g_poolSize[type] = new_size;
|
||||
|
||||
return pool_entry;
|
||||
}
|
||||
|
||||
const char* DB_GetXAssetName(XAsset* asset)
|
||||
{
|
||||
if (!asset) return "";
|
||||
|
||||
assert(asset->header.data);
|
||||
|
||||
return DB_XAssetGetNameHandler[asset->type](&asset->header);
|
||||
}
|
||||
|
||||
bool DB_IsZoneLoaded(const char* zone)
|
||||
{
|
||||
for (int i = 1; i < 33; ++i)
|
||||
{
|
||||
if (Game::g_zoneNames[i].name && !_stricmp(Game::g_zoneNames[i].name, zone))
|
||||
return Game::g_zoneNames[i].loaded;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
39
src/Game/Database.hpp
Normal file
39
src/Game/Database.hpp
Normal file
@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
namespace Game
|
||||
{
|
||||
extern unsigned int* g_poolSize;
|
||||
extern const char** g_assetNames;
|
||||
extern XAssetHeader* DB_XAssetPool;
|
||||
extern HANDLE databaseCompletedEvent;
|
||||
extern HANDLE databaseCompletedEvent2;
|
||||
extern XZoneName* g_zoneNames;
|
||||
//-------------------------------------------------
|
||||
typedef void (*DB_LoadXAssets_t)(XZoneInfo* data, unsigned int count, int sync);
|
||||
extern DB_LoadXAssets_t DB_LoadXAssets;
|
||||
|
||||
typedef void(*DB_EnumXAssets_t)(XAssetType type, void(*)(XAssetHeader, void*), const void* userdata, bool overrides);
|
||||
extern DB_EnumXAssets_t DB_EnumXAssets;
|
||||
|
||||
typedef XAssetHeader(*DB_FindXAssetHeader_t)(XAssetType type, const char* name);
|
||||
extern DB_FindXAssetHeader_t DB_FindXAssetHeader;
|
||||
|
||||
typedef int(__cdecl* DB_GetXAssetSizeHandler_t)();
|
||||
extern DB_GetXAssetSizeHandler_t* DB_GetXAssetSizeHandlers;
|
||||
|
||||
typedef const char* (*DB_XAssetGetNameHandler_t)(XAssetHeader* asset);
|
||||
extern DB_XAssetGetNameHandler_t* DB_XAssetGetNameHandler;
|
||||
|
||||
typedef void(*DB_BeginRecoverLostDevice_t)();
|
||||
extern DB_BeginRecoverLostDevice_t DB_BeginRecoverLostDevice;
|
||||
|
||||
typedef void(*DB_EndRecoverLostDevice_t)();
|
||||
extern DB_EndRecoverLostDevice_t DB_EndRecoverLostDevice;
|
||||
|
||||
typedef bool(__cdecl* DB_IsXAssetDefault_t)(XAssetType assettype, const char* name);
|
||||
extern DB_IsXAssetDefault_t DB_IsXAssetDefault;
|
||||
//-------------------------------------------------
|
||||
XAssetHeader DB_ReallocXAssetPool(XAssetType type, unsigned int new_size);
|
||||
extern const char* DB_GetXAssetName(XAsset* asset);
|
||||
extern bool DB_IsZoneLoaded(const char* zone);
|
||||
}
|
1320
src/Game/Functions.cpp
Normal file
1320
src/Game/Functions.cpp
Normal file
File diff suppressed because it is too large
Load Diff
262
src/Game/Functions.hpp
Normal file
262
src/Game/Functions.hpp
Normal file
@ -0,0 +1,262 @@
|
||||
#pragma once
|
||||
#include "../Utils/Function.hpp"
|
||||
|
||||
namespace Game
|
||||
{
|
||||
//defines
|
||||
constexpr auto KEY_NAME_COUNT = 95;
|
||||
constexpr auto LOCALIZED_KEY_NAME_COUNT = 95;
|
||||
|
||||
const static HWND__* hWnd = reinterpret_cast<HWND__*>(0x13E39A8); // Splash screen (cod.bmp)
|
||||
const static HWND* hWndParent = reinterpret_cast<HWND*>(0x13E39B0); // External console
|
||||
const static HWND* hWndBuffer = reinterpret_cast<HWND*>(0x13E39B4); // External console buffer
|
||||
|
||||
extern IDirect3DDevice9** dx9_device_ptr;
|
||||
|
||||
// Game data
|
||||
extern Game::AimAssistGlobals* aaGlobArray;
|
||||
extern Game::cg_s* cgs;
|
||||
extern Game::cgMedia_t* cgMedia;
|
||||
extern Game::cgs_t* cgsArray;
|
||||
extern Game::clientActive_t* clients;
|
||||
extern Game::clientUIActive_t* clientUIActive;
|
||||
extern Game::clipMap_t* cm;
|
||||
extern Game::gclient_s* g_clients;
|
||||
extern Game::gentity_s* g_entities;
|
||||
extern Game::GfxDrawMethod* gfxDrawMethod;
|
||||
extern Game::itemDef_s* my_item;
|
||||
extern Game::keyname_t* keyNames;
|
||||
extern Game::keyname_t* localizedKeyNames;
|
||||
//extern Game::languageInfo_t* g_languages;
|
||||
extern Game::PlayerKeyState* playerKeys;
|
||||
extern Game::playerState_s* ps;
|
||||
extern Game::pmove_t* pmove;
|
||||
extern Game::ScreenPlacement* scrPlace;
|
||||
extern Game::ScreenPlacement* scrPlaceFull;
|
||||
extern Game::ScreenPlacement* scrPlaceFullUnsafe;
|
||||
extern Game::searchpath_s* fs_searchpaths;
|
||||
extern Game::sharedUiInfo_t* sharedUiInfo;
|
||||
extern Game::snd_local_t* g_snd;
|
||||
extern Game::uiInfo_s* uiInfo;
|
||||
extern Game::WeaponDef_s** bg_weaponDefs;
|
||||
extern Game::weaponInfo_s* cg_weaponsArray;
|
||||
extern Game::WinMouseVars_t* s_wmv;
|
||||
|
||||
extern int* g_waitingForKey;
|
||||
extern bool* isDvarSystemActive;
|
||||
extern int* level_initializing;
|
||||
|
||||
typedef void(*longjmp_internal_t)(jmp_buf env, int status);
|
||||
extern longjmp_internal_t longjmp_internal;
|
||||
|
||||
static Utils::function<void()> R_BeginRemoteScreenUpdate = 0x5DC550;
|
||||
static Utils::function<void()> R_EndRemoteScreenUpdate = 0x5DC5A0;
|
||||
|
||||
//-------------------------------------------------
|
||||
typedef void(*UpdateViewWeaponAnim_t)();
|
||||
extern UpdateViewWeaponAnim_t UpdateViewWeaponAnim;
|
||||
|
||||
typedef int(__cdecl* SND_GetEntChannelFromName_t)(const char* channelName);
|
||||
extern SND_GetEntChannelFromName_t SND_GetEntChannelFromName;
|
||||
|
||||
extern snd_alias_list_t* Com_FindSoundAlias(const char* name);
|
||||
|
||||
static Utils::function<snd_alias_list_t* (const char* soundname)>
|
||||
Com_PickSoundAliasFromList_t = 0x581500;
|
||||
|
||||
inline snd_alias_list_t* Com_PickSoundAliasFromList(const char* soundname) {
|
||||
return Com_PickSoundAliasFromList_t(soundname);
|
||||
}
|
||||
|
||||
extern bool CL_IsCgameInitialized();
|
||||
|
||||
extern Game::Font_s* R_RegisterFont(char const* fontName, int imageTrack);
|
||||
extern const char* SL_ConvertToString(unsigned int idx);
|
||||
|
||||
typedef int(__cdecl* StringTable_LookupRowNumForValue_t)(const StringTable* table, int comparisonColumn, const char* value);
|
||||
extern StringTable_LookupRowNumForValue_t StringTable_LookupRowNumForValue;
|
||||
|
||||
extern const char* StringTable_Lookup(const StringTable* table /*<ebp>*/, const int comparisonColumn /*<esi>*/, const char* value/*<eax>*/, const int valueColumn /*<edi>*/);
|
||||
extern void StringTable_GetAsset(const char* filename, const StringTable** tablePtr);
|
||||
|
||||
extern bool Key_IsCatcherActive(int mask);
|
||||
|
||||
extern const char* SEH_GetCurrentLanguage();
|
||||
|
||||
typedef Game::gentity_s* (*GetPlayerEntity_t)(Game::scr_entref_t entref);
|
||||
extern GetPlayerEntity_t GetPlayerEntity;
|
||||
|
||||
Game::ScreenPlacement* ScrPlace_GetFullPlacement();
|
||||
Game::ScreenPlacement* ScrPlace_GetUnsafeFullPlacement();
|
||||
void R_AddCmdDrawTextASM(const char* text, int max_chars, void* font, float x, float y, float x_scale, float y_scale, float rotation, const float* color, int style);
|
||||
void R_AddCmdDrawStretchPic(Game::Material* material, float x, float y, float w, float h, float null1, float null2, float null3, float null4, float* color); // ASM
|
||||
const char* UI_GetFontHandle(const ScreenPlacement* ScrPlace, float fontscale);
|
||||
int R_TextHeight(Font_s* font);
|
||||
long double R_NormalizedTextScale(Font_s* font, float scale);
|
||||
|
||||
int UI_TextWidth(const char* text, int maxChars, Font_s* font, float scale);
|
||||
int UI_TextHeight(Font_s* font, float scale);
|
||||
int R_TextWidth/*eax*/(const char* text /*eax*/, signed int maxChars, Game::Font_s* font/*ecx*/);
|
||||
|
||||
|
||||
void ScrPlace_ApplyRect(const ScreenPlacement* ScrPlace, float* x, float* y, float* w, float* h, int horzAlign, int vertAlign);
|
||||
void UI_DrawText(const ScreenPlacement* ScrPlace, const char* text, int maxChars, Font_s* font, float ix, float iy, int horzAlign, int vertAlign, float scale, const float* color, int style);
|
||||
|
||||
extern int* g_entities_int;
|
||||
|
||||
extern DWORD* dword_FDBDCC;
|
||||
extern __int16* word_13E45E8;
|
||||
extern __int16* word_13E45DC;
|
||||
|
||||
extern int* g_animRateOffsets;
|
||||
|
||||
void SV_SendServerCommand(int clientNum, const char* fmt);
|
||||
void SV_GameSendServerCommand(int clientNum, const char* fmt);
|
||||
|
||||
static Utils::function<void(Game::pmove_t* pm, Game::pml_t* pml)> PM_AirMove = 0x5BF480;
|
||||
static Utils::function<void(Game::pmove_t* pm)> PM_UpdateSprint = 0x5B72F0;
|
||||
|
||||
|
||||
extern char* byte_14C80E0;
|
||||
|
||||
typedef void(__cdecl* CG_GameMessage_t)(const char* message, int a2);
|
||||
extern CG_GameMessage_t CG_GameMessage;
|
||||
|
||||
const char* SEH_GetLanguageName/*eax*/(unsigned int iLanguage /*eax*/);
|
||||
void SEH_GetLanguageIndexFromName(const char* name/*edi*/, int* langindex); // Redone via ASM wrapper.
|
||||
const char* UI_SafeTranslateString/*eax*/(const char* reference /*eax*/);
|
||||
|
||||
typedef const char*(__cdecl* UI_ReplaceConversionString_t)(const char* reference, const char* value);
|
||||
extern UI_ReplaceConversionString_t UI_ReplaceConversionString;
|
||||
|
||||
int I_stricmp/*eax*/(int a1/*eax*/, const char* a2 /*edx*/, const char* a3);
|
||||
|
||||
static Utils::function<unsigned int()> G_RegisterWeapon = 0x4B6140;
|
||||
static Utils::function<unsigned int(const char* weaponName, void* registerWeaponFunction)> BG_GetWeaponIndexForName = 0x5BECE0;
|
||||
|
||||
typedef unsigned int(__cdecl* BG_FindWeaponIndexForName_t)(const char* weaponName);
|
||||
extern BG_FindWeaponIndexForName_t BG_FindWeaponIndexForName;
|
||||
|
||||
extern Game::localization_t* localization;
|
||||
|
||||
extern game_hudelem_s* g_hudelems;
|
||||
extern game_hudelem_field_t* fields_0;
|
||||
|
||||
void FS_DisplayPath(int bLanguageCull);
|
||||
|
||||
typedef void(__cdecl* FS_AddIwdFilesForGameDirectory_t)(const char* path, char* pszGameFolder);
|
||||
extern FS_AddIwdFilesForGameDirectory_t FS_AddIwdFilesForGameDirectory;
|
||||
|
||||
void FS_AddLocalizedGameDirectory(const char* dir/*edi*/, const char* path);
|
||||
int FS_FOpenFileWriteToDir(const char* a1/*eax*/, const char* a2/*esi*/, int a3);
|
||||
|
||||
void PM_Weapon_FireWeapon(Game::playerState_s* ps, int delayedAction);
|
||||
|
||||
void StartWeaponAnim(int weaponIndex /*eax*/, Game::DObj_s* obj /*edi*/, int animIndex, float transitionTime);
|
||||
|
||||
Game::Font_s* UI_GetFontHandleStock(int fontEnum, const ScreenPlacement* scrPlace, float scale);
|
||||
|
||||
bool ShotLimitReached(Game::WeaponDef_s* weaponDef, Game::playerState_s* playerState);
|
||||
|
||||
void PM_Weapon_BeginWeaponRaise(Game::playerState_s* playerState, int time, int anim, float aim, int altSwitch);
|
||||
|
||||
static const char* g_he_font_old[] =
|
||||
{
|
||||
"default", // HE_FONT_DEFAULT
|
||||
"bigfixed", // HE_FONT_BIGFIXED
|
||||
"smallfixed", // HE_FONT_SMALLFIXED
|
||||
"objective", // HE_FONT_OBJECTIVE
|
||||
"big", // HE_FONT_BIG
|
||||
"small", // HE_FONT_SMALL
|
||||
};
|
||||
|
||||
unsigned int G_GetWeaponIndexForName(const char* name);
|
||||
|
||||
int DObjGetBoneIndex(Game::DObj_s* obj, unsigned int name, unsigned __int8* index);
|
||||
int XModelGetBoneIndex(Game::XModel* model, unsigned int name, unsigned int offset, unsigned __int8* index);
|
||||
|
||||
void ChangeViewmodelDobj(int weapIndex /*eax*/, unsigned __int8 weaponModel /*cl*/, Game::XModel* newHands, Game::XModel* newGoggles, Game::XModel* newRocket, Game::XModel* newKnife, char updateClientInfo);
|
||||
float Vec2Normalize(float* v);
|
||||
void Cbuf_InsertText(int localClientNum /*eax*/, const char* text);
|
||||
void UI_KeyEvent(int down /*edi*/, int localClientNum, int key);
|
||||
void Key_WriteBindings(int localClientNum /*eax*/, char* buffer);
|
||||
|
||||
typedef int(*FS_Printf_t)(int file, const char* fmt, ...);
|
||||
extern FS_Printf_t FS_Printf;
|
||||
|
||||
void CL_DrawStretchPic(const Game::ScreenPlacement* ScrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, float s1, float t1, float s2, float t2, float* color, Game::Material* material);
|
||||
|
||||
typedef void(*UI_ReplaceConversions_t)(const char* sourceString, ConversionArguments* arguments, char* outputString);
|
||||
extern UI_ReplaceConversions_t UI_ReplaceConversions;
|
||||
|
||||
int UI_GetActiveMenu();
|
||||
|
||||
void UI_FilterStringForButtonAnimation(char* str, unsigned int strMaxSize);
|
||||
|
||||
typedef void(*UI_SetActiveMenu_t)(int localClientNum, int menu);
|
||||
extern UI_SetActiveMenu_t UI_SetActiveMenu;
|
||||
|
||||
void Key_SetBinding(int localClientNum /*eax*/, int keyNum /*ecx*/, const char* binding);
|
||||
|
||||
void AimAssist_UpdateTweakables(const AimInput* input);
|
||||
void AimAssist_UpdateAdsLerp(const AimInput* input);
|
||||
typedef void(*AimAssist_ApplyAutoMelee_t)(const AimInput* input, const AimOutput* output);
|
||||
extern AimAssist_ApplyAutoMelee_t AimAssist_ApplyAutoMelee;
|
||||
void AimAssist_ApplyMeleeCharge(const AimInput* input /*eax*/, const AimOutput* output);
|
||||
|
||||
extern Game::GraphFloat* aaInputGraph;
|
||||
|
||||
float GraphGetValueFromFraction(int knotCount, const float(*knots)[2], float fraction);
|
||||
float GraphFloat_GetValue(const GraphFloat* graph, const float fraction);
|
||||
bool BG_PlayerEverHadWeapon(const Game::playerState_s* ps, int weaponIndex);
|
||||
bool BG_PlayerHasWeapon(const Game::playerState_s* playerState, int weaponIndex);
|
||||
int BG_WeaponAmmo(int weaponIndex /*eax*/, const Game::playerState_s* ps /*ecx*/);
|
||||
void vectoangles(const float* vec /*esi*/, float* angles /*edi*/);
|
||||
float AngleNormalize360(float angle);
|
||||
float AngleNormalize180(float angle);
|
||||
|
||||
typedef float(*DiffTrackAngle_t)(float tgt, float cur, float rate, float deltaTime);
|
||||
extern DiffTrackAngle_t DiffTrackAngle;
|
||||
|
||||
typedef float(*AngleSubtract_t)(const float a1, const float a2);
|
||||
extern AngleSubtract_t AngleSubtract;
|
||||
|
||||
unsigned int SEH_DecodeLetter(char firstChar, char secondChar, int* usedCount);
|
||||
unsigned int SEH_ReadCharFromString(const char** text);
|
||||
Glyph* R_GetCharacterGlyph(Font_s* font, unsigned int letter);
|
||||
|
||||
typedef XAnimTree_s*(*CG_CreateWeaponViewModelXAnim_t)(Game::WeaponDef_s* weaponDef);
|
||||
extern CG_CreateWeaponViewModelXAnim_t CG_CreateWeaponViewModelXAnim;
|
||||
|
||||
void RB_DrawStretchPicRotate(Game::Material* material, float x, float y, float w, float h, float s0, float t0, float s1, float t1, float sinAngle, float cosAngle, unsigned int color);
|
||||
|
||||
void Sys_SnapVector();
|
||||
Game::vec_t Vec3Normalize(Game::vec3_t v);
|
||||
|
||||
typedef void(*SV_SetConfigstring_t)(int index, const char* string);
|
||||
extern SV_SetConfigstring_t SV_SetConfigstring;
|
||||
|
||||
void CG_PlayBoltedEffect(int localClientNum/*eax*/, Game::FxEffectDef* fxDef, int dobjHandle/*edi*/, unsigned int boneName/*edx*/);
|
||||
void FX_ThroughWithEffect(Game::FxEffectDef* fxDef /*esi*/);
|
||||
|
||||
typedef void(*IN_RecenterMouse_t)();
|
||||
extern IN_RecenterMouse_t IN_RecenterMouse;
|
||||
|
||||
typedef void(*IN_MouseMove_t)();
|
||||
extern IN_MouseMove_t IN_MouseMove;
|
||||
|
||||
typedef void(*IN_Init_t)();
|
||||
extern IN_Init_t IN_Init;
|
||||
|
||||
typedef void(*UI_MouseEvent_t)(int x, int y);
|
||||
extern UI_MouseEvent_t UI_MouseEvent;
|
||||
|
||||
void UI_DrawHandlePic(const float* color /*ecx*/, Game::ScreenPlacement* ScrPlace /*edx*/, float x, float y, float w, float h, int horzAlign, int vertAlign, Game::Material* material);
|
||||
|
||||
typedef int(__cdecl* RemoveRefToObject_t)(unsigned int id);
|
||||
extern RemoveRefToObject_t RemoveRefToObject;
|
||||
|
||||
void SV_ShutdownGameVM(int clearScripts/*edi*/);
|
||||
void UI_DrawTextWithGlow(int vertAlign/*eax*/, int horzAlign/*ecx*/, const Game::ScreenPlacement* ScrPlace, const char* text, Game::Font_s* font, float x, float y, float scale, const float* color, int style, const float* glowColor, int subtitle, int cinematic);
|
||||
int String_Parse/*eax*/(const char** p/*eax*/, char* char_out, int len);
|
||||
}
|
6
src/Game/Game.cpp
Normal file
6
src/Game/Game.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "STDInc.hpp"
|
||||
|
||||
namespace Game
|
||||
{
|
||||
Game::gui_t gui = {};
|
||||
}
|
13
src/Game/Game.hpp
Normal file
13
src/Game/Game.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Commands.hpp"
|
||||
#include "Common.hpp"
|
||||
#include "Database.hpp"
|
||||
#include "Functions.hpp"
|
||||
#include "Scripts.hpp"
|
||||
#include "System.hpp"
|
||||
|
||||
namespace Game
|
||||
{
|
||||
extern Game::gui_t gui;
|
||||
}
|
135
src/Game/Scripts.cpp
Normal file
135
src/Game/Scripts.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
#include "STDInc.hpp"
|
||||
|
||||
namespace Game
|
||||
{
|
||||
scr_const_t* scr_const = reinterpret_cast<scr_const_t*>(0xF523E8);
|
||||
Game::scrVarPub_t* scrVarPub = reinterpret_cast<Game::scrVarPub_t*>(0x1264980);
|
||||
Game::scrVmPub_t* scrVmPub = reinterpret_cast<Game::scrVmPub_t*>(0x1287240);
|
||||
|
||||
//-------------------------------------------------
|
||||
Scr_AllocString_t Scr_AllocString = (Scr_AllocString_t)0x54CEC0;
|
||||
Scr_AddInt_t Scr_AddInt = Scr_AddInt_t(0x558B80);
|
||||
Scr_AddFloat_t Scr_AddFloat = Scr_AddFloat_t(0x558BC0);
|
||||
Scr_ParamError_t Scr_ParamError = Scr_ParamError_t(0x5902D0);
|
||||
Player_GetMethod_t* Player_GetMethod = reinterpret_cast<Player_GetMethod_t*>(0x49B2E0);
|
||||
Scr_GetFunction_t* Scr_GetFunction = reinterpret_cast<Scr_GetFunction_t*>(0x4DAD80);
|
||||
Scr_GetFunctionHandle_t Scr_GetFunctionHandle = Scr_GetFunctionHandle_t(0x549050);
|
||||
Scr_LoadScriptInternal_t Scr_LoadScriptInternal = Scr_LoadScriptInternal_t(0x549420);
|
||||
//-------------------------------------------------
|
||||
unsigned int GScr_AllocString(const char* s)
|
||||
{
|
||||
unsigned int stringVal = Game::Scr_AllocString(s, 1, strlen(s) + 1);
|
||||
return stringVal;
|
||||
}
|
||||
|
||||
void Scr_AddString(const char* value /*esi*/)
|
||||
{
|
||||
const static uint32_t Scr_AddString_func = 0x558D10;
|
||||
__asm
|
||||
{
|
||||
mov esi, value;
|
||||
call Scr_AddString_func;
|
||||
}
|
||||
}
|
||||
|
||||
const char* Scr_GetString(unsigned int index)
|
||||
{
|
||||
unsigned int ConstString;
|
||||
ConstString = Game::Scr_GetConstString(index);
|
||||
return SL_ConvertToString(ConstString);
|
||||
}
|
||||
|
||||
unsigned int Scr_GetConstString(unsigned int index /*eax*/)
|
||||
{
|
||||
const static uint32_t Scr_GetConstString_func = 0x558440;
|
||||
__asm
|
||||
{
|
||||
mov eax, index;
|
||||
call Scr_GetConstString_func;
|
||||
}
|
||||
}
|
||||
|
||||
int Scr_GetInt/*eax*/(unsigned int index /*eax*/)
|
||||
{
|
||||
int result;
|
||||
const static uint32_t Scr_GetInt_func = 0x5580F0;
|
||||
__asm
|
||||
{
|
||||
mov eax, index;
|
||||
call Scr_GetInt_func;
|
||||
mov result, eax;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
float Scr_GetFloat/*st0*/(unsigned int index /*eax*/)
|
||||
{
|
||||
const static uint32_t Scr_GetFloat_func = 0x5583A0;
|
||||
__asm
|
||||
{
|
||||
mov eax, index;
|
||||
xor eax, eax;
|
||||
call Scr_GetFloat_func;
|
||||
}
|
||||
}
|
||||
|
||||
void Scr_Error(const char* error/*eax*/)
|
||||
{
|
||||
const static uint32_t Scr_Error_func = 0x558FD0;
|
||||
__asm
|
||||
{
|
||||
mov eax, error;
|
||||
call Scr_Error_func;
|
||||
}
|
||||
}
|
||||
|
||||
int Scr_GetNumParam()
|
||||
{
|
||||
return *reinterpret_cast<int*>(0x128725C);
|
||||
}
|
||||
|
||||
void Scr_VerifyWeaponIndex(const char* weaponName /*esi*/)
|
||||
{
|
||||
const static uint32_t Scr_VerifyWeaponIndex_func = 0x4C7D70;
|
||||
__asm
|
||||
{
|
||||
mov esi, weaponName;
|
||||
call Scr_VerifyWeaponIndex_func;
|
||||
}
|
||||
}
|
||||
|
||||
__int16 Scr_ExecThread(int handle/*eax*/)
|
||||
{
|
||||
__int16 result;
|
||||
const static uint32_t Scr_ExecThread_func = 0x557950;
|
||||
__asm
|
||||
{
|
||||
pushad;
|
||||
mov eax, handle;
|
||||
call Scr_ExecThread_func;
|
||||
mov result, ax;
|
||||
popad;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int Scr_FreeThread(unsigned __int16 handle)
|
||||
{
|
||||
return Game::RemoveRefToObject(handle);
|
||||
}
|
||||
|
||||
int Scr_LoadScript(const char* filename)
|
||||
{
|
||||
int result;
|
||||
const static uint32_t Scr_LoadScript_func = 0x549630;
|
||||
__asm
|
||||
{
|
||||
pushad;
|
||||
mov ecx, filename;
|
||||
call Scr_LoadScript_func;
|
||||
mov result, eax;
|
||||
popad;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
47
src/Game/Scripts.hpp
Normal file
47
src/Game/Scripts.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
namespace Game
|
||||
{
|
||||
extern scr_const_t* scr_const;
|
||||
extern Game::scrVarPub_t* scrVarPub;
|
||||
extern Game::scrVmPub_t* scrVmPub;
|
||||
|
||||
//-------------------------------------------------
|
||||
typedef unsigned int(__cdecl* Scr_AllocString_t)(const char* s, int sys, size_t size);
|
||||
extern Scr_AllocString_t Scr_AllocString;
|
||||
|
||||
typedef void(*Scr_AddInt_t)(int value);
|
||||
extern Scr_AddInt_t Scr_AddInt;
|
||||
|
||||
typedef void(*Scr_AddFloat_t)(float value);
|
||||
extern Scr_AddFloat_t Scr_AddFloat;
|
||||
|
||||
typedef void(__cdecl* Scr_ParamError_t)(const char* error, ...);
|
||||
extern Scr_ParamError_t Scr_ParamError;
|
||||
|
||||
typedef Game::xmethod_t(Player_GetMethod_t)(const char**);
|
||||
extern Player_GetMethod_t* Player_GetMethod;
|
||||
|
||||
typedef Game::xfunction_t(Scr_GetFunction_t)(const char**, int*);
|
||||
extern Scr_GetFunction_t* Scr_GetFunction;
|
||||
|
||||
typedef int(*Scr_GetFunctionHandle_t)(const char* filename, const char* name);
|
||||
extern Scr_GetFunctionHandle_t Scr_GetFunctionHandle;
|
||||
|
||||
typedef int(*Scr_LoadScriptInternal_t)(const char* filename, Game::PrecacheEntry* entries, int entriesCount);
|
||||
extern Scr_LoadScriptInternal_t Scr_LoadScriptInternal;
|
||||
|
||||
//-------------------------------------------------
|
||||
unsigned int GScr_AllocString(const char* s);
|
||||
void Scr_AddString(const char* value /*esi*/);
|
||||
const char* Scr_GetString(unsigned int index);
|
||||
unsigned int Scr_GetConstString(unsigned int index /*eax*/);
|
||||
int Scr_GetInt/*eax*/(unsigned int index /*eax*/);
|
||||
float Scr_GetFloat/*st0*/(unsigned int index /*eax*/);
|
||||
int Scr_GetNumParam();
|
||||
void Scr_Error(const char* error/*eax*/);
|
||||
void Scr_VerifyWeaponIndex(const char* weaponName /*esi*/);
|
||||
__int16 Scr_ExecThread(int handle/*eax*/);
|
||||
int Scr_FreeThread(unsigned __int16 handle);
|
||||
int Scr_LoadScript(const char* filename);
|
||||
}
|
6335
src/Game/Structs.hpp
Normal file
6335
src/Game/Structs.hpp
Normal file
File diff suppressed because it is too large
Load Diff
61
src/Game/System.cpp
Normal file
61
src/Game/System.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
#include "STDInc.hpp"
|
||||
|
||||
namespace Game
|
||||
{
|
||||
char* sys_processSemaphoreFile = reinterpret_cast<char*>(0x13E1F10);
|
||||
//-------------------------------------------------
|
||||
Sys_SuspendOtherThreads_t Sys_SuspendOtherThreads = Sys_SuspendOtherThreads_t(0x539E40);
|
||||
//-------------------------------------------------
|
||||
int sys_timeBase;
|
||||
int Sys_MilliSeconds()
|
||||
{
|
||||
int sys_curtime;
|
||||
static bool initialized = false;
|
||||
|
||||
if (!initialized) {
|
||||
sys_timeBase = timeGetTime();
|
||||
initialized = true;
|
||||
}
|
||||
sys_curtime = timeGetTime() - sys_timeBase;
|
||||
|
||||
return sys_curtime;
|
||||
}
|
||||
|
||||
int Sys_MillisecondsRaw()
|
||||
{
|
||||
return timeGetTime();
|
||||
}
|
||||
|
||||
int Sys_IsDatabaseReady()
|
||||
{
|
||||
return WaitForSingleObject(Game::databaseCompletedEvent, 0) == 0;
|
||||
}
|
||||
|
||||
int Sys_IsDatabaseReady2()
|
||||
{
|
||||
return WaitForSingleObject(Game::databaseCompletedEvent2, 0) == 0;
|
||||
}
|
||||
|
||||
void Sys_CreateConsole/*ax*/(HINSTANCE hInstance /*edi*/)
|
||||
{
|
||||
const static uint32_t Sys_CreateConsole_func = 0x5962B0;
|
||||
__asm
|
||||
{
|
||||
mov edi, hInstance;
|
||||
call Sys_CreateConsole_func;
|
||||
}
|
||||
}
|
||||
|
||||
void Sys_ShowConsole()
|
||||
{
|
||||
if (!*Game::hWndParent)
|
||||
{
|
||||
HMODULE ModuleHandleA = GetModuleHandleA(0);
|
||||
Game::Sys_CreateConsole(ModuleHandleA);
|
||||
}
|
||||
|
||||
ShowWindow(*Game::hWndParent, SW_SHOWNORMAL);
|
||||
SendMessageA(*Game::hWndBuffer, 0xB6u, 0, 0xFFFF);
|
||||
DeleteFileA(&*Game::sys_processSemaphoreFile);
|
||||
}
|
||||
}
|
16
src/Game/System.hpp
Normal file
16
src/Game/System.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
namespace Game
|
||||
{
|
||||
extern char* sys_processSemaphoreFile;
|
||||
//-------------------------------------------------
|
||||
typedef void(*Sys_SuspendOtherThreads_t)();
|
||||
extern Sys_SuspendOtherThreads_t Sys_SuspendOtherThreads;
|
||||
//-------------------------------------------------
|
||||
extern int Sys_MilliSeconds();
|
||||
extern int Sys_MillisecondsRaw();
|
||||
extern int Sys_IsDatabaseReady();
|
||||
extern int Sys_IsDatabaseReady2();
|
||||
void Sys_CreateConsole/*ax*/(HINSTANCE hInstance /*edi*/);
|
||||
void Sys_ShowConsole();
|
||||
}
|
Reference in New Issue
Block a user