@@ -532,21 +532,21 @@ void Courtroom::set_widgets()
532532 // them.
533533 ui_settings->show ();
534534
535- ui_vp_background->move (0 , 0 );
535+ ui_vp_background->move_and_center (0 , 0 );
536536 ui_vp_background->combo_resize (ui_viewport->width (), ui_viewport->height ());
537537
538- ui_vp_speedlines->move (0 , 0 );
538+ ui_vp_speedlines->move_and_center (0 , 0 );
539539 ui_vp_speedlines->combo_resize (ui_viewport->width (), ui_viewport->height ());
540540
541- ui_vp_player_char->move (0 , 0 );
541+ ui_vp_player_char->move_and_center (0 , 0 );
542542 ui_vp_player_char->combo_resize (ui_viewport->width (), ui_viewport->height ());
543543
544- ui_vp_sideplayer_char->move (0 , 0 );
544+ ui_vp_sideplayer_char->move_and_center (0 , 0 );
545545 ui_vp_sideplayer_char->combo_resize (ui_viewport->width (),
546546 ui_viewport->height ());
547547
548548 // the AO2 desk element
549- ui_vp_desk->move (0 , 0 );
549+ ui_vp_desk->move_and_center (0 , 0 );
550550 ui_vp_desk->combo_resize (ui_viewport->width (), ui_viewport->height ());
551551
552552 ui_vp_evidence_display->move (0 , 0 );
@@ -570,16 +570,16 @@ void Courtroom::set_widgets()
570570 // thing, which is to parent these to ui_viewport. instead, AOLayer handles
571571 // masking so we don't overlap parts of the UI, and they become free floating
572572 // widgets.
573- ui_vp_testimony->move (ui_viewport->x (), ui_viewport->y ());
573+ ui_vp_testimony->move_and_center (ui_viewport->x (), ui_viewport->y ());
574574 ui_vp_testimony->combo_resize (ui_viewport->width (), ui_viewport->height ());
575575
576- ui_vp_effect->move (ui_viewport->x (), ui_viewport->y ());
576+ ui_vp_effect->move_and_center (ui_viewport->x (), ui_viewport->y ());
577577 ui_vp_effect->combo_resize (ui_viewport->width (), ui_viewport->height ());
578578
579- ui_vp_wtce->move (ui_viewport->x (), ui_viewport->y ());
579+ ui_vp_wtce->move_and_center (ui_viewport->x (), ui_viewport->y ());
580580 ui_vp_wtce->combo_resize (ui_viewport->width (), ui_viewport->height ());
581581
582- ui_vp_objection->move (ui_viewport->x (), ui_viewport->y ());
582+ ui_vp_objection->move_and_center (ui_viewport->x (), ui_viewport->y ());
583583 ui_vp_objection->combo_resize (ui_viewport->width (), ui_viewport->height ());
584584
585585 log_maximum_blocks = ao_app->get_max_log_size ();
@@ -2277,24 +2277,7 @@ void Courtroom::display_character()
22772277 // Hide the face sticker
22782278 ui_vp_sticker->stop ();
22792279 // Initialize the correct pos (called SIDE here for some reason) with DESK_MOD to determine if we should hide the desk or not.
2280- switch (m_chatmessage[DESK_MOD ].toInt ()) {
2281- case 4 :
2282- set_self_offset (m_chatmessage[SELF_OFFSET ]);
2283- [[fallthrough]] ;
2284- case 2 :
2285- set_scene (" 1" , m_chatmessage[SIDE ]);
2286- break ;
2287- case 5 :
2288- ui_vp_sideplayer_char->hide ();
2289- ui_vp_player_char->move (0 , 0 );
2290- [[fallthrough]] ;
2291- case 3 :
2292- set_scene (" 0" , m_chatmessage[SIDE ]);
2293- break ;
2294- default :
2295- set_scene (m_chatmessage[DESK_MOD ], m_chatmessage[SIDE ]);
2296- break ;
2297- }
2280+ set_scene (m_chatmessage[DESK_MOD ], m_chatmessage[SIDE ]);
22982281
22992282 // Arrange the netstrings of the frame SFX for the character to know about
23002283 if (!m_chatmessage[FRAME_SFX ].isEmpty () &&
@@ -2313,16 +2296,8 @@ void Courtroom::display_character()
23132296 ui_vp_player_char->set_flipped (true );
23142297 else
23152298 ui_vp_player_char->set_flipped (false );
2316-
2317- // Parse the character X offset
2318- QStringList offsets = m_chatmessage[SELF_OFFSET ].split (" &" );
2319- int offset_x = offsets[0 ].toInt ();
2320- // Y offset is 0 by default unless we find that the server sent us the Y position as well
2321- int offset_y = 0 ;
2322- if (offsets.length () > 1 )
2323- offset_y = offsets[1 ].toInt ();
23242299 // Move the character on the viewport according to the offsets
2325- ui_vp_player_char-> move (ui_viewport-> width () * offset_x / 100 , ui_viewport-> height () * offset_y / 100 );
2300+ set_self_offset (m_chatmessage[ SELF_OFFSET ] );
23262301}
23272302
23282303void Courtroom::display_pair_character (QString other_charid, QString other_offset)
@@ -3189,6 +3164,23 @@ void Courtroom::play_preanim(bool immediate)
31893164 ui_vp_player_char->set_play_once (true );
31903165 ui_vp_player_char->load_image (f_preanim, f_char, preanim_duration, true );
31913166
3167+ switch (m_chatmessage[DESK_MOD ].toInt ()) {
3168+ case 4 :
3169+ ui_vp_sideplayer_char->hide ();
3170+ ui_vp_player_char->move_and_center (0 , 0 );
3171+ [[fallthrough]] ;
3172+ case 2 :
3173+ set_scene (" 0" , m_chatmessage[SIDE ]);
3174+ break ;
3175+ case 5 :
3176+ case 3 :
3177+ set_scene (" 1" , m_chatmessage[SIDE ]);
3178+ break ;
3179+ default :
3180+ set_scene (m_chatmessage[DESK_MOD ], m_chatmessage[SIDE ]);
3181+ break ;
3182+ }
3183+
31923184 if (immediate)
31933185 anim_state = 4 ;
31943186 else
@@ -3204,6 +3196,24 @@ void Courtroom::play_preanim(bool immediate)
32043196void Courtroom::preanim_done ()
32053197{
32063198 anim_state = 1 ;
3199+ switch (m_chatmessage[DESK_MOD ].toInt ()) {
3200+ case 4 :
3201+ set_self_offset (m_chatmessage[SELF_OFFSET ]);
3202+ [[fallthrough]] ;
3203+ case 2 :
3204+ set_scene (" 1" , m_chatmessage[SIDE ]);
3205+ break ;
3206+ case 5 :
3207+ ui_vp_sideplayer_char->hide ();
3208+ ui_vp_player_char->move_and_center (0 , 0 );
3209+ [[fallthrough]] ;
3210+ case 3 :
3211+ set_scene (" 0" , m_chatmessage[SIDE ]);
3212+ break ;
3213+ default :
3214+ set_scene (m_chatmessage[DESK_MOD ], m_chatmessage[SIDE ]);
3215+ break ;
3216+ }
32073217 qDebug () << " preanim over, anim_state set to 1" ;
32083218 handle_ic_speaking ();
32093219}
0 commit comments