diff --git a/server/gameserver/constant.h b/server/gameserver/constant.h index 01278a3..a977229 100755 --- a/server/gameserver/constant.h +++ b/server/gameserver/constant.h @@ -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; + diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index e53357f..60afaca 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -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 diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index bc9ad0f..b20f0b3 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -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