Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
GUI_TopMenubar.h
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2005-2012 Pierre-Michel Ricordel
4 Copyright 2007-2012 Thomas Fischer
5 Copyright 2016-2020 Petr Ohlidal
6
7 For more information, see http://www.rigsofrods.org/
8
9 Rigs of Rods is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License version 3, as
11 published by the Free Software Foundation.
12
13 Rigs of Rods is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20*/
21
25
26#pragma once
27
28#include "AddonPartFileFormat.h"
29#include "CacheSystem.h"
30#include "RoRnet.h"
31
32#include <imgui.h>
33#include <imgui_internal.h>
34#include <vector>
35#include <rapidjson/document.h>
36
38{
39 Ogre::Vector3 position;
40 int speed = -1;
41};
42
43namespace RoR {
44namespace GUI {
45
47{
48public:
49 const float MENU_Y_OFFSET = 40.f;
50 const float PANEL_HOVERBOX_HEIGHT = 50.f;
51 const ImVec4 GRAY_HINT_TEXT = ImVec4(0.62f, 0.62f, 0.61f, 1.f);
52 const ImVec4 WHITE_TEXT = ImVec4(0.9f, 0.9f, 0.9f, 1.f);
53 const ImVec4 GREEN_TEXT = ImVec4(0.0f, 0.9f, 0.0f, 1.f);
54 const ImVec4 ORANGE_TEXT = ImVec4(0.9f, 0.6f, 0.0f, 1.f);
55 const ImVec4 RED_TEXT = ImVec4(1.00f, 0.00f, 0.00f, 1.f);
56 const ImVec2 MENU_HOVERBOX_PADDING = ImVec2(25.f, 10.f);
58
61
62 TopMenubar();
64
65 void Draw(float dt);
66 bool ShouldDisplay(ImVec2 window_pos);
67
69
70 // Vehicle AI
71 std::vector<ai_events> ai_waypoints;
72 int ai_num = 1;
73 int ai_speed = 50;
74 int ai_times = 1;
75 int ai_altitude = 1000;
76 int ai_distance = 20;
78 Ogre::String ai_fname = "95bbUID-agoras.truck";
79 Ogre::String ai_dname = "Bus RVI Agora S";
80 Ogre::String ai_sectionconfig = "";
81 std::string ai_skin = "";
82 bool ai_select = false;
83 bool ai_rec = false;
84 int ai_mode = 0;
85 bool ai_menu = false;
86
87 // Secondary selections for Drag Race and Crash driving modes
88 bool ai_select2 = false;
89 Ogre::String ai_fname2 = "95bbUID-agoras.truck";
90 Ogre::String ai_dname2 = "Bus RVI Agora S";
91 Ogre::String ai_sectionconfig2 = "";
92 std::string ai_skin2 = "";
93
94 int ai_num_prev = 1;
95 int ai_speed_prev = 50;
98 int ai_mode_prev = 0;
99
100 // AI waypoint presets
102 void LoadBundledAiPresets(TerrainPtr terrain);
103 void RefreshAiPresets();
104 rapidjson::Document ai_presets_all;
105 rapidjson::Document ai_presets_extern;
108 rapidjson::Document ai_presets_bundled;
109
110 // Tuning menu
112 std::vector<CacheEntryPtr> tuning_addonparts;
119 const ImVec4 TUNING_HOLDTOCONFIRM_COLOR = ImVec4(0.25f, 0.15f, 0.2f, 0.5f);
123 void RefreshTuningMenu();
124
125private:
126 bool IsMenuEnabled(TopMenu which);
127
129 void DrawMpUserToActorList(RoRnet::UserInfo &user); // Multiplayer
130 void DrawSpecialStateBox(float top_offset);
131
132 // Tuning menu helpers
133 void DrawTuningBoxedSubjectIdInline(int subject_id);
134 void DrawTuningProtectedChkRightAligned(const int subject_id, bool is_protected, ModifyProjectRequestType request_type_set, ModifyProjectRequestType request_type_reset, const std::string& subject = "");
135 void DrawTuningForceRemoveControls(const int subject_id, const std::string& name, const bool is_unwanted, const bool is_force_removed, ModifyProjectRequestType request_type_set, ModifyProjectRequestType request_type_reset);
136
140
144
146
147 float m_daytime = 0.f;
149 bool m_quickload = false;
151 std::string m_quicksave_name;
152 std::vector<std::string> m_savegame_names;
153};
154
155} // namespace GUI
156} // namespace RoR
A database of user-installed content alias 'mods' (vehicles, terrains...)
Ogre::String ai_sectionconfig
const ImVec4 WHITE_TEXT
std::vector< std::string > m_savegame_names
CacheQuery tuning_saves
Tuneups saved by user, with category ID RoR::CID_AddonpartUser
std::vector< bool > tuning_addonparts_conflict_w_used
1:1 with tuning_addonparts; True means the eligible (not used) addonpart conflicts with an used addon...
Ogre::String ai_sectionconfig2
void DrawTuningProtectedChkRightAligned(const int subject_id, bool is_protected, ModifyProjectRequestType request_type_set, ModifyProjectRequestType request_type_reset, const std::string &subject="")
const ImVec4 ORANGE_TEXT
bool ShouldDisplay(ImVec2 window_pos)
const ImVec4 TUNING_HOLDTOCONFIRM_COLOR
Str< 200 > tuning_savebox_buf
Buffer for tuneup name to be saved.
const ImVec4 GRAY_HINT_TEXT
rapidjson::Document ai_presets_bundled
Presets bundled with the terrain, see [AI Presets] section in .terrn2 file format.
const float PANEL_HOVERBOX_HEIGHT
bool tuning_savebox_overwrite
Status of "Overwrite?" checkbox.
bool ai_presets_extern_fetching
True if the (down)load of 'extern' waypoints is in progress.
const int TUNING_SUBJECTID_USE_NAME
void DrawMpUserToActorList(RoRnet::UserInfo &user)
AddonPartConflictVec tuning_conflicts
Conflicts between eligible addonparts tweaking the same element.
const float TUNING_HOLDTOCONFIRM_TIMELIMIT
Delete button must be held for several sec to confirm.
rapidjson::Document ai_presets_extern
Externally provided presets (GitHub repo or local 'savegames/waypoints.json' file).
const ImVec4 GREEN_TEXT
std::string m_quicksave_name
rapidjson::Document ai_presets_all
The full list of presets, used for display. Needs to be refreshed when terrain is loaded.
std::vector< CacheEntryPtr > tuning_addonparts
Addonparts eligible for current actor, both matched by GUID and force-installed by user via [browse a...
const float MENU_Y_OFFSET
std::vector< ai_events > ai_waypoints
void DrawTuningBoxedSubjectIdInline(int subject_id)
void RefreshAiPresets()
Refresh the list of presets, used for display. Needs to be called when terrain is loaded.
float tuning_rwidget_cursorx_min
Avoid drawing right-side widgets ('Delete' button or 'Protected' chk) over saved tuneup names.
std::string ai_presets_extern_error
Error message from the (down)load of 'extern' waypoints.
ActorPtr tuning_actor
Detecting actor change to update cached values.
void DrawSpecialStateBox(float top_offset)
bool IsMenuEnabled(TopMenu which)
bool tuning_savebox_visible
User pressed 'save active' to open savebox.
void LoadBundledAiPresets(TerrainPtr terrain)
Loads JSON files from [AI Presets] section in .terrn2 file format.
void FetchExternAiPresetsOnBackground()
Initiate threaded (down)load of 'extern' waypoints from GitHub repo.
void DrawTuningForceRemoveControls(const int subject_id, const std::string &name, const bool is_unwanted, const bool is_force_removed, ModifyProjectRequestType request_type_set, ModifyProjectRequestType request_type_reset)
const ImVec2 MENU_HOVERBOX_PADDING
CacheEntryPtr tuning_hovered_addonpart
Wrapper for classic c-string (local buffer) Refresher: strlen() excludes '\0' terminator; strncat() A...
Definition Str.h:36
ModifyProjectRequestType
std::vector< AddonPartConflict > AddonPartConflictVec
Ogre::Vector3 position