Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 23 additions & 7 deletions aocharmovie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,40 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
m_movie->start();
}

void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration, int reverse)
{
QString gif_path = ao_app->get_character_path(p_char) + p_emote.toLower();

m_movie->stop();
this->clear();
m_movie->setFileName(gif_path);
m_movie->jumpToFrame(0);

if (reverse != 0):
{
m_movie->jumpToFrame(m_movie->frameCount());
}
else
{
m_movie->jumpToFrame(0);
}
int full_duration = duration * time_mod;
int real_duration = 0;

play_once = false;

for (int n_frame = 0 ; n_frame < m_movie->frameCount() ; ++n_frame)
if (reverse != 0):
{
for (int n_frame = m_movie->frameCount() ; n_frame > 0 ; --n_frame)
{
real_duration += m_movie->nextFrameDelay();
m_movie->jumpToFrame(n_frame - 1);
}
}
else
{
real_duration += m_movie->nextFrameDelay();
m_movie->jumpToFrame(n_frame + 1);
for (int n_frame = 0 ; n_frame < m_movie->frameCount() ; ++n_frame)
{
real_duration += m_movie->nextFrameDelay();
m_movie->jumpToFrame(n_frame + 1);
}
}
qDebug() << "full_duration: " << full_duration;
qDebug() << "real_duration: " << real_duration;
Expand Down
2 changes: 1 addition & 1 deletion aocharmovie.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AOCharMovie : public QLabel
AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app);

void play(QString p_char, QString p_emote, QString emote_prefix);
void play_pre(QString p_char, QString p_emote, int duration);
void play_pre(QString p_char, QString p_emote, int duration, int reverse);
void play_talking(QString p_char, QString p_emote);
void play_idle(QString p_char, QString p_emote);

Expand Down
3 changes: 2 additions & 1 deletion base/themes/default/courtroom_design.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ reload_theme = 5, 415, 101, 23
call_mod = 5, 440, 71, 23
pre = 187, 345, 51, 21
flip = 187, 362, 51, 21
guard = 187, 379, 61, 21
reverse = 187, 379, 51, 21
guard = 187, 396, 61, 21
custom_objection = 250, 325, 40, 40
realization = 295, 325, 40, 40
mute_button = 340, 325, 40, 40
Expand Down
35 changes: 33 additions & 2 deletions courtroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_guard = new QCheckBox(this);
ui_guard->setText("Guard");
ui_guard->hide();
ui_reverse = new QCheckBox(this);
ui_reverse->setText("Reverse");

ui_custom_objection = new AOButton(this, ao_app);
ui_realization = new AOButton(this, ao_app);
Expand Down Expand Up @@ -244,6 +246,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked()));
connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked()));
connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked()));
connect(ui_reverse, SIGNAL(clicked()), this, SLOT(on_reverse_clicked()));

connect(ui_evidence_button, SIGNAL(clicked()), this, SLOT(on_evidence_button_clicked()));

Expand Down Expand Up @@ -450,6 +453,8 @@ void Courtroom::set_widgets()

set_size_and_pos(ui_guard, "guard");

set_size_and_pos(ui_reverse, "reverse");

set_size_and_pos(ui_custom_objection, "custom_objection");
ui_custom_objection->set_image("custom.png");

Expand Down Expand Up @@ -799,6 +804,7 @@ void Courtroom::on_chat_return_pressed()
//placeholder#
//realization#
//text_color#%
//reverse#

QStringList packet_contents;

Expand Down Expand Up @@ -901,6 +907,15 @@ void Courtroom::on_chat_return_pressed()

packet_contents.append(f_text_color);

QString f_reverse;

if (ui_reverse->isChecked())
f_reverse = "1";
else
f_reverse = "0";

packet_contents.append(f_flip);

ao_app->send_server_packet(new AOPacket("MS", packet_contents));
}

Expand Down Expand Up @@ -1228,8 +1243,12 @@ void Courtroom::play_preanim()
qDebug() << "could not find " + ao_app->get_character_path(f_char) + f_preanim.toLower() + ".gif";
return;
}

ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration);
int is_reversed = 0;
if (m_chatmessage[REVERSE] == "1")
{
is_reversed = 1;
}
ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration, is_reversed);
anim_state = 1;
if (text_delay >= 0)
text_delay_timer->start(text_delay);
Expand Down Expand Up @@ -2079,6 +2098,18 @@ void Courtroom::on_flip_clicked()
ui_ic_chat_message->setFocus();
}

void Courtroom::on_reverse_clicked()
{
if (ui_pre->isChecked() == false)
{
if(ui_reverse->isChecked())
{
ui_pre->setChecked(false)
}
}
ui_ic_chat_message->setFocus();
}

void Courtroom::on_guard_clicked()
{
ui_ic_chat_message->setFocus();
Expand Down
2 changes: 2 additions & 0 deletions courtroom.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ class Courtroom : public QMainWindow
QCheckBox *ui_pre;
QCheckBox *ui_flip;
QCheckBox *ui_guard;
QCheckBox *ui_reverse;

AOButton *ui_custom_objection;
AOButton *ui_realization;
Expand Down Expand Up @@ -481,6 +482,7 @@ private slots:
void on_pre_clicked();
void on_flip_clicked();
void on_guard_clicked();
void on_reverse_clicked();

void on_evidence_button_clicked();

Expand Down
4 changes: 3 additions & 1 deletion datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct chatmessage_type
int cid;
int sfx_delay;
int flip;
int reverse;
};

struct area_type
Expand Down Expand Up @@ -92,7 +93,8 @@ enum CHAT_MESSAGE
EVIDENCE_ID,
FLIP,
REALIZATION,
TEXT_COLOR
TEXT_COLOR,
REVERSE
};

enum COLOR
Expand Down