From a4fa4c9e3d7087b3789ff16238089547e78b818f Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20Chilliet?= Date: Sat, 19 Aug 2017 01:37:56 +0200 Subject: [PATCH] Moved max run speed to PersonType --- Source/Objects/Person.cpp | 17 ++++------------- Source/Objects/PersonType.cpp | 2 ++ Source/Objects/PersonType.hpp | 1 + 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Source/Objects/Person.cpp b/Source/Objects/Person.cpp index 01b9f90..0ca911a 100644 --- a/Source/Objects/Person.cpp +++ b/Source/Objects/Person.cpp @@ -6009,19 +6009,10 @@ void Person::DoStuff() } else if (isRun()) { velocity += facing * multiplier * speed * 700 * scale; velspeed = findLength(&velocity); - if (creature == rabbittype) { - if (velspeed > speed * 55 * scale) { - velocity /= velspeed; - velspeed = speed * 55 * scale; - velocity *= velspeed; - } - } - if (creature == wolftype) { - if (velspeed > speed * 75 * scale) { - velocity /= velspeed; - velspeed = speed * 75 * scale; - velocity *= velspeed; - } + if (velspeed > speed * PersonType::types[creature].maxRunSpeed * scale) { + velocity /= velspeed; + velspeed = speed * PersonType::types[creature].maxRunSpeed * scale; + velocity *= velspeed; } velocity.y += gravity * multiplier * 20; ReflectVector(&velocity, terrain.getNormal(coords.x, coords.z)); diff --git a/Source/Objects/PersonType.cpp b/Source/Objects/PersonType.cpp index 521a02c..c1a3aec 100644 --- a/Source/Objects/PersonType.cpp +++ b/Source/Objects/PersonType.cpp @@ -80,6 +80,7 @@ void PersonType::Load() types[wolftype].defaultScale = .23; types[wolftype].hasClaws = true; types[wolftype].clothes = false; + types[wolftype].maxRunSpeed = 75; /* Rabbit */ types[rabbittype].proportions[0] = 1.2; @@ -135,4 +136,5 @@ void PersonType::Load() types[rabbittype].defaultScale = .2; types[rabbittype].hasClaws = false; types[rabbittype].clothes = true; + types[rabbittype].maxRunSpeed = 55; } diff --git a/Source/Objects/PersonType.hpp b/Source/Objects/PersonType.hpp index 512b8a8..b60fc19 100644 --- a/Source/Objects/PersonType.hpp +++ b/Source/Objects/PersonType.hpp @@ -62,6 +62,7 @@ public: float defaultScale; bool hasClaws; bool clothes; + unsigned int maxRunSpeed; GLubyte bloodText[512 * 512 * 3] = { 0 }; -- 2.39.5