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

Function DrawPlayerInvulSphere

Descent3/renderobject.cpp:2002–2032  ·  view source on GitHub ↗

Draws the red sphere around a player indicating invulnerability

Source from the content-addressed store, hash-verified

2000}
2001// Draws the red sphere around a player indicating invulnerability
2002void DrawPlayerInvulSphere(object *obj) {
2003 // if (!(Game_mode & GM_MULTI))
2004 // return; // only in multiplayer
2005
2006 ASSERT(obj->type == OBJ_PLAYER);
2007 if (Viewer_object == obj)
2008 return; // don't do me
2009 if (!(Players[obj->id].flags & PLAYER_FLAGS_INVULNERABLE))
2010 return;
2011 if (Players[obj->id].invul_magnitude < .05)
2012 return;
2013
2014 int bm_handle = Fireballs[INVUL_HIT_INDEX].bm_handle;
2015 // Figure out the position and orientation to draw this
2016 vector hit_pos = obj->pos + (Players[obj->id].invul_vector * obj->size);
2017 vector norm_vec = Players[obj->id].invul_vector;
2018 // Check to see that we're ok with the length of the vector
2019 float mag = vm_GetMagnitudeFast(&norm_vec);
2020 if (mag < 1)
2021 return;
2022 norm_vec /= mag;
2023
2024 // Now draw!
2025 rend_SetAlphaType(AT_SATURATE_TEXTURE);
2026 rend_SetZBufferWriteMask(0);
2027 rend_SetAlphaValue(.6 * Players[obj->id].invul_magnitude * 255);
2028 rend_SetOverlayType(OT_NONE);
2029 rend_SetLighting(LS_NONE);
2030 g3_DrawPlanarRotatedBitmap(&hit_pos, &norm_vec, 0, 3, 3, bm_handle);
2031 rend_SetZBufferWriteMask(1);
2032}
2033// Draws a rotating ball around the player
2034void DrawPlayerRotatingBall(object *obj) {
2035 ASSERT(obj->type == OBJ_PLAYER);

Callers 1

RenderObjectFunction · 0.85

Calls 7

vm_GetMagnitudeFastFunction · 0.50
rend_SetAlphaTypeFunction · 0.50
rend_SetZBufferWriteMaskFunction · 0.50
rend_SetAlphaValueFunction · 0.50
rend_SetOverlayTypeFunction · 0.50
rend_SetLightingFunction · 0.50

Tested by

no test coverage detected