Carry over team flag fix from nblood

This commit is contained in:
carnivoroussociety 2021-08-28 06:30:34 +10:00 committed by Mitchell Richters
parent 049665e03e
commit 2b44f8e79d

View file

@ -978,20 +978,56 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) {
} }
} }
return 0; return 0;
case kItemFlagA: case kItemFlagA: {
if (gGameOptions.nGameType != 3) return 0; if (gGameOptions.nGameType != 3) return 0;
evKill(pItem->index, 3, kCallbackReturnFlag);
pPlayer->hasFlag |= 1;
pPlayer->used2[0] = pItem->index;
gBlueFlagDropped = false; 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; break;
case kItemFlagB: }
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: {
if (gGameOptions.nGameType != 3) return 0; if (gGameOptions.nGameType != 3) return 0;
evKill(pItem->index, 3, kCallbackReturnFlag);
pPlayer->hasFlag |= 2;
pPlayer->used2[1] = pItem->index;
gRedFlagDropped = false; 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; 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 kItemArmorBasic:
case kItemArmorBody: case kItemArmorBody:
case kItemArmorFire: case kItemArmorFire: