Skip to content

Commit

Permalink
Merge pull request #463 from Hiradur/bugfixes
Browse files Browse the repository at this point in the history
Fixes by Hiradur
  • Loading branch information
Petr Ohlídal committed Dec 3, 2015
2 parents f03531f + 6ac3352 commit 9535c19
Show file tree
Hide file tree
Showing 23 changed files with 103 additions and 212 deletions.
9 changes: 0 additions & 9 deletions bin/resources/OgreCore/Ogre.fontdef

This file was deleted.

Binary file removed bin/resources/OgreCore/bluecond.ttf
Binary file not shown.
Binary file removed bin/resources/OgreCore/bluehigh.ttf
Binary file not shown.
128 changes: 0 additions & 128 deletions bin/resources/OgreCore/micross.fontdef

This file was deleted.

Binary file removed bin/resources/OgreCore/micross.ttf
Binary file not shown.
Binary file modified bin/resources/skeleton.zip
Binary file not shown.
5 changes: 4 additions & 1 deletion bin/resources/skeleton/config/categories.cfg
Expand Up @@ -30,10 +30,13 @@
117, Trailers
118, Other Loads


;;; terrains
129, Addon Terrains

859, Container

875, Submarine

;note: these categories are NOT in the repository:
5000, Official Terrains
5001, Night Terrains
Expand Down
Binary file modified bin/resources/textures/icon_person.dds
Binary file not shown.
Binary file added bin/resources/textures/icon_person_activated.dds
Binary file not shown.
Binary file not shown.
8 changes: 4 additions & 4 deletions source/main/CMakeLists.txt
Expand Up @@ -14,14 +14,14 @@ macro(add_ror_project BINNAME folder useWxWidgets)
# warning C4244: 'initializing' : conversion from 'const float' to 'int', possible loss of data
# warning C4305: 'initializing' : truncation from 'double' to 'const float'
add_definitions("/wd4305 /wd4244 /wd4193 -DNOMINMAX")

# enable mumble on the windows platform for now only, has no dependencies as its only using shared memory and URLs
add_definitions("-DUSE_MUMBLE")
ELSEIF(UNIX)
include_directories(${GTK_INCLUDE_DIRS})
set(OS_LIBS "X11 -l${CMAKE_DL_LIBS}")
set(OS_LIBS "X11 -l${CMAKE_DL_LIBS} -lrt")
ENDIF(WIN32)

# build with support for Mumble positional audio, has no dependencies but requires linking against librt on UNIX
add_definitions("-DUSE_MUMBLE")

include_directories(${Ogre_INCLUDE_DIRS})
link_directories (${Ogre_LIBRARY_DIRS})
include_directories(${Boost_INCLUDE_DIRS})
Expand Down
4 changes: 2 additions & 2 deletions source/main/audio/SoundScriptManager.cpp
Expand Up @@ -369,8 +369,8 @@ SoundScriptInstance* SoundScriptManager::createInstance(Ogre::String templatenam
}

