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

Function DebugGraph_DisplayOptions

Descent3/debuggraph.cpp:472–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470*/
471
472void DebugGraph_DisplayOptions(void) {
473 if (graph_num_nodes == 0)
474 return;
475
476 newuiTiledWindow window;
477 newuiSheet *sheet;
478
479 bool **bool_values = NULL;
480 bool exit_menu = false;
481 tGraphNode *node;
482
483 bool_values = (bool **)mem_malloc(sizeof(bool *) * graph_num_nodes);
484 if (!bool_values)
485 return;
486
487 window.Create("Debug Graph", 0, 0, 256, 384);
488 sheet = window.GetSheet();
489
490 sheet->NewGroup(NULL, 0, 0);
491 char buffer[256];
492 int bit = 0x01;
493
494 bool multi_game = (bool)((Game_mode & GM_MULTI) != 0);
495
496 for (int i = 0; i < graph_num_nodes; i++) {
497 bool_values[i] = NULL;
498 node = DebugGraph_FindNode(i);
499 if (!node) {
500 bit = bit << 1;
501 continue;
502 }
503
504 // see if we should add it
505 if (multi_game) {
506 if (!(node->init_data.flags & DGF_MULTIPLAYER)) {
507 bit = bit << 1;
508 continue;
509 }
510 } else {
511 if (!(node->init_data.flags & DGF_SINGLEPLAYER)) {
512 bit = bit << 1;
513 continue;
514 }
515 }
516
517 snprintf(buffer, sizeof(buffer), "%s (%s)", node->name, GraphColors[i].color_name);
518 bool_values[i] = sheet->AddLongCheckBox(buffer);
519 if (bool_values[i]) {
520 *bool_values[i] = (bool)((graph_mask & bit) != 0);
521 }
522
523 bit = bit << 1;
524 }
525
526 sheet->NewGroup(NULL, 50, 200);
527 sheet->AddButton(TXT_OK, UID_OK);
528
529 // process

Callers 1

RunGameMenuFunction · 0.85

Calls 12

DebugGraph_FindNodeFunction · 0.85
DebugGraph_EnableFunction · 0.85
DebugGraph_DisableFunction · 0.85
GetSheetMethod · 0.80
NewGroupMethod · 0.80
AddLongCheckBoxMethod · 0.80
AddButtonMethod · 0.80
CreateMethod · 0.45
OpenMethod · 0.45
DoUIMethod · 0.45
CloseMethod · 0.45
DestroyMethod · 0.45

Tested by

no test coverage detected