When talking about ongoing actions (so, the cooking dinner in the example above) Italians might use an alternative to the imperfetto: the passato progressivo, formed by
imperfetto of stare
gerund
Remember that the gerund of the verb is formed by take the infinitive of the verb, drop the ending and adding -ando / -endo, as in:
Mentre stavo preparando la cena, ho sentito un forte rumore al piano di sopra.
While I was cooking dinner, I heard a loud noise from upstairs.
Notice that the English translation doesn’t change. It’s mostly a matter of nuance in Italian. Using the passato progressivo, you’re stressing that the action was, indeed, in progress.