Make a new mission when making a new mine to avoid a crash when testing it straight from the editor and winning, only create a new mine if a mission isn't loaded, if it thinks it needs to use Cursegp to fix the player object make sure Cursegp is initialised, remove key command for ToggleDrawAllSegments since add segment now has ctrl-A

This commit is contained in:
Chris Taylor 2012-04-16 16:53:32 +08:00
parent ee9f1b33db
commit fa76bc657e
8 changed files with 44 additions and 7 deletions

View file

@ -5,6 +5,7 @@ D1X-Rebirth Changelog
main/gameseq.c, main/multi.c, main/multi.h: fixed two bugs caused by recent Multiplayer cleanup: Set more player-death-related veriables outside of dead_player_end() when creating new ship as not covered in subfunction is Palyer_is_dead is not true; also init my own inventory properly in multi_prep_level to get our inventory straight after receiving netgame information
editor/data/med.mnu, editor/med.c, editor/medmisc.c, main/slew.c, ui/ui.c: Make movement in the editor's game screen use the player controls, make that movement more like the automap and resolve some likely conflicting key commands
editor/centers.c, editor/eswitch.c, editor/med.c, editor/medrobot.c, editor/medwall.c, main/game.c, main/gameseq.c: Avoid crashes when clicking on close box with a center, switch, object or wall editing dialog open; also when playing a level, going to the editor, going back to the game then dying
editor/eglobal.c, editor/med.c, main/game.c, main/gamesave.c, main/menu.c, main/mission.c, main/mission.h: Make a new mission when making a new mine to avoid a crash when testing it straight from the editor and winning, only create a new mine if a mission isn't loaded, if it thinks it needs to use Cursegp to fix the player object make sure Cursegp is initialised, remove key command for ToggleDrawAllSegments since add segment now has ctrl-A
20120415
--------

View file

@ -29,12 +29,12 @@ static char rcsid[] = "$Id: eglobal.c,v 1.1.1.1 2006/03/17 19:45:24 zicodxx Exp
// Global pointer to current vertices, right now always Vertices. Set in create_new_mine.
segment New_segment; // The segment which can be added to the mine.
segment *Cursegp; // Pointer to current segment in mine.
segment *Cursegp = NULL; // Pointer to current segment in mine.
int Curside; // Side index in 0..MAX_SIDES_PER_SEGMENT of active side.
int Curedge; // Current edge on current side, in 0..3
int Curvert; // Current vertex on current side, in 0..3
int AttachSide = WFRONT; // Side on segment to attach.
segment *Markedsegp; // Marked segment, used in conjunction with *Cursegp to form joints.
segment *Markedsegp = NULL; // Marked segment, used in conjunction with *Cursegp to form joints.
int Markedside; // Marked side on Markedsegp.
int Draw_all_segments; // Set to 1 means draw_world draws all segments in Segments, else draw only connected segments

View file

@ -843,7 +843,7 @@ void init_editor_screen()
// ui_gadget_calc_keys(EditorWindow); //make tab work for all windows
ViewIcon = ui_add_gadget_icon( EditorWindow, "Lock\nview", 455,25+530, 40, 22, KEY_V+KEY_CTRLED, ToggleLockViewToCursegp );
AllIcon = ui_add_gadget_icon( EditorWindow, "Draw\nall", 500,25+530, 40, 22, KEY_A+KEY_CTRLED, ToggleDrawAllSegments );
AllIcon = ui_add_gadget_icon( EditorWindow, "Draw\nall", 500,25+530, 40, 22, -1, ToggleDrawAllSegments );
AxesIcon = ui_add_gadget_icon( EditorWindow, "Coord\naxes",545,25+530, 40, 22, KEY_D+KEY_CTRLED, ToggleCoordAxes );
//-NOLIGHTICON- LightIcon = ui_add_gadget_icon( EditorWindow, "Light\ning", 590,25+530, 40, 22, KEY_L+KEY_SHIFTED,ToggleLighting );
ChaseIcon = ui_add_gadget_icon( EditorWindow, "Chase\nmode",635,25+530, 40, 22, -1, ToggleChaseMode );

View file

@ -938,6 +938,12 @@ window *game_setup(void)
netplayerinfo_on = 0;
#ifdef EDITOR
if (!Cursegp)
{
Cursegp = &Segments[0];
Curside = 0;
}
if (Segments[ConsoleObject->segnum].segnum == -1) //segment no longer exists
obj_relink( ConsoleObject-Objects, SEG_PTR_2_NUM(Cursegp) );

View file

@ -1327,6 +1327,8 @@ int create_new_mine(void)
ControlCenterTriggers.num_links = 0;
create_new_mission();
//editor_status("New mine created.");
return 0; // say no error
}

View file

@ -547,8 +547,11 @@ int do_option ( int select)
break;
#ifdef EDITOR
case MENU_EDITOR:
create_new_mine();
SetPlayerFromCurseg();
if (!Current_mission)
{
create_new_mine();
SetPlayerFromCurseg();
}
hide_menus();
init_editor();
@ -1765,8 +1768,11 @@ void do_sound_menu()
#endif
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "";
#ifdef USE_SDLMIXER
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "cd music / jukebox options:";
#else
m[nitems].type = NM_TYPE_TEXT; m[nitems++].text = "cd music options:";
#endif
opt_sm_redbook_playorder = nitems;
m[nitems].type = NM_TYPE_CHECK; m[nitems].text = "force mac cd track order"; m[nitems++].value = GameCfg.OrigTrackOrder;
@ -2162,4 +2168,4 @@ void do_sandbox_menu()
newmenu_do3( NULL, "Coder's sandbox", 2, m, sandbox_menuset, NULL, 0, NULL );
}
#endif
#endif

View file

@ -746,3 +746,21 @@ int select_mission(int anarchy_mode, char *message, int (*when_selected)(void))
return 1; // presume success
}
#ifdef EDITOR
void create_new_mission(void)
{
if (Current_mission)
free_mission();
Current_mission = d_malloc(sizeof(Mission));
if (!Current_mission)
return;
memset(Current_mission, 0, sizeof(Mission));
Current_mission->path = d_strdup("new_mission");
Current_mission->filename = Current_mission->path;
strcpy(Level_names[0], "GAMESAVE.LVL");
}
#endif

View file

@ -96,5 +96,9 @@ int select_mission (int anarchy_mode, char *message, int (*when_selected)(void))
void free_mission(void);
#ifdef EDITOR
void create_new_mission(void);
#endif
#endif