diff --git a/src/engine/client/ec_client.c b/src/engine/client/ec_client.c index 1c8ea26dc..d6e1419a9 100644 --- a/src/engine/client/ec_client.c +++ b/src/engine/client/ec_client.c @@ -1296,7 +1296,7 @@ const DEMOPLAYBACK_INFO *client_demoplayer_getinfo() void client_demoplayer_setpos(float percent) { const DEMOREC_PLAYBACKINFO *info = demorec_playback_info(); - int point = (int)((info->seekable_points-1)*percent); + int point = (int)(info->seekable_points*percent); demorec_playback_set(point); } diff --git a/src/engine/e_demorec.c b/src/engine/e_demorec.c index 5b8885adb..051337b6b 100644 --- a/src/engine/e_demorec.c +++ b/src/engine/e_demorec.c @@ -301,7 +301,7 @@ static void scan_file() if(read_chunk_header(&chunk_type, &chunk_size, &chunk_tick)) break; - + /* read the chunk */ if(chunk_type&CHUNKTYPEFLAG_TICKMARKER) { @@ -512,9 +512,9 @@ int demorec_playback_nextframe() int demorec_playback_play() { /* fill in previous and next tick */ - while(playbackinfo.previous_tick == -1) + while(playbackinfo.previous_tick == -1 && demorec_isplaying()) do_tick(); - + /* set start info */ /*playbackinfo.start_tick = playbackinfo.previous_tick; playbackinfo.start_time = time_get();*/ @@ -553,6 +553,9 @@ int demorec_playback_update() int64 deltatime = now-playbackinfo.last_update; playbackinfo.last_update = now; + if(!demorec_isplaying()) + return 0; + if(playbackinfo.paused) { diff --git a/src/engine/server/es_server.c b/src/engine/server/es_server.c index 4e55210a6..05a989839 100644 --- a/src/engine/server/es_server.c +++ b/src/engine/server/es_server.c @@ -39,8 +39,6 @@ static int browseinfo_progression = -1; static int64 lastheartbeat; /*static NETADDR4 master_server;*/ -static IOHANDLE demorec_file = 0; - static char current_map[64]; static int current_map_crc; static unsigned char *current_map_data = 0; @@ -375,7 +373,7 @@ static void server_do_snap() } /* create snapshot for demo recording */ - if(demorec_file) + if(demorec_isrecording()) { char data[MAX_SNAPSHOT_SIZE]; int snapshot_size; diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index bc77798a1..4ee924600 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -620,6 +620,8 @@ void GAMECLIENT::on_snapshot() local_character_pos = vec2(snap.local_character->x, snap.local_character->y); } } + else + snap.spectate = true; // update render info for(int i = 0; i < MAX_CLIENTS; i++)