comparison Player.cpp @ 1620:61ea994a1812

sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped to Player::HasUnderwaterSuitEquipped, sub_43EDB9_get_some_race_sex_relation_2 to ShouldLoadTexturesForRaceAndGender, Player_has_item to Player::HasItem
author Grumpy7
date Sun, 15 Sep 2013 02:20:06 +0200
parents eceabd56f399
children 511cd6dd1048
comparison
equal deleted inserted replaced
1619:eceabd56f399 1620:61ea994a1812
7366 7366
7367 7367
7368 //----- (0049387A) -------------------------------------------------------- 7368 //----- (0049387A) --------------------------------------------------------
7369 int CycleCharacter(bool backwards) 7369 int CycleCharacter(bool backwards)
7370 { 7370 {
7371 signed int result; // eax@1 7371 const int PARTYSIZE = 4;
7372 signed int v2; // ecx@2 7372 int valToAdd = backwards ? (PARTYSIZE - 2) : 0;
7373 signed int v3; // ecx@8 7373 int mult = backwards ? -1 : 1;
7374 7374
7375 result = uActiveCharacter; 7375 for (int i = 0; i < (PARTYSIZE - 1); i++)
7376 if ( backwards ) 7376 {
7377 { 7377 int currCharId = ((uActiveCharacter + mult * i + valToAdd) % PARTYSIZE) + 1;
7378 v2 = 0; 7378 if ( pPlayers[currCharId]->uTimeToRecovery == 0 )
7379 while ( 1 ) 7379 {
7380 { 7380 return currCharId;
7381 --result; 7381 }
7382 if ( result < 1 ) 7382 }
7383 result = 4; 7383 return uActiveCharacter;
7384 if ( !pPlayers[result]->uTimeToRecovery ) 7384 }
7385 break; 7385
7386 ++v2;
7387 if ( v2 >= 4 )
7388 return uActiveCharacter;
7389 }
7390 }
7391 else
7392 {
7393 v3 = 0;
7394 while ( 1 )
7395 {
7396 ++result;
7397 if ( result > 4 )
7398 result = 1;
7399 if ( !pPlayers[result]->uTimeToRecovery )
7400 break;
7401 ++v3;
7402 if ( v3 >= 4 )
7403 return uActiveCharacter;
7404 }
7405 }
7406 return result;
7407 }
7408 //----- (0043EE77) -------------------------------------------------------- 7386 //----- (0043EE77) --------------------------------------------------------
7409 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1) 7387 bool Player::HasUnderwaterSuitEquipped() //the original function took the player number as a parameter. if it was 0, the whole party was checked. calls with the parameter 0 have been changed to calls to this for every player
7410 { 7388 {
7411 bool result; // eax@0 7389 if (this->pEquipment.uArmor == 0 || this->pInventoryItemList[this->pEquipment.uArmor].uItemID != 604)
7412 Player *v2; // edx@3 7390 {
7413 int v3; // ecx@3 7391 return false;
7414 Player **pPlayers; // esi@8 7392 }
7415 //bool item_flag; 7393 return true;
7416 Player *v6; // edx@9 7394 }
7417
7418 //if ( a1 < 1 || a1 > 4 )
7419 //{
7420 //if ( !a1 )
7421 //{
7422 //pPlayers = &::pPlayers[1];
7423 //v5 = 604;
7424 //while ( 1 )
7425 Assert ( a1 > 0 && a1 < 5 );
7426 for ( uint i = 1; i < 5; ++i )
7427 {
7428 //item_flag = Player_has_item(604, *pPlayers, 0);
7429 if ( !Player_has_item(604, ::pPlayers[i], 0) )
7430 return false;
7431 //__debugbreak(); // player.cpp(8748): warning C4700: uninitialized local variable 'v6' used
7432 //result = ::pPlayers[i]->pEquipment.uArmor;
7433 if ( !::pPlayers[i]->pEquipment.uArmor )
7434 return false;
7435 //result *= 9;
7436 if (::pPlayers[i]->pEquippedItems[::pPlayers[i]->pEquipment.uArmor].uItemID != 604 )
7437 return false;
7438 //++pPlayers;
7439 //if ( (signed int)pPlayers >= (signed int)&qword_A750D8 )
7440 //return true;
7441 }
7442 return true;
7443 }
7444 7395
7445 //----- (0043EE15) -------------------------------------------------------- 7396 //----- (0043EE15) --------------------------------------------------------
7446 bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3) 7397 bool Player::HasItem( unsigned int uItemID, char a3 )
7447 { 7398 {
7448 if ( !a3 || pParty->pPickedItem.uItemID != uItemID ) 7399 if ( !a3 || pParty->pPickedItem.uItemID != uItemID )
7449 { 7400 {
7450 for ( uint i = 0; i < 126; ++i ) 7401 for ( uint i = 0; i < 126; ++i )
7451 { 7402 {
7452 if ( pPlayer->pInventoryMatrix[i] > 0 ) 7403 if ( this->pInventoryMatrix[i] > 0 )
7453 { 7404 {
7454 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pInventoryMatrix[i] - 1].uItemID == uItemID ) 7405 if ( (unsigned int)this->pInventoryItemList[this->pInventoryMatrix[i] - 1].uItemID == uItemID )
7455 return true; 7406 return true;
7456 } 7407 }
7457 } 7408 }
7458 for ( uint i = 0; i < 16; ++i ) 7409 for ( uint i = 0; i < 16; ++i )
7459 { 7410 {
7460 if ( pPlayer->pEquipment.pIndices[i] ) 7411 if ( this->pEquipment.pIndices[i] )
7461 { 7412 {
7462 if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) 7413 if ( (unsigned int)this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID == uItemID )
7463 return true; 7414 return true;
7464 } 7415 }
7465 } 7416 }
7466 } 7417 }
7467 return false; 7418 return false;
7468 } 7419 }
7469 //----- (0043EDB9) -------------------------------------------------------- 7420 //----- (0043EDB9) --------------------------------------------------------
7470 bool sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1) 7421 bool ShouldLoadTexturesForRaceAndGender(unsigned int _this)
7471 { 7422 {
7472 unsigned int pNum; // ebp@1 7423 CHARACTER_RACE race; // edi@2
7473 Player **pPlayer; // ebx@1 7424 PLAYER_SEX sex; // eax@2
7474 Player *pPlayer2; // esi@2 7425
7475 enum CHARACTER_RACE pRace; // edi@2 7426 for (int i = 1; i <= 4; i++)
7476 bool pSex; // eax@2 7427 {
7477 char v6; // zf@7 7428 race = pPlayers[i]->GetRace();
7478 7429 sex = pPlayers[i]->GetSexByVoice();
7479 //pPlayer = &pPlayers[1]; 7430 switch(_this)
7480 /*pNum = a1; 7431 {
7481 7432 case 0:
7482 while ( 1 ) 7433 if (( race == CHARACTER_RACE_HUMAN || race == CHARACTER_RACE_ELF || race == CHARACTER_RACE_GOBLIN ) && sex == SEX_MALE )
7483 { 7434 return true;
7484 pPlayer2 = *pPlayer; 7435 break;
7485 pRace = pPlayer2->GetRace(); 7436 case 1:
7486 pSex = pPlayer2->GetSexByVoice(); 7437 if (( race == CHARACTER_RACE_HUMAN || race == CHARACTER_RACE_ELF || race == CHARACTER_RACE_GOBLIN ) && sex == SEX_FEMALE )
7487 if ( !pRace ) 7438 return true;
7488 break; 7439 break;
7489 if ( pRace == 1 || pRace == 2 ) 7440 case 2:
7490 break; 7441 if ( race == CHARACTER_RACE_DWARF && sex == SEX_MALE )
7491 if ( !pSex && pNum == 2 )// 7442 return true;
7492 //goto LABEL_15; 7443 break;
7493 { 7444 case 3:
7494 pSex = 1; 7445 if ( race == CHARACTER_RACE_DWARF && sex == SEX_FEMALE )
7495 return pSex; 7446 return true;
7496 } 7447 break;
7497 v6 = pNum == 3;// 7448 }
7498 LABEL_11: 7449 }
7499 if ( v6 ) 7450 return false;
7500 //goto LABEL_15;
7501 {
7502 pSex = 1;
7503 return pSex;
7504 }
7505 ++pPlayer;
7506 if ( (signed int)pPlayer >= (signed int)&qword_A750D8 )//
7507 {
7508 pSex = 0;
7509 return pSex;
7510 }
7511 }
7512 if ( pSex || pNum )
7513 {
7514 v6 = pNum == 1;
7515 goto LABEL_11;
7516 }
7517 //LABEL_15:
7518 pSex = 1;
7519 return pSex;*/
7520 for (uint i = 1; i <= 4; ++i)
7521 {
7522 pRace = pPlayers[i]->GetRace();
7523 pSex = pPlayers[i]->GetSexByVoice();
7524 if (pRace == 0 || pRace == 1 || pRace == 2 || pSex == 0 )
7525 return 1;
7526 }
7527 return 0;
7528 } 7451 }
7529 //----- (0043ED6F) -------------------------------------------------------- 7452 //----- (0043ED6F) --------------------------------------------------------
7530 bool _43ED6F_check_party_races(bool a1) 7453 bool _43ED6F_check_party_races(bool a1)
7531 { 7454 {
7532 bool v6; // zf@5 7455 bool v6; // zf@5