手雷可以丢弃

This commit is contained in:
aozhiwei 2019-04-03 13:59:41 +08:00
parent b3d24e827a
commit 870c4f5de6
3 changed files with 41 additions and 8 deletions

View File

@ -77,3 +77,7 @@ const int MAX_WEAPON_NUM = 5;
const int GUN_SLOT1 = 1;
const int GUN_SLOT2 = 2;
const int FRAG_SLOT = 3;
const int SMOKE_SLOT = 4;

View File

@ -418,6 +418,32 @@ void Player::UpdateDropWeapon()
curr_weapon = &weapons[0];
}
}
} else if (weapon->weapon_idx == FRAG_SLOT) {
drop_ok = true;
*weapon = Weapon();
weapon->weapon_idx = drop_weapon_idx;
if (curr_weapon == weapon) {
if (weapons[GUN_SLOT1].weapon_id != 0) {
curr_weapon = &weapons[GUN_SLOT1];
} else if (weapons[GUN_SLOT2].weapon_id != 0) {
curr_weapon = &weapons[GUN_SLOT2];
} else {
curr_weapon = &weapons[0];
}
}
} else if (weapon->weapon_idx == SMOKE_SLOT) {
drop_ok = true;
*weapon = Weapon();
weapon->weapon_idx = drop_weapon_idx;
if (curr_weapon == weapon) {
if (weapons[GUN_SLOT1].weapon_id != 0) {
curr_weapon = &weapons[GUN_SLOT1];
} else if (weapons[GUN_SLOT2].weapon_id != 0) {
curr_weapon = &weapons[GUN_SLOT2];
} else {
curr_weapon = &weapons[0];
}
}
}
if (drop_ok) {
#if 1

View File

@ -446,8 +446,16 @@ message MFShot
//
message MFExplosion
{
optional MFVector2D pos = 1; //
optional int32 type = 2;
optional int32 item_id = 1; //id
optional MFVector2D pos = 2; //
}
//
message MFSmoke
{
optional int32 item_id = 1; //id
optional MFVector2D pos = 2; //
optional float rad = 3; //
}
//
@ -523,12 +531,6 @@ message CMMove
optional int32 select_weapon = 10; //()
optional int32 drop_weapon = 11; //
optional bool cancel_action = 15; //zz
//optional bool edit_mode = 16; //
optional bool scroll_down = 17; //zzz
optional bool scroll_up = 18; //zz
optional bool portrait = 19; //zz
//use_item使用道具
optional int32 use_scope = 25; //使 0-4
@ -613,6 +615,7 @@ message SMUpdate
repeated MFBullet bullets = 20; //
repeated MFShot shots = 21; //
repeated MFExplosion explosions = 22; //
repeated MFSmoke smokes = 25; //
repeated MFEmote emotes = 23; //
optional int32 ack = 24; //req id