mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
New feature: Getting and using intel allows for more spy-related roleplay.
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=23643&goto=352475&#msg_352475 Requires GameDir >= r2401. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8522 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1421,6 +1421,30 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
|
||||
}
|
||||
}
|
||||
|
||||
// Flugente: camera
|
||||
if ( HasItemFlag( usHandItem, CAMERA ) )
|
||||
{
|
||||
sAPCost = APBPConstants[AP_CAMERA];
|
||||
|
||||
if ( EnoughPoints( pSoldier, sAPCost, 0, fFromUI ) )
|
||||
{
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, sGridNo, gsInterfaceLevel, 0, TRUE, CALC_FROM_WANTED_DIR, TRUE ) )
|
||||
{
|
||||
TakePhoto( pSoldier, usMapPos, gsInterfaceLevel );
|
||||
|
||||
return( ITEM_HANDLE_OK );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( ITEM_HANDLE_CANNOT_GETTO_LOCATION );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return( ITEM_HANDLE_NOAPS );
|
||||
}
|
||||
}
|
||||
|
||||
// Flugente: apply misc items to other soldiers
|
||||
if ( ItemCanBeAppliedToOthers( usHandItem ) )
|
||||
{
|
||||
@@ -9238,6 +9262,9 @@ void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name )
|
||||
|
||||
// the temperature of the water in this sector (temperature reflects the quality)
|
||||
FLOAT wateraddtemperature = OVERHEATING_MAX_TEMPERATURE;
|
||||
|
||||
// if we try to add an attachment that cannot be added by this function (we don't perform skill checks here), warn the player of the offending item
|
||||
UINT16 attachmenttowarnabout = NOTHING;
|
||||
|
||||
// 1. loop over the gear we should pick up and remove mismatching items if we can find a fitting one in the sector
|
||||
for (std::vector<GEAR_NODE>::iterator it = vec.begin(); it != vec.end(); ++it)
|
||||
@@ -9381,7 +9408,7 @@ void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name )
|
||||
UINT8 index = 0;
|
||||
if ( GetBetterObject_InventoryPool( item_attachment, 0, poolslot, index ) )
|
||||
{
|
||||
(pInventoryPoolList[poolslot].object).RemoveObjectAtIndex( index, &gItemPointer );
|
||||
( pInventoryPoolList[poolslot].object ).RemoveObjectAtIndex( index, &gItemPointer );
|
||||
|
||||
BOOLEAN isAttachedNow = pObj->AttachObject( pSoldier, &gItemPointer, FALSE, i ); //do the actual attaching
|
||||
|
||||
@@ -9396,6 +9423,10 @@ void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name )
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attachmenttowarnabout = item_attachment;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9657,7 +9688,11 @@ void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name )
|
||||
DeleteObj( &gItemPointer );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attachmenttowarnabout = item_attachment;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9809,6 +9844,12 @@ void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name )
|
||||
else if ( attachmentsound )
|
||||
PlayJA2Sample( ATTACH_TO_GUN, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
||||
|
||||
// warn us if we tried to attach something we can't attach
|
||||
if ( attachmenttowarnabout != NOTHING )
|
||||
{
|
||||
ScreenMsg( color, MSG_INTERFACE, szGearTemplateText[5], Item[attachmenttowarnabout].szItemName, attachmenttowarnabout );
|
||||
}
|
||||
|
||||
// 6. redraw inventory
|
||||
fTeamPanelDirty = TRUE;
|
||||
fMapPanelDirty = TRUE;
|
||||
@@ -9820,3 +9861,48 @@ void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name )
|
||||
MarkAButtonDirty( giItemDescAmmoButton ); // Required for tactical screen
|
||||
}
|
||||
}
|
||||
|
||||
// Flugente: intel
|
||||
void TakePhoto(SOLDIERTYPE* pSoldier, INT32 sGridNo, INT8 bLevel )
|
||||
{
|
||||
if ( !pSoldier || TileIsOutOfBounds( sGridNo ) )
|
||||
return;
|
||||
|
||||
// if we take a photo, take note of all rooms & NPC we see. We then send that to LUA, where we store anything worthwhile
|
||||
// later on, we can then sell worthwhile information 'gathered' this way for intel
|
||||
|
||||
// to make this simple, check only tiles in a radius around the gridno we targetted
|
||||
INT16 sBaseX, sBaseY;
|
||||
ConvertGridNoToXY( sGridNo, &sBaseX, &sBaseY );
|
||||
|
||||
int radius = 3;
|
||||
|
||||
for ( int x = -radius; x < radius; ++x )
|
||||
{
|
||||
int diff = sqrt( radius*radius - x*x );
|
||||
|
||||
for ( int y = -diff; y < diff; ++y )
|
||||
{
|
||||
INT32 newgridno = MAPROWCOLTOPOS( (sBaseY + y), ( sBaseX + x ));
|
||||
|
||||
// can we see this gridno?
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, newgridno, bLevel, 0, TRUE, CALC_FROM_WANTED_DIR, TRUE ) )
|
||||
{
|
||||
// check if this is a room
|
||||
UINT16 room = NO_ROOM;
|
||||
if ( !bLevel )
|
||||
InARoom( newgridno, &room );
|
||||
|
||||
// check if there is someone here
|
||||
UINT16 ubid = WhoIsThere2( newgridno, bLevel );
|
||||
|
||||
LuaAddPhotoData( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, newgridno, bLevel, pSoldier->ubProfile, room, ( ubid == NOBODY ) ? NO_PROFILE : MercPtrs[ubid]->ubProfile );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DeductPoints( pSoldier, APBPConstants[AP_CAMERA], 0, 0 );
|
||||
|
||||
// Play sound
|
||||
PlayJA2SampleFromFile( "Sounds\\camera1.wav", RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user