(player_state_t ps, player_state_t ops)
| 846 | * ============== CL_AddViewWeapon ============== |
| 847 | */ |
| 848 | static void AddViewWeapon(player_state_t ps, player_state_t ops) { |
| 849 | int i; |
| 850 | |
| 851 | //don't draw if outside body... |
| 852 | if (ClientGlobals.cl_3rd.value == 1) |
| 853 | return; |
| 854 | |
| 855 | // allow the gun to be completely removed |
| 856 | if (0 == ClientGlobals.cl_gun.value) |
| 857 | return; |
| 858 | |
| 859 | //memset( gun, 0, sizeof(gun)); |
| 860 | gun.clear(); |
| 861 | |
| 862 | if (ClientGlobals.gun_model != null) |
| 863 | gun.model = ClientGlobals.gun_model; // development tool |
| 864 | else |
| 865 | gun.model = ClientGlobals.cl.model_draw[ps.gunindex]; |
| 866 | |
| 867 | if (gun.model == null) |
| 868 | return; |
| 869 | |
| 870 | // set up gun position |
| 871 | for (i = 0; i < 3; i++) { |
| 872 | gun.origin[i] = ClientGlobals.cl.refdef.vieworg[i] + ops.gunoffset[i] + ClientGlobals.cl.lerpfrac |
| 873 | * (ps.gunoffset[i] - ops.gunoffset[i]); |
| 874 | gun.angles[i] = ClientGlobals.cl.refdef.viewangles[i] + Math3D.LerpAngle(ops.gunangles[i], ps.gunangles[i], ClientGlobals.cl.lerpfrac); |
| 875 | } |
| 876 | |
| 877 | if (ClientGlobals.gun_frame != 0) { |
| 878 | gun.frame = ClientGlobals.gun_frame; // development tool |
| 879 | gun.oldframe = ClientGlobals.gun_frame; // development tool |
| 880 | } else { |
| 881 | gun.frame = ps.gunframe; |
| 882 | if (gun.frame == 0) |
| 883 | gun.oldframe = 0; // just changed weapons, don't lerp from old |
| 884 | else |
| 885 | gun.oldframe = ops.gunframe; |
| 886 | } |
| 887 | |
| 888 | gun.flags = Defines.RF_MINLIGHT | Defines.RF_DEPTHHACK | Defines.RF_WEAPONMODEL; |
| 889 | gun.backlerp = 1.0f - ClientGlobals.cl.lerpfrac; |
| 890 | Math3D.VectorCopy(gun.origin, gun.oldorigin); // don't lerp at all |
| 891 | V.AddEntity(gun); |
| 892 | } |
| 893 | |
| 894 | /* |
| 895 | * =============== CL_CalcViewValues |
no test coverage detected