Fix crashing when doing menus in multiplayer, don't let player move when in automap
This commit is contained in:
parent
e05553d802
commit
408f2ffd33
|
@ -3,6 +3,7 @@ D1X-Rebirth Changelog
|
||||||
20100131
|
20100131
|
||||||
--------
|
--------
|
||||||
main/newmenu.c: Fix memory errors, but still dynamically allocate menu and lb so it doesn't have to stay in newmenu_do4 and newmenu_listbox1 respectively
|
main/newmenu.c: Fix memory errors, but still dynamically allocate menu and lb so it doesn't have to stay in newmenu_do4 and newmenu_listbox1 respectively
|
||||||
|
main/automap.c, main/game.c, main/game.h, main/multi.c, main/multi.h, main/net_ipx.c, main/net_udp.c, main/newmenu.c: Fix crashing when doing menus in multiplayer, don't let player move when in automap
|
||||||
|
|
||||||
20100130
|
20100130
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -95,6 +95,7 @@ typedef struct automap
|
||||||
int leave_mode;
|
int leave_mode;
|
||||||
int pause_game;
|
int pause_game;
|
||||||
vms_angvec tangles;
|
vms_angvec tangles;
|
||||||
|
ushort old_wiggle; // keep 4 byte aligned
|
||||||
int max_segments_away;
|
int max_segments_away;
|
||||||
int segment_limit;
|
int segment_limit;
|
||||||
|
|
||||||
|
@ -358,6 +359,11 @@ int automap_idle(window *wind, d_event *event, automap *am)
|
||||||
vms_matrix tempm;
|
vms_matrix tempm;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
if (!am->pause_game) {
|
||||||
|
ConsoleObject->mtype.phys_info.flags |= am->old_wiggle; // Restore wiggle
|
||||||
|
Controls = am->saved_control_info; // Restore controls
|
||||||
|
}
|
||||||
|
|
||||||
if ( am->leave_mode==0 && Controls.automap_state && (timer_get_fixed_seconds()-am->entry_time)>LEAVE_TIME)
|
if ( am->leave_mode==0 && Controls.automap_state && (timer_get_fixed_seconds()-am->entry_time)>LEAVE_TIME)
|
||||||
am->leave_mode = 1;
|
am->leave_mode = 1;
|
||||||
|
|
||||||
|
@ -367,16 +373,6 @@ int automap_idle(window *wind, d_event *event, automap *am)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!am->pause_game) {
|
|
||||||
ushort old_wiggle;
|
|
||||||
am->saved_control_info = Controls; // Save controls so we can zero them
|
|
||||||
memset(&Controls,0,sizeof(control_info)); // Clear everything...
|
|
||||||
old_wiggle = ConsoleObject->mtype.phys_info.flags & PF_WIGGLE; // Save old wiggle
|
|
||||||
ConsoleObject->mtype.phys_info.flags &= ~PF_WIGGLE; // Turn off wiggle
|
|
||||||
ConsoleObject->mtype.phys_info.flags |= old_wiggle; // Restore wiggle
|
|
||||||
Controls = am->saved_control_info;
|
|
||||||
}
|
|
||||||
|
|
||||||
controls_read_all(1);
|
controls_read_all(1);
|
||||||
|
|
||||||
if ( Controls.automap_down_count ) {
|
if ( Controls.automap_down_count ) {
|
||||||
|
@ -502,6 +498,13 @@ int automap_idle(window *wind, d_event *event, automap *am)
|
||||||
}
|
}
|
||||||
am->t1 = am->t2;
|
am->t1 = am->t2;
|
||||||
|
|
||||||
|
if (!am->pause_game) {
|
||||||
|
am->saved_control_info = Controls; // Save controls so we can zero them
|
||||||
|
memset(&Controls,0,sizeof(control_info)); // Clear everything...
|
||||||
|
am->old_wiggle = ConsoleObject->mtype.phys_info.flags & PF_WIGGLE; // Save old wiggle
|
||||||
|
ConsoleObject->mtype.phys_info.flags &= ~PF_WIGGLE; // Turn off wiggle
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
main/game.c
22
main/game.c
|
@ -1106,8 +1106,23 @@ extern void check_create_player_path(void);
|
||||||
|
|
||||||
extern int Do_appearance_effect;
|
extern int Do_appearance_effect;
|
||||||
|
|
||||||
|
void game_leave_menus(void)
|
||||||
|
{
|
||||||
|
window *wind;
|
||||||
|
|
||||||
|
if (!Game_wind)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (wind = window_get_next(Game_wind); wind != NULL; wind = window_get_next(wind))
|
||||||
|
window_close(wind);
|
||||||
|
}
|
||||||
|
|
||||||
void GameProcessFrame(void)
|
void GameProcessFrame(void)
|
||||||
{
|
{
|
||||||
|
fix player_shields = Players[Player_num].shields;
|
||||||
|
int was_fuelcen_destroyed = Control_center_destroyed;
|
||||||
|
int player_was_dead = Player_is_dead;
|
||||||
|
|
||||||
update_player_stats();
|
update_player_stats();
|
||||||
diminish_palette_towards_normal(); // Should leave palette effect up for as long as possible by putting right before render.
|
diminish_palette_towards_normal(); // Should leave palette effect up for as long as possible by putting right before render.
|
||||||
do_cloak_stuff();
|
do_cloak_stuff();
|
||||||
|
@ -1218,6 +1233,13 @@ void GameProcessFrame(void)
|
||||||
create_player_appearance_effect(ConsoleObject);
|
create_player_appearance_effect(ConsoleObject);
|
||||||
Do_appearance_effect = 0;
|
Do_appearance_effect = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if we have to close in-game menus for multiplayer
|
||||||
|
if (Endlevel_sequence || (Player_is_dead != player_was_dead) || (Players[Player_num].shields < player_shields))
|
||||||
|
game_leave_menus();
|
||||||
|
|
||||||
|
if ((Control_center_destroyed && !was_fuelcen_destroyed) || ((Control_center_destroyed) && (Fuelcen_seconds_left < 10)))
|
||||||
|
game_leave_menus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
|
@ -200,6 +200,7 @@ extern grs_canvas VR_screen_sub_pages[2]; // Two sub pages of VRAM if paging is
|
||||||
|
|
||||||
void game_init_render_buffers (int render_max_w, int render_max_h, int render_method);
|
void game_init_render_buffers (int render_max_w, int render_max_h, int render_method);
|
||||||
void game_do_render_frame(int flip);
|
void game_do_render_frame(int flip);
|
||||||
|
void game_leave_menus(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
43
main/multi.c
43
main/multi.c
|
@ -722,8 +722,6 @@ void multi_do_protocol_frame(int force, int listen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int multi_menu_check(void);
|
|
||||||
|
|
||||||
void multi_do_frame(void)
|
void multi_do_frame(void)
|
||||||
{
|
{
|
||||||
if (!(Game_mode & GM_MULTI) || Newdemo_state == ND_STATE_PLAYBACK)
|
if (!(Game_mode & GM_MULTI) || Newdemo_state == ND_STATE_PLAYBACK)
|
||||||
|
@ -734,8 +732,6 @@ void multi_do_frame(void)
|
||||||
|
|
||||||
multi_send_message(); // Send any waiting messages
|
multi_send_message(); // Send any waiting messages
|
||||||
|
|
||||||
multi_menu_check();
|
|
||||||
|
|
||||||
if (Game_mode & GM_MULTI_ROBOTS)
|
if (Game_mode & GM_MULTI_ROBOTS)
|
||||||
{
|
{
|
||||||
multi_check_robot_timeout();
|
multi_check_robot_timeout();
|
||||||
|
@ -933,43 +929,6 @@ void multi_send_endlevel_packet()
|
||||||
// the state of the game in some way.
|
// the state of the game in some way.
|
||||||
//
|
//
|
||||||
|
|
||||||
void multi_leave_menus(void)
|
|
||||||
{
|
|
||||||
window *wind;
|
|
||||||
|
|
||||||
for (wind = window_get_front(); wind != Game_wind; wind = window_get_front())
|
|
||||||
if (!window_close(wind)) // Uh-oh! Close cancelled.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
static fix old_shields = 400*F1_0;
|
|
||||||
static int was_fuelcen_destroyed = 1;
|
|
||||||
static int player_was_dead;
|
|
||||||
|
|
||||||
int multi_menu_check(void)
|
|
||||||
{
|
|
||||||
// Check if we have to close in-game menus for multiplayer
|
|
||||||
|
|
||||||
if (! ((Game_mode & GM_MULTI) && (Function_mode == FMODE_GAME)) )
|
|
||||||
return(0);
|
|
||||||
|
|
||||||
if (Endlevel_sequence || (Control_center_destroyed && !was_fuelcen_destroyed) || (Player_is_dead != player_was_dead) || (Players[Player_num].shields < old_shields))
|
|
||||||
{
|
|
||||||
multi_leave_menus();
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
if ((Control_center_destroyed) && (Fuelcen_seconds_left < 10))
|
|
||||||
{
|
|
||||||
multi_leave_menus();
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
old_shields = Players[Player_num].shields;
|
|
||||||
was_fuelcen_destroyed = Control_center_destroyed;
|
|
||||||
player_was_dead = Player_is_dead;
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
multi_define_macro(int key)
|
multi_define_macro(int key)
|
||||||
{
|
{
|
||||||
|
@ -2724,7 +2683,7 @@ void multi_consistency_error(int reset)
|
||||||
Function_mode = FMODE_GAME;
|
Function_mode = FMODE_GAME;
|
||||||
count = 0;
|
count = 0;
|
||||||
multi_quit_game = 1;
|
multi_quit_game = 1;
|
||||||
multi_leave_menus();
|
game_leave_menus();
|
||||||
multi_reset_stuff();
|
multi_reset_stuff();
|
||||||
Function_mode = FMODE_MENU;
|
Function_mode = FMODE_MENU;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,6 @@ int multi_endlevel_poll1();
|
||||||
int multi_endlevel_poll2( newmenu *menu, d_event *event, void *userdata );
|
int multi_endlevel_poll2( newmenu *menu, d_event *event, void *userdata );
|
||||||
void multi_send_endlevel_packet();
|
void multi_send_endlevel_packet();
|
||||||
void multi_leave_game(void);
|
void multi_leave_game(void);
|
||||||
void multi_leave_menus(void);
|
|
||||||
void multi_process_data(char *dat, int len);
|
void multi_process_data(char *dat, int len);
|
||||||
void multi_process_bigdata(char *buf, int len);
|
void multi_process_bigdata(char *buf, int len);
|
||||||
void multi_do_death(int objnum);
|
void multi_do_death(int objnum);
|
||||||
|
|
|
@ -1880,7 +1880,7 @@ void net_ipx_process_dump(IPX_sequence_packet *their)
|
||||||
nm_messagebox(NULL, 1, TXT_OK, "%s has kicked you out!",their->player.callsign);
|
nm_messagebox(NULL, 1, TXT_OK, "%s has kicked you out!",their->player.callsign);
|
||||||
Function_mode = FMODE_GAME;
|
Function_mode = FMODE_GAME;
|
||||||
multi_quit_game = 1;
|
multi_quit_game = 1;
|
||||||
multi_leave_menus();
|
game_leave_menus();
|
||||||
multi_reset_stuff();
|
multi_reset_stuff();
|
||||||
Function_mode = FMODE_MENU;
|
Function_mode = FMODE_MENU;
|
||||||
}
|
}
|
||||||
|
|
|
@ -686,7 +686,7 @@ net_udp_disconnect_player(int playernum)
|
||||||
nm_messagebox(NULL, 1, TXT_OK, "Game was closed by host!");
|
nm_messagebox(NULL, 1, TXT_OK, "Game was closed by host!");
|
||||||
Function_mode = FMODE_GAME;
|
Function_mode = FMODE_GAME;
|
||||||
multi_quit_game = 1;
|
multi_quit_game = 1;
|
||||||
multi_leave_menus();
|
game_leave_menus();
|
||||||
multi_reset_stuff();
|
multi_reset_stuff();
|
||||||
Function_mode = FMODE_MENU;
|
Function_mode = FMODE_MENU;
|
||||||
}
|
}
|
||||||
|
@ -1888,7 +1888,7 @@ void net_udp_process_dump(ubyte *data, int len, struct _sockaddr sender_addr)
|
||||||
nm_messagebox(NULL, 1, TXT_OK, "%s has kicked you out!",Players[0].callsign);
|
nm_messagebox(NULL, 1, TXT_OK, "%s has kicked you out!",Players[0].callsign);
|
||||||
Function_mode = FMODE_GAME;
|
Function_mode = FMODE_GAME;
|
||||||
multi_quit_game = 1;
|
multi_quit_game = 1;
|
||||||
multi_leave_menus();
|
game_leave_menus();
|
||||||
multi_reset_stuff();
|
multi_reset_stuff();
|
||||||
Function_mode = FMODE_MENU;
|
Function_mode = FMODE_MENU;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1232,6 +1232,13 @@ int newmenu_handler(window *wind, d_event *event, newmenu *menu)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVENT_WINDOW_CLOSE:
|
case EVENT_WINDOW_CLOSE:
|
||||||
|
if (!menu->done)
|
||||||
|
{
|
||||||
|
menu->citem = -1;
|
||||||
|
menu->done = 1;
|
||||||
|
return 1; // cancel close and do it in newmenu_do4 instead
|
||||||
|
}
|
||||||
|
|
||||||
newmenu_hide_cursor();
|
newmenu_hide_cursor();
|
||||||
game_flush_inputs();
|
game_flush_inputs();
|
||||||
|
|
||||||
|
@ -1934,6 +1941,13 @@ int listbox_handler(window *wind, d_event *event, listbox *lb)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVENT_WINDOW_CLOSE:
|
case EVENT_WINDOW_CLOSE:
|
||||||
|
if (!lb->done)
|
||||||
|
{
|
||||||
|
lb->citem = -1;
|
||||||
|
lb->done = 1;
|
||||||
|
return 1; // cancel close and do it in newmenu_listbox1 instead
|
||||||
|
}
|
||||||
|
|
||||||
newmenu_hide_cursor();
|
newmenu_hide_cursor();
|
||||||
d_free(lb);
|
d_free(lb);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue