diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 3c4d3418d..6beb43ff6 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,7 @@ D2X-Rebirth Changelog -------- arch/include/event.h, arch/include/joy.h, arch/include/key.h, arch/include/mouse.h, arch/sdl/event.c, arch/sdl/joy.c, arch/sdl/key.c, arch/sdl/mouse.c, main/automap.c, main/endlevel.c, main/game.c, main/gamecntl.c, main/inferno.c, main/kconfig.c, main/kconfig.h, main/movie.c, main/multi.c, main/newmenu.c, main/slew.c: Added event types for all input actions; Rewrote kconfig code to work with events; static defined inputs will not trigger kconfig-mapped inputs anymore; Simplified keyboard, mouse and joystick code a lot due to event-based handling; Added function to toggle SDL key repeats on and off; Put timer_update() to event_process; Removed return when event_poll() is idle to get cursor hiding to work again; Added a small delay between cursoe hiding and re-enabling to cursor will not accidentially enable by SDL event centering cursor while hiding arch/ogl/ogl.c: After rendering Reboot reticle, reset glLineWidth to default value again +main/fireball.c, main/gameseq.c, main/net_ipx.c, main/net_udp.c: Little more smoothness for Multiplayer: Before dropping Powerups in random segment, make sure it's accessible by the player who drops it; Got rid of goto in InitPlayerPositions() and made code more D2-ish; Allow host to send 50 object/extra packets per second which does not overload network stack, yet but speeds up joining 20110126 -------- diff --git a/main/fireball.c b/main/fireball.c index 2872505f4..e3ea50a0a 100644 --- a/main/fireball.c +++ b/main/fireball.c @@ -506,8 +506,7 @@ int pick_connected_segment(object *objp, int max_depth) return -1; } -#ifdef NETWORK -#define BASE_NET_DROP_DEPTH 8 +#define BASE_NET_DROP_DEPTH 8 // ------------------------------------------------------------------------------------------------------ // Choose segment to drop a powerup in. @@ -574,14 +573,14 @@ int choose_drop_segment() } if (segnum == -1) { - return (d_rand() * Highest_segment_index) >> 15; + while (cur_drop_depth > 0 && segnum == -1) // before dropping in random segment, try to find ANY segment which is connected to the player responsible for the drop so object will not spawn in inaccessible areas + segnum = pick_connected_segment(&Objects[Players[Player_num].objnum], --cur_drop_depth); + return ((segnum == -1)?((d_rand() * Highest_segment_index) >> 15):segnum); // basically it should be impossible segnum == -1 now... but oh well... } else return segnum; } -#endif // NETWORK -#ifdef NETWORK // ------------------------------------------------------------------------------------------------------ // Drop cloak powerup if in a network game. @@ -628,7 +627,6 @@ void maybe_drop_net_powerup(int powerup_type) object_create_explosion(segnum, &new_pos, i2f(5), VCLIP_POWERUP_DISAPPEARANCE ); } } -#endif // ------------------------------------------------------------------------------------------------------ // Return true if current segment contains some object. diff --git a/main/gameseq.c b/main/gameseq.c index 46fb4994d..119ddb558 100644 --- a/main/gameseq.c +++ b/main/gameseq.c @@ -1821,19 +1821,16 @@ void InitPlayerPosition(int random_flag) { int NewPlayer=0; -#ifdef NETWORK if (! ((Game_mode & GM_MULTI) && !(Game_mode&GM_MULTI_COOP)) ) // If not deathmatch -#endif NewPlayer = Player_num; -#ifdef NETWORK else if (random_flag == 1) { int i, closest = -1, trys=0; fix closest_dist = 0x7ffffff, dist; + timer_update(); + d_srand((fix)timer_query()); do { - timer_update(); - d_srand((fix)timer_query()); trys++; NewPlayer = d_rand() % NumNetPlayerPositions; @@ -1842,7 +1839,7 @@ void InitPlayerPosition(int random_flag) for (i=0; i= 0) ) { closest_dist = dist; closest = i; @@ -1850,22 +1847,19 @@ void InitPlayerPosition(int random_flag) } } - } while ( (closest_dist= 0); Assert(NewPlayer < NumNetPlayerPositions); -#endif - ConsoleObject->pos = Player_init[NewPlayer].pos; ConsoleObject->orient = Player_init[NewPlayer].orient; obj_relink(ConsoleObject-Objects,Player_init[NewPlayer].segnum); - -#ifdef NETWORK -done: -#endif reset_player_object(); reset_cruise(); } diff --git a/main/net_ipx.c b/main/net_ipx.c index aa6390db7..d94d402c5 100644 --- a/main/net_ipx.c +++ b/main/net_ipx.c @@ -1468,7 +1468,7 @@ void net_ipx_send_objects(void) int player_num = IPX_sync_player.player.connected; static fix64 last_send_time = 0; - if (last_send_time + (F1_0/10) > timer_query()) + if (last_send_time + (F1_0/50) > timer_query()) return; last_send_time = timer_query(); @@ -5205,7 +5205,7 @@ void net_ipx_send_extras () { static fix64 last_send_time = 0; - if (last_send_time + (F1_0/10) > timer_query()) + if (last_send_time + (F1_0/50) > timer_query()) return; last_send_time = timer_query(); diff --git a/main/net_udp.c b/main/net_udp.c index bd4a504a5..b9f197e44 100644 --- a/main/net_udp.c +++ b/main/net_udp.c @@ -1451,7 +1451,7 @@ void net_udp_send_objects(void) int loc = 0, i = 0, remote_objnum = 0, obj_count_frame = 0; static fix64 last_send_time = 0; - if (last_send_time + (F1_0/10) > timer_query()) + if (last_send_time + (F1_0/50) > timer_query()) return; last_send_time = timer_query(); @@ -4846,7 +4846,7 @@ void net_udp_send_extras () { static fix64 last_send_time = 0; - if (last_send_time + (F1_0/10) > timer_query()) + if (last_send_time + (F1_0/50) > timer_query()) return; last_send_time = timer_query();