Mercurial > mm7
comparison Player.cpp @ 1554:e303d8a9bcdc
Merge
author | Grumpy7 |
---|---|
date | Sat, 07 Sep 2013 21:14:48 +0200 |
parents | b98812ead5d9 c4ab816fcc5e |
children | 9c4cf5b07e98 |
comparison
equal
deleted
inserted
replaced
1553:b98812ead5d9 | 1554:e303d8a9bcdc |
---|---|
1 #ifdef _MSC_VER | 1 #ifdef _MSC_VER |
2 #define _CRT_SECURE_NO_WARNINGS | 2 #define _CRT_SECURE_NO_WARNINGS |
3 #endif | 3 #endif |
4 | 4 |
5 #include <assert.h> | |
6 | |
7 #include "stru6.h" | 5 #include "stru6.h" |
8 | |
9 | 6 |
10 #include "Player.h" | 7 #include "Player.h" |
11 #include "PlayerFrameTable.h" | 8 #include "PlayerFrameTable.h" |
12 #include "AudioPlayer.h" | 9 #include "AudioPlayer.h" |
13 #include "Party.h" | 10 #include "Party.h" |
341 | 338 |
342 //----- (004B8142) -------------------------------------------------------- | 339 //----- (004B8142) -------------------------------------------------------- |
343 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) | 340 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) |
344 { | 341 { |
345 uint price = (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100); | 342 uint price = (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100); |
346 assert (price > 0); | 343 Assert (price > 0); |
347 | 344 |
348 if (price < uRealValue) | 345 if (price < uRealValue) |
349 price = uRealValue; | 346 price = uRealValue; |
350 return price; | 347 return price; |
351 } | 348 } |
648 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 77)); | 645 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 77)); |
649 case 0x23u: | 646 case 0x23u: |
650 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 79)); | 647 return(_449B57_test_bit((unsigned __int8 *)this->_achieved_awards_bits, 79)); |
651 break; | 648 break; |
652 default: | 649 default: |
653 assert("Should not be able to get here" && false); | 650 Error("Should not be able to get here (%u)", uClass); |
654 break; | 651 break; |
655 } | 652 } |
656 return false; | 653 return false; |
657 } | 654 } |
658 } | 655 } |
811 if ( !areWeLoadingTexture ) | 808 if ( !areWeLoadingTexture ) |
812 { | 809 { |
813 texture->Release(); | 810 texture->Release(); |
814 pIcons_LOD->SyncLoadedFilesCount(); | 811 pIcons_LOD->SyncLoadedFilesCount(); |
815 } | 812 } |
816 if ( slotHeight == 0 || slotWidth == 0) | 813 |
817 { | 814 assert("Items should have nonzero dimensions"); |
818 assert("Items should have nonzero dimensions" && false); | |
819 return 1; | |
820 } | |
821 if ( (slotWidth + uSlot % INVETORYSLOTSWIDTH) <= INVETORYSLOTSWIDTH && (slotHeight + uSlot / INVETORYSLOTSWIDTH) <= INVETORYSLOTSHEIGHT ) | 815 if ( (slotWidth + uSlot % INVETORYSLOTSWIDTH) <= INVETORYSLOTSWIDTH && (slotHeight + uSlot / INVETORYSLOTSWIDTH) <= INVETORYSLOTSHEIGHT ) |
822 { | 816 { |
823 for (unsigned int x = 0; x < slotWidth; x++) | 817 for (unsigned int x = 0; x < slotWidth; x++) |
824 { | 818 { |
825 for (unsigned int y = 0; y < slotHeight; y++) | 819 for (unsigned int y = 0; y < slotHeight; y++) |
1076 return 5; | 1070 return 5; |
1077 if ( !(equipType == EQUIP_REAGENT || equipType == EQUIP_POTION || equipType == EQUIP_MESSAGE_SCROLL)) | 1071 if ( !(equipType == EQUIP_REAGENT || equipType == EQUIP_POTION || equipType == EQUIP_MESSAGE_SCROLL)) |
1078 return 4; | 1072 return 4; |
1079 break; | 1073 break; |
1080 default: | 1074 default: |
1081 assert(false); | 1075 Error("(%u)", building_type); |
1082 break; | 1076 break; |
1083 } | 1077 } |
1084 if (pItem->Stolen()) | 1078 if (pItem->Stolen()) |
1085 return 6; | 1079 return 6; |
1086 | 1080 |
1101 break; | 1095 break; |
1102 case 5: | 1096 case 5: |
1103 price = this->GetPriceRepair(itemValue, multiplier); | 1097 price = this->GetPriceRepair(itemValue, multiplier); |
1104 break; | 1098 break; |
1105 default: | 1099 default: |
1106 assert(false); | 1100 Assert("(%u)", ShopMenuType); |
1107 break; | 1101 break; |
1108 } | 1102 } |
1109 if ( merchantLevel ) | 1103 if ( merchantLevel ) |
1110 { | 1104 { |
1111 if (price == itemValue) | 1105 if (price == itemValue) |
2834 armour_recovery_multipliers[2] = 0.5f; | 2828 armour_recovery_multipliers[2] = 0.5f; |
2835 armour_recovery_multipliers[3] = 0; | 2829 armour_recovery_multipliers[3] = 0; |
2836 } | 2830 } |
2837 else | 2831 else |
2838 { | 2832 { |
2839 assert(false && "Unknown armour type"); // what kind of armour is that? | 2833 Error("Unknown armour type"); // what kind of armour is that? |
2840 armour_recovery_multipliers[0] = 1.0f; | 2834 armour_recovery_multipliers[0] = 1.0f; |
2841 armour_recovery_multipliers[1] = 1.0f; | 2835 armour_recovery_multipliers[1] = 1.0f; |
2842 armour_recovery_multipliers[2] = 1.0f; | 2836 armour_recovery_multipliers[2] = 1.0f; |
2843 armour_recovery_multipliers[3] = 1.0f; | 2837 armour_recovery_multipliers[3] = 1.0f; |
2844 } | 2838 } |
3228 } | 3222 } |
3229 | 3223 |
3230 //----- (0048E96A) -------------------------------------------------------- | 3224 //----- (0048E96A) -------------------------------------------------------- |
3231 void Player::SetRecoveryTime(signed int rec) | 3225 void Player::SetRecoveryTime(signed int rec) |
3232 { | 3226 { |
3233 assert(rec >= 0); | 3227 Assert(rec >= 0); |
3234 | 3228 |
3235 if (rec > uTimeToRecovery) | 3229 if (rec > uTimeToRecovery) |
3236 uTimeToRecovery = rec; | 3230 uTimeToRecovery = rec; |
3237 | 3231 |
3238 if (pPlayers[uActiveCharacter] == this && !some_active_character) | 3232 if (pPlayers[uActiveCharacter] == this && !some_active_character) |
4675 case 1: return mult1; | 4669 case 1: return mult1; |
4676 case 2: return mult2; | 4670 case 2: return mult2; |
4677 case 3: return mult3; | 4671 case 3: return mult3; |
4678 case 4: return mult4; | 4672 case 4: return mult4; |
4679 } | 4673 } |
4680 assert(false); | 4674 Error("(%u)", masteryLvl); |
4681 return 0; | 4675 return 0; |
4682 } | 4676 } |
4683 //----- (00490109) -------------------------------------------------------- | 4677 //----- (00490109) -------------------------------------------------------- |
4684 // faces are: 0 1 2 3 human males | 4678 // faces are: 0 1 2 3 human males |
4685 // 4 5 6 7 human females | 4679 // 4 5 6 7 human females |
4758 case 0x13u: | 4752 case 0x13u: |
4759 case 0x15u: | 4753 case 0x15u: |
4760 case 0x18u: | 4754 case 0x18u: |
4761 return SEX_FEMALE; | 4755 return SEX_FEMALE; |
4762 } | 4756 } |
4763 assert(false); | 4757 Error("(%u)", this->uVoiceID); |
4764 return SEX_MALE; | 4758 return SEX_MALE; |
4765 } | 4759 } |
4766 | 4760 |
4767 //----- (00490188) -------------------------------------------------------- | 4761 //----- (00490188) -------------------------------------------------------- |
4768 void Player::SetInitialStats() | 4762 void Player::SetInitialStats() |
5102 statToChange = &this->uSpeed; | 5096 statToChange = &this->uSpeed; |
5103 break; | 5097 break; |
5104 case 6: | 5098 case 6: |
5105 statToChange = &this->uLuck; | 5099 statToChange = &this->uLuck; |
5106 default: | 5100 default: |
5107 assert(false); | 5101 Error("(%u)", eAttribute); |
5108 return; | |
5109 break; | |
5110 } | 5102 } |
5111 if ( *statToChange < baseValue ) | 5103 if ( *statToChange < baseValue ) |
5112 { | 5104 { |
5113 tmp = baseStep; | 5105 tmp = baseStep; |
5114 baseStep = droppedStep; | 5106 baseStep = droppedStep; |
6412 { | 6404 { |
6413 currPlayerId = i - 1; | 6405 currPlayerId = i - 1; |
6414 break; | 6406 break; |
6415 } | 6407 } |
6416 } | 6408 } |
6417 assert(currPlayerId != -1); | 6409 |
6410 Assert(currPlayerId != -1); | |
6418 if ( var_type > VAR_AutoNotes ) | 6411 if ( var_type > VAR_AutoNotes ) |
6419 { | 6412 { |
6420 if ( var_type <= VAR_GoldInBank ) | 6413 if ( var_type <= VAR_GoldInBank ) |
6421 { | 6414 { |
6422 if ( var_type == VAR_GoldInBank ) | 6415 if ( var_type == VAR_GoldInBank ) |
6863 break; | 6856 break; |
6864 case VAR_DarkResistanceBonus: | 6857 case VAR_DarkResistanceBonus: |
6865 this->sResDarkBonus = (unsigned __int8)var_value; | 6858 this->sResDarkBonus = (unsigned __int8)var_value; |
6866 break; | 6859 break; |
6867 case VAR_PhysicalResistanceBonus: | 6860 case VAR_PhysicalResistanceBonus: |
6868 assert("VAR_PhysicalResistanceBonus variable unsupported" && false); | 6861 Assert("VAR_PhysicalResistanceBonus variable unsupported" && false); |
6869 return; | 6862 return; |
6870 break; | 6863 break; |
6871 case VAR_MagicResistanceBonus: | 6864 case VAR_MagicResistanceBonus: |
6872 this->sResMagicBonus = (unsigned __int8)var_value; | 6865 this->sResMagicBonus = (unsigned __int8)var_value; |
6873 break; | 6866 break; |
6874 default: | 6867 default: |
6875 assert("Unexpected var_type" && false); | 6868 Assert("Unexpected var_type: %u", var_type); |
6876 return; | 6869 return; |
6877 break; | 6870 break; |
6878 } | 6871 } |
6879 goto LABEL_111; | 6872 goto LABEL_111; |
6880 } | 6873 } |
7617 case 313: | 7610 case 313: |
7618 result = (bool)pValue; | 7611 result = (bool)pValue; |
7619 pParty->uNumArenaLordWins -= (char)pValue; | 7612 pParty->uNumArenaLordWins -= (char)pValue; |
7620 break; | 7613 break; |
7621 } | 7614 } |
7622 assert(false && "Function not returning any value!"); | 7615 Error("Function not returning any value! (%u)", VarNum); |
7623 } | 7616 } |
7624 else | 7617 else |
7625 { | 7618 { |
7626 if ( (signed int)VarNum >= 123 ) | 7619 if ( (signed int)VarNum >= 123 ) |
7627 { | 7620 { |
8199 //if ( !a1 ) | 8192 //if ( !a1 ) |
8200 //{ | 8193 //{ |
8201 //pPlayers = &::pPlayers[1]; | 8194 //pPlayers = &::pPlayers[1]; |
8202 //v5 = 604; | 8195 //v5 = 604; |
8203 //while ( 1 ) | 8196 //while ( 1 ) |
8204 assert ( a1 > 0 && a1 < 5 ); | 8197 Assert ( a1 > 0 && a1 < 5 ); |
8205 for ( uint i = 1; i < 5; ++i ) | 8198 for ( uint i = 1; i < 5; ++i ) |
8206 { | 8199 { |
8207 //item_flag = Player_has_item(604, *pPlayers, 0); | 8200 //item_flag = Player_has_item(604, *pPlayers, 0); |
8208 if ( !Player_has_item(604, ::pPlayers[i], 0) ) | 8201 if ( !Player_has_item(604, ::pPlayers[i], 0) ) |
8209 return false; | 8202 return false; |