2929#include "bflib_filelst.h"
3030#include "bflib_dernc.h"
3131#include "bflib_keybrd.h"
32+ #include "bflib_datetm.h"
3233#include "bflib_video.h"
3334#include "bflib_vidraw.h"
3435#include "bflib_mouse.h"
@@ -61,11 +62,15 @@ static long torture_sprite_frame;
6162static long torture_door_selected ;
6263static struct DoorSoundState door_sound_state [TORTURE_DOORS_COUNT ];
6364static struct TortureState torture_state ;
65+ static TbClockMSec torture_idle_start ;
66+ static TbClockMSec torture_screen_start ;
6467static unsigned char * torture_background ;
6568static unsigned char * torture_palette ;
6669extern struct DoorDesc doors [TORTURE_DOORS_COUNT ];
6770extern struct TbSpriteSheet * fronttor_sprites ;
6871long torture_doors_available = TORTURE_DOORS_COUNT ;
72+ #define TORTURE_MULTIPLAYER_IDLE_TIMEOUT 10000
73+ #define TORTURE_MULTIPLAYER_MAX_TIME 45000
6974/******************************************************************************/
7075#ifdef __cplusplus
7176}
@@ -167,6 +172,8 @@ void fronttorture_load(void)
167172 LbMouseChangeSpriteAndHotspot (0 , 0 , 0 );
168173 }
169174 torture_left_button = 0 ;
175+ torture_idle_start = LbTimerClock ();
176+ torture_screen_start = torture_idle_start ;
170177}
171178
172179TbBool fronttorture_draw (void )
@@ -236,6 +243,18 @@ void fronttorture_input(void)
236243 pckt -> actn_par1 = GetMouseX ();
237244 pckt -> actn_par2 = GetMouseY ();
238245 }
246+ if (network_is_active ())
247+ {
248+ TbClockMSec now = LbTimerClock ();
249+ if (now - torture_idle_start >= TORTURE_MULTIPLAYER_IDLE_TIMEOUT )
250+ {
251+ pckt -> action |= 0x01 ;
252+ }
253+ if (now - torture_screen_start >= TORTURE_MULTIPLAYER_MAX_TIME )
254+ {
255+ pckt -> action |= 0x01 ;
256+ }
257+ }
239258 // Exchange packet with other players
240259 if (network_is_active ())
241260 {
@@ -254,6 +273,7 @@ void fronttorture_input(void)
254273 {
255274 x = pckt -> actn_par1 ;
256275 y = pckt -> actn_par2 ;
276+ torture_idle_start = LbTimerClock ();
257277 } else
258278 {
259279 plyr_idx = my_player_number ;
0 commit comments