MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / MultiStartNewLevel

Function MultiStartNewLevel

Descent3/multi.cpp:6420–6500  ·  view source on GitHub ↗

Starts multiplayer-specific stuff for a new level Anything not specific to multiplayer should be in StartNewLevel()

Source from the content-addressed store, hash-verified

6418// Starts multiplayer-specific stuff for a new level
6419// Anything not specific to multiplayer should be in StartNewLevel()
6420bool MultiStartNewLevel(int level) {
6421 Time_last_taunt_request = 0;
6422
6423 // Figure the ships into the checksum
6424 for (int i = 0; i < MAX_SHIPS; i++)
6425 if (Ships[i].used)
6426 MultiGetShipChecksum(i);
6427
6428 Reliable_count = 0;
6429 Last_reliable_count = -1;
6430 Multi_next_level = -1;
6431
6432#ifndef RELEASE
6433 // Clear our packet tracking
6434 for (int i = 0; i < 255; i++)
6435 Multi_packet_tracking[i] = 0;
6436
6437#endif
6438
6439 memset(Player_pos_fix, 0, sizeof(Player_pos_fix));
6440
6441 memset(Multi_building_states, 0, MAX_OBJECTS);
6442 Multi_num_buildings_changed = 0;
6443
6444 memset(Multi_additional_damage, 0, MAX_PLAYERS * 4);
6445 memset(Multi_additional_shields, 0, MAX_SHIELD_REQUEST_TYPES * 4);
6446 Multi_requested_damage_amount = 0;
6447
6448 for (int i = 0; i < MAX_OBJECTS; i++) {
6449 Server_object_list[i] = 65535;
6450 Local_object_list[i] = 65535;
6451 Objects[i].generic_nonvis_flags = 0;
6452 }
6453
6454 for (int i = 0; i < MAX_SPEW_EFFECTS; i++)
6455 Server_spew_list[i] = 65535;
6456
6457 // SCRIPT POINT!!!
6458 MultiMassageAllObjects(0, (Netgame.flags & NF_USE_ROBOTS) ? 0 : 1);
6459 MultiBuildMatchTables();
6460 Num_broke_glass = 0;
6461
6462 // Fill in player object numbers
6463 for (int i = 0; i < MAX_PLAYERS; i++) {
6464 if (Players[i].start_roomnum != -1) {
6465 int objnum = Players[i].objnum;
6466
6467 Server_object_list[objnum] = objnum;
6468 Local_object_list[objnum] = objnum;
6469 Objects[objnum].flags |= (OF_SERVER_OBJECT | OF_CLIENT_KNOWS);
6470 }
6471
6472 InitPlayerNewLevel(i);
6473
6474 // Inititialize all other players besides myself
6475 if (Netgame.local_role == LR_CLIENT && i != Player_num && !(NetPlayers[i].flags & NPF_SERVER))
6476 NetPlayers[i].flags &= ~NPF_CONNECTED;
6477 }

Callers 1

StartLevelFunction · 0.85

Calls 10

MultiGetShipChecksumFunction · 0.85
MultiMassageAllObjectsFunction · 0.85
MultiBuildMatchTablesFunction · 0.85
InitPlayerNewLevelFunction · 0.85
ResetTeamScoresFunction · 0.85
InitPlayerNewShipFunction · 0.85
ObjGetFunction · 0.85
CallGameDLLFunction · 0.85
CheckItemMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected