diff --git a/GameInitOptionsScreen.cpp b/GameInitOptionsScreen.cpp index fca5cc4a..cab717b4 100644 --- a/GameInitOptionsScreen.cpp +++ b/GameInitOptionsScreen.cpp @@ -633,7 +633,7 @@ UINT32 GameInitOptionsScreenInit( void ) // Max. IMP Characters UINT8 maxIMPCharacterCount = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_MAX_IMP_CHARACTERS, 1); - gGameOptions.ubMaxIMPCharacters = min( (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount), ( max( 1, maxIMPCharacterCount) )); + gGameOptions.ubMaxIMPCharacters = min( gGameExternalOptions.iMaxIMPCharacters, ( max( 1, maxIMPCharacterCount) )); // Progress Speed of Item Choices (Default: Normal) gGameOptions.ubProgressSpeedOfItemsChoices = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_PROGRESS_SPEED_OF_ITEM_CHOICES, ITEM_PROGRESS_NORMAL); @@ -1767,7 +1767,7 @@ void BtnGIOIMPNumberSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { - if ( iCurrentIMPNumberSetting < (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount) ) + if ( iCurrentIMPNumberSetting < gGameExternalOptions.iMaxIMPCharacters ) { PlayButtonSound( giGIOIMPNumberButton[1], BUTTON_SOUND_CLICKED_ON ); @@ -1783,7 +1783,7 @@ void BtnGIOIMPNumberSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) { btn->uiFlags|=(BUTTON_CLICKED_ON); - if ( iCurrentIMPNumberSetting < (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount) ) + if ( iCurrentIMPNumberSetting < gGameExternalOptions.iMaxIMPCharacters ) { PlayButtonSound( giGIOIMPNumberButton[1], BUTTON_SOUND_CLICKED_ON ); @@ -3093,7 +3093,7 @@ void DoneFadeOutForExitGameInitOptionScreen( void ) gGameExternalOptions.ubGameMaximumNumberOfPlayerMercs = gGameOptions.ubSquadSize;*/ // SANDRO - added following: - gGameOptions.ubMaxIMPCharacters = min( (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount), ( max( 1, iCurrentIMPNumberSetting) )); + gGameOptions.ubMaxIMPCharacters = min( gGameExternalOptions.iMaxIMPCharacters, ( max( 1, iCurrentIMPNumberSetting) )); gGameOptions.fNewTraitSystem = GetCurrentTraitsOptionButtonSetting(); gGameUBOptions.fTexAndJohn = GetCurrentTexAndJohnButtonSetting(); @@ -3706,7 +3706,7 @@ UINT32 GameInitOptionsScreenInit( void ) // Max. IMP Characters UINT8 maxIMPCharacterCount = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_MAX_IMP_CHARACTERS, 1); - gGameOptions.ubMaxIMPCharacters = min( (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount), ( max( 1, maxIMPCharacterCount) )); + gGameOptions.ubMaxIMPCharacters = min( gGameExternalOptions.iMaxIMPCharacters, ( max( 1, maxIMPCharacterCount) )); // Progress Speed of Item Choices (Default: Normal) gGameOptions.ubProgressSpeedOfItemsChoices = (UINT8)props.getIntProperty(JA2SP_INI_INITIAL_SECTION, JA2SP_PROGRESS_SPEED_OF_ITEM_CHOICES, ITEM_PROGRESS_NORMAL); @@ -4832,7 +4832,7 @@ void BtnGIOIMPNumberSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { - if ( iCurrentIMPNumberSetting < (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount) ) + if ( iCurrentIMPNumberSetting < gGameExternalOptions.iMaxIMPCharacters ) { PlayButtonSound( giGIOIMPNumberButton[1], BUTTON_SOUND_CLICKED_ON ); @@ -4848,7 +4848,7 @@ void BtnGIOIMPNumberSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) { btn->uiFlags|=(BUTTON_CLICKED_ON); - if ( iCurrentIMPNumberSetting < (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount) ) + if ( iCurrentIMPNumberSetting < gGameExternalOptions.iMaxIMPCharacters ) { PlayButtonSound( giGIOIMPNumberButton[1], BUTTON_SOUND_CLICKED_ON ); @@ -6104,10 +6104,9 @@ void DoneFadeOutForExitGameInitOptionScreen( void ) gGameOptions.ubSquadSize = 10; break; } - - + // SANDRO - added following: - gGameOptions.ubMaxIMPCharacters = min( (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount), ( max( 1, iCurrentIMPNumberSetting) )); + gGameOptions.ubMaxIMPCharacters = min( gGameExternalOptions.iMaxIMPCharacters, ( max( 1, iCurrentIMPNumberSetting) )); gGameOptions.fNewTraitSystem = GetCurrentTraitsOptionButtonSetting(); gGameOptions.fEnemiesDropAllItems = GetCurrentDropAllButtonSetting(); gGameOptions.ubProgressSpeedOfItemsChoices = min( GIO_PROGRESS_VERY_FAST, iCurrentProgressSetting ); diff --git a/GameSettings.cpp b/GameSettings.cpp index e19680fc..83ae803b 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -664,7 +664,7 @@ void InitGameOptions() gGameOptions.ubIronManMode = 0; // following added by SANDRO - gGameOptions.ubMaxIMPCharacters = (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount); + gGameOptions.ubMaxIMPCharacters = gGameExternalOptions.iMaxIMPCharacters; if (gGameExternalOptions.fReadProfileDataFromXML) gGameOptions.fNewTraitSystem = TRUE; @@ -689,9 +689,6 @@ void InitGameOptions() #define FIRST_STANDARD_FEMALE_SLOT 54 -extern INT32 CountFilledIMPSlots( INT8 iSex ); -extern INT32 CountEmptyIMPSlots( INT8 iSex ); - // Snap: Read options from an INI file in the default of custom Data directory void LoadGameExternalOptions() { @@ -743,16 +740,8 @@ void LoadGameExternalOptions() // WDS: Allow flexible numbers of IMPs of each sex // SANDRO - moved to the game itself - //gGameExternalOptions.iMaxIMPCharacters = iniReader.ReadInteger("Recruitment Settings","MAX_IMP_CHARACTERS",1, 1, NUM_PROFILES); - - gGameExternalOptions.iIMPMaleCharacterCount = iniReader.ReadInteger("Recruitment Settings","IMP_MALE_CHARACTER_COUNT", COUNT_STANDARD_MALE_SLOTS, 1, NUM_PROFILES); - gGameExternalOptions.iIMPFemaleCharacterCount = iniReader.ReadInteger("Recruitment Settings","IMP_FEMALE_CHARACTER_COUNT", COUNT_STANDARD_FEMALE_SLOTS, 1, NUM_PROFILES); - if (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount > NUM_PROFILES) - { - gGameExternalOptions.iIMPMaleCharacterCount = COUNT_STANDARD_MALE_SLOTS; - gGameExternalOptions.iIMPFemaleCharacterCount = COUNT_STANDARD_FEMALE_SLOTS; - } - + gGameExternalOptions.iMaxIMPCharacters = iniReader.ReadInteger("Recruitment Settings","MAX_IMP_CHARACTERS",1, 1, NUM_PROFILES); + // // Note: put -1 between male/female slots and -1 at end. This allows everything to be // counted dynamically quite easily. Note that all the code assumes there is AT @@ -761,15 +750,13 @@ void LoadGameExternalOptions() // Because errors in these values can really goof things up we will try to fix up bad // values and use the defaults instead. // - int idx; - char caMaleCountStr [] = "IMP_MALE_%d"; - char caFemaleCountStr [] = "IMP_FEMALE_%d"; + char caIMPCountStr[] = "IMP_%d"; char caCountStr[20]; - gGameExternalOptions.iaIMPSlots = (INT32*)MemAlloc( (gGameExternalOptions.iIMPMaleCharacterCount + gGameExternalOptions.iIMPFemaleCharacterCount + 2) * sizeof( UINT32 ) ); - for (idx = 0; idx < gGameExternalOptions.iIMPMaleCharacterCount; ++idx) + gGameExternalOptions.iaIMPSlots = (INT32*)MemAlloc( (gGameExternalOptions.iMaxIMPCharacters) * sizeof( UINT32 ) ); + for (int idx = 0; idx < gGameExternalOptions.iMaxIMPCharacters; ++idx) { - sprintf( caCountStr, caMaleCountStr, idx+1); + sprintf( caCountStr, caIMPCountStr, idx+1); gGameExternalOptions.iaIMPSlots[idx] = iniReader.ReadInteger("Recruitment Settings",caCountStr, -1, -1, NUM_PROFILES-1); if (gGameExternalOptions.iaIMPSlots[idx] < 0) { @@ -777,32 +764,13 @@ void LoadGameExternalOptions() { gGameExternalOptions.iaIMPSlots[idx] = FIRST_STANDARD_MALE_SLOT+idx; } - else + else if ( idx < COUNT_STANDARD_FEMALE_SLOTS ) { // This is bad so just use the last standard slot # gGameExternalOptions.iaIMPSlots[idx] = FIRST_STANDARD_MALE_SLOT+COUNT_STANDARD_MALE_SLOTS-1; } } } - gGameExternalOptions.iaIMPSlots[gGameExternalOptions.iIMPMaleCharacterCount] = -1; - for (idx = 0; idx < gGameExternalOptions.iIMPFemaleCharacterCount; ++idx) - { - sprintf( caCountStr, caFemaleCountStr, idx+1); - gGameExternalOptions.iaIMPSlots[idx+gGameExternalOptions.iIMPMaleCharacterCount+1] = iniReader.ReadInteger("Recruitment Settings",caCountStr, -1, -1, NUM_PROFILES-1); - if (gGameExternalOptions.iaIMPSlots[idx+gGameExternalOptions.iIMPMaleCharacterCount+1] < 0) - { - if (idx < COUNT_STANDARD_FEMALE_SLOTS) - { - gGameExternalOptions.iaIMPSlots[idx+gGameExternalOptions.iIMPMaleCharacterCount+1] = FIRST_STANDARD_FEMALE_SLOT+idx; - } - else - { - // This is bad so just use the last standard slot # - gGameExternalOptions.iaIMPSlots[idx+gGameExternalOptions.iIMPMaleCharacterCount+1] = FIRST_STANDARD_FEMALE_SLOT+COUNT_STANDARD_FEMALE_SLOTS-1; - } - } - } - gGameExternalOptions.iaIMPSlots[gGameExternalOptions.iIMPFemaleCharacterCount+gGameExternalOptions.iIMPMaleCharacterCount+1] = -1; // silversurfer: read early recruitment options 1=immediately (control Omerta), 2=early (control 1, 2, 3 towns including Omerta) // 3=normal (control 3, 4, 5 towns including Omerta), 4=after liberating Omerta and solving the "Deliver Food Quest" for Miguel diff --git a/GameSettings.h b/GameSettings.h index 776e25f5..bf7157b7 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -285,11 +285,9 @@ typedef struct BOOLEAN fSellAll; INT16 iPriceModifier; - - // WDS: Allow flexible numbers of IMPs of each sex - INT32 iIMPMaleCharacterCount; // Count of how many there are - INT32 iIMPFemaleCharacterCount; - //INT32 iMaxIMPCharacters; // Limit of how many to allow + + // Flugente: max number of IMPs, regardless of gender + INT32 iMaxIMPCharacters; // Limit of how many to allow // // iaIMPSlots is an array of the slots (in prof.dat) to use for IMPs. // diff --git a/Laptop/IMP Begin Screen.cpp b/Laptop/IMP Begin Screen.cpp index 4da8ce57..bd65aed0 100644 --- a/Laptop/IMP Begin Screen.cpp +++ b/Laptop/IMP Begin Screen.cpp @@ -379,23 +379,11 @@ void BtnIMPBeginScreenDoneCallback(GUI_BUTTON *btn,INT32 reason) // check to see if a name has been selected, if not, do not allow player to proceed with more char generation if( ( pFullNameString[ 0 ] != 0) && ( pFullNameString[ 0 ] != L' ' ) && ( bGenderFlag != -1 ) ) { - if (bGenderFlag == IMP_MALE) + if ( CountEmptyIMPSlots() == 0 ) { - if (CountEmptyIMPSlots(MALE) == 0) - { - // You cannot have more than the male max I.M.P characters on your team. - DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 9 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); - bProceed = FALSE; - } - } - else if (bGenderFlag == IMP_FEMALE) - { - if (CountEmptyIMPSlots(FEMALE) == 0) - { - // You cannot have more than the female max I.M.P characters on your team. - DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 9 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); - bProceed = FALSE; - } + // You cannot have more than the max I.M.P characters on your team. + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[9], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL ); + bProceed = FALSE; } } else diff --git a/Laptop/IMP Compile Character.cpp b/Laptop/IMP Compile Character.cpp index b84a9b99..fb55dbbe 100644 --- a/Laptop/IMP Compile Character.cpp +++ b/Laptop/IMP Compile Character.cpp @@ -123,17 +123,8 @@ void CreateACharacterFromPlayerEnteredStats( void ) // ensure that these lists don't get overwritten or Nulled due to the amount // of changes and revisions that have been made to personalities and attitudes. CreatePlayersPersonalitySkillsAndAttitude(); - - // Flugente: as the profile is no longer identical to the voice set, we need to determine a free slot - INT32 impslot = 0; - if ( fCharacterIsMale ) - impslot = GetFirstMaleSlot( ); - else - impslot = GetFirstFemaleSlot( ); - - INT32 impid = gGameExternalOptions.iaIMPSlots[impslot]; - - LaptopSaveInfo.iIMPIndex = GetFreeIMPSlot( impid, -1 ); + + LaptopSaveInfo.iIMPIndex = GetFreeIMPSlot( -1 ); // copy over full name wcscpy( gMercProfiles[ LaptopSaveInfo.iIMPIndex ].zName, pFullName ); diff --git a/Laptop/IMP Confirm.cpp b/Laptop/IMP Confirm.cpp index c95c089d..28b602ad 100644 --- a/Laptop/IMP Confirm.cpp +++ b/Laptop/IMP Confirm.cpp @@ -1511,7 +1511,7 @@ BOOLEAN LoadImpCharacter( STR nickName ) } // Set the ID of the new IMP - iProfileId = GetFreeIMPSlot(iProfileId, iProfileId); + iProfileId = GetFreeIMPSlot(iProfileId); // We can create the new imp, beacuse we found an empty slot if (iProfileId != -1) @@ -1718,8 +1718,7 @@ void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeInd if ( usItem > 0 && (ItemIsLegal(usItem) || Item[usItem].usItemClass == IC_GUN)) { MakeProfileInvItemAnySlot(pProfile,usItem,100,1); - - + // give ammo for guns if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) { @@ -1740,8 +1739,6 @@ void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeInd if (iChoice < 0) iChoice = 0; } - - } // SANDRO - Function to determine actual cost of profile @@ -1753,7 +1750,7 @@ INT32 iGetProfileCost() if (gGameExternalOptions.fDynamicIMPProfileCost) { // silversurfer: When we create an IMP he doesn't occupy a slot yet so we need to add 1 to get the correct price in advance. - INT32 iIMPProfileCost = gGameExternalOptions.iIMPProfileCost * (CountFilledIMPSlots( -1 ) + 1); + INT32 iIMPProfileCost = gGameExternalOptions.iIMPProfileCost * (CountFilledIMPSlots() + 1); if ( iIMPProfileCost + impgearcost >= gGameExternalOptions.iIMPProfileCost ) return iIMPProfileCost + impgearcost; @@ -1761,6 +1758,3 @@ INT32 iGetProfileCost() return gGameExternalOptions.iIMPProfileCost + impgearcost; } - - - diff --git a/Laptop/IMP HomePage.cpp b/Laptop/IMP HomePage.cpp index 8689cf85..cc97c7ce 100644 --- a/Laptop/IMP HomePage.cpp +++ b/Laptop/IMP HomePage.cpp @@ -408,7 +408,7 @@ void ProcessPlayerInputActivationString( void ) return; } - if (CountFilledIMPSlots(-1) < gGameOptions.ubMaxIMPCharacters) + if (CountFilledIMPSlots() < gGameOptions.ubMaxIMPCharacters) { // Kaiden: Need to reset skills, attributes and personalities with the new UB Method. ResetSkillsAttributesAndPersonality( ); @@ -430,7 +430,7 @@ void ProcessPlayerInputActivationString( void ) return; } - if (CountFilledIMPSlots(-1) < gGameOptions.ubMaxIMPCharacters) + if (CountFilledIMPSlots() < gGameOptions.ubMaxIMPCharacters) { if (LoadImpCharacter( IMP_MERC_FILENAME ) == TRUE) { @@ -456,7 +456,7 @@ void ProcessPlayerInputActivationString( void ) return; } - if (CountFilledIMPSlots(-1) < gGameOptions.ubMaxIMPCharacters) + if (CountFilledIMPSlots() < gGameOptions.ubMaxIMPCharacters) { if (LoadImpCharacter( charPlayerActivationString ) == TRUE) { diff --git a/Laptop/IMP MainPage.cpp b/Laptop/IMP MainPage.cpp index e165c9a5..0fc74ad5 100644 --- a/Laptop/IMP MainPage.cpp +++ b/Laptop/IMP MainPage.cpp @@ -29,7 +29,6 @@ #define MAIN_PAGE_BUTTON_TEXT_WIDTH 95 - #define MAIN_PAGE_SPACE_BTN_BUTTONS 120 #define MAIN_PAGE__FIRST_BUTTON_POS_X ( LAPTOP_SCREEN_UL_X + 15 ) @@ -37,12 +36,10 @@ #define MAIN_PAGE__THIRD_BUTTON_POS_X ( MAIN_PAGE__SECOND_BUTTON_POS_X + MAIN_PAGE_SPACE_BTN_BUTTONS ) #define MAIN_PAGE__FOURTH_BUTTON_POS_X ( MAIN_PAGE__THIRD_BUTTON_POS_X + MAIN_PAGE_SPACE_BTN_BUTTONS ) - // main page buttons INT32 giIMPMainPageButton[6]; INT32 giIMPMainPageButtonImage[6]; - // mouse regions for not entablable warning MOUSE_REGION pIMPMainPageMouseRegions[ 4 ]; @@ -70,7 +67,6 @@ BOOLEAN IMP_CanWeDisplaySpecialtiesGraph( ); BOOLEAN IMP_CanWeDisplayAttributeGraph( ); BOOLEAN IMP_CanWeDisplayPortrait( ); - BOOLEAN CheckIfFinishedCharacterGeneration( void ); // this is the current state of profiling the player is in. @@ -85,171 +81,6 @@ BOOLEAN CheckIfFinishedCharacterGeneration( void ); INT32 iCurrentProfileMode = IMP__REGISTRY; -// Return a count of how many IMP slots there are in total -INT32 CountIMPSlots() -{ - INT32 idx; - // Keep a static count so we only count once - static INT32 iMaxIMPs = -1; - if (iMaxIMPs != -1) - return iMaxIMPs; - - iMaxIMPs = 0; - // Count the males - for (idx = GetFirstMaleSlot(); idx <= GetLastMaleSlot(); ++idx) - { - ++iMaxIMPs; - } - // Count the females - for (idx = GetFirstFemaleSlot(); idx <= GetLastFemaleSlot(); ++idx) - { - ++iMaxIMPs; - } - Assert(iMaxIMPs > 0); - return iMaxIMPs; -} - -INT32 GetFirstSlot(INT8 iSex) -{ - if (iSex == MALE) - return GetFirstMaleSlot(); - else if (iSex == FEMALE) - return GetFirstFemaleSlot(); - else { - return GetFirstMaleSlot(); - } -} - -INT32 GetLastSlot(INT8 iSex) -{ - if (iSex == MALE) - return GetLastMaleSlot(); - else if (iSex == FEMALE) - return GetLastFemaleSlot(); - else { - return GetLastFemaleSlot(); - } -} - -INT32 GetFirstFreeSlot(INT8 iSex) { - INT32 iStart = GetFirstSlot(iSex); - INT32 iEnd = GetLastSlot(iSex); - INT32 idx; - - for (idx = iStart; idx <= iEnd; ++idx) - { - if (IsIMPSlotFree(gGameExternalOptions.iaIMPSlots[idx]) == TRUE) - return idx; - } - return -1; -} - - -// Return a count of how many IMP slots there are for males -INT32 CountMaleIMPSlots() { - INT32 idx; - // Keep a static count so we only count once - static INT32 iMaxMaleIMPS = -1; - if (iMaxMaleIMPS != -1) - return iMaxMaleIMPS; - - iMaxMaleIMPS = 0; - for (idx = GetFirstMaleSlot(); idx <= GetLastMaleSlot(); ++idx) - // Count the males - { - ++iMaxMaleIMPS; - } - Assert(iMaxMaleIMPS > 0); - return iMaxMaleIMPS; -} -INT32 GetFirstMaleSlot() { - Assert(gGameExternalOptions.iaIMPSlots[0] != -1); - return 0; -} -INT32 GetLastMaleSlot() { - // Keep a static count so we only count once - static INT32 idx = -1; - if (idx != -1) - return idx; - - idx = 0; - // Skip the males - while (gGameExternalOptions.iaIMPSlots[idx] != -1) - { - ++idx; - } - --idx; - Assert(idx >= 0); - Assert(gGameExternalOptions.iaIMPSlots[idx] != -1); - return idx; -} - -// Return a count of how many IMP slots there are for females -INT32 CountFemaleIMPSlots() { - INT32 idx; - // Keep a static count so we only count once - static INT32 iMaxFemaleIMPS = -1; - if (iMaxFemaleIMPS != -1) - return iMaxFemaleIMPS; - - iMaxFemaleIMPS = 0; - for (idx = GetFirstFemaleSlot(); idx <= GetLastFemaleSlot(); ++idx) - // Count the males - { - ++iMaxFemaleIMPS; - } - Assert(iMaxFemaleIMPS > 0); - return iMaxFemaleIMPS; -} -INT32 GetFirstFemaleSlot() { - // Keep a static count so we only count once - static INT32 idx = -1; - if (idx != -1) - return idx; - - idx = 0; - // Skip the males - while (gGameExternalOptions.iaIMPSlots[idx] != -1) - { - ++idx; - } - ++idx; - Assert(idx >= 0); - Assert(gGameExternalOptions.iaIMPSlots[idx] != -1); - return idx; -} -INT32 GetLastFemaleSlot() { - // Keep a static count so we only count once - static INT32 idx = -1; - if (idx != -1) - return idx; - - idx = 0; - // Skip the males - while (gGameExternalOptions.iaIMPSlots[idx] != -1) - { - ++idx; - } - ++idx; - // Skip the females - while (gGameExternalOptions.iaIMPSlots[idx] != -1) - { - ++idx; - } - --idx; - Assert(idx >= 0); - Assert(gGameExternalOptions.iaIMPSlots[idx] != -1); - return idx; -} - -INT32 GetVoiceCountFromVoiceSlot(INT32 iSlot) { - if (iSlot <= GetLastMaleSlot()) - return iSlot - GetFirstMaleSlot() + 1; - else - return iSlot - GetFirstFemaleSlot() + 1; -} - - BOOLEAN IsIMPSlotFree(INT32 iIMPId) { if ((iIMPId >= 0) && (iIMPId < NUM_PROFILES) && @@ -264,7 +95,6 @@ BOOLEAN IsIMPSlotFree(INT32 iIMPId) } } - void EnterIMPMainPage( void ) { // turn off review mode @@ -286,7 +116,6 @@ void EnterIMPMainPage( void ) RenderIMPMainPage( ); } - void ExitIMPMainPage( void ) { // exit from IMP About us page @@ -296,7 +125,6 @@ void ExitIMPMainPage( void ) DestoryMouseRegionsForIMPMainPageBasedOnCharGenStatus( ); } - void RenderIMPMainPage( void ) { // rneders the IMP about us page @@ -310,7 +138,6 @@ void RenderIMPMainPage( void ) RenderMainIndentFrame( 164, 74 ); } - void HandleIMPMainPage( void ) { // handles the IMP about main page @@ -855,8 +682,6 @@ void UpDateIMPMainPageButtons( void ) */ break; } - - return; } void BeginMessageBoxCallBack( UINT8 bExitValue ) @@ -865,22 +690,20 @@ void BeginMessageBoxCallBack( UINT8 bExitValue ) if( bExitValue == MSG_BOX_RETURN_YES ) { iCurrentImpPage = IMP_BEGIN; - iCurrentProfileMode = IMP__REGISTRY; + iCurrentProfileMode = IMP__REGISTRY; } - else if( bExitValue == MSG_BOX_RETURN_OK ) { // if ok, then we are coming from financial warning, allow continue } + return; } - void CreateMouseRegionsForIMPMainPageBasedOnCharGenStatus( void ) { // this procedure will create masks for the char generation main page - - + // mask for personality page button MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 0 ],LAPTOP_SCREEN_UL_X + 13 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 13 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); @@ -888,16 +711,11 @@ void CreateMouseRegionsForIMPMainPageBasedOnCharGenStatus( void ) // mask for attrib page button MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 1 ],LAPTOP_SCREEN_UL_X + 133 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 133 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); - - - + // mask for portrait page button MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 2 ],LAPTOP_SCREEN_UL_X + 253 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 253 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); - - - - + // mask for voice page button MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 3 ],LAPTOP_SCREEN_UL_X + 373 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 373 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); @@ -908,11 +726,8 @@ void DestoryMouseRegionsForIMPMainPageBasedOnCharGenStatus( void ) // will destroy button masks for the char gen pages MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 0 ]); - MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 1 ]); - MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 2 ]); - MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 3 ]); } @@ -920,8 +735,7 @@ void IMPMainPageNotSelectableBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) { if (iReason & MSYS_CALLBACK_REASON_INIT) { - - return; + return; } if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) @@ -931,18 +745,12 @@ void IMPMainPageNotSelectableBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) } // WDS: Allow flexible numbers of IMPs of each sex -INT32 CountFilledIMPSlots( INT8 iSex ) +INT32 CountFilledIMPSlots() { - INT32 i; INT32 iCount = 0; - INT32 iStart; - INT32 iEnd; - - iStart = GetFirstSlot(iSex); - iEnd = GetLastSlot(iSex); - + // Count the used slots - for (i = iStart; i <= iEnd; ++i) + for ( INT32 i = 0; i < gGameExternalOptions.iMaxIMPCharacters; ++i) { if ((gGameExternalOptions.iaIMPSlots[i] != -1) && (!IsIMPSlotFree(gGameExternalOptions.iaIMPSlots[i]))) @@ -955,18 +763,12 @@ INT32 CountFilledIMPSlots( INT8 iSex ) return iCount; } -INT32 CountEmptyIMPSlots( INT8 iSex ) +INT32 CountEmptyIMPSlots() { - INT32 i; INT32 iCount = 0; - INT32 iStart; - INT32 iEnd; - - iStart = GetFirstSlot(iSex); - iEnd = GetLastSlot(iSex); - + // Count the free slots - for (i = iStart; i <= iEnd; ++i) + for ( INT32 i = 0; i < gGameExternalOptions.iMaxIMPCharacters; ++i) { if (IsIMPSlotFree(gGameExternalOptions.iaIMPSlots[i])) { @@ -978,75 +780,26 @@ INT32 CountEmptyIMPSlots( INT8 iSex ) return iCount; } - -INT32 GetSexOfIMP(INT32 iIMPId) +INT32 GetFreeIMPSlot(INT32 iDefaultIMPId) { - INT32 ui; - //CHRISL: There is "padding" build into the iaIMPSLots array. The index after the last male and female entry are both set - // to -1. The following loop, however, does not take this into consideration. A female IMP using iIMPId 56 will never - // get setup correctly, resulting in the "Assert(FALSE)" the occurs after the loop. Since the array is initially setup - // by adding 2 to the male/female totals, do the same here. - //for (ui = 0; ui < CountIMPSlots(); ++ui) - for (ui = 0; ui < CountIMPSlots()+2; ++ui) + // We have a default imp id (90210 or nickname) + if (iDefaultIMPId != -1) { - if (gGameExternalOptions.iaIMPSlots[ui] == iIMPId) + if (IsIMPSlotFree(iDefaultIMPId)) { - if (ui <= GetLastMaleSlot()) - return MALE; - else - return FEMALE; + return iDefaultIMPId; } } - Assert(FALSE); - return MALE; -} + // The default IMP id is already used, find next free imp id -INT32 GetFreeIMPSlot(INT32 iIMPId, INT32 iDefaultIMPId) -{ - INT32 iStart; - INT32 iEnd; - INT32 i; - - UINT32 iSex = GetSexOfIMP(iIMPId); - - if (iIMPId != -1) + // Find a free imp slot + for (INT32 i = 0; i < gGameExternalOptions.iMaxIMPCharacters; ++i) { - // We have a default imp id (90210 or nickname) - if (iDefaultIMPId != -1) + // Found a free imp slot + if (IsIMPSlotFree(gGameExternalOptions.iaIMPSlots[i])) { - if (IsIMPSlotFree(iDefaultIMPId)) - { - return iDefaultIMPId; - } - } - - // The default IMP id is already used, find next free imp id - // Female - if (iSex == FEMALE) - { - iStart = GetFirstFemaleSlot(); - iEnd = GetLastFemaleSlot(); - } - else if (iSex == MALE) - { - iStart = GetFirstMaleSlot(); - iEnd = GetLastMaleSlot(); - } - else - { - AssertMsg( 0, "Merc neither male nor female"); - return -1; - } - - // Find a free imp slot - for (i = iStart; i <= iEnd; ++i) - { - // Found a free imp slot - if (IsIMPSlotFree(gGameExternalOptions.iaIMPSlots[i])) - { - return gGameExternalOptions.iaIMPSlots[i]; - } + return gGameExternalOptions.iaIMPSlots[i]; } } diff --git a/Laptop/IMP MainPage.h b/Laptop/IMP MainPage.h index 6e9f7f0d..c783e801 100644 --- a/Laptop/IMP MainPage.h +++ b/Laptop/IMP MainPage.h @@ -8,39 +8,16 @@ void EnterIMPMainPage( void ); void HandleIMPMainPage( void ); void NextProfilingMode( void ); void ShadeUnSelectableButtons( void ); + BOOLEAN IsIMPSlotFree(INT32 iIMPId); +INT32 GetFreeIMPSlot(INT32 iDefaultIMPId); -INT32 GetFreeIMPSlot(INT32 iIMPId, INT32 iDefaultIMPId); - -// WDS: Allow flexible numbers of IMPs of each sex -INT32 CountFilledIMPSlots( INT8 iSex ); -INT32 CountEmptyIMPSlots( INT8 iSex ); - -// Return a count of how many IMP slots there are -INT32 CountIMPSlots(); -INT32 CountMaleIMPSlots(); -INT32 CountFemaleIMPSlots(); - -// Get the first/last slots -INT32 GetFirstSlot(INT8 iSex); -INT32 GetLastSlot(INT8 iSex); -INT32 GetFirstFreeSlot(INT8 iSex); -INT32 GetFirstMaleSlot(); -INT32 GetLastMaleSlot(); -INT32 GetFirstFemaleSlot(); -INT32 GetLastFemaleSlot(); - -// This returns a count of how any slots along we are in the potential -// slot list. Usable for displaying on the "Voice" button in the interface -// and probably not much else. -INT32 GetVoiceCountFromVoiceSlot(INT32 iSlot); - -// Given an IMP slot # (0 to NUM_PROFILES-1) return MALE or FEMALE -INT32 GetSexOfIMP(INT32 iIMPId); +// WDS: Allow flexible numbers of IMPs +INT32 CountFilledIMPSlots(); +INT32 CountEmptyIMPSlots(); extern INT32 iCurrentProfileMode; - //enums for the various Profile modes enum { @@ -52,5 +29,4 @@ enum IMP__FINISH, }; - #endif \ No newline at end of file