From b4e5d2a1047baff3f17d58d2ccb2ede10294bec9 Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Sun, 23 Sep 2018 11:35:20 +0500 Subject: [PATCH] Fixing sprites --- OpenGTA-win/OpenGTA-win.vcxproj | 2 +- game_objects.cpp | 12 +++++++++--- math/weighted_set.cpp | 9 ++++++--- math/weighted_set.h | 2 -- opengta.h | 0 viewer.cpp | 8 ++++---- 6 files changed, 20 insertions(+), 13 deletions(-) mode change 100644 => 100755 math/weighted_set.cpp mode change 100644 => 100755 math/weighted_set.h mode change 100644 => 100755 opengta.h diff --git a/OpenGTA-win/OpenGTA-win.vcxproj b/OpenGTA-win/OpenGTA-win.vcxproj index 205ba9f..5994736 100755 --- a/OpenGTA-win/OpenGTA-win.vcxproj +++ b/OpenGTA-win/OpenGTA-win.vcxproj @@ -93,7 +93,7 @@ true true ../../libs/boost-gil-extension;../../tes-engine;../../eigen;../../boost_1_67_0/;../../libs/jpeg-9;../../libs/jpeg-9/vc10;../../libs/lpng1510;..\;..\math;..\coldet\;..\util;..\..\SDL2-2.0.8\include;..\..\physfs-3.0.1\build\install\include;..\opensteer\include;..\replaceLoki - WIN32;_WINDOWS;TARGET_WIN32;_WIN32_WINNT=0x0501;WIN32_LEAN_AND_MEAN;EIGEN_DONT_ALIGN_STATICALLY;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions) + DO_SCALE2X;WIN32;_WINDOWS;TARGET_WIN32;_WIN32_WINNT=0x0501;WIN32_LEAN_AND_MEAN;EIGEN_DONT_ALIGN_STATICALLY;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions) false MultiThreadedDebugDLL diff --git a/game_objects.cpp b/game_objects.cpp index f8fa8ff..5399e77 100755 --- a/game_objects.cpp +++ b/game_objects.cpp @@ -166,7 +166,8 @@ namespace OpenGTA { speedForces(other.speedForces), inventory(other.inventory), activeWeapon(other.activeWeapon), - activeAmmo(&inventory.find(activeWeapon)->second), + //activeAmmo(&inventory.find(activeWeapon)->second), + activeAmmo(other.activeAmmo), aiData(other.aiData) { lastUpdateAt = other.lastUpdateAt; inGroundContact = other.inGroundContact; @@ -183,12 +184,17 @@ namespace OpenGTA { lastUpdateAt = ticks; return; } + + if (pedId < 0xffffffff) ai_step_fake(this); //AI::Pedestrian::walk_pavement(this); - if (aiMode) { + + + //Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com + /*if (aiMode) { AI::Pedestrian::moveto_shortrange(this); - } + }*/ uint8_t chooseWeapon = m_control.getActiveWeapon(); if (chooseWeapon != activeWeapon) { if (chooseWeapon == 0) { diff --git a/math/weighted_set.cpp b/math/weighted_set.cpp old mode 100644 new mode 100755 index 77962f9..b7d0e2b --- a/math/weighted_set.cpp +++ b/math/weighted_set.cpp @@ -1,9 +1,12 @@ #include "weighted_set.h" +#include +#include namespace Math { WeightedSet::WeightedSet(unsigned int seed) : - elements(), - rng(seed) { + elements() + { + std::srand(unsigned(std::time(0))); } void WeightedSet::add(unsigned int w, unsigned int e) { @@ -15,7 +18,7 @@ namespace Math { unsigned int WeightedSet::getRandom() { //unsigned int rnd = (int) (totalWeight * (rand() / (RAND_MAX + 1.0))); - unsigned int rnd = rng.nextUint(elements.size()); + unsigned int rnd = std::rand() % (elements.size()); return elements[rnd]; } } diff --git a/math/weighted_set.h b/math/weighted_set.h old mode 100644 new mode 100755 index 7d12cfb..59a7158 --- a/math/weighted_set.h +++ b/math/weighted_set.h @@ -2,7 +2,6 @@ #define WEIGHTED_SET_H #include -#include "yasli/random.h" namespace Math { @@ -13,7 +12,6 @@ namespace Math { unsigned int getRandom(); private: std::vector elements; - Random rng; }; } diff --git a/opengta.h b/opengta.h old mode 100644 new mode 100755 diff --git a/viewer.cpp b/viewer.cpp index 0e012f2..b688dc4 100755 --- a/viewer.cpp +++ b/viewer.cpp @@ -815,11 +815,11 @@ void handleKeyPress( SDL_Keysym *keysym ) { //Xperimental -- Vladislav Khorev vladislav.khorev@fishrungames.com - /* + case SDLK_F4: follow_toggle = (follow_toggle ? 0 : 1); if (follow_toggle) { - SDL_EnableKeyRepeat( 0, SDL_DEFAULT_REPEAT_INTERVAL ); + //SDL_EnableKeyRepeat( 0, SDL_DEFAULT_REPEAT_INTERVAL ); city->setViewMode(false); Vector3D p(cam.getEye()); create_ped_at(p); @@ -828,7 +828,7 @@ void handleKeyPress( SDL_Keysym *keysym ) { cam.setCamGravity(true); } else { - SDL_EnableKeyRepeat( 100, SDL_DEFAULT_REPEAT_INTERVAL ); + //SDL_EnableKeyRepeat( 100, SDL_DEFAULT_REPEAT_INTERVAL ); cam.setVectors(cam.getEye(), Vector3D(cam.getEye() + Vector3D(1, -1, 1)), Vector3D(0, 1, 0)); cam.setCamGravity(false); @@ -837,7 +837,7 @@ void handleKeyPress( SDL_Keysym *keysym ) { OpenGTA::SpriteManagerHolder::Instance().removeDeadStuff(); GUI::remove_ingame_gui(); } - break;*/ + break; case SDLK_RETURN: car_toggle(); break;