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

Function DrawAllPaths

editor/EPath.cpp:368–480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366#include "gr.h"
367
368void DrawAllPaths(grViewport *vp, vector *viewer_eye, matrix *viewer_orient, float zoom) {
369 int i, current_path_index = 0, t;
370 g3Point rot_points[300];
371 int sort_index[300];
372
373 if (!Show_paths)
374 return;
375
376 current_path_index = GetFirstPath();
377
378 for (i = 0; i < Num_game_paths; i++, current_path_index = GetNextPath(current_path_index)) {
379
380 game_path *gp = &GamePaths[current_path_index];
381
382#ifndef NEWEDITOR
383 int curnode = D3EditState.current_node;
384#else
385 int curnode = Editor_state.GetCurrentNode();
386#endif
387
388 for (t = 0; t < gp->num_nodes; t++) {
389 g3_RotatePoint(&rot_points[t], &gp->pathnodes[t].pos);
390 sort_index[t] = t;
391 }
392
393#ifndef NEWEDITOR
394 ddgr_color path_color =
395 (current_path_index == D3EditState.current_path) ? GR_RGB(255, 255, 255) : GR_RGB(36, 99, 238);
396#else
397 ddgr_color path_color =
398 (current_path_index == Editor_state.GetCurrentPath()) ? GR_RGB(255, 255, 255) : GR_RGB(36, 99, 238);
399#endif
400
401 for (t = 0; t < gp->num_nodes - 1; t++) {
402 g3Point p1 = rot_points[t];
403 g3Point p2 = rot_points[t + 1];
404
405 g3_DrawLine(path_color, &p1, &p2);
406 }
407
408 for (t = 0; t < gp->num_nodes; t++) {
409 for (int k = 0; k < gp->num_nodes; k++) {
410 if (rot_points[k].p3_vec.z < rot_points[t].p3_vec.z) {
411 g3Point temp;
412 int tindex;
413
414 memcpy(&temp, &rot_points[t], sizeof(g3Point));
415 memcpy(&rot_points[t], &rot_points[k], sizeof(g3Point));
416 memcpy(&rot_points[k], &temp, sizeof(g3Point));
417
418 tindex = sort_index[t];
419 sort_index[t] = sort_index[k];
420 sort_index[k] = tindex;
421 }
422 }
423 }
424
425 for (t = 0; t < gp->num_nodes; t++) {

Callers 1

RenderMethod · 0.85

Calls 9

GetFirstPathFunction · 0.85
GetNextPathFunction · 0.85
g3_RotatePointFunction · 0.85
g3_DrawLineFunction · 0.85
g3_DrawSphereFunction · 0.85
DrawNumberFunction · 0.70
GR_RGBFunction · 0.50
rend_SetPixelFunction · 0.50
rend_GetPixelFunction · 0.50

Tested by

no test coverage detected