diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index c524aa521..cc9e06b46 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -978,20 +978,56 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) { } } return 0; - case kItemFlagA: + case kItemFlagA: { if (gGameOptions.nGameType != 3) return 0; - evKill(pItem->index, 3, kCallbackReturnFlag); - pPlayer->hasFlag |= 1; - pPlayer->used2[0] = pItem->index; gBlueFlagDropped = false; + const bool enemyTeam = (pPlayer->teamId&1) == 1; + if (!enemyTeam && (pItem->owner >= 0) && (pItem->owner < kMaxSprites)) { + pPlayer->hasFlag &= ~1; + pPlayer->used2[0] = -1; + spritetype* pOwner = &sprite[pItem->owner]; + XSPRITE* pXOwner = &xsprite[pOwner->extra]; + trTriggerSprite(pOwner->index, pXOwner, kCmdOn); + sprintf(buffer, "%s returned Blue Flag", gProfile[pPlayer->nPlayer].name); + sndStartSample(8003, 255, 2, 0); + viewSetMessage(buffer); + break; + } + pPlayer->hasFlag |= 1; + pPlayer->used2[0] = pItem->owner; + if (enemyTeam) + { + sprintf(buffer, "%s stole Blue Flag", gProfile[pPlayer->nPlayer].name); + sndStartSample(8007, 255, 2, 0); + viewSetMessage(buffer); + } break; - case kItemFlagB: + } + case kItemFlagB: { if (gGameOptions.nGameType != 3) return 0; - evKill(pItem->index, 3, kCallbackReturnFlag); - pPlayer->hasFlag |= 2; - pPlayer->used2[1] = pItem->index; gRedFlagDropped = false; + const bool enemyTeam = (pPlayer->teamId&1) == 0; + if (!enemyTeam && (pItem->owner >= 0) && (pItem->owner < kMaxSprites)) { + pPlayer->hasFlag &= ~2; + pPlayer->used2[1] = -1; + spritetype* pOwner = &sprite[pItem->owner]; + XSPRITE* pXOwner = &xsprite[pOwner->extra]; + trTriggerSprite(pOwner->index, pXOwner, kCmdOn); + sprintf(buffer, "%s returned Red Flag", gProfile[pPlayer->nPlayer].name); + sndStartSample(8002, 255, 2, 0); + viewSetMessage(buffer); + break; + } + pPlayer->hasFlag |= 2; + pPlayer->used2[1] = pItem->owner; + if (enemyTeam) + { + sprintf(buffer, "%s stole Red Flag", gProfile[pPlayer->nPlayer].name); + sndStartSample(8006, 255, 2, 0); + viewSetMessage(buffer); + } break; + } case kItemArmorBasic: case kItemArmorBody: case kItemArmorFire: