minor code cleanup

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7963 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2015-08-08 09:33:28 +00:00
parent 5e8ab2af31
commit 13875810a4
6 changed files with 100 additions and 218 deletions
+24 -36
View File
@@ -149,9 +149,8 @@ void CopyNumEntriesIntoQuoteStruct( ) // Not used
{ {
INT32 cnt; INT32 cnt;
for ( cnt = 0; cnt < NUM_CIV_QUOTES; cnt++ ) for ( cnt = 0; cnt < NUM_CIV_QUOTES; ++cnt )
{ {
if (cnt <= 50) if (cnt <= 50)
gCivQuotes[ cnt ].ubNumEntries = gubNumEntries[ cnt ]; gCivQuotes[ cnt ].ubNumEntries = gubNumEntries[ cnt ];
else else
@@ -168,15 +167,15 @@ BOOLEAN GetCivQuoteText(UINT16 ubCivQuoteID, UINT16 ubEntryID, STR16 zQuote )
// Build filename.... // Build filename....
if ( ubCivQuoteID == CIV_QUOTE_HINT ) if ( ubCivQuoteID == CIV_QUOTE_HINT )
{ {
if ( gbWorldSectorZ > 0 ) if ( gbWorldSectorZ > 0 )
{ {
//sprintf( zFileName, "NPCData\\miners.edt" ); //sprintf( zFileName, "NPCData\\miners.edt" );
sprintf( zFileName,"NPCDATA\\CIV%02d.edt", CIV_QUOTE_MINERS_NOT_FOR_PLAYER ); sprintf( zFileName,"NPCDATA\\CIV%02d.edt", CIV_QUOTE_MINERS_NOT_FOR_PLAYER );
} }
else else
{ {
sprintf( zFileName, "NPCData\\%c%d.edt", 'A' + (gWorldSectorY - 1) , gWorldSectorX ); sprintf( zFileName, "NPCData\\%c%d.edt", 'A' + (gWorldSectorY - 1) , gWorldSectorX );
} }
} }
else else
{ {
@@ -217,14 +216,14 @@ void SurrenderMessageBoxCallBack( UINT8 ubExitValue )
// Are we active and in sector..... // Are we active and in sector.....
if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) if ( pTeamSoldier->bActive && pTeamSoldier->bInSector )
{ {
if ( pTeamSoldier->stats.bLife != 0 ) if ( pTeamSoldier->stats.bLife != 0 )
{ {
EnemyCapturesPlayerSoldier( pTeamSoldier ); EnemyCapturesPlayerSoldier( pTeamSoldier );
RemoveSoldierFromTacticalSector( pTeamSoldier, TRUE ); RemoveSoldierFromTacticalSector( pTeamSoldier, TRUE );
} }
} }
} }
EndCaptureSequence( ); EndCaptureSequence( );
@@ -254,8 +253,8 @@ void ShutDownQuoteBox( BOOLEAN fForce )
// Remove mouse region... // Remove mouse region...
MSYS_RemoveRegion( &(gCivQuoteData.MouseRegion) ); MSYS_RemoveRegion( &(gCivQuoteData.MouseRegion) );
RemoveMercPopupBoxFromIndex( gCivQuoteData.iDialogueBox ); RemoveMercPopupBoxFromIndex( gCivQuoteData.iDialogueBox );
gCivQuoteData.iDialogueBox = -1; gCivQuoteData.iDialogueBox = -1;
gCivQuoteData.bActive = FALSE; gCivQuoteData.bActive = FALSE;
#ifdef JA2UB #ifdef JA2UB
@@ -303,8 +302,8 @@ INT8 GetCivType( SOLDIERTYPE *pCiv )
// 1 ) check sector.... // 1 ) check sector....
if ( gWorldSectorX == 10 && gWorldSectorY == 6 && gbWorldSectorZ == 0 ) if ( gWorldSectorX == 10 && gWorldSectorY == 6 && gbWorldSectorZ == 0 )
{ {
// 2 ) the only female.... // 2 ) the only female....
if ( pCiv->ubCivilianGroup == 0 && pCiv->bTeam != gbPlayerNum && pCiv->ubBodyType == REGFEMALE ) if ( pCiv->ubCivilianGroup == 0 && pCiv->bTeam != gbPlayerNum && pCiv->ubBodyType == REGFEMALE )
{ {
// She's a ho! // She's a ho!
return( CIV_TYPE_MARRIED_PC ); return( CIV_TYPE_MARRIED_PC );
@@ -427,8 +426,7 @@ void BeginCivQuote( SOLDIERTYPE *pCiv, UINT16 ubCivQuoteID, UINT16 ubEntryID, IN
// Prepare text box // 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 ); 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 ); //SET_USE_WINFONTS( FALSE );
// OK, find center for box...... // OK, find center for box......
sX = sX - ( gusCivQuoteBoxWidth / 2 ); sX = sX - ( gusCivQuoteBoxWidth / 2 );
sY = sY - ( gusCivQuoteBoxHeight / 2 ); sY = sY - ( gusCivQuoteBoxHeight / 2 );
@@ -475,8 +473,7 @@ void BeginCivQuote( SOLDIERTYPE *pCiv, UINT16 ubCivQuoteID, UINT16 ubEntryID, IN
CURSOR_NORMAL, MSYS_NO_CALLBACK, QuoteOverlayClickCallback ); CURSOR_NORMAL, MSYS_NO_CALLBACK, QuoteOverlayClickCallback );
// Add region // Add region
MSYS_AddRegion( &(gCivQuoteData.MouseRegion) ); MSYS_AddRegion( &(gCivQuoteData.MouseRegion) );
gCivQuoteData.bActive = TRUE; gCivQuoteData.bActive = TRUE;
gCivQuoteData.uiTimeOfCreation = GetJA2Clock( ); gCivQuoteData.uiTimeOfCreation = GetJA2Clock( );
@@ -484,7 +481,6 @@ void BeginCivQuote( SOLDIERTYPE *pCiv, UINT16 ubCivQuoteID, UINT16 ubEntryID, IN
gCivQuoteData.uiDelayTime = FindDelayForString( gzCivQuote ) + 500; gCivQuoteData.uiDelayTime = FindDelayForString( gzCivQuote ) + 500;
gCivQuoteData.pCiv = pCiv; gCivQuoteData.pCiv = pCiv;
} }
UINT16 DetermineCivQuoteEntry( SOLDIERTYPE *pCiv, UINT16 *pubCivHintToUse, BOOLEAN fCanUseHints ) 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? // Are we in a town sector?
// get town id // get town id
bTownId = GetTownIdForSector( gWorldSectorX, gWorldSectorY ); bTownId = GetTownIdForSector( gWorldSectorX, gWorldSectorY );
// If a married PC... // If a married PC...
if ( ubCivType == CIV_TYPE_MARRIED_PC ) if ( ubCivType == CIV_TYPE_MARRIED_PC )
{ {
@@ -953,7 +948,6 @@ void StartCivQuote( SOLDIERTYPE *pCiv )
ubCivQuoteID2 = ubCivQuoteID; ubCivQuoteID2 = ubCivQuoteID;
CivQuoteDelta = ubEntryID; CivQuoteDelta = ubEntryID;
//pCiv->bCurrentCivQuoteDelta = ubEntryID; //pCiv->bCurrentCivQuoteDelta = ubEntryID;
} }
// Flugente: if we are an assassin, we speak like the militia we emulate // Flugente: if we are an assassin, we speak like the militia we emulate
@@ -996,9 +990,7 @@ void StartCivQuote( SOLDIERTYPE *pCiv )
if ( CivQuoteDelta == 2 ) if ( CivQuoteDelta == 2 )
{ {
CivQuoteDelta = 0; CivQuoteDelta = 0;
} }
} }
} }
@@ -1081,8 +1073,7 @@ void PossiblyStartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, UINT32 ui
return; return;
} }
// only enemies and militia taunt // only enemies and militia taunt
if( ( !( pCiv->bTeam == ENEMY_TEAM ) && !( pCiv->bTeam == MILITIA_TEAM ) ) if ( pCiv->bTeam != ENEMY_TEAM && pCiv->bTeam != MILITIA_TEAM )
&& ( !( pCiv->bTeam == ENEMY_TEAM ) && !( pCiv->bTeam == MILITIA_TEAM ) ) )
{ {
return; return;
} }
@@ -1255,7 +1246,6 @@ void PossiblyStartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, UINT32 ui
} }
StartEnemyTaunt( pCiv, iTauntType, pTarget ); StartEnemyTaunt( pCiv, iTauntType, pTarget );
} }
// SANDRO - soldier taunts // SANDRO - soldier taunts
@@ -1277,7 +1267,7 @@ void StartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SOLDIERTYPE *pTar
//} //}
// anv: check all taunts, and remember those applicable // anv: check all taunts, and remember those applicable
for(UINT16 i=0; i<num_found_taunt; i++) for(UINT16 i=0; i<num_found_taunt; ++i)
{ {
// check if attitudes are ok // check if attitudes are ok
switch( pCiv->aiData.bAttitude ) switch( pCiv->aiData.bAttitude )
@@ -1709,7 +1699,6 @@ void StartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SOLDIERTYPE *pTar
// target limitations // target limitations
if( pTarget != NULL ) if( pTarget != NULL )
{ {
// target should be zombie // target should be zombie
if( zTaunt[ i ].uiFlags2 & TAUNT_T_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 ) if( zTaunt[ i ].value[TAUNT_TARGET_APPEARANCE] != -1 )
{ {
// check if pTarget has his own predefined profile (ubProfile = 200 for generated characters) // 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] ) if( gMercProfiles[pTarget->ubProfile].bAppearance != zTaunt[ i ].value[TAUNT_TARGET_APPEARANCE] )
continue; continue;
@@ -2009,7 +1998,6 @@ void ShowTauntPopupBox( SOLDIERTYPE *pCiv, STR16 gzTauntQuote )
// Add region // Add region
MSYS_AddRegion( &(gCivQuoteData.MouseRegion) ); MSYS_AddRegion( &(gCivQuoteData.MouseRegion) );
gCivQuoteData.bActive = TRUE; gCivQuoteData.bActive = TRUE;
gCivQuoteData.uiTimeOfCreation = GetJA2Clock( ); gCivQuoteData.uiTimeOfCreation = GetJA2Clock( );
+2 -3
View File
@@ -932,7 +932,7 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE
if ( pSoldier->ubBodyType != ICECREAMTRUCK && pSoldier->ubBodyType != HUMVEE ) if ( pSoldier->ubBodyType != ICECREAMTRUCK && pSoldier->ubBodyType != HUMVEE )
{ {
Corpse.ubDirection = 7; Corpse.ubDirection = NORTHWEST;
} }
else else
{ {
@@ -942,10 +942,9 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE
if ( ubType == QUEEN_MONSTER_DEAD || ubType == BURNT_DEAD || ubType == EXPLODE_DEAD ) if ( ubType == QUEEN_MONSTER_DEAD || ubType == BURNT_DEAD || ubType == EXPLODE_DEAD )
{ {
Corpse.ubDirection = 7; Corpse.ubDirection = NORTHWEST;
} }
// ATE: If bDirection, get opposite // ATE: If bDirection, get opposite
// if ( ubType == SMERC_FALLF || ubType == MMERC_FALLF || ubType == FMERC_FALLF ) // if ( ubType == SMERC_FALLF || ubType == MMERC_FALLF || ubType == FMERC_FALLF )
//{ //{
+23 -110
View File
@@ -8265,20 +8265,19 @@ void SOLDIERTYPE::TurnSoldier( void )
// Get new direction // Get new direction
//sDirection = this->ubDirection + QuickestDirection( this->ubDirection, this->pathing.bDesiredDirection ); //sDirection = this->ubDirection + QuickestDirection( this->ubDirection, this->pathing.bDesiredDirection );
sDirection = this->ubDirection + this->bTurningIncrement; sDirection = this->ubDirection + this->bTurningIncrement;
if ( sDirection > 7 ) if ( sDirection > NORTHWEST )
{ {
sDirection = 0; sDirection = NORTH;
} }
else else
{ {
if ( sDirection < 0 ) if ( sDirection < NORTH )
{ {
sDirection = 7; sDirection = NORTHWEST;
} }
} }
} }
// CHECK FOR A VALID TURN DIRECTION // CHECK FOR A VALID TURN DIRECTION
// This is needed for prone animations as well as any multi-tiled structs // This is needed for prone animations as well as any multi-tiled structs
if ( fDoDirectionChange ) if ( fDoDirectionChange )
@@ -8498,7 +8497,6 @@ BOOLEAN SOLDIERTYPE::CreateSoldierPalettes( void )
this->p8BPPPalette = NULL; this->p8BPPPalette = NULL;
} }
// Allocate mem for new palette // Allocate mem for new palette
this->p8BPPPalette = (SGPPaletteEntry *)MemAlloc( sizeof(SGPPaletteEntry)* 256 ); this->p8BPPPalette = (SGPPaletteEntry *)MemAlloc( sizeof(SGPPaletteEntry)* 256 );
memset( this->p8BPPPalette, 0, sizeof(SGPPaletteEntry)* 256 ); memset( this->p8BPPPalette, 0, sizeof(SGPPaletteEntry)* 256 );
@@ -8547,7 +8545,6 @@ BOOLEAN SOLDIERTYPE::CreateSoldierPalettes( void )
} }
} }
if ( this->p16BPPPalette != NULL ) if ( this->p16BPPPalette != NULL )
{ {
MemFree( this->p16BPPPalette ); MemFree( this->p16BPPPalette );
@@ -8557,7 +8554,7 @@ BOOLEAN SOLDIERTYPE::CreateSoldierPalettes( void )
// -- BUILD 16BPP Palette from this // -- BUILD 16BPP Palette from this
this->p16BPPPalette = Create16BPPPalette( this->p8BPPPalette ); 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 ) 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 ) 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 ) if ( this->pGlowShades[iWhich] != NULL )
{ {
@@ -8584,10 +8581,8 @@ BOOLEAN SOLDIERTYPE::CreateSoldierPalettes( void )
} }
} }
CreateSoldierPaletteTables( this, HVOBJECT_GLOW_GREEN ); CreateSoldierPaletteTables( this, HVOBJECT_GLOW_GREEN );
// Build a grayscale palette for testing grayout of mercs // Build a grayscale palette for testing grayout of mercs
//for(uiCount=0; uiCount < 256; uiCount++) //for(uiCount=0; uiCount < 256; uiCount++)
//{ //{
@@ -8602,14 +8597,14 @@ BOOLEAN SOLDIERTYPE::CreateSoldierPalettes( void )
// First do visible guy // First do visible guy
this->pGlowShades[0] = Create16BPPPaletteShaded( this->p8BPPPalette, 255, 255, 255, FALSE ); 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 ); this->pGlowShades[cnt] = CreateEnemyGlow16BPPPalette( this->p8BPPPalette, gRedGlowR[cnt], 255, FALSE );
} }
// Now for gray guy... // Now for gray guy...
this->pGlowShades[10] = Create16BPPPaletteShaded( this->p8BPPPalette, 100, 100, 100, TRUE ); 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 ); 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.... // ATE: OK, piggyback on the shades we are not using for 2 colored lighting....
// ORANGE, VISIBLE GUY // ORANGE, VISIBLE GUY
this->pShades[20] = Create16BPPPaletteShaded( this->p8BPPPalette, 255, 255, 255, FALSE ); 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 ); this->pShades[cnt] = CreateEnemyGlow16BPPPalette( this->p8BPPPalette, gOrangeGlowR[(cnt - 20)], gOrangeGlowG[(cnt - 20)], TRUE );
} }
// ORANGE, GREY GUY // ORANGE, GREY GUY
this->pShades[30] = Create16BPPPaletteShaded( this->p8BPPPalette, 100, 100, 100, TRUE ); 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 ); 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 ); gubpNumReplacementsPerRange = (UINT8 *)MemAlloc( sizeof(UINT8)* guiNumPaletteSubRanges );
// Read # of types for each! // 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 ) ) if ( !FileRead( hFile, &gubpNumReplacementsPerRange[cnt], sizeof(UINT8), (UINT32 *)NULL ) )
{ {
@@ -8993,7 +8988,7 @@ BOOLEAN LoadPaletteData( )
} }
// Loop for each one, read in data // 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 ) ) if ( !FileRead( hFile, &gpPaletteSubRanges[cnt].ubStart, sizeof(UINT8), (UINT32 *)NULL ) )
{ {
@@ -9005,7 +9000,6 @@ BOOLEAN LoadPaletteData( )
} }
} }
// Read # of palettes // Read # of palettes
if ( !FileRead( hFile, &guiNumReplacements, sizeof(guiNumReplacements), (UINT32 *)NULL ) ) if ( !FileRead( hFile, &guiNumReplacements, sizeof(guiNumReplacements), (UINT32 *)NULL ) )
{ {
@@ -9016,7 +9010,7 @@ BOOLEAN LoadPaletteData( )
gpPalRep = (PaletteReplacementType *)MemAlloc( sizeof(PaletteReplacementType)* guiNumReplacements ); gpPalRep = (PaletteReplacementType *)MemAlloc( sizeof(PaletteReplacementType)* guiNumReplacements );
// Read! // Read!
for ( cnt = 0; cnt < guiNumReplacements; cnt++ ) for ( cnt = 0; cnt < guiNumReplacements; ++cnt )
{ {
// type // type
if ( !FileRead( hFile, &gpPalRep[cnt].ubType, sizeof(gpPalRep[cnt].ubType), (UINT32 *)NULL ) ) 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 ); gpPalRep[cnt].b = (UINT8 *)MemAlloc( gpPalRep[cnt].ubPaletteSize );
CHECKF( gpPalRep[cnt].b != NULL ); 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 ) ) if ( !FileRead( hFile, &gpPalRep[cnt].r[cnt2], sizeof(UINT8), (UINT32 *)NULL ) )
{ {
@@ -9058,7 +9052,6 @@ BOOLEAN LoadPaletteData( )
return(FALSE); return(FALSE);
} }
} }
} }
FileClose( hFile ); FileClose( hFile );
@@ -9077,7 +9070,7 @@ BOOLEAN SetPaletteReplacement( SGPPaletteEntry *p8BPPPalette, PaletteRepID aPalR
// Get range type // Get range type
ubType = gpPalRep[ubPalIndex].ubType; 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].peRed = gpPalRep[ubPalIndex].r[cnt2 - gpPaletteSubRanges[ubType].ubStart];
p8BPPPalette[cnt2].peGreen = gpPalRep[ubPalIndex].g[cnt2 - gpPaletteSubRanges[ubType].ubStart]; p8BPPPalette[cnt2].peGreen = gpPalRep[ubPalIndex].g[cnt2 - gpPaletteSubRanges[ubType].ubStart];
@@ -9105,8 +9098,7 @@ BOOLEAN DeletePaletteData( )
gubpNumReplacementsPerRange = NULL; gubpNumReplacementsPerRange = NULL;
} }
for ( cnt = 0; cnt < guiNumReplacements; ++cnt )
for ( cnt = 0; cnt < guiNumReplacements; cnt++ )
{ {
// Free // Free
if ( gpPalRep[cnt].r != NULL ) if ( gpPalRep[cnt].r != NULL )
@@ -10401,7 +10393,6 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe
{ {
return(FALSE); return(FALSE);
} }
} }
// If a death sound, and we have already done ours... // If a death sound, and we have already done ours...
@@ -10413,14 +10404,12 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe
} }
} }
// Are we mute? // Are we mute?
if ( pSoldier->flags.uiStatusFlags & SOLDIER_MUTE ) if ( pSoldier->flags.uiStatusFlags & SOLDIER_MUTE )
{ {
return(FALSE); return(FALSE);
} }
// uiTimeSameBattleSndDone // uiTimeSameBattleSndDone
// If we are a creature, etc, pick a better sound... // 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); uiSubSoundID = (UINT32)(EXPLOSION_1);
PlayJA2Sample( ROBOT_DEATH, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); PlayJA2Sample( ROBOT_DEATH, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
break; break;
} }
} }
@@ -10606,12 +10594,10 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe
} }
} }
// Save this one we're doing... // Save this one we're doing...
pSoldier->bOldBattleSnd = ubBattleSoundID; pSoldier->bOldBattleSnd = ubBattleSoundID;
pSoldier->uiTimeSameBattleSndDone = GetJA2Clock( ); pSoldier->uiTimeSameBattleSndDone = GetJA2Clock( );
// Adjust based on morale... // Adjust based on morale...
if ( ubBattleSoundID == BATTLE_SOUND_OK1 && pSoldier->aiData.bMorale < LOW_MORALE_BATTLE_SND_THREASHOLD ) 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 ) if ( gBattleSndsData[ubSoundID].ubRandomVal != 0 )
{ {
ubSoundID = ubSoundID + (UINT8)Random( gBattleSndsData[ubSoundID].ubRandomVal ); ubSoundID = ubSoundID + (UINT8)Random( gBattleSndsData[ubSoundID].ubRandomVal );
} }
// OK, build file and play! // OK, build file and play!
if ( pSoldier->ubProfile != NO_PROFILE ) 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 ( gSoundProfileValue[pSoldier->ubProfile].EnabledSound == TRUE || pSoldier->ubProfile == NO_PROFILE )
{ {
if ( (uiSoundID = SoundPlay( zFilename, &spParms )) == SOUND_ERROR ) if ( (uiSoundID = SoundPlay( zFilename, &spParms )) == SOUND_ERROR )
{ {
return(FALSE); return(FALSE);
@@ -10806,7 +10789,6 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe
return(TRUE); return(TRUE);
} }
} }
else else
{ {
@@ -10877,8 +10859,6 @@ BOOLEAN PreloadSoldierBattleSounds( SOLDIERTYPE *pSoldier, BOOLEAN fRemove )
return(TRUE); return(TRUE);
} }
BOOLEAN SOLDIERTYPE::CheckSoldierHitRoof( void ) BOOLEAN SOLDIERTYPE::CheckSoldierHitRoof( void )
{ {
// Check if we are near a lower level // 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 ); this->SoldierTakeDamage( ANIM_CROUCH, 100, 5000, TAKE_DAMAGE_FALLROOF, NOBODY, NOWHERE, 0, TRUE );
fReturnVal = TRUE; fReturnVal = TRUE;
} }
else else
{ {
this->sTempNewGridNo = NewGridNo( this->sGridNo, (INT16)(-1 * DirectionInc( bNewDirection )) ); this->sTempNewGridNo = NewGridNo( this->sGridNo, (INT16)(-1 * DirectionInc( bNewDirection )) );
this->sTempNewGridNo = NewGridNo( this->sTempNewGridNo, (INT16)(-1 * DirectionInc( bNewDirection )) ); this->sTempNewGridNo = NewGridNo( this->sTempNewGridNo, (INT16)(-1 * DirectionInc( bNewDirection )) );
this->EVENT_SetSoldierDesiredDirection( bNewDirection ); this->EVENT_SetSoldierDesiredDirection( bNewDirection );
@@ -10971,7 +10949,6 @@ void SOLDIERTYPE::BeginSoldierClimbDownRoof( void )
INT8 bNewDirection; INT8 bNewDirection;
UINT8 ubWhoIsThere; UINT8 ubWhoIsThere;
if ( FindLowerLevel( this, this->sGridNo, this->ubDirection, &bNewDirection ) && (this->pathing.bLevel > 0) ) if ( FindLowerLevel( this, this->sGridNo, this->ubDirection, &bNewDirection ) && (this->pathing.bLevel > 0) )
{ {
if ( EnoughPoints( this, GetAPsToClimbRoof( this, TRUE ), 0, TRUE ) ) if ( EnoughPoints( this, GetAPsToClimbRoof( this, TRUE ), 0, TRUE ) )
@@ -10984,7 +10961,6 @@ void SOLDIERTYPE::BeginSoldierClimbDownRoof( void )
} }
else else
{ {
if ( this->bTeam == gbPlayerNum ) if ( this->bTeam == gbPlayerNum )
{ {
// OK, SET INTERFACE FIRST // OK, SET INTERFACE FIRST
@@ -11013,11 +10989,9 @@ void SOLDIERTYPE::BeginSoldierClimbDownRoof( void )
this->InternalReceivingSoldierCancelServices( FALSE ); this->InternalReceivingSoldierCancelServices( FALSE );
this->InternalGivingSoldierCancelServices( FALSE ); this->InternalGivingSoldierCancelServices( FALSE );
} }
} }
} }
} }
/* /*
void BeginSoldierClimbDownRoof( SOLDIERTYPE *pSoldier ) void BeginSoldierClimbDownRoof( SOLDIERTYPE *pSoldier )
@@ -11574,7 +11548,6 @@ void SendSoldierPositionEvent( SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNew
SSetPosition.dNewYPos = dNewYPos; SSetPosition.dNewYPos = dNewYPos;
AddGameEvent( S_SETPOSITION, 0, &SSetPosition ); AddGameEvent( S_SETPOSITION, 0, &SSetPosition );
} }
void SendSoldierDestinationEvent( SOLDIERTYPE *pSoldier, UINT32 usNewDestination ) void SendSoldierDestinationEvent( SOLDIERTYPE *pSoldier, UINT32 usNewDestination )
@@ -11587,7 +11560,6 @@ void SendSoldierDestinationEvent( SOLDIERTYPE *pSoldier, UINT32 usNewDestination
SChangeDest.uiUniqueId = pSoldier->uiUniqueSoldierIdValue; SChangeDest.uiUniqueId = pSoldier->uiUniqueSoldierIdValue;
AddGameEvent( S_CHANGEDEST, 0, &SChangeDest ); AddGameEvent( S_CHANGEDEST, 0, &SChangeDest );
} }
void SendSoldierSetDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usNewDirection ) void SendSoldierSetDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usNewDirection )
@@ -11600,7 +11572,6 @@ void SendSoldierSetDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usNewDirection
SSetDirection.uiUniqueId = pSoldier->uiUniqueSoldierIdValue; SSetDirection.uiUniqueId = pSoldier->uiUniqueSoldierIdValue;
AddGameEvent( S_SETDIRECTION, 0, &SSetDirection ); AddGameEvent( S_SETDIRECTION, 0, &SSetDirection );
} }
void SendSoldierSetDesiredDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usDesiredDirection ) void SendSoldierSetDesiredDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usDesiredDirection )
@@ -11614,7 +11585,6 @@ void SendSoldierSetDesiredDirectionEvent( SOLDIERTYPE *pSoldier, UINT16 usDesire
AddGameEvent( S_SETDESIREDDIRECTION, 0, &SSetDesiredDirection ); AddGameEvent( S_SETDESIREDDIRECTION, 0, &SSetDesiredDirection );
if ( is_server || (is_client && pSoldier->ubID <20) ) send_dir( pSoldier, usDesiredDirection ); if ( is_server || (is_client && pSoldier->ubID <20) ) send_dir( pSoldier, usDesiredDirection );
} }
void SendGetNewSoldierPathEvent( SOLDIERTYPE *pSoldier, INT32 sDestGridNo, UINT16 usMovementAnim ) void SendGetNewSoldierPathEvent( SOLDIERTYPE *pSoldier, INT32 sDestGridNo, UINT16 usMovementAnim )
@@ -11668,7 +11638,6 @@ void SendBeginFireWeaponEvent( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo )
SBeginFireWeapon.uiUniqueId = pSoldier->uiUniqueSoldierIdValue; SBeginFireWeapon.uiUniqueId = pSoldier->uiUniqueSoldierIdValue;
AddGameEvent( S_BEGINFIREWEAPON, 0, &SBeginFireWeapon ); AddGameEvent( S_BEGINFIREWEAPON, 0, &SBeginFireWeapon );
} }
#if 0 #if 0
@@ -11782,8 +11751,6 @@ BOOLEAN SOLDIERTYPE::MercInHighWater( void )
} }
} }
void RevivePlayerTeam( ) void RevivePlayerTeam( )
{ {
INT32 cnt; INT32 cnt;
@@ -11797,7 +11764,6 @@ void RevivePlayerTeam( )
{ {
pSoldier->ReviveSoldier( ); pSoldier->ReviveSoldier( );
} }
} }
@@ -11835,9 +11801,7 @@ void SOLDIERTYPE::ReviveSoldier( void )
// Dirty INterface // Dirty INterface
fInterfacePanelDirty = DIRTYLEVEL2; 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 //#endif
return(pNode); return(pNode);
} }
@@ -12003,7 +11965,6 @@ void SOLDIERTYPE::EVENT_SoldierBeginGiveItem( void )
// begin animation // begin animation
this->EVENT_InitNewSoldierAnim( GIVE_ITEM, 0, FALSE ); this->EVENT_InitNewSoldierAnim( GIVE_ITEM, 0, FALSE );
} }
else else
{ {
@@ -12046,10 +12007,8 @@ void SOLDIERTYPE::EVENT_SoldierBeginBladeAttack( INT32 sGridNo, UINT8 ubDirectio
// GET POINTER TO TAREGT // GET POINTER TO TAREGT
if ( this->flags.uiStatusFlags & SOLDIER_MONSTER ) if ( this->flags.uiStatusFlags & SOLDIER_MONSTER )
{ {
UINT8 ubTargetID;
// Is there an unconscious guy at gridno...... // 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)) ) 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( ); this->SoldierGotoStationaryStance( );
break; break;
} }
} }
void SOLDIERTYPE::EVENT_SoldierDefuseTripwire( INT32 sGridNo, INT32 sItem ) 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! return(0); // nothing to do, shouldn't have even been called!
} }
if ( pVictim->stats.bLife == 0 ) if ( pVictim->stats.bLife <= 0 )
{ {
return(0); return(0);
} }
@@ -12866,7 +12824,6 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1
uiActual = uiPossible; // start by assuming maximum possible uiActual = uiPossible; // start by assuming maximum possible
// figure out how far below OKLIFE the victim is // figure out how far below OKLIFE the victim is
// SANDRO - only if we are actually here to bandage the target // SANDRO - only if we are actually here to bandage the target
if ( pVictim->bBleeding ) if ( pVictim->bBleeding )
@@ -12931,7 +12888,6 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1
ubPtsLeft = (UINT8)uiActual; ubPtsLeft = (UINT8)uiActual;
// heal real life points first (if below OKLIFE) because we don't want the // 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! // 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! // 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 // turn off merc QUOTE flags
pVictim->flags.fDyingComment = FALSE; pVictim->flags.fDyingComment = FALSE;
} }
// update patient's entire panel (could have regained consciousness, etc.) // update patient's entire panel (could have regained consciousness, etc.)
@@ -13355,7 +13310,6 @@ void SOLDIERTYPE::HaultSoldierFromSighting( BOOLEAN fFromSightingEnemy )
DirtyMercPanelInterface( this, DIRTYLEVEL2 ); DirtyMercPanelInterface( this, DIRTYLEVEL2 );
} }
// Kaiden: Added fix from UB for seeing new enemies when throwing Knives. // Kaiden: Added fix from UB for seeing new enemies when throwing Knives.
// ATE: Dave, don't kill me // ATE: Dave, don't kill me
// Here, we need to handle the situation when we're throweing a knife and we see somebody // 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 ); DirtyMercPanelInterface( this, DIRTYLEVEL2 );
} }
if ( !(gTacticalStatus.uiFlags & INCOMBAT) ) if ( !(gTacticalStatus.uiFlags & INCOMBAT) )
{ {
this->EVENT_StopMerc( this->sGridNo, this->ubDirection ); 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" ) ); 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" ); DebugAttackBusy( "@@@@@@@ Reducing attacker busy count..., ending fire because saw something\n" );
FreeUpAttacker( ); FreeUpAttacker( );
} }
// OK, if we are stopped at our destination, cancel pending action... // 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 ); sX = CenterX( sGridNo );
sY = CenterY( sGridNo ); sY = CenterY( sGridNo );
//Cancel pending events //Cancel pending events
if ( !this->flags.fDelayedMovement ) if ( !this->flags.fDelayedMovement )
{ {
@@ -13501,7 +13451,6 @@ void SOLDIERTYPE::EVENT_StopMerc( INT32 sGridNo, INT8 bDirection )
UnSetUIBusy( this->ubID ); UnSetUIBusy( this->ubID );
UnMarkMovementReserved( this ); UnMarkMovementReserved( this );
} }
@@ -13621,7 +13570,6 @@ void SOLDIERTYPE::ReLoadSoldierAnimationDueToHandItemChange( UINT16 usOldItem, U
SetSoldierAnimationSurface( this, this->usAnimState ); SetSoldierAnimationSurface( this, this->usAnimState );
break; break;
} }
} }
@@ -13637,7 +13585,7 @@ UINT16 *CreateEnemyGlow16BPPPalette( SGPPaletteEntry *pPalette, UINT32 rscale, U
p16BPPPalette = (UINT16 *)MemAlloc( sizeof(UINT16)* 256 ); p16BPPPalette = (UINT16 *)MemAlloc( sizeof(UINT16)* 256 );
for ( cnt = 0; cnt < 256; cnt++ ) for ( cnt = 0; cnt < 256; ++cnt )
{ {
gmod = (pPalette[cnt].peGreen); gmod = (pPalette[cnt].peGreen);
bmod = (pPalette[cnt].peBlue); bmod = (pPalette[cnt].peBlue);
@@ -16850,41 +16798,6 @@ INT8 SOLDIERTYPE::GetTraitCTHModifier( UINT16 usItem, INT16 ubAimTime, UINT8 ubT
return modifier; 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( ) void SOLDIERTYPE::HandleFlashLights( )
{ {
// no more need to redo this check // no more need to redo this check
+18 -25
View File
@@ -3320,7 +3320,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea
{ {
iHitChance = 100; 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; 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 ) ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Hit chance was %ld, roll %ld (range %d)", uiHitChance, uiDiceRoll, PythSpacesAway( pSoldier->sGridNo, sTargetGridNo ) );
} }
#endif #endif
if ( Item[ usItemNum ].usItemClass == IC_LAUNCHER ) if ( Item[ usItemNum ].usItemClass == IC_LAUNCHER )
{ {
// Preserve gridno! // Preserve gridno!
@@ -4241,7 +4240,6 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo )
iBPCost = sAPCost * GetBPCostPer10APsForGunHolding( pSoldier ) / 10; iBPCost = sAPCost * GetBPCostPer10APsForGunHolding( pSoldier ) / 10;
else else
iBPCost = 0; iBPCost = 0;
} }
else else
{ {
@@ -4292,7 +4290,6 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo )
pObject = &( ObjectSlots[ iID ] ); pObject = &( ObjectSlots[ iID ] );
//pObject->fPotentialForDebug = TRUE; //pObject->fPotentialForDebug = TRUE;
OBJECTTYPE::DeleteMe( &pSoldier->pTempObject ); OBJECTTYPE::DeleteMe( &pSoldier->pTempObject );
MemFree( pSoldier->pThrowParams ); MemFree( pSoldier->pThrowParams );
@@ -12325,7 +12322,6 @@ void EstimateBulletsLeft( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj )
UINT16 ubMagSize = Weapon[pObj->usItem].ubMagSize; UINT16 ubMagSize = Weapon[pObj->usItem].ubMagSize;
UINT16 usRealBulletCount = (*pObj)[0]->data.gun.ubGunShotsLeft; UINT16 usRealBulletCount = (*pObj)[0]->data.gun.ubGunShotsLeft;
UINT16 i = 0; UINT16 i = 0;
BOOLEAN fPsycho = FALSE;
INT16 sEffectiveSkill; INT16 sEffectiveSkill;
INT8 bDeviation = 0; INT8 bDeviation = 0;
@@ -12337,24 +12333,17 @@ void EstimateBulletsLeft( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj )
return; return;
} }
usExpLevel = EffectiveExpLevel(pSoldier);
usDexterity = EffectiveDexterity(pSoldier, FALSE);
usWisdom = EffectiveWisdom(pSoldier);
if ( gGameExternalOptions.usBulletHideIntensity <= 0 ) if ( gGameExternalOptions.usBulletHideIntensity <= 0 )
{ {
// Feature is disabled. Print the real bullet count. // Feature is disabled. Print the real bullet count.
swprintf(gBulletCount, L"%d", usRealBulletCount); swprintf( gBulletCount, L"%d", usRealBulletCount );
return; return;
} }
// Is this Soldier a psycho? usExpLevel = EffectiveExpLevel(pSoldier);
// Flugente: drugs can temporarily cause a merc to go psycho usDexterity = EffectiveDexterity(pSoldier, FALSE);
if ( DoesMercHaveDisability( pSoldier, PSYCHO ) ) usWisdom = EffectiveWisdom(pSoldier);
{
fPsycho = TRUE;
}
// High EXP Level, Wisdom and Dexterity required for any estimation to be possible. // High EXP Level, Wisdom and Dexterity required for any estimation to be possible.
// When Experience goes up, the required WIS+DEX goes down. // When Experience goes up, the required WIS+DEX goes down.
// At ExpLevel 1 -> WIS+DEX must be > 180. A high requirement! // 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); swprintf(gBulletCount, L"%d", usRealBulletCount);
return; return;
} }
if (usRealBulletCount == 0) if (usRealBulletCount == 0)
{ {
// Magazine is empty, so it will also show as empty. // 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 // 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. // 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 = __max(0, sEffectiveSkill);
sEffectiveSkill = __min(100, sEffectiveSkill); sEffectiveSkill = __min(100, sEffectiveSkill);
@@ -12438,17 +12433,16 @@ void EstimateBulletsLeft( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj )
{ {
swprintf(gBulletCount, L"%s", L"?M"); swprintf(gBulletCount, L"%s", L"?M");
} }
else if (usRealBulletCount < ubMagSize/3) else// if (usRealBulletCount < ubMagSize/3)
{ {
swprintf(gBulletCount, L"%s", L"?L"); swprintf(gBulletCount, L"%s", L"?L");
} }
return; return;
} }
// Default - return true count. // Default - return true count.
swprintf(gBulletCount, L"%d", usRealBulletCount); swprintf(gBulletCount, L"%d", usRealBulletCount);
return;
} }
// HEADROCK HAM 4: Calculate the ratio between current Mag Factor and Target Factor. Used for the CTH bars. // 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 ( 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 ... FLOAT guntemperature = (*pObj)[0]->data.bTemperature; // ... get current temperature ...
@@ -13014,7 +13008,6 @@ FLOAT CalcNewChanceToHitBaseTargetBonus(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTar
{ {
iHeightDifference = 0; iHeightDifference = 0;
} }
} }
// Height difference is mitigated by range. A LONGER range reduces this penalty! // Height difference is mitigated by range. A LONGER range reduces this penalty!
+13 -22
View File
@@ -1888,10 +1888,7 @@ void ResetOncePerConvoRecordsForNPC( UINT8 ubNPC )
} }
void ResetOncePerConvoRecordsForAllNPCsInLoadedSector( void ) void ResetOncePerConvoRecordsForAllNPCsInLoadedSector( void )
{ {
UINT8 ubLoop;
UINT8 IDnpc;
if ( gWorldSectorX == 0 || gWorldSectorY == 0 ) if ( gWorldSectorX == 0 || gWorldSectorY == 0 )
{ {
return; return;
@@ -1899,24 +1896,18 @@ void ResetOncePerConvoRecordsForAllNPCsInLoadedSector( void )
//for ( ubLoop = FIRST_RPC; ubLoop < GASTON; ubLoop++ ) //for ( ubLoop = FIRST_RPC; ubLoop < GASTON; ubLoop++ )
//new profiles by Jazz //new profiles by Jazz
for ( IDnpc = 0; IDnpc < NUM_PROFILES; IDnpc++ ) for ( UINT8 IDnpc = 0; IDnpc < NUM_PROFILES; IDnpc++ )
{ {
if ( gProfilesRPC[IDnpc].ProfilId == IDnpc || gProfilesNPC[IDnpc].ProfilId == IDnpc)
if ( gProfilesRPC[IDnpc].ProfilId == IDnpc || gProfilesNPC[IDnpc].ProfilId == IDnpc) {
{ if ( gMercProfiles[IDnpc].sSectorX == gWorldSectorX &&
ubLoop = IDnpc; gMercProfiles[IDnpc].sSectorY == gWorldSectorY &&
gMercProfiles[IDnpc].bSectorZ == gbWorldSectorZ &&
gpNPCQuoteInfoArray[IDnpc] != NULL )
if ( gMercProfiles[ ubLoop ].sSectorX == gWorldSectorX && {
gMercProfiles[ ubLoop ].sSectorY == gWorldSectorY && ResetOncePerConvoRecordsForNPC( IDnpc );
gMercProfiles[ ubLoop ].bSectorZ == gbWorldSectorZ && }
gpNPCQuoteInfoArray[ ubLoop ] != NULL ) }
{
ResetOncePerConvoRecordsForNPC( ubLoop );
}
}
} }
} }
+20 -22
View File
@@ -889,7 +889,7 @@ INT32 NewGridNo(INT32 sGridNo, INT16 sDirInc)
INT16 DirectionInc(UINT8 ubDirection) INT16 DirectionInc(UINT8 ubDirection)
{ {
if (ubDirection > 7) if ( ubDirection > NORTHWEST )
{ {
//#ifdef BETAVERSION //#ifdef BETAVERSION
@@ -897,7 +897,7 @@ INT16 DirectionInc(UINT8 ubDirection)
//#endif //#endif
//direction = random(8); // replace garbage with random direction //direction = random(8); // replace garbage with random direction
ubDirection = 0; ubDirection = NORTH;
} }
@@ -1049,18 +1049,17 @@ INT8 FindNumTurnsBetweenDirs( INT8 sDir1, INT8 sDir2 )
do do
{ {
sDirection = sDirection + QuickestDirection( sDir1, sDir2 ); sDirection = sDirection + QuickestDirection( sDir1, sDir2 );
if (sDirection > 7) if ( sDirection > NORTHWEST )
{ {
sDirection = 0; sDirection = NORTH;
} }
else 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 ) ); sNewGridNo = NewGridNo( sGridNo, (UINT16)DirectionInc( (UINT8)cnt ) );
// Make sure there is NOT a roof here... // Make sure there is NOT a roof here...
// Check OK destination // Check OK destination
if ( NewOKDestination( pSoldier, sNewGridNo, TRUE, 0 ) ) 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; bMinNumTurns = bNumTurns;
bMinDirection = (INT8)cnt;
// FInd how many turns we should go to get here
bNumTurns = FindNumTurnsBetweenDirs( (INT8)cnt, bStartingDir );
if ( bNumTurns < bMinNumTurns )
{
bMinNumTurns = bNumTurns;
bMinDirection = (INT8)cnt;
}
} }
} }
} }
}
} }
if ( fFound ) if ( fFound )