Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3f8d81a
split get_blips into two functions
Lernos Jun 5, 2022
71ff2fc
include new function, rewrite description
Lernos Jun 5, 2022
1b4e0b1
check for custom blips support in packet
Lernos Jun 5, 2022
0034887
add custom blips enabled bool
Lernos Jun 5, 2022
30cec4b
increase MS_MAXIMUM, add custom blips QLineEdit
Lernos Jun 5, 2022
ff3464a
add BLIPNAME to chat message
Lernos Jun 5, 2022
a2af389
introducing custom blips
Lernos Jun 5, 2022
8e129ce
introducing custom blips I said
Lernos Jun 5, 2022
01efc92
Merge branch 'master' into pr/780
stonedDiscord Jun 6, 2022
bf7d760
Merge branch 'master' into pr/780
stonedDiscord Jun 19, 2022
d6c6e89
Merge branch 'master' into feature/custom-blips
stonedDiscord Sep 2, 2022
f22cb53
unfold if
stonedDiscord Sep 2, 2022
579f54a
unfold other if
stonedDiscord Sep 2, 2022
b277f7a
Merge branch 'master' into feature/custom-blips
in1tiate Feb 29, 2024
15295ec
Merge branch 'master' into feature/custom-blips
in1tiate May 9, 2024
cda95d5
Merge branch 'master' into feature/custom-blips
in1tiate May 9, 2024
2f44a0a
retool custom blips code, add ini parser
in1tiate May 9, 2024
a056aff
Merge branch 'master' into option-override
in1tiate May 9, 2024
4a2de06
remove extraneous debug calls
in1tiate May 10, 2024
7f5d72e
Merge branch 'option-override' of https://github.com/AttorneyOnline/A…
in1tiate May 10, 2024
94bf6b8
Merge branch 'master' into option-override
in1tiate May 10, 2024
a97168b
fix incorrect default value on get_showname
in1tiate May 10, 2024
8cb5fd4
restructure ini format
in1tiate May 10, 2024
db370ae
fix parser again
in1tiate May 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions include/aoapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ class AOApplication : public QApplication {
bool casing_alerts_supported = false;
bool modcall_reason_supported = false;
bool looping_sfx_supported = false;
bool additive_text_supported = false;
bool additive_supported = false;
bool effects_supported = false;
bool y_offset_supported = false;
bool expanded_desk_mods_supported = false;
bool auth_packet_supported = false;
bool custom_blips_supported = false;

///////////////loading info///////////////////

Expand Down Expand Up @@ -260,7 +261,7 @@ class AOApplication : public QApplication {
QString get_char_side(QString p_char);

// Returns the showname from the ini of p_char
QString get_showname(QString p_char);
QString get_showname(QString p_char, int p_emote = -1);

// Returns the category of this character
QString get_category(QString p_char);
Expand Down Expand Up @@ -336,8 +337,11 @@ class AOApplication : public QApplication {
// Returns the desk modifier for p_char's p_emote
int get_desk_mod(QString p_char, int p_emote);

// Returns p_char's blips (previously called their "gender")
QString get_blips(QString p_char);
// Returns p_char's blipname by reading char.ini for blips (previously called "gender")
QString get_blipname(QString p_char, int p_emote = -1);

// Returns p_blipname's sound(path) to play in the client
QString get_blips(QString p_blipname);

// Get a property of a given emote, or get it from "options" if emote doesn't have it
QString get_emote_property(QString p_char, QString p_emote, QString p_property);
Expand Down
3 changes: 2 additions & 1 deletion include/courtroom.h
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ class Courtroom : public QMainWindow {

// Minumum and maximum number of parameters in the MS packet
static const int MS_MINIMUM = 15;
static const int MS_MAXIMUM = 30;
static const int MS_MAXIMUM = 31;
QString m_chatmessage[MS_MAXIMUM];

QString previous_ic_message = "";
Expand Down Expand Up @@ -692,6 +692,7 @@ class Courtroom : public QMainWindow {
QLineEdit *ui_ic_chat_message;
AOLineEditFilter *ui_ic_chat_message_filter;
QLineEdit *ui_ic_chat_name;
QLineEdit *ui_custom_blips;

QLineEdit *ui_ooc_chat_message;
QLineEdit *ui_ooc_chat_name;
Expand Down
1 change: 1 addition & 0 deletions include/datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ enum CHAT_MESSAGE {
FRAME_SFX,
ADDITIVE,
EFFECTS,
BLIPNAME,
};

enum EMOTE_MOD_TYPE {
Expand Down
16 changes: 10 additions & 6 deletions src/courtroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1593,7 +1593,7 @@ void Courtroom::enter_courtroom()
else
ui_flip->hide();

if (ao_app->additive_text_supported)
if (ao_app->additive_supported)
ui_additive->show();
else
ui_additive->hide();
Expand Down Expand Up @@ -2019,13 +2019,12 @@ void Courtroom::on_chat_return_pressed()

// If the server we're on supports CCCC stuff, we should use it!
if (ao_app->cccc_ic_supported) {
// If there is a showname entered, use that -- else, just send an empty
// packet-part.
// If there is a showname entered, use that -- else, just send whatever the ini calls for.
if (!ui_ic_chat_name->text().isEmpty()) {
packet_contents.append(ui_ic_chat_name->text());
}
else {
packet_contents.append("");
packet_contents.append(ao_app->get_showname(current_char, current_emote));
}

// Similarly, we send over whom we're paired with, unless we have chosen
Expand Down Expand Up @@ -2088,7 +2087,7 @@ void Courtroom::on_chat_return_pressed()
}
}

if (ao_app->additive_text_supported) {
if (ao_app->additive_supported) {
packet_contents.append(ui_additive->isChecked() ? "1" : "0");
}
if (ao_app->effects_supported) {
Expand All @@ -2111,6 +2110,7 @@ void Courtroom::on_chat_return_pressed()
}
}

packet_contents.append(ao_app->get_blipname(current_char, current_emote));
ao_app->send_server_packet(new AOPacket("MS", packet_contents));
}

Expand Down Expand Up @@ -3658,7 +3658,11 @@ void Courtroom::start_chat_ticking()
if (last_misc != current_misc || char_color_rgb_list.size() < max_colors)
gen_char_rgb_list(current_misc);

QString f_blips = ao_app->get_blips(m_chatmessage[CHAR_NAME]);
QString f_blips = ao_app->get_blipname(m_chatmessage[CHAR_NAME]);
f_blips = ao_app->get_blips(f_blips);
if (ao_app->custom_blips_supported && !m_chatmessage[BLIPNAME].isEmpty()) {
f_blips = ao_app->get_blips(m_chatmessage[BLIPNAME]);
}
blip_player->set_blips(f_blips);

// means text is currently ticking
Expand Down
13 changes: 9 additions & 4 deletions src/packet_distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
casing_alerts_supported = false;
modcall_reason_supported = false;
looping_sfx_supported = false;
additive_text_supported = false;
additive_supported = false;
effects_supported = false;
y_offset_supported = false;
custom_blips_supported = false;

QString f_hdid;
f_hdid = get_hdid();
Expand Down Expand Up @@ -101,10 +102,13 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
casing_alerts_supported = false;
modcall_reason_supported = false;
looping_sfx_supported = false;
additive_text_supported = false;
additive_supported = false;
effects_supported = false;
expanded_desk_mods_supported = false;
auth_packet_supported = false;
custom_blips_supported = false;
log_to_demo = false;

if (f_packet.contains("yellowtext", Qt::CaseInsensitive))
yellow_text_supported = true;
if (f_packet.contains("prezoom", Qt::CaseInsensitive))
Expand All @@ -128,7 +132,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (f_packet.contains("looping_sfx", Qt::CaseInsensitive))
looping_sfx_supported = true;
if (f_packet.contains("additive", Qt::CaseInsensitive))
additive_text_supported = true;
additive_supported = true;
if (f_packet.contains("effects", Qt::CaseInsensitive))
effects_supported = true;
if (f_packet.contains("y_offset", Qt::CaseInsensitive))
Expand All @@ -137,7 +141,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
expanded_desk_mods_supported = true;
if (f_packet.contains("auth_packet", Qt::CaseInsensitive))
auth_packet_supported = true;
log_to_demo = false;
if (f_packet.contains("custom_blips", Qt::CaseInsensitive))
custom_blips_supported = true;
}
else if (header == "PN") {
if (!lobby_constructed || f_contents.size() < 2)
Expand Down
49 changes: 38 additions & 11 deletions src/text_file_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,23 @@ QStringList AOApplication::read_ini_tags(VPath p_path, QString target_tag)
return r_values;
}

QString AOApplication::get_showname(QString p_char)
QString AOApplication::get_showname(QString p_char, int p_emote)
{
QString f_result = read_char_ini(p_char, "showname", "Options");
QString f_needed = read_char_ini(p_char, "needs_showname", "Options");

if (p_emote != -1) {
int override_idx =
read_char_ini(p_char, QString::number(p_emote + 1), "OptionsN").toInt();
if (override_idx > 0) {
QString override_key = "Options" + QString::number(override_idx);
QString temp_f_result = read_char_ini(p_char, "showname", override_key);
if (!temp_f_result.isEmpty()) {
f_result = temp_f_result;
}
}
}

if (f_needed.startsWith("false"))
return "";
if (f_result == "")
Expand All @@ -463,24 +475,39 @@ QString AOApplication::get_char_side(QString p_char)
return f_result;
}

QString AOApplication::get_blips(QString p_char)
QString AOApplication::get_blipname(QString p_char, int p_emote)
{
QString f_result = read_char_ini(p_char, "blips", "Options");

if (f_result == "") {
f_result = read_char_ini(p_char, "gender", "Options"); // not very PC, FanatSors
if (f_result == "")
f_result = "male";
if (p_emote != -1) {
int override_idx =
read_char_ini(p_char, QString::number(p_emote + 1), "OptionsN").toInt();
if (override_idx > 0) {
QString override_key = "Options" + QString::number(override_idx);
QString temp_f_result = read_char_ini(p_char, "blips", override_key);
if (!temp_f_result.isEmpty()) {
f_result = temp_f_result;
}
}
}

if (!file_exists(get_sfx_suffix(get_sounds_path(f_result)))) {
if (file_exists(get_sfx_suffix(get_sounds_path("../blips/" + f_result))))
return "../blips/" + f_result; // Return the cool kids variant

return "sfx-blip" + f_result; // Return legacy variant
if (f_result == "") {
f_result =
read_char_ini(p_char, "gender", "Options"); // not very PC, FanatSors
if (f_result == "") f_result = "male";
}
return f_result;
}
QString AOApplication::get_blips(QString p_blipname)
{
if (!file_exists(get_sfx_suffix(get_sounds_path(p_blipname)))) {
if (file_exists(get_sfx_suffix(get_sounds_path("../blips/" + p_blipname))))
return "../blips/" + p_blipname; // Return the cool kids variant

return "sfx-blip" + p_blipname; // Return legacy variant
}
return p_blipname;
}

QString AOApplication::get_emote_property(QString p_char, QString p_emote,
QString p_property)
Expand Down