From c2476f79124d0a7471ff5a91ae069a585c9df822 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 23 Nov 2026 20:41:48 +0100 Subject: [PATCH 1/2] header: FloaterVariationFlags, the flag bits of a floater's variation A new enum, Map::Floaters::FloaterVariationFlags, for the low half of Floater::variation. createFloatingLayerElement (0x004E63A0) stores the variation whole, one dword, at 0x004E64BC, and renderMap (0x004E8CF0), and renderUnits for batched tiles, read the bits back: - FVF_FIRST_PASS (0x02) and FVF_SECOND_PASS (0x01): the floater is drawn in the first or the second of the two passes renderMap makes over each row of visible tiles (row loop 0x004E9060 to 0x004EC46D; the tile loops 0x004E90E0 to 0x004EBAA8 and 0x004EBB00 to 0x004EC272; their floater loops test the bit at 0x004E9ED0 and 0x004EC090). - FVF_SET_RENDERED_OWNER (0x04): the rendered owner becomes the current player's slot and the rendered sprite the floater's GM (0x004E9F30, 0x004EC13D). - FVF_RENDERED_OWNER_0 (0x10): the rendered owner is 0 instead; it is read only together with 0x04. - FVF_USE_TOTAL_HEIGHT (0x08): second pass only (0x004EC09B); while TileMapState's setting at 0x01FE7ACC is on and the view is not flat, the floater is raised by getTotalHeightAt(tile, 0) (0x004FFBA0: the tile's height plus that of the building, wall or tree on it) instead of by the offset every other floater gets. - FVF_MASK_IMAGE (0x20): the mask image passed to renderGMWithAlphaMask is the floater's image ID plus the high half, from the same GM (0x004E9F5F, 0x004EC169). Without it, a non-zero high half is the blend strength for renderGMWithBlending, and 0 draws the floater plainly. On a tile with MD_BATCHED_SPRITES (0x004E9EDF, 0x004EC0ED), renderMap hands the floater to scheduleUnitForBatchedRendering with the whole variation instead, and renderUnits (0x004E7810) reads 0x04, 0x10, 0x20 and the high half the same way (0x004E7FC1, 0x004E7FDC). The parameter and the field stay int, since the original passes and stores the value as one dword. The high half stays a number, written value << 16. Co-Authored-By: Claude Opus 5.5 --- .../Map/Floaters/FloaterVariationFlags.hpp | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/OpenSHC/Map/Floaters/FloaterVariationFlags.hpp diff --git a/src/OpenSHC/Map/Floaters/FloaterVariationFlags.hpp b/src/OpenSHC/Map/Floaters/FloaterVariationFlags.hpp new file mode 100644 index 0000000000..4b608071b7 --- /dev/null +++ b/src/OpenSHC/Map/Floaters/FloaterVariationFlags.hpp @@ -0,0 +1,28 @@ +/** + THIS FILE IS AUTO GENERATED + Communicate changes to the dev team (e.g. via a Pull Request). + Changes get lost otherwise. + + path: 'OpenSHC/Map/Floaters/FloaterVariationFlags.hpp' +*/ + +#pragma once + +namespace OpenSHC { +namespace Map { + namespace Floaters { + typedef enum FloaterVariationFlags { + + FVF_SECOND_PASS = 1, // 0x00000001 + FVF_FIRST_PASS = 2, // 0x00000002 + FVF_SET_RENDERED_OWNER = 4, // 0x00000004 + FVF_USE_TOTAL_HEIGHT = 8, // 0x00000008 + FVF_RENDERED_OWNER_0 = 16, // 0x00000010 + FVF_MASK_IMAGE = 32 // 0x00000020 + + } FloaterVariationFlags; + + static_assert_cpp98_obj(sizeof(FloaterVariationFlags) == 4, FloaterVariationFlags); + } // namespace Floaters +} // namespace Map +} // namespace OpenSHC From 2a2179a521f1d933a086e66564602dc9cfe0eee5 Mon Sep 17 00:00:00 2001 From: kotijekriv Date: Mon, 23 Nov 2026 20:41:48 +0100 Subject: [PATCH 2/2] calculateHoveredTile names its floaters' variation flags The six createFloatingLayerElement calls pass 5, 13 and 29. They are written with FloaterVariationFlags now: FVF_SECOND_PASS | FVF_SET_RENDERED_OWNER (5), with FVF_USE_TOTAL_HEIGHT (13), and with FVF_RENDERED_OWNER_0 as well (29). No other change. Measured: quick_diff gives the same listing as main's text, and a narrow real build on main 48f7e946cc (main's /GL list and this file, with the struct resolvers and the files' function resolvers on, sourcehold's reccmp with --resolve-wrapped-calls --ignore-security-cookie) reads 100.0% raw and normalised with no differing line, and every other function reads as in the same build without it. Co-authored-by: Gynt Co-Authored-By: Claude Opus 5 Co-Authored-By: Claude Opus 5.5 --- .../UI/HoveredState/calculateHoveredTile.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/OpenSHC/UI/HoveredState/calculateHoveredTile.cpp b/src/OpenSHC/UI/HoveredState/calculateHoveredTile.cpp index d2f2251753..ceac6f6d69 100644 --- a/src/OpenSHC/UI/HoveredState/calculateHoveredTile.cpp +++ b/src/OpenSHC/UI/HoveredState/calculateHoveredTile.cpp @@ -5,6 +5,7 @@ #include "OpenSHC/Commands/MappersEnum.hpp" #include "OpenSHC/Game/GameMode.hpp" #include "OpenSHC/IO/Graphics/GmID.hpp" +#include "OpenSHC/Map/Floaters/FloaterVariationFlags.hpp" #include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" #include "OpenSHC/Globals/DAT_TileMapState.hpp" @@ -34,21 +35,22 @@ namespace UI { DAT_ViewportRenderState::ptr)(IO::Graphics::GID_BODY_MANGONEL, 1, 0, 0, DAT_ViewportRenderState::instance.translationMatrix[this->elements[i].y].addXgetTile + this->elements[i].x, - 5); + Map::Floaters::FVF_SECOND_PASS | Map::Floaters::FVF_SET_RENDERED_OWNER); break; case Commands::M_MAPPER_BALLISTA: MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::createFloatingLayerElement, DAT_ViewportRenderState::ptr)(IO::Graphics::GID_BODY_BALLISTA, 1, 0, 0, DAT_ViewportRenderState::instance.translationMatrix[this->elements[i].y].addXgetTile + this->elements[i].x, - 5); + Map::Floaters::FVF_SECOND_PASS | Map::Floaters::FVF_SET_RENDERED_OWNER); break; case Commands::M_MAPPER_BRAZIER: MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::createFloatingLayerElement, DAT_ViewportRenderState::ptr)(IO::Graphics::GID_BODY_BRAZIER, 1, 15, 7, DAT_ViewportRenderState::instance.translationMatrix[this->elements[i].y].addXgetTile + this->elements[i].x, - 29); + Map::Floaters::FVF_SECOND_PASS | Map::Floaters::FVF_SET_RENDERED_OWNER + | Map::Floaters::FVF_USE_TOTAL_HEIGHT | Map::Floaters::FVF_RENDERED_OWNER_0); break; case Commands::M_MAPPER_FLAG_TYPE0: case Commands::M_MAPPER_FLAG_TYPE1: @@ -79,7 +81,9 @@ namespace UI { break; } MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::createFloatingLayerElement, - DAT_ViewportRenderState::ptr)(IO::Graphics::GID_ANIM_FLAGS, imageID, flagX, flagY, tile, 13); + DAT_ViewportRenderState::ptr)(IO::Graphics::GID_ANIM_FLAGS, imageID, flagX, flagY, tile, + Map::Floaters::FVF_SECOND_PASS | Map::Floaters::FVF_SET_RENDERED_OWNER + | Map::Floaters::FVF_USE_TOTAL_HEIGHT); break; } case Commands::M_MAPPER_HEADS: @@ -88,7 +92,8 @@ namespace UI { DAT_ViewportRenderState::ptr)(IO::Graphics::GID_ANIM_HEADS, imageID, 15, 7, DAT_ViewportRenderState::instance.translationMatrix[this->elements[i].y].addXgetTile + this->elements[i].x, - 29); + Map::Floaters::FVF_SECOND_PASS | Map::Floaters::FVF_SET_RENDERED_OWNER + | Map::Floaters::FVF_USE_TOTAL_HEIGHT | Map::Floaters::FVF_RENDERED_OWNER_0); break; case Commands::M_MAPPER_CATAPULT: case Commands::M_MAPPER_TREBUCHET: @@ -129,7 +134,8 @@ namespace UI { } MACRO_CALL_MEMBER(OpenSHC::Rendering::ViewportRenderState_Func::createFloatingLayerElement, DAT_ViewportRenderState::ptr)(IO::Graphics::GID_BODY_TENT, 1, imageX, imageY, - DAT_ViewportRenderState::instance.translationMatrix[y].addXgetTile + x, 5); + DAT_ViewportRenderState::instance.translationMatrix[y].addXgetTile + x, + Map::Floaters::FVF_SECOND_PASS | Map::Floaters::FVF_SET_RENDERED_OWNER); break; } default: