Oh, there's your problem.
When you load a dialog, you've got two options.
1) A dialog box where the game keeps playing: Set a flag by pressing the "dialog button" for example, and whenever that flag is set, draw the dialog box.
//... in main
bool do_dialog_box = false;
if(key[KEY_SPACE])do_dialog_box = true;
if(key[KEY_ESC] && do_dialog_box == true)do_dialog_box = false;
if(do_dialog_box)handle_dialog_box(); //called every frame
2) A dialog box where the game is interrupted until the dialog exits. (Like pressing escape in most games.) In that case, the easiest way is to have a second game loop in the dialog itself.
That is, a call to say main_menu_dialog() goes to that function, and stays there until that dialog box's exit condition is satisfied, which calls return, and sends execution back to the main loop.
5 //do stuff in NEW loop
KEY_ESC])break; //send execution back to main loop
11// in main
handle_dialog_box(); //called once, moving execution to there.
In case #1: You have to be careful to pass input to the dialog box while it's open.
In case #2: You have to make sure you events all get handled. You don't want to go to a new function only checking keyboard events, and then end up having all of the joystick/mouse/whatever events fill up like crazy until you return.