[883] | 1 | #include "Objt.h"
|
---|
| 2 | #include "../Daodan.h"
|
---|
| 3 | #include "../Oni_Symbols.h"
|
---|
| 4 |
|
---|
| 5 | void DD_OBJiTriggerVolume_Draw(OBJtObject *inObject, uint32_t inDrawFlags)
|
---|
| 6 | {
|
---|
| 7 | uint32_t itr;
|
---|
| 8 | OBJtOSD_All* inOSD = (OBJtOSD_All*) inObject->object_data;
|
---|
| 9 | OBJtOSD_TriggerVolume *trigger_osd = &inOSD->osd.trigger_volume_osd;
|
---|
| 10 | M3tPoint3D* points = trigger_osd->volume.worldPoints;
|
---|
| 11 | M3tPoint3D trigger_center = MUgZeroPoint;
|
---|
| 12 | uint32_t shade = 0xFFFFFF;
|
---|
| 13 | UUtBool is_selected = ((inDrawFlags & OBJcDrawFlag_Selected) != 0);
|
---|
| 14 |
|
---|
| 15 | if (!OBJgTriggerVolume_Visible) {
|
---|
| 16 | return;
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | if (OBJrTriggerVolume_IntersectsCharacter(inObject, trigger_osd->team_mask, ONgGameState->local.playerCharacter)) {
|
---|
| 20 | shade = IMcShade_Red;
|
---|
| 21 | }
|
---|
| 22 | else if (is_selected)
|
---|
| 23 | {
|
---|
| 24 | shade = IMcShade_Green;
|
---|
| 25 | }
|
---|
| 26 | else
|
---|
| 27 | {
|
---|
| 28 | shade = IMcShade_Blue;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | M3rGeom_Line_Light(points + 0, points + 1, shade);
|
---|
| 32 | M3rGeom_Line_Light(points + 1, points + 3, shade);
|
---|
| 33 | M3rGeom_Line_Light(points + 3, points + 2, shade);
|
---|
| 34 | M3rGeom_Line_Light(points + 2, points + 0, shade);
|
---|
| 35 |
|
---|
| 36 | M3rGeom_Line_Light(points + 4, points + 5, shade);
|
---|
| 37 | M3rGeom_Line_Light(points + 5, points + 7, shade);
|
---|
| 38 | M3rGeom_Line_Light(points + 7, points + 6, shade);
|
---|
| 39 | M3rGeom_Line_Light(points + 6, points + 4, shade);
|
---|
| 40 |
|
---|
| 41 | M3rGeom_Line_Light(points + 0, points + 4, shade);
|
---|
| 42 | M3rGeom_Line_Light(points + 1, points + 5, shade);
|
---|
| 43 | M3rGeom_Line_Light(points + 3, points + 7, shade);
|
---|
| 44 | M3rGeom_Line_Light(points + 2, points + 6, shade);
|
---|
| 45 |
|
---|
| 46 | if (is_selected) {
|
---|
| 47 | M3rGeom_Line_Light(points + 0, points + 3, shade);
|
---|
| 48 | M3rGeom_Line_Light(points + 1, points + 2, shade);
|
---|
| 49 |
|
---|
| 50 | M3rGeom_Line_Light(points + 4, points + 7, shade);
|
---|
| 51 | M3rGeom_Line_Light(points + 5, points + 6, shade);
|
---|
| 52 |
|
---|
| 53 | M3rGeom_Line_Light(points + 2, points + 4, shade);
|
---|
| 54 | M3rGeom_Line_Light(points + 1, points + 7, shade);
|
---|
| 55 | M3rGeom_Line_Light(points + 0, points + 6, shade);
|
---|
| 56 | M3rGeom_Line_Light(points + 3, points + 5, shade);
|
---|
| 57 |
|
---|
| 58 | M3rGeom_Line_Light(points + 2, points + 7, shade);
|
---|
| 59 | M3rGeom_Line_Light(points + 3, points + 6, shade);
|
---|
| 60 | M3rGeom_Line_Light(points + 0, points + 5, shade);
|
---|
| 61 | M3rGeom_Line_Light(points + 1, points + 4, shade);
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | trigger_center = MUgZeroPoint;
|
---|
| 65 | for(itr = 0; itr < M3cNumBoundingPoints; itr++)
|
---|
| 66 | {
|
---|
| 67 | MUmVector_Add(trigger_center, trigger_center, points[itr]);
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | MUmVector_Scale(trigger_center, (1.0f / ((float) M3cNumBoundingPoints)));
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | void DD_OBJiFlag_Draw(OBJtObject *inObject, uint32_t inDrawFlags)
|
---|
| 74 | {
|
---|
| 75 | OBJtOSD_Flag *flag_osd;
|
---|
| 76 | M3tPoint3D camera_location;
|
---|
| 77 |
|
---|
| 78 | M3tPoint3D points[4] =
|
---|
| 79 | {
|
---|
| 80 | { 0.0f, 0.0f, 0.0f },
|
---|
| 81 | { 0.0f, 10.0f, 0.0f },
|
---|
| 82 | { 0.0f, 8.0f, 4.0f },
|
---|
| 83 | { 0.0f, 6.0f, 0.0f }
|
---|
| 84 | };
|
---|
| 85 |
|
---|
| 86 | if (OBJgFlag_DrawFlags == UUcFalse) { return; }
|
---|
| 87 |
|
---|
| 88 | // get a pointer to the object osd
|
---|
| 89 | flag_osd = (OBJtOSD_Flag*)inObject->object_data;
|
---|
| 90 |
|
---|
| 91 | if ((OBJgFlag_ViewPrefix != 0) && (OBJgFlag_ViewPrefix != flag_osd->id_prefix)) { return; }
|
---|
| 92 |
|
---|
| 93 | // set up the matrix stack
|
---|
| 94 | M3rMatrixStack_Push();
|
---|
| 95 | M3rMatrixStack_ApplyTranslate(inObject->position);
|
---|
| 96 | M3rMatrixStack_Multiply(&flag_osd->rotation_matrix);
|
---|
| 97 | M3rGeom_State_Commit();
|
---|
| 98 |
|
---|
| 99 | // draw the flag
|
---|
| 100 | M3rGeom_Line_Light(points + 0, points + 1, flag_osd->shade);
|
---|
| 101 | M3rGeom_Line_Light(points + 1, points + 2, flag_osd->shade);
|
---|
| 102 | M3rGeom_Line_Light(points + 2, points + 3, flag_osd->shade);
|
---|
| 103 |
|
---|
| 104 | // draw the name
|
---|
| 105 | camera_location = CArGetLocation();
|
---|
| 106 | if (MUrPoint_Distance(&inObject->position, &camera_location) < OBJgFlag_DrawNameDistance)
|
---|
| 107 | {
|
---|
| 108 | OBJiFlag_DrawName(inObject, points + 1);
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | // draw the rotation ring if this flag is selected
|
---|
| 112 | if (inDrawFlags & OBJcDrawFlag_Selected)
|
---|
| 113 | {
|
---|
| 114 | M3tBoundingSphere bounding_sphere;
|
---|
| 115 |
|
---|
| 116 | OBJrObject_GetBoundingSphere(inObject, &bounding_sphere);
|
---|
| 117 | OBJrObjectUtil_DrawRotationRings(inObject, &bounding_sphere, OBJcDrawFlag_RingY);
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | M3rMatrixStack_Pop();
|
---|
| 121 | }
|
---|
| 122 |
|
---|