centurio is the nominative subject, tristis is also nominative, agreeing with it. The verb pertulit I would assume can be translated along the lines of ‘reported’ (comes from “perfero”, it is perfect tense), which would then introduce the indirect statement. Quintum is the one being ’reported to’, as it follows the preposition, ad.
exercitum is accusative (from the 4th declension noun exercitus, -us) and thus is the subject of the indirect statement. esse is infinitive and the verb of the indirect statement. And magno periculo is ablative because of the preposition, which here, is describing the army.
Very rough translation: “The gloomy centurion reported to Quintus that the army was in great danger.”
As for how to change the indirect statement into a direct statement, I am a little confused as to what you mean, but I am assuming you would just make it its own sentence. “The army was in great danger. The sad centurion reported this to Quintus.” I do apologise if I made any mistakes! But I do hope it clears things up!