comparison Player.cpp @ 1018:9ac94d00012e

Merge
author Grumpy7
date Tue, 21 May 2013 02:24:31 +0200
parents c45d51b3f4f4 a704435d3285
children 3413ad40cc88
comparison
equal deleted inserted replaced
1017:af20650a052f 1018:9ac94d00012e
110 short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175, 110 short word_4EDFFC[30] = {500, 400, 350, 300, 275, 250, 225, 200, 175,
111 150, 125, 100, 75, 50, 40, 35, 30, 25, 21, 111 150, 125, 100, 75, 50, 40, 35, 30, 25, 21,
112 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0}; 112 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 0};
113 signed int player_stat_bonuses[30] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, 0}; 113 signed int player_stat_bonuses[30] = {30, 25, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, 0};
114 114
115
116 unsigned char pEquipTypeToBodyAnchor[20] = {1, 1, 2, 3, 0, 4, 5, 6, 7, 8, 10, 9, 1, 0, 0, 0, 0, 0, 0, 0};
115 117
116 118
117 unsigned short base_recovery_times_per_weapon_type[12] = 119 unsigned short base_recovery_times_per_weapon_type[12] =
118 { 120 {
119 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill 121 100, // PLAYER_SKILL_STAFF && Unarmed withoud skill
219 return false; 221 return false;
220 } 222 }
221 223
222 224
223 //----- (004BE2DD) -------------------------------------------------------- 225 //----- (004BE2DD) --------------------------------------------------------
224 void Player::SalesProcess(unsigned int a2, int a3, int _2devent_idx) 226 void Player::SalesProcess( unsigned int inventory_idnx, int item_index, int _2devent_idx )
225 { 227 {
226 Player *v4; // edi@1
227 char *v5; // esi@1
228 float v6; // ST04_4@1 228 float v6; // ST04_4@1
229 signed int v7; // eax@1 229 signed int item_value; // eax@1
230 signed int v8; // ebx@1 230 signed int sell_price; // ebx@1
231 231
232 auto a4 = _2devent_idx; 232 item_value =pOwnItems[item_index].GetValue();
233 v4 = this; 233 v6 = p2DEvents[ _2devent_idx - 1].fPriceMultiplier;
234 v5 = (char *)this + 36 * a3; 234 sell_price = GetPriceSell(item_value, v6);
235 v6 = p2DEvents[a4 - 1].fPriceMultiplier; 235 if ( pOwnItems[item_index].Broken() )
236 //v6 = p2DEvents_minus1__20[13 * a4]; 236 sell_price = 1;
237 v7 = ((ItemGen *)(v5 + 532))->GetValue(); 237 if ( sell_price < 1 )
238 v8 = GetPriceSell(v7, v6); 238 sell_price = 1;
239 if ( v5[552] & 2 ) 239 RemoveItemAtInventoryIndex(inventory_idnx);
240 v8 = 1; 240 Party::SetGold(pParty->uNumGold + sell_price);
241 if ( v8 < 1 )
242 v8 = 1;
243 RemoveItemAtInventoryIndex(a2);
244 Party::SetGold(pParty->uNumGold + v8);
245 } 241 }
246 242
247 243
248 244
249 //----- (0043EEF3) -------------------------------------------------------- 245 //----- (0043EEF3) --------------------------------------------------------
250 bool Player::_43EEF3() 246 bool Player::_43EEF3()
251 { 247 {
252 signed int v1; // esi@1 248 signed int item_idx; // esi@1
253 PlayerEquipment *v2; // edx@1 249 signed int item_id; // esi@1
254 bool result; // eax@2 250 for (int i=0; i<16;++i)
255 251 {
256 v1 = 0; 252 item_idx=pEquipment.pIndices[i];
257 v2 = &this->pEquipment; 253 if (item_idx)
258 while ( 1 ) 254 {
259 { 255 item_id=pOwnItems[item_idx-1].uItemID;
260 result = v2->uShield; 256 if (item_id!=64 && item_id!= 65 ) //blaster& blaster rifle
261 if ( v2->uShield ) 257 return false;
262 { 258 }
263 result = *(int *)&this->pInventoryItems[result-1]; 259 }
264 if ( result ) 260 return true;
265 { 261 }
266 if ( result != 64 && result != 65 ) 262
267 break;
268 }
269 }
270 ++v1;
271 v2 = (PlayerEquipment *)((char *)v2 + 4);
272 if ( v1 >= 16 )
273 {
274 LOBYTE(result) = 1;
275 return result;
276 }
277 }
278 LOBYTE(result) = 0;
279 return result;
280 }
281 263
282 264
283 265
284 //----- (004B8040) -------------------------------------------------------- 266 //----- (004B8040) --------------------------------------------------------
285 int Player::_4B8040_condition_time(unsigned int uCondition) 267 int Player::_4B8040_condition_time(unsigned int uCondition)
455 signed int v2; // eax@1 437 signed int v2; // eax@1
456 char v3; // zf@4 438 char v3; // zf@4
457 439
458 v1 = this; 440 v1 = this;
459 v2 = (signed int)window_SpeakInHouse->ptr_1C; 441 v2 = (signed int)window_SpeakInHouse->ptr_1C;
460 if ( v2 == 78 || v2 > 80 && v2 <= 82 ) 442 if ( (v2 == 78 || v2 > 80) && v2 <= 82 )
461 { 443 {
462 if ( GetMajorConditionIdx() == 18 ) 444 if ( GetMajorConditionIdx() == 18 )
463 goto LABEL_6; 445 goto LABEL_6;
464 v3 = GetMajorConditionIdx() == 17; 446 v3 = GetMajorConditionIdx() == 17;
465 } 447 }
476 } 458 }
477 459
478 460
479 461
480 //----- (00421E75) -------------------------------------------------------- 462 //----- (00421E75) --------------------------------------------------------
481 unsigned int Player::GetItemIDAtInventoryIndex(int *a2) 463 unsigned int Player::GetItemIDAtInventoryIndex(int *pitem_index)
482 { 464 {
483 int v2; // eax@1 465 int item_idx; // eax@1
484 unsigned int result; // eax@3 466 int inv_index; // eax@3
485 467
486 v2 = *a2; 468 item_idx = *pitem_index;
487 if ( *a2 >= 126 || v2 < 0 ) 469 if ( item_idx >125 || item_idx < 0 )
488 { 470 {
489 result = 0; 471 return 0;
490 } 472 }
491 else 473
492 { 474 inv_index = this->pInventoryIndices[item_idx];
493 result = this->pInventoryIndices[v2]; 475 if ( inv_index < 0 )
494 if ( (result & 0x80000000u) != 0 ) 476 {
495 { 477 *pitem_index = -1 - inv_index;
496 *a2 = -1 - result; 478 inv_index = this->pInventoryIndices[-1 - inv_index];
497 result = this->pInventoryIndices[-1 - result]; 479 }
498 } 480
499 } 481 return inv_index;
500 return result;
501 } 482 }
502 483
503 484
504 485
505 //----- (004160CA) -------------------------------------------------------- 486 //----- (004160CA) --------------------------------------------------------
506 char Player::_4160CA(int a2) 487 void Player::ItemsEnchant( int enchant_count )
507 { 488 {
508 Player *v2; // esi@1 489 int avalible_items; // ebx@1
509 signed int v3; // edx@1 490 int i; // edx@8
510 signed int v4; // ebx@1 491 __int16 item_index_tabl[138]; // [sp+Ch] [bp-118h]@1
511 ItemGen *v5; // eax@1 492
512 int v6; // edi@2 493 avalible_items = 0;
513 signed int i; // edx@8 494 memset (item_index_tabl,0,sizeof(item_index_tabl));
514 ItemGen **v8; // ecx@9 495
515 __int16 v10[137]; // [sp+Ch] [bp-118h]@1 496 for (i=0; i<138; ++i)
516 __int16 v11; // [sp+11Eh] [bp-6h]@1 497 {
517 int v12; // [sp+120h] [bp-4h]@1 498 if (( pOwnItems[i].uItemID>0)&&(pOwnItems[i].uItemID<= 134))
518 499 item_index_tabl[avalible_items++] = i;
519 auto a1 = this; 500 }
520 501
521 v12 = a2; 502 if ( avalible_items )
522 v2 = a1; 503 {
523 v3 = 0; 504 if ( enchant_count )
524 v10[0] = 0; 505 {
525 v4 = 0; 506 for ( i = 0; i < enchant_count; ++i )
526 memset(&v10[1], 0, 0x110u);
527 v11 = 0;
528 v5 = a1->pInventoryItems;
529 do
530 {
531 v6 = 0;
532 if ( (signed int)v5->uItemID > 0 && (signed int)v5->uItemID <= 134 )
533 v10[v4++] = v3;
534 ++v3;
535 ++v5;
536 }
537 while ( v3 < 138 );
538 if ( v4 )
539 {
540 if ( v12 )
541 {
542 if ( v12 > 0 )
543 {
544 do
545 { 507 {
546 LOWORD(v5) = 9 * v10[v6]; 508 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED))
547 if ( !(BYTE1(v2->pInventoryItems[v10[v6]].uAttributes) & 2) ) 509 pInventoryItems[item_index_tabl[rand() % avalible_items]].uAttributes|=ITEM_ENCHANTED;
548 {
549 v5 = (ItemGen *)((char *)&v2->pInventoryItems[v10[rand() % v4]] + 20);
550 v5->uItemID |= 2u;
551 }
552 ++v6;
553 } 510 }
554 while ( v6 < v12 ); 511
555 }
556 } 512 }
557 else 513 else
558 { 514 {
559 for ( i = 0; i < v4; ++i ) 515 for ( i = 0; i < avalible_items; ++i )
560 { 516 {
561 v8 = (ItemGen **)&v2->pInventoryItems[v10[i]].uAttributes; 517 if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED))
562 v5 = *v8; 518 pInventoryItems[item_index_tabl[i]].uAttributes|=ITEM_ENCHANTED;
563 if ( !(BYTE1(v5) & 2) ) 519 }
564 { 520 }
565 LOBYTE(v5) = (unsigned __int8)v5 | 2; 521 }
566 *v8 = v5; 522 ;
567 }
568 }
569 }
570 }
571 return (char)v5;
572 } 523 }
573 524
574 //----- (004948B1) -------------------------------------------------------- 525 //----- (004948B1) --------------------------------------------------------
575 void Player::PlaySound(PlayerSpeech speech, int a3) 526 void Player::PlaySound(PlayerSpeech speech, int a3)
576 { 527 {
697 goto LABEL_12; 648 goto LABEL_12;
698 if ( v3 > 8 ) 649 if ( v3 > 8 )
699 { 650 {
700 if ( v3 > 11 ) 651 if ( v3 > 11 )
701 { 652 {
702 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED || v3 > 97 && v3 <= 99 ) 653 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED ||( v3 > 97 && v3 <= 99) )
703 return; 654 return;
704 goto LABEL_15; 655 goto LABEL_15;
705 } 656 }
706 LABEL_12: 657 LABEL_12:
707 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) 658 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36)
1101 return 0; 1052 return 0;
1102 } 1053 }
1103 1054
1104 //----- (00492D65) -------------------------------------------------------- 1055 //----- (00492D65) --------------------------------------------------------
1105 int Player::SetCondition(unsigned int uConditionIdx, int a3) 1056 int Player::SetCondition(unsigned int uConditionIdx, int a3)
1106 { 1057 {
1107 Player *v3; // esi@1 1058
1108 Player **v4; // ebx@2 1059 signed int player_sex; // ecx@77
1109 Player *v5; // ecx@21 1060 char zombi_face; // al@80
1110 Player *v6; // ecx@22 1061 signed int remainig_player; // ebx@82
1111 Player *v7; // ecx@29 1062 int players_before; // [sp+10h] [bp-4h]@2
1112 Player *v8; // ecx@30 1063 int players_after; // [sp+20h] [bp+Ch]@82
1113 Player *v9; // ecx@37 1064
1114 Player *v10; // ecx@38 1065 if ( pConditions[uConditionIdx] )
1115 Player *v11; // ecx@45 1066 return 0;
1116 Player *v12; // ecx@46 1067 players_before = 0;
1117 char *v13; // eax@49 1068 for (int i=1;i<5;++i)
1118 Player *v14; // ecx@58 1069 if ( pPlayers[i]->CanAct() )
1119 Player *v15; // ecx@59 1070 ++players_before;
1120 Player *v16; // ecx@60 1071
1121 signed int result; // eax@76
1122 signed int v18; // ecx@77
1123 int v19; // eax@77
1124 char v20; // al@80
1125 signed int v21; // ebx@82
1126 signed int v22; // esi@82
1127 int v23; // [sp-8h] [bp-1Ch]@7
1128 int v24; // [sp-8h] [bp-1Ch]@15
1129 int v25; // [sp-8h] [bp-1Ch]@53
1130 int v26; // [sp-4h] [bp-18h]@7
1131 signed int v27; // [sp-4h] [bp-18h]@15
1132 int v28; // [sp-4h] [bp-18h]@53
1133 char *v29; // [sp+Ch] [bp-8h]@1
1134 int v30; // [sp+10h] [bp-4h]@2
1135 int v31; // [sp+20h] [bp+Ch]@82
1136
1137 v3 = this;
1138 v29 = (char *)this + 8 * uConditionIdx;
1139 if ( *(_QWORD *)v29 )
1140 {
1141 LABEL_76:
1142 result = 0;
1143 }
1144 else
1145 {
1146 v4 = &pPlayers[1];
1147 v30 = 0;
1148 do
1149 {
1150 if ( (*v4)->CanAct() )
1151 ++v30;
1152 ++v4;
1153 }
1154 while ( (signed int)v4 <= (signed int)&pPlayers[4] );
1155 switch ( uConditionIdx ) 1072 switch ( uConditionIdx )
1156 { 1073 {
1157 case 0u: 1074 case Condition_Cursed:
1158 v26 = 0; 1075 PlaySound((PlayerSpeech)30, 0);
1159 v23 = 30; 1076 break;
1160 goto LABEL_81; 1077 case Condition_Weak:
1161 case 1u:
1162 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) 1078 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 )
1163 goto LABEL_10; 1079 {--pParty->pPartyBuffs[13].uPower;
1164 v26 = 0; 1080 if ( pParty->pPartyBuffs[13].uPower < 1u )
1165 v23 = 25; 1081 pParty->pPartyBuffs[13].Reset();
1166 goto LABEL_81; 1082 return 0;
1167 case 2u: 1083 }
1168 if ( a3 != 1 ) 1084
1169 goto LABEL_82; 1085 PlaySound((PlayerSpeech)25, 0);
1170 if ( v3->HasEnchantedItemEquipped(22) ) 1086 break;
1171 goto LABEL_76; 1087 case Condition_Sleep:
1172 v27 = 3; 1088 if ( a3 == 1 &&(HasEnchantedItemEquipped(22)||WearsItem(505, 3)))
1173 v24 = 505; 1089 return 0;
1174 goto LABEL_16; 1090 break;
1175 case 3u: 1091
1176 v26 = 0; 1092 case Condition_Fear:
1177 v23 = 26; 1093 PlaySound((PlayerSpeech)26, 0);
1178 goto LABEL_81; 1094 break;
1179 case 4u: 1095 case Condition_Drunk:
1180 v26 = 0; 1096 PlaySound((PlayerSpeech)31, 0);
1181 v23 = 31; 1097 break;
1182 goto LABEL_81; 1098
1183 case 5u: 1099 case Condition_Insane:
1184 if ( a3 == 1 1100 if ( a3 == 1
1185 && (v3->HasEnchantedItemEquipped(19) || v5->WearsItem(505, 3) || v6->WearsItem(530, 6)) ) 1101 && (HasEnchantedItemEquipped(19) || WearsItem(505, 3) || WearsItem(530, 6)) )
1186 goto LABEL_76; 1102 return 0;
1187 v26 = 0; 1103
1188 v23 = 29; 1104 PlaySound((PlayerSpeech)29, 0);
1189 goto LABEL_81; 1105 break;
1190 case 6u: 1106 case Condition_Poison1:
1191 case 8u: 1107 case Condition_Poison2:
1192 case 0xAu: 1108 case Condition_Poison3:
1193 if ( a3 == 1 ) 1109 if ( a3 == 1 )
1194 { 1110 {
1195 if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 ) 1111 if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0i64 )
1196 { 1112 {
1113 --pParty->pPartyBuffs[13].uPower;
1114 if ( pParty->pPartyBuffs[13].uPower < 1u )
1115 pParty->pPartyBuffs[13].Reset();
1116 }
1117 if ( HasEnchantedItemEquipped(21)
1118 || WearsItem(505, 3)
1119 || WearsItem(530, 6) )
1120 //goto LABEL_76;
1121 return 0;
1122 }
1123
1124 //v23 = 27;
1125 PlaySound((PlayerSpeech)27, 0);
1126 break;
1127
1128 case Condition_Disease1:
1129 case Condition_Disease2:
1130 case Condition_Disease3:
1131 if ( a3 == 1 )
1132 {
1133 if ( pParty->pPartyBuffs[13].uExpireTime > 0i64 )
1134 {
1135 --pParty->pPartyBuffs[13].uPower;
1136 if ( pParty->pPartyBuffs[13].uPower < 1u )
1137 pParty->pPartyBuffs[13].Reset();
1138 return 0;
1139 }
1140
1141 if ( HasEnchantedItemEquipped(18) ||WearsItem(505, 3) || WearsItem(530, 6) )
1142 return 0;
1143 }
1144 PlaySound((PlayerSpeech)28, 0);
1145 break;
1146 case Condition_Paralyzed:
1147 if ( a3 == 1 )
1148 {
1149 if ( pParty->pPartyBuffs[13].uExpireTime > 0i64 )
1150 {
1151 --pParty->pPartyBuffs[13].uPower;
1152 if ( pParty->pPartyBuffs[13].uPower < 1u )
1153 pParty->pPartyBuffs[13].Reset();
1154 return 0;
1155 }
1156
1157 if ( HasEnchantedItemEquipped(20)|| WearsItem(505, 3)|| WearsItem(507, 16)||WearsItem(530, 6))
1158 return 0;
1159 }
1160 break;
1161 case Condition_Unconcious:
1162 PlaySound(SPEECH_32, 0);
1163 if ( sHealth > 0 )
1164 sHealth = 0;
1165 break;
1166 case Condition_Dead:
1167 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0i64 && pParty->pPartyBuffs[13].uSkill >= 4u )
1168 {
1197 --pParty->pPartyBuffs[13].uPower; 1169 --pParty->pPartyBuffs[13].uPower;
1198 if ( pParty->pPartyBuffs[13].uPower < 1u ) 1170 if ( pParty->pPartyBuffs[13].uPower < 1u )
1199 pParty->pPartyBuffs[13].Reset(); 1171 pParty->pPartyBuffs[13].Reset();
1200 } 1172 }
1201 if ( v3->HasEnchantedItemEquipped(21) 1173
1202 || v7->WearsItem(505, 3) 1174 PlaySound((PlayerSpeech)33, 0);
1203 || v8->WearsItem(530, 6) ) 1175 if ( sHealth > 0 )
1204 goto LABEL_76; 1176 sHealth = 0;
1177 if ( sMana > 0 )
1178 sMana = 0;
1179 break;
1180 case Condition_Pertified:
1181 if ( a3 == 1
1182 &&((pParty->pPartyBuffs[13].uExpireTime > 0i64)
1183 || HasEnchantedItemEquipped(23)|| WearsItem(520, 16) || WearsItem(505, 3) || WearsItem(530, 6)) )
1184
1185 return 0;
1186 PlaySound((PlayerSpeech)34, 0);
1187 break;
1188 case Condition_Eradicated:
1189 if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 )&&( pParty->pPartyBuffs[13].uSkill >= 4u ))
1190 {
1191 --pParty->pPartyBuffs[13].uPower;
1192 if ( pParty->pPartyBuffs[13].uPower < 1u )
1193 pParty->pPartyBuffs[13].Reset();
1194 return 0;
1195 }
1196 PlaySound(SPEECH_35, 0);
1197 if (sHealth > 0 )
1198 sHealth = 0;
1199 if ( sMana > 0 )
1200 sMana = 0;
1201 break;
1202 case Condition_Zombie:
1203 if ( classType == PLAYER_CLASS_LICH || Eradicated() ||Zombie() || !Dead())
1204 return 0;
1205 memset(&pConditions[0], 0, sizeof(pConditions));
1206 sHealth = GetMaxHealth();
1207 sMana = 0;
1208 player_sex = 0;
1209 uPrevFace = uCurrentFace;
1210 uPrevVoiceID = uVoiceID;
1211 switch ( uVoiceID )
1212 {
1213 case 0:
1214 case 1:
1215 case 2:
1216 case 3:
1217 case 8:
1218 case 9:
1219 case 12:
1220 case 13:
1221 case 16:
1222 case 17:
1223 case 20:
1224 case 23:
1225 player_sex = 0;
1226 break;
1227 case 4:
1228 case 5:
1229 case 6:
1230 case 7:
1231 case 10:
1232 case 11:
1233 case 14:
1234 case 15:
1235 case 18:
1236 case 19:
1237 case 21:
1238 case 24:
1239 player_sex = 1;
1240 break;
1241 default:
1242 break;
1243 }
1244
1245 zombi_face = (player_sex != 0) + 23;
1246 uCurrentFace = zombi_face;
1247 uVoiceID = zombi_face;
1248 PlaySound((PlayerSpeech)SPEECH_99, 0);
1249 break;
1205 } 1250 }
1206 v26 = 0; 1251
1207 v23 = 27; 1252 remainig_player = 0;
1208 goto LABEL_81; 1253 pConditions[uConditionIdx] = pParty->uTimePlayed;
1209 case 7u: 1254 players_after = 0;
1210 case 9u: 1255 for (int i=1;i<5;++i)
1211 case 0xBu:
1212 if ( a3 != 1 )
1213 goto LABEL_40;
1214 if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0
1215 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) )
1216 goto LABEL_10;
1217 if ( v3->HasEnchantedItemEquipped(18) || v3->WearsItem(505, 3) || v3->WearsItem(530, 6) )
1218 goto LABEL_76;
1219 LABEL_40:
1220 v26 = 0;
1221 v23 = 28;
1222 goto LABEL_81;
1223 case 0xCu:
1224 if ( a3 != 1 )
1225 goto LABEL_82;
1226 if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0
1227 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) )
1228 goto LABEL_10;
1229 if ( v3->HasEnchantedItemEquipped(20)
1230 || v11->WearsItem(505, 3)
1231 || v12->WearsItem(507, 16) )
1232 goto LABEL_76;
1233 v27 = 6;
1234 v24 = 530;
1235 LABEL_16:
1236 if ( v3->WearsItem(v24, v27) )
1237 goto LABEL_76;
1238 goto LABEL_82;
1239 case 0xDu:
1240 v3->PlaySound(SPEECH_32, 0);
1241 v13 = (char *)&v3->sHealth;
1242 goto LABEL_70;
1243 case 0xEu:
1244 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u )
1245 goto LABEL_10;
1246 v28 = 0;
1247 v25 = 33;
1248 goto LABEL_67;
1249 case 0xFu:
1250 if ( a3 == 1
1251 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0
1252 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0)
1253 || v3->HasEnchantedItemEquipped(23)
1254 || v14->WearsItem(520, 16)
1255 || v15->WearsItem(505, 3)
1256 || v16->WearsItem(530, 6)) )
1257 goto LABEL_76;
1258 v26 = 0;
1259 v23 = 34;
1260 goto LABEL_81;
1261 case 0x10u:
1262 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u )
1263 { 1256 {
1264 LABEL_10: 1257
1265 --pParty->pPartyBuffs[13].uPower; 1258
1266 if ( pParty->pPartyBuffs[13].uPower < 1u ) 1259 if ( pPlayers[i]->CanAct() )
1267 pParty->pPartyBuffs[13].Reset(); 1260 {
1268 goto LABEL_76; 1261 remainig_player=i;
1262 ++players_after;
1263 }
1269 } 1264 }
1270 v28 = 0; 1265 if (( players_before == 2 )&&( players_after == 1 ))
1271 v25 = SPEECH_35;
1272 LABEL_67:
1273 v3->PlaySound((PlayerSpeech)v25, v28);
1274 if ( v3->sHealth > 0 )
1275 v3->sHealth = 0;
1276 v13 = (char *)&v3->sMana;
1277 LABEL_70:
1278 if ( *(int *)v13 > 0 )
1279 *(int *)v13 = 0;
1280 LABEL_82:
1281 v21 = 0;
1282 *(_QWORD *)v29 = pParty->uTimePlayed;
1283 v31 = 0;
1284 v22 = 1;
1285 do
1286 { 1266 {
1287 if ( pPlayers[v22]->CanAct() ) 1267 pPlayers[remainig_player]->PlaySound(SPEECH_107, 0);
1288 {
1289 ++v31;
1290 v21 = v22;
1291 }
1292 ++v22;
1293 } 1268 }
1294 while ( v22 <= 4 ); 1269 return 1;
1295 if ( v30 == 2 ) 1270 }
1296 {
1297 if ( v31 == 1 )
1298 pPlayers[v21]->PlaySound(SPEECH_107, 0);
1299 }
1300 result = 1;
1301 break;
1302 case 0x11u:
1303 if ( v3->classType == PLAYER_CLASS_LICH || v3->Eradicated() ||
1304 v3->Zombie() || !v3->Dead())
1305 goto LABEL_76;
1306 memset(v3, 0, 0xA0u);
1307 v3->sHealth = v3->GetMaxHealth();
1308 v18 = 0;
1309 v3->field_1928 = v3->uFace;
1310 v19 = v3->uVoiceID;
1311 v3->sMana = 0;
1312 v3->field_1924 = v19;
1313 switch ( v19 )
1314 {
1315 case 0:
1316 case 1:
1317 case 2:
1318 case 3:
1319 case 8:
1320 case 9:
1321 case 12:
1322 case 13:
1323 case 16:
1324 case 17:
1325 case 20:
1326 case 23:
1327 v18 = 0;
1328 break;
1329 case 4:
1330 case 5:
1331 case 6:
1332 case 7:
1333 case 10:
1334 case 11:
1335 case 14:
1336 case 15:
1337 case 18:
1338 case 19:
1339 case 21:
1340 case 24:
1341 v18 = 1;
1342 break;
1343 default:
1344 break;
1345 }
1346 v26 = 0;
1347 v20 = (v18 != 0) + 23;
1348 v23 = SPEECH_99;
1349 v3->uFace = v20;
1350 v3->uVoiceID = v20;
1351 LABEL_81:
1352 v3->PlaySound((PlayerSpeech)v23, v26);
1353 goto LABEL_82;
1354 default:
1355 goto LABEL_82;
1356 }
1357 }
1358 return result;
1359 }
1360 1271
1361 //----- (00492528) -------------------------------------------------------- 1272 //----- (00492528) --------------------------------------------------------
1362 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) 1273 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID)
1363 { 1274 {
1364 //unsigned int v3; // eax@1 1275 //unsigned int v3; // eax@1
1375 v5 = GetSizeInInventorySlots(v4->uTextureWidth); 1286 v5 = GetSizeInInventorySlots(v4->uTextureWidth);
1376 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); 1287 uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight);
1377 if ( !areWeLoadingTexture ) 1288 if ( !areWeLoadingTexture )
1378 { 1289 {
1379 v4->Release(); 1290 v4->Release();
1380 pIcons_LOD->_40F9C5(); 1291 pIcons_LOD->SyncLoadedFilesCount();
1381 } 1292 }
1382 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 ) 1293 if ( (signed int)(v5 + (signed int)uSlot % 14) <= 14 && (signed int)(uItemIDa + (signed int)uSlot / 14) <= 9 )
1383 { 1294 {
1384 v6 = 0; 1295 v6 = 0;
1385 if ( (signed int)uItemIDa <= 0 ) 1296 if ( (signed int)uItemIDa <= 0 )
1470 v10 = GetSizeInInventorySlots(v8->uTextureWidth); 1381 v10 = GetSizeInInventorySlots(v8->uTextureWidth);
1471 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); 1382 uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight);
1472 if ( !areWeLoadingTexture ) 1383 if ( !areWeLoadingTexture )
1473 { 1384 {
1474 v8->Release(); 1385 v8->Release();
1475 pIcons_LOD->_40F9C5(); 1386 pIcons_LOD->SyncLoadedFilesCount();
1476 } 1387 }
1477 if ( (signed int)uItemIDa > 0 ) 1388 if ( (signed int)uItemIDa > 0 )
1478 { 1389 {
1479 v9 = &v11->pInventoryIndices[uSlot]; 1390 v9 = &v11->pInventoryIndices[uSlot];
1480 do 1391 do
1513 } 1424 }
1514 1425
1515 //----- (00492745) -------------------------------------------------------- 1426 //----- (00492745) --------------------------------------------------------
1516 int Player::WearItem(unsigned int uItemID) 1427 int Player::WearItem(unsigned int uItemID)
1517 { 1428 {
1518 signed int v2; // eax@1 1429 int item_body_anch; // edi@6
1519 ItemGen *v3; // edx@1 1430 int item_indx;
1520 int v4; // edi@6 1431 //find empty slot
1521 char *v5; // eax@6 1432 for(item_indx=0;item_indx<126;++item_indx)
1522 char *v6; // esi@6 1433 if (pInventoryItems[item_indx].uItemID==0)
1523 1434 break;
1524 __debugbreak(); // sub is definetly broken 1435 if (item_indx==126) //not found
1525 1436 item_indx=-1;
1526 v2 = 0; 1437
1527 v3 = this->pInventoryItems; 1438 if ( item_indx != -1 )
1528 while ( v3->uItemID ) 1439 {
1529 { 1440
1530 ++v2; 1441 pInventoryItems[item_indx].uItemID=uItemID;
1531 ++v3; 1442 item_body_anch=pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType];
1532 if ( v2 >= 126 ) 1443 pEquipment.pIndices[item_body_anch]=item_indx+1;
1533 { 1444 pInventoryItems[item_indx].uBodyAnchor=item_body_anch+1;
1534 v2 = -1; 1445
1535 break;
1536 }
1537 }
1538 if ( v2 != -1 )
1539 {
1540 v4 = v2 + 1;
1541 v5 = (char *)this + 36 * v2;
1542 v6 = &byte_4E8394[pItemsTable->pItems[uItemID].uEquipType + 4];
1543 *(&this->pEquipment.uShield + (unsigned __int8)*v6) = v4;
1544 *((int *)v5 + 133) = uItemID;
1545 v5[556] = *v6 + 1;
1546 } 1446 }
1547 return 0; 1447 return 0;
1548 } 1448 }
1549 1449
1550 //----- (004927A8) -------------------------------------------------------- 1450 //----- (004927A8) --------------------------------------------------------
1551 int Player::AddItem(unsigned int uSlot, unsigned int uItemID) 1451 int Player::AddItem(int uSlot, unsigned int uItemID)
1552 { 1452 {
1553 signed int v3; // ebx@2 1453 signed int v3; // ebx@2
1554 signed int v4; // edi@3 1454 signed int v4; // edi@3
1555 unsigned int v5; // esi@3 1455 unsigned int v5; // esi@3
1556 unsigned int v7; // [sp-8h] [bp-18h]@8 1456 unsigned int v7; // [sp-8h] [bp-18h]@8
1559 1459
1560 thisa = this; 1460 thisa = this;
1561 if ( uSlot == -1 ) 1461 if ( uSlot == -1 )
1562 { 1462 {
1563 v3 = 0; 1463 v3 = 0;
1564 while ( 2 ) 1464 while ( true )
1565 { 1465 {
1566 v4 = 0; 1466 v4 = 0;
1567 v5 = v3; 1467 v5 = v3;
1568 do 1468 do
1569 { 1469 {
1593 v7 = uSlot; 1493 v7 = uSlot;
1594 return CreateItemInInventory(v7, v8); 1494 return CreateItemInInventory(v7, v8);
1595 } 1495 }
1596 1496
1597 //----- (00492826) -------------------------------------------------------- 1497 //----- (00492826) --------------------------------------------------------
1598 int Player::AddItem2(unsigned int uSlot, ItemGen *Src) 1498 int Player::AddItem2(int uSlot, ItemGen *Src)
1599 { 1499 {
1600 unsigned int v3; // ebx@1 1500 unsigned int v3; // ebx@1
1601 unsigned int v4; // esi@3 1501 unsigned int v4; // esi@3
1602 signed int v5; // edi@3 1502 signed int v5; // edi@3
1603 unsigned int v7; // [sp-8h] [bp-18h]@9 1503 unsigned int v7; // [sp-8h] [bp-18h]@9
1609 v3 = Src->uItemID; 1509 v3 = Src->uItemID;
1610 pItemsTable->SetSpecialBonus(Src); 1510 pItemsTable->SetSpecialBonus(Src);
1611 if ( uSlot == -1 ) 1511 if ( uSlot == -1 )
1612 { 1512 {
1613 uSlota = 0; 1513 uSlota = 0;
1614 while ( 2 ) 1514 while ( true )
1615 { 1515 {
1616 v4 = uSlota; 1516 v4 = uSlota;
1617 v5 = 0; 1517 v5 = 0;
1618 do 1518 do
1619 { 1519 {
1646 { 1546 {
1647 signed int v3; // ebx@1 1547 signed int v3; // ebx@1
1648 ItemGen *v4; // eax@1 1548 ItemGen *v4; // eax@1
1649 int result; // eax@6 1549 int result; // eax@6
1650 //unsigned int v6; // eax@7 1550 //unsigned int v6; // eax@7
1651 Texture *v7; // esi@7 1551 Texture *item_texture; // esi@7
1652 unsigned int v8; // edx@9 1552 unsigned int v8; // edx@9
1653 void *v9; // esi@10 1553 int *pInvPos; // esi@10
1654 unsigned int v10; // [sp+4h] [bp-Ch]@7 1554 unsigned int slot_width; // [sp+4h] [bp-Ch]@7
1655 unsigned int v11; // [sp+8h] [bp-8h]@7 1555 unsigned int slot_height; // [sp+8h] [bp-8h]@7
1656 Player *v12; // [sp+Ch] [bp-4h]@1 1556 Player *v12; // [sp+Ch] [bp-4h]@1
1657 unsigned int uSlota; // [sp+18h] [bp+8h]@10 1557
1658 1558
1659 v12 = this; 1559 v12 = this;
1660 v3 = 0; 1560 v3 = 0;
1661 v4 = this->pInventoryItems; 1561 v4 = this->pInventoryItems;
1662 while ( v4->uItemID ) 1562 while ( v4->uItemID )
1673 { 1573 {
1674 result = 0; 1574 result = 0;
1675 } 1575 }
1676 else 1576 else
1677 { 1577 {
1678 v7 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); 1578 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
1679 v10 = GetSizeInInventorySlots(v7->uTextureWidth); 1579 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth);
1680 v11 = GetSizeInInventorySlots(v7->uTextureHeight); 1580 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight);
1681 if ( !areWeLoadingTexture ) 1581 if ( !areWeLoadingTexture )
1682 { 1582 {
1683 v7->Release(); 1583 item_texture->Release();
1684 pIcons_LOD->_40F9C5(); 1584 pIcons_LOD->SyncLoadedFilesCount();
1685 } 1585 }
1686 v8 = uSlot; 1586 if ( slot_height > 0 )
1687 if ( (signed int)v11 > 0 ) 1587 {
1688 { 1588 pInvPos = &pInventoryIndices[uSlot];
1689 uSlota = v11;
1690 v9 = &v12->pInventoryIndices[v8];
1691 do 1589 do
1692 { 1590 {
1693 if ( (signed int)v10 > 0 ) 1591 if ( slot_width > 0 )
1694 memset32(v9, -1 - v8, v10); 1592 memset32(pInvPos, -1 - uSlot, slot_width);
1695 v9 = (char *)v9 + 56; 1593 pInvPos +=14;
1696 --uSlota; 1594 --slot_height;
1697 } 1595 }
1698 while ( uSlota ); 1596 while ( slot_height );
1699 } 1597 }
1700 v12->pInventoryIndices[v8] = v3 + 1; 1598 pInventoryIndices[uSlot] = v3 + 1;
1701 memcpy(&v12->pInventoryItems[v3], Src, 0x24u); 1599 memcpy(&pInventoryItems[v3], Src, sizeof(ItemGen));
1702 result = v3 + 1; 1600 result = v3 + 1;
1703 } 1601 }
1704 return result; 1602 return result;
1705 } 1603 }
1706 // 506128: using guessed type int areWeLoadingTexture; 1604 // 506128: using guessed type int areWeLoadingTexture;
1707 1605
1708 //----- (0049298B) -------------------------------------------------------- 1606 //----- (0049298B) --------------------------------------------------------
1709 bool Player::_49298B(ItemGen *a2, int a3, int a4) 1607 int Player::PutItemArInventoryIndex( ItemGen *item, int item_id, int uSlot )
1710 { 1608 {
1711 //Player *v4; // ebx@1 1609 //Player *v4; // ebx@1
1712 //unsigned int v5; // eax@1 1610 //unsigned int v5; // eax@1
1713 Texture *v6; // esi@1 1611 Texture *item_texture; // esi@1
1714 void *v7; // esi@4 1612 int *pInvPos; // esi@4
1715 unsigned int v9; // [sp+Ch] [bp-4h]@1 1613 unsigned int slot_width; // [sp+Ch] [bp-4h]@1
1716 unsigned int a2a; // [sp+18h] [bp+8h]@1 1614 unsigned int slot_height; // [sp+18h] [bp+8h]@1
1717 1615
1718 v6 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[a2->uItemID].pIconName, TEXTURE_16BIT_PALETTE); 1616 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
1719 v9 = GetSizeInInventorySlots(v6->uTextureWidth); 1617 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth);
1720 a2a = GetSizeInInventorySlots(v6->uTextureHeight); 1618 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight);
1721 if ( !areWeLoadingTexture ) 1619 if ( !areWeLoadingTexture )
1722 { 1620 {
1723 v6->Release(); 1621 item_texture->Release();
1724 pIcons_LOD->_40F9C5(); 1622 pIcons_LOD->SyncLoadedFilesCount();
1725 } 1623 }
1726 if ( (signed int)a2a > 0 ) 1624 if ( (signed int)slot_height > 0 )
1727 { 1625 {
1728 v7 = &pInventoryIndices[a4]; 1626 pInvPos = &pInventoryIndices[uSlot]; //14x9
1729 do 1627 do
1730 { 1628 {
1731 if ( (signed int)v9 > 0 ) 1629 if ( (signed int)slot_width > 0 )
1732 memset32(v7, -1 - a4, v9); 1630 memset32(pInvPos, -1 - uSlot, slot_width);
1733 v7 = (char *)v7 + 56; 1631 pInvPos +=14;
1734 --a2a; 1632 --slot_height;
1735 } 1633 }
1736 while ( a2a ); 1634 while ( slot_height );
1737 } 1635 }
1738 pInventoryIndices[a4] = a3 + 1; 1636 pInventoryIndices[uSlot] = item_id + 1;
1739 return 1; 1637 return 1;
1740 } 1638 }
1741 1639
1742 // 506128: using guessed type int areWeLoadingTexture; 1640 // 506128: using guessed type int areWeLoadingTexture;
1743 1641
1744 //----- (00492A36) -------------------------------------------------------- 1642 //----- (00492A36) --------------------------------------------------------
1745 unsigned int Player::RemoveItemAtInventoryIndex(unsigned int uSlot) 1643 void Player::RemoveItemAtInventoryIndex( unsigned int uSlot )
1746 { 1644 {
1747 int *pIndices; // edi@1 1645
1748 ItemGen *v3; // ecx@1 1646 ItemGen *item_in_slot; // ecx@1
1749 unsigned int v4; // esi@1 1647 Texture *item_texture; // esi@1
1750 //unsigned int v5; // eax@1 1648 unsigned int slot_height; // ebp@1
1751 Texture *v6; // esi@1 1649 int *pInvPos; // edx@4
1752 unsigned int result; // eax@1 1650 unsigned int slot_width; // [sp+14h] [bp+4h]@1
1753 unsigned int v8; // ebp@1 1651
1754 void *v9; // edx@4 1652 item_in_slot = &this->pInventoryItems[pInventoryIndices[uSlot]-1];
1755 unsigned int uSlota; // [sp+14h] [bp+4h]@1 1653 item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
1756 1654 item_in_slot->Reset();
1757 pIndices = &this->pInventoryIndices[uSlot]; 1655 slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth);
1758 v3 = &this->pInventoryItems[*pIndices-1]; 1656 slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight);
1759 v4 = v3->uItemID;
1760 v3->Reset();
1761 v6 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE);
1762 uSlota = GetSizeInInventorySlots(v6->uTextureWidth);
1763 result = GetSizeInInventorySlots(v6->uTextureHeight);
1764 v8 = result;
1765 if ( !areWeLoadingTexture ) 1657 if ( !areWeLoadingTexture )
1766 { 1658 {
1767 v6->Release(); 1659 item_texture->Release();
1768 result = pIcons_LOD->_40F9C5(); 1660 pIcons_LOD->SyncLoadedFilesCount();
1769 } 1661 }
1770 if ( (signed int)v8 > 0 ) 1662 if ( slot_height > 0 )
1771 { 1663 {
1772 v9 = pIndices; 1664 pInvPos = &pInventoryIndices[uSlot];
1773 do 1665 do
1774 { 1666 {
1775 if ( (signed int)uSlota > 0 ) 1667 if (slot_width > 0 )
1776 { 1668 memset32(pInvPos, 0, slot_width);
1777 result = 0; 1669 pInvPos += 14;
1778 memset(v9, 0, 4 * uSlota); 1670 --slot_height;
1779 } 1671 }
1780 v9 = (char *)v9 + 56; 1672 while ( slot_height );
1781 --v8; 1673 }
1782 } 1674
1783 while ( v8 );
1784 }
1785 return result;
1786 } 1675 }
1787 // 506128: using guessed type int areWeLoadingTexture; 1676 // 506128: using guessed type int areWeLoadingTexture;
1788 1677
1789 //identf 1678 //identf
1790 //----- (00490EEE) -------------------------------------------------------- 1679 //----- (00490EEE) --------------------------------------------------------
1968 } 1857 }
1969 1858
1970 //----- (0049107D) -------------------------------------------------------- 1859 //----- (0049107D) --------------------------------------------------------
1971 int Player::GetBodybuilding() 1860 int Player::GetBodybuilding()
1972 { 1861 {
1973 char v1; // al@1 1862 int v1; // al@1
1974 int v2; // ecx@1 1863 int v2; // ecx@1
1975 int v4; // eax@3 1864 int v4; // eax@3
1976 signed int v6; // [sp-4h] [bp-4h]@2 1865 signed int v6; // [sp-4h] [bp-4h]@2
1977 1866
1978 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING); 1867 v1 = GetActualSkillLevel(PLAYER_SKILL_BODYBUILDING);
1981 { 1870 {
1982 v6 = 5; 1871 v6 = 5;
1983 } 1872 }
1984 else 1873 else
1985 { 1874 {
1986 if ( v1 >= 0 ) 1875 if ( (v1&0xFF) >= 0 )
1987 { 1876 {
1988 v4 = ((v1 & 0x40) != 0) + 1; 1877 v4 = ((v1 & 0x40) != 0) + 1;
1989 return v2 * v4; 1878 return v2 * v4;
1990 } 1879 }
1991 v6 = 3; 1880 v6 = 3;
1995 } 1884 }
1996 1885
1997 //----- (004910A8) -------------------------------------------------------- 1886 //----- (004910A8) --------------------------------------------------------
1998 int Player::GetMeditation() 1887 int Player::GetMeditation()
1999 { 1888 {
2000 char v1; // al@1 1889 int v1; // al@1
2001 int v2; // ecx@1 1890 int base_level; // ecx@1
2002 int v4; // eax@3 1891 int v4; // eax@3
2003 signed int v6; // [sp-4h] [bp-4h]@2 1892 signed int v6; // [sp-4h] [bp-4h]@2
2004 1893
2005 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION); 1894 v1 = GetActualSkillLevel(PLAYER_SKILL_MEDITATION);
2006 v2 = v1 & 0x3F; 1895 base_level = v1 & 0x3F;
2007 if ( v1 & 0x100 ) 1896 if ( v1 & 0x100 )
2008 { 1897 {
2009 v6 = 5; 1898 v6 = 5;
2010 } 1899 }
2011 else 1900 else
2012 { 1901 {
2013 if ( v1 >= 0 ) 1902 if ( (v1&0xFF) >= 0 )
2014 { 1903 {
2015 v4 = ((v1 & 0x40) != 0) + 1; 1904 v4 = ((v1 & 0x40) != 0) + 1;
2016 return v2 * v4; 1905 return base_level * v4;
2017 } 1906 }
2018 v6 = 3; 1907 v6 = 3;
2019 } 1908 }
2020 v4 = v6; 1909 v4 = v6;
2021 return v2 * v4; 1910 return base_level * v4;
2022 } 1911 }
2023 1912
2024 //----- (004910D3) -------------------------------------------------------- 1913 //----- (004910D3) --------------------------------------------------------
2025 int Player::CanIdentify(ItemGen *pItem) 1914 int Player::CanIdentify(ItemGen *pItem)
2026 { 1915 {
2076 unsigned __int16 v2; // ax@1 1965 unsigned __int16 v2; // ax@1
2077 unsigned __int16 v3; // bx@1 1966 unsigned __int16 v3; // bx@1
2078 int v4; // eax@3 1967 int v4; // eax@3
2079 int v5; // edi@7 1968 int v5; // edi@7
2080 signed int v6; // ebp@7 1969 signed int v6; // ebp@7
2081 char v8; // al@10
2082 signed int v10; // [sp-4h] [bp-14h]@2 1970 signed int v10; // [sp-4h] [bp-14h]@2
2083 1971
2084 1972
2085 auto v7 = &pItemsTable->pItems[a2->uItemID]; 1973 auto v7 = &pItemsTable->pItems[a2->uItemID];
2086 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || 1974 if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 ||
2087 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || 1975 CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 ||
2088 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) 1976 CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 )
2089 return true; 1977 return true;
2090 1978
2091 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_REPAIR); 1979 v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR);
2092 v3 = v2; 1980 v3 = v2;
2093 if ( HIBYTE(v2) & 1 ) 1981 if (v2 & 0x100 )
2094 { 1982 {
2095 v10 = 5; 1983 v10 = 5;
2096 } 1984 }
2097 else 1985 else
2098 { 1986 {
2129 int v8; // ecx@7 2017 int v8; // ecx@7
2130 signed int v9; // [sp-4h] [bp-10h]@6 2018 signed int v9; // [sp-4h] [bp-10h]@6
2131 2019
2132 v1 = this; 2020 v1 = this;
2133 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); 2021 v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT);
2134 v3 = v1->pActiveSkills[22]; 2022 v3 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT];
2135 v4 = v2 & 0x003F; 2023 v4 = v2 & 0x003F;
2136 v5 = v1->pActiveSkills[22] & 0x3F; 2024 v5 = v1->pActiveSkills[PLAYER_SKILL_MERCHANT] & 0x3F;
2137 if ( (signed int)SkillToMastery(v2) >= 4 ) 2025 if ( (signed int)SkillToMastery(v2) >= 4 )
2138 return 10000; 2026 return 10000;
2139 v7 = GetPartyReputation(); 2027 v7 = GetPartyReputation();
2140 if ( !v4 ) 2028 if ( !v4 )
2141 return -v7; 2029 return -v7;
2142 if ( HIBYTE(v3) & 1 ) 2030 if ( v3 & 0x100 )
2143 { 2031 {
2144 v9 = 5; 2032 v9 = 5;
2145 } 2033 }
2146 else 2034 else
2147 { 2035 {
2166 int v5; // edi@1 2054 int v5; // edi@1
2167 int v7; // eax@5 2055 int v7; // eax@5
2168 signed int v8; // [sp-4h] [bp-10h]@4 2056 signed int v8; // [sp-4h] [bp-10h]@4
2169 2057
2170 v1 = this; 2058 v1 = this;
2171 v2 = (char)GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); 2059 v2 = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION);
2172 v3 = v1->pActiveSkills[26]; 2060 v3 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION];
2173 v4 = v2 & 0x3F; 2061 v4 = v2 & 0x3F;
2174 v5 = v1->pActiveSkills[26] & 0x3F; 2062 v5 = v1->pActiveSkills[PLAYER_SKILL_PERCEPTION] & 0x3F;
2175 if ( (signed int)SkillToMastery(v2) >= 4 ) 2063 if ( (signed int)SkillToMastery(v2) >= 4 )
2176 return 10000; 2064 return 10000;
2177 if ( HIBYTE(v3) & 1 ) 2065 if ( v3 & 0x100 )
2178 { 2066 {
2179 v8 = 5; 2067 v8 = 5;
2180 } 2068 }
2181 else 2069 else
2182 { 2070 {
2201 int v5; // edi@1 2089 int v5; // edi@1
2202 int v7; // eax@7 2090 int v7; // eax@7
2203 signed int v8; // [sp-4h] [bp-14h]@6 2091 signed int v8; // [sp-4h] [bp-14h]@6
2204 2092
2205 v1 = this; 2093 v1 = this;
2206 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM); 2094 v2 = GetActualSkillLevel(PLAYER_SKILL_TRAP_DISARM);
2207 v3 = v1->pActiveSkills[29]; 2095 v3 = v1->pActiveSkills[29];
2208 v4 = v2 & 0x3F; 2096 v4 = v2 & 0x3F;
2209 v5 = v1->pActiveSkills[29] & 0x3F; 2097 v5 = v1->pActiveSkills[29] & 0x3F;
2210 if ( (signed int)SkillToMastery(v2) >= 4 ) 2098 if ( (signed int)SkillToMastery(v2) >= 4 )
2211 return 10000; 2099 return 10000;
2212 if ( HasEnchantedItemEquipped(35) ) 2100 if ( HasEnchantedItemEquipped(35) )
2213 v4 *= 2; 2101 v4 *= 2;
2214 if ( HIBYTE(v3) & 1 ) 2102 if ( v3 & 0x100 )
2215 { 2103 {
2216 v8 = 5; 2104 v8 = 5;
2217 } 2105 }
2218 else 2106 else
2219 { 2107 {
2237 int v4; // ecx@1 2125 int v4; // ecx@1
2238 int v5; // eax@4 2126 int v5; // eax@4
2239 signed int v7; // [sp-4h] [bp-Ch]@3 2127 signed int v7; // [sp-4h] [bp-Ch]@3
2240 2128
2241 v1 = this; 2129 v1 = this;
2242 LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_LEARNING); 2130 v2 = GetActualSkillLevel(PLAYER_SKILL_LEARNING);
2243 v3 = v1->pActiveSkills[36]; 2131 v3 = v1->pActiveSkills[36];
2244 v4 = v2 & 0x3F; 2132 v4 = v2 & 0x3F;
2245 if ( v2 ) 2133 if ( v2 )
2246 { 2134 {
2247 if ( HIBYTE(v3) & 1 ) 2135 if (v3 & 0x100 )
2248 { 2136 {
2249 v7 = 5; 2137 v7 = 5;
2250 } 2138 }
2251 else 2139 else
2252 { 2140 {
2284 pPlayerBuffs[i].uCaster = 0; 2172 pPlayerBuffs[i].uCaster = 0;
2285 pPlayerBuffs[i].uFlags = 0; 2173 pPlayerBuffs[i].uFlags = 0;
2286 } 2174 }
2287 2175
2288 pName[0] = 0; 2176 pName[0] = 0;
2289 uFace = 0; 2177 uCurrentFace = 0;
2290 uVoiceID = 0; 2178 uVoiceID = 0;
2291 memset(pConditions, 0, 20 * sizeof(__int64)); 2179 memset(pConditions, 0, 20 * sizeof(__int64));
2292 2180
2293 field_BB = 0; 2181 field_BB = 0;
2294 2182
2379 signed int v8; // esi@10 2267 signed int v8; // esi@10
2380 Player *v9; // edi@11 2268 Player *v9; // edi@11
2381 int v10; // eax@11 2269 int v10; // eax@11
2382 bool result; // eax@15 2270 bool result; // eax@15
2383 std::string v12; // [sp-18h] [bp-40h]@9 2271 std::string v12; // [sp-18h] [bp-40h]@9
2384 const char *v13; // [sp-8h] [bp-30h]@9 2272
2385 int v14; // [sp-4h] [bp-2Ch]@9 2273
2386 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3 2274 int v15[4] = {0, 1, 2, 3}; // [sp+Ch] [bp-1Ch]@3
2387 //int v16; // [sp+10h] [bp-18h]@3 2275 //int v16; // [sp+10h] [bp-18h]@3
2388 //int v17; // [sp+14h] [bp-14h]@3 2276 //int v17; // [sp+14h] [bp-14h]@3
2389 //int v18; // [sp+18h] [bp-10h]@3 2277 //int v18; // [sp+18h] [bp-10h]@3
2390 Player *v19; // [sp+1Ch] [bp-Ch]@9 2278 Player *v19; // [sp+1Ch] [bp-Ch]@9
2421 v8 = 0; 2309 v8 = 0;
2422 while ( 1 ) 2310 while ( 1 )
2423 { 2311 {
2424 v9 = &v20->pPlayers[v15[v8]]; 2312 v9 = &v20->pPlayers[v15[v8]];
2425 v19 = &v20->pPlayers[v15[v8]]; 2313 v19 = &v20->pPlayers[v15[v8]];
2426 v10 = v19->AddItem(0xFFFFFFFFu, pItem->uItemID); 2314 v10 = v19->AddItem(-1, pItem->uItemID);
2427 if ( v10 ) 2315 if ( v10 )
2428 break; 2316 break;
2429 ++v8; 2317 ++v8;
2430 if ( v8 >= 4 ) 2318 if ( v8 >= 4 )
2431 { 2319 {
2432 if ( !v21 ) 2320 if ( !v21 )
2433 { 2321 {
2434 v7->Release(); 2322 v7->Release();
2435 pIcons_LOD->_40F9C5(); 2323 pIcons_LOD->SyncLoadedFilesCount();
2436 } 2324 }
2437 goto LABEL_15; 2325 goto LABEL_15;
2438 } 2326 }
2439 } 2327 }
2440 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); 2328 memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u);
2442 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); 2330 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0);
2443 v19->PlaySound(SPEECH_60, 0); 2331 v19->PlaySound(SPEECH_60, 0);
2444 if ( !v21 ) 2332 if ( !v21 )
2445 { 2333 {
2446 v7->Release(); 2334 v7->Release();
2447 pIcons_LOD->_40F9C5(); 2335 pIcons_LOD->SyncLoadedFilesCount();
2448 } 2336 }
2449 result = 1; 2337 result = 1;
2450 } 2338 }
2451 else 2339 else
2452 { 2340 {
2595 } 2483 }
2596 2484
2597 //----- (0048CABC) -------------------------------------------------------- 2485 //----- (0048CABC) --------------------------------------------------------
2598 int Player::GetActualEndurance() 2486 int Player::GetActualEndurance()
2599 { 2487 {
2600 int v6; // ebp@5
2601
2602 uint uActualAge = GetBaseAge() + sAgeModifier; 2488 uint uActualAge = GetBaseAge() + sAgeModifier;
2603 uint uAgeingMultiplier = 100; 2489 uint uAgeingMultiplier = 100;
2604 for (uint i = 0; i < 4; ++i) 2490 for (uint i = 0; i < 4; ++i)
2605 if (uActualAge >= pAgeingTable[i]) 2491 if (uActualAge >= pAgeingTable[i])
2606 uAgeingMultiplier = pAgeingEnduranceMultiplier[i]; 2492 uAgeingMultiplier = pAgeingEnduranceMultiplier[i];
3435 } 3321 }
3436 3322
3437 //----- (0048D709) -------------------------------------------------------- 3323 //----- (0048D709) --------------------------------------------------------
3438 bool Player::WearsItem(int a1, signed int a2) 3324 bool Player::WearsItem(int a1, signed int a2)
3439 { 3325 {
3440 int v3; // edx@2 3326
3441 Player *v4; // ecx@2
3442 int v6; // esi@5 3327 int v6; // esi@5
3443 int v7; // edx@6
3444 3328
3445 if ( a2 >= 16 ) 3329 if ( a2 >= 16 )
3446 { 3330 {
3447 v6 = 0; 3331 v6 = 0;
3448 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) 3332 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6)
3673 // 4EDEC4: using guessed type int dword_4EDEC4[]; 3557 // 4EDEC4: using guessed type int dword_4EDEC4[];
3674 3558
3675 //----- (0048DBB9) -------------------------------------------------------- 3559 //----- (0048DBB9) --------------------------------------------------------
3676 void Player::Heal(int amount) 3560 void Player::Heal(int amount)
3677 { 3561 {
3678 Player *v2; // esi@1 3562 signed int max_health; // eax@3
3679 signed int v3; // eax@3 3563
3680 3564 if ( !pConditions[Condition_Eradicated] && !pConditions[Condition_Dead] )
3681 v2 = this; 3565 {
3682 if ( !this->pConditions[16] && !this->pConditions[14] ) 3566 max_health = GetMaxHealth();
3683 { 3567 if ( pConditions[Condition_Zombie] )
3684 v3 = GetMaxHealth(); 3568 max_health /= 2;
3685 if ( v2->pConditions[17] ) 3569 sHealth += amount;
3686 v3 /= 2; 3570 if ( sHealth > max_health )
3687 v2->sHealth += amount; 3571 sHealth = max_health;
3688 if ( v2->sHealth > v3 ) 3572 if ( pConditions[Condition_Unconcious] )
3689 v2->sHealth = v3; 3573 {
3690 if ( v2->pConditions[13] ) 3574 if ( sHealth > 0 )
3691 { 3575 {
3692 if ( v2->sHealth > 0 ) 3576 pConditions[Condition_Unconcious] = 0i64;
3693 {
3694 LODWORD(v2->pConditions[13]) = 0;
3695 HIDWORD(v2->pConditions[13]) = 0;
3696 } 3577 }
3697 } 3578 }
3698 } 3579 }
3699 } 3580 }
3700 3581
3709 char *v8; // ecx@9 3590 char *v8; // ecx@9
3710 int v9; // eax@9 3591 int v9; // eax@9
3711 //signed int typea; // [sp+14h] [bp+8h]@1 3592 //signed int typea; // [sp+14h] [bp+8h]@1
3712 3593
3713 v3 = this; 3594 v3 = this;
3714 this->pConditions[2] = 0i64; 3595 this->pConditions[Condition_Sleep] = 0i64;
3715 v4 = CalculateIncommingDamage(resistance, type); 3596 v4 = CalculateIncommingDamage(resistance, type);
3716 v3->sHealth -= v4; 3597 v3->sHealth -= v4;
3717 //typea = v4; 3598 //typea = v4;
3718 v5 = v3->sHealth; 3599 v5 = v3->sHealth;
3719 v6 = v5 < -10; 3600 v6 = v5 < -10;
3720 LOBYTE(v6) = v5 <= -10; 3601 LOBYTE(v6) = v5 <= -10;
3721 if ( v5 < 1 ) 3602 if ( v5 < 1 )
3722 { 3603 {
3723 if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1 3604 if ( v3->sHealth + v3->uEndurance + GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE, 0) >= 1
3724 || (signed __int64)v3->pPlayerBuffs[11].uExpireTime > 0 ) 3605 || (signed __int64)v3->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 )
3725 { 3606 {
3726 SetCondition(0xDu, 0); 3607 SetCondition(0xDu, 0);
3727 } 3608 }
3728 else 3609 else
3729 { 3610 {
3768 ItemGen *v13; // eax@9 3649 ItemGen *v13; // eax@9
3769 int v14; // edx@16 3650 int v14; // edx@16
3770 unsigned int v15; // edx@17 3651 unsigned int v15; // edx@17
3771 int v16; // edx@26 3652 int v16; // edx@26
3772 unsigned int v17; // edx@27 3653 unsigned int v17; // edx@27
3773 Player *v18; // ecx@32
3774 signed int v19; // edx@38 3654 signed int v19; // edx@38
3775 int *v20; // ecx@38 3655 int *v20; // ecx@38
3776 signed int v21; // eax@40 3656 signed int v21; // eax@40
3777 int v22; // eax@49 3657 int v22; // eax@49
3778 signed int v23; // ebx@49 3658 signed int v23; // ebx@49
4152 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; 4032 weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery;
4153 } 4033 }
4154 else 4034 else
4155 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; 4035 weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType];
4156 } 4036 }
4157 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) // ADD: shield check because shield recovery is added later and can be accidentally doubled 4037 if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD)
4038 // ADD: shield check because shield recovery is added later and can be accidentally doubled
4158 { 4039 {
4159 auto v12 = &pInventoryItems[pEquipment.uShield - 1]; 4040 auto v12 = &pInventoryItems[pEquipment.uShield - 1];
4160 auto v12_desc = &pItemsTable->pItems[v12->uItemID]; 4041 auto v12_desc = &pItemsTable->pItems[v12->uItemID];
4161 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) 4042 if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery)
4162 { 4043 {
4494 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2) 4375 int Player::GetActualResistance(enum CHARACTER_ATTRIBUTE_TYPE a2)
4495 { 4376 {
4496 signed int v2; // edi@1 4377 signed int v2; // edi@1
4497 Player *v3; // esi@1 4378 Player *v3; // esi@1
4498 enum CHARACTER_RACE v4; // ebx@1 4379 enum CHARACTER_RACE v4; // ebx@1
4499 Player *v5; // ecx@8
4500 char v6; // zf@18 4380 char v6; // zf@18
4501 int v7; // ebx@28 4381 int v7; // ebx@28
4502 int result; // eax@28 4382 int result; // eax@28
4503 signed int v9; // [sp+10h] [bp-8h]@1 4383 signed int v9; // [sp+10h] [bp-8h]@1
4504 signed int v10; // [sp+14h] [bp-4h]@1 4384 signed int v10; // [sp+14h] [bp-4h]@1
5643 } 5523 }
5644 return result; 5524 return result;
5645 } 5525 }
5646 5526
5647 //----- (0048F882) -------------------------------------------------------- 5527 //----- (0048F882) --------------------------------------------------------
5648 char Player::GetActualSkillLevel(PLAYER_SKILL_TYPE uSkillType) 5528 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType )
5649 { 5529 {
5650 signed int v2; // esi@1 5530 signed int v2; // esi@1
5651 unsigned __int16 v3; // ax@126 5531 unsigned __int16 v3; // ax@126
5652 char result; // al@127 5532 char result; // al@127
5653 unsigned int v5; // [sp-4h] [bp-14h]@13 5533 unsigned int v5; // [sp-4h] [bp-14h]@13
5654 signed int v6; // [sp-4h] [bp-14h]@27 5534 signed int v6; // [sp-4h] [bp-14h]@27
5874 } 5754 }
5875 break; 5755 break;
5876 } 5756 }
5877 5757
5878 v3 = pActiveSkills[uSkillType]; 5758 v3 = pActiveSkills[uSkillType];
5879 if ( v2 + (pActiveSkills[uSkillType] & 0x3F) < 60 ) 5759 if ( v2 + (v3 & 0x3F) < 60 )
5880 result = v2 + v3; 5760 result = v2 + v3;
5881 else 5761 else
5882 result = v3 & 0xFC | 0x3C; 5762 result = v3 & 0xFFFC | 0x3C; //al
5883 return result; 5763 return result;
5884 } 5764 }
5885 5765
5886 //----- (0048FC00) -------------------------------------------------------- 5766 //----- (0048FC00) --------------------------------------------------------
5887 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2) 5767 int Player::GetSkillBonus(enum CHARACTER_ATTRIBUTE_TYPE a2)
6342 // 22 underwater suits (unused) 6222 // 22 underwater suits (unused)
6343 // 23 zombie male 6223 // 23 zombie male
6344 // 24 zombie female 6224 // 24 zombie female
6345 enum CHARACTER_RACE Player::GetRace() 6225 enum CHARACTER_RACE Player::GetRace()
6346 { 6226 {
6347 if ( uFace > 15 ) 6227 if ( uCurrentFace > 15 )
6348 { 6228 {
6349 if ( uFace >= 16 && uFace <= 19 ) 6229 if ( uCurrentFace >= 16 && uCurrentFace <= 19 )
6350 return CHARACTER_RACE_GOBLIN; 6230 return CHARACTER_RACE_GOBLIN;
6351 } 6231 }
6352 else 6232 else
6353 { 6233 {
6354 if ( uFace >= 12 ) 6234 if ( uCurrentFace >= 12 )
6355 { 6235 {
6356 return CHARACTER_RACE_DWARF; 6236 return CHARACTER_RACE_DWARF;
6357 } 6237 }
6358 else 6238 else
6359 { 6239 {
6360 if ( uFace >= 0 ) 6240
6361 { 6241 if ( uCurrentFace <= 7 )
6362 if ( uFace <= 7 )
6363 { 6242 {
6364 return CHARACTER_RACE_HUMAN; 6243 return CHARACTER_RACE_HUMAN;
6365 } 6244 }
6366 else 6245 else
6367 { 6246 {
6368 if ( uFace <= 11 ) 6247 if ( uCurrentFace <= 11 )
6369 return CHARACTER_RACE_ELF; 6248 return CHARACTER_RACE_ELF;
6370 } 6249 }
6371 }
6372 } 6250 }
6373 } 6251 }
6374 return CHARACTER_RACE_HUMAN; 6252 return CHARACTER_RACE_HUMAN;
6375 } 6253 }
6376 6254
6910 int attribute_value; // edx@1 6788 int attribute_value; // edx@1
6911 unsigned __int8 pBaseAttrValue; // of@1 6789 unsigned __int8 pBaseAttrValue; // of@1
6912 __int16 uGreen; // [sp+8h] [bp-8h]@1 6790 __int16 uGreen; // [sp+8h] [bp-8h]@1
6913 __int16 uRed; // [sp+Ch] [bp-4h]@1 6791 __int16 uRed; // [sp+Ch] [bp-4h]@1
6914 6792
6915 uRed = TargetColor(0xFFu, 0x23u, 0); 6793 uRed = TargetColor(255, 35, 0);
6916 uGreen = TargetColor(0, 0xFFu, 0); 6794 uGreen = TargetColor(0, 255, 0);
6917 uWhite = TargetColor(0xFFu, 0xFFu, 0xFFu); 6795 uWhite = TargetColor(255, 255, 255);
6918 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue; 6796 pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue;
6919 6797
6920 switch (uStat) 6798 switch (uStat)
6921 { 6799 {
6922 case 0: attribute_value = uMight; break; 6800 case 0: attribute_value = uMight; break;
6937 } 6815 }
6938 6816
6939 //----- (004908A8) -------------------------------------------------------- 6817 //----- (004908A8) --------------------------------------------------------
6940 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime) 6818 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime)
6941 { 6819 {
6942 unsigned __int64 *result; // eax@1 6820 if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) )
6943 6821 {
6944 result = (unsigned __int64 *)((char *)this + 8 * uCondition); 6822 pConditions[uCondition]=0i64;
6945 if ( *result && (signed __int64)uTime < (signed __int64)*result ) 6823 return true;
6946 {
6947 *(int *)result = 0;
6948 *((int *)result + 1) = 0;
6949 LOBYTE(result) = 1;
6950 } 6824 }
6951 else 6825 else
6952 { 6826 return false;
6953 LOBYTE(result) = 0;
6954 }
6955 return (bool)result;
6956 } 6827 }
6957 6828
6958 //----- (004680ED) -------------------------------------------------------- 6829 //----- (004680ED) --------------------------------------------------------
6959 void Player::UseItem_DrinkPotion_etc(signed int a2, int a3) 6830 void Player::UseItem_DrinkPotion_etc(signed int a2, int a3)
6960 { 6831 {
7791 dword_50C9EC[3 * dword_50C9E8] = 146; 7662 dword_50C9EC[3 * dword_50C9E8] = 146;
7792 dword_50C9EC[3 * dword_50C9E8 + 1] = v24; 7663 dword_50C9EC[3 * dword_50C9E8 + 1] = v24;
7793 dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1; 7664 dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1;
7794 ++dword_50C9E8; 7665 ++dword_50C9E8;
7795 }*/ 7666 }*/
7796 pMessageQueue_50CBD0->AddMessage(UIMSG_92, 0, 0); 7667 pMessageQueue_50C9E8->AddMessage(UIMSG_92, v24, a2 - 1);
7797 if ( pCurrentScreen 7668 if ( pCurrentScreen
7798 && pGUIWindow_CurrentMenu 7669 && pGUIWindow_CurrentMenu
7799 && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) 7670 && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
7800 //&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 7671 //&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
7801 { 7672 {
8647 if ( v4->sResEarthBase < 20 ) 8518 if ( v4->sResEarthBase < 20 )
8648 v4->sResEarthBase = 20; 8519 v4->sResEarthBase = 20;
8649 v4->sResMindBase = 200; 8520 v4->sResMindBase = 200;
8650 v4->sResBodyBase = 200; 8521 v4->sResBodyBase = 200;
8651 v11 = v4->GetSexByVoice(); 8522 v11 = v4->GetSexByVoice();
8652 v4->field_1924 = v4->uVoiceID; 8523 v4->uPrevVoiceID = v4->uVoiceID;
8653 v4->field_1928 = v4->uFace; 8524 v4->uPrevFace = v4->uCurrentFace;
8654 if ( v11 ) 8525 if ( v11 )
8655 { 8526 {
8656 v4->uFace = 21; 8527 v4->uCurrentFace = 21;
8657 v4->uVoiceID = 21; 8528 v4->uVoiceID = 21;
8658 } 8529 }
8659 else 8530 else
8660 { 8531 {
8661 v4->uFace = 20; 8532 v4->uCurrentFace = 20;
8662 v4->uVoiceID = 20; 8533 v4->uVoiceID = 20;
8663 } 8534 }
8664 ReloadPlayerPortraits(currPlayerId, v4->uFace); 8535 ReloadPlayerPortraits(currPlayerId, v4->uCurrentFace);
8665 goto LABEL_124; 8536 goto LABEL_124;
8666 } 8537 }
8667 LABEL_64: 8538 LABEL_64:
8668 this->uMightBonus = (unsigned __int8)var_value; 8539 this->uMightBonus = (unsigned __int8)var_value;
8669 LABEL_111: 8540 LABEL_111: