Disconnect Goes from a connected state to full screen console state Sends a disconnect message to the server This is also called on Com_Error, so it shouldn't cause any errors.
()
| 660 | * shouldn't cause any errors. |
| 661 | */ |
| 662 | private static void Disconnect() { |
| 663 | |
| 664 | if (ClientGlobals.cls.state == Defines.ca_disconnected) |
| 665 | return; |
| 666 | |
| 667 | if (ClientGlobals.cl_timedemo != null && ClientGlobals.cl_timedemo.value != 0.0f) { |
| 668 | int time; |
| 669 | |
| 670 | time = (int) (Timer.Milliseconds() - ClientGlobals.cl.timedemo_start); |
| 671 | if (time > 0) |
| 672 | Com.Printf("%i frames, %3.1f seconds: %3.1f fps\n", |
| 673 | new Vargs(3).add(ClientGlobals.cl.timedemo_frames).add( |
| 674 | time / 1000.0).add( |
| 675 | ClientGlobals.cl.timedemo_frames * 1000.0 / time)); |
| 676 | } |
| 677 | |
| 678 | Math3D.VectorClear(ClientGlobals.cl.refdef.blend); |
| 679 | |
| 680 | ClientGlobals.re.CinematicSetPalette(null); |
| 681 | |
| 682 | Menu.ForceMenuOff(); |
| 683 | |
| 684 | ClientGlobals.cls.connect_time = 0; |
| 685 | |
| 686 | SCR.StopCinematic(); |
| 687 | |
| 688 | if (ClientGlobals.cls.demorecording) |
| 689 | Stop_f.execute(Collections.emptyList()); |
| 690 | |
| 691 | // send a disconnect message to the server |
| 692 | |
| 693 | sizebuf_t buf = new sizebuf_t(128); |
| 694 | new StringCmdMessage(StringCmdMessage.DISCONNECT).writeTo(buf); |
| 695 | |
| 696 | // fixme: was sending it 3 times |
| 697 | ClientGlobals.cls.netchan.transmit(List.of(new StringCmdMessage(StringCmdMessage.DISCONNECT))); |
| 698 | |
| 699 | |
| 700 | ClearState(); |
| 701 | |
| 702 | // stop download |
| 703 | if (ClientGlobals.cls.download != null) { |
| 704 | Lib.fclose(ClientGlobals.cls.download); |
| 705 | ClientGlobals.cls.download = null; |
| 706 | } |
| 707 | |
| 708 | ClientGlobals.cls.state = Defines.ca_disconnected; |
| 709 | } |
| 710 | |
| 711 | /** |
| 712 | * ParseStatusMessage |
no test coverage detected