New feature: We can now create non-profile-based merchants via lua.scripts.

Requires GameDir >= r2320.

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

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8212 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2016-05-15 17:11:29 +00:00
parent d594ba0e67
commit 7bb401b1fb
27 changed files with 295 additions and 296 deletions
+1
View File
@@ -1460,6 +1460,7 @@ void LoadGameExternalOptions()
// can extra civilians be created via LUA? // can extra civilians be created via LUA?
gGameExternalOptions.bExtraCivilians = iniReader.ReadBoolean( "Tactical Interface Settings", "ALLOW_EXTRA_CIVILIANS", FALSE ); gGameExternalOptions.bExtraCivilians = iniReader.ReadBoolean( "Tactical Interface Settings", "ALLOW_EXTRA_CIVILIANS", FALSE );
gGameExternalOptions.bExtraMerchants = iniReader.ReadBoolean( "Tactical Interface Settings", "ALLOW_EXTRA_MERCHANTS", FALSE );
// Add smoke after regular explosions // Add smoke after regular explosions
gGameExternalOptions.bAddSmokeAfterExplosion = iniReader.ReadBoolean("Tactical Interface Settings","ADD_SMOKE_AFTER_EXPLOSION",FALSE); gGameExternalOptions.bAddSmokeAfterExplosion = iniReader.ReadBoolean("Tactical Interface Settings","ADD_SMOKE_AFTER_EXPLOSION",FALSE);
+1
View File
@@ -800,6 +800,7 @@ typedef struct
BOOLEAN bLazyCivilians; BOOLEAN bLazyCivilians;
BOOLEAN bNeutralCiviliansAvoidPlayerMines; //sevenfm: Neutral civilians can detect mines with MAPELEMENT_PLAYER_MINE_PRESENT flag set BOOLEAN bNeutralCiviliansAvoidPlayerMines; //sevenfm: Neutral civilians can detect mines with MAPELEMENT_PLAYER_MINE_PRESENT flag set
BOOLEAN bExtraCivilians; // Flugente: add civilians via LUA BOOLEAN bExtraCivilians; // Flugente: add civilians via LUA
BOOLEAN bExtraMerchants; // Flugente: add non-profile-based merchants via LUA
BOOLEAN bAddSmokeAfterExplosion; BOOLEAN bAddSmokeAfterExplosion;
BOOLEAN bAllowExplosiveAttachments; BOOLEAN bAllowExplosiveAttachments;
BOOLEAN bAllowSpecialExplosiveAttachments; BOOLEAN bAllowSpecialExplosiveAttachments;
+9 -9
View File
@@ -15,9 +15,9 @@
#ifdef JA2EDITOR #ifdef JA2EDITOR
#ifdef JA2UB #ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8207 (Development Build)" }; CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8212 (Development Build)" };
#else #else
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8207 (Development Build)" }; CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8212 (Development Build)" };
#endif #endif
// ------------------------------ // ------------------------------
@@ -27,11 +27,11 @@
//DEBUG BUILD VERSION //DEBUG BUILD VERSION
#ifdef JA2UB #ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8207 (Development Build)" }; CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8212 (Development Build)" };
#elif defined (JA113DEMO) #elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8207 (Development Build)" }; CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8212 (Development Build)" };
#else #else
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8207 (Development Build)" }; CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8212 (Development Build)" };
#endif #endif
#elif defined CRIPPLED_VERSION #elif defined CRIPPLED_VERSION
@@ -46,16 +46,16 @@
//RELEASE BUILD VERSION //RELEASE BUILD VERSION
#ifdef JA2UB #ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8207 (Development Build)" }; CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8212 (Development Build)" };
#elif defined (JA113DEMO) #elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8207 (Development Build)" }; CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8212 (Development Build)" };
#else #else
CHAR16 zVersionLabel[256] = { L"Release v1.13.8207 (Development Build)" }; CHAR16 zVersionLabel[256] = { L"Release v1.13.8212 (Development Build)" };
#endif #endif
#endif #endif
CHAR8 czVersionNumber[16] = { "Build 16.05.08" }; //YY.MM.DD CHAR8 czVersionNumber[16] = { "Build 16.05.15" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" }; CHAR16 zTrackingNumber[16] = { L"Z" };
// SAVE_GAME_VERSION is defined in header, change it there // SAVE_GAME_VERSION is defined in header, change it there
+2 -1
View File
@@ -21,6 +21,7 @@ extern CHAR16 zTrackingNumber[16];
// Keeps track of the saved game version. Increment the saved game version whenever // Keeps track of the saved game version. Increment the saved game version whenever
// you will invalidate the saved game file // you will invalidate the saved game file
#define NONPROFILE_MERCHANTS 167 // Flugente: merchants can be created from non-profile NPCs
#define INDIVIDUAL_MILITIA 166 // Flugente: individual militia #define INDIVIDUAL_MILITIA 166 // Flugente: individual militia
#define ENEMY_JEEPS 165 // Flugente: enemy jeeps #define ENEMY_JEEPS 165 // Flugente: enemy jeeps
#define ENEMY_HELICOPTERS 164 // Flugente: enemy helicopters #define ENEMY_HELICOPTERS 164 // Flugente: enemy helicopters
@@ -85,7 +86,7 @@ extern CHAR16 zTrackingNumber[16];
#define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes #define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes
#define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system #define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system
#define SAVE_GAME_VERSION INDIVIDUAL_MILITIA #define SAVE_GAME_VERSION NONPROFILE_MERCHANTS
//#define RUSSIANGOLD //#define RUSSIANGOLD
#ifdef __cplusplus #ifdef __cplusplus
+5 -79
View File
@@ -678,86 +678,12 @@ BOOLEAN LoadExternalGameplayData(STR directoryName)
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
strcat(fileName, TINAINVENTORYFILENAME); strcat(fileName, TINAINVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gTinaInventory,fileName),TINAINVENTORYFILENAME); SGP_THROW_IFFALSE(ReadInInventoryStats(gTinaInventory,fileName),TINAINVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_1_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[0],fileName),ADITIONALDEALER_1_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_2_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[1],fileName),ADITIONALDEALER_2_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_3_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[2],fileName),ADITIONALDEALER_3_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_4_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[3],fileName),ADITIONALDEALER_4_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_5_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[4],fileName),ADITIONALDEALER_5_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_6_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[5],fileName),ADITIONALDEALER_6_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_7_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[6],fileName),ADITIONALDEALER_7_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_8_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[7],fileName),ADITIONALDEALER_8_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_9_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[8],fileName),ADITIONALDEALER_9_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_10_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[9],fileName),ADITIONALDEALER_10_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_11_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[10],fileName),ADITIONALDEALER_11_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_12_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[11],fileName),ADITIONALDEALER_12_INVENTORYFILENAME);
strcpy(fileName, directoryName); for ( int i = 0; i < ADDITIONAL_ARMS_DEALERS; ++i )
strcat(fileName, ADITIONALDEALER_13_INVENTORYFILENAME); {
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[12],fileName),ADITIONALDEALER_13_INVENTORYFILENAME); sprintf_s( fileName, 260, "%s%s%d%s", directoryName, ADITIONALDEALER_INVENTORYFILENAME_A, i + 1, ADITIONALDEALER_INVENTORYFILENAME_B );
ReadInInventoryStats( gArmsDealerAdditional[i], fileName );
strcpy(fileName, directoryName); }
strcat(fileName, ADITIONALDEALER_14_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[13],fileName),ADITIONALDEALER_14_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_15_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[14],fileName),ADITIONALDEALER_15_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_16_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[15],fileName),ADITIONALDEALER_16_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_17_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[16],fileName),ADITIONALDEALER_17_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_18_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[17],fileName),ADITIONALDEALER_18_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_19_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[18],fileName),ADITIONALDEALER_19_INVENTORYFILENAME);
strcpy(fileName, directoryName);
strcat(fileName, ADITIONALDEALER_20_INVENTORYFILENAME);
SGP_THROW_IFFALSE(ReadInInventoryStats(gArmsDealerAdditional[19],fileName),ADITIONALDEALER_20_INVENTORYFILENAME);
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
strcat(fileName, CITYTABLEFILENAME); strcat(fileName, CITYTABLEFILENAME);
+15 -3
View File
@@ -747,11 +747,23 @@ BOOLEAN LoadArmsDealerInventoryFromSavedGameFile( HWFILE hFile )
{ {
return( FALSE ); return( FALSE );
} }
gArmsDealersInventory.resize(dealers); gArmsDealersInventory.resize(dealers);
if (!FileRead( hFile, gArmsDealerStatus, sizeof( gArmsDealerStatus ), &uiNumBytesRead )) if ( guiCurrentSaveGameVersion >= NONPROFILE_MERCHANTS )
{ {
return( FALSE ); if ( !FileRead( hFile, gArmsDealerStatus, sizeof(gArmsDealerStatus), &uiNumBytesRead ) )
{
return(FALSE);
}
}
else
{
// Flugente: as we increased the number of dealers, we can only read part of the array
if ( !FileRead( hFile, gArmsDealerStatus, sizeof(ARMS_DEALER_STATUS) * 40, &uiNumBytesRead ) )
{
return(FALSE);
}
} }
//loop through all the dealers inventories //loop through all the dealers inventories
@@ -2179,7 +2191,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile)
} }
numBytesRead = ReadFieldByField(hFile, &this->bScopeMode, sizeof(bScopeMode), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bScopeMode, sizeof(bScopeMode), sizeof(INT8), numBytesRead);
numBytesRead = ReadFieldByField(hFile, &this->ubMilitiaAssists, sizeof(ubMilitiaAssists), sizeof(UINT8), numBytesRead ); numBytesRead = ReadFieldByField(hFile, &this->ubMilitiaAssists, sizeof(ubMilitiaAssists), sizeof(UINT8), numBytesRead );
numBytesRead = ReadFieldByField(hFile, &this->bUnusedINT8_2, sizeof(bUnusedINT8_2), sizeof(INT8), numBytesRead ); numBytesRead = ReadFieldByField(hFile, &this->sNonNPCTraderID, sizeof(sNonNPCTraderID), sizeof(INT8), numBytesRead );
numBytesRead = ReadFieldByField(hFile, &this->bUnusedINT8_3, sizeof(bUnusedINT8_3), sizeof(INT8), numBytesRead ); numBytesRead = ReadFieldByField(hFile, &this->bUnusedINT8_3, sizeof(bUnusedINT8_3), sizeof(INT8), numBytesRead );
numBytesRead = ReadFieldByField(hFile, &this->bUnusedINT16_4, sizeof(bUnusedINT16_4), sizeof(INT16), numBytesRead ); numBytesRead = ReadFieldByField(hFile, &this->bUnusedINT16_4, sizeof(bUnusedINT16_4), sizeof(INT16), numBytesRead );
numBytesRead = ReadFieldByField(hFile, &this->bUnusedINT16_5, sizeof(bUnusedINT16_5), sizeof(INT16), numBytesRead ); numBytesRead = ReadFieldByField(hFile, &this->bUnusedINT16_5, sizeof(bUnusedINT16_5), sizeof(INT16), numBytesRead );
+12 -11
View File
@@ -13080,23 +13080,24 @@ static int l_CreateArmedCivilain( lua_State *L )
static int l_CreateCivilian( lua_State *L ) static int l_CreateCivilian( lua_State *L )
{ {
if ( lua_gettop( L ) >= 11 ) if ( lua_gettop( L ) >= 12 )
{ {
INT32 sGridNo = lua_tointeger( L, 1 ); INT32 sGridNo = lua_tointeger( L, 1 );
UINT8 usCivilianGroup = lua_tointeger( L, 2 ); UINT8 usCivilianGroup = lua_tointeger( L, 2 );
INT8 sBodyType = lua_tointeger( L, 3 ); INT8 usTraderID = lua_tointeger( L, 3 );
INT8 aVest = lua_tointeger( L, 4 ); INT8 sBodyType = lua_tointeger( L, 4 );
INT8 aPants = lua_tointeger( L, 5 ); INT8 aVest = lua_tointeger( L, 5 );
INT8 aHair = lua_tointeger( L, 6 ); INT8 aPants = lua_tointeger( L, 6 );
INT8 aSkin = lua_tointeger( L, 7 ); INT8 aHair = lua_tointeger( L, 7 );
INT16 item1 = lua_tointeger( L, 8 ); INT8 aSkin = lua_tointeger( L, 8 );
INT16 item2 = lua_tointeger( L, 9 ); INT16 item1 = lua_tointeger( L, 9 );
INT16 item3 = lua_tointeger( L, 10 ); INT16 item2 = lua_tointeger( L, 10 );
INT16 item4 = lua_tointeger( L, 11 ); INT16 item3 = lua_tointeger( L, 11 );
INT16 item4 = lua_tointeger( L, 12 );
if ( gGameExternalOptions.bExtraCivilians ) if ( gGameExternalOptions.bExtraCivilians )
{ {
SOLDIERTYPE* pSoldier = TacticalCreateCivilian( sGridNo, usCivilianGroup, sBodyType, aVest, aPants, aHair, aSkin, item1, item2, item3, item4 ); SOLDIERTYPE* pSoldier = TacticalCreateCivilian( sGridNo, usCivilianGroup, usTraderID, sBodyType, aVest, aPants, aHair, aSkin, item1, item2, item3, item4 );
if ( pSoldier ) if ( pSoldier )
{ {
+23 -22
View File
@@ -17,6 +17,7 @@
#include "Quests.h" #include "Quests.h"
#include "Scheduling.h" #include "Scheduling.h"
#include "GameSettings.h" #include "GameSettings.h"
#include "Overhead.h" // added by Flugente for MercPtrs[]
#endif #endif
#ifdef JA2UB #ifdef JA2UB
@@ -1161,14 +1162,10 @@ BOOLEAN IsMercADealer( UINT8 ubMercID )
return( FALSE ); return( FALSE );
} }
INT8 GetArmsDealerIDFromMercID( UINT8 ubMercID ) INT8 GetArmsDealerIDFromMercID( UINT8 ubMercID )
{ {
INT8 cnt;
//loop through the list of arms dealers //loop through the list of arms dealers
for( cnt=0; cnt<NUM_ARMS_DEALERS; cnt++ ) for ( INT8 cnt = 0; cnt<NUM_ARMS_DEALERS; ++cnt )
{ {
if( armsDealerInfo[ cnt ].ubShopKeeperID == ubMercID ) if( armsDealerInfo[ cnt ].ubShopKeeperID == ubMercID )
return( cnt ); return( cnt );
@@ -1177,8 +1174,6 @@ INT8 GetArmsDealerIDFromMercID( UINT8 ubMercID )
return( -1 ); return( -1 );
} }
UINT8 GetTypeOfArmsDealer( UINT8 ubDealerID ) UINT8 GetTypeOfArmsDealer( UINT8 ubDealerID )
{ {
return( armsDealerInfo[ ubDealerID ].ubTypeOfArmsDealer ); return( armsDealerInfo[ ubDealerID ].ubTypeOfArmsDealer );
@@ -1769,28 +1764,34 @@ void RemoveRandomItemFromArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemI
} }
BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 ubMercID ) BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 usProfileID, UINT8 aMercID )
{ {
INT8 bArmsDealer;
#ifdef JA2UB
BOOLEAN fBoobyTrapItemsWhenDropping=FALSE;
#endif
//Get Dealer ID from from merc Id //Get Dealer ID from from merc Id
bArmsDealer = GetArmsDealerIDFromMercID( ubMercID ); INT8 bArmsDealer = GetArmsDealerIDFromMercID( usProfileID );
if( bArmsDealer == -1 )
//Get a pointer to the dealer
SOLDIERTYPE* pSoldier = FindSoldierByProfileID( usProfileID, FALSE );
// not if this isn't a proper profile
if ( usProfileID == NO_PROFILE )
{
pSoldier = MercPtrs[aMercID];
if ( pSoldier && pSoldier->sNonNPCTraderID > 0 )
bArmsDealer = pSoldier->sNonNPCTraderID;
else
bArmsDealer = -1;
}
if( bArmsDealer <= -1 )
{ {
// not a dealer, that's ok, we get called for every dude that croaks. // not a dealer, that's ok, we get called for every dude that croaks.
return( FALSE ); return( FALSE );
} }
SOLDIERTYPE *pSoldier;
// mark the dealer as being out of business! // mark the dealer as being out of business!
gArmsDealerStatus[ bArmsDealer ].fOutOfBusiness = TRUE; gArmsDealerStatus[ bArmsDealer ].fOutOfBusiness = TRUE;
//Get a pointer to the dealer
pSoldier = FindSoldierByProfileID( ubMercID, FALSE );
if( pSoldier == NULL ) if( pSoldier == NULL )
{ {
// This should never happen, a dealer getting knocked off without the sector being loaded, should it? // This should never happen, a dealer getting knocked off without the sector being loaded, should it?
@@ -1815,8 +1816,7 @@ BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 ubMercID )
} }
gArmsDealersInventory[bArmsDealer].clear(); gArmsDealersInventory[bArmsDealer].clear();
//if the dealer has money //if the dealer has money
if( gArmsDealerStatus[ bArmsDealer ].uiArmsDealersCash > 0 ) if( gArmsDealerStatus[ bArmsDealer ].uiArmsDealersCash > 0 )
{ {
@@ -1831,6 +1831,7 @@ BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 ubMercID )
gArmsDealerStatus[ bArmsDealer ].uiArmsDealersCash = 0; gArmsDealerStatus[ bArmsDealer ].uiArmsDealersCash = 0;
} }
return( TRUE ); return( TRUE );
} }
+3 -2
View File
@@ -3,7 +3,7 @@
#include "Store Inventory.h" #include "Store Inventory.h"
#define ADDITIONAL_ARMS_DEALERS 20 // Flugente: this does NOT include Tina, this is for the as-of-yet undetermined slots #define ADDITIONAL_ARMS_DEALERS 60 // Flugente: this does NOT include Tina, this is for the as-of-yet undetermined slots
//enums for the various arms dealers //enums for the various arms dealers
enum enum
@@ -184,6 +184,7 @@ typedef struct
UINT32 daysDelayMax; // 1-10 UINT32 daysDelayMax; // 1-10
bool useBRSetting; bool useBRSetting;
bool allInventoryAlwaysAvailable; bool allInventoryAlwaysAvailable;
UINT8 nonprofile_loyaltyrequired; // Flugente: if dealer is a non-profile NPC in a city, this is the loyalty required for us to deal with him
} ARMS_DEALER_INFO; } ARMS_DEALER_INFO;
@@ -372,7 +373,7 @@ UINT32 GetTimeToFixItemBeingRepaired( UINT8 ubArmsDealer, UINT16 usItemIndex, UI
BOOLEAN CanDealerTransactItem( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN fPurchaseFromPlayer ); BOOLEAN CanDealerTransactItem( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN fPurchaseFromPlayer );
BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ); BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex );
BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 ubMercID ); BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 usProfileID, UINT8 aMercID );
void MakeObjectOutOfDealerItems( DEALER_SPECIAL_ITEM *pSpclItemInfo, OBJECTTYPE *pObject ); void MakeObjectOutOfDealerItems( DEALER_SPECIAL_ITEM *pSpclItemInfo, OBJECTTYPE *pObject );
void CreateObjectForDealer( int usItem, int status, int numObjects, OBJECTTYPE *pObject ); void CreateObjectForDealer( int usItem, int status, int numObjects, OBJECTTYPE *pObject );
+1 -1
View File
@@ -4030,7 +4030,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld )
} }
//if the NPC is a dealer, add the dealers items to the ground //if the NPC is a dealer, add the dealers items to the ground
AddDeadArmsDealerItemsToWorld( pSoldierOld->ubProfile ); AddDeadArmsDealerItemsToWorld( pSoldierOld->ubProfile, pSoldierOld->ubID );
#ifdef JA2UB #ifdef JA2UB
HandleDeathInPowerGenSector( pSoldierOld ); //ja25 ub HandleDeathInPowerGenSector( pSoldierOld ); //ja25 ub
+92 -141
View File
@@ -332,6 +332,9 @@ INT32 giSKIMessageBox=-1;
INT8 gbSelectedArmsDealerID = -1; //Contains the enum value for the currently selected arms dealer INT8 gbSelectedArmsDealerID = -1; //Contains the enum value for the currently selected arms dealer
// Flugente: while we're trading, store the ID of non-NPC dealers
UINT8 gusIDOfCivTrader = NOBODY;
//the quote that is in progress, in certain circumstances, we don't want queuing of related but different quotes //the quote that is in progress, in certain circumstances, we don't want queuing of related but different quotes
INT32 giShopKeepDialogueEventinProgress = - 1; INT32 giShopKeepDialogueEventinProgress = - 1;
@@ -609,7 +612,7 @@ void PerformTransaction( UINT32 uiMoneyFromPlayersAccount );
void MovePlayerOfferedItemsOfValueToArmsDealersInventory( ); void MovePlayerOfferedItemsOfValueToArmsDealersInventory( );
INT16 AddInventoryToSkiLocation( INVENTORY_IN_SLOT *pInv, UINT16 ubSpotLocation, UINT8 ubWhere ); INT16 AddInventoryToSkiLocation( INVENTORY_IN_SLOT *pInv, UINT16 ubSpotLocation, UINT8 ubWhere );
BOOLEAN RemoveItemFromDealersInventory( INVENTORY_IN_SLOT* pInvSlot, UINT16 ubSlot ); BOOLEAN RemoveItemFromDealersInventory( INVENTORY_IN_SLOT* pInvSlot, UINT16 ubSlot );
BOOLEAN InitShopKeepersFace( UINT8 ubMercID ); BOOLEAN InitShopKeepersFace( UINT8 usProfileID );
void DisplayTalkingArmsDealer(); void DisplayTalkingArmsDealer();
BOOLEAN StartShopKeeperTalking( UINT16 usQuoteNum ); BOOLEAN StartShopKeeperTalking( UINT16 usQuoteNum );
void HandleShopKeeperDialog( UINT8 ubInit ); void HandleShopKeeperDialog( UINT8 ubInit );
@@ -792,8 +795,7 @@ UINT32 ShopKeeperScreenHandle()
RestoreBackgroundRects(); RestoreBackgroundRects();
GetShopKeeperInterfaceUserInput(); GetShopKeeperInterfaceUserInput();
// Check for any newly added items... // Check for any newly added items...
if ( gpSMCurrentMerc->flags.fCheckForNewlyAddedItems ) if ( gpSMCurrentMerc->flags.fCheckForNewlyAddedItems )
{ {
@@ -802,10 +804,8 @@ UINT32 ShopKeeperScreenHandle()
gpSMCurrentMerc->flags.fCheckForNewlyAddedItems = FALSE; gpSMCurrentMerc->flags.fCheckForNewlyAddedItems = FALSE;
} }
HandleShopKeeperInterface(); HandleShopKeeperInterface();
if( gubSkiDirtyLevel == SKI_DIRTY_LEVEL2 ) if( gubSkiDirtyLevel == SKI_DIRTY_LEVEL2 )
{ {
RenderShopKeeperInterface(); RenderShopKeeperInterface();
@@ -860,13 +860,10 @@ UINT32 ShopKeeperScreenHandle()
gfDisplayNoRoomMsg = FALSE; gfDisplayNoRoomMsg = FALSE;
} }
return( SHOPKEEPER_SCREEN ); return( SHOPKEEPER_SCREEN );
} }
UINT32 ShopKeeperScreenShutdown() UINT32 ShopKeeperScreenShutdown()
{ {
ShutDownArmsDealers(); ShutDownArmsDealers();
@@ -874,18 +871,10 @@ UINT32 ShopKeeperScreenShutdown()
return( TRUE ); return( TRUE );
} }
// //
// //
// //
BOOLEAN EnterShopKeeperInterface() BOOLEAN EnterShopKeeperInterface()
{ {
VOBJECT_DESC VObjectDesc; VOBJECT_DESC VObjectDesc;
@@ -893,12 +882,17 @@ BOOLEAN EnterShopKeeperInterface()
CHAR8 zTemp[32]; CHAR8 zTemp[32];
VSURFACE_DESC vs_desc; VSURFACE_DESC vs_desc;
//ADB if we are here, we must be able to talk with an extended ear (CheckIfRadioIsEquipped()) //ADB if we are here, we must be able to talk with an extended ear (CheckIfRadioIsEquipped())
//but if we are physically too far away, we don't have extended arms! //but if we are physically too far away, we don't have extended arms!
SOLDIERTYPE* pSoldier = MercPtrs[ gusSelectedSoldier ]; SOLDIERTYPE* pSoldier = MercPtrs[ gusSelectedSoldier ];
SOLDIERTYPE* pShopkeeper = FindSoldierByProfileID( armsDealerInfo[ gbSelectedArmsDealerID ].ubShopKeeperID, FALSE ); SOLDIERTYPE* pShopkeeper = NULL;
if ( gusIDOfCivTrader != NOBODY )
pShopkeeper = MercPtrs[gusIDOfCivTrader];
else
pShopkeeper = FindSoldierByProfileID( armsDealerInfo[gbSelectedArmsDealerID].ubShopKeeperID, FALSE );
if ( GetRangeFromGridNoDiff( pSoldier->sGridNo, pShopkeeper->sGridNo ) > NPC_TALK_RADIUS ) if ( GetRangeFromGridNoDiff( pSoldier->sGridNo, pShopkeeper->sGridNo ) > NPC_TALK_RADIUS )
{ {
//so now we know we are too far away to trade, so instead of just quitting, //so now we know we are too far away to trade, so instead of just quitting,
@@ -950,7 +944,6 @@ BOOLEAN EnterShopKeeperInterface()
} }
} }
// make sure current merc is close enough and eligible to talk to the shopkeeper. // make sure current merc is close enough and eligible to talk to the shopkeeper.
AssertMsg( CanMercInteractWithSelectedShopkeeper( MercPtrs[ gusSelectedSoldier ] ), "Selected merc can't interact with shopkeeper. Send save AM-1"); AssertMsg( CanMercInteractWithSelectedShopkeeper( MercPtrs[ gusSelectedSoldier ] ), "Selected merc can't interact with shopkeeper. Send save AM-1");
@@ -1010,7 +1003,6 @@ BOOLEAN EnterShopKeeperInterface()
return( FALSE ); return( FALSE );
} }
// load the Main trade screen background image // load the Main trade screen background image
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
FilenameForBPP("InterFace\\itemcrossout.sti", VObjectDesc.ImageFile); FilenameForBPP("InterFace\\itemcrossout.sti", VObjectDesc.ImageFile);
@@ -1022,8 +1014,6 @@ BOOLEAN EnterShopKeeperInterface()
return( FALSE ); return( FALSE );
} }
/* /*
ATM: ATM:
// load the Main trade screen backgroiund image // load the Main trade screen backgroiund image
@@ -1047,16 +1037,15 @@ ATM:
//Create the string for the face file name //Create the string for the face file name
//sprintf( zTemp, "FACES\\33FACE\\%02d.sti", gMercProfiles[ pSoldier->ubProfile ].ubFaceIndex ); //sprintf( zTemp, "FACES\\33FACE\\%02d.sti", gMercProfiles[ pSoldier->ubProfile ].ubFaceIndex );
if ( gProfilesIMP[ pSoldier->ubProfile ].ProfilId == pSoldier->ubProfile )
if ( gProfilesIMP[ pSoldier->ubProfile ].ProfilId == pSoldier->ubProfile ) {
{ sprintf( zTemp, "IMPFACES\\33FACE\\%02d.sti", gMercProfiles[ pSoldier->ubProfile ].ubFaceIndex );
sprintf( zTemp, "IMPFACES\\33FACE\\%02d.sti", gMercProfiles[ pSoldier->ubProfile ].ubFaceIndex ); }
} else
else {
{ sprintf( zTemp, "FACES\\33FACE\\%02d.sti", gMercProfiles[ pSoldier->ubProfile ].ubFaceIndex );
sprintf( zTemp, "FACES\\33FACE\\%02d.sti", gMercProfiles[ pSoldier->ubProfile ].ubFaceIndex ); }
}
//While we are at it, add their small face //While we are at it, add their small face
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
@@ -1089,9 +1078,7 @@ ATM:
BUTTON_NEWTOGGLE, MSYS_PRIORITY_HIGHEST, BUTTON_NEWTOGGLE, MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, BtnSKI_InvPageDownButtonCallback ); DEFAULT_MOVE_CALLBACK, BtnSKI_InvPageDownButtonCallback );
SpecifyDisabledButtonStyle( guiSKI_InvPageDownButton, DISABLED_STYLE_HATCHED ); SpecifyDisabledButtonStyle( guiSKI_InvPageDownButton, DISABLED_STYLE_HATCHED );
//Evaluate: //Evaluate:
EnableDisableShopkeeperButtons(SHOPKEEPER_SCREEN, ACTIVATE_BUTTON); EnableDisableShopkeeperButtons(SHOPKEEPER_SCREEN, ACTIVATE_BUTTON);
// guiSKI_EvaluateButtonImage = LoadButtonImage("INTERFACE\\TradeButtons.sti", -1,0,-1,1,-1 ); // guiSKI_EvaluateButtonImage = LoadButtonImage("INTERFACE\\TradeButtons.sti", -1,0,-1,1,-1 );
@@ -1142,10 +1129,7 @@ ATM:
MSYS_DefineRegion( &gSKI_EntireScreenMouseRegions, 0, 0, (SCREEN_WIDTH - 1), (SCREEN_HEIGHT - INV_INTERFACE_HEIGHT), MSYS_PRIORITY_HIGH-2, MSYS_DefineRegion( &gSKI_EntireScreenMouseRegions, 0, 0, (SCREEN_WIDTH - 1), (SCREEN_HEIGHT - INV_INTERFACE_HEIGHT), MSYS_PRIORITY_HIGH-2,
CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK); CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK);
MSYS_AddRegion( &gSKI_EntireScreenMouseRegions ); MSYS_AddRegion( &gSKI_EntireScreenMouseRegions );
/* /*
//ATM: //ATM:
//Blanket the tactical buttons where the ATM will go //Blanket the tactical buttons where the ATM will go
@@ -1156,9 +1140,7 @@ ATM:
//Create the mouse regions for the inventory slot //Create the mouse regions for the inventory slot
CreateSkiInventorySlotMouseRegions( ); CreateSkiInventorySlotMouseRegions( );
//Create the mouse region to limit the movement of the item cursos //Create the mouse region to limit the movement of the item cursos
MSYS_DefineRegion( &gSkiInventoryMovementAreaMouseRegions, SKI_ITEM_MOVEMENT_AREA_X, SKI_ITEM_MOVEMENT_AREA_Y, (UINT16)(SKI_ITEM_MOVEMENT_AREA_X+SKI_ITEM_MOVEMENT_AREA_WIDTH), (UINT16)(SKI_ITEM_MOVEMENT_AREA_Y+SKI_ITEM_MOVEMENT_AREA_HEIGHT), MSYS_PRIORITY_HIGH-1, MSYS_DefineRegion( &gSkiInventoryMovementAreaMouseRegions, SKI_ITEM_MOVEMENT_AREA_X, SKI_ITEM_MOVEMENT_AREA_Y, (UINT16)(SKI_ITEM_MOVEMENT_AREA_X+SKI_ITEM_MOVEMENT_AREA_WIDTH), (UINT16)(SKI_ITEM_MOVEMENT_AREA_Y+SKI_ITEM_MOVEMENT_AREA_HEIGHT), MSYS_PRIORITY_HIGH-1,
CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); //SelectSkiInventoryMovementAreaRegionCallBack CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); //SelectSkiInventoryMovementAreaRegionCallBack
@@ -1166,14 +1148,12 @@ ATM:
//Disable the region that limits the movement of the cursor with the item //Disable the region that limits the movement of the cursor with the item
MSYS_DisableRegion( &gSkiInventoryMovementAreaMouseRegions ); MSYS_DisableRegion( &gSkiInventoryMovementAreaMouseRegions );
//Create the mouse region for the shopkeeper's face //Create the mouse region for the shopkeeper's face
MSYS_DefineRegion( &gArmsDealersFaceMouseRegions, SKI_FACE_X, SKI_FACE_Y, (UINT16)(SKI_FACE_X+SKI_FACE_WIDTH), (UINT16)(SKI_FACE_Y+SKI_FACE_HEIGHT), MSYS_PRIORITY_HIGH-1, MSYS_DefineRegion( &gArmsDealersFaceMouseRegions, SKI_FACE_X, SKI_FACE_Y, (UINT16)(SKI_FACE_X+SKI_FACE_WIDTH), (UINT16)(SKI_FACE_Y+SKI_FACE_HEIGHT), MSYS_PRIORITY_HIGH-1,
CURSOR_NORMAL, MSYS_NO_CALLBACK, SelectArmsDealersFaceRegionCallBack ); CURSOR_NORMAL, MSYS_NO_CALLBACK, SelectArmsDealersFaceRegionCallBack );
MSYS_AddRegion( &gArmsDealersFaceMouseRegions ); MSYS_AddRegion( &gArmsDealersFaceMouseRegions );
//Create the atm button //Create the atm button
//ATM: //ATM:
// CreateSkiAtmButtons(); // CreateSkiAtmButtons();
@@ -1189,13 +1169,9 @@ ATM:
HandlePossibleRepairDelays(); HandlePossibleRepairDelays();
} }
//Setup the currently selected arms dealer //Setup the currently selected arms dealer
InitializeShopKeeper( TRUE ); InitializeShopKeeper( TRUE );
//Set the flag indicating that we are in the shop keeper interface //Set the flag indicating that we are in the shop keeper interface
guiTacticalInterfaceFlags |= INTERFACE_SHOPKEEP_INTERFACE; guiTacticalInterfaceFlags |= INTERFACE_SHOPKEEP_INTERFACE;
@@ -1260,7 +1236,6 @@ ATM:
// Dirty the bottom panel // Dirty the bottom panel
fInterfacePanelDirty = DIRTYLEVEL2; fInterfacePanelDirty = DIRTYLEVEL2;
gfDealerHasSaidTheEvaluateQuoteOnceThisSession = FALSE; gfDealerHasSaidTheEvaluateQuoteOnceThisSession = FALSE;
guiRandomQuoteDelayTime = SKI_DEALERS_RANDOM_QUOTE_DELAY; guiRandomQuoteDelayTime = SKI_DEALERS_RANDOM_QUOTE_DELAY;
@@ -1290,32 +1265,31 @@ ATM:
} }
BOOLEAN InitShopKeepersFace( UINT8 ubMercID ) BOOLEAN InitShopKeepersFace( UINT8 usProfileID )
{ {
SOLDIERTYPE *pSoldier = FindSoldierByProfileID( armsDealerInfo[ gbSelectedArmsDealerID ].ubShopKeeperID, FALSE ); SOLDIERTYPE *pSoldier = NULL;
// if this is a non-NPC, don't set this up
if ( gusIDOfCivTrader == NOBODY )
pSoldier = FindSoldierByProfileID( armsDealerInfo[gbSelectedArmsDealerID].ubShopKeeperID, FALSE );
if( pSoldier == NULL ) if( pSoldier == NULL )
{ {
#ifdef JA2TESTVERSION //Create the facial index
//Create the facial index giShopKeeperFaceIndex = InitFace( usProfileID, NOBODY, FACE_BIGFACE );
giShopKeeperFaceIndex = InitFace( ubMercID, NOBODY, FACE_BIGFACE );
#else
return( FALSE );
#endif
} }
else else
{ {
//Create the facial index //Create the facial index
giShopKeeperFaceIndex = InitFace( ubMercID, pSoldier->ubID, FACE_BIGFACE ); giShopKeeperFaceIndex = InitFace( usProfileID, pSoldier->ubID, FACE_BIGFACE );
} }
SetAutoFaceActive( FRAME_BUFFER, FACE_AUTO_RESTORE_BUFFER, giShopKeeperFaceIndex, SKI_FACE_X, SKI_FACE_Y ); SetAutoFaceActive( FRAME_BUFFER, FACE_AUTO_RESTORE_BUFFER, giShopKeeperFaceIndex, SKI_FACE_X, SKI_FACE_Y );
//Set it so the face cannot be set InActive //Set it so the face cannot be set InActive
gFacesData[ giShopKeeperFaceIndex ].uiFlags |= FACE_INACTIVE_HANDLED_ELSEWHERE; if ( giShopKeeperFaceIndex > -1 )
gFacesData[ giShopKeeperFaceIndex ].uiFlags |= FACE_INACTIVE_HANDLED_ELSEWHERE;
RenderAutoFace( giShopKeeperFaceIndex ); RenderAutoFace( giShopKeeperFaceIndex );
return(TRUE); return(TRUE);
@@ -1443,7 +1417,6 @@ void HandleShopKeeperInterface()
INT32 iCounter = 0; INT32 iCounter = 0;
//if we are in the item desc panel, disable the buttons //if we are in the item desc panel, disable the buttons
if( InItemDescriptionBox( ) && pShopKeeperItemDescObject != NULL ) if( InItemDescriptionBox( ) && pShopKeeperItemDescObject != NULL )
{ {
@@ -1467,8 +1440,7 @@ void HandleShopKeeperInterface()
return; return;
} }
if( gubSkiDirtyLevel == SKI_DIRTY_LEVEL2 ) if( gubSkiDirtyLevel == SKI_DIRTY_LEVEL2 )
{ {
fInterfacePanelDirty = DIRTYLEVEL2; fInterfacePanelDirty = DIRTYLEVEL2;
@@ -1505,7 +1477,6 @@ void HandleShopKeeperInterface()
DisplayTalkingArmsDealer(); DisplayTalkingArmsDealer();
DisplayArmsDealerCurrentInventoryPage( ); DisplayArmsDealerCurrentInventoryPage( );
DisplayArmsDealerOfferArea(); DisplayArmsDealerOfferArea();
@@ -1583,14 +1554,12 @@ BOOLEAN RenderShopKeeperInterface()
CHAR16 zMoney[128]; CHAR16 zMoney[128];
HVSURFACE hDestVSurface, hSrcVSurface; HVSURFACE hDestVSurface, hSrcVSurface;
SGPRect SrcRect; SGPRect SrcRect;
if( InItemDescriptionBox( ) && pShopKeeperItemDescObject != NULL ) if( InItemDescriptionBox( ) && pShopKeeperItemDescObject != NULL )
{ {
return( TRUE ); return( TRUE );
} }
// RenderSMPanel( &fDirty ); // RenderSMPanel( &fDirty );
// RenderTacticalInterface( ); // RenderTacticalInterface( );
@@ -1618,8 +1587,7 @@ BOOLEAN RenderShopKeeperInterface()
//Display the total value text //Display the total value text
DisplayWrappedString( SKI_TOTAL_VALUE_X, SKI_TOTAL_VALUE_Y, SKI_TOTAL_VALUE_WIDTH, 2, SKI_LABEL_FONT, SKI_TITLE_COLOR, SKI_Text[ SKI_TEXT_TOTAL_VALUE ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); DisplayWrappedString( SKI_TOTAL_VALUE_X, SKI_TOTAL_VALUE_Y, SKI_TOTAL_VALUE_WIDTH, 2, SKI_LABEL_FONT, SKI_TITLE_COLOR, SKI_Text[ SKI_TEXT_TOTAL_VALUE ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
//Display the players current balance text //Display the players current balance text
DisplayWrappedString( SKI_PLAYERS_CURRENT_BALANCE_X, SKI_PLAYERS_CURRENT_BALANCE_Y, SKI_PLAYERS_CURRENT_BALANCE_WIDTH, 2, SKI_LABEL_FONT, SKI_TITLE_COLOR, SkiMessageBoxText[ SKI_PLAYERS_CURRENT_BALANCE ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); DisplayWrappedString( SKI_PLAYERS_CURRENT_BALANCE_X, SKI_PLAYERS_CURRENT_BALANCE_Y, SKI_PLAYERS_CURRENT_BALANCE_WIDTH, 2, SKI_LABEL_FONT, SKI_TITLE_COLOR, SkiMessageBoxText[ SKI_PLAYERS_CURRENT_BALANCE ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
@@ -2569,19 +2537,37 @@ void SelectSkiInventoryMovementAreaRegionCallBack(MOUSE_REGION * pRegion, INT32
} }
} }
void EnterShopKeeperInterfaceScreen( UINT8 ubArmsDealer ) void EnterShopKeeperInterfaceScreen( UINT8 ubArmsDealer )
{ {
gusIDOfCivTrader = NOBODY;
//Get Dealer ID from from merc Id //Get Dealer ID from from merc Id
gbSelectedArmsDealerID = GetArmsDealerIDFromMercID( ubArmsDealer ); gbSelectedArmsDealerID = GetArmsDealerIDFromMercID( ubArmsDealer );
if( gbSelectedArmsDealerID == -1 ) if( gbSelectedArmsDealerID <= -1 )
{ {
#ifdef JA2BETAVERSION #ifdef JA2BETAVERSION
ScreenMsg( FONT_MCOLOR_WHITE, MSG_BETAVERSION, L"Failed to find Arms Dealer ID From Merc ID #%d", ubArmsDealer ); ScreenMsg( FONT_MCOLOR_WHITE, MSG_BETAVERSION, L"Failed to find Arms Dealer ID From Merc ID #%d", ubArmsDealer );
#endif #endif
gfSKIScreenExit = TRUE;
}
LeaveTacticalScreen( SHOPKEEPER_SCREEN );
}
// Flugente: set up shopkeeper with a non-NPC
void EnterShopKeeperInterfaceScreen_NonNPC( INT8 ubArmsDealerID, UINT8 aMercID )
{
gusIDOfCivTrader = aMercID;
//Get Dealer ID from from merc Id
gbSelectedArmsDealerID = ubArmsDealerID;
if ( gbSelectedArmsDealerID <= -1 )
{
#ifdef JA2BETAVERSION
ScreenMsg( FONT_MCOLOR_WHITE, MSG_BETAVERSION, L"Failed to find Arms Dealer ID From Merc ID #%d", ubArmsDealerID );
#endif
gfSKIScreenExit = TRUE; gfSKIScreenExit = TRUE;
} }
@@ -4015,13 +4001,11 @@ void PerformTransaction( UINT32 uiMoneyFromPlayersAccount )
UINT32 uiMoneyInPlayersOfferArea = CalculateHowMuchMoneyIsInPlayersOfferArea( ); UINT32 uiMoneyInPlayersOfferArea = CalculateHowMuchMoneyIsInPlayersOfferArea( );
INT32 iChangeToGiveToPlayer = 0; INT32 iChangeToGiveToPlayer = 0;
UINT32 uiAvailablePlayerOfferSlots; UINT32 uiAvailablePlayerOfferSlots;
//if the player has already requested to leave, get out //if the player has already requested to leave, get out
if( gfUserHasRequestedToLeave ) if( gfUserHasRequestedToLeave )
return; return;
// handle bribing... if the player is giving the dealer money, without buying anything // handle bribing... if the player is giving the dealer money, without buying anything
if( IsMoneyTheOnlyItemInThePlayersOfferArea( ) && CountNumberOfItemsInTheArmsDealersOfferArea( ) == 0 ) if( IsMoneyTheOnlyItemInThePlayersOfferArea( ) && CountNumberOfItemsInTheArmsDealersOfferArea( ) == 0 )
{ {
@@ -4934,7 +4918,8 @@ void DisplayTalkingArmsDealer()
//Make sure the Dealers doesn't get disabled //Make sure the Dealers doesn't get disabled
gFacesData[ giShopKeeperFaceIndex ].fDisabled = FALSE; if ( giShopKeeperFaceIndex > -1 )
gFacesData[ giShopKeeperFaceIndex ].fDisabled = FALSE;
HandleDialogue(); HandleDialogue();
@@ -4944,8 +4929,9 @@ void DisplayTalkingArmsDealer()
HandleTalkingAutoFaces( ); HandleTalkingAutoFaces( );
HandleShopKeeperDialog( 0 ); HandleShopKeeperDialog( 0 );
gfIsTheShopKeeperTalking = FALSE;
gfIsTheShopKeeperTalking = gFacesData[ giShopKeeperFaceIndex ].fTalking; if ( giShopKeeperFaceIndex > -1 )
gfIsTheShopKeeperTalking = gFacesData[ giShopKeeperFaceIndex ].fTalking;
//if the merc just started talking //if the merc just started talking
// if( gfIsTheShopKeeperTalking && !fWasTheMercTalking ) // if( gfIsTheShopKeeperTalking && !fWasTheMercTalking )
@@ -7070,16 +7056,13 @@ void StartSKIDescriptionBox( void )
void DeleteShopKeeperItemDescBox() void DeleteShopKeeperItemDescBox()
{ {
INT32 iCnt;
pShopKeeperItemDescObject = NULL; pShopKeeperItemDescObject = NULL;
gubSkiDirtyLevel = SKI_DIRTY_LEVEL2; gubSkiDirtyLevel = SKI_DIRTY_LEVEL2;
//Redraw the face //Redraw the face
gFacesData[ giShopKeeperFaceIndex ].uiFlags |= FACE_REDRAW_WHOLE_FACE_NEXT_FRAME; if ( giShopKeeperFaceIndex > -1 )
gFacesData[ giShopKeeperFaceIndex ].uiFlags |= FACE_REDRAW_WHOLE_FACE_NEXT_FRAME;
// enable almost everything! // enable almost everything!
CheckForDisabledForGiveItem( ); CheckForDisabledForGiveItem( );
@@ -7104,7 +7087,7 @@ void DeleteShopKeeperItemDescBox()
EnableAllDealersInventorySlots(); EnableAllDealersInventorySlots();
EnableAllDealersOfferSlots(); EnableAllDealersOfferSlots();
for (iCnt = 0; iCnt < SKI_NUM_TRADING_INV_SLOTS; iCnt++) for ( INT32 iCnt = 0; iCnt < SKI_NUM_TRADING_INV_SLOTS; ++iCnt )
{ {
MSYS_EnableRegion( &gPlayersOfferSlotsMouseRegions[ iCnt ] ); MSYS_EnableRegion( &gPlayersOfferSlotsMouseRegions[ iCnt ] );
MSYS_EnableRegion( &gPlayersOfferSlotsSmallFaceMouseRegions[ iCnt ] ); MSYS_EnableRegion( &gPlayersOfferSlotsSmallFaceMouseRegions[ iCnt ] );
@@ -7119,11 +7102,9 @@ void DeleteShopKeeperItemDescBox()
// if( giItemDescAmmoButton >= 0 && ButtonList[ giItemDescAmmoButton ]. // if( giItemDescAmmoButton >= 0 && ButtonList[ giItemDescAmmoButton ].
// EnableButton( giItemDescAmmoButton ); // EnableButton( giItemDescAmmoButton );
} }
BOOLEAN OfferObjectToDealer( OBJECTTYPE *pComplexObject, UINT8 ubOwnerProfileId, INT16 bOwnerSlotId ) BOOLEAN OfferObjectToDealer( OBJECTTYPE *pComplexObject, UINT8 ubOwnerProfileId, INT16 bOwnerSlotId )
{ {
UINT8 ubRepairableSubObjects; UINT8 ubRepairableSubObjects;
@@ -7136,7 +7117,6 @@ BOOLEAN OfferObjectToDealer( OBJECTTYPE *pComplexObject, UINT8 ubOwnerProfileId,
BOOLEAN fFirstOne = TRUE; BOOLEAN fFirstOne = TRUE;
BOOLEAN fSuccess = FALSE; BOOLEAN fSuccess = FALSE;
if ( armsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer != ARMS_DEALER_REPAIRS ) if ( armsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer != ARMS_DEALER_REPAIRS )
{ {
// if not actually doing repairs, there's no need to split objects up at all // if not actually doing repairs, there's no need to split objects up at all
@@ -7367,8 +7347,7 @@ BOOLEAN ShopkeeperAutoPlaceObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObject,
// the entire pObj will get memset to 0 by RemoveObjs() if all the items are successfully placed, // the entire pObj will get memset to 0 by RemoveObjs() if all the items are successfully placed,
// so we have to keep a copy to retrieve with every iteration of the loop // so we have to keep a copy to retrieve with every iteration of the loop
OBJECTTYPE movingObject; OBJECTTYPE movingObject;
while ( pObject->exists() == true ) while ( pObject->exists() == true )
{ {
// figure out how many to place during this loop iteration. Can't do more than MAX_OBJECTS_PER_SLOT at a time // figure out how many to place during this loop iteration. Can't do more than MAX_OBJECTS_PER_SLOT at a time
@@ -7389,7 +7368,6 @@ BOOLEAN ShopkeeperAutoPlaceObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObject,
} }
// The Shopkeeper interface *MUST* use this intermediary function instead of calling AddItemToPool() directly! // The Shopkeeper interface *MUST* use this intermediary function instead of calling AddItemToPool() directly!
// This is because the OBJECTTYPEs used within Shopkeeper may contain an illegal ubNumberOfObjects // This is because the OBJECTTYPEs used within Shopkeeper may contain an illegal ubNumberOfObjects
void ShopkeeperAddItemToPool( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel ) void ShopkeeperAddItemToPool( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel )
@@ -7408,8 +7386,6 @@ void ShopkeeperAddItemToPool( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible,
} }
} }
void IfMercOwnedCopyItemToMercInv( INVENTORY_IN_SLOT *pInv ) void IfMercOwnedCopyItemToMercInv( INVENTORY_IN_SLOT *pInv )
{ {
INT16 sSoldierID; INT16 sSoldierID;
@@ -7494,7 +7470,6 @@ BOOLEAN SKITryToReturnInvToOwnerOrCurrentMerc( INVENTORY_IN_SLOT *pInv )
// owner's inventory is full, so we'll try to give it to the current merc instead // owner's inventory is full, so we'll try to give it to the current merc instead
} }
//if the current merc is not disabled //if the current merc is not disabled
if( !gfSMDisableForItems ) if( !gfSMDisableForItems )
{ {
@@ -7514,8 +7489,7 @@ BOOLEAN SKITryToAddInvToMercsInventory( INVENTORY_IN_SLOT *pInv, SOLDIERTYPE *pS
{ {
INT8 bMoneyInvPos; INT8 bMoneyInvPos;
BOOLEAN fNewItem = FALSE; BOOLEAN fNewItem = FALSE;
//if the item is money //if the item is money
if( Item[ pInv->sItemIndex ].usItemClass == IC_MONEY ) if( Item[ pInv->sItemIndex ].usItemClass == IC_MONEY )
{ {
@@ -7538,7 +7512,6 @@ BOOLEAN SKITryToAddInvToMercsInventory( INVENTORY_IN_SLOT *pInv, SOLDIERTYPE *pS
} }
} }
// If it's just been purchased or repaired, mark it as a "new item" // If it's just been purchased or repaired, mark it as a "new item"
fNewItem = ( BOOLEAN ) ( pInv->uiFlags & ( ARMS_INV_JUST_PURCHASED | ARMS_INV_ITEM_REPAIRED ) ); fNewItem = ( BOOLEAN ) ( pInv->uiFlags & ( ARMS_INV_JUST_PURCHASED | ARMS_INV_ITEM_REPAIRED ) );
@@ -7552,20 +7525,21 @@ BOOLEAN SKITryToAddInvToMercsInventory( INVENTORY_IN_SLOT *pInv, SOLDIERTYPE *pS
return(TRUE); return(TRUE);
} }
BOOLEAN CanMercInteractWithSelectedShopkeeper( SOLDIERTYPE *pSoldier ) BOOLEAN CanMercInteractWithSelectedShopkeeper( SOLDIERTYPE *pSoldier )
{ {
SOLDIERTYPE *pShopkeeper; SOLDIERTYPE *pShopkeeper;
INT32 sDestGridNo; INT32 sDestGridNo;
INT8 bDestLevel; INT8 bDestLevel;
UINT32 uiRange; UINT32 uiRange;
Assert( pSoldier!= NULL ); Assert( pSoldier!= NULL );
Assert( gbSelectedArmsDealerID != -1 ); Assert( gbSelectedArmsDealerID != -1 );
pShopkeeper = FindSoldierByProfileID( armsDealerInfo[ gbSelectedArmsDealerID ].ubShopKeeperID, FALSE ); if ( gusIDOfCivTrader != NOBODY )
pShopkeeper = MercPtrs[gusIDOfCivTrader];
else
pShopkeeper = FindSoldierByProfileID( armsDealerInfo[gbSelectedArmsDealerID].ubShopKeeperID, FALSE );
Assert( pShopkeeper != NULL ); Assert( pShopkeeper != NULL );
Assert( pShopkeeper->bActive ); Assert( pShopkeeper->bActive );
Assert( pShopkeeper->bInSector ); Assert( pShopkeeper->bInSector );
@@ -7597,8 +7571,6 @@ BOOLEAN CanMercInteractWithSelectedShopkeeper( SOLDIERTYPE *pSoldier )
return( FALSE ); return( FALSE );
} }
#ifdef JA2TESTVERSION #ifdef JA2TESTVERSION
void AddShopkeeperToGridNo( UINT8 ubProfile, INT32 sGridNo ) void AddShopkeeperToGridNo( UINT8 ubProfile, INT32 sGridNo )
@@ -7632,8 +7604,7 @@ void AddShopkeeperToGridNo( UINT8 ubProfile, INT32 sGridNo )
void ExitSKIRequested() void ExitSKIRequested()
{ {
BOOLEAN fPlayerOwnedStuffOnTable = FALSE; BOOLEAN fPlayerOwnedStuffOnTable = FALSE;
ShutUpShopKeeper(); ShutUpShopKeeper();
if( !gfRemindedPlayerToPickUpHisStuff ) if( !gfRemindedPlayerToPickUpHisStuff )
@@ -7669,8 +7640,7 @@ void ExitSKIRequested()
} }
} }
} }
// if the player hasn't already requested to leave // if the player hasn't already requested to leave
if( !gfUserHasRequestedToLeave ) if( !gfUserHasRequestedToLeave )
{ {
@@ -7688,8 +7658,6 @@ void ExitSKIRequested()
} }
} }
void ResetAllQuoteSaidFlags() void ResetAllQuoteSaidFlags()
{ {
UINT8 uiCnt; UINT8 uiCnt;
@@ -7703,14 +7671,11 @@ void ResetAllQuoteSaidFlags()
guiLastTimeDealerSaidNormalEvaluationQuote = 0; guiLastTimeDealerSaidNormalEvaluationQuote = 0;
} }
void DealWithItemsStillOnTheTable() void DealWithItemsStillOnTheTable()
{ {
UINT8 ubCnt; UINT8 ubCnt;
SOLDIERTYPE *pDropSoldier; SOLDIERTYPE *pDropSoldier;
// in case we have have to drop stuff off at someone's feet, figure out where it's all gonna go // in case we have have to drop stuff off at someone's feet, figure out where it's all gonna go
// use the current merc, unless he's ineligible, then use the selected merc instead. // use the current merc, unless he's ineligible, then use the selected merc instead.
@@ -7755,8 +7720,6 @@ void DealWithItemsStillOnTheTable()
} }
} }
void ReturnItemToPlayerSomehow( INVENTORY_IN_SLOT *pInvSlot, SOLDIERTYPE *pDropSoldier ) void ReturnItemToPlayerSomehow( INVENTORY_IN_SLOT *pInvSlot, SOLDIERTYPE *pDropSoldier )
{ {
//if the item doesn't have a duplicate copy in its owner merc's inventory slot //if the item doesn't have a duplicate copy in its owner merc's inventory slot
@@ -7770,6 +7733,7 @@ void ReturnItemToPlayerSomehow( INVENTORY_IN_SLOT *pInvSlot, SOLDIERTYPE *pDropS
ShopkeeperAddItemToPool( pDropSoldier->sGridNo, &pInvSlot->ItemObject, VISIBLE, pDropSoldier->pathing.bLevel, 0, 0 ); ShopkeeperAddItemToPool( pDropSoldier->sGridNo, &pInvSlot->ItemObject, VISIBLE, pDropSoldier->pathing.bLevel, 0, 0 );
} }
} }
//CHRISL: We need to handle LBENODE items a little differently so we don't lose anything stored in them. Instead of //CHRISL: We need to handle LBENODE items a little differently so we don't lose anything stored in them. Instead of
// trying to return the item, simply drop the item to the ground. // trying to return the item, simply drop the item to the ground.
if(UsingNewInventorySystem() == true && pInvSlot->ItemObject.IsActiveLBE(0) == true) if(UsingNewInventorySystem() == true && pInvSlot->ItemObject.IsActiveLBE(0) == true)
@@ -7779,8 +7743,6 @@ void ReturnItemToPlayerSomehow( INVENTORY_IN_SLOT *pInvSlot, SOLDIERTYPE *pDropS
} }
} }
void GivePlayerSomeChange( UINT32 uiAmount ) void GivePlayerSomeChange( UINT32 uiAmount )
{ {
INVENTORY_IN_SLOT MoneyInvSlot; INVENTORY_IN_SLOT MoneyInvSlot;
@@ -7805,8 +7767,6 @@ void GivePlayerSomeChange( UINT32 uiAmount )
gArmsDealerStatus[ gbSelectedArmsDealerID ].uiArmsDealersCash -= uiAmount; gArmsDealerStatus[ gbSelectedArmsDealerID ].uiArmsDealersCash -= uiAmount;
} }
void DealerGetsBribed( UINT8 ubProfileId, UINT32 uiMoneyAmount ) void DealerGetsBribed( UINT8 ubProfileId, UINT32 uiMoneyAmount )
{ {
BOOLEAN fBribable = FALSE; BOOLEAN fBribable = FALSE;
@@ -7836,13 +7796,10 @@ void DealerGetsBribed( UINT8 ubProfileId, UINT32 uiMoneyAmount )
} }
} }
void HandlePossibleRepairDelays() void HandlePossibleRepairDelays()
{ {
UINT32 uiHoursSinceAnyItemsShouldHaveBeenRepaired = 0; UINT32 uiHoursSinceAnyItemsShouldHaveBeenRepaired = 0;
// assume there won't be a delay // assume there won't be a delay
gfStartWithRepairsDelayedQuote = FALSE; gfStartWithRepairsDelayedQuote = FALSE;
@@ -7884,8 +7841,6 @@ void HandlePossibleRepairDelays()
} }
} }
BOOLEAN RepairmanFixingAnyItemsThatShouldBeDoneNow( UINT32 *puiHoursSinceOldestItemRepaired ) BOOLEAN RepairmanFixingAnyItemsThatShouldBeDoneNow( UINT32 *puiHoursSinceOldestItemRepaired )
{ {
//if the dealer is not a repair dealer, return //if the dealer is not a repair dealer, return
@@ -7929,12 +7884,10 @@ BOOLEAN RepairmanFixingAnyItemsThatShouldBeDoneNow( UINT32 *puiHoursSinceOldestI
} }
} }
// if FALSE returned here, he's either not repairing anything, or none of it's done yet // if FALSE returned here, he's either not repairing anything, or none of it's done yet
return( fFoundOne ); return( fFoundOne );
} }
void DelayRepairsInProgressBy( UINT32 uiMinutesDelayed ) void DelayRepairsInProgressBy( UINT32 uiMinutesDelayed )
{ {
UINT32 uiMinutesShopClosedBeforeItsDone; UINT32 uiMinutesShopClosedBeforeItsDone;
@@ -7959,8 +7912,6 @@ void DelayRepairsInProgressBy( UINT32 uiMinutesDelayed )
} }
} }
//Mouse Call back for the Arms delaers face //Mouse Call back for the Arms delaers face
void SelectArmsDealersDropItemToGroundRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) void SelectArmsDealersDropItemToGroundRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
{ {
+5 -2
View File
@@ -116,9 +116,12 @@ UINT32 ShopKeeperScreenShutdown( void );
bool ArmsDealerItemQsortCompare(INVENTORY_IN_SLOT& pInvSlot1, INVENTORY_IN_SLOT& pInvSlot2); bool ArmsDealerItemQsortCompare(INVENTORY_IN_SLOT& pInvSlot1, INVENTORY_IN_SLOT& pInvSlot2);
bool RepairmanItemQsortCompare(INVENTORY_IN_SLOT& pInvSlot1, INVENTORY_IN_SLOT& pInvSlot2); bool RepairmanItemQsortCompare(INVENTORY_IN_SLOT& pInvSlot1, INVENTORY_IN_SLOT& pInvSlot2);
void EnterShopKeeperInterfaceScreen( UINT8 ubArmsDealer ); void EnterShopKeeperInterfaceScreen( UINT8 ubArmsDealer );
void EnableDisableShopkeeperButtons(UINT32 uiCurrentItemDescriptionScreen, int bpAction);
// Flugente: set up shopkeeper with a non-NPC
void EnterShopKeeperInterfaceScreen_NonNPC( INT8 ubArmsDealerID, UINT8 aMercID );
void EnableDisableShopkeeperButtons(UINT32 uiCurrentItemDescriptionScreen, int bpAction);
void DrawHatchOnInventory( UINT32 uiSurface, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usHeight, UINT16 usColor = 0 ); void DrawHatchOnInventory( UINT32 uiSurface, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usHeight, UINT16 usColor = 0 );
void DrawHatchOnInventory_MilitiaAccess( UINT32 uiSurface, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usHeight, UINT16 usColor = 0 ); void DrawHatchOnInventory_MilitiaAccess( UINT32 uiSurface, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usHeight, UINT16 usColor = 0 );
+35
View File
@@ -99,6 +99,7 @@
#include "Facilities.h" // added by Flugente #include "Facilities.h" // added by Flugente
#include "Cheats.h" // added by Flugente #include "Cheats.h" // added by Flugente
#include "MilitiaIndividual.h" // added by Flugente #include "MilitiaIndividual.h" // added by Flugente
#include "Arms Dealer Init.h" // added by Flugente for armsDealerInfo[]
#endif #endif
#include "ub_config.h" #include "ub_config.h"
@@ -20512,6 +20513,40 @@ BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValid
HandleSurrenderOffer( pTSoldier ); HandleSurrenderOffer( pTSoldier );
return(FALSE); return(FALSE);
} }
else if ( pTSoldier->sNonNPCTraderID > 0 )
{
UINT8 ubTownID = StrategicMap[CALCULATE_STRATEGIC_INDEX( pTSoldier->sSectorX, pTSoldier->sSectorY )].bNameId;
// not possible if this guy is hostile towards us
// however, if we are covert as a soldier, this check does not apply - merchants know better than do defy the army
if ( !pTSoldier->aiData.bNeutral && !(this->usSoldierFlagMask & SOLDIER_COVERT_SOLDIER) )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, szNonProfileMerchantText[0] );
}
// not possible if this guy is incapitated
else if ( pTSoldier->bCollapsed || pTSoldier->bBreathCollapsed || pTSoldier->stats.bLife < OKLIFE )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, szNonProfileMerchantText[1] );
}
// not possible in combat
else if ( gTacticalStatus.uiFlags & INCOMBAT )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, szNonProfileMerchantText[2] );
}
// not possible of loyalty too low
// however, if we are covert as a soldier, this check does not apply - merchants know better than do defy the army
else if ( ubTownID != BLANK_SECTOR && gTownLoyalty[ubTownID].ubRating < armsDealerInfo[pTSoldier->sNonNPCTraderID].nonprofile_loyaltyrequired && !(this->usSoldierFlagMask & SOLDIER_COVERT_SOLDIER) )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, szNonProfileMerchantText[3] );
}
// if we passed the above check, we can trade
else
{
EnterShopKeeperInterfaceScreen_NonNPC( pTSoldier->sNonNPCTraderID, pTSoldier->ubID );
}
return FALSE;
}
else else
{ {
// Flugente: if this guy is a potential volunteer, we might be able to sway him // Flugente: if this guy is a potential volunteer, we might be able to sway him
+1 -1
View File
@@ -1480,7 +1480,7 @@ public:
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
// Flugente: this was the location of required variables required for the now removed poison feature. They can be used again // Flugente: this was the location of required variables required for the now removed poison feature. They can be used again
UINT8 ubMilitiaAssists; // Flugente: stores militia assists UINT8 ubMilitiaAssists; // Flugente: stores militia assists
INT8 bUnusedINT8_2; INT8 sNonNPCTraderID; // Flugente: we can set up non-NPC soldiers to be merchants, we store their dealer id here (value > 0 means arms dealer entry x)
INT8 bUnusedINT8_3; INT8 bUnusedINT8_3;
INT16 bUnusedINT16_4; INT16 bUnusedINT16_4;
+15 -2
View File
@@ -3397,7 +3397,9 @@ SOLDIERTYPE* TacticalCreateArmedCivilian( UINT8 usSoldierClass )
return(pSoldier); return(pSoldier);
} }
SOLDIERTYPE* TacticalCreateCivilian( INT32 sGridNo, UINT8 usCivilianGroup, INT8 sBodyType, INT8 aVest, INT8 aPants, INT8 aHair, INT8 aSkin, INT16 sItem1, INT16 sItem2, INT16 sItem3, INT16 sItem4 ) SOLDIERTYPE* TacticalCreateCivilian( INT32 sGridNo, UINT8 usCivilianGroup, INT8 usTraderID,
INT8 sBodyType, INT8 aVest, INT8 aPants, INT8 aHair, INT8 aSkin,
INT16 sItem1, INT16 sItem2, INT16 sItem3, INT16 sItem4 )
{ {
// not in autoresolve! // not in autoresolve!
if ( guiCurrentScreen == AUTORESOLVE_SCREEN ) if ( guiCurrentScreen == AUTORESOLVE_SCREEN )
@@ -3416,7 +3418,7 @@ SOLDIERTYPE* TacticalCreateCivilian( INT32 sGridNo, UINT8 usCivilianGroup, INT8
MercCreateStruct.sInsertionGridNo = sGridNo; MercCreateStruct.sInsertionGridNo = sGridNo;
MercCreateStruct.ubDirection = Random( NUM_WORLD_DIRECTIONS ); MercCreateStruct.ubDirection = Random( NUM_WORLD_DIRECTIONS );
while ( sBodyType < 0 || sBodyType >= CRIPPLECIV || (sBodyType >= ADULTFEMALEMONSTER && sBodyType <= QUEENMONSTER) ) while ( sBodyType < 0 || sBodyType > CRIPPLECIV || (sBodyType >= ADULTFEMALEMONSTER && sBodyType <= QUEENMONSTER) )
{ {
sBodyType = Random( CRIPPLECIV + 1 ); sBodyType = Random( CRIPPLECIV + 1 );
} }
@@ -3458,6 +3460,17 @@ SOLDIERTYPE* TacticalCreateCivilian( INT32 sGridNo, UINT8 usCivilianGroup, INT8
// set correct civ group // set correct civ group
pSoldier->ubCivilianGroup = usCivilianGroup; pSoldier->ubCivilianGroup = usCivilianGroup;
pSoldier->sNonNPCTraderID = -1;
if ( gGameExternalOptions.bExtraMerchants )
{
pSoldier->sNonNPCTraderID = usTraderID;
// if we're a dealer, don't walk around that much
if ( pSoldier->sNonNPCTraderID > 0 )
pSoldier->aiData.bOrders = ONGUARD;
}
// make him wear administrator uniform // make him wear administrator uniform
UINT16 usPaletteAnimSurface = LoadSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); UINT16 usPaletteAnimSurface = LoadSoldierAnimationSurface( pSoldier, pSoldier->usAnimState );
+3 -1
View File
@@ -475,7 +475,9 @@ SOLDIERTYPE* TacticalCreateEnemyJeep( );
// Flugente: create an armed civilian // Flugente: create an armed civilian
SOLDIERTYPE* TacticalCreateArmedCivilian( UINT8 usSoldierClass = SOLDIER_CLASS_ARMY ); SOLDIERTYPE* TacticalCreateArmedCivilian( UINT8 usSoldierClass = SOLDIER_CLASS_ARMY );
SOLDIERTYPE* TacticalCreateCivilian( INT32 sGridNo, UINT8 usCivilianGroup, INT8 sBodyType, INT8 aVest, INT8 aPants, INT8 aHair, INT8 aSkin, INT16 sItem1, INT16 sItem2, INT16 sItem3, INT16 sItem4 ); SOLDIERTYPE* TacticalCreateCivilian( INT32 sGridNo, UINT8 usCivilianGroup, INT8 usTraderID,
INT8 sBodyType, INT8 aVest, INT8 aPants, INT8 aHair, INT8 aSkin,
INT16 sItem1, INT16 sItem2, INT16 sItem3, INT16 sItem4 );
// Flugente: assassins are elite soldiers of the civ team that go hostile on a certain event, otherwise they just blend in // Flugente: assassins are elite soldiers of the civ team that go hostile on a certain event, otherwise they just blend in
SOLDIERTYPE* TacticalCreateEnemyAssassin(UINT8 disguisetype); SOLDIERTYPE* TacticalCreateEnemyAssassin(UINT8 disguisetype);
+4 -20
View File
@@ -136,26 +136,10 @@ typedef PARSE_STAGE;
#define PERKOINVENTORYFILENAME "NPCInventory\\PerkoInventory.xml" #define PERKOINVENTORYFILENAME "NPCInventory\\PerkoInventory.xml"
#define FREDOINVENTORYFILENAME "NPCInventory\\FredoInventory.xml" #define FREDOINVENTORYFILENAME "NPCInventory\\FredoInventory.xml"
#define TINAINVENTORYFILENAME "NPCInventory\\TinaInventory.xml" #define TINAINVENTORYFILENAME "NPCInventory\\TinaInventory.xml"
#define ADITIONALDEALER_1_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_1_Inventory.xml"
#define ADITIONALDEALER_2_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_2_Inventory.xml" // Flugente: create additional filenames by putting them together
#define ADITIONALDEALER_3_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_3_Inventory.xml" #define ADITIONALDEALER_INVENTORYFILENAME_A "NPCInventory\\AdditionalDealer_"
#define ADITIONALDEALER_4_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_4_Inventory.xml" #define ADITIONALDEALER_INVENTORYFILENAME_B "_Inventory.xml"
#define ADITIONALDEALER_5_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_5_Inventory.xml"
#define ADITIONALDEALER_6_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_6_Inventory.xml"
#define ADITIONALDEALER_7_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_7_Inventory.xml"
#define ADITIONALDEALER_8_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_8_Inventory.xml"
#define ADITIONALDEALER_9_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_9_Inventory.xml"
#define ADITIONALDEALER_10_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_10_Inventory.xml"
#define ADITIONALDEALER_11_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_11_Inventory.xml"
#define ADITIONALDEALER_12_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_12_Inventory.xml"
#define ADITIONALDEALER_13_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_13_Inventory.xml"
#define ADITIONALDEALER_14_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_14_Inventory.xml"
#define ADITIONALDEALER_15_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_15_Inventory.xml"
#define ADITIONALDEALER_16_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_16_Inventory.xml"
#define ADITIONALDEALER_17_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_17_Inventory.xml"
#define ADITIONALDEALER_18_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_18_Inventory.xml"
#define ADITIONALDEALER_19_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_19_Inventory.xml"
#define ADITIONALDEALER_20_INVENTORYFILENAME "NPCInventory\\AdditionalDealer_20_Inventory.xml"
#ifdef JA2UB #ifdef JA2UB
#define BETTYINVENTORYFILENAME "NPCInventory\\BettyInventory.xml" #define BETTYINVENTORYFILENAME "NPCInventory\\BettyInventory.xml"
+8 -1
View File
@@ -65,7 +65,8 @@ merchantStartElementHandle(void *userData, const XML_Char *name, const XML_Char
strcmp(name, "daysDelayMin") == 0 || strcmp(name, "daysDelayMin") == 0 ||
strcmp(name, "daysDelayMax") == 0 || strcmp(name, "daysDelayMax") == 0 ||
strcmp(name, "useBRSetting") == 0 || strcmp(name, "useBRSetting") == 0 ||
strcmp(name, "allInventoryAlwaysAvailable") == 0 )) strcmp(name, "allInventoryAlwaysAvailable" ) == 0 ||
strcmp(name, "nonprofile_loyaltyrequired") == 0 ))
{ {
pData->curElement = ELEMENT_PROPERTY; pData->curElement = ELEMENT_PROPERTY;
@@ -223,6 +224,11 @@ merchantEndElementHandle(void *userData, const XML_Char *name)
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
pData->curMerchant.allInventoryAlwaysAvailable = (BOOLEAN) atol(pData->szCharData); pData->curMerchant.allInventoryAlwaysAvailable = (BOOLEAN) atol(pData->szCharData);
} }
else if ( strcmp( name, "nonprofile_loyaltyrequired" ) == 0 )
{
pData->curElement = ELEMENT;
pData->curMerchant.nonprofile_loyaltyrequired = (UINT8)strtoul( pData->szCharData, NULL, 0 );
}
pData->maxReadDepth--; pData->maxReadDepth--;
} }
@@ -333,6 +339,7 @@ BOOLEAN WriteMerchantStats()
FilePrintf(hFile,"\t\t<daysDelayMax>%d</daysDelayMax>\r\n", armsDealerInfo[cnt].daysDelayMax ); FilePrintf(hFile,"\t\t<daysDelayMax>%d</daysDelayMax>\r\n", armsDealerInfo[cnt].daysDelayMax );
FilePrintf(hFile,"\t\t<useBRSetting>%d</useBRSetting>\r\n", armsDealerInfo[cnt].useBRSetting ); FilePrintf(hFile,"\t\t<useBRSetting>%d</useBRSetting>\r\n", armsDealerInfo[cnt].useBRSetting );
FilePrintf(hFile,"\t\t<allInventoryAlwaysAvailable>%d</allInventoryAlwaysAvailable>\r\n", armsDealerInfo[cnt].allInventoryAlwaysAvailable ); FilePrintf(hFile,"\t\t<allInventoryAlwaysAvailable>%d</allInventoryAlwaysAvailable>\r\n", armsDealerInfo[cnt].allInventoryAlwaysAvailable );
FilePrintf(hFile,"\t\t<nonprofile_loyaltyrequired>%d</nonprofile_loyaltyrequired>\r\n", armsDealerInfo[cnt].nonprofile_loyaltyrequired );
FilePrintf(hFile,"\t</MERCHANT>\r\n"); FilePrintf(hFile,"\t</MERCHANT>\r\n");
} }
+3
View File
@@ -2959,6 +2959,9 @@ extern STR16 szIdividualMilitiaWebsiteFilterText_Rank[] ;
extern STR16 szIdividualMilitiaWebsiteFilterText_Origin[]; extern STR16 szIdividualMilitiaWebsiteFilterText_Origin[];
extern STR16 szIdividualMilitiaWebsiteFilterText_Sector[]; extern STR16 szIdividualMilitiaWebsiteFilterText_Sector[];
// Flugente: non-profile merchants
extern STR16 szNonProfileMerchantText[];
#define TACTICAL_INVENTORY_DIALOG_NUM 16 #define TACTICAL_INVENTORY_DIALOG_NUM 16
#define TACTICAL_COVER_DIALOG_NUM 16 #define TACTICAL_COVER_DIALOG_NUM 16
+7
View File
@@ -11102,6 +11102,13 @@ STR16 szIdividualMilitiaWebsiteFilterText_Sector[] =
L"All sectors", L"All sectors",
}; };
STR16 szNonProfileMerchantText[] =
{
L"Merchant is hostile and does not want to trade.",
L"Merchant is in no state to do business.",
L"Merchant won't trade during combat.",
L"Merchant refuses to interact with you.",
};
// WANNE: Some Chinese specific strings that needs to be in unicode! // WANNE: Some Chinese specific strings that needs to be in unicode!
STR16 ChineseSpecString1 = L"%"; //defined in _ChineseText.cpp as this file is already unicode STR16 ChineseSpecString1 = L"%"; //defined in _ChineseText.cpp as this file is already unicode
+7
View File
@@ -11119,5 +11119,12 @@ STR16 szIdividualMilitiaWebsiteFilterText_Sector[] =
L"All sectors", L"All sectors",
}; };
STR16 szNonProfileMerchantText[] =
{
L"Merchant is hostile and does not want to trade.",
L"Merchant is in no state to do business.",
L"Merchant won't trade during combat.",
L"Merchant refuses to interact with you.",
};
#endif //DUTCH #endif //DUTCH
+8
View File
@@ -11102,4 +11102,12 @@ STR16 szIdividualMilitiaWebsiteFilterText_Sector[] =
L"All sectors", L"All sectors",
}; };
STR16 szNonProfileMerchantText[] =
{
L"Merchant is hostile and does not want to trade.",
L"Merchant is in no state to do business.",
L"Merchant won't trade during combat.",
L"Merchant refuses to interact with you.",
};
#endif //ENGLISH #endif //ENGLISH
+7
View File
@@ -11101,5 +11101,12 @@ STR16 szIdividualMilitiaWebsiteFilterText_Sector[] =
L"All sectors", L"All sectors",
}; };
STR16 szNonProfileMerchantText[] =
{
L"Merchant is hostile and does not want to trade.",
L"Merchant is in no state to do business.",
L"Merchant won't trade during combat.",
L"Merchant refuses to interact with you.",
};
#endif //FRENCH #endif //FRENCH
+7
View File
@@ -10931,5 +10931,12 @@ STR16 szIdividualMilitiaWebsiteFilterText_Sector[] =
L"All sectors", L"All sectors",
}; };
STR16 szNonProfileMerchantText[] =
{
L"Merchant is hostile and does not want to trade.",
L"Merchant is in no state to do business.",
L"Merchant won't trade during combat.",
L"Merchant refuses to interact with you.",
};
#endif //GERMAN #endif //GERMAN
+7
View File
@@ -11110,5 +11110,12 @@ STR16 szIdividualMilitiaWebsiteFilterText_Sector[] =
L"All sectors", L"All sectors",
}; };
STR16 szNonProfileMerchantText[] =
{
L"Merchant is hostile and does not want to trade.",
L"Merchant is in no state to do business.",
L"Merchant won't trade during combat.",
L"Merchant refuses to interact with you.",
};
#endif //ITALIAN #endif //ITALIAN
+7
View File
@@ -11123,5 +11123,12 @@ STR16 szIdividualMilitiaWebsiteFilterText_Sector[] =
L"All sectors", L"All sectors",
}; };
STR16 szNonProfileMerchantText[] =
{
L"Merchant is hostile and does not want to trade.",
L"Merchant is in no state to do business.",
L"Merchant won't trade during combat.",
L"Merchant refuses to interact with you.",
};
#endif //POLISH #endif //POLISH
+7
View File
@@ -11102,5 +11102,12 @@ STR16 szIdividualMilitiaWebsiteFilterText_Sector[] =
L"All sectors", L"All sectors",
}; };
STR16 szNonProfileMerchantText[] =
{
L"Merchant is hostile and does not want to trade.",
L"Merchant is in no state to do business.",
L"Merchant won't trade during combat.",
L"Merchant refuses to interact with you.",
};
#endif //RUSSIAN #endif //RUSSIAN