mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Merged revision(s) 7166-7177 from branches/ja2_source_official_2014:
- Flagmasks are unsigned, and should be called and treated as such - Fix: experience gain from interrogation was too high - Fix: chance of a prisoner becoming militia was calculated wrong - default weight maximum for MOVE ITEM assignment increased from 30 to 40 kg - Fix: snitches report the same event multiple times - Fix: snitches treat vehicles as persons - Fix: selection of launchables is inefficient, an does not take into account wether items are depending on day/night cycle - new key combination: in strategic, pressing [CTRL] + [E] wile both a merc's inventory and the sector inventory are open will fill the merc's inventory with sector items - trivial code cleanup - if prisoners are taken in a sector that houses a prison, that prison can also be selected to house them - Fix: distributing newly taken prisoners in a prison sector no longer redistributes all prisoners, only the new ones - GetClosestFlaggedSoldierID can also be called without evaluation of sight - Fix: Covert Ops: throwing/lobbing items or shooting rockets is deemed suspicious behaviour - Fix: boxing was broken by loading a savegame - Fix: campaign history rarely recorded kills in autoresolve - There is no reason why the IDs that boxers are reset to before they are reinitialised would ever need to be altered by a modder. Required script change in stable GameDir r2024. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7178 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+42
-12
@@ -9508,7 +9508,7 @@ BOOLEAN ApplyClothes( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fUseAPs
|
||||
if ( newvest )
|
||||
{
|
||||
// if we are already wearing a vest, give us back that item
|
||||
if ( pSoldier->bSoldierFlagMask & SOLDIER_NEW_VEST )
|
||||
if ( pSoldier->usSoldierFlagMask & SOLDIER_NEW_VEST )
|
||||
{
|
||||
UINT16 vestitem = 0;
|
||||
if ( GetFirstClothesItemWithSpecificData(&vestitem, pSoldier->VestPal, "blank") )
|
||||
@@ -9522,16 +9522,16 @@ BOOLEAN ApplyClothes( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fUseAPs
|
||||
}
|
||||
|
||||
SET_PALETTEREP_ID( pSoldier->VestPal, Clothes[clothestype].vest );
|
||||
pSoldier->bSoldierFlagMask |= SOLDIER_NEW_VEST;
|
||||
pSoldier->usSoldierFlagMask |= SOLDIER_NEW_VEST;
|
||||
|
||||
// this vest is not damaged, so remove the damaged vest flag
|
||||
pSoldier->bSoldierFlagMask &= ~SOLDIER_DAMAGED_VEST;
|
||||
pSoldier->usSoldierFlagMask &= ~SOLDIER_DAMAGED_VEST;
|
||||
}
|
||||
|
||||
if ( newpants )
|
||||
{
|
||||
// if we are already wearing a vest, give us back that item
|
||||
if ( pSoldier->bSoldierFlagMask & SOLDIER_NEW_PANTS )
|
||||
if ( pSoldier->usSoldierFlagMask & SOLDIER_NEW_PANTS )
|
||||
{
|
||||
UINT16 pantsitem = 0;
|
||||
if ( GetFirstClothesItemWithSpecificData(&pantsitem, "blank", pSoldier->PantsPal) )
|
||||
@@ -9545,10 +9545,10 @@ BOOLEAN ApplyClothes( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fUseAPs
|
||||
}
|
||||
|
||||
SET_PALETTEREP_ID( pSoldier->PantsPal, Clothes[clothestype].pants );
|
||||
pSoldier->bSoldierFlagMask |= SOLDIER_NEW_PANTS;
|
||||
pSoldier->usSoldierFlagMask |= SOLDIER_NEW_PANTS;
|
||||
|
||||
// these pants are not damaged, so remove the damaged pants flag
|
||||
pSoldier->bSoldierFlagMask &= ~SOLDIER_DAMAGED_PANTS;
|
||||
pSoldier->usSoldierFlagMask &= ~SOLDIER_DAMAGED_PANTS;
|
||||
}
|
||||
|
||||
// Use palette from HVOBJECT, then use substitution for pants, etc
|
||||
@@ -9567,10 +9567,10 @@ BOOLEAN ApplyClothes( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fUseAPs
|
||||
DeductPoints( pSoldier, apcost, 0 );
|
||||
}
|
||||
|
||||
if ( pSoldier->bSoldierFlagMask & SOLDIER_NEW_VEST && pSoldier->bSoldierFlagMask & SOLDIER_NEW_PANTS )
|
||||
if ( pSoldier->usSoldierFlagMask & SOLDIER_NEW_VEST && pSoldier->usSoldierFlagMask & SOLDIER_NEW_PANTS )
|
||||
{
|
||||
// first, remove the covert flags, and then reapply the correct ones, in case we switch between civilian and military clothes
|
||||
pSoldier->bSoldierFlagMask &= ~(SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER);
|
||||
pSoldier->usSoldierFlagMask &= ~(SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER);
|
||||
|
||||
// we now have to determine wether we are currently wearing civilian or military clothes
|
||||
for ( UINT8 i = UNIFORM_ENEMY_ADMIN; i <= UNIFORM_ENEMY_ELITE; ++i )
|
||||
@@ -9578,7 +9578,7 @@ BOOLEAN ApplyClothes( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fUseAPs
|
||||
// both parts have to fit. We cant mix different uniforms and get soldier disguise
|
||||
if ( COMPARE_PALETTEREP_ID(pSoldier->VestPal, gUniformColors[ i ].vest) && COMPARE_PALETTEREP_ID(pSoldier->PantsPal, gUniformColors[ i ].pants) )
|
||||
{
|
||||
pSoldier->bSoldierFlagMask |= SOLDIER_COVERT_SOLDIER;
|
||||
pSoldier->usSoldierFlagMask |= SOLDIER_COVERT_SOLDIER;
|
||||
|
||||
if ( pSoldier->bTeam == OUR_TEAM )
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_DISGUISED_AS_SOLDIER], pSoldier->GetName() );
|
||||
@@ -9588,9 +9588,9 @@ BOOLEAN ApplyClothes( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fUseAPs
|
||||
}
|
||||
|
||||
// if not dressed as a soldier, we must be dressed as a civilian
|
||||
if ( !(pSoldier->bSoldierFlagMask & SOLDIER_COVERT_SOLDIER) )
|
||||
if ( !(pSoldier->usSoldierFlagMask & SOLDIER_COVERT_SOLDIER) )
|
||||
{
|
||||
pSoldier->bSoldierFlagMask |= SOLDIER_COVERT_CIV;
|
||||
pSoldier->usSoldierFlagMask |= SOLDIER_COVERT_CIV;
|
||||
|
||||
if ( pSoldier->bTeam == OUR_TEAM )
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_DISGUISED_AS_CIVILIAN], pSoldier->GetName() );
|
||||
@@ -12194,8 +12194,8 @@ UINT16 PickARandomLaunchable(UINT16 itemIndex)
|
||||
{
|
||||
UINT16 usNumMatches = 0;
|
||||
UINT16 usRandom = 0;
|
||||
UINT16 i = 0;
|
||||
UINT16 lowestCoolness = LowestLaunchableCoolness(itemIndex);
|
||||
#if 0
|
||||
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("PickARandomLaunchable: itemIndex = %d", itemIndex));
|
||||
|
||||
// WANNE: This should fix the hang on the merc positioning screen (fix by Razer)
|
||||
@@ -12230,6 +12230,36 @@ UINT16 PickARandomLaunchable(UINT16 itemIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Flugente: the above code is highly dubious.. why do we loop over all items 2 times, and why that obscure usRandom--; business? This can cause an underflow!
|
||||
BOOLEAN isnight = NightTime();
|
||||
UINT16 maxcoolness = max( HighestPlayerProgressPercentage() / 10, lowestCoolness );
|
||||
|
||||
std::vector<UINT16> legalvec;
|
||||
for ( UINT16 i = 0; i < MAXITEMS; ++i )
|
||||
{
|
||||
if ( Item[i].usItemClass == 0 )
|
||||
break;
|
||||
|
||||
//Madd: quickfix: make it not choose best grenades right away.
|
||||
if ( Item[i].ubCoolness <= maxcoolness && ItemIsLegal( i ) && ValidLaunchable( i, itemIndex ) )
|
||||
{
|
||||
// Flugente: ignore this item if we aren't allowed to pick it at this time of day
|
||||
if ( (isnight && Item[i].usItemChoiceTimeSetting == 1) || (!isnight && Item[i].usItemChoiceTimeSetting == 2) )
|
||||
continue;
|
||||
|
||||
legalvec.push_back(i);
|
||||
++usNumMatches;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !legalvec.empty() )
|
||||
{
|
||||
usRandom = (UINT16)Random( legalvec.size() );
|
||||
|
||||
return legalvec[usRandom];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user