Merge branch 'master' into kaleidoscope

This commit is contained in:
TrickyLeifa 2024-05-15 00:23:46 +02:00
commit a0cee58c04
6 changed files with 71 additions and 28 deletions

View File

@ -98,11 +98,12 @@ public:
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///////////////////
@ -234,7 +235,7 @@ public:
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);
@ -307,8 +308,11 @@ public:
// 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);

View File

@ -1657,7 +1657,7 @@ void Courtroom::enter_courtroom()
ui_flip->hide();
}
if (ao_app->additive_text_supported)
if (ao_app->additive_supported)
{
ui_additive->show();
}
@ -2179,7 +2179,7 @@ void Courtroom::on_chat_return_pressed()
}
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
@ -2251,7 +2251,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");
}
@ -2276,6 +2276,8 @@ void Courtroom::on_chat_return_pressed()
}
}
packet_contents.append(ao_app->get_blipname(current_char, current_emote));
ao_app->send_server_packet(AOPacket("MS", packet_contents));
}
@ -3993,7 +3995,11 @@ void Courtroom::start_chat_ticking()
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

View File

@ -438,7 +438,7 @@ private:
// 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;
@ -635,6 +635,7 @@ private:
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;

View File

@ -117,6 +117,7 @@ enum CHAT_MESSAGE
FRAME_SFX,
ADDITIVE,
EFFECTS,
BLIPNAME,
};
enum EMOTE_MOD_TYPE

View File

@ -61,9 +61,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();
@ -117,10 +118,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;
@ -167,7 +171,7 @@ void AOApplication::server_packet_received(AOPacket p_packet)
}
if (f_packet.contains("additive", Qt::CaseInsensitive))
{
additive_text_supported = true;
additive_supported = true;
}
if (f_packet.contains("effects", Qt::CaseInsensitive))
{
@ -185,7 +189,13 @@ void AOApplication::server_packet_received(AOPacket p_packet)
{
auth_packet_supported = true;
}
if (f_packet.contains("custom_blips", Qt::CaseInsensitive))
{
custom_blips_supported = true;
}
log_to_demo = false;
}
else if (header == "PN")
{

View File

@ -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 "";
@ -469,30 +481,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)
{