Fix noborder stuff

This commit is contained in:
momo5502 2016-06-28 12:46:28 +02:00
parent 9b2d709211
commit 8a4c64c2db
12 changed files with 39 additions and 53 deletions

2
deps/mongoose vendored

@ -1 +1 @@
Subproject commit ced823cd95b70b313fa56baad544ccec5d6ccd5b Subproject commit 4d65cb1c0ff6c8e50127afd6d9e2a88fe5f30972

View File

@ -61,18 +61,26 @@ namespace Components
return ((point.x - rect.left) > 0 && (point.y - rect.top) > 0 && (rect.right - point.x) > 0 && (rect.bottom - point.y) > 0); return ((point.x - rect.left) > 0 && (point.y - rect.top) > 0 && (rect.right - point.x) > 0 && (rect.bottom - point.y) > 0);
} }
void __declspec(naked) Window::StyleHookStub() int Window::IsNoBorder()
{ {
if (Window::NoBorder.Get<bool>()) return Window::NoBorder.Get<bool>();
{
__asm mov ebp, WS_VISIBLE | WS_POPUP
}
else
{
__asm mov ebp, WS_VISIBLE | WS_SYSMENU | WS_CAPTION
} }
__asm retn void __declspec(naked) Window::StyleHookStub()
{
__asm
{
call Window::IsNoBorder
test al, al
jz setBorder
mov ebp, WS_VISIBLE | WS_POPUP
retn
setBorder:
mov ebp, WS_VISIBLE | WS_SYSMENU | WS_CAPTION
retn
}
} }
void Window::DrawCursorStub(void *scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float *color, Game::Material *material) void Window::DrawCursorStub(void *scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float *color, Game::Material *material)

View File

@ -22,6 +22,8 @@ namespace Components
static HWND MainWindow; static HWND MainWindow;
static int IsNoBorder();
static int WINAPI ShowCursorHook(BOOL show); static int WINAPI ShowCursorHook(BOOL show);
static void DrawCursorStub(void *scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float *color, Game::Material *material); static void DrawCursorStub(void *scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float *color, Game::Material *material);

View File

@ -317,12 +317,16 @@ namespace Components
} }
// Add branding asset // Add branding asset
// TODO: Check if a RawFile with the same name has already been added, to prevent conflicts.
void ZoneBuilder::Zone::AddBranding() void ZoneBuilder::Zone::AddBranding()
{ {
char* data = "FastFile built using IW4x ZoneTool!"; char* data = "FastFile built using IW4x ZoneTool!";
ZoneBuilder::Zone::Branding = { ZoneBuilder::Zone::ZoneName.data(), (int)strlen(data), 0, data }; ZoneBuilder::Zone::Branding = { ZoneBuilder::Zone::ZoneName.data(), (int)strlen(data), 0, data };
if (ZoneBuilder::Zone::FindAsset(Game::XAssetType::ASSET_TYPE_RAWFILE, ZoneBuilder::Zone::Branding.name) != -1)
{
Logger::Error("Unable to add branding. Asset '%s' already exists!", ZoneBuilder::Zone::Branding.name);
}
Game::XAssetHeader header = { &Branding }; Game::XAssetHeader header = { &Branding };
Game::XAsset brandingAsset = { Game::XAssetType::ASSET_TYPE_RAWFILE, header }; Game::XAsset brandingAsset = { Game::XAssetType::ASSET_TYPE_RAWFILE, header };
ZoneBuilder::Zone::LoadedAssets.push_back(brandingAsset); ZoneBuilder::Zone::LoadedAssets.push_back(brandingAsset);
@ -387,16 +391,14 @@ namespace Components
// Find a local scriptString // Find a local scriptString
int ZoneBuilder::Zone::FindScriptString(std::string str) int ZoneBuilder::Zone::FindScriptString(std::string str)
{ {
int loc = 0; for (unsigned int i = 0; i < ZoneBuilder::Zone::ScriptStrings.size(); ++i)
for (auto it : ZoneBuilder::Zone::ScriptStrings)
{ {
++loc; if (ZoneBuilder::Zone::ScriptStrings[i] == str)
{
return (i + 1);
}
}
if (!it.compare(str))
{
return loc;
}
}
return -1; return -1;
} }
@ -461,38 +463,12 @@ namespace Components
ZoneBuilder::ZoneBuilder() ZoneBuilder::ZoneBuilder()
{ {
static_assert(sizeof(Game::XFileHeader) == 21, "Invalid XFileHeader structure!"); Assert_Size(Game::XFileHeader, 21);
static_assert(sizeof(Game::XFile) == 40, "Invalid XFile structure!"); Assert_Size(Game::XFile, 40);
static_assert(Game::MAX_XFILE_COUNT == 8, "XFile block enum is invalid!"); static_assert(Game::MAX_XFILE_COUNT == 8, "XFile block enum is invalid!");
ZoneBuilder::EndAssetTrace(); ZoneBuilder::EndAssetTrace();
AssetHandler::OnLoad([] (Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool* restrict)
{
// static void* blocTable = 0;
//
// if (FastFiles::Current() == "iw4x_ui_mp" && type == Game::XAssetType::ASSET_TYPE_MATERIAL)
// {
// if (name == "preview_mp_bloc"s)
// {
// blocTable = asset.material->stateBitTable;
// }
// else if (blocTable)
// {
// void* thisTable = asset.material->stateBitTable;
//
// if (thisTable != blocTable)
// {
// OutputDebugStringA("DIFF!");
// }
// else
// {
// OutputDebugStringA("YAY!");
// }
// }
// }
});
if (ZoneBuilder::IsEnabled()) if (ZoneBuilder::IsEnabled())
{ {
// Prevent loading textures (preserves loaddef) // Prevent loading textures (preserves loaddef)