Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adventure beta updates #4467

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
890cb95
update structures ref
myk002 Apr 13, 2024
b0b65a3
reference dungeonmode
myk002 Apr 14, 2024
4402430
update structures ref
myk002 Apr 14, 2024
43331d4
update rfr and ref
myk002 Apr 14, 2024
f17488d
bump version
myk002 Apr 14, 2024
0d3a9a9
update ref
myk002 Apr 14, 2024
5a8943e
don't crash on std::set fields
myk002 Apr 15, 2024
d3b423a
update ref
myk002 Apr 15, 2024
54fa0e9
remove debug line
myk002 Apr 15, 2024
897c6e5
add new viewscreens to overlay
myk002 Apr 15, 2024
2379a99
update ref
myk002 Apr 15, 2024
8d0c3cf
remove references to optimize viewscreen
myk002 Apr 15, 2024
1cba40c
Merge branch 'develop' into adv-beta
myk002 Apr 15, 2024
9ac2539
comment out references to nyi features
ab9rf Apr 16, 2024
61611b2
Update xml
ab9rf Apr 16, 2024
5440370
update ref
myk002 Apr 16, 2024
5fbf626
Merge branch 'develop' into adv-beta
myk002 Apr 16, 2024
388f9b2
Merge branch 'develop' into adv-beta
myk002 Apr 16, 2024
38c4bdc
move the DFHack logo to a free spot in dungeon mode
myk002 Apr 16, 2024
f6b4608
Merge branch 'develop' into adv-beta
myk002 Apr 17, 2024
989eb08
update ref
myk002 Apr 17, 2024
c660c66
Update xml
ab9rf Apr 17, 2024
aeaf213
update ref
myk002 Apr 17, 2024
047c864
Merge branch 'develop' into adv-beta
myk002 Apr 17, 2024
39c5005
update ref
myk002 Apr 17, 2024
9efd43b
Merge branch 'develop' into adv-beta
myk002 Apr 18, 2024
4786392
update refs
myk002 Apr 18, 2024
e90fe1e
Merge branch 'develop' into adv-beta
myk002 Apr 18, 2024
d71503d
Merge branch 'develop' into adv-beta
myk002 Apr 18, 2024
4437433
Merge branch 'develop' into adv-beta
myk002 Apr 18, 2024
3c58946
update ref
myk002 Apr 18, 2024
191fd46
Merge branch 'develop' into adv-beta
myk002 Apr 18, 2024
3d82849
Auto-update structures ref
github-actions[bot] Apr 18, 2024
20aaf0b
Auto-update structures ref
github-actions[bot] Apr 18, 2024
4bbea7a
Merge branch 'develop' into adv-beta
myk002 Apr 18, 2024
6258162
Auto-update structures ref
myk002 Apr 18, 2024
9c72ed4
Merge branch 'develop' into adv-beta
myk002 Apr 20, 2024
1c4f639
comment out references to non-ready viewscreens
myk002 Apr 20, 2024
8ca48eb
update ref
myk002 Apr 20, 2024
91bb4d5
Merge branch 'develop' into adv-beta
myk002 Apr 21, 2024
f52820e
Merge branch 'develop' into adv-beta
myk002 Apr 21, 2024
45397cb
Auto-update structures ref
myk002 Apr 21, 2024
733dbad
Merge branch 'develop' into adv-beta
myk002 Apr 21, 2024
5bf857e
Update xml
ab9rf Apr 21, 2024
2f3a615
Merge branch 'adv-beta' of https://github.com/DFHack/dfhack into adv-…
ab9rf Apr 21, 2024
cfaf8a4
fix menu appearing in wrong location when logo is clicked
myk002 Apr 21, 2024
68474d7
update ref
myk002 Apr 21, 2024
5bc0fec
Merge branch 'develop' into adv-beta
myk002 Apr 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ cmake_policy(SET CMP0074 NEW)
project(dfhack)

# set up versioning.
set(DF_VERSION "50.12")
set(DFHACK_RELEASE "r3")
set(DF_VERSION "51.01")
set(DFHACK_RELEASE "r1")
set(DFHACK_PRERELEASE FALSE)

set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}")
Expand Down
14 changes: 10 additions & 4 deletions plugins/hotkeys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ using std::vector;

using namespace DFHack;

static const string INVOKE_MENU_COMMAND = "overlay trigger hotkeys.menu";
static const string INVOKE_MENU_BASE_COMMAND = "overlay trigger ";
static const string INVOKE_MENU_PREFIX = INVOKE_MENU_BASE_COMMAND + "hotkeys.";
static const string INVOKE_MENU_DEFAULT_COMMAND = INVOKE_MENU_BASE_COMMAND + "hotkeys.menu";
static const string INVOKE_HOTKEYS_COMMAND = "hotkeys";
static const std::string MENU_SCREEN_FOCUS_STRING = "dfhack/lua/hotkeys/menu";

