(SubgameEntity ent, GameExportsImpl gameExports)
| 878 | } |
| 879 | |
| 880 | static void ClientBegin(SubgameEntity ent, GameExportsImpl gameExports) { |
| 881 | |
| 882 | //ent.client = game.clients + (ent - g_edicts - 1); |
| 883 | ent.setClient(gameExports.game.clients[ent.index - 1]); |
| 884 | |
| 885 | if (gameExports.gameCvars.deathmatch.value != 0) { |
| 886 | ClientBeginDeathmatch(ent, gameExports); |
| 887 | return; |
| 888 | } |
| 889 | |
| 890 | // if there is already a body waiting for us (a loadgame), just |
| 891 | // take it, otherwise spawn one from scratch |
| 892 | gclient_t client = ent.getClient(); |
| 893 | if (ent.inuse == true) { |
| 894 | // the client has cleared the client side viewangles upon |
| 895 | // connecting to the server, which is different than the |
| 896 | // state when the game is saved, so we need to compensate |
| 897 | // with deltaangles |
| 898 | for (int i = 0; i < 3; i++) |
| 899 | client.getPlayerState().pmove.delta_angles[i] = (short) Math3D |
| 900 | .ANGLE2SHORT(client.getPlayerState().viewangles[i]); |
| 901 | } else { |
| 902 | // a spawn point will completely reinitialize the entity |
| 903 | // except for the persistant data that was initialized at |
| 904 | // ClientConnect() time |
| 905 | ent.G_InitEdict(ent.index); |
| 906 | ent.classname = "player"; |
| 907 | client.InitClientResp(gameExports); |
| 908 | PutClientInServer(ent, gameExports); |
| 909 | } |
| 910 | |
| 911 | if (gameExports.level.intermissiontime != 0) { |
| 912 | PlayerHud.MoveClientToIntermission(ent, gameExports); |
| 913 | } else { |
| 914 | // send effect if in a multiplayer game |
| 915 | if (gameExports.game.maxclients > 1) { |
| 916 | gameExports.gameImports.multicastMessage(ent.s.origin, new WeaponSoundMessage(ent.index, Defines.MZ_LOGIN), MulticastTypes.MULTICAST_PVS); |
| 917 | |
| 918 | gameExports.gameImports.bprintf(Defines.PRINT_HIGH, client.pers.netname |
| 919 | + " entered the game\n"); |
| 920 | } |
| 921 | } |
| 922 | |
| 923 | // make sure all view stuff is valid |
| 924 | gameExports.playerView.ClientEndServerFrame(ent, gameExports); |
| 925 | } |
| 926 | |
| 927 | static String ClientUserinfoChanged(SubgameEntity ent, String userinfo, GameExportsImpl gameExports) { |
| 928 | String s; |
no test coverage detected