Draws the glowing disk around a powerup
| 1933 | #define POWERUP_HALO_ALPHA .3f |
| 1934 | // Draws the glowing disk around a powerup |
| 1935 | void DrawPowerupGlowDisk(object *obj) { |
| 1936 | ASSERT(obj->type == OBJ_POWERUP); |
| 1937 | if (!Detail_settings.Powerup_halos) |
| 1938 | return; |
| 1939 | if (obj->render_type == RT_NONE) |
| 1940 | return; |
| 1941 | if (Viewer_object->effect_info && Viewer_object->effect_info->type_flags & EF_DEFORM) |
| 1942 | return; |
| 1943 | light_info *li = ObjGetLightInfo(obj); |
| 1944 | int objnum = obj - Objects; |
| 1945 | float size_adjust = FixSin((objnum * 5000) + (FrameCount * 600)); |
| 1946 | size_adjust += 1.0; |
| 1947 | size_adjust /= 2; // now in range 0 to 1.0 |
| 1948 | size_adjust += .5; |
| 1949 | vector subvec = obj->pos - Viewer_object->pos; |
| 1950 | float mag = vm_GetMagnitudeFast(&subvec); |
| 1951 | if (mag < 40) |
| 1952 | return; |
| 1953 | |
| 1954 | float alpha_scalar = 1; |
| 1955 | if (obj->flags & OF_USES_LIFELEFT) { |
| 1956 | if (obj->lifeleft < 5) |
| 1957 | alpha_scalar = (obj->lifeleft / 5.0); |
| 1958 | } |
| 1959 | if (mag < 70) { |
| 1960 | alpha_scalar *= ((mag - 40) / 30.0); |
| 1961 | } |
| 1962 | |
| 1963 | // Draw lo-res disk |
| 1964 | DrawColoredDisk(&obj->pos, li->red_light1, li->green_light1, li->blue_light1, POWERUP_HALO_ALPHA * alpha_scalar, 0.0f, |
| 1965 | (obj->size / 2) + size_adjust, 0, 2); |
| 1966 | } |
| 1967 | // Draws the glowing disk around a player indicating damage |
| 1968 | void DrawPlayerDamageDisk(object *obj) { |
| 1969 | // if (!(Game_mode & GM_MULTI)) |
no test coverage detected