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

Function DrawPlayerDamageDisk

Descent3/renderobject.cpp:1968–2000  ·  view source on GitHub ↗

Draws the glowing disk around a player indicating damage

Source from the content-addressed store, hash-verified

1966}
1967// Draws the glowing disk around a player indicating damage
1968void DrawPlayerDamageDisk(object *obj) {
1969 // if (!(Game_mode & GM_MULTI))
1970 // return; // only in multiplayer
1971
1972 ASSERT(obj->type == OBJ_PLAYER);
1973 if (obj == Viewer_object)
1974 return; // don't do me
1975 float damage_norm = Players[obj->id].damage_magnitude / MAX_DAMAGE_MAG;
1976 if (damage_norm > 1.0)
1977 damage_norm = 1.0;
1978 if (damage_norm < .001)
1979 return;
1980 rend_SetZBias(-obj->size);
1981 int bm_handle;
1982 int objnum = obj - Objects;
1983 float rot_temp = .25; // Higher is faster
1984 int int_game = Gametime / rot_temp;
1985 float diff = Gametime - (int_game * rot_temp);
1986 int rot_angle = diff * 65536;
1987 rot_angle = 0;
1988 bm_handle = Fireballs[SHIP_HIT_INDEX].bm_handle;
1989
1990 rend_SetAlphaType(AT_SATURATE_TEXTURE);
1991 rend_SetZBufferWriteMask(0);
1992
1993 rend_SetAlphaValue(.4 * damage_norm * 255);
1994 rend_SetOverlayType(OT_NONE);
1995 rend_SetLighting(LS_NONE);
1996 g3_DrawRotatedBitmap(&obj->pos, rot_angle, obj->size, (obj->size * bm_h(bm_handle, 0)) / bm_w(bm_handle, 0),
1997 bm_handle);
1998 rend_SetZBufferWriteMask(1);
1999 rend_SetZBias(0);
2000}
2001// Draws the red sphere around a player indicating invulnerability
2002void DrawPlayerInvulSphere(object *obj) {
2003 // if (!(Game_mode & GM_MULTI))

Callers 1

RenderObjectFunction · 0.85

Calls 9

g3_DrawRotatedBitmapFunction · 0.85
bm_hFunction · 0.85
bm_wFunction · 0.85
rend_SetZBiasFunction · 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