Ejemplo n.º 1
0
void Driver_Voice_Play(const uint8 *data, int16 arg0A)
{
	static int16 l_var_639A = -1;

	Driver *voice = g_driverVoice;

	if (!g_gameConfig.sounds || voice->index == 0xFFFF) return;

	if (data == NULL) {
		arg0A = 0x100;
	} else {
		arg0A = min(arg0A, 0xFF);
	}

	if (!Driver_Voice_IsPlaying()) l_var_639A = -1;

	if (arg0A < l_var_639A) return;

	Driver_Voice_Stop();

	if (data == NULL) return;

	l_var_639A = arg0A;

	if (data == NULL) return;

	DSP_Play(data);
}
Ejemplo n.º 2
0
/**
 * Output feedback about events of the game.
 * @param index Feedback to provide (\c 0xFFFF means do nothing, \c 0xFFFE means stop, otherwise a feedback code).
 * @note If sound is disabled, the main viewport is used to display a message.
 */
void Sound_Output_Feedback(uint16 index)
{
    if (index == 0xFFFF) return;

    if (index == 0xFFFE) {
        uint8 i;

        /* Clear spoken audio. */
        for (i = 0; i < lengthof(s_spokenWords); i++) {
            s_spokenWords[i] = 0xFFFF;
        }

        Driver_Voice_Stop();

        g_viewportMessageText = NULL;
        if ((g_viewportMessageCounter & 1) != 0) {
            g_viewport_forceRedraw = true;
            g_viewportMessageCounter = 0;
        }
        s_variable_4060 = 0;

        return;
    }

    if (g_enableVoices == 0 || g_gameConfig.sounds == 0) {
        Driver_Sound_Play(g_feedback[index].soundId, 0xFF);

        g_viewportMessageText = String_Get_ByIndex(g_feedback[index].messageId);

        if ((g_viewportMessageCounter & 1) != 0) {
            g_viewport_forceRedraw = true;
        }

        g_viewportMessageCounter = 4;

        return;
    }

    /* If nothing is being said currently, load new words. */
    if (s_spokenWords[0] == 0xFFFF) {
        uint8 i;

        for (i = 0; i < lengthof(s_spokenWords); i++) {
            s_spokenWords[i] = (g_config.language == LANGUAGE_ENGLISH) ? g_feedback[index].voiceId[i] : g_translatedVoice[index][i];
        }
    }

    Sound_StartSpeech();
}