From e1b73b996db0ecef8f1d2e21deda5c6dbbb9f321 Mon Sep 17 00:00:00 2001 From: Vriff <74007411+vrifftech@users.noreply.github.com> Date: Sat, 24 Oct 2026 16:25:49 -0400 Subject: [PATCH 01/23] The computer conversation panel now shows what the game shows: - the leader's Computer Use and Repair totals and the party's computer spikes and repair parts, written once per entry, when its replies are listed; - the two skill names from skills.2da, and in KotOR their icons; - the terminal hum, computer_lp_04, looping at 30 of 127 while the panel is up and stopping for a camera shot; - in KotOR, the panel frame from comptypes.2da by the dialogue's ComputerType, and the four static bands drawn at 40% opacity instead of hidden. --- include/reone/game/gui/computer.h | 46 ++++++++--- include/reone/gui/control.h | 4 + src/libs/game/gui/computer.cpp | 122 ++++++++++++++++++++++++++---- src/libs/gui/control.cpp | 22 +++--- test/game/computer.cpp | 8 ++ 5 files changed, 168 insertions(+), 34 deletions(-) diff --git a/include/reone/game/gui/computer.h b/include/reone/game/gui/computer.h index a8320b645..e8c86dabc 100644 --- a/include/reone/game/gui/computer.h +++ b/include/reone/game/gui/computer.h @@ -17,6 +17,7 @@ #pragma once +#include "reone/audio/clip.h" #include "reone/gui/control/label.h" #include "reone/gui/control/listbox.h" @@ -54,8 +55,20 @@ class ComputerGUI : public Conversation { ComputerCamGUI _cameraGUI; Presentation _presentation {Presentation::Normal}; + /** The terminal hum, looping while the panel is up. */ + std::shared_ptr _humClip; + /** The playing hum; none while the panel is down or a camera shot shows. */ + std::shared_ptr _hum; + /** KotOR: the panel frame of each computer type, the rows of comptypes.2da. */ + std::vector _panelFrames; void returnFromCamera(); + /** Switches between the panel and a camera shot; the terminal hum plays only with the panel. */ + void setPresentation(Presentation presentation); + /** Starts the terminal hum from its beginning. */ + void playHum(); + /** Stops the terminal hum. */ + void stopHum(); struct Controls { std::shared_ptr LBL_BAR1; @@ -98,29 +111,42 @@ class ComputerGUI : public Conversation { _controls.LBL_BAR5 = findControl("LBL_BAR5"); _controls.LBL_BAR6 = findControl("LBL_BAR6"); _controls.LBL_COMP_SKILL = findControl("LBL_COMP_SKILL"); - _controls.LBL_COMP_SKILL_ICON = findControl("LBL_COMP_SKILL_ICON"); _controls.LBL_COMP_SKILL_VAL = findControl("LBL_COMP_SKILL_VAL"); _controls.LBL_COMP_SPIKES = findControl("LBL_COMP_SPIKES"); - _controls.LBL_COMP_SPIKES_ICON = findControl("LBL_COMP_SPIKES_ICON"); _controls.LBL_COMP_SPIKES_VAL = findControl("LBL_COMP_SPIKES_VAL"); - _controls.LBL_OBSCURE = findControl("LBL_OBSCURE"); _controls.LBL_REP_SKILL = findControl("LBL_REP_SKILL"); - _controls.LBL_REP_SKILL_ICON = findControl("LBL_REP_SKILL_ICON"); _controls.LBL_REP_SKILL_VAL = findControl("LBL_REP_SKILL_VAL"); _controls.LBL_REP_UNITS = findControl("LBL_REP_UNITS"); - _controls.LBL_REP_UNITS_ICON = findControl("LBL_REP_UNITS_ICON"); _controls.LBL_REP_UNITS_VAL = findControl("LBL_REP_UNITS_VAL"); - _controls.LBL_STATIC1 = findControl("LBL_STATIC1"); - _controls.LBL_STATIC2 = findControl("LBL_STATIC2"); - _controls.LBL_STATIC3 = findControl("LBL_STATIC3"); - _controls.LBL_STATIC4 = findControl("LBL_STATIC4"); _controls.LB_MESSAGE = findControl("LB_MESSAGE"); _controls.LB_REPLIES = findControl("LB_REPLIES"); + if (!isTSL()) { + // Only the KotOR terminal sets up the skill icons, the obscuring + // label and the static bands. + _controls.LBL_COMP_SKILL_ICON = findControl("LBL_COMP_SKILL_ICON"); + _controls.LBL_COMP_SPIKES_ICON = findControl("LBL_COMP_SPIKES_ICON"); + _controls.LBL_OBSCURE = findControl("LBL_OBSCURE"); + _controls.LBL_REP_SKILL_ICON = findControl("LBL_REP_SKILL_ICON"); + _controls.LBL_REP_UNITS_ICON = findControl("LBL_REP_UNITS_ICON"); + _controls.LBL_STATIC1 = findControl("LBL_STATIC1"); + _controls.LBL_STATIC2 = findControl("LBL_STATIC2"); + _controls.LBL_STATIC3 = findControl("LBL_STATIC3"); + _controls.LBL_STATIC4 = findControl("LBL_STATIC4"); + } } void configureMessage(); void configureReplies(); - void hideStaticBands(); + /** Names the two skills, and in KotOR shows their icons. */ + void configureSkillLabels(); + /** KotOR draws the static bands faintly. */ + void configureBands(); + /** KotOR reads the panel frame of each computer type. */ + void loadPanelFrames(); + /** KotOR frames the panel by the conversation's computer type. */ + void applyPanelFrame(); + /** Writes the leader's Computer Use and Repair totals and the party's spike and repair-part counts. */ + void refreshSkills(); void setMessage(std::string message) override; void setReplyLines(std::vector lines) override; diff --git a/include/reone/gui/control.h b/include/reone/gui/control.h index 586e721da..90b5098c3 100644 --- a/include/reone/gui/control.h +++ b/include/reone/gui/control.h @@ -96,6 +96,8 @@ class Control : boost::noncopyable { std::shared_ptr edge; std::shared_ptr fill; glm::vec3 color {1.0f}; + /** The opacity every piece of the border is drawn with. */ + float alpha {1.0f}; int dimension {0}; FillTransform fillTransform {FillTransform::None}; }; @@ -166,6 +168,8 @@ class Control : boost::noncopyable { void setBorderFill(std::shared_ptr texture); void setBorderFillTransform(Border::FillTransform transform); void setBorderColor(glm::vec3 color); + /** Sets the opacity every piece of the border is drawn with. */ + void setBorderAlpha(float alpha); void setBorderColorOverride(glm::vec3 color); void setDisabled(bool disabled); virtual void setExtent(Extent extent); diff --git a/src/libs/game/gui/computer.cpp b/src/libs/game/gui/computer.cpp index 2a0b2a50c..336f9ced2 100644 --- a/src/libs/game/gui/computer.cpp +++ b/src/libs/game/gui/computer.cpp @@ -17,7 +17,18 @@ #include "reone/game/gui/computer.h" +#include "reone/audio/di/services.h" +#include "reone/audio/mixer.h" +#include "reone/game/d20/skills.h" +#include "reone/game/di/services.h" #include "reone/game/game.h" +#include "reone/game/object/creature.h" +#include "reone/game/party.h" +#include "reone/game/twodautil.h" +#include "reone/resource/2da.h" +#include "reone/resource/di/services.h" +#include "reone/resource/provider/2das.h" +#include "reone/resource/provider/audioclips.h" using namespace reone::audio; @@ -29,15 +40,19 @@ namespace reone { namespace game { -static void setVisible(const std::shared_ptr