Fires a multiplayer and AI on/off weapon
| 40 | #include "psrand.h" |
| 41 | // Fires a multiplayer and AI on/off weapon |
| 42 | void FireOnOffWeapon(object *objp) { |
| 43 | if (objp->type == OBJ_PLAYER) { |
| 44 | int slot = objp->id; |
| 45 | |
| 46 | int ship_index = Players[slot].ship_index; |
| 47 | int wb_index = Players[slot].weapon[PW_PRIMARY].index; |
| 48 | |
| 49 | if (WBIsBatteryReady(objp, &Ships[ship_index].static_wb[wb_index], wb_index)) { |
| 50 | WBFireBattery(objp, &Ships[ship_index].static_wb[wb_index], 0, wb_index); |
| 51 | } |
| 52 | } else if (objp->ai_info) { |
| 53 | char wb_index = objp->ai_info->last_special_wb_firing; |
| 54 | if (wb_index > MAX_WBS_PER_OBJ) { // DAJ |
| 55 | mprintf(2, "FireOnOffWeapon wb_index %d > MAX_WBS_PER_OBJ\n", wb_index); |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | if (WBIsBatteryReady(objp, &Object_info[objp->id].static_wb[wb_index], wb_index)) { |
| 60 | WBFireBattery(objp, &Object_info[objp->id].static_wb[wb_index], 0, wb_index); |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | void WBSetupFireAnim(object *obj, otype_wb_info *static_wb, int wb_index) { |
| 66 | dynamic_wb_info *p_dwb = &obj->dynamic_wb[wb_index]; |
no test coverage detected