Rename MessageBox to ui_messagebox to avoid a conflict with Windows' MessageBox

This commit is contained in:
Chris Taylor 2012-04-17 16:02:32 +08:00
parent 7971e8cff8
commit 7b9f0f8d17
14 changed files with 42 additions and 41 deletions

View file

@ -7,6 +7,7 @@ editor/med.c: Reset the player object for the editor, since demo playback mucks
main/render.c: Skip rendering of OBJ_NONE objects to avoid a failed Assert (can happen when playing a demo then going to the editor) main/render.c: Skip rendering of OBJ_NONE objects to avoid a failed Assert (can happen when playing a demo then going to the editor)
main/newdemo.c: Set object lifeleft to IMMORTAL_TIME if the byte read in demo playback is -1. This allows the objects to stay when playing a demo, going to the editor then playing the game from the editor main/newdemo.c: Set object lifeleft to IMMORTAL_TIME if the byte read in demo playback is -1. This allows the objects to stay when playing a demo, going to the editor then playing the game from the editor
main/newdemo.c: Call free_mission() if a demo is corrupt, so the editor doesn't load a corrupt level main/newdemo.c: Call free_mission() if a demo is corrupt, so the editor doesn't load a corrupt level
editor/group.c, editor/kgame.c, editor/khelp.c, editor/kmine.c, editor/macro.c, editor/med.c, editor/medwall.c, editor/mine.c, include/ui.h, ui/file.c, ui/keypad.c, ui/menubar.c, ui/message.c: Rename MessageBox to ui_messagebox to avoid a conflict with Windows' MessageBox
20120416 20120416
-------- --------

View file

@ -551,7 +551,7 @@ int med_copy_group(int delta_flag, segment *base_seg, int base_side, segment *gr
} }
if (num_groups == MAX_GROUPS) { if (num_groups == MAX_GROUPS) {
x = MessageBox( -2, -2, 2, "Warning: You have reached the MAXIMUM group number limit. Continue?", "No", "Yes" ); x = ui_messagebox( -2, -2, 2, "Warning: You have reached the MAXIMUM group number limit. Continue?", "No", "Yes" );
if (x==1) if (x==1)
return 0; return 0;
} }
@ -1058,7 +1058,7 @@ int med_save_group( char *filename, int *vertex_ids, short *segment_ids, int num
if (!SaveFile) if (!SaveFile)
{ {
sprintf( ErrorMessage, "ERROR: Unable to open %s\n", filename ); sprintf( ErrorMessage, "ERROR: Unable to open %s\n", filename );
MessageBox( -2, -2, 1, ErrorMessage, "Ok" ); ui_messagebox( -2, -2, 1, ErrorMessage, "Ok" );
return 1; return 1;
} }
@ -1198,7 +1198,7 @@ int med_load_group( char *filename, int *vertex_ids, short *segment_ids, int *nu
if (!LoadFile) if (!LoadFile)
{ {
sprintf( ErrorMessage, "ERROR: Unable to open %s\n", filename ); sprintf( ErrorMessage, "ERROR: Unable to open %s\n", filename );
MessageBox( -2, -2, 1, ErrorMessage, "Ok" ); ui_messagebox( -2, -2, 1, ErrorMessage, "Ok" );
return 1; return 1;
} }
@ -1236,13 +1236,13 @@ int med_load_group( char *filename, int *vertex_ids, short *segment_ids, int *nu
"with the current expected version %d groups.", \ "with the current expected version %d groups.", \
filename, group_top_fileinfo.fileinfo_version, MINE_VERSION ); filename, group_top_fileinfo.fileinfo_version, MINE_VERSION );
if (MessageBox( -2, -2, 2, ErrorMessage, "Forget it", "Try anyway" )==1) if (ui_messagebox( -2, -2, 2, ErrorMessage, "Forget it", "Try anyway" )==1)
{ {
PHYSFS_close( LoadFile ); PHYSFS_close( LoadFile );
return 1; return 1;
} }
MessageBox( -2, -2, 1, "Good luck!", "I need it" ); ui_messagebox( -2, -2, 1, "Good luck!", "I need it" );
} }
// Now, Read in the fileinfo // Now, Read in the fileinfo
@ -1462,7 +1462,7 @@ int SaveGroup()
if (current_group == -1) if (current_group == -1)
{ {
sprintf( ErrorMessage, "ERROR: No current group." ); sprintf( ErrorMessage, "ERROR: No current group." );
MessageBox( -2, -2, 1, ErrorMessage, "Ok" ); ui_messagebox( -2, -2, 1, ErrorMessage, "Ok" );
return 0; return 0;
} }
@ -1503,7 +1503,7 @@ int LoadGroup()
if (num_groups == MAX_GROUPS) if (num_groups == MAX_GROUPS)
{ {
x = MessageBox( -2, -2, 2, "Warning: You are about to wipe out a group.", "ARGH! NO!", "No problemo." ); x = ui_messagebox( -2, -2, 2, "Warning: You are about to wipe out a group.", "ARGH! NO!", "No problemo." );
if (x==1) return 0; if (x==1) return 0;
} }
@ -1752,7 +1752,7 @@ int SubtractFromGroup(void)
autosave_mine(mine_filename); autosave_mine(mine_filename);
if (num_groups == MAX_GROUPS) { if (num_groups == MAX_GROUPS) {
x = MessageBox( -2, -2, 2, "Warning: You are about to wipe out a group.", "ARGH! NO!", "No problemo." ); x = ui_messagebox( -2, -2, 2, "Warning: You are about to wipe out a group.", "ARGH! NO!", "No problemo." );
if (x==1) return 0; if (x==1) return 0;
} }
@ -1840,7 +1840,7 @@ int CreateGroup(void)
autosave_mine(mine_filename); autosave_mine(mine_filename);
if (num_groups == MAX_GROUPS) { if (num_groups == MAX_GROUPS) {
x = MessageBox( -2, -2, 2, "Warning: You are about to wipe out a group.", "ARGH! NO!", "No problemo." ); x = ui_messagebox( -2, -2, 2, "Warning: You are about to wipe out a group.", "ARGH! NO!", "No problemo." );
if (x==1) if (x==1)
return 0; // Aborting at user's request. return 0; // Aborting at user's request.
} }

