From 2b44f8e79dce354103218d6f2b37fb3bafaa2a1e Mon Sep 17 00:00:00 2001 From: carnivoroussociety <38839485+carnivoroussociety@users.noreply.github.com> Date: Sat, 28 Aug 2021 06:30:34 +1000 Subject: [PATCH] Carry over team flag fix from nblood --- source/games/blood/src/player.cpp | 52 ++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 8 deletions(-) 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: