Skip to content

Commit f337aa1

Browse files
authored
Multiplayer: add torture screen back in (dkfans#4855)
1 parent ada3dd5 commit f337aa1

6 files changed

Lines changed: 18 additions & 11 deletions

File tree

src/front_lvlstats.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ void frontstats_set_timer(void)
329329

330330
void frontstats_update(void)
331331
{
332-
scrolling_offset++;
332+
scrolling_offset += game.delta_time;
333333
LbTextSetFont(frontend_font[1]);
334334
int h = LbTextLineHeight();
335335
if (h+4 < scrolling_offset)

src/front_torture.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ void fronttorture_input(void)
247247
{
248248
player = get_player(plyr_idx);
249249
pckt = get_packet(plyr_idx);
250-
if ((pckt->action != 0) && (player->victory_state == VicS_WonLevel))
250+
if (pckt->action != 0)
251251
break;
252252
}
253253
if (plyr_idx < PLAYERS_COUNT)

src/frontend.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ short old_menu_mouse_y;
416416
unsigned char menu_ids[3];
417417
unsigned char new_objective;
418418
int frontend_menu_state;
419+
int skip_high_score_screen;
419420
int load_game_scroll_offset;
420421
unsigned char video_gamma_correction;
421422

@@ -427,7 +428,7 @@ struct TbSpriteSheet * winfont = NULL;
427428
unsigned long playing_bad_descriptive_speech;
428429
unsigned long playing_good_descriptive_speech;
429430
long scrolling_index;
430-
long scrolling_offset;
431+
float scrolling_offset;
431432
long packet_left_button_double_clicked[6];
432433
long packet_left_button_click_space_count[6];
433434
char frontend_alliances;
@@ -2674,6 +2675,7 @@ FrontendMenuState frontend_setup_state(FrontendMenuState nstate)
26742675
time_last_played_demo = LbTimerClock();
26752676
fe_high_score_table_from_main_menu = true;
26762677
clear_flag(game.system_flags, GSF_NetworkActive);
2678+
skip_high_score_screen = 0;
26772679
set_pointer_graphic_menu();
26782680
break;
26792681
case FeSt_FELOAD_GAME:
@@ -3642,8 +3644,9 @@ FrontendMenuState get_menu_state_when_back_from_substate(FrontendMenuState subst
36423644
case FeSt_DRAG:
36433645
return FeSt_TORTURE;
36443646
case FeSt_LEVEL_STATS:
3645-
if (network_is_active())
3647+
if (network_is_active() || skip_high_score_screen) {
36463648
return FeSt_NET_SESSION;
3649+
}
36473650
lvnum = get_loaded_level_number();
36483651
if (is_multiplayer_level(lvnum))
36493652
return get_menu_state_based_on_last_level(lvnum);

src/frontend.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ extern short old_menu_mouse_y;
273273
extern unsigned char menu_ids[3];
274274
extern unsigned char new_objective;
275275
extern int frontend_menu_state;
276+
extern int skip_high_score_screen;
276277
extern int load_game_scroll_offset;
277278
extern unsigned char video_gamma_correction;
278279
extern MenuID vid_change_query_menu;
@@ -287,7 +288,7 @@ extern struct TbSpriteSheet *winfont;
287288
extern unsigned long playing_bad_descriptive_speech;
288289
extern unsigned long playing_good_descriptive_speech;
289290
extern long scrolling_index;
290-
extern long scrolling_offset;
291+
extern float scrolling_offset;
291292
extern long packet_left_button_double_clicked[6];
292293
extern long packet_left_button_click_space_count[6];
293294
extern char frontend_alliances;

src/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ TbBool should_use_delta_time_on_menu()
245245
case FeSt_NET_SERVICE: /**< Network service selection, where player can select Serial/Modem/IPX/TCP IP/1 player. */
246246
case FeSt_NET_SESSION: /**< Network session selection screen, where list of games is displayed, with possibility to join or create own game. */
247247
case FeSt_NET_START: /**< Network game start screen (the menu with chat), when created new session or joined existing session. */
248+
case FeSt_LEVEL_STATS:
248249
case FeSt_HIGH_SCORES:
249250
case FeSt_FEDEFINE_KEYS:
250251
case FeSt_FEOPTIONS:
@@ -3883,6 +3884,7 @@ static TbBool wait_at_frontend(void)
38833884
break;
38843885
case FeSt_START_MPLEVEL:
38853886
set_flag(game.system_flags, GSF_NetworkActive);
3887+
skip_high_score_screen = 1;
38863888
game.game_kind = GKind_MultiGame;
38873889
player = get_my_player();
38883890
player->is_active = 1;

src/packets.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -646,20 +646,21 @@ TbBool process_players_global_packet_action(PlayerNumber plyr_idx)
646646
free_swipe_graphic();
647647
}
648648
if (network_is_active()) {
649+
if (victory_state == VicS_WonLevel) {
650+
player->victory_state = VicS_WonLevel;
651+
get_my_player()->additional_flags |= PlaAF_UnlockedLordTorture;
652+
quit_game = 1;
653+
return 0;
654+
}
649655
TbBool host_packet = player->packet_num == get_host_player_id();
650656
if (!my_player) {
651-
if ((victory_state == VicS_WonLevel) || (host_packet && (player->victory_state != VicS_LostLevel))) {
657+
if (host_packet && (player->victory_state != VicS_LostLevel)) {
652658
get_my_player()->additional_flags &= ~PlaAF_UnlockedLordTorture;
653659
quit_game = 1;
654660
}
655661
return 0;
656662
} else if (host_packet && (victory_state == VicS_LostLevel) && network_human_contenders_remain()) {
657663
return 0;
658-
} else if (host_packet && (victory_state == VicS_WonLevel)) {
659-
player->additional_flags &= ~PlaAF_UnlockedLordTorture;
660-
LbNetwork_Stop();
661-
quit_game = 1;
662-
return 0;
663664
}
664665
}
665666
switch (victory_state)

0 commit comments

Comments
 (0)