|
|
|
@ -48,74 +48,106 @@ int Gui_Finish(DFHackObject* gui)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int Gui_ReadViewScreen(DFHackObject* gui, t_viewscreen* viewscreen)
|
|
|
|
|
int Gui_getViewCoords(DFHackObject* gui, int32_t* x, int32_t* y, int32_t* z)
|
|
|
|
|
{
|
|
|
|
|
if(gui != NULL)
|
|
|
|
|
{
|
|
|
|
|
return ((DFHack::Gui*)gui)->ReadViewScreen(*viewscreen);
|
|
|
|
|
int32_t tx, ty, tz;
|
|
|
|
|
|
|
|
|
|
if(((DFHack::Gui*)gui)->getViewCoords(tx, ty, tz))
|
|
|
|
|
{
|
|
|
|
|
*x = tx;
|
|
|
|
|
*y = ty;
|
|
|
|
|
*z = tz;
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int Gui_ReadMenuState(DFHackObject* gui, uint32_t* menuState)
|
|
|
|
|
int Gui_setViewCoords(DFHackObject* gui, int32_t x, int32_t y, int32_t z)
|
|
|
|
|
{
|
|
|
|
|
if(gui != NULL)
|
|
|
|
|
{
|
|
|
|
|
*menuState = ((DFHack::Gui*)gui)->ReadMenuState();
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
if(((DFHack::Gui*)gui)->setViewCoords(x, y, z))
|
|
|
|
|
return 1;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int Gui_getViewCoords(DFHackObject* pos, int32_t* x, int32_t* y, int32_t* z)
|
|
|
|
|
int Gui_getCursorCoords(DFHackObject* gui, int32_t* x, int32_t* y, int32_t* z)
|
|
|
|
|
{
|
|
|
|
|
if(pos != NULL)
|
|
|
|
|
{
|
|
|
|
|
int32_t tx, ty, tz;
|
|
|
|
|
if(gui != NULL)
|
|
|
|
|
{
|
|
|
|
|
int32_t tx, ty, tz;
|
|
|
|
|
|
|
|
|
|
if(((DFHack::Gui*)gui)->getCursorCoords(tx, ty, tz))
|
|
|
|
|
{
|
|
|
|
|
*x = tx;
|
|
|
|
|
*y = ty;
|
|
|
|
|
*z = tz;
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(((DFHack::Gui*)pos)->getViewCoords(tx, ty, tz))
|
|
|
|
|
{
|
|
|
|
|
*x = tx;
|
|
|
|
|
*y = ty;
|
|
|
|
|
*z = tz;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
int Gui_setCursorCoords(DFHackObject* gui, int32_t x, int32_t y, int32_t z)
|
|
|
|
|
{
|
|
|
|
|
if(gui != NULL)
|
|
|
|
|
{
|
|
|
|
|
if(((DFHack::Gui*)gui)->setCursorCoords(x, y, z))
|
|
|
|
|
return 1;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int Gui_setViewCoords(DFHackObject* pos, int32_t x, int32_t y, int32_t z)
|
|
|
|
|
t_hotkey* Gui_ReadHotkeys(DFHackObject* gui)
|
|
|
|
|
{
|
|
|
|
|
if(pos != NULL)
|
|
|
|
|
{
|
|
|
|
|
if(((DFHack::Gui*)pos)->setViewCoords(x, y, z))
|
|
|
|
|
return 1;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if(gui != NULL)
|
|
|
|
|
{
|
|
|
|
|
t_hotkey* buf;
|
|
|
|
|
|
|
|
|
|
(*alloc_t_hotkey_buffer_callback)(&buf, NUM_HOTKEYS);
|
|
|
|
|
|
|
|
|
|
if(buf != NULL)
|
|
|
|
|
{
|
|
|
|
|
if(((DFHack::Gui*)gui)->ReadHotkeys(buf))
|
|
|
|
|
return buf;
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Gui_getCursorCoords(DFHackObject* pos, int32_t* x, int32_t* y, int32_t* z)
|
|
|
|
|
int Gui_getWindowSize(DFHackObject* gui, int32_t* width, int32_t* height)
|
|
|
|
|
{
|
|
|
|
|
if(pos != NULL)
|
|
|
|
|
if(gui != NULL)
|
|
|
|
|
{
|
|
|
|
|
int32_t tx, ty, tz;
|
|
|
|
|
int32_t tw, th;
|
|
|
|
|
|
|
|
|
|
if(((DFHack::Gui*)pos)->getCursorCoords(tx, ty, tz))
|
|
|
|
|
if(((DFHack::Gui*)gui)->getWindowSize(tw, th))
|
|
|
|
|
{
|
|
|
|
|
*x = tx;
|
|
|
|
|
*y = ty;
|
|
|
|
|
*z = tz;
|
|
|
|
|
*width = tw;
|
|
|
|
|
*height = th;
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
@ -126,82 +158,48 @@ int Gui_getCursorCoords(DFHackObject* pos, int32_t* x, int32_t* y, int32_t* z)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int Gui_setCursorCoords(DFHackObject* pos, int32_t x, int32_t y, int32_t z)
|
|
|
|
|
t_screen* Gui_getScreenTiles(DFHackObject* gui, int32_t width, int32_t height)
|
|
|
|
|
{
|
|
|
|
|
if(pos != NULL)
|
|
|
|
|
{
|
|
|
|
|
if(((DFHack::Gui*)pos)->setCursorCoords(x, y, z))
|
|
|
|
|
return 1;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if(gui != NULL)
|
|
|
|
|
{
|
|
|
|
|
t_screen* buf;
|
|
|
|
|
|
|
|
|
|
t_hotkey* Gui_ReadHotkeys(DFHackObject* pos)
|
|
|
|
|
{
|
|
|
|
|
if(pos != NULL)
|
|
|
|
|
{
|
|
|
|
|
t_hotkey* buf = NULL;
|
|
|
|
|
(*alloc_t_screen_buffer_callback)(&buf, width * height);
|
|
|
|
|
|
|
|
|
|
(*alloc_hotkey_buffer_callback)(&buf, NUM_HOTKEYS);
|
|
|
|
|
if(buf == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
if(buf != NULL)
|
|
|
|
|
{
|
|
|
|
|
if(((DFHack::Gui*)pos)->ReadHotkeys(buf))
|
|
|
|
|
return buf;
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if(((DFHack::Gui*)gui)->getScreenTiles(width, height, buf))
|
|
|
|
|
return buf;
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int Gui_getWindowSize(DFHackObject* pos, int32_t* width, int32_t* height)
|
|
|
|
|
int Gui_ReadViewScreen(DFHackObject* gui, t_viewscreen* viewscreen)
|
|
|
|
|
{
|
|
|
|
|
if(pos != NULL)
|
|
|
|
|
{
|
|
|
|
|
int32_t tw, th;
|
|
|
|
|
|
|
|
|
|
if(((DFHack::Gui*)pos)->getWindowSize(tw, th))
|
|
|
|
|
{
|
|
|
|
|
*width = tw;
|
|
|
|
|
*height = th;
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
if(gui != NULL)
|
|
|
|
|
{
|
|
|
|
|
return ((DFHack::Gui*)gui)->ReadViewScreen(*viewscreen);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t_screen* Gui_getScreenTiles(DFHackObject* pos, int32_t width, int32_t height)
|
|
|
|
|
int Gui_ReadMenuState(DFHackObject* gui, uint32_t* menuState)
|
|
|
|
|
{
|
|
|
|
|
if(pos != NULL)
|
|
|
|
|
{
|
|
|
|
|
t_screen* buf = NULL;
|
|
|
|
|
|
|
|
|
|
(*alloc_screen_buffer_callback)(&buf, width * height);
|
|
|
|
|
|
|
|
|
|
if(buf == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
if(gui != NULL)
|
|
|
|
|
{
|
|
|
|
|
*menuState = ((DFHack::Gui*)gui)->ReadMenuState();
|
|
|
|
|
|
|
|
|
|
if(((DFHack::Gui*)pos)->getScreenTiles(width, height, buf))
|
|
|
|
|
return buf;
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|