(List<String> args, GameImportsImpl gameImports, client_t client)
| 73 | * ================ |
| 74 | */ |
| 75 | private static void SV_New_f(List<String> args, GameImportsImpl gameImports, client_t client) { |
| 76 | |
| 77 | Com.DPrintf("New() from " + client.name + "\n"); |
| 78 | |
| 79 | if (client.state != ClientStates.CS_CONNECTED) { |
| 80 | Com.Printf("New not valid -- already spawned\n"); |
| 81 | return; |
| 82 | } |
| 83 | |
| 84 | // |
| 85 | // serverdata needs to go over for all types of servers |
| 86 | // to make sure the protocol is right, and to set the gamedir |
| 87 | // |
| 88 | String gamedir = Cvar.getInstance().VariableString("gamedir"); |
| 89 | |
| 90 | // send the serverdata |
| 91 | // send full levelname |
| 92 | |
| 93 | final int clientIndex; |
| 94 | if (gameImports.sv.state == ServerStates.SS_CINEMATIC || gameImports.sv.state == ServerStates.SS_PIC) |
| 95 | clientIndex = -1; |
| 96 | else |
| 97 | clientIndex = client.edict.index - 1; |
| 98 | |
| 99 | |
| 100 | client.netchan.reliablePending.add( |
| 101 | new ServerDataMessage( |
| 102 | Defines.PROTOCOL_VERSION, |
| 103 | gameImports.spawncount, |
| 104 | gameImports.sv.isDemo, |
| 105 | gamedir, |
| 106 | clientIndex, |
| 107 | gameImports.sv.configstrings[Defines.CS_NAME] |
| 108 | )); |
| 109 | // |
| 110 | // game server |
| 111 | // |
| 112 | if (gameImports.sv.state == ServerStates.SS_GAME) { |
| 113 | // set up the entity for the client |
| 114 | edict_t ent = gameImports.gameExports.getEdict(clientIndex + 1); |
| 115 | ent.s.number = clientIndex + 1; |
| 116 | client.edict = ent; |
| 117 | client.lastcmd = new usercmd_t(); |
| 118 | |
| 119 | // begin fetching configstrings |
| 120 | client.netchan.reliablePending.add(new StuffTextMessage(String.format("cmd %s %d 0", StringCmdMessage.CONFIG_STRINGS, gameImports.spawncount))); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | /* |
| 125 | * ================== SV_Configstrings_f ================== |
no test coverage detected