Skip to content

Commit

Permalink
Merge branch 'DFHack:master' into fix/optifog
Browse files Browse the repository at this point in the history
  • Loading branch information
NicksWorld authored Jan 28, 2025
2 parents 886fc13 + c71abf6 commit 03ddb51
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
9 changes: 5 additions & 4 deletions Creatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,15 @@ void DrawCreatureText(int drawx, int drawy, Stonesense_Unit* creature )
textcol = al_map_rgb(255,255,255);
}

if (!creature->origin->name.nickname.empty() && ssConfig.config.names_use_nick) {
auto name = DFHack::Units::getVisibleName(creature->origin);
if (!name->nickname.empty() && ssConfig.config.names_use_nick) {
draw_textf_border(stonesenseState.font, textcol, drawx, drawy-((WALLHEIGHT*ssConfig.scale)+fontHeight + offsety), 0,
"%s", DF2UTF(creature->origin->name.nickname).c_str());
"%s", DF2UTF(name->nickname).c_str());
}
else if (!creature->origin->name.first_name.empty())
else if (!name->first_name.empty())
{
char buffer[128];
strncpy(buffer,creature->origin->name.first_name.c_str(),127);
strncpy(buffer,name->first_name.c_str(), 127);
buffer[127]=0;
ALLEGRO_USTR* temp = bufferToUstr(buffer, 128);
al_ustr_set_chr(temp, 0, charToUpper(al_ustr_get(temp, 0)));
Expand Down
16 changes: 10 additions & 6 deletions GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,10 @@ void DoSpriteIndexOverlay()
paintboard();
}

float clockToMs(float clockTicks) {
return clockTicks / (CLOCKS_PER_SEC/1000);
}

void paintboard()
{
DFHack::CoreSuspender suspend;
Expand Down Expand Up @@ -939,12 +943,12 @@ void paintboard()

if(ssConfig.config.debug_mode) {
auto& contentLoader = stonesenseState.contentLoader;
draw_textf_border(font, uiColor(1), 10, 3*fontHeight, 0, "Map Read Time: %.2fms", float(stonesenseState.stoneSenseTimers.read_time));
draw_textf_border(font, uiColor(1), 10, 4*fontHeight, 0, "Map Beautification Time: %.2fms", float(stonesenseState.stoneSenseTimers.beautify_time));
draw_textf_border(font, uiColor(1), 10, 5*fontHeight, 0, "Tile Sprite Assembly Time: %.2fms", float(stonesenseState.stoneSenseTimers.assembly_time));
draw_textf_border(font, uiColor(1), 10, 6*fontHeight, 0, "DF Renderer Overlay Time: %.2fms", float(stonesenseState.stoneSenseTimers.overlay_time));
draw_textf_border(font, uiColor(1), 10, 2*fontHeight, 0, "FPS: %.2f", float(1000.0/stonesenseState.stoneSenseTimers.frame_total));
draw_textf_border(font, uiColor(1), 10, 7*fontHeight, 0, "Draw: %.2fms", float(stonesenseState.stoneSenseTimers.draw_time));
draw_textf_border(font, uiColor(1), 10, 3*fontHeight, 0, "Map Read Time: %.2fms", clockToMs(stonesenseState.stoneSenseTimers.read_time));
draw_textf_border(font, uiColor(1), 10, 4*fontHeight, 0, "Map Beautification Time: %.2fms", clockToMs(stonesenseState.stoneSenseTimers.beautify_time));
draw_textf_border(font, uiColor(1), 10, 5*fontHeight, 0, "Tile Sprite Assembly Time: %.2fms", clockToMs(stonesenseState.stoneSenseTimers.assembly_time));
draw_textf_border(font, uiColor(1), 10, 6*fontHeight, 0, "DF Renderer Overlay Time: %.2fms", clockToMs(stonesenseState.stoneSenseTimers.overlay_time));
draw_textf_border(font, uiColor(1), 10, 2*fontHeight, 0, "FPS: %.2f", 1000.0/clockToMs(stonesenseState.stoneSenseTimers.frame_total));
draw_textf_border(font, uiColor(1), 10, 7*fontHeight, 0, "Draw: %.2fms", clockToMs(stonesenseState.stoneSenseTimers.draw_time));
draw_textf_border(font, uiColor(1), 10, 9*fontHeight, 0, "%i/%i/%i, %i:%i", contentLoader->currentDay+1, contentLoader->currentMonth+1, contentLoader->currentYear, contentLoader->currentHour, (contentLoader->currentTickRel*60)/50);

drawDebugInfo(segment);
Expand Down
3 changes: 3 additions & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ Template for new versions:
- `stonesense`: fixed announcement text rendering off-screen with larger font sizes
- `stonesense`: screen dimensions are now properly set when overriden by a window manager
- `stonesense`: fixed glass cabinets and bookcases being misaligned by 1 pixel
- `stonesense`: vampires no longer show their true name when they shouldn't.
- `stonesense`: fixed debug performance timers to show milliseconds as intended


## Misc Improvements
- `stonesense`: improved the way altars look
Expand Down

0 comments on commit 03ddb51

Please sign in to comment.