if ( free_trigs[templ->trigger_source] >= MAX_INSTANCES_PER_GROUP
|| free_gains[templ->trigger_source] >= MAX_INSTANCES_PER_GROUP && templ->gain_source != SS_MOD_NONE
|| free_pitches[templ->trigger_source] >= MAX_INSTANCES_PER_GROUP && templ->pitch_source != SS_MOD_NONE )
|| (free_gains[templ->trigger_source] >= MAX_INSTANCES_PER_GROUP && templ->gain_source != SS_MOD_NONE)
|| (free_pitches[templ->trigger_source] >= MAX_INSTANCES_PER_GROUP && templ->pitch_source != SS_MOD_NONE))
{
LOG("SoundScriptManager: Reached MAX_INSTANCES_PER_GROUP limit (" + TOSTRING(MAX_INSTANCES_PER_GROUP) + ")");
return NULL; // reached limit!
Expand Down
5 changes: 1 addition & 4 deletions source/main/gameplay/LandVehicleSimulation.cpp
Expand Up @@ -325,18 +325,15 @@ void LandVehicleSimulation::UpdateVehicle(Beam* curr_truck, float seconds_since_
{
if (RoR::Application::GetInputEngine()->getEventBoolValueBounce(EV_TRUCK_SHIFT_UP))
{
if (shiftmode != BeamEngine::AUTOMATIC || curr_truck->engine->getAutoShift() == BeamEngine::DRIVE)
{
curr_truck->engine->shift(1);
gear_changed_rel = true;
}
}
else if (RoR::Application::GetInputEngine()->getEventBoolValueBounce(EV_TRUCK_SHIFT_DOWN))
{
if (shiftmode > BeamEngine::SEMIAUTO ||
shiftmode == BeamEngine::SEMIAUTO && !arcadeControls ||
shiftmode == BeamEngine::SEMIAUTO && curr_truck->engine->getGear() > 0 ||
shiftmode == BeamEngine::AUTOMATIC && curr_truck->engine->getGear() > 1)
shiftmode == BeamEngine::AUTOMATIC)
{
curr_truck->engine->shift(-1);
gear_changed_rel = true;
Expand Down
6 changes: 5 additions & 1 deletion source/main/gameplay/RoRFrameListener.cpp
Expand Up @@ -1288,7 +1288,11 @@ bool RoRFrameListener::frameStarted(const FrameEvent& evt)
#ifdef USE_MUMBLE
if (gEnv->player)
{
MumbleIntegration::getSingleton().update(gEnv->mainCamera->getPosition(), gEnv->player->getPosition() + Vector3(0, 1.8f, 0));
// calculate orientation of avatar first
Ogre::Vector3 avatarDir = Ogre::Vector3(Math::Cos(gEnv->player->getRotation()), 0.0f, Math::Sin(gEnv->player->getRotation()));

MumbleIntegration::getSingleton().update(gEnv->mainCamera->getPosition(), gEnv->mainCamera->getDirection(), gEnv->mainCamera->getUp(),
gEnv->player->getPosition() + Vector3(0, 1.8f, 0), avatarDir, Ogre::Vector3(0.0f, 1.0f, 0.0f));
}
#endif // USE_MUMBLE
}
Expand Down
6 changes: 2 additions & 4 deletions source/main/gfx/Skidmark.cpp
Expand Up @@ -165,8 +165,6 @@ void Skidmark::addObject(Vector3 start, String texture)
skid.lastPointAv=start;
skid.facecounter=0;

for (int i = 0; i<3; i++) skid.face[i] = Vector3::ZERO;

skid.colour = ColourValue(Math::RangeRandom(0, 100)/100.0f, Math::RangeRandom(0, 100)/100.0f, Math::RangeRandom(0, 100)/100.0f, 0.8f);


Expand All @@ -188,7 +186,7 @@ void Skidmark::addObject(Vector3 start, String texture)
skid.groundTexture.resize(lenght);
skid.obj = gEnv->sceneManager->createManualObject("skidmark" + TOSTRING(instanceCounter++));
skid.obj->setDynamic(true);
skid.obj->setRenderingDistance(2000); //2km sight range
skid.obj->setRenderingDistance(800); // 800m view distance
skid.obj->begin(bname, RenderOperation::OT_TRIANGLE_STRIP);
for (int i = 0; i < lenght; i++)
{
Expand All @@ -198,7 +196,7 @@ void Skidmark::addObject(Vector3 start, String texture)
skid.obj->position(start);
skid.obj->textureCoord(0,0);
}
skid.obj->end();
skid.obj->end();
mNode->attachObject(skid.obj);


Expand Down
1 change: 0 additions & 1 deletion source/main/gfx/Skidmark.h
Expand Up @@ -75,7 +75,6 @@ class Skidmark : public ZeroedMemoryAllocator
Ogre::Vector3 lastPointAv;
int pos;
Ogre::ColourValue colour;
Ogre::Vector3 face[2];
int facecounter;
} skidmark_t;

Expand Down
4 changes: 3 additions & 1 deletion source/main/gui/Console.cpp
Expand Up @@ -33,6 +33,7 @@
#include "IHeightFinder.h"
#include "HighScoreWindow.h"
#include "Language.h"
#include "MainThread.h"
#include "Network.h"
#include "OverlayWrapper.h"
#include "RoRFrameListener.h"
Expand Down Expand Up @@ -385,7 +386,8 @@ void Console::eventCommandAccept(MyGUI::Edit* _sender)
}
else if (args[0] == "/quit")
{
gEnv->frameListener->shutdown_final();
Application::GetMainThreadLogic()->RequestExitCurrentLoop();
Application::GetMainThreadLogic()->RequestShutdown();
return;

}
Expand Down
3 changes: 2 additions & 1 deletion source/main/gui/GUIMenu.cpp
Expand Up @@ -393,7 +393,8 @@ void GUI_MainMenu::onMenuBtn(MyGUI::MenuCtrlPtr _sender, MyGUI::MenuItemPtr _ite
GUI_Friction::getSingleton().setVisible(true);
} else if (miname == _L("Exit"))
{
gEnv->frameListener->shutdown_final();
Application::GetMainThreadLogic()->RequestExitCurrentLoop();
Application::GetMainThreadLogic()->RequestShutdown();
} else if (miname == _L("Show Console"))
{
Console *c = RoR::Application::GetConsole();
Expand Down
3 changes: 2 additions & 1 deletion source/main/gui/panels/GUI_GameMainMenu.cpp
Expand Up @@ -112,7 +112,8 @@ void CLASS::eventMouseButtonClickAboutButton(MyGUI::WidgetPtr _sender)
void CLASS::eventMouseButtonClickExitButton(MyGUI::WidgetPtr _sender)
{
Hide();
gEnv->frameListener->shutdown_final();
Application::GetMainThreadLogic()->RequestExitCurrentLoop();
Application::GetMainThreadLogic()->RequestShutdown();
}

void CLASS::eventMouseButtonClickMultiPlayerButton(MyGUI::WidgetPtr _sender)
Expand Down
16 changes: 8 additions & 8 deletions source/main/main_sim/MainThread.cpp
Expand Up @@ -481,6 +481,12 @@ void MainThread::Go()
}
/* Restore wallpaper */
menu_wallpaper_widget->setVisible(true);

/* Set Mumble to non-positional audio */
#ifdef USE_MUMBLE
MumbleIntegration::getSingleton().update(Vector3::ZERO, Ogre::Vector3(0.0f, 0.0f, 1.0f), Ogre::Vector3(0.0f, 1.0f, 0.0f),
Vector3::ZERO, Ogre::Vector3(0.0f, 0.0f, 1.0f), Ogre::Vector3(0.0f, 1.0f, 0.0f));
#endif // USE_MUMBLE
}

