We can play external dialogue lines for NPC merchants via the lua function HandleNPCMerchantQuote(...)

For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=20611&goto=360388&#msg_360388

Requires GameDir >= r2550.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8821 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2020-06-17 20:21:39 +00:00
parent f0c6511ca4
commit 3b3abc2bc6
3 changed files with 35 additions and 0 deletions
+14
View File
@@ -13365,6 +13365,20 @@ void LuaHandleReplaceQuote( UINT8 ubProfile, UINT16 usQuoteNum )
LuaFunction( _LS.L, "HandleReplaceQuote" ).Param<int>( ubProfile ).Param<int>( usQuoteNum ).Call( 2 );
}
void LuaHandleNPCMerchantQuote( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 ubMerchantID, UINT8 ubBodyType, UINT16 usQuoteNum )
{
const char* filename = "scripts\\Overhead.lua";
LuaScopeState _LS( true );
IniFunction( _LS.L(), TRUE );
IniGlobalGameSetting( _LS.L() );
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
LuaFunction( _LS.L, "HandleNPCMerchantQuote" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( ubMerchantID ).Param<int>( ubBodyType ).Param<int>( usQuoteNum ).Call( 6 );
}
void LuaAddArmsDealerAdditionalIntelData()
{
const char* filename = "scripts\\Overhead.lua";
+1
View File
@@ -94,6 +94,7 @@ extern BOOLEAN LetLuaMusicControl(UINT8 Init);
void LuaHandleAdditionalDialogue( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 ubProfile, INT32 iFaceIndex, UINT16 usEventNr, UINT32 aData1, UINT32 aData2, UINT32 aData3 );
void LuaHandleReplaceQuote( UINT8 ubProfile, UINT16 usQuoteNum );
void LuaHandleNPCMerchantQuote( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 ubMerchantID, UINT8 ubBodyType, UINT16 usQuoteNum );
void LuaAddArmsDealerAdditionalIntelData();
void LuaAddPhotoData( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, INT32 sGridNo, INT8 bLevel, UINT8 ubPhotographerProfile, UINT16 room, UINT8 usTargetProfile );
void LuaGetPhotoData( UINT8 aType );
+20
View File
@@ -211,6 +211,7 @@ extern void HandlePendingInitConv( );
extern BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote );
extern void DrawFace( INT16 sCharNumber );
extern void LuaHandleReplaceQuote( UINT8 ubProfile, UINT16 usQuoteNum );
extern void LuaHandleNPCMerchantQuote( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 ubMerchantID, UINT8 ubBodyType, UINT16 usQuoteNum );
// the next said quote will pause time
BOOLEAN fPausedTimeDuringQuote = FALSE;
@@ -2045,6 +2046,9 @@ BOOLEAN SpecialCharacterDialogueEventWithExtraParam( UINT32 uiSpecialEventFlag,
return( TRUE );
}
extern INT8 gbSelectedArmsDealerID;
extern UINT8 gusIDOfCivTrader;
BOOLEAN ExecuteCharacterDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, INT32 iFaceIndex, UINT8 bUIHandlerID, BOOLEAN fFromSoldier )
{
UINT32 uiSoundID;
@@ -2146,6 +2150,22 @@ BOOLEAN ExecuteCharacterDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, INT32
// anv: have to do it now for single sounds
subsequentsounds.ubMaxSndCounter = 0;
// Flugente: if this an NPC merchant we don't say anything normally. So instead we call lua so that modders can add dislogue of their own
if ( bUIHandlerID == DIALOGUE_SHOPKEEPER_UI
&& ubCharacterNum == NO_PROFILE
&& iFaceIndex == -1
&& gusIDOfCivTrader != NOBODY )
{
SOLDIERTYPE* pShopkeeper = MercPtrs[gusIDOfCivTrader];
if ( pShopkeeper )
{
LuaHandleNPCMerchantQuote( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, gbSelectedArmsDealerID, pShopkeeper->ubBodyType, usQuoteNum );
return TRUE;
}
}
// Check face index
CHECKF( iFaceIndex != -1 );