mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Bugfixes: Bombs (by Flugente)
- bombs armed in the inventory now have a small indicator that describes their settings - fix: it is no longer possible to remove the detonators of an armed bomb. Trying so will detonate it. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5351 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -3968,6 +3968,53 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
|
||||
gprintfinvalidate( sNewX, sNewY, pStr );
|
||||
|
||||
}
|
||||
|
||||
// Flugente: display the time left/frequencies on armed bombs (as we can now arm them in our inventory)
|
||||
if( ( (Item[pObject->usItem].usItemClass & (IC_BOMB)) && ( ( (*pObject)[0]->data.misc.bDetonatorType == BOMB_TIMED ) || ( (*pObject)[0]->data.misc.bDetonatorType == BOMB_REMOTE ) ) ) )
|
||||
{
|
||||
sNewY = sY + sHeight - 10;
|
||||
|
||||
INT8 timeleft = (*pObject)[0]->data.misc.bDelay;
|
||||
INT8 detfrequency = (*pObject)[0]->data.misc.bFrequency;
|
||||
INT8 defusefrequency = (*pObject)[0]->data.bDefuseFrequency;
|
||||
|
||||
if ( ( (*pObject)[0]->data.misc.bDetonatorType == BOMB_TIMED ) && timeleft > 0 )
|
||||
{
|
||||
SetRGBFontForeground( 250, 0, 0 );
|
||||
|
||||
if ( defusefrequency > 0 )
|
||||
swprintf( pStr, L"%d/%d", timeleft, defusefrequency );
|
||||
else
|
||||
swprintf( pStr, L"%d", timeleft );
|
||||
}
|
||||
else if ( detfrequency > 0 )
|
||||
{
|
||||
SetRGBFontForeground( 207, 211, 39 );
|
||||
|
||||
if ( defusefrequency > 0 )
|
||||
swprintf( pStr, L"%d/%d", detfrequency, defusefrequency );
|
||||
else
|
||||
swprintf( pStr, L"%d", detfrequency );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetRGBFontForeground( 7, 243, 143 );
|
||||
|
||||
swprintf( pStr, L"-/%d", defusefrequency );
|
||||
}
|
||||
|
||||
// Get length of string
|
||||
uiStringLength=StringPixLength(pStr, ITEM_FONT );
|
||||
|
||||
sNewX = sX + sWidth - uiStringLength - 4;
|
||||
|
||||
if ( uiBuffer == guiSAVEBUFFER )
|
||||
{
|
||||
RestoreExternBackgroundRect( sNewX, sNewY, 15, 15 );
|
||||
}
|
||||
mprintf( sNewX, sNewY, pStr );
|
||||
gprintfinvalidate( sNewX, sNewY, pStr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5823,6 +5870,27 @@ void ItemDescAttachmentsCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
// ATE: Make sure we have enough AP's to drop it if we pick it up!
|
||||
if ( pAttachment->exists() && EnoughPoints( gpItemDescSoldier, ( AttachmentAPCost( pAttachment->usItem, gpItemDescObject, gpItemPointerSoldier ) + APBPConstants[AP_PICKUP_ITEM] ), 0, TRUE ) )
|
||||
{
|
||||
// Flugente: if we are trying to remove the detonators of an armed bomb, auto-fail: it explodes
|
||||
if ( gpItemPointerSoldier && ( (Item[gpItemDescObject->usItem].usItemClass & (IC_BOMB)) && ( ( (*gpItemDescObject)[ubStatusIndex]->data.misc.bDetonatorType == BOMB_TIMED ) || ( (*gpItemDescObject)[ubStatusIndex]->data.misc.bDetonatorType == BOMB_REMOTE ) ) ) )
|
||||
{
|
||||
if ( guiCurrentScreen == GAME_SCREEN )
|
||||
{
|
||||
// ignite explosions manually - this item is not in the WorldBombs-structure, so we can't add it to the queue
|
||||
IgniteExplosion( (*gpItemDescObject)[0]->data.misc.ubBombOwner - 2, gpItemPointerSoldier->sX, gpItemPointerSoldier->sY, (INT16) (gpWorldLevelData[gpItemPointerSoldier->sGridNo].sHeight), gpItemPointerSoldier->sGridNo, gpItemDescObject->usItem, gpItemPointerSoldier->pathing.bLevel, gpItemPointerSoldier->ubDirection );
|
||||
|
||||
DeleteObj( gpItemDescObject );
|
||||
}
|
||||
else if ( (guiCurrentScreen == MAP_SCREEN) || (guiCurrentScreen == MSG_BOX_SCREEN) )
|
||||
{
|
||||
// no explosions in map screen - instead we simply damage the inventory and harm our health
|
||||
gpItemPointerSoldier->InventoryExplosion();
|
||||
|
||||
DeleteObj( gpItemDescObject );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Get attachment if there is one
|
||||
// The follwing function will handle if no attachment is here
|
||||
if ( gpItemDescObject->RemoveAttachment( pAttachment, &gItemPointer, ubStatusIndex, gpItemDescSoldier ) )
|
||||
|
||||
+1
-1
@@ -13053,7 +13053,7 @@ INT32 GetGunAccuracy( OBJECTTYPE *pObj )
|
||||
if ( gGameOptions.fWeaponOverheating )
|
||||
{
|
||||
FLOAT overheatdamagepercentage = GetGunOverheatDamagePercentage( pObj );
|
||||
FLOAT accuracymalus = (max(1.0f, overheatdamagepercentage) - 1.0f) * 0.1;
|
||||
FLOAT accuracymalus = (max(1.0f, overheatdamagepercentage) - 1.0f) * 0.1f;
|
||||
accuracyheatmultiplicator = max(0.0f, 1.0f - accuracymalus);
|
||||
}
|
||||
|
||||
|
||||
@@ -857,13 +857,14 @@ void CoolDownWorldItems( BOOLEAN fSetZero )
|
||||
cooldownfactor *= gGameExternalOptions.iCooldownModificatorLonelyBarrel;
|
||||
|
||||
newguntemperature = max(0.0f, guntemperature - cooldownfactor); // ... calculate new temperature ...
|
||||
|
||||
#if 0//def JA2TESTVERSION
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"World: Item temperature lowered from %4.2f to %4.2f", guntemperature, newguntemperature );
|
||||
#endif
|
||||
}
|
||||
|
||||
(*pObj)[i]->data.bTemperature = newguntemperature; // ... set new temperature
|
||||
|
||||
#if 0//def JA2TESTVERSION
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"World: Item temperature lowered from %4.2f to %4.2f", guntemperature, newguntemperatre );
|
||||
#endif
|
||||
// for every objects, we also have to check wether there are weapon attachments (eg. underbarrel grenade launchers), and cool them down too
|
||||
attachmentList::iterator iterend = (*pObj)[i]->attachments.end();
|
||||
for (attachmentList::iterator iter = (*pObj)[i]->attachments.begin(); iter != iterend; ++iter)
|
||||
|
||||
Reference in New Issue
Block a user