Rdio sets no longer need a battery.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7974 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2015-08-14 20:50:27 +00:00
parent dfe2dae684
commit 8fa2d4402c
9 changed files with 3 additions and 189 deletions
-6
View File
@@ -2976,12 +2976,6 @@ void LoadItemSettings()
gItemSettings.fDamageBreathModifierExplosive = iniReader.ReadFloat ("Explosives Settings","DAMAGE_BREATH_EXPLOSIVE_MODIFIER", 1.0f, 0.1f, 5.0f);
gItemSettings.fDamageHealthMoveModifierExplosive = iniReader.ReadFloat ("Explosives Settings","DAMAGE_HEALTH_MOVE_EXPLOSIVE_MODIFIER", 0.1f, 0.0f, 1.0f);
gItemSettings.fDamageBreathMoveModifierExplosive = iniReader.ReadFloat ("Explosives Settings","DAMAGE_BREATH_MOVE_EXPLOSIVE_MODIFIER", 0.1f, 0.0f, 1.0f);
// ------------ ENERGY MODIFIERS -----------------
gItemSettings.energy_cost_radioset_activate = iniReader.ReadFloat ("Energy Settings","ENERGY_COST_RADIOSET_ACTIVATE", 100.00f, 1.00f, 1000.0f);
gItemSettings.energy_cost_radioset_jam = iniReader.ReadFloat ("Energy Settings","ENERGY_COST_RADIOSET_JAM", 10.00f, 1.00f, 1000.0f);
gItemSettings.energy_cost_radioset_scan = iniReader.ReadFloat ("Energy Settings","ENERGY_COST_RADIOSET_SCAN", 3.00f, 1.00f, 1000.0f);
gItemSettings.energy_cost_radioset_scan_assignment = iniReader.ReadFloat ("Energy Settings","ENERGY_COST_RADIOSET_SCAN_ASSIGNMENT", 3000.00f, 1.00f, 30000.0f);
}
INT16 DynamicAdjustAPConstants(INT16 iniReadValue, INT16 iniDefaultValue, BOOLEAN reverse)
-7
View File
@@ -2233,13 +2233,6 @@ typedef struct
FLOAT fDamageHealthMoveModifierExplosive; // applies when character moves through gas cloud without a gas mask
FLOAT fDamageBreathMoveModifierExplosive; // applies when character moves through gas cloud without a gas mask
// ------------ ENERGY MODIFIERS -----------------
// Flugente: energy consumption settings (energy-consumption of attached non-vanilla batteries)
FLOAT energy_cost_radioset_activate;
FLOAT energy_cost_radioset_jam;
FLOAT energy_cost_radioset_scan;
FLOAT energy_cost_radioset_scan_assignment;
}ITEM_SETTINGS;
extern MOD_SETTINGS gModSettings;
-3
View File
@@ -5407,9 +5407,6 @@ void HandleRadioScanInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
if( ( pSoldier->bAssignment == RADIO_SCAN ) && ( EnoughTimeOnAssignment( pSoldier ) ) && ( pSoldier->flags.fMercAsleep == FALSE ) )
{
++numberofradiooperators;
// use up radio energy
pSoldier->DepleteActiveRadioSetEnergy(FALSE, TRUE);
}
}
}
-77
View File
@@ -3981,19 +3981,6 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
DrawItemUIBarEx( pObject, DRAW_ITEM_TEMPERATURE, sX, sY + sHeight-1, ITEMDESC_ITEM_STATUS_WIDTH, (INT16)((sHeight-1)*(1-condition)), colour, colour, TRUE, guiSAVEBUFFER);
}
// Flugente: display energy level of power packs
else if ( HasItemFlag(pObject->usItem, POWER_PACK) )
{
FLOAT energylevel = (*pObject)[0]->data.bTemperature / (FLOAT)OVERHEATING_MAX_TEMPERATURE;
UINT32 red = (UINT32) ( 255 * ( 1.0 - max(0, 2*energylevel - 1.0) ) );
UINT32 green = (UINT32) ( 255 * ( min(1.0, 2*energylevel) ) );
UINT32 blue = 0;
UINT16 colour = Get16BPPColor( FROMRGB( red, green, blue ) );
DrawItemUIBarEx( pObject, DRAW_ITEM_TEMPERATURE, sX, sY + sHeight-1, ITEMDESC_ITEM_STATUS_WIDTH, sHeight-1, colour, colour, TRUE, guiSAVEBUFFER);
}
}
// display symbol if we are leaning our weapon on something
@@ -6975,22 +6962,6 @@ void RenderItemDescriptionBox( )
DrawItemUIBarEx( &(*iter), DRAW_ITEM_TEMPERATURE, sCenX+4, sCenY, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, colour, colour, TRUE, guiSAVEBUFFER );
}
// Flugente: display energy level of power packs
else if ( HasItemFlag(iter->usItem, POWER_PACK) )
{
if ( OVERHEATING_MAX_TEMPERATURE > 0 )
{
FLOAT energylevel = (*iter)[0]->data.bTemperature / (FLOAT)OVERHEATING_MAX_TEMPERATURE;
UINT32 red = (UINT32) ( 255 * ( 1.0 - max(0, 2*energylevel - 1.0) ) );
UINT32 green = (UINT32) ( 255 * ( min(1.0, 2*energylevel) ) );
UINT32 blue = 0;
UINT16 colour = Get16BPPColor( FROMRGB( red, green, blue ) );
DrawItemUIBarEx( &(*iter), DRAW_ITEM_TEMPERATURE, sCenX+4, sCenY, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, colour, colour, TRUE, guiSAVEBUFFER );
}
}
}
}
@@ -7279,54 +7250,6 @@ void RenderItemDescriptionBox( )
mprintf( usX, usY, pStr );
}
}
else if ( HasItemFlag(gpItemDescObject->usItem, POWER_PACK) )
{
if ( OVERHEATING_MAX_TEMPERATURE > 0 )
{
FLOAT energylevel = (*gpItemDescObject)[0]->data.bTemperature / (FLOAT)OVERHEATING_MAX_TEMPERATURE;
UINT32 red = (UINT32) ( 255 * ( 1.0 - max(0, 2*energylevel - 1.0) ) );
UINT32 green = (UINT32) ( 255 * ( min(1.0, 2*energylevel) ) );
UINT32 blue = 0;
UINT8 stringNum = 5;
if ( energylevel > 0.8f )
stringNum = 1;
else if ( energylevel > 0.6f )
stringNum = 2;
else if ( energylevel > 0.4f )
stringNum = 3;
else if ( energylevel > 0.2f )
stringNum = 4;
// UDB system displays a string with colored condition text.
int regionindex = 7;
SetFontForeground( ForegroundColor );
swprintf( pStr, L"%s", gPowerPackDesc[STR_POWERPACK_BEGIN] ); // "Temperature is "
mprintf( gItemDescTextRegions[regionindex].sLeft, gItemDescTextRegions[regionindex].sTop, pStr );
// Record length
INT16 indent = StringPixLength( gPowerPackDesc[STR_POWERPACK_BEGIN], ITEMDESC_FONT );
swprintf( pStr, L"%s", gPowerPackDesc[stringNum] );
SetRGBFontForeground( red, green, blue );
mprintf( gItemDescTextRegions[regionindex].sLeft+indent+2, gItemDescTextRegions[regionindex].sTop, pStr );
// Record length
indent += StringPixLength( gPowerPackDesc[stringNum], ITEMDESC_FONT );
SetFontForeground( ForegroundColor );
swprintf( pStr, L"%s", gPowerPackDesc[STR_POWERPACK_END] ); // "."
mprintf( gItemDescTextRegions[regionindex].sLeft + indent + 2, gItemDescTextRegions[regionindex].sTop, pStr );
// to get the text to the left side...
swprintf( pStr, L"");
FindFontRightCoordinates( gItemDescTextRegions[regionindex].sLeft, gItemDescTextRegions[regionindex].sTop, gItemDescTextRegions[regionindex].sRight - gItemDescTextRegions[regionindex].sLeft ,gItemDescTextRegions[regionindex].sBottom - gItemDescTextRegions[regionindex].sTop ,pStr, BLOCKFONT2, &usX, &usY);
mprintf( usX, usY, pStr );
}
}
// UDB system displays a string with colored condition text.
SetFontForeground( ForegroundColor );
-7
View File
@@ -434,13 +434,6 @@ void DrawItemUIBarEx( OBJECTTYPE *pObject, UINT8 ubStatus, INT16 sXPos, INT16 sY
{
sValue = 100;
}
else if ( HasItemFlag(pObject->usItem, POWER_PACK) )
{
if ( OVERHEATING_MAX_TEMPERATURE > 0 )
{
sValue = (INT16) ( 100 * (*pObject)[0]->data.bTemperature / (FLOAT)OVERHEATING_MAX_TEMPERATURE );
}
}
else
{
sValue = (INT16) (100 * GetGunOverheatJamPercentage( pObject) );
+1 -1
View File
@@ -763,7 +763,7 @@ extern OBJECTTYPE gTempObject;
#define TRIPWIREROLL 0x01000000 //16777216 // this item is a tripwire roll
#define RADIO_SET 0x02000000 //33554432 // item can be used to radio militia/squads in other sectors
#define SIGNAL_SHELL 0x04000000 //67108864 // this is a signal shell that precedes artillery barrages
#define POWER_PACK 0x08000000 //134217728 // item continously powers an item it is attached to
//#define POWER_PACK 0x08000000 //134217728 // item continously powers an item it is attached to
#define ROOF_COLLAPSE_ITEM 0x10000000 //268435456 // this item is required in the collapsing of roof tiles. It is used internally and should never be seen by the player
#define DISEASEPROTECTION_1 0x20000000 //536870912 // this item protects us from getting diseases by human contact if kept in inventory
-6
View File
@@ -8094,12 +8094,6 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj )
(*pObj)[0]->data.bTemperature = OVERHEATING_MAX_TEMPERATURE;
}
// Flugente: certain items get the maximum temperature when they are created
if ( HasItemFlag(usItem, POWER_PACK) )
{
(*pObj)[0]->data.bTemperature = OVERHEATING_MAX_TEMPERATURE;
}
//ADB ubWeight has been removed, see comments in OBJECTTYPE
//pObj->ubWeight = CalculateObjectWeight( pObj );
fRet = TRUE;
+2 -81
View File
@@ -17347,27 +17347,7 @@ BOOLEAN SOLDIERTYPE::CanUseRadio( BOOLEAN fCheckForAP )
pObj = GetObjectWithFlag( RADIO_SET );
if ( pObj && HasItemFlag( pObj->usItem, RADIO_SET ) )
{
// if radio set doesn't need batteries, all is fine
if ( !Item[pObj->usItem].needsbatteries )
return TRUE;
//search power pack
attachmentList::iterator iterend = (*pObj)[0]->attachments.end( );
for ( attachmentList::iterator iter = (*pObj)[0]->attachments.begin( ); iter != iterend; ++iter )
{
// do we have a power pack?
if ( iter->exists( ) && HasItemFlag( iter->usItem, POWER_PACK ) )
{
// Hack (or clever use of unused memory, depending on your view):
// data.bTemperature has to exist on all items, as it is used on weapons and certain attachments (barrels)
// It isn't used on armor... that's why we can use it now. The idea is that the temperature of the power pack represents its available energy.
// The cooling down represents its energy depleting.
if ( (*iter)[0]->data.bTemperature > 0.0f )
return(TRUE);
}
}
}
return TRUE;
return FALSE;
}
@@ -17388,10 +17368,7 @@ BOOLEAN SOLDIERTYPE::UseRadio( )
if ( Chance( (*pObj)[0]->data.objectStatus ) )
success = TRUE;
}
// even if we fail, we still use up AP, use animation an use up batteries
DepleteActiveRadioSetEnergy( TRUE );
if ( this->bInSector && (this->ubBodyType == REGMALE || this->ubBodyType == BIGMALE) )
{
switch ( gAnimControl[this->usAnimState].ubEndHeight )
@@ -18103,62 +18080,6 @@ SOLDIERTYPE::RadioFail( )
}
}
void SOLDIERTYPE::DepleteActiveRadioSetEnergy( BOOLEAN fActivation, BOOLEAN fAssignment )
{
if ( !CanUseRadio( FALSE ) )
return;
FLOAT cost = 0;
if ( fActivation )
cost = gItemSettings.energy_cost_radioset_activate;
else if ( fAssignment )
cost = gItemSettings.energy_cost_radioset_scan_assignment;
else if ( usSoldierFlagMask & SOLDIER_RADIO_OPERATOR_JAMMING )
cost = gItemSettings.energy_cost_radioset_jam;
else if ( usSoldierFlagMask & (SOLDIER_RADIO_OPERATOR_SCANNING | SOLDIER_RADIO_OPERATOR_LISTENING) )
cost = gItemSettings.energy_cost_radioset_scan;
else
// nothing to do here..
return;
OBJECTTYPE* pObj = NULL;
if ( this->bTeam == OUR_TEAM && UsingNewInventorySystem( ) )
pObj = &(inv[CPACKPOCKPOS]);
else
pObj = GetObjectWithFlag( RADIO_SET );
if ( pObj && HasItemFlag( pObj->usItem, RADIO_SET ) )
{
// if radio set doesn't need batteries, all is fine
if ( !Item[pObj->usItem].needsbatteries )
return;
//search power pack
attachmentList::iterator iterend = (*pObj)[0]->attachments.end( );
for ( attachmentList::iterator iter = (*pObj)[0]->attachments.begin( ); iter != iterend; ++iter )
{
// do we have a power pack on our armor?
if ( iter->exists( ) && HasItemFlag( iter->usItem, POWER_PACK ) )
{
(*iter)[0]->data.bTemperature = max( 0.0f, (*iter)[0]->data.bTemperature - cost );
if ( (*iter)[0]->data.bTemperature <= 0.0f )
{
// destroy batteries
iter->RemoveObjectsFromStack( 1 );
if ( iter->exists( ) == false )
pObj->RemoveAttachment( &(*iter) );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RADIO_NO_ENERGY], this->GetName( ) );
}
// there can only be one battery on a radio set
return;
}
}
}
}
// Flugente: spotter
BOOLEAN SOLDIERTYPE::IsSpotting( )
{
-1
View File
@@ -1871,7 +1871,6 @@ public:
BOOLEAN RadioCallReinforcements( UINT32 usSector, UINT16 sNumber );
BOOLEAN SwitchOffRadio();
void RadioFail(); // display and error sound used either when the radio set fails or the sector is jammed - the player knows of the error, but cannot be sure of the cause
void DepleteActiveRadioSetEnergy(BOOLEAN fActivation = FALSE, BOOLEAN fAssignment = FALSE);
// Flugente: spotter
BOOLEAN IsSpotting();