small fixes and removing compiler warnings

This commit is contained in:
David Skoland 2018-11-16 02:26:47 +01:00
parent 8ffdd2afb8
commit 727c39a1df
3 changed files with 30 additions and 38 deletions

View File

@ -75,8 +75,11 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
real_duration += m_movie->nextFrameDelay(); real_duration += m_movie->nextFrameDelay();
m_movie->jumpToFrame(n_frame + 1); m_movie->jumpToFrame(n_frame + 1);
} }
#ifdef DEBUG_GIF
qDebug() << "full_duration: " << full_duration; qDebug() << "full_duration: " << full_duration;
qDebug() << "real_duration: " << real_duration; qDebug() << "real_duration: " << real_duration;
#endif
double percentage_modifier = 100.0; double percentage_modifier = 100.0;
@ -88,7 +91,10 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
if (percentage_modifier > 100.0) if (percentage_modifier > 100.0)
percentage_modifier = 100.0; percentage_modifier = 100.0;
} }
#ifdef DEBUG_GIF
qDebug() << "% mod: " << percentage_modifier; qDebug() << "% mod: " << percentage_modifier;
#endif
if (full_duration == 0 || full_duration >= real_duration) if (full_duration == 0 || full_duration >= real_duration)
{ {

View File

@ -1034,11 +1034,11 @@ void Courtroom::handle_chatmessage_2()
case 1: case 2: case 6: case 1: case 2: case 6:
play_preanim(); play_preanim();
break; break;
default:
qDebug() << "W: invalid emote mod: " << QString::number(emote_mod);
//intentional fallthru
case 0: case 5: case 0: case 5:
handle_chatmessage_3(); handle_chatmessage_3();
break;
default:
qDebug() << "W: invalid emote mod: " << QString::number(emote_mod);
} }
} }
@ -1094,15 +1094,11 @@ void Courtroom::handle_chatmessage_3()
QString f_char = m_chatmessage[CHAR_NAME]; QString f_char = m_chatmessage[CHAR_NAME];
QString f_emote = m_chatmessage[EMOTE]; QString f_emote = m_chatmessage[EMOTE];
switch (f_anim_state) if (f_anim_state == 2) {
{
case 2:
ui_vp_player_char->play_talking(f_char, f_emote); ui_vp_player_char->play_talking(f_char, f_emote);
anim_state = 2; anim_state = 2;
break; }
default: else {
qDebug() << "W: invalid anim_state: " << f_anim_state;
case 3:
ui_vp_player_char->play_idle(f_char, f_emote); ui_vp_player_char->play_idle(f_char, f_emote);
anim_state = 3; anim_state = 3;
} }
@ -1194,12 +1190,11 @@ void Courtroom::play_preanim()
sfx_delay_timer->start(sfx_delay); sfx_delay_timer->start(sfx_delay);
if (!file_exists(ao_app->get_character_path(f_char, f_preanim.toLower() + ".gif")) || if (!file_exists(ao_app->get_character_path(f_char, f_preanim + ".gif")) ||
preanim_duration < 0) preanim_duration < 0)
{ {
anim_state = 1; anim_state = 1;
preanim_done(); preanim_done();
qDebug() << "could not find " + ao_app->get_character_path(f_char, f_preanim.toLower() + ".gif");
return; return;
} }
@ -1462,12 +1457,14 @@ void Courtroom::set_text_color()
ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
"color: yellow"); "color: yellow");
break; break;
default:
qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR];
case WHITE: case WHITE:
ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
"color: white"); "color: white");
break;
default:
ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
"color: white");
qDebug() << "W: undefined text color: " << m_chatmessage[TEXT_COLOR];
} }
} }

View File

@ -18,27 +18,23 @@
#define CASE_SENSITIVE_FILESYSTEM #define CASE_SENSITIVE_FILESYSTEM
#endif #endif
QString base_path = "";
QString AOApplication::get_base_path() QString AOApplication::get_base_path()
{ {
if (base_path == "") QString base_path = "";
{ #ifdef ANDROID
#ifdef BASE_OVERRIDE QString sdcard_storage = getenv("SECONDARY_STORAGE");
base_path = base_override; if (dir_exists(sdcard_storage + "/AO2/")){
#elif defined(ANDROID) base_path = sdcard_storage + "/AO2/";
QString sdcard_storage = getenv("SECONDARY_STORAGE"); }
if (dir_exists(sdcard_storage + "/AO2/")){ else {
base_path = sdcard_storage + "/AO2/"; QString external_storage = getenv("EXTERNAL_STORAGE");
}else{ base_path = external_storage + "/AO2/";
QString external_storage = getenv("EXTERNAL_STORAGE"); }
base_path = external_storage + "/AO2/";
}
#else #else
base_path = QDir::currentPath() + "/base/"; base_path = QDir::currentPath() + "/base/";
#endif #endif
}
return base_path; return base_path;
} }
QString AOApplication::get_data_path() QString AOApplication::get_data_path()
@ -146,21 +142,14 @@ QString AOApplication::get_evidence_path(QString p_file)
} }
QString AOApplication::get_case_sensitive_path(QString p_file) { QString AOApplication::get_case_sensitive_path(QString p_file) {
qDebug() << "calling get_case_sensitive_path: " << p_file;
QFileInfo file(p_file); QFileInfo file(p_file);
//quick check to see if it's actually there first //quick check to see if it's actually there first
if (file.exists()) return p_file; if (file.exists()) return p_file;
QString file_name = file.fileName(); QString file_name = file.fileName();
qDebug() << "file_name: " << file_name;
QString file_path = file.absolutePath(); QString file_path = file.absolutePath();
qDebug() << "file_path: " << file_path;
QRegExp file_rx = QRegExp(file_name, Qt::CaseInsensitive); QRegExp file_rx = QRegExp(file_name, Qt::CaseInsensitive);
QStringList files = QDir(file_path).entryList(); QStringList files = QDir(file_path).entryList();
int result = files.indexOf(file_rx); int result = files.indexOf(file_rx);