Mercurial > mm7
comparison Player.cpp @ 290:4776715a964b
StatTable
author | Ritor1 |
---|---|
date | Mon, 18 Feb 2013 20:47:41 +0600 |
parents | 92d443ed0cba |
children | 055cea8660e5 2503214e5258 |
comparison
equal
deleted
inserted
replaced
289:92d443ed0cba | 290:4776715a964b |
---|---|
29 | 29 |
30 | 30 |
31 | 31 |
32 /* 381 */ | 32 /* 381 */ |
33 #pragma pack(push, 1) | 33 #pragma pack(push, 1) |
34 struct PlayerCreation_AttributeProp | 34 struct PlayerCreation_AttributeProps |
35 { | 35 { |
36 unsigned __int8 uBaseValue; | 36 unsigned __int8 uBaseValue; |
37 char uMaxValue; | 37 char uMaxValue; |
38 char uDroppedStep; | 38 char uDroppedStep; |
39 char uBaseStep; | 39 char uBaseStep; |
40 }; | 40 }; |
41 #pragma pack(pop) | 41 #pragma pack(pop) |
42 | 42 |
43 | 43 |
44 #pragma pack(push, 1) | 44 #pragma pack(push, 1) |
45 struct PlayerCreation_AttributePropsByRace | 45 |
46 { | 46 |
47 PlayerCreation_AttributeProp attr[7]; | 47 |
48 }; | |
49 | |
50 struct PlayerCreation_AttributeProps | |
51 { | |
52 union | |
53 { | |
54 unsigned __int8 _[4][7][4]; | |
55 PlayerCreation_AttributePropsByRace race[4]; | |
56 }; | |
57 }; | |
58 #pragma pack(pop) | 48 #pragma pack(pop) |
59 PlayerCreation_AttributeProps stru_4ED7B0 = | 49 PlayerCreation_AttributeProps StatTable[4][7] = //0x4ED7B0 |
60 { | 50 { |
61 11, 25, 1, 1, 11, 25, 1, 1, 11, 25, 1, 1, 9, 25, 1, 1, 11, 25, 1, 1, 11, 25, 1, 1, 9, 25, 1, 1, | 51 {{11, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, { 9, 25, 1, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {9, 25, 1, 1},}, |
62 7, 15, 2, 1, 14, 30, 1, 2, 11, 25, 1, 1, 7, 15, 2, 1, 14, 30, 1, 2, 11, 25, 1, 1, 9, 20, 1, 1, | 52 {{ 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, { 7, 15, 2, 1}, {14, 30, 1, 2}, {11, 25, 1, 1}, {9, 20, 1, 1},}, |
63 14, 30, 1, 2, 7, 15, 2, 1, 7, 15, 2, 1, 11, 25, 1, 1, 11, 25, 1, 1, 14, 30, 1, 2, 9, 20, 1, 1, | 53 {{14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, {9, 20, 1, 1},}, |
64 14, 30, 1, 2, 11, 25, 1, 1, 11, 25, 1, 1, 14, 30, 1, 2, 7, 15, 2, 1, 7, 15, 2, 1, 9, 20, 1, 1 | 54 {{14, 30, 1, 2}, {11, 25, 1, 1}, {11, 25, 1, 1}, {14, 30, 1, 2}, { 7, 15, 2, 1}, { 7, 15, 2, 1}, {9, 20, 1, 1}} |
65 }; | 55 }; |
66 | 56 |
67 | 57 |
68 | 58 |
69 | 59 |
171 else | 161 else |
172 { | 162 { |
173 v0 = pParty->pPlayers[v1].uMight; | 163 v0 = pParty->pPlayers[v1].uMight; |
174 } | 164 } |
175 v3 = v2 + v9; | 165 v3 = v2 + v9; |
176 v4 = stru_4ED7B0.race[0].attr[v3].uBaseValue; | 166 v4 = StatTable[0][v3].uBaseValue; |
177 if ( v0 >= v4 ) | 167 if ( v0 >= v4 ) |
178 { | 168 { |
179 v5 = stru_4ED7B0.race[0].attr[v3].uDroppedStep; | 169 v5 = StatTable[0][v3].uDroppedStep; |
180 v6 = stru_4ED7B0.race[0].attr[v3].uBaseStep; | 170 v6 = StatTable[0][v3].uBaseStep; |
181 } | 171 } |
182 else | 172 else |
183 { | 173 { |
184 v5 = stru_4ED7B0.race[0].attr[v3].uBaseStep; | 174 v5 = StatTable[0][v3].uBaseStep; |
185 v6 = stru_4ED7B0.race[0].attr[v3].uDroppedStep; | 175 v6 = StatTable[0][v3].uDroppedStep; |
186 } | 176 } |
187 v8 += v5 * (v4 - v0) / v6; | 177 v8 += v5 * (v4 - v0) / v6; |
188 ++v9; | 178 ++v9; |
189 } | 179 } |
190 while ( v9 <= 6 ); | 180 while ( v9 <= 6 ); |
6447 | 6437 |
6448 //----- (00490188) -------------------------------------------------------- | 6438 //----- (00490188) -------------------------------------------------------- |
6449 void Player::SetInitialStats() | 6439 void Player::SetInitialStats() |
6450 { | 6440 { |
6451 auto v1 = GetRace(); | 6441 auto v1 = GetRace(); |
6452 uMight = stru_4ED7B0.race[v1].attr[0].uBaseValue; | 6442 uMight = StatTable[v1][0].uBaseValue; |
6453 uIntelligence = stru_4ED7B0.race[v1].attr[1].uBaseValue; | 6443 uIntelligence = StatTable[v1][1].uBaseValue; |
6454 uWillpower = stru_4ED7B0.race[v1].attr[2].uBaseValue; | 6444 uWillpower = StatTable[v1][2].uBaseValue; |
6455 uEndurance = stru_4ED7B0.race[v1].attr[3].uBaseValue; | 6445 uEndurance = StatTable[v1][3].uBaseValue; |
6456 uAccuracy = stru_4ED7B0.race[v1].attr[4].uBaseValue; | 6446 uAccuracy = StatTable[v1][4].uBaseValue; |
6457 uSpeed = stru_4ED7B0.race[v1].attr[5].uBaseValue; | 6447 uSpeed = StatTable[v1][5].uBaseValue; |
6458 uLuck = stru_4ED7B0.race[v1].attr[6].uBaseValue; | 6448 uLuck = StatTable[v1][6].uBaseValue; |
6459 } | 6449 } |
6460 | 6450 |
6461 //----- (004901FC) -------------------------------------------------------- | 6451 //----- (004901FC) -------------------------------------------------------- |
6462 int Player::SetSexByVoice() | 6452 int Player::SetSexByVoice() |
6463 { | 6453 { |
6636 int pStep; // esi@1 | 6626 int pStep; // esi@1 |
6637 unsigned __int16 result; // ax@7 | 6627 unsigned __int16 result; // ax@7 |
6638 int uMinValue; // [sp+Ch] [bp-4h]@1 | 6628 int uMinValue; // [sp+Ch] [bp-4h]@1 |
6639 | 6629 |
6640 v2 = eAttribute + 7 * GetRace(); | 6630 v2 = eAttribute + 7 * GetRace(); |
6641 pBaseValue = stru_4ED7B0.race[0].attr[v2].uBaseValue; | 6631 pBaseValue = StatTable[0][v2].uBaseValue; |
6642 pDroppedStep = stru_4ED7B0.race[0].attr[v2].uDroppedStep; | 6632 pDroppedStep = StatTable[0][v2].uDroppedStep; |
6643 uMinValue = pBaseValue - 2; | 6633 uMinValue = pBaseValue - 2; |
6644 pStep = stru_4ED7B0.race[0].attr[v2].uBaseStep; | 6634 pStep = StatTable[0][v2].uBaseStep; |
6645 switch ( eAttribute ) | 6635 switch ( eAttribute ) |
6646 { | 6636 { |
6647 case CHARACTER_MIGHT: | 6637 case CHARACTER_MIGHT: |
6648 if ( this->uMight <= pBaseValue ) | 6638 if ( this->uMight <= pBaseValue ) |
6649 pStep = pDroppedStep; | 6639 pStep = pDroppedStep; |
6703 int v9; // [sp+Ch] [bp-8h]@1 | 6693 int v9; // [sp+Ch] [bp-8h]@1 |
6704 signed int v10; // [sp+10h] [bp-4h]@1 | 6694 signed int v10; // [sp+10h] [bp-4h]@1 |
6705 | 6695 |
6706 v2 = this; | 6696 v2 = this; |
6707 v3 = eAttribute + 7 * GetRace(); | 6697 v3 = eAttribute + 7 * GetRace(); |
6708 v4 = stru_4ED7B0.race[0].attr[v3].uMaxValue; | 6698 v4 = StatTable[0][v3].uMaxValue; |
6709 v5 = stru_4ED7B0.race[0].attr[v3].uBaseStep; | 6699 v5 = StatTable[0][v3].uBaseStep; |
6710 v9 = stru_4ED7B0.race[0].attr[v3].uBaseValue; | 6700 v9 = StatTable[0][v3].uBaseValue; |
6711 v10 = stru_4ED7B0.race[0].attr[v3].uDroppedStep; | 6701 v10 = StatTable[0][v3].uDroppedStep; |
6712 PlayerCreation_ComputeAttributeBonus(); | 6702 PlayerCreation_ComputeAttributeBonus(); |
6713 if ( eAttribute ) | 6703 if ( eAttribute ) |
6714 { | 6704 { |
6715 switch ( eAttribute ) | 6705 switch ( eAttribute ) |
6716 { | 6706 { |
6828 } | 6818 } |
6829 | 6819 |
6830 //----- (004907E7) -------------------------------------------------------- | 6820 //----- (004907E7) -------------------------------------------------------- |
6831 __int16 Player::GetStatColor(unsigned int uStat) | 6821 __int16 Player::GetStatColor(unsigned int uStat) |
6832 { | 6822 { |
6833 Player *v2; // edi@1 | |
6834 __int16 uWhite; // si@1 | 6823 __int16 uWhite; // si@1 |
6835 // int uStartingHP; // eax@1 | 6824 int attribute_value; // edx@1 |
6836 int v5; // edx@1 | |
6837 // unsigned __int8 v6; // zf@1 | |
6838 // char v7; // sf@1 | |
6839 unsigned __int8 v8; // of@1 | 6825 unsigned __int8 v8; // of@1 |
6840 __int16 result; // ax@2 | |
6841 __int16 uGreen; // [sp+8h] [bp-8h]@1 | 6826 __int16 uGreen; // [sp+8h] [bp-8h]@1 |
6842 __int16 uRed; // [sp+Ch] [bp-4h]@1 | 6827 __int16 uRed; // [sp+Ch] [bp-4h]@1 |
6843 | 6828 |
6844 v2 = this; | |
6845 uRed = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x23u, 0); | 6829 uRed = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x23u, 0); |
6846 uGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); | 6830 uGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); |
6847 uWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | 6831 uWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); |
6848 v8 = stru_4ED7B0.race[GetRace()].attr[uStat].uBaseValue; | 6832 v8 = StatTable[GetRace()][uStat].uBaseValue; |
6849 | 6833 |
6850 int attribute_value = 0; | |
6851 switch (uStat) | 6834 switch (uStat) |
6852 { | 6835 { |
6853 case 0: attribute_value = uMight; break; | 6836 case 0: attribute_value = uMight; break; |
6854 case 1: attribute_value = uIntelligence; break; | 6837 case 1: attribute_value = uIntelligence; break; |
6855 case 2: attribute_value = uWillpower; break; | 6838 case 2: attribute_value = uWillpower; break; |
6856 case 3: attribute_value = uEndurance; break; | 6839 case 3: attribute_value = uEndurance; break; |
6857 case 4: attribute_value = uSpeed; break; | 6840 case 4: attribute_value = uAccuracy; break; |
6858 case 5: attribute_value = uAccuracy; break; | 6841 case 5: attribute_value = uSpeed; break; |
6859 case 6: attribute_value = uLuck; break; | 6842 case 6: attribute_value = uLuck; break; |
6860 }; | 6843 }; |
6861 | 6844 |
6862 v5 = attribute_value; | 6845 if ( attribute_value == v8 ) |
6863 if ( v5 >= v8 ) | 6846 return uWhite; |
6864 { | 6847 else if ( attribute_value > v8 ) |
6865 result = uGreen; | 6848 return uGreen; |
6866 if ( v5 == v8 ) | |
6867 result = uWhite; | |
6868 } | |
6869 else | 6849 else |
6870 { | 6850 return uRed; |
6871 result = uRed; | |
6872 } | |
6873 return result; | |
6874 } | 6851 } |
6875 | 6852 |
6876 //----- (004908A8) -------------------------------------------------------- | 6853 //----- (004908A8) -------------------------------------------------------- |
6877 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) | 6854 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) |
6878 { | 6855 { |