comparison Player.cpp @ 1619:eceabd56f399

Player::EquipBody cleaned up
author Grumpy7
date Sat, 14 Sep 2013 19:09:44 +0200
parents f5b13e6be493
children 61ea994a1812
comparison
equal deleted inserted replaced
1618:f5b13e6be493 1619:eceabd56f399
5650 } 5650 }
5651 if ( var_type <= VAR_Counter8 ) 5651 if ( var_type <= VAR_Counter8 )
5652 { 5652 {
5653 if ( (signed int)var_type >= 0xF5 ) 5653 if ( (signed int)var_type >= 0xF5 )
5654 { 5654 {
5655 __debugbreak(); //how do I get here?
5655 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); 5656 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed);
5656 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); 5657 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed);
5657 } 5658 }
5658 else 5659 else
5659 { 5660 {
5660 switch ( var_type ) 5661 switch ( var_type )
5661 { 5662 {
5662 case VAR_MonthEquals|VAR_CurrentSP: 5663 case VAR_MonthEquals|VAR_CurrentSP:
5664 __debugbreak(); //how do I get here?
5663 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); 5665 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u);
5664 break; 5666 break;
5665 case VAR_NPCs2: 5667 case VAR_NPCs2:
5668 __debugbreak(); //how do I get here?
5666 pParty->field_709 = 0; 5669 pParty->field_709 = 0;
5667 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; 5670 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u;
5668 pParty->CountHirelings(); 5671 pParty->CountHirelings();
5669 viewparams->bRedrawGameUI = true; 5672 viewparams->bRedrawGameUI = true;
5670 break; 5673 break;
5677 } 5680 }
5678 if ( var_type < VAR_Counter9 ) 5681 if ( var_type < VAR_Counter9 )
5679 return; 5682 return;
5680 if ( (signed int)var_type <= 0x112 ) 5683 if ( (signed int)var_type <= 0x112 )
5681 { 5684 {
5685 __debugbreak(); //how do I get here?
5682 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); 5686 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed);
5683 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); 5687 *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed);
5684 } 5688 }
5685 else 5689 else
5686 { 5690 {
5699 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) 5703 || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22])
5700 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), 5704 || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed),
5701 v23 = pStorylineText->StoreLine[v22].pText == 0,//*(&pStorylineText->field_0 + 3 * v22) == 0, 5705 v23 = pStorylineText->StoreLine[v22].pText == 0,//*(&pStorylineText->field_0 + 3 * v22) == 0,
5702 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), 5706 pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed),
5703 v23) ) 5707 v23) )
5708 __debugbreak(); //how do I get here?
5704 return; 5709 return;
5705 bFlashHistoryBook = 1; 5710 bFlashHistoryBook = 1;
5706 } 5711 }
5707 v25 = 8 * currPlayerId + 400; 5712 v25 = 8 * currPlayerId + 400;
5708 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); 5713 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
7322 7327
7323 7328
7324 //----- (00467E7F) -------------------------------------------------------- 7329 //----- (00467E7F) --------------------------------------------------------
7325 void Player::EquipBody(ITEM_EQUIP_TYPE uEquipType) 7330 void Player::EquipBody(ITEM_EQUIP_TYPE uEquipType)
7326 { 7331 {
7327 //unsigned int v1; // esi@1
7328 int v2; // ebx@1 7332 int v2; // ebx@1
7329 Player *v3; // eax@1 7333 Player *v3; // eax@1
7330 int v4; // edx@1 7334 int v4; // edx@1
7331 int v5; // esi@2
7332 //int v6; // eax@2
7333 int v7; // eax@3 7335 int v7; // eax@3
7334 ItemGen _this; // [sp+Ch] [bp-30h]@1 7336 ItemGen tempPickedItem; // [sp+Ch] [bp-30h]@1
7335 //Player *v9; // [sp+30h] [bp-Ch]@1 7337 unsigned int *v11; // [sp+38h] [bp-4h]@1
7336 int v10; // [sp+34h] [bp-8h]@1 7338
7337 int *v11; // [sp+38h] [bp-4h]@1 7339 tempPickedItem.Reset();
7338
7339
7340 _this.Reset();
7341 v2 = pEquipTypeToBodyAnchor[uEquipType]; 7340 v2 = pEquipTypeToBodyAnchor[uEquipType];
7342 v3 = pPlayers[uActiveCharacter]; 7341 v3 = pPlayers[uActiveCharacter];
7343 v11 = (int *)&v3->pEquipment.pIndices[v2]; 7342 v11 = &v3->pEquipment.pIndices[v2];
7344 v4 = *v11; 7343 v4 = *v11;
7345 v10 = *v11; 7344 if ( v4 )
7346 if ( v10 ) 7345 {
7347 { 7346 memcpy(&tempPickedItem, &pParty->pPickedItem, sizeof(tempPickedItem));
7348 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 7347 v3->pInventoryItemList[v4 - 1].uBodyAnchor = 0;
7349 v5 = (int)((char *)v3 + 4 * (9 * v4 - 9));
7350 *(char *)(v5 + 556) = 0;
7351 pParty->pPickedItem.Reset(); 7348 pParty->pPickedItem.Reset();
7352 pParty->SetHoldingItem((ItemGen *)(v5 + 532)); 7349 pParty->SetHoldingItem(&v3->pInventoryItemList[v4 - 1]);
7353 _this.uBodyAnchor = v2 + 1; 7350 tempPickedItem.uBodyAnchor = v2 + 1;
7354 memcpy((void *)(v5 + 532), &_this, 0x24u); 7351 memcpy(&v3->pInventoryItemList[v4 - 1], &tempPickedItem, sizeof(ItemGen));
7355 *v11 = v10; 7352 *v11 = v4;
7356 } 7353 }
7357 else 7354 else
7358 { 7355 {
7359 v7 = v3->FindFreeInventoryListSlot(); 7356 v7 = v3->FindFreeInventoryListSlot();
7360 if (v7 >= 0) 7357 if (v7 >= 0)
7361 { 7358 {
7362 pParty->pPickedItem.uBodyAnchor = v2 + 1; 7359 pParty->pPickedItem.uBodyAnchor = v2 + 1;
7363 memcpy(&v3->pInventoryItemList[v7], &pParty->pPickedItem, sizeof(v3->pInventoryItemList[v7])); 7360 memcpy(&v3->pInventoryItemList[v7], &pParty->pPickedItem, sizeof(ItemGen));
7364 *v11 = v7 + 1; 7361 *v11 = v7 + 1;
7365 pMouse->RemoveHoldingItem(); 7362 pMouse->RemoveHoldingItem();
7366 } 7363 }
7367 } 7364 }
7368 } 7365 }