Draws the player name on the hud
| 2168 | } |
| 2169 | // Draws the player name on the hud |
| 2170 | void DrawPlayerNameOnHud(object *obj) { |
| 2171 | if (!(Game_mode & GM_MULTI)) |
| 2172 | return; |
| 2173 | int slot = obj->id; |
| 2174 | int color; |
| 2175 | if (slot == Player_num) |
| 2176 | return; |
| 2177 | if (NetPlayers[slot].sequence != NETSEQ_PLAYING) |
| 2178 | return; |
| 2179 | if (HudNameTan <= 0) |
| 2180 | return; |
| 2181 | if (obj->effect_info && obj->effect_info->type_flags & EF_CLOAKED) |
| 2182 | return; |
| 2183 | |
| 2184 | // Get color to draw this name in |
| 2185 | DLLInfo.me_handle = obj->handle; |
| 2186 | CallGameDLL(EVT_CLIENT_GETCOLOREDNAME, &DLLInfo); |
| 2187 | color = DLLInfo.iRet; |
| 2188 | if (color < 0) |
| 2189 | return; |
| 2190 | |
| 2191 | // See if its in our viewcone |
| 2192 | vector subvec = obj->pos - Player_object->pos; |
| 2193 | vm_NormalizeVectorFast(&subvec); |
| 2194 | if ((vm_DotProduct(&subvec, &Player_object->orient.fvec)) < HudNameTan) |
| 2195 | return; |
| 2196 | // Find out if it is o.k. to draw here. |
| 2197 | fvi_query fq; |
| 2198 | fvi_info hit_data; |
| 2199 | int fate; |
| 2200 | fq.p0 = &Player_object->pos; |
| 2201 | fq.startroom = Player_object->roomnum; |
| 2202 | fq.p1 = &obj->pos; |
| 2203 | fq.rad = 0; |
| 2204 | fq.thisobjnum = -1; |
| 2205 | fq.ignore_obj_list = NULL; |
| 2206 | fq.flags = FQ_CHECK_OBJS | FQ_IGNORE_POWERUPS | FQ_IGNORE_WEAPONS; |
| 2207 | fate = fvi_FindIntersection(&fq, &hit_data); |
| 2208 | if (fate == HIT_NONE || (fate == HIT_SPHERE_2_POLY_OBJECT && hit_data.hit_object[0] == (obj - Objects))) { |
| 2209 | int half = Game_window_w / 2; |
| 2210 | // Draw this name on the hud |
| 2211 | g3Point pnt; |
| 2212 | g3_RotatePoint(&pnt, fq.p1); |
| 2213 | g3_ProjectPoint(&pnt); |
| 2214 | // put a centered name string in the text buffer. |
| 2215 | |
| 2216 | grtext_SetFont(HUD_FONT); |
| 2217 | grtext_SetColor(color); |
| 2218 | grtext_CenteredPrintf(pnt.p3_sx - half, pnt.p3_sy, Players[slot].callsign); |
| 2219 | grtext_Flush(); |
| 2220 | } |
| 2221 | } |
| 2222 | // Creates lightning sparks on a damaged object |
| 2223 | void DrawSparkyDamageLightning(object *obj) { |
| 2224 | float max_shields = 100; |
no test coverage detected