0x00447A5F
| 1155 | |
| 1156 | // 0x00447A5F |
| 1157 | static bool isSpriteInteractedWithPaletteSet(const Gfx::RenderTarget* rt, ImageId imageId, const Ui::Point& coords, const Gfx::PaletteMap::View paletteMap) |
| 1158 | { |
| 1159 | const auto* g1 = Gfx::getG1Element(imageId.getIndex()); |
| 1160 | if (g1 == nullptr) |
| 1161 | { |
| 1162 | return false; |
| 1163 | } |
| 1164 | |
| 1165 | auto zoomLevel = rt->zoomLevel; |
| 1166 | Ui::Point interactionPoint{ rt->x, rt->y }; |
| 1167 | Ui::Point origin = coords; |
| 1168 | |
| 1169 | if (zoomLevel > 0) |
| 1170 | { |
| 1171 | if (g1->hasFlags(Gfx::G1ElementFlags::noZoomDraw)) |
| 1172 | { |
| 1173 | return false; |
| 1174 | } |
| 1175 | |
| 1176 | while (g1->hasFlags(Gfx::G1ElementFlags::hasZoomSprites) && zoomLevel > 0) |
| 1177 | { |
| 1178 | imageId = ImageId(imageId.getIndex() - g1->zoomOffset); |
| 1179 | g1 = Gfx::getG1Element(imageId.getIndex()); |
| 1180 | if (g1 == nullptr || g1->hasFlags(Gfx::G1ElementFlags::noZoomDraw)) |
| 1181 | { |
| 1182 | return false; |
| 1183 | } |
| 1184 | zoomLevel = zoomLevel - 1; |
| 1185 | interactionPoint.x >>= 1; |
| 1186 | interactionPoint.y >>= 1; |
| 1187 | origin.x >>= 1; |
| 1188 | origin.y >>= 1; |
| 1189 | } |
| 1190 | } |
| 1191 | |
| 1192 | origin.x += g1->xOffset; |
| 1193 | origin.y += g1->yOffset; |
| 1194 | interactionPoint -= origin; |
| 1195 | |
| 1196 | if (interactionPoint.x < 0 || interactionPoint.y < 0 || interactionPoint.x >= g1->width || interactionPoint.y >= g1->height) |
| 1197 | { |
| 1198 | return false; |
| 1199 | } |
| 1200 | |
| 1201 | if (g1->hasFlags(Gfx::G1ElementFlags::isRLECompressed)) |
| 1202 | { |
| 1203 | return isPixelPresentRLE(*g1, interactionPoint); |
| 1204 | } |
| 1205 | |
| 1206 | if (!g1->hasFlags(Gfx::G1ElementFlags::unk1)) |
| 1207 | { |
| 1208 | return isPixelPresentBMP(imageId, *g1, interactionPoint, paletteMap); |
| 1209 | } |
| 1210 | |
| 1211 | return false; |
| 1212 | } |
| 1213 | |
| 1214 | // 0x00447A0E |
no test coverage detected