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

Function DrawNumber

editor/EPath.cpp:506–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504static int NumOfPoints[] = {5, 6, 10, 7, 6, 10, 10, 4, 10, 6};
505
506void DrawNumber(int num, vector pos, float size) {
507 g3Point basepnt, rot_pnt[20];
508 int num_array[10];
509 int i, j;
510 int total = num;
511 size /= 2;
512
513 if (num < 0) {
514 return;
515 }
516
517 int num_numbers = log10(num) + 1;
518 if (num_numbers > 10) {
519 mprintf(0, "Cannot represent a number with over 10 digits\n");
520 Int3();
521 return;
522 }
523
524 for (j = num_numbers - 1; j >= 0; j--) {
525 num_array[j] = total / (pow(10, j));
526 total -= num_array[j] * pow(10, j);
527 }
528
529 for (j = 0; j < num_numbers; j++) {
530 vector cur_pos;
531
532 if (num_numbers & 0x00000001)
533 cur_pos = pos + (2.1 * size * ((num_numbers >> 1) - j)) * Viewer_object->orient.rvec;
534 else
535 cur_pos = pos + (2.1 * size * ((num_numbers >> 1) - j) - size) * Viewer_object->orient.rvec;
536
537 g3_RotatePoint(&basepnt, &cur_pos);
538
539 for (i = 0; i < NumOfPoints[num_array[j]]; i++) {
540 rot_pnt[i] = basepnt;
541
542 rot_pnt[i].p3_vec.x += (ArrayX[num_array[j]][i] * size);
543 rot_pnt[i].p3_vec.y += (ArrayY[num_array[j]][i] * size);
544
545 rot_pnt[i].p3_flags = 0;
546 g3_CodePoint(&rot_pnt[i]);
547 g3_ProjectPoint(&rot_pnt[i]);
548 }
549
550 for (i = 0; i < NumOfPoints[num_array[j]] - 1; i++) {
551 g3Point p1, p2;
552
553 p1 = rot_pnt[i];
554 p2 = rot_pnt[i + 1];
555
556 g3_DrawLine(GR_RGB(255, 255, 255), &p1, &p2);
557 }
558 }
559}

Callers 2

DrawAllPathsFunction · 0.70
EBNode_DrawRoomFunction · 0.70

Calls 5

g3_RotatePointFunction · 0.85
g3_CodePointFunction · 0.85
g3_ProjectPointFunction · 0.85
g3_DrawLineFunction · 0.85
GR_RGBFunction · 0.50

Tested by

no test coverage detected