//eventually, this should be a sort of "smart-follow" which switches modes intelligently void followCurrentDFFocus() { if(ssState.dfCursor.x != -30000) { ssState.Position.x = ssState.dfCursor.x - (ssState.Size.x / 2) + ssConfig.viewXoffset; ssState.Position.y = ssState.dfCursor.y - (ssState.Size.y / 2) + ssConfig.viewYoffset; ssState.Position.z = ssState.dfCursor.z + ssConfig.viewZoffset + 1; } else { followCurrentDFCenter(); } }
void read_segment( void *arg) { if(!Maps::IsValid()) { return; } static bool firstLoad = 1; ssConfig.threadstarted = 1; WorldSegment* segment = NULL; { CoreSuspender suspend; //read cursor if (ssConfig.follow_DFcursor) { Gui::getCursorCoords(ssState.dfCursor.x, ssState.dfCursor.y, ssState.dfCursor.z); ssState.dfSelection.x = df::global::selection_rect->start_x; ssState.dfSelection.y = df::global::selection_rect->start_y; ssState.dfSelection.z = df::global::selection_rect->start_z; } if (firstLoad || ssConfig.track_mode != GameConfiguration::TRACKING_NONE) { firstLoad = 0; if (ssConfig.track_mode == GameConfiguration::TRACKING_CENTER) { followCurrentDFCenter(); } else if (ssConfig.track_mode == GameConfiguration::TRACKING_WINDOW) { followCurrentDFWindow(); } else if (ssConfig.track_mode == GameConfiguration::TRACKING_FOCUS) { followCurrentDFFocus(); ssConfig.follow_DFcursor = true; } } segment = map_segment.getRead(); readMapSegment(segment, ssState); ssConfig.threadstarted = 0; } if(segment) { beautifySegment(segment); //putting these here to increase responsiveness of the UI and to make megashots work //segment->segState.Position = ssState.Position; //segment->segState.dfCursor = ssState.dfCursor; segment->AssembleAllTiles(); //only need to lock the drawing segment because the reading segment is already locked map_segment.lockDraw(); map_segment.swap(); map_segment.unlockDraw(); } }