mapper: EDG angled edges (squareRect) editing

This commit is contained in:
phobos2077
2026-06-06 23:27:51 +02:00
parent 823858f275
commit d12dbca951
6 changed files with 465 additions and 148 deletions
+6 -1
View File
@@ -250,7 +250,7 @@ static bool mapEdgeLoadFromStream(File* stream)
}
// File stores RECT order: [0]=left, [1]=top, [2]=right, [3]=bottom.
EdgeZone zone{};
EdgeZone zone {};
zone.tileRect = { tileRect[0], tileRect[1], tileRect[2], tileRect[3] };
calcEdgeData(&zone);
data.zones.push_back(zone);
@@ -398,6 +398,11 @@ bool mapEdgeIsEnabled()
return edgeDataLoaded && edgeEnabled;
}
void mapEdgeUpgradeToVersion2()
{
edgeVersion2 = true;
}
bool mapEdgeZoneIsSelected()
{
return currentEdgeZone != nullptr;
+3
View File
@@ -64,6 +64,9 @@ bool mapEdgeIsLoaded();
void mapEdgeSetEnabled(bool enabled);
bool mapEdgeIsEnabled();
// Marks edge data as version 2 so squareRect/clipSides are written on save.
void mapEdgeUpgradeToVersion2();
// Returns true if a zone was selected on last tileSetCenter call.
bool mapEdgeZoneIsSelected();
File diff suppressed because it is too large Load Diff
+4
View File
@@ -10,6 +10,10 @@ void mapEdgeSetupInit();
// Edits the in-memory edge data; the disk write happens on the next map save.
void mapEdgeSetupDialog();
// Opens the Map Angled Edge Setup dialog to edit the current elevation's squareRect/clipSides.
// Edits the in-memory edge data; the disk write happens on the next map save.
void mapEdgeSquareSetupDialog();
// Toggles the persistent edge-rects overlay shown over the iso view while editing.
void mapEdgeSetupToggleOverlay();
+14 -3
View File
@@ -139,6 +139,7 @@ static char kArtToProtos[] = " Art => New Protos ";
static char kSwapPrototypse[] = " Swap Prototypes ";
static char kHiResMapEdges[] = " Hi-Res Map Edges Setup ";
static char kSetAngledEdges[] = " Set Hi-Res Angled Edges ";
static char kToggleMapEdgesOverlay[] = " Toggle Map Edges Overlay ";
static char kTmpMapName[] = "TMP$MAP#.MAP";
@@ -228,6 +229,7 @@ char* menu_3[] = {
char* menuNamesSettings[] = {
kHiResMapEdges,
kSetAngledEdges,
kToggleMapEdgesOverlay,
};
@@ -297,7 +299,7 @@ int menu_val_2[8];
int menu_val_3[7];
int menu_val_4[2];
int menu_val_4[3];
// 0x6EAA80
unsigned char e_num[4][19 * 26];
@@ -577,6 +579,7 @@ constexpr int kBtnClearMapLevel = 5666;
constexpr int kBtnCreateAllMapTexts = 5406;
constexpr int kBtnRebuildAllMaps = 5405;
constexpr int kBtnHiResMapEdges = 0x3101;
constexpr int kBtnSetAngledEdges = 0x3103;
constexpr int kBtnToggleMapEdgesOverlay = 0x3102;
// FILE menu pulldown keycodes
@@ -738,7 +741,8 @@ void MapperInit()
menu_val_3[6] = kBtnLibrarianSwapProtos;
menu_val_4[0] = kBtnHiResMapEdges;
menu_val_4[1] = kBtnToggleMapEdgesOverlay;
menu_val_4[1] = kBtnSetAngledEdges;
menu_val_4[2] = kBtnToggleMapEdgesOverlay;
}
static int loadMapperLbm(int lbmBufWidth, int lbmBufHeight)
@@ -782,7 +786,7 @@ static void initMenuBar(const int screenWidth)
_win_register_menu_pulldown(menu_bar, 8, "FILE", kBtnMenuHeaderFile, 8, menu_names[0], foregroundColor, backgroundColor);
_win_register_menu_pulldown(menu_bar, 40, "TOOLS", kBtnMenuHeaderTools, 21, menu_names[1], foregroundColor, backgroundColor);
_win_register_menu_pulldown(menu_bar, 80, "SCRIPTS", kBtnMenuHeaderScripts, 8, menu_names[2], foregroundColor, backgroundColor);
_win_register_menu_pulldown(menu_bar, 130, "SETTINGS", kBtnMenuHeaderSettings, 2, menu_names[4], foregroundColor, backgroundColor);
_win_register_menu_pulldown(menu_bar, 130, "SETTINGS", kBtnMenuHeaderSettings, 3, menu_names[4], foregroundColor, backgroundColor);
if (can_modify_protos) {
_win_register_menu_pulldown(menu_bar, 180, "LIBRARIAN", kBtnMenuHeaderLibrarian, 7, menu_names[3], foregroundColor, backgroundColor);
}
@@ -1576,6 +1580,13 @@ void edit_mapper()
}
mapEdgeSetupDialog();
break;
case kBtnSetAngledEdges:
if (map_entered) {
mapperShowTimedMsg("This map has been Entered. Can't edit edges.");
break;
}
mapEdgeSquareSetupDialog();
break;
case kBtnToggleMapEdgesOverlay:
mapEdgeSetupToggleOverlay();
break;
+1 -1
View File
@@ -1545,7 +1545,7 @@ void tileRenderFloorsInRect(Rect* rect, int elevation)
// Port of sfall HRP ViewMap::square_obj_render
void tileRenderEdgeBlackSquares(Rect* rect, int elevation, bool drawOnTop)
{
if (!mapEdgeHasSquareRect(elevation)) {
if (!mapEdgeIsEnabled() || !mapEdgeHasSquareRect(elevation)) {
return;
}