This commit is contained in:
aozhiwei 2019-07-03 16:02:38 +08:00
parent db03d2a512
commit 446026bc4f
4 changed files with 13 additions and 13 deletions

View File

@ -76,6 +76,7 @@ enum InventorySlot_e
IS_SMOKE = 6,
IS_HEALTHKIT = 7,
IS_PAIN_KILLER = 8,
IS_TANK = 9,
IS_1XSCOPE = 12,
IS_2XSCOPE = 13,

View File

@ -47,6 +47,7 @@ Human::Human():Entity()
inventory_[IS_762MM] = FIGHTING_MODE_BULLET_NUM;
inventory_[IS_12GAUGE] = FIGHTING_MODE_BULLET_NUM;
inventory_[IS_RPG] = FIGHTING_MODE_BULLET_NUM;
inventory_[IS_TANK] = FIGHTING_MODE_BULLET_NUM;
}
}
@ -186,8 +187,7 @@ void Human::Shot(a8::Vec2& target_dir)
return;
}
if (curr_weapon->weapon_idx != 0 &&
curr_weapon->ammo <= 0) {
if (curr_weapon->ammo <= 0) {
AutoLoadingBullet();
return;
}
@ -482,8 +482,7 @@ void Human::SyncAroundPlayers()
void Human::AutoLoadingBullet(bool manual)
{
if (curr_weapon->weapon_idx != 0 &&
(curr_weapon->ammo <= 0 ||
if ((curr_weapon->ammo <= 0 ||
(manual && curr_weapon->ammo < curr_weapon->GetClipVolume()))
) {
MetaData::Equip* bullet_meta = MetaMgr::Instance()->GetEquip(curr_weapon->meta->i->use_bullet());
@ -1543,8 +1542,8 @@ void Human::UpdateAction()
case AT_Reload:
{
if (curr_weapon->weapon_idx == action_target_id &&
curr_weapon->weapon_id == action_item_id &&
curr_weapon->weapon_idx != 0) {
curr_weapon->weapon_id == action_item_id
) {
MetaData::Equip* bullet_meta = MetaMgr::Instance()->GetEquip(curr_weapon->meta->i->use_bullet());
if (bullet_meta) {
int ammo = curr_weapon->ammo;

View File

@ -245,8 +245,7 @@ void Player::Shot()
return;
}
if (curr_weapon->weapon_idx != 0 &&
curr_weapon->ammo <= 0) {
if (curr_weapon->ammo <= 0) {
AutoLoadingBullet();
return;
}
@ -289,9 +288,7 @@ void Player::Shot()
} else {
return;
}
if (curr_weapon->weapon_idx != 0) {
--curr_weapon->ammo;
}
--curr_weapon->ammo;
int slot_id = curr_weapon->meta->i->_inventory_slot();
switch (slot_id) {
case 5:
@ -341,8 +338,7 @@ void Player::Shot()
}
break;
}
if (curr_weapon->weapon_idx != 0 &&
curr_weapon->ammo <= 0) {
if (curr_weapon->ammo <= 0) {
AutoLoadingBullet();
}
last_shot_frameno_ = room->frame_no;

View File

@ -71,7 +71,11 @@ Player* PlayerMgr::CreatePlayerByCMJoin(long ip_saddr, int socket, const cs::CMJ
hum->weapons[GUN_SLOT0].weapon_idx = GUN_SLOT0;
hum->weapons[GUN_SLOT0].weapon_id = msg.weapon().weapon_id();
hum->weapons[GUN_SLOT0].weapon_lv = msg.weapon().weapon_lv();
#if 1
hum->weapons[GUN_SLOT0].ammo = 0;
#else
hum->weapons[GUN_SLOT0].ammo = FIGHTING_MODE_BULLET_NUM;
#endif
hum->weapons[GUN_SLOT0].meta = weapon_meta;
hum->weapons[GUN_SLOT0].Recalc();
hum->curr_weapon = &hum->weapons[GUN_SLOT0];