Expand Down Expand Up @@ -64,7 +66,7 @@ static void add_binding_if_valid(color_ostream &out, const string &sym, const st
if (!can_invoke(cmdline, screen))
return;

if (filtermenu && (cmdline == INVOKE_MENU_COMMAND ||
if (filtermenu && (cmdline.starts_with(INVOKE_MENU_PREFIX) ||
cmdline == INVOKE_HOTKEYS_COMMAND)) {
DEBUG(log).print("filtering out hotkey menu keybinding\n");
return;
Expand Down Expand Up @@ -191,8 +193,12 @@ static bool invoke_command(color_ostream &out, const size_t index) {

static command_result hotkeys_cmd(color_ostream &out, vector <string> & parameters) {
if (!parameters.size()) {
DEBUG(log).print("invoking command: '%s'\n", INVOKE_MENU_COMMAND.c_str());
return Core::getInstance().runCommand(out, INVOKE_MENU_COMMAND );
DEBUG(log).print("invoking command: '%s'\n", INVOKE_MENU_DEFAULT_COMMAND.c_str());
return Core::getInstance().runCommand(out, INVOKE_MENU_DEFAULT_COMMAND );
} else if (parameters.size() == 2 && parameters[0] == "menu") {
string cmd = INVOKE_MENU_BASE_COMMAND + parameters[1];
DEBUG(log).print("invoking command: '%s'\n", cmd.c_str());
return Core::getInstance().runCommand(out, cmd);
}

CoreSuspender guard;
Expand Down
68 changes: 45 additions & 23 deletions plugins/lua/hotkeys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,7 @@ end

HotspotMenuWidget = defclass(HotspotMenuWidget, overlay.OverlayWidget)
HotspotMenuWidget.ATTRS{
desc='Shows the DFHack logo context menu button.',
default_pos={x=5,y=1},
default_enabled=true,
version=2,
viewscreens={
'adopt_region',
'choose_game_type',
-- 'choose_start_site', -- conflicts with vanilla panel layouts
'dwarfmode',
'export_region',
'game_cleaner',
'initial_prep',
-- 'legends', -- conflicts with vanilla export button and info text
-- 'loadgame', -- disable temporarily while we get texture reloading sorted
-- 'new_arena', -- conflicts with vanilla panel layouts
-- 'new_region', -- conflicts with vanilla panel layouts
'savegame',
'setupdwarfgame',
'title/Default',
'update_region',
'world'
},
frame={w=4, h=3}
}

Expand Down Expand Up @@ -84,7 +63,7 @@ function HotspotMenuWidget:init()
get_tile_token(5, 179), get_tile_token(6, 'H'), get_tile_token(7, 'a'), get_tile_token(8, 179), NEWLINE,
get_tile_token(9, 179), get_tile_token(10, 'c'), get_tile_token(11, 'k'), get_tile_token(12, 179),
},
on_click=function() dfhack.run_command('hotkeys') end,
on_click=function() dfhack.run_command{'hotkeys', 'menu', self.name} end,
},
}
end
Expand All @@ -93,8 +72,51 @@ function HotspotMenuWidget:overlay_trigger()
return MenuScreen{hotspot=self}:show()
end

DwarfHotspotMenuWidget = defclass(DwarfHotspotMenuWidget, HotspotMenuWidget)
DwarfHotspotMenuWidget.ATTRS{
desc='Shows the DFHack logo context menu button in non-adventure mode screens.',
default_pos={x=5,y=1},
version=2,
viewscreens={
'adopt_region',
'choose_game_type',
-- 'choose_start_site', -- conflicts with vanilla panel layouts
'dwarfmode',
'export_region',
'game_cleaner',
'initial_prep',
-- 'legends', -- conflicts with vanilla export button and info text
-- 'loadgame', -- disable temporarily while we get texture reloading sorted
-- 'new_arena', -- conflicts with vanilla panel layouts
-- 'new_region', -- conflicts with vanilla panel layouts
'savegame',
'setupdwarfgame',
'title/Default',
'update_region',
'world'
},
}

DungeonHotspotMenuWidget = defclass(DungeonHotspotMenuWidget, HotspotMenuWidget)
DungeonHotspotMenuWidget.ATTRS{
desc='Shows the DFHack logo context menu button in adventure mode screens.',
default_pos={x=5,y=-13},
viewscreens={
-- 'adventure_log', -- need to verify compatibility
-- 'barter', -- need to verify compatibility
-- 'dungeon_monsterstatus', -- need to verify compatibility
'dungeonmode',
-- 'layer_unit_action', -- need to verify compatibility
-- 'layer_unit_health', -- need to verify compatibility
-- 'setupadventure', -- need to verify compatibility
},
}

-- register the menu hotspot with the overlay
OVERLAY_WIDGETS = {menu=HotspotMenuWidget}
OVERLAY_WIDGETS = {
menu=DwarfHotspotMenuWidget,
adventuremenu=DungeonHotspotMenuWidget,
}

-- ---- --
-- Menu --
Expand Down
21 changes: 21 additions & 0 deletions plugins/overlay.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
#include "df/enabler.h"
#include "df/viewscreen_adopt_regionst.h"
//#include "df/viewscreen_adventure_logst.h"
//#include "df/viewscreen_barterst.h"
#include "df/viewscreen_choose_game_typest.h"
#include "df/viewscreen_choose_start_sitest.h"
//#include "df/viewscreen_dungeon_monsterstatusst.h"
#include "df/viewscreen_dungeonmodest.h"
#include "df/viewscreen_dwarfmodest.h"
#include "df/viewscreen_export_regionst.h"
#include "df/viewscreen_game_cleanerst.h"
#include "df/viewscreen_initial_prepst.h"
//#include "df/viewscreen_layer_unit_actionst.h"
//#include "df/viewscreen_layer_unit_healthst.h"
#include "df/viewscreen_legendsst.h"
#include "df/viewscreen_loadgamest.h"
#include "df/viewscreen_new_arenast.h"
#include "df/viewscreen_new_regionst.h"
#include "df/viewscreen_savegamest.h"
#include "df/viewscreen_setupadventurest.h"
#include "df/viewscreen_setupdwarfgamest.h"
#include "df/viewscreen_titlest.h"
#include "df/viewscreen_update_regionst.h"
Expand Down Expand Up @@ -112,17 +119,24 @@ struct viewscreen_overlay : T {
template<> IMPLEMENT_VMETHOD_INTERPOSE_PRIO(screen##_overlay, render, 100);

IMPLEMENT_HOOKS(adopt_region)
//IMPLEMENT_HOOKS(adventure_log)
//IMPLEMENT_HOOKS(barter)
IMPLEMENT_HOOKS(choose_game_type)
IMPLEMENT_HOOKS(choose_start_site)
//IMPLEMENT_HOOKS(dungeon_monsterstatus)
IMPLEMENT_HOOKS(dungeonmode)
IMPLEMENT_HOOKS(dwarfmode)
IMPLEMENT_HOOKS(export_region)
IMPLEMENT_HOOKS(game_cleaner)
IMPLEMENT_HOOKS(initial_prep)
//IMPLEMENT_HOOKS(layer_unit_action)
//IMPLEMENT_HOOKS(layer_unit_health)
IMPLEMENT_HOOKS(legends)
IMPLEMENT_HOOKS(loadgame)
IMPLEMENT_HOOKS(new_arena)
IMPLEMENT_HOOKS(new_region)
IMPLEMENT_HOOKS(savegame)
IMPLEMENT_HOOKS(setupadventure)
IMPLEMENT_HOOKS(setupdwarfgame)
IMPLEMENT_HOOKS(title)
IMPLEMENT_HOOKS(update_region)
Expand All @@ -147,17 +161,24 @@ DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) {
DEBUG(control).print("%sing interpose hooks\n", enable ? "enabl" : "disabl");

if (INTERPOSE_HOOKS_FAILED(adopt_region) ||
// INTERPOSE_HOOKS_FAILED(adventure_log) ||
// INTERPOSE_HOOKS_FAILED(barter) ||
INTERPOSE_HOOKS_FAILED(choose_start_site) ||
INTERPOSE_HOOKS_FAILED(choose_game_type) ||
// INTERPOSE_HOOKS_FAILED(dungeon_monsterstatus) ||
INTERPOSE_HOOKS_FAILED(dungeonmode) ||
INTERPOSE_HOOKS_FAILED(dwarfmode) ||
INTERPOSE_HOOKS_FAILED(export_region) ||
INTERPOSE_HOOKS_FAILED(game_cleaner) ||
INTERPOSE_HOOKS_FAILED(initial_prep) ||
// INTERPOSE_HOOKS_FAILED(layer_unit_action) ||
// INTERPOSE_HOOKS_FAILED(layer_unit_health) ||
INTERPOSE_HOOKS_FAILED(legends) ||
INTERPOSE_HOOKS_FAILED(loadgame) ||
INTERPOSE_HOOKS_FAILED(new_arena) ||
INTERPOSE_HOOKS_FAILED(new_region) ||
INTERPOSE_HOOKS_FAILED(savegame) ||
INTERPOSE_HOOKS_FAILED(setupadventure) ||
INTERPOSE_HOOKS_FAILED(setupdwarfgame) ||
INTERPOSE_HOOKS_FAILED(title) ||
INTERPOSE_HOOKS_FAILED(update_region) ||
Expand Down
4 changes: 2 additions & 2 deletions plugins/remotefortressreader/remotefortressreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2526,9 +2526,9 @@ static void CopyLocalMap(df::world_data * worldData, df::world_region_details* w
if (region_x < 0 || region_y < 0 || region_x >= 16 || region_y >= 16)
continue;

for (size_t j = 0; j < realization->building_map[site_x][site_y].buildings.size(); j++)
for (size_t j = 0; j < realization->face[site_x][site_y].buildings.size(); j++)
{
auto in_building = realization->building_map[site_x][site_y].buildings[j];
auto in_building = realization->face[site_x][site_y].buildings[j];
auto out_building = outputTiles[region_x][region_y]->add_buildings();

out_building->set_id(in_building->id);
Expand Down
Loading