View file

@ -92,7 +92,7 @@ int SaveGameData()
if (gamestate_not_restored) { if (gamestate_not_restored) {
sprintf( Message, "Game State has not been restored...\nContinue?\n"); sprintf( Message, "Game State has not been restored...\nContinue?\n");
if (MessageBox( -2, -2, 2, Message, "NO", "Yes" )==1) if (ui_messagebox( -2, -2, 2, Message, "NO", "Yes" )==1)
return 0; return 0;
} }

View file

@ -129,21 +129,21 @@ int DoHelp()
int more_key = 2; int more_key = 2;
while (help_key > 1) while (help_key > 1)
{ {
help_key = MessageBox( -2, -2, 5, MainHelpText, "Ok", "Segment", "Keypad", "View", "More"); help_key = ui_messagebox( -2, -2, 5, MainHelpText, "Ok", "Segment", "Keypad", "View", "More");
if (help_key == 2) if (help_key == 2)
MessageBox( -2, -2, 1, SegmentHelpText, "Ok" ); ui_messagebox( -2, -2, 1, SegmentHelpText, "Ok" );
if (help_key == 3) if (help_key == 3)
MessageBox( -2, -2, 1, KeyPadHelpText, "Ok" ); ui_messagebox( -2, -2, 1, KeyPadHelpText, "Ok" );
if (help_key == 4) if (help_key == 4)
MessageBox( -2, -2, 1, ViewHelpText, "Ok" ); ui_messagebox( -2, -2, 1, ViewHelpText, "Ok" );
if (help_key == 5) { if (help_key == 5) {
more_key = MessageBox( -2, -2, 4, MainHelpText, "Back", "Curve", "Macro", "Game"); more_key = ui_messagebox( -2, -2, 4, MainHelpText, "Back", "Curve", "Macro", "Game");
if (more_key == 2) if (more_key == 2)
MessageBox( -2, -2, 1, CurveHelpText, "Ok" ); ui_messagebox( -2, -2, 1, CurveHelpText, "Ok" );
if (help_key == 3) if (help_key == 3)
MessageBox( -2, -2, 1, MacrosHelpText, "Ok" ); ui_messagebox( -2, -2, 1, MacrosHelpText, "Ok" );
if (help_key == 4) if (help_key == 4)
MessageBox( -2, -2, 1, GameHelpText, "Ok" ); ui_messagebox( -2, -2, 1, GameHelpText, "Ok" );
} }
} }
return 1; return 1;

