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

Method OnLitepadCountLights

editor/LightingDialog.cpp:459–516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457}
458
459void CLightingDialog::OnLitepadCountLights() {
460 int lightcount, i, t;
461 char str[1000];
462
463 for (lightcount = 0, i = 0; i < MAX_ROOMS; i++) {
464 if (Rooms[i].used && !(Rooms[i].flags & RF_EXTERNAL)) {
465 for (t = 0; t < Rooms[i].num_faces; t++) {
466 int texnum = Rooms[i].faces[t].tmap;
467 if (GameTextures[texnum].r > 0 || GameTextures[texnum].g > 0 || GameTextures[texnum].b > 0)
468 lightcount++;
469 }
470 }
471 }
472
473 for (i = 0; i <= Highest_object_index; i++) {
474 if (OBJECT_OUTSIDE(&Objects[i]))
475 continue;
476
477 if (Objects[i].type != OBJ_NONE && Objects[i].lighting_render_type == LRT_LIGHTMAPS) {
478 poly_model *po = &Poly_models[Objects[i].rtype.pobj_info.model_num];
479
480 if (!po->new_style)
481 continue;
482
483 for (t = 0; t < po->n_models; t++) {
484 bsp_info *sm = &po->submodel[t];
485
486 if (IsNonRenderableSubmodel(po, t))
487 continue;
488
489 for (int j = 0; j < sm->num_faces; j++) {
490 if (sm->faces[j].texnum == -1)
491 continue;
492
493 int texnum = po->textures[sm->faces[j].texnum];
494 if (GameTextures[texnum].r > 0 || GameTextures[texnum].g > 0 || GameTextures[texnum].b > 0)
495 lightcount++;
496 }
497 }
498 }
499 }
500
501 sprintf(str,
502 "There are %d lights present in the mine. Do you wish for me to set the 'light iterations' control to match "
503 "this number?",
504 lightcount);
505 int answer = MessageBox(str, "Light Question", MB_YESNO);
506 if (answer == IDNO)
507 return;
508
509 CEdit *ebox;
510
511 ebox = (CEdit *)GetDlgItem(IDC_LIGHT_ITERATION_EDIT);
512 sprintf(str, "%d", lightcount);
513 ebox->SetWindowText(str);
514
515 rad_MaxStep = lightcount;
516}

Callers

nothing calls this directly

Calls 1

IsNonRenderableSubmodelFunction · 0.85

Tested by

no test coverage detected