Random Events

This commit is contained in:
FrogAi
2024-01-12 22:39:30 -07:00
parent f71e0b629f
commit deb2b8d247
18 changed files with 56 additions and 5 deletions

View File

@@ -376,7 +376,8 @@ ExperimentalButton::ExperimentalButton(QWidget *parent) : experimental_mode(fals
{3, loadPixmap("../frogpilot/assets/wheel_images/frog.png", {img_size, img_size})},
{4, loadPixmap("../frogpilot/assets/wheel_images/rocket.png", {img_size, img_size})},
{5, loadPixmap("../frogpilot/assets/wheel_images/hyundai.png", {img_size, img_size})},
{6, loadPixmap("../frogpilot/assets/wheel_images/stalin.png", {img_size, img_size})}
{6, loadPixmap("../frogpilot/assets/wheel_images/stalin.png", {img_size, img_size})},
{7, loadPixmap("../frogpilot/assets/wheel_images/firefox.png", {img_size, img_size})}
};
}
@@ -405,13 +406,20 @@ void ExperimentalButton::updateState(const UIState &s, bool leadInfo) {
}
// FrogPilot variables
firefoxRandomEventTriggered = scene.current_random_event == 1;
rotatingWheel = scene.rotating_wheel;
wheelIcon = scene.wheel_icon;
y_offset = leadInfo ? 10 : 0;
if (firefoxRandomEventTriggered) {
static int rotationDegree = 0;
rotationDegree = (rotationDegree + 36) % 360;
steeringAngleDeg = rotationDegree;
wheelIcon = 7;
update();
// Update the icon so the steering wheel rotates in real time
if (rotatingWheel && steeringAngleDeg != scene.steering_angle_deg) {
} else if (rotatingWheel && steeringAngleDeg != scene.steering_angle_deg) {
steeringAngleDeg = scene.steering_angle_deg;
update();
}
@@ -431,7 +439,7 @@ void ExperimentalButton::paintEvent(QPaintEvent *event) {
QColor(0, 0, 0, 166));
if (!scene.show_driver_camera) {
if (rotatingWheel) {
if (rotatingWheel || firefoxRandomEventTriggered) {
drawIconRotate(p, QPoint(btn_size / 2, btn_size / 2 + y_offset), img, background_color, (isDown() || (!engageable && !scene.always_on_lateral_active)) ? 0.6 : 1.0, steeringAngleDeg);
} else {
drawIcon(p, QPoint(btn_size / 2, btn_size / 2 + y_offset), img, background_color, (isDown() || (!engageable && !scene.always_on_lateral_active)) ? 0.6 : 1.0);

View File

@@ -85,6 +85,7 @@ private:
std::map<int, QPixmap> wheelImages;
bool firefoxRandomEventTriggered;
bool rotatingWheel;
int steeringAngleDeg;
int wheelIcon;

View File

@@ -40,6 +40,8 @@ sound_list: Dict[int, Tuple[str, Optional[int], float]] = {
AudibleAlert.warningSoft: ("warning_soft.wav", None, MAX_VOLUME),
AudibleAlert.warningImmediate: ("warning_immediate.wav", None, MAX_VOLUME),
AudibleAlert.firefox: ("firefox.wav", None, MAX_VOLUME),
}
def check_controls_timeout_alert(sm):

View File

@@ -330,6 +330,7 @@ void ui_update_params(UIState *s) {
scene.quality_of_life_visuals = params.getBool("QOLVisuals");
scene.full_map = params.getBool("QOLVisuals") && scene.quality_of_life_visuals;
scene.random_events = params.getBool("RandomEvents");
scene.rotating_wheel = params.getBool("RotatingWheel");
scene.screen_brightness = params.getInt("ScreenBrightness");
scene.speed_limit_controller = params.getBool("SpeedLimitController");
@@ -410,6 +411,9 @@ void UIState::update() {
if (scene.conditional_experimental) {
scene.conditional_status = paramsMemory.getInt("CEStatus");
}
if (scene.random_events) {
scene.current_random_event = paramsMemory.getInt("CurrentRandomEvent");
}
}
void UIState::setPrimeType(PrimeType type) {

View File

@@ -192,6 +192,7 @@ typedef struct UIScene {
bool mute_dm;
bool personalities_via_screen;
bool quality_of_life_visuals;
bool random_events;
bool road_name_ui;
bool rotating_wheel;
bool show_driver_camera;
@@ -218,6 +219,7 @@ typedef struct UIScene {
int conditional_speed;
int conditional_speed_lead;
int conditional_status;
int current_random_event;
int custom_colors;
int custom_signals;
int desired_follow;