View file

@ -92,7 +92,7 @@ int SaveMine()
char ErrorMessage[200]; char ErrorMessage[200];
sprintf( ErrorMessage, "Save Mine not available in demo version.\n"); sprintf( ErrorMessage, "Save Mine not available in demo version.\n");
MessageBox( -2, -2, 1, ErrorMessage, "Ok" ); ui_messagebox( -2, -2, 1, ErrorMessage, "Ok" );
return 1; return 1;
} }
#endif #endif
@ -191,7 +191,7 @@ int med_save_situation(char * filename)
char ErrorMessage[200]; char ErrorMessage[200];
sprintf( ErrorMessage, "ERROR: Unable to open %s\n", filename ); sprintf( ErrorMessage, "ERROR: Unable to open %s\n", filename );
MessageBox( -2, -2, 1, ErrorMessage, "Ok" ); ui_messagebox( -2, -2, 1, ErrorMessage, "Ok" );
return 1; return 1;
} }

View file

@ -97,7 +97,7 @@ int MacroSave()
if (MacroNumEvents < 1 ) if (MacroNumEvents < 1 )
{ {
MessageBox( -2, -2, 1, "No macro has been defined to save!", "Oops" ); ui_messagebox( -2, -2, 1, "No macro has been defined to save!", "Oops" );
return 1; return 1;
} }

View file

