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

Function MultiMassageAllObjects

Descent3/multi.cpp:6359–6415  ·  view source on GitHub ↗

Deletes all the objects in the level except for players Makes all the players ghosts

Source from the content-addressed store, hash-verified

6357// Deletes all the objects in the level except for players
6358// Makes all the players ghosts
6359void MultiMassageAllObjects(int kill_powerups, int kill_robots) {
6360 int i;
6361 Num_powerup_respawn = 0;
6362 Num_powerup_timer = 0;
6363 Num_client_lm_objects = 0;
6364 Num_server_lm_objects = 0;
6365 mprintf(0, "Massaging all objects!\n");
6366
6367 for (i = 0; i <= Highest_object_index; i++) {
6368 // If client, delete all robots and powerups
6369 if (Netgame.local_role == LR_CLIENT) {
6370 if (IS_GENERIC(Objects[i].type) || Objects[i].type == OBJ_DOOR) {
6371 if (IS_GENERIC(Objects[i].type)) {
6372 if (Object_info[Objects[i].id].lighting_info.lighting_render_type != LRT_LIGHTMAPS) {
6373 Objects[i].flags |= OF_SERVER_SAYS_DELETE;
6374 ObjDelete(i);
6375 } else {
6376 // Add it to our lightmap list
6377 Client_lightmap_list[Num_client_lm_objects] = i;
6378 Num_client_lm_objects++;
6379 }
6380 } else {
6381 // Add this door to our lightmap list
6382 Client_lightmap_list[Num_client_lm_objects] = i;
6383 Num_client_lm_objects++;
6384 }
6385 }
6386 }
6387
6388 // If Server, then only delete the types we're supposed to
6389 if (Netgame.local_role == LR_SERVER) {
6390 if ((Objects[i].type == OBJ_ROBOT || (Objects[i].type == OBJ_BUILDING && Objects[i].ai_info)) && kill_robots) {
6391 ObjDelete(i);
6392 } else if (Objects[i].type == OBJ_POWERUP) {
6393 if ((kill_powerups) || (!(Object_info[Objects[i].id].multi_allowed)))
6394 ObjDelete(i);
6395 else {
6396 if (Num_powerup_respawn < MAX_RESPAWNS) {
6397 Powerup_respawn[Num_powerup_respawn].pos = Objects[i].pos;
6398 Powerup_respawn[Num_powerup_respawn].roomnum = Objects[i].roomnum;
6399 Powerup_respawn[Num_powerup_respawn].objnum = i;
6400 Powerup_respawn[Num_powerup_respawn].used = 1;
6401 Powerup_respawn[Num_powerup_respawn].original_id = Objects[i].id;
6402 Num_powerup_respawn++;
6403 }
6404 }
6405 }
6406 Objects[i].flags |= OF_CLIENT_KNOWS;
6407 }
6408
6409 if (Objects[i].type == OBJ_PLAYER) {
6410 if (Netgame.local_role == LR_CLIENT || (Netgame.local_role == LR_SERVER && Objects[i].id != Player_num)) {
6411 MultiMakePlayerGhost(Objects[i].id);
6412 }
6413 }
6414 }
6415}
6416

Callers 1

MultiStartNewLevelFunction · 0.85

Calls 2

ObjDeleteFunction · 0.85
MultiMakePlayerGhostFunction · 0.85

Tested by

no test coverage detected