24 std::map<uint32_t, const Figure*> players;
25 for (
const Figure& figure : figures) {
26 if (!figure.monster && !figure.npc) {
27 players[figure.id] = &figure;
30 for (
Figure& figure : figures) {
31 if (!figure.monster) {
34 const auto found = blows_.find(figure.id);
35 if (found != blows_.end()) {
36 Blow& blow = found->second;
37 const auto player = players.find(blow.player);
38 if (player != players.end()) {
39 const Vector3 from = player->second->position;
41 std::atan2(figure.position.x - from.x, figure.position.z - from.z);
45 const float t = blow.age;
48 figure.flash = std::max(1.0f - t /
kFlashTime, 0.0f);
49 figure.lean = blow.aimed ?
kRock * rock : 0.0f;
50 figure.lean_yaw = blow.away;
54 if (figure.lift > 0.0f) {
55 figure.lean +=
kTumble * figure.lift;
56 if (found != blows_.end()) {
57 figure.lean_yaw = found->second.away;