- UB Improvements / Cleanup (by Jazz)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6334 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2013-08-29 11:53:39 +00:00
parent a5abf4d91a
commit 25dd0b084e
16 changed files with 734 additions and 200 deletions
+31 -68
View File
@@ -119,9 +119,7 @@ BOOLEAN AdjustCertainDealersInventory();
void LimitArmsDealersInventory( UINT8 ubArmsDealer, UINT32 uDealerItemType, UINT8 ubMaxNumberOfItemType );
void GuaranteeAtLeastOneItemOfType( UINT8 ubArmsDealer, UINT32 uiDealerItemType );
void GuaranteeAtLeastXItemsOfIndex( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubHowMany );
#ifdef JA2UB
void GuaranteeAtMostNumOfItemsForItem( UINT8 ubArmsDealer, INT16 sItemIndex, UINT8 ubAtMostNumItems );
#endif
void ArmsDealerGetsFreshStock( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubNumItems );
BOOLEAN ItemContainsLiquid( UINT16 usItemIndex );
@@ -643,17 +641,25 @@ BOOLEAN AdjustCertainDealersInventory( )
GuaranteeAtLeastXItemsOfIndex( ARMS_DEALER_RAUL, BARRETT_UB, 1 );
}
/*
moved to Quest.lua
//if the player hasnt done the "killed the annoying bloodcats" quest for betty,
if( gubQuest[ QUEST_FIX_LAPTOP ] != QUESTDONE && gGameUBOptions.LaptopQuestEnabled == TRUE )
{
//Guarntee 1 laptop transmitter to be at betty's
GuaranteeAtLeastXItemsOfIndex( ARMS_DEALER_BETTY, LAPTOP_TRANSMITTER , 1 ); //4500
}
else
{
GuaranteeAtMostNumOfItemsForItem( ARMS_DEALER_BETTY, LAPTOP_TRANSMITTER, 0 ); //4500
}
*/
if( gGameUBOptions.LaptopQuestEnabled == FALSE )
{
GuaranteeAtMostNumOfItemsForItem( ARMS_DEALER_BETTY, LAPTOP_TRANSMITTER, 0 ); //4500
}
if( gubQuest[ QUEST_GET_RID_BLOODCATS_AT_BETTYS ] != QUESTDONE )
{
@@ -891,6 +897,27 @@ void GuaranteeAtLeastOneItemOfType( UINT8 ubArmsDealer, UINT32 uiDealerItemType
// internal logic failure!
}
void GuaranteeAtMostNumOfItemsForItem( UINT8 ubArmsDealer, INT16 sItemIndex, UINT8 ubAtMostNumItems )
{
if( gArmsDealerStatus[ ubArmsDealer ].fOutOfBusiness )
return;
//ADB, ya, a whole 1 line of extra code!
// not permitted for repair dealers - would take extra code to avoid counting items under repair!
//Assert( !DoesDealerDoRepairs( ubArmsDealer ) );
int itemsIHave = 0;
for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin();
iter != gArmsDealersInventory[ ubArmsDealer ].end(); ++iter) {
if (iter->ItemIsInInventory() == true
&& iter->object.usItem == sItemIndex
&& iter->IsUnderRepair() == false) {
itemsIHave -= iter->object.ubNumberOfObjects;
//if there are any of these in stock
}
}
}
void GuaranteeAtLeastXItemsOfIndex( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubHowMany )
{
@@ -2442,68 +2469,4 @@ BOOLEAN CanThisItemBeSoldToSimulatedCustomer( UINT8 ubArmsDealerID, UINT16 usIte
return( TRUE );
}
void GuaranteeAtMostNumOfItemsForItem( UINT8 ubArmsDealer, INT16 sItemIndex, UINT8 ubAtMostNumItems )
{
if( gArmsDealerStatus[ ubArmsDealer ].fOutOfBusiness )
return;
//ADB, ya, a whole 1 line of extra code!
// not permitted for repair dealers - would take extra code to avoid counting items under repair!
//Assert( !DoesDealerDoRepairs( ubArmsDealer ) );
int itemsIHave = 0;
for (DealerItemList::iterator iter = gArmsDealersInventory[ ubArmsDealer ].begin();
iter != gArmsDealersInventory[ ubArmsDealer ].end(); ++iter) {
if (iter->ItemIsInInventory() == true
&& iter->object.usItem == sItemIndex
&& iter->IsUnderRepair() == false) {
itemsIHave -= iter->object.ubNumberOfObjects;
//if there are any of these in stock
}
}
/* UINT16 usCnt=0;
UINT8 ubNumToRemove=0;
SPECIAL_ITEM_INFO SpclItemInfo;
UINT8 ubNumLeftToRemove=0;
INT8 bItemCondition=0;
UINT8 bElementToRemove=0;
//if the num items in stock is greater then the num past in
if( gArmsDealersInventory[ ubArmsDealer ][ sItemIndex ].ubTotalItems > ubAtMostNumItems )
{
ubNumToRemove = gArmsDealersInventory[ ubArmsDealer ][ sItemIndex ].ubTotalItems - ubAtMostNumItems;
ubNumLeftToRemove = ubNumToRemove;
//loop through the specified #of times
while( ubNumLeftToRemove > 0 )
{
SetSpecialItemInfoToDefaults( &SpclItemInfo );
//remove special ones first
if( gArmsDealersInventory[ ubArmsDealer ][ sItemIndex ].ubTotalItems > gArmsDealersInventory[ ubArmsDealer ][ sItemIndex ].ubPerfectItems )
{
bElementToRemove = GetFirstValidSpecialItemFromDealer( ubArmsDealer, sItemIndex );
RemoveSpecialItemFromArmsDealerInventoryAtElement( ubArmsDealer, sItemIndex, bElementToRemove );
ubNumLeftToRemove -= 1;
}
else
{
//lower the number to the required number
RemoveItemFromArmsDealerInventory( ubArmsDealer, sItemIndex, &SpclItemInfo, ubNumLeftToRemove );
ubNumLeftToRemove = 0;
}
}
}
*/
}
#endif
#endif
+1 -1
View File
@@ -396,7 +396,7 @@ UINT32 CalculateMinutesClosedBetween( UINT8 ubArmsDealer, UINT32 uiStartTime, UI
extern void DailyCheckOnItemQuantities( BOOLEAN fInstallyHaveItemsAppear ); //Ja25 UB
#endif
extern void GuaranteeAtLeastXItemsOfIndex( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubHowMany );
extern void GuaranteeAtMostNumOfItemsForItem( UINT8 ubArmsDealer, INT16 sItemIndex, UINT8 ubAtMostNumItems );
#endif
+85 -9
View File
@@ -2021,6 +2021,81 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN
ubFileNumID = CARLO;
}
#ifdef JA2UB
if ( ubCharacterNum == MANUEL_UB )
{
sprintf( (char *)zFileNameExists,"NPCDATA\\%03d.EDT", MANUEL_UB );
ubFileNumID = MANUEL_UB;
}
if ( ubCharacterNum == BIGGENS_UB )
{
sprintf( (char *)zFileNameExists,"NPCDATA\\%03d.EDT", BIGGENS_UB );
ubFileNumID = BIGGENS_UB;
}
if ( ubCharacterNum == JOHN_K_UB )
{
sprintf( (char *)zFileNameExists,"NPCDATA\\%03d.EDT", JOHN_K_UB );
ubFileNumID = JOHN_K_UB;
}
if ( ubCharacterNum == TEX_UB )
{
sprintf( (char *)zFileNameExists,"NPCDATA\\%03d.EDT", TEX_UB );
ubFileNumID = TEX_UB;
}
if ( ubCharacterNum == GASTON_UB )
{
sprintf( (char *)zFileNameExists,"NPCDATA\\%03d.EDT", GASTON_UB );
ubFileNumID = GASTON_UB;
}
if ( ubCharacterNum == STOGIE_UB )
{
sprintf( (char *)zFileNameExists,"NPCDATA\\%03d.EDT", STOGIE_UB );
ubFileNumID = STOGIE_UB;
}
if ( ubCharacterNum == JERRY_MILO_UB )
{
sprintf( (char *)zFileNameExists,"NPCDATA\\%03d.EDT", JERRY_MILO_UB );
ubFileNumID = JERRY_MILO_UB;
}
if ( ubCharacterNum == PGMALE4_UB )
{
sprintf( (char *)zFileNameExists,"NPCDATA\\%03d.EDT", PGMALE4_UB );
ubFileNumID = PGMALE4_UB;
}
if ( ubCharacterNum == BETTY_UB )
{
sprintf( (char *)zFileNameExists,"NPCDATA\\%03d.EDT", BETTY_UB );
ubFileNumID = BETTY_UB;
}
if ( ubCharacterNum == RAUL_UB )
{
sprintf( (char *)zFileNameExists,"NPCDATA\\%03d.EDT", RAUL_UB );
ubFileNumID = RAUL_UB;
}
if ( ubCharacterNum == MORRIS_UB )
{
sprintf( (char *)zFileNameExists,"NPCDATA\\%03d.EDT", MORRIS_UB );
ubFileNumID = MORRIS_UB;
}
if ( ubCharacterNum == RUDY_UB )
{
sprintf( (char *)zFileNameExists,"NPCDATA\\%03d.EDT", RUDY_UB );
ubFileNumID = RUDY_UB;
}
#endif
// If we are character #155, check fact!
if ( ubCharacterNum == MANNY && !gubFact[ FACT_MANNY_IS_BARTENDER ] )
{
@@ -2069,32 +2144,33 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN
//new profiles by Jazz
if ( ( gProfilesRPC[ubCharacterNum].ProfilId == ubCharacterNum || gProfilesNPC[ubCharacterNum].ProfilId == ubCharacterNum || gProfilesVehicle[ubCharacterNum].ProfilId == ubCharacterNum ) && gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED )
{
//inshy: fix for UB-1.13 version only sprintf( zFileName,"SPEECH\\r_%03d_%03d.ogg",ubCharacterNum,usQuoteNum );
//inshy: fix for UB-1.13 version only sprintf( zFileName,"SPEECH\\r_%03d_%03d.ogg",ubCharacterNum,usQuoteNum );
if ( gSoundProfileValue[ubCharacterNum].EnabledSound == TRUE )
{
#ifdef JA2UB
#ifdef JA2UB
sprintf( zFileName,"SPEECH\\%03d_%03d.ogg",ubCharacterNum,usQuoteNum );
if ( !FileExists( zFileName ) )
{
sprintf( zFileName,"SPEECH\\%03d_%03d.ogg",ubCharacterNum,usQuoteNum );
}
#else
#else
sprintf( zFileName,"SPEECH\\r_%03d_%03d.ogg",ubCharacterNum,usQuoteNum );
#endif
#endif
if ( !FileExists( zFileName ) )
{
//inshy: fix for UB-1.13 version only
#ifdef JA2UB
//inshy: fix for UB-1.13 version only
#ifdef JA2UB
sprintf( zFileName,"SPEECH\\%03d_%03d.wav",ubCharacterNum,usQuoteNum );
if ( !FileExists( zFileName ) )
{
sprintf( zFileName,"SPEECH\\%03d_%03d.wav",ubCharacterNum,usQuoteNum );
}
#else
#else
sprintf( zFileName,"SPEECH\\r_%03d_%03d.wav",ubCharacterNum,usQuoteNum );
#endif
//<SB> Also check for Russian Gold sound files (identical to international ones)
#endif
//<SB> Also check for Russian Gold sound files (identical to international ones)
if(! FileExists( zFileName ) )
{
sprintf( zFileName,"SPEECH\\%03d_%03d.ogg",ubCharacterNum,usQuoteNum );
+2 -2
View File
@@ -2397,10 +2397,10 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT32 sGr
#ifdef JA2UB
//JA25 ub
//if the item is valid
if( usItem != 0 )
if( iItemIndex != 0 )
{
//handle the picking up of a new ja25 gun
HandleNewGunComment( pSoldier, usItem, TRUE );
HandleNewGunComment( pSoldier, iItemIndex, TRUE );
}
#endif
// Aknowledge....
+1 -1
View File
@@ -5636,7 +5636,7 @@ void HandleRaulBlowingHimselfUp()
UINT16 usItem=0;
//Find Raul
pSoldier = FindSoldierByProfileID( 74, FALSE );
pSoldier = FindSoldierByProfileID( RAUL_UB, FALSE );
//if he exists
if( pSoldier )
+38
View File
@@ -319,6 +319,42 @@ void InitGridNoUB()
POWERGENFANSOUND_GRIDNO2 = gGameUBOptions.PowergenFanSoundGridNo2; //= 19749;
STARTFANBACKUPAGAIN_GRIDNO = gGameUBOptions.StartFanbackupAgainGridNo; //= 10980;
STOPPOWERGENFAN_GRIDNO = gGameUBOptions.StopPowergenFanGridNo; //= 10980;
MANUEL_UB = gGameUBOptions.ubMANUEL_UB;
BIGGENS_UB = gGameUBOptions.ubBIGGENS_UB;
JOHN_K_UB = gGameUBOptions.ubJOHN_K_UB;
TEX_UB = gGameUBOptions.ubTEX_UB;
GASTON_UB = gGameUBOptions.ubGASTON_UB;
STOGIE_UB = gGameUBOptions.ubSTOGIE_UB;
JERRY_MILO_UB = gGameUBOptions.ubJERRY_MILO_UB;
PGMALE4_UB = gGameUBOptions.ubPGMALE4_UB;
BETTY_UB = gGameUBOptions.ubBETTY_UB;
RAUL_UB = gGameUBOptions.ubRAUL_UB;
MORRIS_UB = gGameUBOptions.ubMORRIS_UB;
RUDY_UB = gGameUBOptions.ubRUDY_UB;
TEX_MOVIE_ATTACK_CLYDESDALES = gGameUBOptions.ubTEX_MOVIE_ATTACK_CLYDESDALES;
TEX_MOVIE_WILD_EAST = gGameUBOptions.ubTEX_MOVIE_WILD_EAST;
TEX_MOVIE_HAVE_HONDA = gGameUBOptions.ubTEX_MOVIE_HAVE_HONDA;
LAPTOP_TRANSMITTER = gGameUBOptions.ubLAPTOP_TRANSMITTER;
CHE_GUEVARA_CANTEEN = gGameUBOptions.ubCHE_GUEVARA_CANTEEN;
MERC_WRISTWATCH = gGameUBOptions.ubMERC_WRISTWATCH;
SAM_GARVER_COMBAT_KNIFE = gGameUBOptions.ubSAM_GARVER_COMBAT_KNIFE;
MERC_UMBRELLA_OLD = gGameUBOptions.ubMERC_UMBRELLA_OLD;
MORRIS_INSTRUCTION_NOTE = gGameUBOptions.ubMORRIS_INSTRUCTION_NOTE;
HAND_CANNON = gGameUBOptions.ubHAND_CANNON;
HARTFORD_6_SHOOTER = gGameUBOptions.ubHARTFORD_6_SHOOTER;
MERC_UMBRELLA = gGameUBOptions.ubMERC_UMBRELLA;
CLIP_CANNON_BALL = gGameUBOptions.ubCLIP_CANNON_BALL;
BARRETT_UB = gGameUBOptions.ubBARRETT_UB;
CALICO_960_UB = gGameUBOptions.ubCALICO_960_UB;
PSG1_UB = gGameUBOptions.ubPSG1_UB;
L85_UB = gGameUBOptions.ubL85_UB;
TAR21_UB = gGameUBOptions.ubTAR21_UB;
VAL_SILENT_UB = gGameUBOptions.ubVAL_SILENT_UB;
MICRO_UZI_UB = gGameUBOptions.ubMICRO_UZI_UB;
CALICO_950_UB = gGameUBOptions.ubCALICO_950_UB;
CALICO_900_UB = gGameUBOptions.ubCALICO_900_UB;
}
@@ -1253,12 +1289,14 @@ void HandlePickingUpMorrisInstructionNote( SOLDIERTYPE *pSoldier, INT32 iIndex )
return;
}
/*
//if the note has already been picked up by a new merc, or the not ehas been displayed
if( gJa25SaveStruct.ubMorrisNoteState == MN__PICKED_UP_BY_NEW_MERC ||
gJa25SaveStruct.ubMorrisNoteState == MN__FINISHED )
{
return;
}
*/
bID = RandomSoldierIdFromNewMercsOnPlayerTeam();
+33 -27
View File
@@ -3466,6 +3466,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld )
if (pSoldierOld->bTeam == CIV_TEAM )
{
#ifdef JA2UB
#else
SOLDIERTYPE * pOther;
#endif
@@ -3475,30 +3476,12 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld )
ScreenMsg( FONT_RED, MSG_INTERFACE, pMercDeadString[ 0 ], pSoldierOld->GetName() );
}
#ifdef JA2UB
if ( pSoldierOld->ubProfile == MORRIS_UB )
{
{
INT8 bSoldierID;
//Geta a random soldier ID
bSoldierID = RandomSoldierIdFromNewMercsOnPlayerTeam();
//if there is any
if( bSoldierID != -1 )
{
//say the MORRIS dead quote
TacticalCharacterDialogue( &Menptr[ bSoldierID ], QUOTE_LEARNED_TO_HATE_MERC_1_ON_TEAM_WONT_RENEW );
}
}
}
#endif
switch( pSoldierOld->ubProfile )
{
#ifdef JA2UB
#else //Ja25: none of these characters are in the exp.
#else //Ja25: none of these characters are in the exp.
switch( pSoldierOld->ubProfile )
{
case BRENDA:
SetFactTrue( FACT_BRENDA_DEAD );
{
@@ -3637,20 +3620,43 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld )
HandleNPCDoAction( DOREEN, NPC_ACTION_FREE_KIDS, 0 );
}
break;
#endif
#ifdef JA2UB
#else
// SANDRO - Check if queen bitch is dead
case QUEEN:
// Muhahahahaaa, QUEST COMPLETED! Give us everything!! Exp, glory, fame!
EndQuest( QUEST_KILL_DEIDRANNA, pSoldierOld->sSectorX, pSoldierOld->sSectorY );
break;
#endif
}
#endif
#ifdef JA2UB
if ( pSoldierOld->ubProfile == MORRIS_UB )
{
{
INT8 bSoldierID;
SOLDIERTYPE * pOther;
pOther = FindSoldierByProfileID( MORRIS_UB, FALSE );
if ( pOther )
{
OBJECTTYPE Object;
CreateItem( MORRIS_INSTRUCTION_NOTE, 100, &Object );
AutoPlaceObject( pOther, &Object, TRUE );
}
//Geta a random soldier ID
bSoldierID = RandomSoldierIdFromNewMercsOnPlayerTeam();
//if there is any
if( bSoldierID != -1 )
{
//say the MORRIS dead quote
TacticalCharacterDialogue( &Menptr[ bSoldierID ], QUOTE_LEARNED_TO_HATE_MERC_1_ON_TEAM_WONT_RENEW );
}
}
}
// Ja25no queen
#else
// Are we looking at the queen?