| 1283 | } |
| 1284 | |
| 1285 | List<Drawable> Humanoid::renderDummy(Gender gender, HeadArmor const* head, ChestArmor const* chest, LegsArmor const* legs, BackArmor const* back) { |
| 1286 | std::shared_ptr<Fashion> fashion = std::move(m_fashion); |
| 1287 | auto state = m_state; |
| 1288 | m_state = State::Idle; |
| 1289 | float headRotation = m_headRotation; |
| 1290 | m_headRotation = 0.f; |
| 1291 | auto restore = [&]() { |
| 1292 | m_fashion = std::move(fashion); |
| 1293 | m_state = state; |
| 1294 | m_headRotation = headRotation; |
| 1295 | }; |
| 1296 | List<Drawable> drawables; |
| 1297 | |
| 1298 | try { |
| 1299 | m_fashion = std::make_shared<Fashion>(); |
| 1300 | if (head) |
| 1301 | setWearableFromHead(3, *head, gender); |
| 1302 | if (chest) |
| 1303 | setWearableFromChest(2, *chest, gender); |
| 1304 | if (legs) |
| 1305 | setWearableFromLegs(1, *legs, gender); |
| 1306 | if (back) |
| 1307 | setWearableFromBack(0, *back, gender); |
| 1308 | |
| 1309 | drawables = render(false, false); |
| 1310 | Drawable::scaleAll(drawables, TilePixels); |
| 1311 | } |
| 1312 | catch (std::exception const&) { |
| 1313 | restore(); |
| 1314 | throw; |
| 1315 | } |
| 1316 | restore(); |
| 1317 | return drawables; |
| 1318 | } |
| 1319 | |
| 1320 | Vec2F Humanoid::primaryHandPosition(Vec2F const& offset) const { |
| 1321 | return primaryArmPosition(m_facingDirection, m_primaryHand.angle, primaryHandOffset(m_facingDirection) + offset); |