Given a weapon handle, returns that weapons bitmap If the weapon is animated, returns framenum mod num_of_frames in the animation Also figures in gametime
| 561 | // If the weapon is animated, returns framenum mod num_of_frames in the animation |
| 562 | // Also figures in gametime |
| 563 | int GetWeaponHudImage(int handle, int framenum) { |
| 564 | if (Weapons[handle].flags & WF_HUD_ANIMATED) { |
| 565 | float cur_frametime; |
| 566 | int int_frame; |
| 567 | |
| 568 | vclip *vc = &GameVClips[Weapons[handle].hud_image_handle]; |
| 569 | ASSERT(vc->used); |
| 570 | |
| 571 | cur_frametime = Gametime / vc->frame_time; |
| 572 | int_frame = cur_frametime; |
| 573 | int_frame += framenum; |
| 574 | |
| 575 | return (vc->frames[int_frame % vc->num_frames]); |
| 576 | } else |
| 577 | return (Weapons[handle].hud_image_handle); |
| 578 | } |
| 579 | |
| 580 | // Given a filename, loads either the bitmap or vclip found in that file. If type |
| 581 | // is not NULL, sets it to 1 if file is animation, otherwise sets it to zero |