diff --git a/bin/resources/OgreCore/Ogre.fontdef b/bin/resources/OgreCore/Ogre.fontdef deleted file mode 100644 index 4110fe35b6..0000000000 --- a/bin/resources/OgreCore/Ogre.fontdef +++ /dev/null @@ -1,9 +0,0 @@ -BlueHighway -{ - type truetype - source bluehigh.ttf - size 32 - resolution 55 - code_points 33-127 -} - diff --git a/bin/resources/OgreCore/bluecond.ttf b/bin/resources/OgreCore/bluecond.ttf deleted file mode 100644 index 4c5b01f95e..0000000000 Binary files a/bin/resources/OgreCore/bluecond.ttf and /dev/null differ diff --git a/bin/resources/OgreCore/bluehigh.ttf b/bin/resources/OgreCore/bluehigh.ttf deleted file mode 100644 index 14d45c5a1e..0000000000 Binary files a/bin/resources/OgreCore/bluehigh.ttf and /dev/null differ diff --git a/bin/resources/OgreCore/micross.fontdef b/bin/resources/OgreCore/micross.fontdef deleted file mode 100644 index 3c186fff61..0000000000 --- a/bin/resources/OgreCore/micross.fontdef +++ /dev/null @@ -1,128 +0,0 @@ -micross.8.5 -{ - type truetype - source micross.ttf - size 8.5 - resolution 72 -} - - -micross.10 -{ - type truetype - source micross.ttf - size 10 - resolution 72 -} - -micross.12 -{ - type truetype - source micross.ttf - size 12 - resolution 72 -} - -micross.14 -{ - type truetype - source micross.ttf - size 14 - resolution 72 -} - -micross.16 -{ - type truetype - source micross.ttf - size 16 - resolution 72 -} - -micross.18 -{ - type truetype - source micross.ttf - size 18 - resolution 72 -} - -micross.20 -{ - type truetype - source micross.ttf - size 20 - resolution 72 -} - -micross.24 -{ - type truetype - source micross.ttf - size 24 - resolution 72 -} - -micross.28 -{ - type truetype - source micross.ttf - size 28 - resolution 72 -} - -micross.32 -{ - type truetype - source micross.ttf - size 32 - resolution 72 -} - -micross.36 -{ - type truetype - source micross.ttf - size 36 - resolution 72 -} - -micross.42 -{ - type truetype - source micross.ttf - size 42 - resolution 72 -} - -micross.50 -{ - type truetype - source micross.ttf - size 50 - resolution 72 -} - -micross.60 -{ - type truetype - source micross.ttf - size 60 - resolution 72 -} - -micross.75 -{ - type truetype - source micross.ttf - size 75 - resolution 72 -} - -BlueHighwayBig2 -{ - type truetype - source bluehigh.ttf - size 75 - resolution 55 -} diff --git a/bin/resources/OgreCore/micross.ttf b/bin/resources/OgreCore/micross.ttf deleted file mode 100644 index 057260f248..0000000000 Binary files a/bin/resources/OgreCore/micross.ttf and /dev/null differ diff --git a/bin/resources/skeleton.zip b/bin/resources/skeleton.zip index a7b49349d8..15e63906aa 100644 Binary files a/bin/resources/skeleton.zip and b/bin/resources/skeleton.zip differ diff --git a/bin/resources/skeleton/config/categories.cfg b/bin/resources/skeleton/config/categories.cfg index f9c9af0260..098d55784d 100644 --- a/bin/resources/skeleton/config/categories.cfg +++ b/bin/resources/skeleton/config/categories.cfg @@ -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 diff --git a/bin/resources/textures/icon_person.dds b/bin/resources/textures/icon_person.dds index c28cd08289..5890aa7ef6 100644 Binary files a/bin/resources/textures/icon_person.dds and b/bin/resources/textures/icon_person.dds differ diff --git a/bin/resources/textures/icon_person_activated.dds b/bin/resources/textures/icon_person_activated.dds new file mode 100644 index 0000000000..f5b81a5eb8 Binary files /dev/null and b/bin/resources/textures/icon_person_activated.dds differ diff --git a/bin/resources/textures/icon_person_deactivated.dds b/bin/resources/textures/icon_person_deactivated.dds new file mode 100644 index 0000000000..d39957332d Binary files /dev/null and b/bin/resources/textures/icon_person_deactivated.dds differ diff --git a/source/main/CMakeLists.txt b/source/main/CMakeLists.txt index 55e68d5061..7a094fd6a0 100644 --- a/source/main/CMakeLists.txt +++ b/source/main/CMakeLists.txt @@ -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}) diff --git a/source/main/audio/SoundScriptManager.cpp b/source/main/audio/SoundScriptManager.cpp index ac3d9d377c..ee7d503f30 100644 --- a/source/main/audio/SoundScriptManager.cpp +++ b/source/main/audio/SoundScriptManager.cpp @@ -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! diff --git a/source/main/gameplay/LandVehicleSimulation.cpp b/source/main/gameplay/LandVehicleSimulation.cpp index 70015e0688..c0a24412d6 100644 --- a/source/main/gameplay/LandVehicleSimulation.cpp +++ b/source/main/gameplay/LandVehicleSimulation.cpp @@ -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; diff --git a/source/main/gameplay/RoRFrameListener.cpp b/source/main/gameplay/RoRFrameListener.cpp index b6463e9cf1..a3c418a8aa 100644 --- a/source/main/gameplay/RoRFrameListener.cpp +++ b/source/main/gameplay/RoRFrameListener.cpp @@ -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 } diff --git a/source/main/gfx/Skidmark.cpp b/source/main/gfx/Skidmark.cpp index b39b4c757a..ee8549b8f8 100644 --- a/source/main/gfx/Skidmark.cpp +++ b/source/main/gfx/Skidmark.cpp @@ -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); @@ -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++) { @@ -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); diff --git a/source/main/gfx/Skidmark.h b/source/main/gfx/Skidmark.h index 7111c6ec1a..fe04844e18 100644 --- a/source/main/gfx/Skidmark.h +++ b/source/main/gfx/Skidmark.h @@ -75,7 +75,6 @@ class Skidmark : public ZeroedMemoryAllocator Ogre::Vector3 lastPointAv; int pos; Ogre::ColourValue colour; - Ogre::Vector3 face[2]; int facecounter; } skidmark_t; diff --git a/source/main/gui/Console.cpp b/source/main/gui/Console.cpp index c3aca6e741..b3ce136f23 100644 --- a/source/main/gui/Console.cpp +++ b/source/main/gui/Console.cpp @@ -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" @@ -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; } diff --git a/source/main/gui/GUIMenu.cpp b/source/main/gui/GUIMenu.cpp index 043a774962..1e22705a65 100644 --- a/source/main/gui/GUIMenu.cpp +++ b/source/main/gui/GUIMenu.cpp @@ -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(); diff --git a/source/main/gui/panels/GUI_GameMainMenu.cpp b/source/main/gui/panels/GUI_GameMainMenu.cpp index dcf06ba166..b83d70160b 100644 --- a/source/main/gui/panels/GUI_GameMainMenu.cpp +++ b/source/main/gui/panels/GUI_GameMainMenu.cpp @@ -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) diff --git a/source/main/main_sim/MainThread.cpp b/source/main/main_sim/MainThread.cpp index 01c2786fb0..f69c394c4f 100644 --- a/source/main/main_sim/MainThread.cpp +++ b/source/main/main_sim/MainThread.cpp @@ -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)) @@ -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 @@ -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); diff --git a/source/main/physics/Beam.cpp b/source/main/physics/Beam.cpp index 35e04391a3..7fa60dfc9c 100644 --- a/source/main/physics/Beam.cpp +++ b/source/main/physics/Beam.cpp @@ -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(); @@ -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()); @@ -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; diff --git a/source/main/utils/MumbleIntegration.cpp b/source/main/utils/MumbleIntegration.cpp index 450d0162c8..3a3436bf64 100644 --- a/source/main/utils/MumbleIntegration.cpp +++ b/source/main/utils/MumbleIntegration.cpp @@ -28,20 +28,6 @@ along with Rigs of Rods. If not, see . using namespace Ogre; -// small utility function to convert a char string to a widechar string -int convertCharSet(wchar_t *wcstring, const char *s) -{ -#ifdef _WIN32 - // Convert to a wchar_t* - size_t origsize = strlen(s) + 1; - size_t convertedChars = 0; - mbstowcs_s(&convertedChars, wcstring, origsize, s, _TRUNCATE); - return (int)convertedChars; -#else - // TODO -#endif // _WIN32 -} - MumbleIntegration::MumbleIntegration() : lm(NULL) { initMumble(); @@ -86,7 +72,7 @@ void MumbleIntegration::initMumble() #endif // _WIN32 } -void MumbleIntegration::update(Ogre::Vector3 cameraPos, Ogre::Vector3 avatarPos) +void MumbleIntegration::update(Ogre::Vector3 cameraPos, Ogre::Vector3 cameraDir, Ogre::Vector3 cameraUp, Ogre::Vector3 avatarPos, Ogre::Vector3 avatarDir, Ogre::Vector3 avatarUp) { if (! lm) return; @@ -98,48 +84,70 @@ void MumbleIntegration::update(Ogre::Vector3 cameraPos, Ogre::Vector3 avatarPos) } lm->uiTick++; - // Left handed coordinate system. - // X positive towards "left". + // Left handed coordinate system ( http://wiki.mumble.info/index.php?title=Link#Coordinate_system ) + // X positive towards "right". // Y positive towards "up". - // Z positive towards "into screen". + // Z positive towards "front". // // 1 unit = 1 meter - // Unit vector pointing out of the avatars eyes (here Front looks into scene). - lm->fAvatarFront[0] = 0.0f; - lm->fAvatarFront[1] = 0.0f; - lm->fAvatarFront[2] = 1.0f; + // OGRE uses right-handed coordinate system ( http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Basic+Tutorial+1&structure=Tutorials ) + // X positive towards "right". + // Y positive towards "up". + // Z positive towards "back". => conversion necessary! + // + // 1 unit = 1 meter (in RoR) - // Unit vector pointing out of the top of the avatars head (here Top looks straight up). - lm->fAvatarTop[0] = 0.0f; - lm->fAvatarTop[1] = 1.0f; - lm->fAvatarTop[2] = 0.0f; + // We need unit vectors + avatarDir.normalise(); + avatarUp.normalise(); + cameraDir.normalise(); + cameraUp.normalise(); - // Position of the avatar (here standing slightly off the origin) + // Position of the avatar lm->fAvatarPosition[0] = avatarPos.x; lm->fAvatarPosition[1] = avatarPos.y; - lm->fAvatarPosition[2] = avatarPos.z; + lm->fAvatarPosition[2] = -avatarPos.z; + + // Unit vector pointing out of the avatars eyes + lm->fAvatarFront[0] = avatarDir.x; + lm->fAvatarFront[1] = avatarDir.y; + lm->fAvatarFront[2] = -avatarDir.z; + + // Unit vector pointing out of the top of the avatars head + lm->fAvatarTop[0] = avatarUp.x; + lm->fAvatarTop[1] = avatarUp.y; + lm->fAvatarTop[2] = -avatarUp.z; // Same as avatar but for the camera. lm->fCameraPosition[0] = cameraPos.x; lm->fCameraPosition[1] = cameraPos.y; - lm->fCameraPosition[2] = cameraPos.z; + lm->fCameraPosition[2] = -cameraPos.z; - lm->fCameraFront[0] = 0.0f; - lm->fCameraFront[1] = 0.0f; - lm->fCameraFront[2] = 1.0f; + lm->fCameraFront[0] = cameraDir.x; + lm->fCameraFront[1] = cameraDir.y; + lm->fCameraFront[2] = -cameraDir.z; - lm->fCameraTop[0] = 0.0f; - lm->fCameraTop[1] = 1.0f; - lm->fCameraTop[2] = 0.0f; + lm->fCameraTop[0] = cameraUp.x; + lm->fCameraTop[1] = cameraUp.y; + lm->fCameraTop[2] = -cameraUp.z; // Identifier which uniquely identifies a certain player in a context (e.g. the ingame Name). - convertCharSet(lm->identity, SSETTING("Nickname", "Anonymous").c_str()); + std::string playername = SSETTING("Nickname", "Anonymous").c_str(); + std::wstring wplayername; + wplayername.assign(playername.begin(), playername.end()); + wcsncpy(lm->identity, wplayername.c_str(), 256); - // Context should be equal for players which should be able to hear each other positional and + // Context should be equal for players which should be able to hear each other _positional_ and // differ for those who shouldn't (e.g. it could contain the server+port and team) - // TODO: separate teams - int teamID = 0; + // This ensures that Mumble users in the same channel playing on different servers + // don't hear each other positional since the positional information would be wrong + + // TODO: Right now we only create contexts based on server identification but + // some servers allow players to play on different maps independently + // so we should take that into account as well + + int teamID = 0; // RoR currently doesn't have any kind of team-based gameplay sprintf((char *)lm->context, "%s:%s|%d", SSETTING("Server name", "-").c_str(), SSETTING("Server port", "1337").c_str(), teamID); lm->context_len = (int)strnlen((char *)lm->context, 256); } diff --git a/source/main/utils/MumbleIntegration.h b/source/main/utils/MumbleIntegration.h index 6ae8128e5f..8b92a58305 100644 --- a/source/main/utils/MumbleIntegration.h +++ b/source/main/utils/MumbleIntegration.h @@ -27,13 +27,19 @@ along with Rigs of Rods. If not, see . #include "RoRPrerequisites.h" #include "Singleton.h" -#include +#ifdef _WIN32 + #include +#else + #include + #include /* For O_* constants */ +#endif // _WIN32 + class MumbleIntegration : public RoRSingleton, public ZeroedMemoryAllocator { public: MumbleIntegration(); - void update(Ogre::Vector3 cameraPos, Ogre::Vector3 avatarPos); + void update(Ogre::Vector3 cameraPos, Ogre::Vector3 cameraDir, Ogre::Vector3 cameraUp, Ogre::Vector3 avatarPos, Ogre::Vector3 avatarDir, Ogre::Vector3 avatarUp); protected: ~MumbleIntegration();