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

Function MultiBuildMatchTables

Descent3/multi.cpp:6647–6690  ·  view source on GitHub ↗

Builds the tables for uniquely identifying powerups and robots

Source from the content-addressed store, hash-verified

6645
6646// Builds the tables for uniquely identifying powerups and robots
6647void MultiBuildMatchTables() {
6648 int i;
6649
6650 mprintf(0, "Building match tables for multiplayer.\n");
6651
6652 memset(Multi_generic_match_table, 0, MAX_OBJECT_IDS * sizeof(int));
6653 memset(Multi_weapon_match_table, 0, MAX_WEAPONS * sizeof(int));
6654
6655 // Build generic tables
6656 for (i = 0; i < MAX_OBJECT_IDS; i++) {
6657 if (Object_info[i].type != OBJ_NONE) {
6658 uint32_t val = MultiGetUniqueIDFromString(Object_info[i].name);
6659 val += Object_info[i].type;
6660
6661 // See if there is a hash collision. If so, increment the value and retry
6662 while ((MultiMatchGeneric(val)) != -1) {
6663
6664 mprintf(0, "Match collision!\n");
6665 Int3();
6666 val++;
6667 }
6668
6669 Multi_generic_match_table[i] = val;
6670 } else
6671 Multi_generic_match_table[i] = 0;
6672 }
6673
6674 // Build weapon tables
6675 for (i = 0; i < MAX_WEAPONS; i++) {
6676 if (Weapons[i].used) {
6677 uint32_t val = MultiGetUniqueIDFromString(Weapons[i].name);
6678
6679 // See if there is a hash collision. If so, increment the value and retry
6680 while ((MultiMatchWeapon(val)) != -1) {
6681 mprintf(0, "Match collision!\n");
6682 Int3();
6683 val++;
6684 }
6685
6686 Multi_weapon_match_table[i] = val;
6687 } else
6688 Multi_weapon_match_table[i] = 0;
6689 }
6690}
6691
6692// Paints all the goal rooms in a level with their colors
6693void MultiPaintGoalRooms(int *texcolors) {

Callers 3

MultiStartNewLevelFunction · 0.85
DemoToggleRecordingFunction · 0.85
DemoPlaybackFileFunction · 0.85

Calls 3

MultiMatchGenericFunction · 0.85
MultiMatchWeaponFunction · 0.85

Tested by

no test coverage detected