New merc (somewhat): Similar to Larry's two personalities, Buns now has an alternate personality as well.

For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=tree&th=23806&goto=354149&#msg_354149

Requires GameDir >= r2430.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8588 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2018-07-25 20:14:33 +00:00
parent b70fcbe5e6
commit 887170dda5
24 changed files with 216 additions and 96 deletions
+19
View File
@@ -2231,6 +2231,25 @@ BOOLEAN LuaCallsToDoDialogueStuff( UINT8 ubProfile, INT32 iFaceIndex, const char
return TRUE;
}
// Flugente: play sound file like normal dialogue or, if someone else is already talking, just play the sound
void SpecialDialogue( SOLDIERTYPE* pSoldier, STR8 azSoundString, STR16 azTextString )
{
// if possible, set up a proper dialogue. Otherwise just play the file
if ( !DialogueActive() && pSoldier->ubProfile != NO_PROFILE )
{
gpCurrentTalkingFace = &gFacesData[pSoldier->iFaceIndex];
gubCurrentTalkingID = pSoldier->ubID;
SetQuoteStr( azTextString );
LuaCallsToDoDialogueStuff( pSoldier->ubProfile, pSoldier->iFaceIndex, azSoundString );
}
else
{
PlayJA2SampleFromFile( azSoundString, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) );
}
}
void CreateTalkingUI( INT8 bUIHandlerID, INT32 iFaceIndex, UINT8 ubCharacterNum, SOLDIERTYPE *pSoldier, STR16 zQuoteStr )
{
// Show text, if on
+2 -3
View File
@@ -376,9 +376,8 @@ void AdditionalTacticalCharacterDialogue_AllInSector( INT16 aSectorX, INT16 aSec
void AdditionalTacticalCharacterDialogue_AllInSectorRadiusCall( UINT8 ausIgnoreProfile, UINT16 usEventNr,
UINT32 aData1 = 0, UINT32 aData2 = 0, UINT32 aData3 = 0, INT32 aAroundGridno = -1, INT32 aRadius = 0 );
void SetQuoteStr( STR16 aStr );
BOOLEAN LuaCallsToDoDialogueStuff( UINT8 ubProfile, INT32 iFaceIndex, const char* azSoundString );
// Flugente: play sound file like normal dialogue or, if someone else is already talking, just play the sound
void SpecialDialogue( SOLDIERTYPE* pSoldier, STR8 azSoundString, STR16 azTextString );
// Flugente: replace text with other text
BOOLEAN ReplaceTextWithOtherText( CHAR16 *pFinishedString, CHAR16 compare[32], CHAR16 replace[32] );
+1
View File
@@ -71,6 +71,7 @@ enum
#define DISEASE_PROPERTY_HIDESYMBOL 0x00000008 // do not show a symbol for this disease on the merc's face, even if diagnosed
#define DISEASE_PROPERTY_DISGUSTING 0x00000010 // other merc's will be disgusted by anyone with this disease if broken out
#define DISEASE_PROPERTY_PTSD_BUNS 0x00000020 // if Buns has this disease, she can change personality
typedef struct
{
+11 -3
View File
@@ -151,13 +151,21 @@ BOOLEAN ApplyDrugs_New( SOLDIERTYPE *pSoldier, UINT16 usItem, UINT16 uStatusUsed
// do switch for Larry!!
if ( pSoldier->ubProfile == LARRY_NORMAL )
{
pSoldier = SwapLarrysProfiles( pSoldier );
SwapToProfile( pSoldier, LARRY_DRUNK );
gMercProfiles[LARRY_NORMAL].bNPCData = LARRY_FALLS_OFF_WAGON;
}
else if ( pSoldier->ubProfile == LARRY_DRUNK )
{
gMercProfiles[LARRY_DRUNK].bNPCData = 0;
}
// NB store all drunkenness info in LARRY_NORMAL profile (to use same values)
// so long as he keeps consuming, keep number above level at which he cracked
gMercProfiles[LARRY_NORMAL].bNPCData += (INT8)Random( 5 );
// allow value to keep going up to 24 (about 2 days since we subtract Random( 2 ) when he has no access )
gMercProfiles[LARRY_NORMAL].bNPCData = __min( gMercProfiles[LARRY_NORMAL].bNPCData, 24 );
gMercProfiles[LARRY_NORMAL].bNPCData = __max( gMercProfiles[LARRY_NORMAL].bNPCData, LARRY_FALLS_OFF_WAGON );
}
if ( NewDrug[drugused].opinionevent )
{
HandleDynamicOpinionChange( pSoldier, OPINIONEVENT_ADDICT, TRUE, TRUE );
+2
View File
@@ -57,6 +57,8 @@ enum {
HUNGOVER,
};
#define LARRY_FALLS_OFF_WAGON 8
BOOLEAN ApplyDrugs_New( SOLDIERTYPE *pSoldier, UINT16 usItem, UINT16 uStatusUsed );
void HandleEndTurnDrugAdjustments_New( SOLDIERTYPE *pSoldier );
+13 -2
View File
@@ -3577,9 +3577,8 @@ void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier )
}
break;
}
}
//Make a call to handle the strategic things, such as Life Insurance, record it in history file etc.
StrategicHandlePlayerTeamMercDeath( pSoldier );
@@ -8573,6 +8572,18 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
// If soldier is visible on-screen, report to player that they are cowering.
if ( pSoldier->bVisible != -1 )
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113HAMMessage[0], pSoldier->GetName() );
// Flugente: if we are Buns, and we have PTSD, this shock causes us to switch to a different personality
if ( pSoldier->ubProfile == BUNS && pSoldier->HasDiseaseWithFlag( DISEASE_PROPERTY_PTSD_BUNS ) )
{
SwapToProfile( pSoldier, BUNS_CHAOTIC );
gMercProfiles[BUNS].bNPCData += 3 + Random( 3 );
extern void SpecialDialogue( SOLDIERTYPE* pSoldier, STR8 azSoundString, STR16 azTextString );
SpecialDialogue( pSoldier, "Speech\\Special\\buns_ptsd_activation.MP3", L"Mustn't... get... angry... HOW COULD YOU LET THAT HAPPEN TO ME???" );
}
}
}
+26 -2
View File
@@ -10279,7 +10279,7 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr
}
// possibly get traumatized if damage gets close to killing us (not if we're slowly bleeding)
if ( this->stats.bLife < OKLIFE && ubReason != TAKE_DAMAGE_BLOODLOSS )
if ( this->stats.bLife < OKLIFE )//&& ubReason != TAKE_DAMAGE_BLOODLOSS )
HandlePossibleInfection( this, NULL, INFECTION_TYPE_TRAUMATIC );
}
@@ -18937,7 +18937,25 @@ BOOLEAN SOLDIERTYPE::HasDisease( BOOLEAN fDiagnosedOnly, BOOLEAN fHealableOnly,
return FALSE;
}
// get the magnitude os a disease we might have, used to determine wether there are any effects
// Do we have an outbroken disease with a special property?
BOOLEAN SOLDIERTYPE::HasDiseaseWithFlag( UINT32 aFlag )
{
if ( !gGameExternalOptions.fDisease )
return FALSE;
for ( int i = 0; i < NUM_DISEASES; ++i )
{
// disease is relevant if we are infected and are not looking for symbols only while the disease has no symbol
if ( ( Disease[i].usDiseaseProperties & aFlag ) && this->sDiseasePoints[i] > 0 && ( this->sDiseaseFlag[i] & SOLDIERDISEASE_OUTBREAK ) )
{
return TRUE;
}
}
return FALSE;
}
// get the magnitude of a disease we might have, used to determine wether there are any effects
FLOAT SOLDIERTYPE::GetDiseaseMagnitude( UINT8 aDisease )
{
if ( !gGameExternalOptions.fDisease )
@@ -19071,6 +19089,12 @@ void SOLDIERTYPE::PrintDiseaseDesc( CHAR16* apStr, BOOLEAN fFullDesc )
wcscat( apStr, atStr );
}
}
if ( (this->ubProfile == BUNS || this->ubProfile == BUNS_CHAOTIC) && ( Disease[i].usDiseaseProperties & DISEASE_PROPERTY_PTSD_BUNS ) )
{
swprintf( atStr, szDiseaseText[TEXT_DISEASE_PTSD_BUNS_SPECIAL] );
wcscat( apStr, atStr );
}
}
}
else if ( fShowExactPoints && this->sDiseasePoints[i] > 0 )
+2 -1
View File
@@ -1934,7 +1934,8 @@ public:
// fHealableOnly: check wether it can be healed
// fSymbolOnly: only show if symbol should be shown
BOOLEAN HasDisease(BOOLEAN fDiagnosedOnly, BOOLEAN fHealableOnly, BOOLEAN fSymbolOnly = FALSE);
FLOAT GetDiseaseMagnitude( UINT8 aDisease ); // get the magnitude os a disease we might have, used to determine wether there are any effects
BOOLEAN HasDiseaseWithFlag(UINT32 aFlag);
FLOAT GetDiseaseMagnitude( UINT8 aDisease ); // get the magnitude of a disease we might have, used to determine wether there are any effects
void PrintDiseaseDesc( CHAR16* apStr, BOOLEAN fFullDesc = FALSE );
void PrintFoodDesc( CHAR16* apStr, BOOLEAN fFullDesc = FALSE );
void PrintSleepDesc( CHAR16* apStr );
+5 -14
View File
@@ -2367,22 +2367,13 @@ BOOLEAN MercIsInTropicalSector( SOLDIERTYPE * pSoldier )
return( FALSE );
}
SOLDIERTYPE * SwapLarrysProfiles( SOLDIERTYPE * pSoldier )
SOLDIERTYPE* SwapToProfile( SOLDIERTYPE * pSoldier, UINT8 ubDestProfile )
{
UINT8 ubSrcProfile;
UINT8 ubDestProfile;
MERCPROFILESTRUCT * pNewProfile;
MERCPROFILESTRUCT* pNewProfile;
UINT8 ubSrcProfile = pSoldier->ubProfile;
ubSrcProfile = pSoldier->ubProfile;
if ( ubSrcProfile == LARRY_NORMAL )
{
ubDestProfile = LARRY_DRUNK;
}
else if ( ubSrcProfile == LARRY_DRUNK )
{
ubDestProfile = LARRY_NORMAL;
}
else
// need a stop criteria...
if ( FALSE )
{
// I don't think so!
return( pSoldier );
+4 -1
View File
@@ -88,6 +88,7 @@ extern BOOLEAN LoadNewSystemMercsToSaveGameFile( HWFILE hFile );
enum NPCIDs
{
VICKI = 4,// anv: check when hiring Speck
BUNS = 17,
BIFF = 40,
HAYWIRE,
GASKET,
@@ -248,6 +249,8 @@ enum NPCIDs
ELIO = 196,
JUAN = 197,
WAHAN = 198,
BUNS_CHAOTIC = 215,
} ;
BOOLEAN LoadMercProfiles(void);
@@ -285,7 +288,7 @@ extern BOOLEAN gubNumTerrorists;
void MakeRemainingTerroristsTougher( void );
void MakeRemainingAssassinsTougher( void );
SOLDIERTYPE * SwapLarrysProfiles( SOLDIERTYPE * pSoldier );
SOLDIERTYPE* SwapToProfile( SOLDIERTYPE * pSoldier, UINT8 ubDestProfile );
BOOLEAN DoesNPCOwnBuilding( SOLDIERTYPE *pSoldier, INT32 sGridNo );
+8
View File
@@ -82,6 +82,7 @@ diseaseStartElementHandle( void *userData, const XML_Char *name, const XML_Char
strcmp( name, "fCanReInfect" ) == 0 ||
strcmp( name, "fHideSymbol" ) == 0 ||
strcmp( name, "fDisgusting" ) == 0 ||
strcmp( name, "fSpecialFlagPTSDBuns" ) == 0 ||
strcmp( name, "sEffStatAGI" ) == 0 ||
strcmp( name, "sEffStatDEX" ) == 0 ||
strcmp( name, "sEffStatSTR" ) == 0 ||
@@ -302,6 +303,12 @@ diseaseEndElementHandle( void *userData, const XML_Char *name )
if ( atol( pData->szCharData ) )
pData->curItem.usDiseaseProperties |= DISEASE_PROPERTY_DISGUSTING;
}
else if ( strcmp( name, "fSpecialFlagPTSDBuns" ) == 0 )
{
pData->curElement = ELEMENT;
if ( atol( pData->szCharData ) )
pData->curItem.usDiseaseProperties |= DISEASE_PROPERTY_PTSD_BUNS;
}
else if ( strcmp( name, "sEffStatAGI" ) == 0 )
{
pData->curElement = ELEMENT;
@@ -480,6 +487,7 @@ BOOLEAN WriteDiseaseStats( )
FilePrintf( hFile, "\t\t<fCanReInfect>%d</fCanReInfect>\r\n", (Disease[cnt].usDiseaseProperties & DISEASE_PROPERTY_CANREINFECT) ? 1 : 0 );
FilePrintf( hFile, "\t\t<fHideSymbol>%d</fHideSymbol>\r\n", (Disease[cnt].usDiseaseProperties & DISEASE_PROPERTY_HIDESYMBOL) ? 1 : 0 );
FilePrintf( hFile, "\t\t<fDisgusting>%d</fDisgusting>\r\n", (Disease[cnt].usDiseaseProperties & DISEASE_PROPERTY_DISGUSTING) ? 1 : 0 );
FilePrintf( hFile, "\t\t<fSpecialFlagPTSDBuns>%d</fSpecialFlagPTSDBuns>\r\n", ( Disease[cnt].usDiseaseProperties & DISEASE_PROPERTY_PTSD_BUNS ) ? 1 : 0 );
FilePrintf( hFile, "\t\t<sEffStatAGI>%d</sEffStatAGI>\r\n", Disease[cnt].sEffStat[INFST_AGI] );
FilePrintf( hFile, "\t\t<sEffStatDEX>%d</sEffStatDEX>\r\n", Disease[cnt].sEffStat[INFST_DEX] );
FilePrintf( hFile, "\t\t<sEffStatSTR>%d</sEffStatSTR>\r\n", Disease[cnt].sEffStat[INFST_STR] );