| 1269 | } |
| 1270 | |
| 1271 | void render_timer(F32 alpha, F32 glow) |
| 1272 | { |
| 1273 | state_missle_fly* state = (state_missle_fly*)shared.state[THREAD_MISSLE]; |
| 1274 | if (state == NULL || state->type != STATE_MISSLE_FLY) |
| 1275 | { |
| 1276 | return; |
| 1277 | } |
| 1278 | |
| 1279 | F32 life = state->life; |
| 1280 | char buffer[16]; |
| 1281 | sprintf(buffer, "%02d:%02d", (S32)life, ((S32)(100.0f * life)) - (100 * (S32)life)); |
| 1282 | |
| 1283 | F32 dsize = glow * current_tweak->hud.timer.glow_size; |
| 1284 | // zEntCruiseBubble_f_0_0 is loaded too early, should be just before the call |
| 1285 | xfont font = xfont::create(current_tweak->hud.timer.font, |
| 1286 | current_tweak->hud.timer.font_width + dsize, |
| 1287 | current_tweak->hud.timer.font_height + dsize, 0.0f, g_WHITE, |
| 1288 | screen_bounds); |
| 1289 | // register use for copying fields into font off, also causes a larger stack frame |
| 1290 | // also the color tags are loaded too early, should be just before the call |
| 1291 | cruise_bubble::lerp(font.color, glow, zEntCruiseBubble_color_80_00_00_FF, |
| 1292 | zEntCruiseBubble_color_FF_14_14_FF); |
| 1293 | font.color.a = (S32)(255.0f * alpha + 0.5f); |
| 1294 | |
| 1295 | basic_rect<F32> bound = font.bounds(buffer); |
| 1296 | F32 x = current_tweak->hud.timer.x - bound.x - 0.5f * bound.w; |
| 1297 | F32 y = current_tweak->hud.timer.y - bound.y - 0.5f * bound.h; |
| 1298 | |
| 1299 | font.render(buffer, x, y); |
| 1300 | } |
| 1301 | |
| 1302 | void lerp(iColor_tag& c, F32 t, iColor_tag a, iColor_tag b) |
| 1303 | { |