Fixing sprites

This commit is contained in:
Vladislav Khorev 2018-09-23 11:35:20 +05:00
parent ef0392fb63
commit b4e5d2a104
6 changed files with 20 additions and 13 deletions

View File

@ -93,7 +93,7 @@
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../../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</AdditionalIncludeDirectories>
<PreprocessorDefinitions>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)</PreprocessorDefinitions>
<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)</PreprocessorDefinitions>
<CompileAsWinRT>false</CompileAsWinRT>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>

View File

@ -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) {

9
math/weighted_set.cpp Normal file → Executable file
View File

@ -1,9 +1,12 @@
#include "weighted_set.h"
#include <cassert>
#include <ctime>
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];
}
}

2
math/weighted_set.h Normal file → Executable file
View File

@ -2,7 +2,6 @@
#define WEIGHTED_SET_H
#include <vector>
#include "yasli/random.h"
namespace Math {
@ -13,7 +12,6 @@ namespace Math {
unsigned int getRandom();
private:
std::vector<unsigned int> elements;
Random rng;
};
}

0
opengta.h Normal file → Executable file
View File

View File

@ -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;