@ -477,7 +477,7 @@ void init_editor()
int ShowAbout() int ShowAbout()
{ {
MessageBox( -2, -2, 1, "INFERNO Mine Editor\n\n" \ ui_messagebox( -2, -2, 1, "INFERNO Mine Editor\n\n" \
"Copyright (c) 1993 Parallax Software Corp.", "Copyright (c) 1993 Parallax Software Corp.",
"OK"); "OK");
return 0; return 0;
@ -925,7 +925,7 @@ void med_show_warning(char *s)
//gr_pal_fade_in(grd_curscreen->pal); //in case palette is blacked //gr_pal_fade_in(grd_curscreen->pal); //in case palette is blacked
MessageBox(-2,-2,1,s,"OK"); ui_messagebox(-2,-2,1,s,"OK");
gr_set_current_canvas(save_canv); gr_set_current_canvas(save_canv);
@ -1046,7 +1046,7 @@ void gamestate_restore_check()
if (gamestate_not_restored) { if (gamestate_not_restored) {
sprintf( Message, "Do you wish to restore game state?\n"); sprintf( Message, "Do you wish to restore game state?\n");
if (MessageBox( -2, -2, 2, Message, "Yes", "No" )==1) { if (ui_messagebox( -2, -2, 2, Message, "Yes", "No" )==1) {
// Save current position // Save current position
Save_position.pos = ConsoleObject->pos; Save_position.pos = ConsoleObject->pos;

View file

@ -1055,7 +1055,7 @@ int check_walls()
if (wall_count != Num_walls) { if (wall_count != Num_walls) {
sprintf( Message, "Num_walls is bogus\nDo you wish to correct it?\n"); sprintf( Message, "Num_walls is bogus\nDo you wish to correct it?\n");
if (MessageBox( -2, -2, 2, Message, "Yes", "No" )==1) { if (ui_messagebox( -2, -2, 2, Message, "Yes", "No" )==1) {
Num_walls = wall_count; Num_walls = wall_count;
editor_status("Num_walls set to %d\n", Num_walls); editor_status("Num_walls set to %d\n", Num_walls);
} }
@ -1066,7 +1066,7 @@ int check_walls()
if ((Walls[CountedWalls[w].wallnum].segnum != CountedWalls[w].segnum) || if ((Walls[CountedWalls[w].wallnum].segnum != CountedWalls[w].segnum) ||
(Walls[CountedWalls[w].wallnum].sidenum != CountedWalls[w].sidenum)) { (Walls[CountedWalls[w].wallnum].sidenum != CountedWalls[w].sidenum)) {
sprintf( Message, "Unmatched wall detected\nDo you wish to correct it?\n"); sprintf( Message, "Unmatched wall detected\nDo you wish to correct it?\n");
if (MessageBox( -2, -2, 2, Message, "Yes", "No" )==1) { if (ui_messagebox( -2, -2, 2, Message, "Yes", "No" )==1) {
Walls[CountedWalls[w].wallnum].segnum = CountedWalls[w].segnum; Walls[CountedWalls[w].wallnum].segnum = CountedWalls[w].segnum;
Walls[CountedWalls[w].wallnum].sidenum = CountedWalls[w].sidenum; Walls[CountedWalls[w].wallnum].sidenum = CountedWalls[w].sidenum;
} }
@ -1080,7 +1080,7 @@ int check_walls()
if (trigger_count != Num_triggers) { if (trigger_count != Num_triggers) {
sprintf( Message, "Num_triggers is bogus\nDo you wish to correct it?\n"); sprintf( Message, "Num_triggers is bogus\nDo you wish to correct it?\n");
if (MessageBox( -2, -2, 2, Message, "Yes", "No" )==1) { if (ui_messagebox( -2, -2, 2, Message, "Yes", "No" )==1) {
Num_triggers = trigger_count; Num_triggers = trigger_count;
editor_status("Num_triggers set to %d\n", Num_triggers); editor_status("Num_triggers set to %d\n", Num_triggers);
} }
@ -1097,7 +1097,7 @@ int delete_all_walls()
int seg, side; int seg, side;
sprintf( Message, "Are you sure that walls are hosed so\n badly that you want them ALL GONE!?\n"); sprintf( Message, "Are you sure that walls are hosed so\n badly that you want them ALL GONE!?\n");
if (MessageBox( -2, -2, 2, Message, "YES!", "No" )==1) { if (ui_messagebox( -2, -2, 2, Message, "YES!", "No" )==1) {
for (seg=0;seg<=Highest_segment_index;seg++) for (seg=0;seg<=Highest_segment_index;seg++)
for (side=0;side<MAX_SIDES_PER_SEGMENT;side++) for (side=0;side<MAX_SIDES_PER_SEGMENT;side++)
Segments[seg].sides[side].wall_num = -1; Segments[seg].sides[side].wall_num = -1;
@ -1116,7 +1116,7 @@ int delete_all_triggers()
int w; int w;
sprintf( Message, "Are you sure that triggers are hosed so\n badly that you want them ALL GONE!?\n"); sprintf( Message, "Are you sure that triggers are hosed so\n badly that you want them ALL GONE!?\n");
if (MessageBox( -2, -2, 2, Message, "YES!", "No" )==1) { if (ui_messagebox( -2, -2, 2, Message, "YES!", "No" )==1) {
for (w=0; w<Num_walls; w++) for (w=0; w<Num_walls; w++)
Walls[w].trigger=-1; Walls[w].trigger=-1;

View file

@ -73,7 +73,7 @@ int med_save_mine(char * filename)
, filename, fname); , filename, fname);
#endif #endif
sprintf( ErrorMessage, "ERROR: Unable to open %s\n", filename ); sprintf( ErrorMessage, "ERROR: Unable to open %s\n", filename );
MessageBox( -2, -2, 1, ErrorMessage, "Ok" ); ui_messagebox( -2, -2, 1, ErrorMessage, "Ok" );
return 1; return 1;
} }
@ -297,13 +297,13 @@ int save_mine_data_compiled(PHYSFS_file *SaveFile)
if (Highest_segment_index >= MAX_SEGMENTS) { if (Highest_segment_index >= MAX_SEGMENTS) {
char message[128]; char message[128];
sprintf(message, "Error: Too many segments (%i > %i) for game (not editor)", Highest_segment_index+1, MAX_SEGMENTS); sprintf(message, "Error: Too many segments (%i > %i) for game (not editor)", Highest_segment_index+1, MAX_SEGMENTS);
MessageBox( -2, -2, 1, message, "Ok" ); ui_messagebox( -2, -2, 1, message, "Ok" );
} }
if (Highest_vertex_index >= MAX_VERTICES) { if (Highest_vertex_index >= MAX_VERTICES) {
char message[128]; char message[128];
sprintf(message, "Error: Too many vertices (%i > %i) for game (not editor)", Highest_vertex_index+1, MAX_VERTICES); sprintf(message, "Error: Too many vertices (%i > %i) for game (not editor)", Highest_vertex_index+1, MAX_VERTICES);
MessageBox( -2, -2, 1, message, "Ok" ); ui_messagebox( -2, -2, 1, message, "Ok" );
} }
//=============================== Writing part ============================== //=============================== Writing part ==============================

View file

@ -227,7 +227,7 @@ extern void ui_draw_line_in( short x1, short y1, short x2, short y2 );
void ui_init(); void ui_init();
void ui_close(); void ui_close();
int MessageBox( short x, short y, int NumButtons, char * text, ... ); int ui_messagebox( short x, short y, int NumButtons, char * text, ... );
void ui_string_centered( short x, short y, char * s ); void ui_string_centered( short x, short y, char * s );
int PopupMenu( int NumItems, char * text[] ); int PopupMenu( int NumItems, char * text[] );
@ -326,7 +326,7 @@ extern unsigned int ui_event_counter;
int ui_get_file( char * filename, char * Filespec ); int ui_get_file( char * filename, char * Filespec );
int MessageBoxN( short xc, short yc, int NumButtons, char * text, char * Button[] ); int ui_messagebox_n( short xc, short yc, int NumButtons, char * text, char * Button[] );
void ui_draw_icon( UI_GADGET_ICON * icon ); void ui_draw_icon( UI_GADGET_ICON * icon );
int ui_icon_do( UI_DIALOG *dlg, UI_GADGET_ICON * icon, struct d_event *event ); int ui_icon_do( UI_DIALOG *dlg, UI_GADGET_ICON * icon, struct d_event *event );

View file

@ -152,7 +152,7 @@ static int browser_handler(UI_DIALOG *dlg, d_event *event, browser *b)
if (GADGET_PRESSED(b->help_button)) if (GADGET_PRESSED(b->help_button))
{ {
MessageBox( -1, -1, 1, "Sorry, no help is available!", "Ok" ); ui_messagebox( -1, -1, 1, "Sorry, no help is available!", "Ok" );
rval = 1; rval = 1;
} }
@ -301,7 +301,7 @@ int ui_get_filename( char * filename, char * filespec, char * message )
return 0; return 0;
} }
//MessageBox( -2,-2, 1,"DEBUG:0", "Ok" ); //ui_messagebox( -2,-2, 1,"DEBUG:0", "Ok" );
for (i=0; i<35; i++) for (i=0; i<35; i++)
b->spaces[i] = ' '; b->spaces[i] = ' ';
b->spaces[34] = 0; b->spaces[34] = 0;

View file

@ -518,7 +518,7 @@ void ui_pad_read( int n, char * filename )
} else if (keycode==-1) } else if (keycode==-1)
{ {
Error( "Unknown keystroke, %s, in %s\n", text, filename ); Error( "Unknown keystroke, %s, in %s\n", text, filename );
//MessageBox( -2, -2, 1, buffer, "Ok" ); //ui_messagebox( -2, -2, 1, buffer, "Ok" );
} else { } else {
KeyPad[n]->keycode[KeyPad[n]->numkeys] = keycode; KeyPad[n]->keycode[KeyPad[n]->numkeys] = keycode;

View file

@ -832,7 +832,7 @@ void menubar_init( char * file )
if (Menu[menu].Item[item].user_function==NULL) if (Menu[menu].Item[item].user_function==NULL)
{ {
Error( "Unknown function, %s, in %s\n", buf1, file ); Error( "Unknown function, %s, in %s\n", buf1, file );
//MessageBox( -2, -2, 1, buffer, "Ok" ); //ui_messagebox( -2, -2, 1, buffer, "Ok" );
} }
} }

View file

@ -90,7 +90,7 @@ static int messagebox_handler(UI_DIALOG *dlg, d_event *event, messagebox *m)
return 0; return 0;
} }
int MessageBoxN( short xc, short yc, int NumButtons, char * text, char * Button[] ) int ui_messagebox_n( short xc, short yc, int NumButtons, char * text, char * Button[] )
{ {
UI_DIALOG * dlg; UI_DIALOG * dlg;
messagebox *m; messagebox *m;
@ -217,7 +217,7 @@ int MessageBoxN( short xc, short yc, int NumButtons, char * text, char * Button[
} }
int MessageBox( short xc, short yc, int NumButtons, char * text, ... ) int ui_messagebox( short xc, short yc, int NumButtons, char * text, ... )
{ {
va_list marker; va_list marker;
char * Button[10]; char * Button[10];
@ -235,6 +235,6 @@ int MessageBox( short xc, short yc, int NumButtons, char * text, ... )
va_end( marker ); va_end( marker );
return MessageBoxN( xc, yc, NumButtons, text, Button ); return ui_messagebox_n( xc, yc, NumButtons, text, Button );
} }