if (BSETTING("MainMenuMusic", true))
Expand Down Expand Up @@ -737,6 +743,8 @@ bool MainThread::SetupGameplayLoop(bool enable_network, Ogre::String preselected
Application::CreateOverlayWrapper();
Application::GetOverlayWrapper()->SetupDirectionArrow();

gEnv->sceneManager->setAmbientLight(Ogre::ColourValue(0.3f, 0.3f, 0.3f));

if (!m_base_resource_loaded)
{
new DustManager(); // setup particle manager singleton. TODO: Move under Application
Expand Down Expand Up @@ -1113,14 +1121,6 @@ void MainThread::MainMenuLoopUpdate(float seconds_since_last_frame)
GUI_Multiplayer::getSingleton().update();
}
#endif // USE_SOCKETW

// now update mumble 3d audio things
#ifdef USE_MUMBLE
if (gEnv->player)
{
MumbleIntegration::getSingleton().update(gEnv->mainCamera->getPosition(), gEnv->player->getPosition() + Vector3(0, 1.8f, 0));
}
#endif // USE_MUMBLE
}

MainMenuLoopUpdateEvents(seconds_since_last_frame);
Expand Down
21 changes: 15 additions & 6 deletions source/main/physics/Beam.cpp
Expand Up @@ -3056,7 +3056,7 @@ void Beam::updateSkidmarks()
// create skidmark object for wheels with data if not existing
if (!skidtrails[i])
{
skidtrails[i] = new Skidmark(&wheels[i], beamsRoot, 300, 200);
skidtrails[i] = new Skidmark(&wheels[i], beamsRoot, 300, 20);
}

skidtrails[i]->updatePoint();
Expand Down Expand Up @@ -5839,11 +5839,18 @@ void Beam::updateDashBoards(float &dt)

Vector3 Beam::getGForces()
{
if (cameranodecount > 0 && cameranodepos[0] >= 0 && cameranodepos[0] < MAX_NODES && cameranodedir[0] >= 0 && cameranodedir[0] < MAX_NODES && cameranoderoll[0] >= 0 && cameranoderoll[0] < MAX_NODES)
if (cameranodepos[0] >= 0 && cameranodepos[0] < MAX_NODES && cameranodedir[0] >= 0 && cameranodedir[0] < MAX_NODES && cameranoderoll[0] >= 0 && cameranoderoll[0] < MAX_NODES)
{
Vector3 acc = cameranodeacc / cameranodecount;
cameranodeacc = Vector3::ZERO;
cameranodecount = 0;
static Vector3 result = Vector3::ZERO;

if (cameranodecount == 0) // multiple calls in one single frame, avoid division by 0
{
return result;
}

Vector3 acc = cameranodeacc / cameranodecount;
cameranodeacc = Vector3::ZERO;
cameranodecount = 0;

float longacc = acc.dotProduct((nodes[cameranodepos[0]].RelPosition - nodes[cameranodedir[0]].RelPosition).normalisedCopy());
float latacc = acc.dotProduct((nodes[cameranodepos[0]].RelPosition - nodes[cameranoderoll[0]].RelPosition).normalisedCopy());
Expand All @@ -5863,7 +5870,9 @@ Vector3 Beam::getGForces()

float vertacc = std::abs(gravity) - acc.dotProduct(-upv);

return Vector3(vertacc / std::abs(gravity), longacc / std::abs(gravity), latacc / std::abs(gravity));
result = Vector3(vertacc / std::abs(gravity), longacc / std::abs(gravity), latacc / std::abs(gravity));

return result;
}

return Vector3::ZERO;
Expand Down

0 comments on commit 9535c19

Please sign in to comment.