Draws the 'typing message' icon indicator above an object
| 2064 | } |
| 2065 | // Draws the 'typing message' icon indicator above an object |
| 2066 | void DrawPlayerTypingIndicator(object *obj) { |
| 2067 | if (!(Game_mode & GM_MULTI)) |
| 2068 | return; |
| 2069 | int slot = obj->id; |
| 2070 | if (slot == Player_num) |
| 2071 | return; |
| 2072 | if (NetPlayers[slot].sequence != NETSEQ_PLAYING) |
| 2073 | return; |
| 2074 | uint32_t bit = (0x01 << slot); |
| 2075 | if (!(Players_typing & bit)) |
| 2076 | return; |
| 2077 | if (obj->effect_info && obj->effect_info->type_flags & EF_CLOAKED) |
| 2078 | return; |
| 2079 | static int type_indicator_model = -2; |
| 2080 | if (type_indicator_model == -2) |
| 2081 | type_indicator_model = FindTextureName("TypingIndicator"); |
| 2082 | if (type_indicator_model < 0) |
| 2083 | return; |
| 2084 | int bm_handle = GetTextureBitmap(type_indicator_model, 0); |
| 2085 | float IndicatorTan; |
| 2086 | float rad = (float)(3.14 * (float)(10) / 180.0); |
| 2087 | IndicatorTan = tan(rad); |
| 2088 | // See if its in our viewcone |
| 2089 | vector subvec = obj->pos - Player_object->pos; |
| 2090 | vm_NormalizeVectorFast(&subvec); |
| 2091 | if ((vm_DotProduct(&subvec, &Player_object->orient.fvec)) < IndicatorTan) |
| 2092 | return; |
| 2093 | if ((vm_VectorDistanceQuick(&Viewer_object->pos, &obj->pos) > 800.0f)) |
| 2094 | return; |
| 2095 | // Find out if it is o.k. to draw here. |
| 2096 | fvi_query fq; |
| 2097 | fvi_info hit_data; |
| 2098 | int fate; |
| 2099 | fq.p0 = &Player_object->pos; |
| 2100 | fq.startroom = Player_object->roomnum; |
| 2101 | fq.p1 = &obj->pos; |
| 2102 | fq.rad = 0; |
| 2103 | fq.thisobjnum = -1; |
| 2104 | fq.ignore_obj_list = NULL; |
| 2105 | fq.flags = FQ_CHECK_OBJS | FQ_IGNORE_POWERUPS | FQ_IGNORE_WEAPONS; |
| 2106 | fate = fvi_FindIntersection(&fq, &hit_data); |
| 2107 | if (fate == HIT_NONE || (fate == HIT_SPHERE_2_POLY_OBJECT && hit_data.hit_object[0] == (obj - Objects))) { |
| 2108 | // Draw this indicator on the hud |
| 2109 | g3Point pnt; |
| 2110 | int bmh, bmw; |
| 2111 | g3Point *pntlist[32], points[4]; |
| 2112 | g3Codes cc; |
| 2113 | uint8_t code; |
| 2114 | |
| 2115 | cc.cc_and = 0xFF; |
| 2116 | cc.cc_or = 0; |
| 2117 | |
| 2118 | int b_w = std::min(bm_w(bm_handle, 0), 32); |
| 2119 | int b_h = std::min(bm_h(bm_handle, 0), 32); |
| 2120 | bmw = b_w / 2; |
| 2121 | bmh = b_h / 2; |
| 2122 | |
| 2123 | g3_RotatePoint(&pnt, fq.p1); |
no test coverage detected