diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 73b30ecd5..ee0335cc3 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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/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 +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 -------- diff --git a/editor/group.c b/editor/group.c index 5d3f3aecf..79d85dce4 100644 --- a/editor/group.c +++ b/editor/group.c @@ -551,7 +551,7 @@ int med_copy_group(int delta_flag, segment *base_seg, int base_side, segment *gr } 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) return 0; } @@ -1058,7 +1058,7 @@ int med_save_group( char *filename, int *vertex_ids, short *segment_ids, int num if (!SaveFile) { sprintf( ErrorMessage, "ERROR: Unable to open %s\n", filename ); - MessageBox( -2, -2, 1, ErrorMessage, "Ok" ); + ui_messagebox( -2, -2, 1, ErrorMessage, "Ok" ); return 1; } @@ -1198,7 +1198,7 @@ int med_load_group( char *filename, int *vertex_ids, short *segment_ids, int *nu if (!LoadFile) { sprintf( ErrorMessage, "ERROR: Unable to open %s\n", filename ); - MessageBox( -2, -2, 1, ErrorMessage, "Ok" ); + ui_messagebox( -2, -2, 1, ErrorMessage, "Ok" ); 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.", \ 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 ); 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 @@ -1462,7 +1462,7 @@ int SaveGroup() if (current_group == -1) { sprintf( ErrorMessage, "ERROR: No current group." ); - MessageBox( -2, -2, 1, ErrorMessage, "Ok" ); + ui_messagebox( -2, -2, 1, ErrorMessage, "Ok" ); return 0; } @@ -1503,7 +1503,7 @@ int LoadGroup() 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; } @@ -1752,7 +1752,7 @@ int SubtractFromGroup(void) autosave_mine(mine_filename); 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; } @@ -1840,7 +1840,7 @@ int CreateGroup(void) autosave_mine(mine_filename); 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; // Aborting at user's request. } diff --git a/editor/kgame.c b/editor/kgame.c index e0818c8ed..f57d99ba4 100644 --- a/editor/kgame.c +++ b/editor/kgame.c @@ -92,7 +92,7 @@ int SaveGameData() if (gamestate_not_restored) { 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; } diff --git a/editor/khelp.c b/editor/khelp.c index 9b558dcd6..8d90a52f9 100644 --- a/editor/khelp.c +++ b/editor/khelp.c @@ -129,21 +129,21 @@ int DoHelp() int more_key = 2; 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) - MessageBox( -2, -2, 1, SegmentHelpText, "Ok" ); + ui_messagebox( -2, -2, 1, SegmentHelpText, "Ok" ); if (help_key == 3) - MessageBox( -2, -2, 1, KeyPadHelpText, "Ok" ); + ui_messagebox( -2, -2, 1, KeyPadHelpText, "Ok" ); if (help_key == 4) - MessageBox( -2, -2, 1, ViewHelpText, "Ok" ); + ui_messagebox( -2, -2, 1, ViewHelpText, "Ok" ); 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) - MessageBox( -2, -2, 1, CurveHelpText, "Ok" ); + ui_messagebox( -2, -2, 1, CurveHelpText, "Ok" ); if (help_key == 3) - MessageBox( -2, -2, 1, MacrosHelpText, "Ok" ); + ui_messagebox( -2, -2, 1, MacrosHelpText, "Ok" ); if (help_key == 4) - MessageBox( -2, -2, 1, GameHelpText, "Ok" ); + ui_messagebox( -2, -2, 1, GameHelpText, "Ok" ); } } return 1; diff --git a/editor/kmine.c b/editor/kmine.c index b2fa02e97..212cc0a91 100644 --- a/editor/kmine.c +++ b/editor/kmine.c @@ -92,7 +92,7 @@ int SaveMine() char ErrorMessage[200]; 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; } #endif @@ -191,7 +191,7 @@ int med_save_situation(char * filename) char ErrorMessage[200]; sprintf( ErrorMessage, "ERROR: Unable to open %s\n", filename ); - MessageBox( -2, -2, 1, ErrorMessage, "Ok" ); + ui_messagebox( -2, -2, 1, ErrorMessage, "Ok" ); return 1; } diff --git a/editor/macro.c b/editor/macro.c index 498225a7a..524f57860 100644 --- a/editor/macro.c +++ b/editor/macro.c @@ -97,7 +97,7 @@ int MacroSave() 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; } diff --git a/editor/med.c b/editor/med.c index 892fb887d..273208866 100644 --- a/editor/med.c +++ b/editor/med.c @@ -477,7 +477,7 @@ void init_editor() 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.", "OK"); return 0; @@ -925,7 +925,7 @@ void med_show_warning(char *s) //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); @@ -1046,7 +1046,7 @@ void gamestate_restore_check() if (gamestate_not_restored) { 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_position.pos = ConsoleObject->pos; diff --git a/editor/medwall.c b/editor/medwall.c index 90a40504d..e93779ce0 100644 --- a/editor/medwall.c +++ b/editor/medwall.c @@ -1055,7 +1055,7 @@ int check_walls() if (wall_count != Num_walls) { 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; 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) || (Walls[CountedWalls[w].wallnum].sidenum != CountedWalls[w].sidenum)) { 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].sidenum = CountedWalls[w].sidenum; } @@ -1080,7 +1080,7 @@ int check_walls() if (trigger_count != Num_triggers) { 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; editor_status("Num_triggers set to %d\n", Num_triggers); } @@ -1097,7 +1097,7 @@ int delete_all_walls() int seg, side; 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 (side=0;side= MAX_SEGMENTS) { char message[128]; 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) { char message[128]; 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 ============================== diff --git a/include/ui.h b/include/ui.h index 059fd2ba4..09ecaeda4 100644 --- a/include/ui.h +++ b/include/ui.h @@ -227,7 +227,7 @@ extern void ui_draw_line_in( short x1, short y1, short x2, short y2 ); void ui_init(); 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 ); 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 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 ); int ui_icon_do( UI_DIALOG *dlg, UI_GADGET_ICON * icon, struct d_event *event ); diff --git a/ui/file.c b/ui/file.c index 08e9a688e..f7cd39236 100644 --- a/ui/file.c +++ b/ui/file.c @@ -152,7 +152,7 @@ static int browser_handler(UI_DIALOG *dlg, d_event *event, browser *b) 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; } @@ -301,7 +301,7 @@ int ui_get_filename( char * filename, char * filespec, char * message ) return 0; } - //MessageBox( -2,-2, 1,"DEBUG:0", "Ok" ); + //ui_messagebox( -2,-2, 1,"DEBUG:0", "Ok" ); for (i=0; i<35; i++) b->spaces[i] = ' '; b->spaces[34] = 0; diff --git a/ui/keypad.c b/ui/keypad.c index c7a19b0ff..d9949fcf5 100644 --- a/ui/keypad.c +++ b/ui/keypad.c @@ -518,7 +518,7 @@ void ui_pad_read( int n, char * filename ) } else if (keycode==-1) { Error( "Unknown keystroke, %s, in %s\n", text, filename ); - //MessageBox( -2, -2, 1, buffer, "Ok" ); + //ui_messagebox( -2, -2, 1, buffer, "Ok" ); } else { KeyPad[n]->keycode[KeyPad[n]->numkeys] = keycode; diff --git a/ui/menubar.c b/ui/menubar.c index c97b20e8b..7c9b1f8c9 100644 --- a/ui/menubar.c +++ b/ui/menubar.c @@ -832,7 +832,7 @@ void menubar_init( char * file ) if (Menu[menu].Item[item].user_function==NULL) { Error( "Unknown function, %s, in %s\n", buf1, file ); - //MessageBox( -2, -2, 1, buffer, "Ok" ); + //ui_messagebox( -2, -2, 1, buffer, "Ok" ); } } diff --git a/ui/message.c b/ui/message.c index 08856d444..1262fa8e0 100644 --- a/ui/message.c +++ b/ui/message.c @@ -90,7 +90,7 @@ static int messagebox_handler(UI_DIALOG *dlg, d_event *event, messagebox *m) 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; 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; char * Button[10]; @@ -235,6 +235,6 @@ int MessageBox( short xc, short yc, int NumButtons, char * text, ... ) va_end( marker ); - return MessageBoxN( xc, yc, NumButtons, text, Button ); + return ui_messagebox_n( xc, yc, NumButtons, text, Button ); }