Allow renaming of towns during gameplay
This commit is contained in:
parent
6d63e99f6d
commit
badfb2c76b
|
@ -0,0 +1,4 @@
|
||||||
|
0.1.0 (in development)
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
- Feature: Towns can now always be renamed (As seen in OpenTTD).
|
||||||
|
- Feature: Playable in a resizable window.
|
|
@ -48,6 +48,13 @@ void register_hooks()
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
register_hook(0x00498E9B,
|
||||||
|
[](registers ®s) -> uint8_t
|
||||||
|
{
|
||||||
|
openloco::ui::windows::sub_498E9B((openloco::ui::window *)regs.esi);
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
// Remove the set window pos function, we do not want it as it
|
// Remove the set window pos function, we do not want it as it
|
||||||
// keeps moving the process window to 0, 0
|
// keeps moving the process window to 0, 0
|
||||||
// Can be removed when windowmgr:update() is hooked
|
// Can be removed when windowmgr:update() is hooked
|
||||||
|
|
|
@ -63,6 +63,11 @@ namespace openloco
|
||||||
return glpCmdLine;
|
return glpCmdLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_editor_mode()
|
||||||
|
{
|
||||||
|
return (_screen_flags & screen_flags::editor) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool is_paused()
|
bool is_paused()
|
||||||
{
|
{
|
||||||
return paused_state;
|
return paused_state;
|
||||||
|
|
|
@ -16,6 +16,8 @@ namespace openloco
|
||||||
|
|
||||||
void * hInstance();
|
void * hInstance();
|
||||||
const char * lpCmdLine();
|
const char * lpCmdLine();
|
||||||
|
bool is_editor_mode();
|
||||||
|
bool is_paused();
|
||||||
|
|
||||||
void prompt_tick_loop(std::function<bool()> tickAction);
|
void prompt_tick_loop(std::function<bool()> tickAction);
|
||||||
void sub_48A18C();
|
void sub_48A18C();
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
<ClCompile Include="windows\promptbrowsewnd.cpp" />
|
<ClCompile Include="windows\promptbrowsewnd.cpp" />
|
||||||
<ClCompile Include="windows\promptokcancelwnd.cpp" />
|
<ClCompile Include="windows\promptokcancelwnd.cpp" />
|
||||||
<ClCompile Include="windows\textinputwnd.cpp" />
|
<ClCompile Include="windows\textinputwnd.cpp" />
|
||||||
|
<ClCompile Include="windows\townwnd.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="audio\audio.h" />
|
<ClInclude Include="audio\audio.h" />
|
||||||
|
|
|
@ -42,8 +42,12 @@ namespace openloco::ui::windows
|
||||||
save = 2
|
save = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window * open_town_window(uint16_t townId);
|
||||||
|
void sub_498E9B(window * w);
|
||||||
|
|
||||||
bool prompt_browse(browse_type type, char * path, const char * filter, const char * title);
|
bool prompt_browse(browse_type type, char * path, const char * filter, const char * title);
|
||||||
bool prompt_ok_cancel(string_id okButtonStringId);
|
bool prompt_ok_cancel(string_id okButtonStringId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace openloco::ui::textinput
|
namespace openloco::ui::textinput
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
#include "../interop/interop.hpp"
|
||||||
|
#include "../openloco.h"
|
||||||
|
#include "../windowmgr.h"
|
||||||
|
|
||||||
|
namespace openloco::ui::windows
|
||||||
|
{
|
||||||
|
// 0x00498E9B
|
||||||
|
void sub_498E9B(window * w)
|
||||||
|
{
|
||||||
|
w->enabled_widgets |= 2;
|
||||||
|
#ifdef _DISABLE_TOWN_RENAME_
|
||||||
|
if (is_editor_mode())
|
||||||
|
{
|
||||||
|
w->enabled_widgets &= ~2;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0x00446F6B
|
||||||
|
// dx: townId
|
||||||
|
// esi: {return}
|
||||||
|
window * open_town_window(uint16_t townId)
|
||||||
|
{
|
||||||
|
registers regs;
|
||||||
|
regs.dx = townId;
|
||||||
|
LOCO_CALLPROC_X(0x00446F6B, regs);
|
||||||
|
return (window *)regs.esi;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue