MCPcopy Create free account
hub / github.com/demoth/jake2 / Weapon_Generic

Method Weapon_Generic

game/src/main/java/jake2/game/PlayerWeapon.java:1205–1336  ·  view source on GitHub ↗
(SubgameEntity ent, int FRAME_ACTIVATE_LAST,
                                      int FRAME_FIRE_LAST, int FRAME_IDLE_LAST,
                                      int FRAME_DEACTIVATE_LAST, int pause_frames[], int fire_frames[],
                                      EntThinkAdapter fire, GameExportsImpl gameExports)

Source from the content-addressed store, hash-verified

1203 */
1204
1205 public static void Weapon_Generic(SubgameEntity ent, int FRAME_ACTIVATE_LAST,
1206 int FRAME_FIRE_LAST, int FRAME_IDLE_LAST,
1207 int FRAME_DEACTIVATE_LAST, int pause_frames[], int fire_frames[],
1208 EntThinkAdapter fire, GameExportsImpl gameExports) {
1209 int FRAME_FIRE_FIRST = (FRAME_ACTIVATE_LAST + 1);
1210 int FRAME_IDLE_FIRST = (FRAME_FIRE_LAST + 1);
1211 int FRAME_DEACTIVATE_FIRST = (FRAME_IDLE_LAST + 1);
1212
1213 int n;
1214
1215 if (ent.deadflag != 0 || ent.s.modelindex != 255) // VWep animations
1216 // screw up corpses
1217 {
1218 return;
1219 }
1220
1221 gclient_t client = ent.getClient();
1222 if (client.weaponstate == WeaponStates.WEAPON_DROPPING) {
1223 if (client.getPlayerState().gunframe == FRAME_DEACTIVATE_LAST) {
1224 ChangeWeapon(ent, gameExports);
1225 return;
1226 } else if ((FRAME_DEACTIVATE_LAST - client.getPlayerState().gunframe) == 4) {
1227 client.anim_priority = Defines.ANIM_REVERSE;
1228 if ((client.getPlayerState().pmove.pm_flags & Defines.PMF_DUCKED) != 0) {
1229 ent.s.frame = M_Player.FRAME_crpain4 + 1;
1230 client.anim_end = M_Player.FRAME_crpain1;
1231 } else {
1232 ent.s.frame = M_Player.FRAME_pain304 + 1;
1233 client.anim_end = M_Player.FRAME_pain301;
1234 }
1235 }
1236
1237 client.getPlayerState().gunframe++;
1238 return;
1239 }
1240
1241 if (client.weaponstate == WeaponStates.WEAPON_ACTIVATING) {
1242 if (client.getPlayerState().gunframe == FRAME_ACTIVATE_LAST) {
1243 client.weaponstate = WeaponStates.WEAPON_READY;
1244 client.getPlayerState().gunframe = FRAME_IDLE_FIRST;
1245 return;
1246 }
1247
1248 client.getPlayerState().gunframe++;
1249 return;
1250 }
1251
1252 if ((client.newweapon != null)
1253 && (client.weaponstate != WeaponStates.WEAPON_FIRING)) {
1254 client.weaponstate = WeaponStates.WEAPON_DROPPING;
1255 client.getPlayerState().gunframe = FRAME_DEACTIVATE_FIRST;
1256
1257 if ((FRAME_DEACTIVATE_LAST - FRAME_DEACTIVATE_FIRST) < 4) {
1258 client.anim_priority = Defines.ANIM_REVERSE;
1259 if ((client.getPlayerState().pmove.pm_flags & Defines.PMF_DUCKED) != 0) {
1260 ent.s.frame = M_Player.FRAME_crpain4 + 1;
1261 client.anim_end = M_Player.FRAME_crpain1;
1262 } else {

Callers 1

thinkMethod · 0.95

Calls 8

getPlayerStateMethod · 0.95
ChangeWeaponMethod · 0.95
NoAmmoWeaponChangeMethod · 0.95
randMethod · 0.95
soundMethod · 0.65
soundindexMethod · 0.65
getClientMethod · 0.45
thinkMethod · 0.45

Tested by

no test coverage detected