Fix glass and maptest

This commit is contained in:
momo5502 2016-10-31 16:49:45 +01:00
parent 7aba6250f6
commit 4c2f128e97
7 changed files with 21 additions and 39 deletions

2
deps/fmt vendored

@ -1 +1 @@
Subproject commit 8c63ea432c7985eb056f1457d7edc8574d4fa2f8
Subproject commit 6d9e4d330c5845436dca7a32154176212ebbd4a4

2
deps/mongoose vendored

@ -1 +1 @@
Subproject commit 92b15395a43e0fcdfcf094e519798a0a1cae2b1c
Subproject commit b39e30fb0cbed1b91a205903fc6f8956a9e58c32

View File

@ -99,30 +99,21 @@ namespace Components
Command::Add("mapTest", [](Command::Params params)
{
Game::UI_UpdateArenas();
std::string command;
int max = (params.Length() >= 2 ? atoi(params[1]) : 16), current = 0;
for (int i = 0;;)
for (int i = 0; i < (params.Length() >= 2 ? atoi(params[1]) : *Game::arenaCount); ++i)
{
char* mapname = Game::mapnames[i];
if (!*mapname)
{
i = 0;
continue;
}
char* mapname = ArenaLength::NewArenas[i % *Game::arenaCount].mapName;
if (!(i % 2)) command.append(fmt::sprintf("wait 250;disconnect;wait 750;", mapname)); // Test a disconnect
else command.append(fmt::sprintf("wait 500;", mapname)); // Test direct map switch
else command.append(fmt::sprintf("wait 500;", mapname)); // Test direct map switch
command.append(fmt::sprintf("map %s;", mapname));
++i, ++current;
if (current >= max) break;
}
Command::Execute(command, false);
});
Command::Add("debug_exceptionhandler", [](Command::Params)
{
Logger::Print("Rerunning SetUnhandledExceptionHandler...\n");

View File

@ -151,27 +151,16 @@ namespace Components
}
}
Game::GameMap_Data** Maps::GetWorldData()
Game::GameMap_Data* Maps::GetWorldData()
{
Game::XAssetType type = Game::XAssetType::ASSET_TYPE_GAME_MAP_MP;
if (Utils::String::StartsWith(Maps::CurrentMainZone, "mp_") || Maps::IsSPMap)
if (!Utils::String::StartsWith(Maps::CurrentMainZone, "mp_") || Maps::IsSPMap)
{
type = Game::XAssetType::ASSET_TYPE_GAME_MAP_SP;
return Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAME_MAP_SP].gameMapSP[0].data;
}
else
{
return Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAME_MAP_MP].gameMapMP[0].data;
}
return &(Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAME_MAP_MP].gameMapMP[0].data);
}
__declspec(naked) void Maps::GetWorldDataStub()
{
__asm
{
mov eax, 46AC30h
call eax
call Maps::GetWorldData
retn
}
}
void Maps::GetBSPName(char* buffer, size_t size, const char* format, const char* mapname)
@ -507,8 +496,7 @@ namespace Components
Utils::Hook(0x444810, Maps::IgnoreEntityStub, HOOK_JUMP).Install()->Quick();
// WorldData pointer replacement
Utils::Hook::Nop(0x4D90B6, 5);
Utils::Hook(0x4D90B1, Maps::GetWorldDataStub, HOOK_CALL).Install()->Quick();
Utils::Hook(0x4D90B6, Maps::GetWorldData, HOOK_CALL).Install()->Quick();
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_GAME_MAP_SP, 1);
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_IMAGE, 7168);

View File

@ -40,8 +40,7 @@ namespace Components
static int IgnoreEntityStub(const char* entity);
static Game::GameMap_Data** GetWorldData();
static void GetWorldDataStub();
static Game::GameMap_Data* GetWorldData();
static void AddDlc(DLC dlc);
static void UpdateDlcStatus();

View File

@ -224,6 +224,7 @@ namespace Game
UI_AddMenuList_t UI_AddMenuList = (UI_AddMenuList_t)0x4533C0;
UI_CheckStringTranslation_t UI_CheckStringTranslation = (UI_CheckStringTranslation_t)0x4FB010;
UI_LoadMenus_t UI_LoadMenus = (UI_LoadMenus_t)0x641460;
UI_UpdateArenas_t UI_UpdateArenas = (UI_UpdateArenas_t)0x4A95B0;
UI_DrawHandlePic_t UI_DrawHandlePic = (UI_DrawHandlePic_t)0x4D0EA0;
UI_GetContext_t UI_GetContext = (UI_GetContext_t)0x4F8940;
UI_TextWidth_t UI_TextWidth = (UI_TextWidth_t)0x6315C0;

View File

@ -527,6 +527,9 @@ namespace Game
typedef MenuList *(__cdecl * UI_LoadMenus_t)(const char *menuFile, int imageTrack);
extern UI_LoadMenus_t UI_LoadMenus;
typedef void(__cdecl * UI_UpdateArenas_t)();
extern UI_UpdateArenas_t UI_UpdateArenas;
typedef void(__cdecl * UI_DrawHandlePic_t)(/*ScreenPlacement*/void *scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float *color, Material *material);
extern UI_DrawHandlePic_t UI_DrawHandlePic;