Navigation Menu

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

Use map_y1 and map_y2 fields in Gui::DwarfmodeDims #981

Closed
lethosor opened this issue Aug 16, 2016 · 8 comments
Closed

Use map_y1 and map_y2 fields in Gui::DwarfmodeDims #981

lethosor opened this issue Aug 16, 2016 · 8 comments
Assignees
Labels
idea Suggestions, etc. internal DFHack Core
Projects
Milestone

Comments

@lethosor
Copy link
Member

Needed for #746, mifki/df-twbt#21

@lethosor lethosor added idea Suggestions, etc. internal DFHack Core labels Aug 16, 2016
@lethosor lethosor added this to the 0.43.05-r1 milestone Aug 16, 2016
@lethosor lethosor self-assigned this Aug 16, 2016
@pronvit
Copy link
Contributor

pronvit commented Aug 18, 2016

Not map_y1/y2. Something like map_width/height_in_map_tiles.

Examples of the things plugin may want to do:

  • Print text in the menu area - need to know menu x1/x2/y1/y2 in text tiles, need to be able to output to the text buffer.
  • Draw some text/dialog centred over the map - need to know map x1/x2/y1/y2 in text tiles (y1/y2 are the same as for the menu and area map), need to be able to output the text buffer.
  • Find visible objects, draw something on the map (using map tiles) - need to know map width/height, need to be able to output to the map buffer. In the map buffer, map obviously starts at (0,0) always, so no x1/y1 needed here.

@lethosor
Copy link
Member Author

lethosor commented Aug 18, 2016

A height and width wouldn't be consistent with the other fields. Anyway, what's the difference? Wouldn't you be able to get height and width with (map_y2 - map_y1) and (map_x2 - map_x1)?

For your second point, you could use map_y1 and map_y2 and set the map parameter of drawing functions to true to use map tiles, or use y1 and y2 and set map to false to use text tiles, e.g. for stuff like message boxes. (The latter is the default, I believe.)

@pronvit
Copy link
Contributor

pronvit commented Aug 21, 2016

(map_x2 - map_x1) is usable of course, it just that max_x1/map_y1 do not make sense - they are "left/top edge of the map in 'map tiles'", while 'map tile' units exist only inside the map.

As for the drawing, yes, that was the idea, I just mentioned it for the sake of completeness.

@lethosor
Copy link
Member Author

map_x1 and map_y1 both being 1 is more consistent with the other DwarfmodeDims fields, though - e.g. map_x1, map_x2, menu_x1, menu_x2, area_x1, and area_x2 are all absolute tile positions, so it's easy to draw text to the screen at, say, (menu_x1, y) and have it show up in the leftmost column of the sidebar menu. Without TwbT, map_y1 and map_y2 would be usable in the same way if they're absolute coordinates, so I think it's a cleaner solution.

Anyway, it turns out that I did add map_y1/y2 in 2a2ab00, but didn't update anything to use them.

@lethosor lethosor changed the title Add map_y1 and map_y2 fields to Gui::DwarfmodeDims Use map_y1 and map_y2 fields in Gui::DwarfmodeDims Aug 22, 2016
@lethosor
Copy link
Member Author

Update: I got some work done on this a few weeks ago, although it's not finished (or merged). The map_x1/y1 fields are actually set properly in C++, and the Lua gui library is partially refactored to use the C++ function internally.

@lethosor lethosor modified the milestones: 0.43.05-r1, 0.43.05-r2 Jan 4, 2017
@PeridexisErrant
Copy link
Contributor

PeridexisErrant commented May 14, 2017

My build scripts just noticed that we have a stable DFHack release, and that I was planning to check on this issue. So:

  • when is this expected to be merged? (from the tag I guess r2 😉 )
  • will it mean that TwbT can distribute a single plugin only, instead of patching automaterial/mousequery/resume as well?

(No pressure, just to let me set the next build failure appropriately)

@lethosor
Copy link
Member Author

Thanks for reminding me, but I somehow didn't get a notification for it, which is strange.

Anyway, yes, I do expect to work on this before r2, and it should allow TwbT to avoid distributing those three plugins as well. That depends on @pronvit to modify TwbT to use the hooks and on us to merge in whatever changes he's made (I believe there were a couple mousequery modifications).

@lethosor lethosor added this to To Do in 0.43.05-r2 May 27, 2017
@lethosor lethosor moved this from To Do to In Progress in 0.43.05-r2 Jun 3, 2017
@lethosor
Copy link
Member Author

lethosor commented Jun 9, 2017

I've fixed the three plugins here, and fixing Lua scripts wound up being pretty easy, so I'm closing this.

@lethosor lethosor closed this as completed Jun 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea Suggestions, etc. internal DFHack Core
Projects
No open projects
0.43.05-r2
In Progress
Development

No branches or pull requests

3 participants