Skip to content

Commit ef68855

Browse files
committed
LAN Multiplayer made accessible
1 parent 8665b3f commit ef68855

File tree

2 files changed

+50
-3
lines changed

2 files changed

+50
-3
lines changed

src/comets.c

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2294,7 +2294,6 @@ void comets_handle_game_over(int game_status)
22942294
//Adjust font size for resolution:
22952295
int fontsize = (int)(DEFAULT_MENU_FONT_SIZE * get_scale());
22962296

2297-
22982297
//For sorted list of scores:
22992298
lan_player_type sorted_scores[MAX_CLIENTS];
23002299
/* Sort scores: */
@@ -2308,6 +2307,17 @@ void comets_handle_game_over(int game_status)
23082307
qsort((void*)sorted_scores, MAX_CLIENTS, sizeof(lan_player_type), compare_scores);
23092308

23102309

2310+
//Announce the sorted Final score
2311+
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,INTERRUPT,_("Final Scores:"));
2312+
for (i = 0; i < MAX_CLIENTS; i++)
2313+
{
2314+
if(sorted_scores[i].connected)
2315+
{
2316+
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,APPEND,"%d.\t%s: %d", rank, sorted_scores[i].name, sorted_scores[i].score);
2317+
}
2318+
}
2319+
2320+
23112321
/* Begin display loop: */
23122322
do
23132323
{
@@ -4037,7 +4047,23 @@ int tts_announcer(void *unused)
40374047
}
40384048
else if(tts_announcer_switch == 2)
40394049
{
4040-
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,INTERRUPT,"Score %d!",score);
4050+
4051+
if (Opts_LanMode())
4052+
{
4053+
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,INTERRUPT,"Score Board. ");
4054+
for (i = 0; i < MAX_CLIENTS; i++)
4055+
{
4056+
if(LAN_PlayerConnected(i))
4057+
{
4058+
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,APPEND,"%s %d",LAN_PlayerName(i), LAN_PlayerScore(i));
4059+
T4K_Tts_wait();
4060+
}
4061+
}
4062+
}
4063+
else
4064+
{
4065+
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,INTERRUPT,"Score %d!",score);
4066+
}
40414067
SDL_Delay(20);
40424068
T4K_Tts_wait();
40434069
tts_announcer_switch = 1;

src/menu_lan.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ int ConnectToServer(void)
204204
if(!LAN_SetName(player_name)) //tell server nickname
205205
{
206206
ShowMessageWrap(DEFAULT_MENU_FONT_SIZE, _("Connection with server lost"));
207+
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,INTERRUPT,_("Connection with server lost"));
207208
return 0;
208209
}
209210
}
@@ -223,6 +224,7 @@ int ConnectToServer(void)
223224
int Pregame(void)
224225
{
225226
int widest = 0;
227+
int i;
226228
int status = PREGAME_WAITING;
227229
Uint32 timer = 0;
228230
const int loop_msec = 20;
@@ -250,6 +252,10 @@ int Pregame(void)
250252
notready_title = T4K_BlackOutline(_("Waiting until you are ready"), DEFAULT_MENU_FONT_SIZE, &white);
251253
ready_subtitle = T4K_BlackOutline(_("Click \"Pause\" if not ready"), DEFAULT_MENU_FONT_SIZE, &white);
252254
notready_subtitle = T4K_BlackOutline(_("Click \"Play\" when ready"), DEFAULT_MENU_FONT_SIZE, &white);
255+
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,INTERRUPT,"%s. %s. %s. Press space to announce updated table",_("Waiting for other players"), \
256+
_("Waiting until you are ready"),_("Click \"Play\" when ready"));
257+
258+
253259

254260
//Make sure we have needed surfaces:
255261
if(!stop_button || !play_surf || !pause_surf || !ready_title
@@ -342,13 +348,28 @@ int Pregame(void)
342348
}
343349
case SDLK_RETURN:
344350
case SDLK_KP_ENTER:
345-
case SDLK_SPACE:
346351
{
347352
ready = true;
348353
LAN_SetReady(true); //tell server we are ready to start
349354
playsound(SND_TOCK);
350355
break;
351356
}
357+
case SDLK_SPACE:
358+
{
359+
360+
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,INTERRUPT,_("Server Name: %s"), LAN_ConnectedServerName());
361+
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,APPEND,_("Lesson: %s"), LAN_ConnectedServerLesson());
362+
for(i = 0; i < MAX_CLIENTS; i++)
363+
{
364+
if(LAN_PlayerConnected(i))
365+
{
366+
if (LAN_PlayerReady(i))
367+
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,APPEND,"%s %s",LAN_PlayerName(i),_("Ready"));
368+
else
369+
T4K_Tts_say(DEFAULT_VALUE,DEFAULT_VALUE,APPEND,"%s %s",LAN_PlayerName(i),_("Not Ready"));
370+
}
371+
}
372+
}
352373
case SDLK_BACKSPACE:
353374
{
354375
ready = false;

0 commit comments

Comments
 (0)