diff --git a/Tactical/Civ Quotes.cpp b/Tactical/Civ Quotes.cpp index 7d65184e..90d95838 100644 --- a/Tactical/Civ Quotes.cpp +++ b/Tactical/Civ Quotes.cpp @@ -149,9 +149,8 @@ void CopyNumEntriesIntoQuoteStruct( ) // Not used { INT32 cnt; - for ( cnt = 0; cnt < NUM_CIV_QUOTES; cnt++ ) - { - + for ( cnt = 0; cnt < NUM_CIV_QUOTES; ++cnt ) + { if (cnt <= 50) gCivQuotes[ cnt ].ubNumEntries = gubNumEntries[ cnt ]; else @@ -168,15 +167,15 @@ BOOLEAN GetCivQuoteText(UINT16 ubCivQuoteID, UINT16 ubEntryID, STR16 zQuote ) // Build filename.... if ( ubCivQuoteID == CIV_QUOTE_HINT ) { - if ( gbWorldSectorZ > 0 ) - { - //sprintf( zFileName, "NPCData\\miners.edt" ); - sprintf( zFileName,"NPCDATA\\CIV%02d.edt", CIV_QUOTE_MINERS_NOT_FOR_PLAYER ); - } - else - { - sprintf( zFileName, "NPCData\\%c%d.edt", 'A' + (gWorldSectorY - 1) , gWorldSectorX ); - } + if ( gbWorldSectorZ > 0 ) + { + //sprintf( zFileName, "NPCData\\miners.edt" ); + sprintf( zFileName,"NPCDATA\\CIV%02d.edt", CIV_QUOTE_MINERS_NOT_FOR_PLAYER ); + } + else + { + sprintf( zFileName, "NPCData\\%c%d.edt", 'A' + (gWorldSectorY - 1) , gWorldSectorX ); + } } else { @@ -217,14 +216,14 @@ void SurrenderMessageBoxCallBack( UINT8 ubExitValue ) // Are we active and in sector..... if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { - if ( pTeamSoldier->stats.bLife != 0 ) + if ( pTeamSoldier->stats.bLife != 0 ) { EnemyCapturesPlayerSoldier( pTeamSoldier ); RemoveSoldierFromTacticalSector( pTeamSoldier, TRUE ); } } - } + } EndCaptureSequence( ); @@ -254,8 +253,8 @@ void ShutDownQuoteBox( BOOLEAN fForce ) // Remove mouse region... MSYS_RemoveRegion( &(gCivQuoteData.MouseRegion) ); - RemoveMercPopupBoxFromIndex( gCivQuoteData.iDialogueBox ); - gCivQuoteData.iDialogueBox = -1; + RemoveMercPopupBoxFromIndex( gCivQuoteData.iDialogueBox ); + gCivQuoteData.iDialogueBox = -1; gCivQuoteData.bActive = FALSE; #ifdef JA2UB @@ -303,8 +302,8 @@ INT8 GetCivType( SOLDIERTYPE *pCiv ) // 1 ) check sector.... if ( gWorldSectorX == 10 && gWorldSectorY == 6 && gbWorldSectorZ == 0 ) { - // 2 ) the only female.... - if ( pCiv->ubCivilianGroup == 0 && pCiv->bTeam != gbPlayerNum && pCiv->ubBodyType == REGFEMALE ) + // 2 ) the only female.... + if ( pCiv->ubCivilianGroup == 0 && pCiv->bTeam != gbPlayerNum && pCiv->ubBodyType == REGFEMALE ) { // She's a ho! return( CIV_TYPE_MARRIED_PC ); @@ -427,8 +426,7 @@ void BeginCivQuote( SOLDIERTYPE *pCiv, UINT16 ubCivQuoteID, UINT16 ubEntryID, IN // Prepare text box gCivQuoteData.iDialogueBox = PrepareMercPopupBox( gCivQuoteData.iDialogueBox , BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, gzCivQuote, DIALOGUE_DEFAULT_WIDTH, 0, 0, 0, &gusCivQuoteBoxWidth, &gusCivQuoteBoxHeight ); //SET_USE_WINFONTS( FALSE ); - - + // OK, find center for box...... sX = sX - ( gusCivQuoteBoxWidth / 2 ); sY = sY - ( gusCivQuoteBoxHeight / 2 ); @@ -475,8 +473,7 @@ void BeginCivQuote( SOLDIERTYPE *pCiv, UINT16 ubCivQuoteID, UINT16 ubEntryID, IN CURSOR_NORMAL, MSYS_NO_CALLBACK, QuoteOverlayClickCallback ); // Add region MSYS_AddRegion( &(gCivQuoteData.MouseRegion) ); - - + gCivQuoteData.bActive = TRUE; gCivQuoteData.uiTimeOfCreation = GetJA2Clock( ); @@ -484,7 +481,6 @@ void BeginCivQuote( SOLDIERTYPE *pCiv, UINT16 ubCivQuoteID, UINT16 ubEntryID, IN gCivQuoteData.uiDelayTime = FindDelayForString( gzCivQuote ) + 500; gCivQuoteData.pCiv = pCiv; - } UINT16 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT16 *pubCivHintToUse, BOOLEAN fCanUseHints ) @@ -622,8 +618,7 @@ UINT16 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT16 *pubCivHintToUse, BOOLE // Are we in a town sector? // get town id bTownId = GetTownIdForSector( gWorldSectorX, gWorldSectorY ); - - + // If a married PC... if ( ubCivType == CIV_TYPE_MARRIED_PC ) { @@ -953,7 +948,6 @@ void StartCivQuote( SOLDIERTYPE *pCiv ) ubCivQuoteID2 = ubCivQuoteID; CivQuoteDelta = ubEntryID; //pCiv->bCurrentCivQuoteDelta = ubEntryID; - } // Flugente: if we are an assassin, we speak like the militia we emulate @@ -996,9 +990,7 @@ void StartCivQuote( SOLDIERTYPE *pCiv ) if ( CivQuoteDelta == 2 ) { CivQuoteDelta = 0; - } - - + } } } @@ -1081,8 +1073,7 @@ void PossiblyStartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, UINT32 ui return; } // only enemies and militia taunt - if( ( !( pCiv->bTeam == ENEMY_TEAM ) && !( pCiv->bTeam == MILITIA_TEAM ) ) - && ( !( pCiv->bTeam == ENEMY_TEAM ) && !( pCiv->bTeam == MILITIA_TEAM ) ) ) + if ( pCiv->bTeam != ENEMY_TEAM && pCiv->bTeam != MILITIA_TEAM ) { return; } @@ -1255,7 +1246,6 @@ void PossiblyStartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, UINT32 ui } StartEnemyTaunt( pCiv, iTauntType, pTarget ); - } // SANDRO - soldier taunts @@ -1277,7 +1267,7 @@ void StartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SOLDIERTYPE *pTar //} // anv: check all taunts, and remember those applicable - for(UINT16 i=0; iaiData.bAttitude ) @@ -1709,7 +1699,6 @@ void StartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SOLDIERTYPE *pTar // target limitations if( pTarget != NULL ) { - // target should be zombie if( zTaunt[ i ].uiFlags2 & TAUNT_T_ZOMBIE ) { @@ -1751,7 +1740,7 @@ void StartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SOLDIERTYPE *pTar if( zTaunt[ i ].value[TAUNT_TARGET_APPEARANCE] != -1 ) { // check if pTarget has his own predefined profile (ubProfile = 200 for generated characters) - if( pTarget->ubProfile != 200 ) + if( pTarget->ubProfile != NO_PROFILE ) { if( gMercProfiles[pTarget->ubProfile].bAppearance != zTaunt[ i ].value[TAUNT_TARGET_APPEARANCE] ) continue; @@ -2009,7 +1998,6 @@ void ShowTauntPopupBox( SOLDIERTYPE *pCiv, STR16 gzTauntQuote ) // Add region MSYS_AddRegion( &(gCivQuoteData.MouseRegion) ); - gCivQuoteData.bActive = TRUE; gCivQuoteData.uiTimeOfCreation = GetJA2Clock( ); diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index bae05cd2..bfac3ff9 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -932,7 +932,7 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE if ( pSoldier->ubBodyType != ICECREAMTRUCK && pSoldier->ubBodyType != HUMVEE ) { - Corpse.ubDirection = 7; + Corpse.ubDirection = NORTHWEST; } else { @@ -942,10 +942,9 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE if ( ubType == QUEEN_MONSTER_DEAD || ubType == BURNT_DEAD || ubType == EXPLODE_DEAD ) { - Corpse.ubDirection = 7; + Corpse.ubDirection = NORTHWEST; } - // ATE: If bDirection, get opposite // if ( ubType == SMERC_FALLF || ubType == MMERC_FALLF || ubType == FMERC_FALLF ) //{ diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index f9dfa027..4155a928 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -8265,20 +8265,19 @@ void SOLDIERTYPE::TurnSoldier( void ) // Get new direction //sDirection = this->ubDirection + QuickestDirection( this->ubDirection, this->pathing.bDesiredDirection ); sDirection = this->ubDirection + this->bTurningIncrement; - if ( sDirection > 7 ) + if ( sDirection > NORTHWEST ) { - sDirection = 0; + sDirection = NORTH; } else { - if ( sDirection < 0 ) + if ( sDirection < NORTH ) { - sDirection = 7; + sDirection = NORTHWEST; } } } - // CHECK FOR A VALID TURN DIRECTION // This is needed for prone animations as well as any multi-tiled structs if ( fDoDirectionChange ) @@ -8498,7 +8497,6 @@ BOOLEAN SOLDIERTYPE::CreateSoldierPalettes( void ) this->p8BPPPalette = NULL; } - // Allocate mem for new palette this->p8BPPPalette = (SGPPaletteEntry *)MemAlloc( sizeof(SGPPaletteEntry)* 256 ); memset( this->p8BPPPalette, 0, sizeof(SGPPaletteEntry)* 256 ); @@ -8547,7 +8545,6 @@ BOOLEAN SOLDIERTYPE::CreateSoldierPalettes( void ) } } - if ( this->p16BPPPalette != NULL ) { MemFree( this->p16BPPPalette ); @@ -8557,7 +8554,7 @@ BOOLEAN SOLDIERTYPE::CreateSoldierPalettes( void ) // -- BUILD 16BPP Palette from this this->p16BPPPalette = Create16BPPPalette( this->p8BPPPalette ); - for ( iWhich = 0; iWhich < NUM_SOLDIER_SHADES; iWhich++ ) + for ( iWhich = 0; iWhich < NUM_SOLDIER_SHADES; ++iWhich ) { if ( this->pShades[iWhich] != NULL ) { @@ -8566,7 +8563,7 @@ BOOLEAN SOLDIERTYPE::CreateSoldierPalettes( void ) } } - for ( iWhich = 0; iWhich < NUM_SOLDIER_EFFECTSHADES; iWhich++ ) + for ( iWhich = 0; iWhich < NUM_SOLDIER_EFFECTSHADES; ++iWhich ) { if ( this->pEffectShades[iWhich] != NULL ) { @@ -8575,7 +8572,7 @@ BOOLEAN SOLDIERTYPE::CreateSoldierPalettes( void ) } } - for ( iWhich = 0; iWhich < 20; iWhich++ ) + for ( iWhich = 0; iWhich < 20; ++iWhich ) { if ( this->pGlowShades[iWhich] != NULL ) { @@ -8584,10 +8581,8 @@ BOOLEAN SOLDIERTYPE::CreateSoldierPalettes( void ) } } - CreateSoldierPaletteTables( this, HVOBJECT_GLOW_GREEN ); - // Build a grayscale palette for testing grayout of mercs //for(uiCount=0; uiCount < 256; uiCount++) //{ @@ -8602,14 +8597,14 @@ BOOLEAN SOLDIERTYPE::CreateSoldierPalettes( void ) // First do visible guy this->pGlowShades[0] = Create16BPPPaletteShaded( this->p8BPPPalette, 255, 255, 255, FALSE ); - for ( cnt = 1; cnt < 10; cnt++ ) + for ( cnt = 1; cnt < 10; ++cnt ) { this->pGlowShades[cnt] = CreateEnemyGlow16BPPPalette( this->p8BPPPalette, gRedGlowR[cnt], 255, FALSE ); } // Now for gray guy... this->pGlowShades[10] = Create16BPPPaletteShaded( this->p8BPPPalette, 100, 100, 100, TRUE ); - for ( cnt = 11; cnt < 19; cnt++ ) + for ( cnt = 11; cnt < 19; ++cnt ) { this->pGlowShades[cnt] = CreateEnemyGreyGlow16BPPPalette( this->p8BPPPalette, gRedGlowR[cnt], 0, FALSE ); } @@ -8619,14 +8614,14 @@ BOOLEAN SOLDIERTYPE::CreateSoldierPalettes( void ) // ATE: OK, piggyback on the shades we are not using for 2 colored lighting.... // ORANGE, VISIBLE GUY this->pShades[20] = Create16BPPPaletteShaded( this->p8BPPPalette, 255, 255, 255, FALSE ); - for ( cnt = 21; cnt < 30; cnt++ ) + for ( cnt = 21; cnt < 30; ++cnt ) { this->pShades[cnt] = CreateEnemyGlow16BPPPalette( this->p8BPPPalette, gOrangeGlowR[(cnt - 20)], gOrangeGlowG[(cnt - 20)], TRUE ); } // ORANGE, GREY GUY this->pShades[30] = Create16BPPPaletteShaded( this->p8BPPPalette, 100, 100, 100, TRUE ); - for ( cnt = 31; cnt < 39; cnt++ ) + for ( cnt = 31; cnt < 39; ++cnt ) { this->pShades[cnt] = CreateEnemyGreyGlow16BPPPalette( this->p8BPPPalette, gOrangeGlowR[(cnt - 20)], gOrangeGlowG[(cnt - 20)], TRUE ); } @@ -8984,7 +8979,7 @@ BOOLEAN LoadPaletteData( ) gubpNumReplacementsPerRange = (UINT8 *)MemAlloc( sizeof(UINT8)* guiNumPaletteSubRanges ); // Read # of types for each! - for ( cnt = 0; cnt < guiNumPaletteSubRanges; cnt++ ) + for ( cnt = 0; cnt < guiNumPaletteSubRanges; ++cnt ) { if ( !FileRead( hFile, &gubpNumReplacementsPerRange[cnt], sizeof(UINT8), (UINT32 *)NULL ) ) { @@ -8993,7 +8988,7 @@ BOOLEAN LoadPaletteData( ) } // Loop for each one, read in data - for ( cnt = 0; cnt < guiNumPaletteSubRanges; cnt++ ) + for ( cnt = 0; cnt < guiNumPaletteSubRanges; ++cnt ) { if ( !FileRead( hFile, &gpPaletteSubRanges[cnt].ubStart, sizeof(UINT8), (UINT32 *)NULL ) ) { @@ -9005,7 +9000,6 @@ BOOLEAN LoadPaletteData( ) } } - // Read # of palettes if ( !FileRead( hFile, &guiNumReplacements, sizeof(guiNumReplacements), (UINT32 *)NULL ) ) { @@ -9016,7 +9010,7 @@ BOOLEAN LoadPaletteData( ) gpPalRep = (PaletteReplacementType *)MemAlloc( sizeof(PaletteReplacementType)* guiNumReplacements ); // Read! - for ( cnt = 0; cnt < guiNumReplacements; cnt++ ) + for ( cnt = 0; cnt < guiNumReplacements; ++cnt ) { // type if ( !FileRead( hFile, &gpPalRep[cnt].ubType, sizeof(gpPalRep[cnt].ubType), (UINT32 *)NULL ) ) @@ -9043,7 +9037,7 @@ BOOLEAN LoadPaletteData( ) gpPalRep[cnt].b = (UINT8 *)MemAlloc( gpPalRep[cnt].ubPaletteSize ); CHECKF( gpPalRep[cnt].b != NULL ); - for ( cnt2 = 0; cnt2 < gpPalRep[cnt].ubPaletteSize; cnt2++ ) + for ( cnt2 = 0; cnt2 < gpPalRep[cnt].ubPaletteSize; ++cnt2 ) { if ( !FileRead( hFile, &gpPalRep[cnt].r[cnt2], sizeof(UINT8), (UINT32 *)NULL ) ) { @@ -9058,7 +9052,6 @@ BOOLEAN LoadPaletteData( ) return(FALSE); } } - } FileClose( hFile ); @@ -9077,7 +9070,7 @@ BOOLEAN SetPaletteReplacement( SGPPaletteEntry *p8BPPPalette, PaletteRepID aPalR // Get range type ubType = gpPalRep[ubPalIndex].ubType; - for ( cnt2 = gpPaletteSubRanges[ubType].ubStart; cnt2 <= gpPaletteSubRanges[ubType].ubEnd; cnt2++ ) + for ( cnt2 = gpPaletteSubRanges[ubType].ubStart; cnt2 <= gpPaletteSubRanges[ubType].ubEnd; ++cnt2 ) { p8BPPPalette[cnt2].peRed = gpPalRep[ubPalIndex].r[cnt2 - gpPaletteSubRanges[ubType].ubStart]; p8BPPPalette[cnt2].peGreen = gpPalRep[ubPalIndex].g[cnt2 - gpPaletteSubRanges[ubType].ubStart]; @@ -9105,8 +9098,7 @@ BOOLEAN DeletePaletteData( ) gubpNumReplacementsPerRange = NULL; } - - for ( cnt = 0; cnt < guiNumReplacements; cnt++ ) + for ( cnt = 0; cnt < guiNumReplacements; ++cnt ) { // Free if ( gpPalRep[cnt].r != NULL ) @@ -10401,7 +10393,6 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe { return(FALSE); } - } // If a death sound, and we have already done ours... @@ -10413,14 +10404,12 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe } } - // Are we mute? if ( pSoldier->flags.uiStatusFlags & SOLDIER_MUTE ) { return(FALSE); } - - + // uiTimeSameBattleSndDone // If we are a creature, etc, pick a better sound... @@ -10532,7 +10521,6 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe uiSubSoundID = (UINT32)(EXPLOSION_1); PlayJA2Sample( ROBOT_DEATH, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); break; - } } @@ -10606,12 +10594,10 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe } } - // Save this one we're doing... pSoldier->bOldBattleSnd = ubBattleSoundID; pSoldier->uiTimeSameBattleSndDone = GetJA2Clock( ); - - + // Adjust based on morale... if ( ubBattleSoundID == BATTLE_SOUND_OK1 && pSoldier->aiData.bMorale < LOW_MORALE_BATTLE_SND_THREASHOLD ) { @@ -10652,10 +10638,8 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe if ( gBattleSndsData[ubSoundID].ubRandomVal != 0 ) { ubSoundID = ubSoundID + (UINT8)Random( gBattleSndsData[ubSoundID].ubRandomVal ); - } - // OK, build file and play! if ( pSoldier->ubProfile != NO_PROFILE ) { @@ -10783,7 +10767,6 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe if ( gSoundProfileValue[pSoldier->ubProfile].EnabledSound == TRUE || pSoldier->ubProfile == NO_PROFILE ) { - if ( (uiSoundID = SoundPlay( zFilename, &spParms )) == SOUND_ERROR ) { return(FALSE); @@ -10806,7 +10789,6 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe return(TRUE); } - } else { @@ -10877,8 +10859,6 @@ BOOLEAN PreloadSoldierBattleSounds( SOLDIERTYPE *pSoldier, BOOLEAN fRemove ) return(TRUE); } - - BOOLEAN SOLDIERTYPE::CheckSoldierHitRoof( void ) { // Check if we are near a lower level @@ -10940,11 +10920,9 @@ BOOLEAN SOLDIERTYPE::CheckSoldierHitRoof( void ) this->SoldierTakeDamage( ANIM_CROUCH, 100, 5000, TAKE_DAMAGE_FALLROOF, NOBODY, NOWHERE, 0, TRUE ); fReturnVal = TRUE; - } else { - this->sTempNewGridNo = NewGridNo( this->sGridNo, (INT16)(-1 * DirectionInc( bNewDirection )) ); this->sTempNewGridNo = NewGridNo( this->sTempNewGridNo, (INT16)(-1 * DirectionInc( bNewDirection )) ); this->EVENT_SetSoldierDesiredDirection( bNewDirection ); @@ -10971,7 +10949,6 @@ void SOLDIERTYPE::BeginSoldierClimbDownRoof( void ) INT8 bNewDirection; UINT8 ubWhoIsThere; - if ( FindLowerLevel( this, this->sGridNo, this->ubDirection, &bNewDirection ) && (this->pathing.bLevel > 0) ) { if ( EnoughPoints( this, GetAPsToClimbRoof( this, TRUE ), 0, TRUE ) ) @@ -10984,7 +10961,6 @@ void SOLDIERTYPE::BeginSoldierClimbDownRoof( void ) } else { - if ( this->bTeam == gbPlayerNum ) { // OK, SET INTERFACE FIRST @@ -11013,11 +10989,9 @@ void SOLDIERTYPE::BeginSoldierClimbDownRoof( void ) this->InternalReceivingSoldierCancelServices( FALSE ); this->InternalGivingSoldierCancelServices( FALSE ); - } } } - } /* void BeginSoldierClimbDownRoof( SOLDIERTYPE *pSoldier ) @@ -11574,7 +11548,6 @@ void SendSoldierPositionEvent( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNew SSetPosition.dNewYPos = dNewYPos; AddGameEvent( S_SETPOSITION, 0, &SSetPosition ); - } void SendSoldierDestinationEvent( SOLDIERTYPE *pSoldier, UINT32 usNewDestination ) @@ -11587,7 +11560,6 @@ void SendSoldierDestinationEvent( SOLDIERTYPE *pSoldier, UINT32 usNewDestination SChangeDest.uiUniqueId = pSoldier->uiUniqueSoldierIdValue; AddGameEvent( S_CHANGEDEST, 0, &SChangeDest ); - } void SendSoldierSetDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usNewDirection ) @@ -11600,7 +11572,6 @@ void SendSoldierSetDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usNewDirection SSetDirection.uiUniqueId = pSoldier->uiUniqueSoldierIdValue; AddGameEvent( S_SETDIRECTION, 0, &SSetDirection ); - } void SendSoldierSetDesiredDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usDesiredDirection ) @@ -11614,7 +11585,6 @@ void SendSoldierSetDesiredDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usDesire AddGameEvent( S_SETDESIREDDIRECTION, 0, &SSetDesiredDirection ); if ( is_server || (is_client && pSoldier->ubID <20) ) send_dir( pSoldier, usDesiredDirection ); - } void SendGetNewSoldierPathEvent( SOLDIERTYPE *pSoldier, INT32 sDestGridNo, UINT16 usMovementAnim ) @@ -11668,7 +11638,6 @@ void SendBeginFireWeaponEvent( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) SBeginFireWeapon.uiUniqueId = pSoldier->uiUniqueSoldierIdValue; AddGameEvent( S_BEGINFIREWEAPON, 0, &SBeginFireWeapon ); - } #if 0 @@ -11782,8 +11751,6 @@ BOOLEAN SOLDIERTYPE::MercInHighWater( void ) } } - - void RevivePlayerTeam( ) { INT32 cnt; @@ -11797,7 +11764,6 @@ void RevivePlayerTeam( ) { pSoldier->ReviveSoldier( ); } - } @@ -11835,9 +11801,7 @@ void SOLDIERTYPE::ReviveSoldier( void ) // Dirty INterface fInterfacePanelDirty = DIRTYLEVEL2; - } - } @@ -11896,7 +11860,6 @@ void SOLDIERTYPE::HandleAnimationProfile( UINT16 usAnimState, BOOLEAN fRemove ) } } } - } } @@ -11935,7 +11898,6 @@ LEVELNODE *GetAnimProfileFlags( INT32 sGridNo, UINT16 *usFlags, SOLDIERTYPE **pp //#endif return(pNode); - } @@ -12003,7 +11965,6 @@ void SOLDIERTYPE::EVENT_SoldierBeginGiveItem( void ) // begin animation this->EVENT_InitNewSoldierAnim( GIVE_ITEM, 0, FALSE ); - } else { @@ -12046,10 +12007,8 @@ void SOLDIERTYPE::EVENT_SoldierBeginBladeAttack( INT32 sGridNo, UINT8 ubDirectio // GET POINTER TO TAREGT if ( this->flags.uiStatusFlags & SOLDIER_MONSTER ) { - UINT8 ubTargetID; - // Is there an unconscious guy at gridno...... - ubTargetID = WhoIsThere2( sGridNo, this->bTargetLevel ); + UINT8 ubTargetID = WhoIsThere2( sGridNo, this->bTargetLevel ); if ( ubTargetID != NOBODY && ((MercPtrs[ubTargetID]->stats.bLife < OKLIFE && MercPtrs[ubTargetID]->stats.bLife > 0) || (MercPtrs[ubTargetID]->bBreath < OKBREATH && MercPtrs[ubTargetID]->bCollapsed)) ) { @@ -12586,7 +12545,6 @@ void SOLDIERTYPE::EVENT_SoldierBeginDropBomb( ) this->SoldierGotoStationaryStance( ); break; } - } void SOLDIERTYPE::EVENT_SoldierDefuseTripwire( INT32 sGridNo, INT32 sItem ) @@ -12783,7 +12741,7 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1 return(0); // nothing to do, shouldn't have even been called! } - if ( pVictim->stats.bLife == 0 ) + if ( pVictim->stats.bLife <= 0 ) { return(0); } @@ -12866,7 +12824,6 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1 uiActual = uiPossible; // start by assuming maximum possible - // figure out how far below OKLIFE the victim is // SANDRO - only if we are actually here to bandage the target if ( pVictim->bBleeding ) @@ -12931,7 +12888,6 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1 ubPtsLeft = (UINT8)uiActual; - // heal real life points first (if below OKLIFE) because we don't want the // patient still DYING if bandages run out, or medic is disabled/distracted! // NOTE: Dressing wounds for life below OKLIFE now costs 2 pts/life point! @@ -12987,7 +12943,6 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1 // turn off merc QUOTE flags pVictim->flags.fDyingComment = FALSE; - } // update patient's entire panel (could have regained consciousness, etc.) @@ -13355,7 +13310,6 @@ void SOLDIERTYPE::HaultSoldierFromSighting( BOOLEAN fFromSightingEnemy ) DirtyMercPanelInterface( this, DIRTYLEVEL2 ); } - // Kaiden: Added fix from UB for seeing new enemies when throwing Knives. // ATE: Dave, don't kill me // Here, we need to handle the situation when we're throweing a knife and we see somebody @@ -13372,9 +13326,7 @@ void SOLDIERTYPE::HaultSoldierFromSighting( BOOLEAN fFromSightingEnemy ) DirtyMercPanelInterface( this, DIRTYLEVEL2 ); } - - - + if ( !(gTacticalStatus.uiFlags & INCOMBAT) ) { this->EVENT_StopMerc( this->sGridNo, this->ubDirection ); @@ -13401,7 +13353,6 @@ void SOLDIERTYPE::HaultSoldierFromSighting( BOOLEAN fFromSightingEnemy ) DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "@@@@@@@ Reducing attacker busy count..., ending fire because saw something" ) ); DebugAttackBusy( "@@@@@@@ Reducing attacker busy count..., ending fire because saw something\n" ); FreeUpAttacker( ); - } // OK, if we are stopped at our destination, cancel pending action... @@ -13449,7 +13400,6 @@ void SOLDIERTYPE::EVENT_StopMerc( INT32 sGridNo, INT8 bDirection ) sX = CenterX( sGridNo ); sY = CenterY( sGridNo ); - //Cancel pending events if ( !this->flags.fDelayedMovement ) { @@ -13501,7 +13451,6 @@ void SOLDIERTYPE::EVENT_StopMerc( INT32 sGridNo, INT8 bDirection ) UnSetUIBusy( this->ubID ); UnMarkMovementReserved( this ); - } @@ -13621,7 +13570,6 @@ void SOLDIERTYPE::ReLoadSoldierAnimationDueToHandItemChange( UINT16 usOldItem, U SetSoldierAnimationSurface( this, this->usAnimState ); break; } - } @@ -13637,7 +13585,7 @@ UINT16 *CreateEnemyGlow16BPPPalette( SGPPaletteEntry *pPalette, UINT32 rscale, U p16BPPPalette = (UINT16 *)MemAlloc( sizeof(UINT16)* 256 ); - for ( cnt = 0; cnt < 256; cnt++ ) + for ( cnt = 0; cnt < 256; ++cnt ) { gmod = (pPalette[cnt].peGreen); bmod = (pPalette[cnt].peBlue); @@ -16850,41 +16798,6 @@ INT8 SOLDIERTYPE::GetTraitCTHModifier( UINT16 usItem, INT16 ubAimTime, UINT8 ubT return modifier; } -/*void SOLDIERTYPE::AddDrugValues( UINT8 uDrugType, UINT8 usEffect, UINT8 usTravelRate, UINT8 usSideEffect ) -{ - // in case of wrong inout, stay safe - if ( uDrugType >= DRUG_TYPE_MAX ) - return; - - // Flugente: backgrounds - if ( uDrugType == DRUG_TYPE_ALCOHOL ) - { - usEffect = usEffect * ((100 - this->GetBackgroundValue( BG_RESI_ALCOHOL )) / 100); - usSideEffect = usSideEffect * ((100 - this->GetBackgroundValue( BG_RESI_ALCOHOL )) / 100); - } - - // Add effects - if ( (this->drugs.bFutureDrugEffect[uDrugType] + usEffect) < 127 ) - { - this->drugs.bFutureDrugEffect[uDrugType] += usEffect; - } - this->drugs.bDrugEffectRate[uDrugType] = usTravelRate; - - // Reset once we sleep... - this->drugs.bTimesDrugUsedSinceSleep[uDrugType]++; - - // Increment side effects.. - if ( (this->drugs.bDrugSideEffect[uDrugType] + usSideEffect) < 127 ) - { - this->drugs.bDrugSideEffect[uDrugType] += usSideEffect; - } - // Stop side effects until were done.... - this->drugs.bDrugSideEffectRate[uDrugType] = 0; - - // set flag: we are on drugs - this->usSoldierFlagMask |= SOLDIER_DRUGGED; -}*/ - void SOLDIERTYPE::HandleFlashLights( ) { // no more need to redo this check diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index bccfde6f..5f1fe7ee 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -3320,7 +3320,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea { iHitChance = 100; } - else if ( AM_A_ROBOT( pTargetSoldier ) || TANK( pTargetSoldier ) || CREATURE_OR_BLOODCAT( pTargetSoldier ) || TANK( pTargetSoldier ) || (SOLDIER_CLASS_MILITIA(pTargetSoldier->ubSoldierClass) && (gGameExternalOptions.ubMilitiaDropEquipment != 2)) ) // added militia here - SANDRO + else if ( AM_A_ROBOT( pTargetSoldier ) || TANK( pTargetSoldier ) || CREATURE_OR_BLOODCAT( pTargetSoldier ) || (SOLDIER_CLASS_MILITIA(pTargetSoldier->ubSoldierClass) && (gGameExternalOptions.ubMilitiaDropEquipment != 2)) ) // added militia here - SANDRO { iHitChance = 0; } @@ -4226,8 +4226,7 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Hit chance was %ld, roll %ld (range %d)", uiHitChance, uiDiceRoll, PythSpacesAway( pSoldier->sGridNo, sTargetGridNo ) ); } #endif - - + if ( Item[ usItemNum ].usItemClass == IC_LAUNCHER ) { // Preserve gridno! @@ -4241,7 +4240,6 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) iBPCost = sAPCost * GetBPCostPer10APsForGunHolding( pSoldier ) / 10; else iBPCost = 0; - } else { @@ -4292,7 +4290,6 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) pObject = &( ObjectSlots[ iID ] ); //pObject->fPotentialForDebug = TRUE; - OBJECTTYPE::DeleteMe( &pSoldier->pTempObject ); MemFree( pSoldier->pThrowParams ); @@ -12325,7 +12322,6 @@ void EstimateBulletsLeft( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj ) UINT16 ubMagSize = Weapon[pObj->usItem].ubMagSize; UINT16 usRealBulletCount = (*pObj)[0]->data.gun.ubGunShotsLeft; UINT16 i = 0; - BOOLEAN fPsycho = FALSE; INT16 sEffectiveSkill; INT8 bDeviation = 0; @@ -12337,24 +12333,17 @@ void EstimateBulletsLeft( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj ) return; } - usExpLevel = EffectiveExpLevel(pSoldier); - usDexterity = EffectiveDexterity(pSoldier, FALSE); - usWisdom = EffectiveWisdom(pSoldier); - if ( gGameExternalOptions.usBulletHideIntensity <= 0 ) { // Feature is disabled. Print the real bullet count. - swprintf(gBulletCount, L"%d", usRealBulletCount); + swprintf( gBulletCount, L"%d", usRealBulletCount ); return; } - // Is this Soldier a psycho? - // Flugente: drugs can temporarily cause a merc to go psycho - if ( DoesMercHaveDisability( pSoldier, PSYCHO ) ) - { - fPsycho = TRUE; - } - + usExpLevel = EffectiveExpLevel(pSoldier); + usDexterity = EffectiveDexterity(pSoldier, FALSE); + usWisdom = EffectiveWisdom(pSoldier); + // High EXP Level, Wisdom and Dexterity required for any estimation to be possible. // When Experience goes up, the required WIS+DEX goes down. // At ExpLevel 1 -> WIS+DEX must be > 180. A high requirement! @@ -12381,6 +12370,7 @@ void EstimateBulletsLeft( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj ) swprintf(gBulletCount, L"%d", usRealBulletCount); return; } + if (usRealBulletCount == 0) { // Magazine is empty, so it will also show as empty. @@ -12411,8 +12401,13 @@ void EstimateBulletsLeft( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj ) // Psychos are eligible for an estimate just the same as any other character. But the trait reduces // effective skill by 10, so It'll take them longer before they can get a good estimate. - sEffectiveSkill -= (fPsycho * (10)); - + // Is this Soldier a psycho? + // Flugente: drugs can temporarily cause a merc to go psycho + if ( DoesMercHaveDisability( pSoldier, PSYCHO ) ) + { + sEffectiveSkill -= 10; + } + sEffectiveSkill = __max(0, sEffectiveSkill); sEffectiveSkill = __min(100, sEffectiveSkill); @@ -12438,17 +12433,16 @@ void EstimateBulletsLeft( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj ) { swprintf(gBulletCount, L"%s", L"?M"); } - else if (usRealBulletCount < ubMagSize/3) + else// if (usRealBulletCount < ubMagSize/3) { swprintf(gBulletCount, L"%s", L"?L"); } + return; } // Default - return true count. swprintf(gBulletCount, L"%d", usRealBulletCount); - return; - } // HEADROCK HAM 4: Calculate the ratio between current Mag Factor and Target Factor. Used for the CTH bars. @@ -12510,7 +12504,7 @@ void GunIncreaseHeat( OBJECTTYPE *pObj, SOLDIERTYPE* pSoldier ) { if ( gGameExternalOptions.fWeaponOverheating ) { - if ( Item[pObj->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) ) // if item is a gun pr launcher... + if ( Item[pObj->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) ) // if item is a gun or launcher... { FLOAT guntemperature = (*pObj)[0]->data.bTemperature; // ... get current temperature ... @@ -13014,7 +13008,6 @@ FLOAT CalcNewChanceToHitBaseTargetBonus(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTar { iHeightDifference = 0; } - } // Height difference is mitigated by range. A LONGER range reduces this penalty! diff --git a/TacticalAI/NPC.cpp b/TacticalAI/NPC.cpp index 65fbb615..8a3bea84 100644 --- a/TacticalAI/NPC.cpp +++ b/TacticalAI/NPC.cpp @@ -1888,10 +1888,7 @@ void ResetOncePerConvoRecordsForNPC( UINT8 ubNPC ) } void ResetOncePerConvoRecordsForAllNPCsInLoadedSector( void ) -{ - UINT8 ubLoop; - UINT8 IDnpc; - +{ if ( gWorldSectorX == 0 || gWorldSectorY == 0 ) { return; @@ -1899,24 +1896,18 @@ void ResetOncePerConvoRecordsForAllNPCsInLoadedSector( void ) //for ( ubLoop = FIRST_RPC; ubLoop < GASTON; ubLoop++ ) //new profiles by Jazz - for ( IDnpc = 0; IDnpc < NUM_PROFILES; IDnpc++ ) - { - - if ( gProfilesRPC[IDnpc].ProfilId == IDnpc || gProfilesNPC[IDnpc].ProfilId == IDnpc) - { - ubLoop = IDnpc; - - - if ( gMercProfiles[ ubLoop ].sSectorX == gWorldSectorX && - gMercProfiles[ ubLoop ].sSectorY == gWorldSectorY && - gMercProfiles[ ubLoop ].bSectorZ == gbWorldSectorZ && - gpNPCQuoteInfoArray[ ubLoop ] != NULL ) - { - ResetOncePerConvoRecordsForNPC( ubLoop ); - } - - } - + for ( UINT8 IDnpc = 0; IDnpc < NUM_PROFILES; IDnpc++ ) + { + if ( gProfilesRPC[IDnpc].ProfilId == IDnpc || gProfilesNPC[IDnpc].ProfilId == IDnpc) + { + if ( gMercProfiles[IDnpc].sSectorX == gWorldSectorX && + gMercProfiles[IDnpc].sSectorY == gWorldSectorY && + gMercProfiles[IDnpc].bSectorZ == gbWorldSectorZ && + gpNPCQuoteInfoArray[IDnpc] != NULL ) + { + ResetOncePerConvoRecordsForNPC( IDnpc ); + } + } } } diff --git a/TileEngine/Isometric Utils.cpp b/TileEngine/Isometric Utils.cpp index 3fed94a3..9f95824d 100644 --- a/TileEngine/Isometric Utils.cpp +++ b/TileEngine/Isometric Utils.cpp @@ -889,7 +889,7 @@ INT32 NewGridNo(INT32 sGridNo, INT16 sDirInc) INT16 DirectionInc(UINT8 ubDirection) { - if (ubDirection > 7) + if ( ubDirection > NORTHWEST ) { //#ifdef BETAVERSION @@ -897,7 +897,7 @@ INT16 DirectionInc(UINT8 ubDirection) //#endif //direction = random(8); // replace garbage with random direction - ubDirection = 0; + ubDirection = NORTH; } @@ -1049,18 +1049,17 @@ INT8 FindNumTurnsBetweenDirs( INT8 sDir1, INT8 sDir2 ) do { - sDirection = sDirection + QuickestDirection( sDir1, sDir2 ); - if (sDirection > 7) + if ( sDirection > NORTHWEST ) { - sDirection = 0; + sDirection = NORTH; } else { - if ( sDirection < 0 ) + if ( sDirection < NORTH ) { - sDirection = 7; + sDirection = NORTHWEST; } } @@ -1146,27 +1145,26 @@ BOOLEAN FindLowerLevel( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bStartingDir, { sNewGridNo = NewGridNo( sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) ); - // Make sure there is NOT a roof here... - // Check OK destination - if ( NewOKDestination( pSoldier, sNewGridNo, TRUE, 0 ) ) + // Make sure there is NOT a roof here... + // Check OK destination + if ( NewOKDestination( pSoldier, sNewGridNo, TRUE, 0 ) ) + { + if ( FindStructure( sNewGridNo, STRUCTURE_ROOF ) == NULL ) { - if ( FindStructure( sNewGridNo, STRUCTURE_ROOF ) == NULL ) { + fFound = TRUE; + + // FInd how many turns we should go to get here + bNumTurns = FindNumTurnsBetweenDirs( (INT8)cnt, bStartingDir ); + + if ( bNumTurns < bMinNumTurns ) { - fFound = TRUE; - - // FInd how many turns we should go to get here - bNumTurns = FindNumTurnsBetweenDirs( (INT8)cnt, bStartingDir ); - - if ( bNumTurns < bMinNumTurns ) - { - bMinNumTurns = bNumTurns; - bMinDirection = (INT8)cnt; - } - + bMinNumTurns = bNumTurns; + bMinDirection = (INT8)cnt; } } } + } } if ( fFound )