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

Function DrawNumber

Descent3/renderobject.cpp:717–762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715 {1.0, 1.0, 0.0, 0.0, 1.0, -1.0}};
716static int NumOfPoints[] = {5, 6, 10, 7, 6, 10, 10, 4, 10, 6};
717static void DrawNumber(int num, vector pos, float size, ddgr_color c1) {
718 g3Point basepnt, rot_pnt[20];
719 int num_array[10];
720 int i, j;
721 int total = num;
722 size /= 2;
723 if (num < 0) {
724 num *= -1;
725 num += 10000;
726 }
727 int num_numbers = (int)(log10f((float)num) + 1);
728 if (num_numbers > 10) {
729 mprintf(0, "Cannot represent a number with over 10 digits\n");
730 Int3();
731 return;
732 }
733
734 for (j = num_numbers - 1; j >= 0; j--) {
735 num_array[j] = total / ((int)powf(10.0f, (float)j));
736 total -= num_array[j] * (int)powf(10.0f, (float)j);
737 }
738 for (j = 0; j < num_numbers; j++) {
739 vector cur_pos;
740
741 if (num_numbers & 0x00000001)
742 cur_pos = pos + (2.1 * size * ((num_numbers >> 1) - j)) * Viewer_object->orient.rvec;
743 else
744 cur_pos = pos + (2.1 * size * ((num_numbers >> 1) - j) - size) * Viewer_object->orient.rvec;
745 g3_RotatePoint(&basepnt, &cur_pos);
746 for (i = 0; i < NumOfPoints[num_array[j]]; i++) {
747 rot_pnt[i] = basepnt;
748 rot_pnt[i].p3_vec.x += (ArrayX[num_array[j]][i] * size);
749 rot_pnt[i].p3_vec.y += (ArrayY[num_array[j]][i] * size);
750 rot_pnt[i].p3_flags = 0;
751 g3_CodePoint(&rot_pnt[i]);
752 g3_ProjectPoint(&rot_pnt[i]);
753 }
754 for (i = 0; i < NumOfPoints[num_array[j]] - 1; i++) {
755 g3Point p1, p2;
756 p1 = rot_pnt[i];
757 p2 = rot_pnt[i + 1];
758
759 g3_DrawLine(c1, &p1, &p2);
760 }
761 }
762}
763static inline bool object_object_AABB(object *obj1, object *obj2) {
764 bool overlap = true;
765 if (obj1->max_xyz.x < obj2->min_xyz.x || obj2->max_xyz.x < obj1->min_xyz.x || obj1->max_xyz.z < obj2->min_xyz.z ||

Callers 1

DrawDebugInfoFunction · 0.70

Calls 4

g3_RotatePointFunction · 0.85
g3_CodePointFunction · 0.85
g3_ProjectPointFunction · 0.85
g3_DrawLineFunction · 0.85

Tested by

no test coverage detected