diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index 291e2705..d414eb73 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -6113,7 +6113,7 @@ BOOLEAN HandleDefiniteUnloadingOfWorld( UINT8 ubUnloadCode ) //if we arent loading a saved game if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { - // Flugente: Set temperares of all items in the old sector to zero before entering a new sector + // Flugente: Set temperatures of all items in the old sector to zero before entering a new sector CoolDownWorldItems( TRUE ); // Save the current sectors Item list to a temporary file, if its not the first time in diff --git a/Tactical/Drugs And Alcohol.cpp b/Tactical/Drugs And Alcohol.cpp index 541a9cd6..df0ae704 100644 --- a/Tactical/Drugs And Alcohol.cpp +++ b/Tactical/Drugs And Alcohol.cpp @@ -66,6 +66,9 @@ BOOLEAN ApplyDrugs( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject ) gMercProfiles[ LARRY_DRUNK ].bNPCData = 0; } + // set flag: we are on drugs + pSoldier->bSoldierFlagMask |= SOLDIER_DRUGGED; + // Flugente: we have to check for every single type of drug ( a drug applied may consist of several 'pure' drug types) for (UINT8 i = DRUG_TYPE_ADRENALINE; i < DRUG_TYPE_MAX; ++i) { @@ -244,6 +247,10 @@ void HandleEndTurnDrugAdjustments( SOLDIERTYPE *pSoldier ) INT32 cnt, cnt2; INT32 iNumLoops; + // if were not on drugs, nothing to do here + if ( ( pSoldier->bSoldierFlagMask & SOLDIER_DRUGGED ) == 0 ) + return; + // We test for every 'pure' drug separately for (cnt = DRUG_TYPE_ADRENALINE; cnt < DRUG_TYPE_MAX; ++cnt) { @@ -424,6 +431,10 @@ void HandleEndTurnDrugAdjustments( SOLDIERTYPE *pSoldier ) } } } + + // if all drug effects have ended, delete flag + if ( !MercUnderTheInfluence(pSoldier) ) + pSoldier->bSoldierFlagMask &= ~SOLDIER_DRUGGED; } INT8 GetDrugEffect( SOLDIERTYPE *pSoldier, UINT8 ubDrugType ) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index d5c416de..5d874a17 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -3835,6 +3835,8 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec // HEADROCK HAM 4: Advanced Icons if (guiItemInfoAdvancedIcon == 0) { + // added by Flugente + // HEADROCK HAM 4: Advanced Icons VOBJECT_DESC VObjectDesc; VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; strcpy( VObjectDesc.ImageFile, "INTERFACE\\ItemInfoAdvancedIcons.STI" ); @@ -5896,17 +5898,15 @@ void ItemDescAttachmentsCallback( MOUSE_REGION * pRegion, INT32 iReason ) { // 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 ); } + DeleteObj( gpItemDescObject ); + return; } @@ -5928,7 +5928,7 @@ void ItemDescAttachmentsCallback( MOUSE_REGION * pRegion, INT32 iReason ) fMapInventoryItem=TRUE; fTeamPanelDirty=TRUE; } - + //if we are currently in the shopkeeper interface else if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) { @@ -5936,6 +5936,15 @@ void ItemDescAttachmentsCallback( MOUSE_REGION * pRegion, INT32 iReason ) BeginSkiItemPointer( PLAYERS_INVENTORY, -1, FALSE ); } + // Flugente: if we altered a gun's attachments, re-evaluate the scope mode and sight + if ( gGameExternalOptions.fScopeModes && gpItemPointerSoldier && Item[gpItemDescObject->usItem].usItemClass == IC_GUN ) + { + ChangeScopeMode( gpItemPointerSoldier ); + + // reevaluate sight + ManLooksForOtherTeams( gpItemPointerSoldier ); + } + //Dirty interface fInterfacePanelDirty = DIRTYLEVEL2; @@ -12607,17 +12616,15 @@ void BombInventoryMessageBoxCallBack( UINT8 ubExitValue ) { // 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, gpItemDescSoldier->sX, gpItemDescSoldier->sY, (INT16) (gpWorldLevelData[gpItemDescSoldier->sGridNo].sHeight), gpItemDescSoldier->sGridNo, gpItemDescObject->usItem, gpItemDescSoldier->pathing.bLevel, gpItemDescSoldier->ubDirection ); - - DeleteObj( gpItemDescObject ); } else if ( (screen == MAP_SCREEN) || (screen == MSG_BOX_SCREEN) ) { // no explosions in map screen - instead we simply damage the inventory and harm our health gpItemDescSoldier->InventoryExplosion(); - - DeleteObj( gpItemDescObject ); } + DeleteObj( gpItemDescObject ); + return; } } @@ -12775,17 +12782,15 @@ void BombInventoryDisArmMessageBoxCallBack( UINT8 ubExitValue ) { // 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, gpItemDescSoldier->sX, gpItemDescSoldier->sY, (INT16) (gpWorldLevelData[gpItemDescSoldier->sGridNo].sHeight), gpItemDescSoldier->sGridNo, gpItemDescObject->usItem, gpItemDescSoldier->pathing.bLevel, gpItemDescSoldier->ubDirection ); - - DeleteObj( gpItemDescObject ); } else if ( (screen == MAP_SCREEN) || (screen == MSG_BOX_SCREEN) ) { // no explosions in map screen - instead we simply damage the inventory and harm our health gpItemDescSoldier->InventoryExplosion(); - - DeleteObj( gpItemDescObject ); } + DeleteObj( gpItemDescObject ); + #ifdef JA2TESTVERSION ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Arming failed, explosion here" ); #endif @@ -13158,4 +13163,4 @@ void ConfirmTransformationMessageBoxCallBack( UINT8 bExitValue ) guiCurrentScreen = iTempScreen; guiTransformInProgressPrevScreen = 0; } -} \ No newline at end of file +} diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index c1462823..8b392b30 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -13434,6 +13434,11 @@ void GetScopeLists( OBJECTTYPE * pObj, std::map& arScopeMap if ( IsAttachmentClass(iter->usItem, AC_SCOPE|AC_SIGHT|AC_IRONSIGHT ) ) { FLOAT magfactor = Item[iter->usItem].scopemagfactor; + + // fix: if there is no scopemagfactor (or suspiciously small one), assume it to be 1.0f + if ( magfactor < 0.1f ) + magfactor = 1.0f; + BOOLEAN isplaced = false; for (INT8 i = USE_BEST_SCOPE; i < NUM_SCOPE_MODES; ++i) diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index 974c97e9..ced4aa8e 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -2096,7 +2096,7 @@ UINT8 GetNearestRottingCorpseAIWarning( INT32 sGridNo ) { // if gGameExternalOptions.fZombieSpawnWaves is true, zombies will spawn from all corpses (while there is still room for more), creating a wave of zombies. with lots of bodies lying around, this can be a lot. // if GameExternalOptions.fZombieSpawnWaves is false, each zombie can spawn randomly, you will get zombies on msot turns, but they won't spawn a whole horde at once - if ( ( gGameExternalOptions.fZombieSpawnWaves && (INT8) ( Random( 100 ) ) > 100 - gGameExternalOptions.sZombieRiseWaveFrequency ) || !gGameExternalOptions.fZombieSpawnWaves ) + if ( !gGameExternalOptions.fZombieSpawnWaves || ( gGameExternalOptions.fZombieSpawnWaves && (INT8) ( Random( 100 ) ) > 100 - gGameExternalOptions.sZombieRiseWaveFrequency ) ) { ROTTING_CORPSE * pCorpse; BOOLEAN zombieshaverisen = FALSE; diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 92c31ef3..c314b9d4 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -330,6 +330,49 @@ enum NUM_UNIFORMS, }; +// -------- added by Flugente: various flags for soldiers -------- +// easier than adding 32 differently named variables. DO NOT CHANGE THEM, UNLESS YOU KNOW WHAT YOU ARE DOING!!! +#define SOLDIER_DRUGGED 0x00000001 //1 // Soldier is on drugs +/*#define unused 0x00000002 //2 // Soldier is on a kill streak +#define WH40K_BOLTER 0x00000004 //4 +#define WH40K_FLAMER 0x00000008 //8 + +#define WH40K_POWER_ARMOR 0x00000010 //16 +#define WH40K_POWER_PACK 0x00000020 //32 +#define WH40K_JUMPPACK 0x00000040 //64 +#define WH40K_DISPLACER 0x00000080 //128 + +#define WH40K_ROSARIUS 0x00000100 //256 +#define WH40K_SEAL 0x00000200 //512 +#define WH40K_POWER_WEAPON 0x00000400 //1024 +#define ENEMY_NET_4_LVL_3 0x00000800 //2048 + +#define ENEMY_NET_1_LVL_4 0x00001000 //4096 +#define ENEMY_NET_2_LVL_4 0x00002000 //8192 +#define ENEMY_NET_3_LVL_4 0x00004000 //16384 +#define ENEMY_NET_4_LVL_4 0x00008000 //32768 + +#define PLAYER_NET_1_LVL_1 0x00010000 //65536 +#define PLAYER_NET_2_LVL_1 0x00020000 //131072 +#define PLAYER_NET_3_LVL_1 0x00040000 //262144 +#define PLAYER_NET_4_LVL_1 0x00080000 //524288 + +#define PLAYER_NET_1_LVL_2 0x00100000 //1048576 +#define PLAYER_NET_2_LVL_2 0x00200000 //2097152 +#define PLAYER_NET_3_LVL_2 0x00400000 //4194304 +#define PLAYER_NET_4_LVL_2 0x00800000 //8388608 + +#define PLAYER_NET_1_LVL_3 0x01000000 //16777216 +#define PLAYER_NET_2_LVL_3 0x02000000 //33554432 +#define PLAYER_NET_3_LVL_3 0x04000000 //67108864 +#define PLAYER_NET_4_LVL_3 0x08000000 //134217728 + +#define PLAYER_NET_1_LVL_4 0x10000000 //268435456 +#define PLAYER_NET_2_LVL_4 0x20000000 //536870912 +#define WH40K_SOLDIER_ILLUSION 0x40000000 //1073741824 // Soldier is an Illusion +#define WH40K_SOLDIER_KILLTHISTURN 0x80000000 //2147483648 // Soldier is on a kill streak*/ +// ---------------------------------------------------------------- + // enum of uniform pieces typedef struct { diff --git a/Tactical/World Items.cpp b/Tactical/World Items.cpp index efb5e747..941e6edd 100644 --- a/Tactical/World Items.cpp +++ b/Tactical/World Items.cpp @@ -847,7 +847,7 @@ void CoolDownWorldItems( BOOLEAN fSetZero ) { FLOAT newguntemperature = 0.0f; - if ( !fSetZero && gGameExternalOptions.fSetZeroUponNewSector ) + if ( !fSetZero || !gGameExternalOptions.fSetZeroUponNewSector ) { FLOAT guntemperature = (*pObj)[i]->data.bTemperature; // ... get temperature ... @@ -873,7 +873,7 @@ void CoolDownWorldItems( BOOLEAN fSetZero ) { FLOAT newtemperature = 0.0f; - if ( !fSetZero && gGameExternalOptions.fSetZeroUponNewSector ) + if ( !fSetZero || !gGameExternalOptions.fSetZeroUponNewSector ) { FLOAT temperature = (*iter)[i]->data.bTemperature; // ... get temperature of item ...