comparison mm7_6.cpp @ 515:cb0ad52d6a26

LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people) Some object-related subs moved to SpriteObject.cpp
author Nomad
date Fri, 01 Mar 2013 21:13:12 +0200
parents cc4b7981c1bb
children 35f28d4c0ff9
comparison
equal deleted inserted replaced
514:0bbc39457b25 515:cb0ad52d6a26
18 #include "Allocator.h" 18 #include "Allocator.h"
19 #include "Events.h" 19 #include "Events.h"
20 #include "Viewport.h" 20 #include "Viewport.h"
21 #include "FrameTableInc.h" 21 #include "FrameTableInc.h"
22 #include "Math.h" 22 #include "Math.h"
23 #include "LayingItem.h" 23 #include "SpriteObject.h"
24 #include "ObjectList.h" 24 #include "ObjectList.h"
25 #include "Chest.h" 25 #include "Chest.h"
26 #include "PaletteManager.h" 26 #include "PaletteManager.h"
27 #include "DecorationList.h" 27 #include "DecorationList.h"
28 #include "SaveLoad.h" 28 #include "SaveLoad.h"
2576 //signed __int64 v26; // qax@100 2576 //signed __int64 v26; // qax@100
2577 //char *v27; // ecx@100 2577 //char *v27; // ecx@100
2578 //unsigned __int64 v28; // qax@102 2578 //unsigned __int64 v28; // qax@102
2579 int v29; // ecx@105 2579 int v29; // ecx@105
2580 int v30; // ecx@106 2580 int v30; // ecx@106
2581 int v31; // eax@112 2581 //int v31; // eax@112
2582 int v32; // eax@112 2582 //int v32; // eax@112
2583 char *v33; // edx@113 2583 //char *v33; // edx@113
2584 int v34; // eax@121 2584 int v34; // eax@121
2585 int v35; // eax@123 2585 int v35; // eax@123
2586 int v36; // edx@125 2586 int v36; // edx@125
2587 int v37; // eax@129 2587 int v37; // eax@129
2588 signed int v38; // edi@129 2588 signed int v38; // edi@129
3267 __int64 v717; // [sp+DC4h] [bp-C0h]@271 3267 __int64 v717; // [sp+DC4h] [bp-C0h]@271
3268 float v718; // [sp+DCCh] [bp-B8h]@176 3268 float v718; // [sp+DCCh] [bp-B8h]@176
3269 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 3269 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53
3270 char *y; // [sp+DD4h] [bp-B0h]@325 3270 char *y; // [sp+DD4h] [bp-B0h]@325
3271 int v721; // [sp+DD8h] [bp-ACh]@163 3271 int v721; // [sp+DD8h] [bp-ACh]@163
3272 //LayingItem a1; // [sp+DDCh] [bp-A8h]@1 3272 //SpriteObject a1; // [sp+DDCh] [bp-A8h]@1
3273 int v723; // [sp+E4Ch] [bp-38h]@1 3273 int v723; // [sp+E4Ch] [bp-38h]@1
3274 ItemGen *_this; // [sp+E50h] [bp-34h]@23 3274 ItemGen *_this; // [sp+E50h] [bp-34h]@23
3275 float v725; // [sp+E54h] [bp-30h]@23 3275 float v725; // [sp+E54h] [bp-30h]@23
3276 Player *v726; // [sp+E58h] [bp-2Ch]@131 3276 Player *v726; // [sp+E58h] [bp-2Ch]@131
3277 int v726b; 3277 int v726b;
3289 3289
3290 auto ecx0 = this; 3290 auto ecx0 = this;
3291 3291
3292 v711 = ecx0; 3292 v711 = ecx0;
3293 3293
3294 LayingItem a1; // [sp+DDCh] [bp-A8h]@1 3294 SpriteObject a1; // [sp+DDCh] [bp-A8h]@1
3295 //LayingItem::LayingItem(&a1); 3295 //SpriteObject::SpriteObject(&a1);
3296 3296
3297 //v1 = 0; 3297 //v1 = 0;
3298 v2 = 0; 3298 v2 = 0;
3299 amount = 0; 3299 amount = 0;
3300 LODWORD(v733) = 0; 3300 LODWORD(v733) = 0;
3334 if ( pMouse->uPointingObjectID && (v6 & 7) == OBJECT_Actor && pActors[v6 >> 3].CanAct() ) 3334 if ( pMouse->uPointingObjectID && (v6 & 7) == OBJECT_Actor && pActors[v6 >> 3].CanAct() )
3335 a2 = pMouse->uPointingObjectID; 3335 a2 = pMouse->uPointingObjectID;
3336 } 3336 }
3337 3337
3338 3338
3339 a1.uItemType = stru_4E3ACC[v3->spellnum].field_0; 3339 a1.uType = stru_4E3ACC[v3->spellnum].field_0;
3340 if (a1.uItemType) 3340 if (a1.uType)
3341 { 3341 {
3342 if ( (a2 & 7) == OBJECT_Actor) 3342 if ( (a2 & 7) == OBJECT_Actor)
3343 { 3343 {
3344 memcpy(&v715, Actor::GetDirectionInfo((8 * v3->uPlayerID + 8) | OBJECT_Player, a2, &a3, 0), sizeof(v715)); 3344 memcpy(&v715, Actor::GetDirectionInfo((8 * v3->uPlayerID + 8) | OBJECT_Player, a2, &a3, 0), sizeof(v715));
3345 v2 = v723; 3345 v2 = v723;
3458 return; 3458 return;
3459 } 3459 }
3460 3460
3461 switch ( v3->spellnum ) 3461 switch ( v3->spellnum )
3462 { 3462 {
3463 case SPELL_101:
3464 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow");
3463 case SPELL_BOW_ARROW: 3465 case SPELL_BOW_ARROW:
3464 case SPELL_101:
3465 v17 = pPlayer; 3466 v17 = pPlayer;
3466 _this = (ItemGen *)1; 3467 _this = (ItemGen *)1;
3467 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) 3468 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 )
3468 _this = (ItemGen *)2; 3469 _this = (ItemGen *)2;
3469 sRecoveryTime = v17->GetAttackRecoveryTime(1); 3470 sRecoveryTime = v17->GetAttackRecoveryTime(1);
3470 a1.stru_24.Reset(); 3471 a1.stru_24.Reset();
3471 v18 = v3->spellnum; 3472 v18 = v3->spellnum;
3472 a1.field_4C = v2; 3473 a1.field_4C = v2;
3473 a1.field_48 = v18; 3474 a1.field_48 = v18;
3474 a1.field_50 = v731; 3475 a1.field_50 = v731;
3475 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 3476 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
3476 if ( v17->WearsItem(510, 2) ) 3477 if ( v17->WearsItem(510, 2) )
3477 a1.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); 3478 a1.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u);
3478 a1.vPosition.x = pParty->vPosition.x; 3479 a1.vPosition.x = pParty->vPosition.x;
3479 a1.vPosition.y = pParty->vPosition.y; 3480 a1.vPosition.y = pParty->vPosition.y;
3480 a1.uAttributes = 0; 3481 a1.uAttributes = 0;
3511 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); 3512 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0);
3512 a1.stru_24.Reset(); 3513 a1.stru_24.Reset();
3513 a1.field_48 = v3->spellnum; 3514 a1.field_48 = v3->spellnum;
3514 a1.field_4C = v723; 3515 a1.field_4C = v723;
3515 a1.field_50 = v731; 3516 a1.field_50 = v731;
3516 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 3517 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
3517 a1.vPosition.x = pParty->vPosition.x; 3518 a1.vPosition.x = pParty->vPosition.x;
3518 a1.vPosition.y = pParty->vPosition.y; 3519 a1.vPosition.y = pParty->vPosition.y;
3519 a1.uAttributes = 0; 3520 a1.uAttributes = 0;
3520 a1.uSpriteFrameID = 0; 3521 a1.uSpriteFrameID = 0;
3521 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; 3522 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
3563 goto play_sound_and_continue; 3564 goto play_sound_and_continue;
3564 3565
3565 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); 3566 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0);
3566 goto LABEL_1056; 3567 goto LABEL_1056;
3567 3568
3568 case 7: 3569 case SPELL_FIRE_FIRE_SPIKE:
3569 v29 = v12 - 2; 3570 v29 = v12 - 2;
3570 if ( v29 ) 3571 if ( v29 )
3571 { 3572 {
3572 v30 = v29 - 1; 3573 v30 = v29 - 1;
3573 if ( v30 ) 3574 if ( v30 )
3584 } 3585 }
3585 else 3586 else
3586 { 3587 {
3587 amount = 5; 3588 amount = 5;
3588 } 3589 }
3589 v31 = v3->uPlayerID; 3590 //v31 = v3->uPlayerID;
3591 //v32 = 8 * v31;
3592 //LOBYTE(v32) = v32 | OBJECT_Player;
3593
3594 //if ( (signed int)uNumSpriteObjects > 0 )
3590 HIDWORD(v733) = 0; 3595 HIDWORD(v733) = 0;
3591 v32 = 8 * v31; 3596 for (uint i = 0; i < uNumSpriteObjects; ++i)
3592 LOBYTE(v32) = v32 | OBJECT_Player; 3597 {
3593 if ( (signed int)uNumLayingItems > 0 ) 3598 auto object = pSpriteObjects + i;
3594 { 3599 if (object->uType && object->field_48 == 7 && object->field_58_pid == 8 * (int)v3->uPlayerID | OBJECT_Player)
3595 v33 = (char *)&pLayingItems[0].field_48; 3600 ++HIDWORD(v733);
3596 v730 = uNumLayingItems; 3601 /*v33 = (char *)&pSpriteObjects[0].field_48;
3602 v730 = uNumSpriteObjects;
3597 do 3603 do
3598 { 3604 {
3599 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) 3605 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 )
3600 ++HIDWORD(v733); 3606 ++HIDWORD(v733);
3601 v33 += 112; 3607 v33 += 112;
3602 --v730; 3608 --v730;
3603 } 3609 }
3604 while ( v730 ); 3610 while ( v730 );*/
3605 } 3611 }
3606 if ( SHIDWORD(v733) > amount ) 3612 if ( SHIDWORD(v733) > amount )
3607 goto LABEL_200; 3613 goto LABEL_200;
3608 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3614 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3609 goto play_sound_and_continue; 3615 goto play_sound_and_continue;
3616
3610 a1.stru_24.Reset(); 3617 a1.stru_24.Reset();
3611 a1.field_48 = v3->spellnum; 3618 a1.field_48 = v3->spellnum;
3612 a1.field_4C = v2; 3619 a1.field_4C = v2;
3613 a1.field_50 = v731; 3620 a1.field_50 = v731;
3614 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 3621 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
3615 a1.vPosition.y = pParty->vPosition.y; 3622 a1.vPosition.y = pParty->vPosition.y;
3616 a1.vPosition.x = pParty->vPosition.x; 3623 a1.vPosition.x = pParty->vPosition.x;
3617 a1.uAttributes = 0; 3624 a1.uAttributes = 0;
3618 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; 3625 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
3619 a1.uSectorID = pIndoor->GetSector( 3626 a1.uSectorID = pIndoor->GetSector(
3646 v697 = 0; 3653 v697 = 0;
3647 a1.stru_24.Reset(); 3654 a1.stru_24.Reset();
3648 a1.field_48 = v3->spellnum; 3655 a1.field_48 = v3->spellnum;
3649 a1.field_4C = v2; 3656 a1.field_4C = v2;
3650 a1.field_50 = v731; 3657 a1.field_50 = v731;
3651 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 3658 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
3652 a1.uAttributes = 0; 3659 a1.uAttributes = 0;
3653 a1.uSectorID = 0; 3660 a1.uSectorID = 0;
3654 a1.uSpriteFrameID = 0; 3661 a1.uSpriteFrameID = 0;
3655 v37 = v3->uPlayerID; 3662 v37 = v3->uPlayerID;
3656 a1.field_60_distance_related_prolly_lod = 0; 3663 a1.field_60_distance_related_prolly_lod = 0;
3685 v704 = 0; 3692 v704 = 0;
3686 a1.stru_24.Reset(); 3693 a1.stru_24.Reset();
3687 a1.field_48 = v3->spellnum; 3694 a1.field_48 = v3->spellnum;
3688 a1.field_4C = v2; 3695 a1.field_4C = v2;
3689 a1.field_50 = v731; 3696 a1.field_50 = v731;
3690 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 3697 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
3691 a1.uAttributes = 0; 3698 a1.uAttributes = 0;
3692 a1.uSectorID = 0; 3699 a1.uSectorID = 0;
3693 a1.uSpriteFrameID = 0; 3700 a1.uSpriteFrameID = 0;
3694 v44 = v3->uPlayerID; 3701 v44 = v3->uPlayerID;
3695 a1.field_60_distance_related_prolly_lod = 0; 3702 a1.field_60_distance_related_prolly_lod = 0;
3722 v691 = 0; 3729 v691 = 0;
3723 a1.stru_24.Reset(); 3730 a1.stru_24.Reset();
3724 a1.field_48 = v3->spellnum; 3731 a1.field_48 = v3->spellnum;
3725 a1.field_4C = v2; 3732 a1.field_4C = v2;
3726 a1.field_50 = v731; 3733 a1.field_50 = v731;
3727 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 3734 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
3728 a1.vPosition.x = *(short *)(HIDWORD(v733) + 142); 3735 a1.vPosition.x = *(short *)(HIDWORD(v733) + 142);
3729 a1.vPosition.y = *(short *)(HIDWORD(v733) + 144); 3736 a1.vPosition.y = *(short *)(HIDWORD(v733) + 144);
3730 v48 = *(short *)(HIDWORD(v733) + 138); 3737 v48 = *(short *)(HIDWORD(v733) + 138);
3731 a1.vPosition.z = *(short *)(HIDWORD(v733) + 138); 3738 a1.vPosition.z = *(short *)(HIDWORD(v733) + 138);
3732 a1.uAttributes = 0; 3739 a1.uAttributes = 0;
3767 goto play_sound_and_continue; 3774 goto play_sound_and_continue;
3768 a1.stru_24.Reset(); 3775 a1.stru_24.Reset();
3769 a1.field_48 = v3->spellnum; 3776 a1.field_48 = v3->spellnum;
3770 a1.field_4C = v2; 3777 a1.field_4C = v2;
3771 a1.field_50 = v731; 3778 a1.field_50 = v731;
3772 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 3779 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
3773 a1.vPosition.y = pParty->vPosition.y; 3780 a1.vPosition.y = pParty->vPosition.y;
3774 a1.vPosition.x = pParty->vPosition.x; 3781 a1.vPosition.x = pParty->vPosition.x;
3775 a1.uAttributes = 0; 3782 a1.uAttributes = 0;
3776 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; 3783 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
3777 a1.uSectorID = pIndoor->GetSector( 3784 a1.uSectorID = pIndoor->GetSector(
3799 goto play_sound_and_continue; 3806 goto play_sound_and_continue;
3800 a1.stru_24.Reset(); 3807 a1.stru_24.Reset();
3801 a1.field_48 = v3->spellnum; 3808 a1.field_48 = v3->spellnum;
3802 a1.field_4C = v2; 3809 a1.field_4C = v2;
3803 a1.field_50 = v731; 3810 a1.field_50 = v731;
3804 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 3811 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
3805 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; 3812 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
3806 a1.vPosition.y = pParty->vPosition.y; 3813 a1.vPosition.y = pParty->vPosition.y;
3807 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; 3814 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
3808 v660 = pParty->vPosition.y; 3815 v660 = pParty->vPosition.y;
3809 goto LABEL_153; 3816 goto LABEL_153;
3906 v731, 0, 0, 0); 3913 v731, 0, 0, 0);
3907 a1.stru_24.Reset(); 3914 a1.stru_24.Reset();
3908 a1.field_48 = v3->spellnum; 3915 a1.field_48 = v3->spellnum;
3909 a1.field_4C = v2; 3916 a1.field_4C = v2;
3910 a1.field_50 = v731; 3917 a1.field_50 = v731;
3911 v60 = pObjectList->ObjectIDByItemID(a1.uItemType); 3918 v60 = pObjectList->ObjectIDByItemID(a1.uType);
3912 v61 = a2 >> 3; 3919 v61 = a2 >> 3;
3913 goto LABEL_1086; 3920 goto LABEL_1086;
3914 case 92: 3921 case 92:
3915 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3922 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3916 goto play_sound_and_continue; 3923 goto play_sound_and_continue;
3917 a1.stru_24.Reset(); 3924 a1.stru_24.Reset();
3918 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 3925 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
3919 a1.vPosition.x = pParty->vPosition.x; 3926 a1.vPosition.x = pParty->vPosition.x;
3920 a1.vPosition.y = pParty->vPosition.y; 3927 a1.vPosition.y = pParty->vPosition.y;
3921 a1.uAttributes = 0; 3928 a1.uAttributes = 0;
3922 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; 3929 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
3923 a1.uSectorID = pIndoor->GetSector( 3930 a1.uSectorID = pIndoor->GetSector(
4308 a1.stru_24.Reset(); 4315 a1.stru_24.Reset();
4309 v119 = HIDWORD(v733); 4316 v119 = HIDWORD(v733);
4310 a1.field_48 = *(int *)HIDWORD(v733); 4317 a1.field_48 = *(int *)HIDWORD(v733);
4311 a1.field_4C = v723; 4318 a1.field_4C = v723;
4312 a1.field_50 = v731; 4319 a1.field_50 = v731;
4313 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 4320 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
4314 a1.uAttributes = 0; 4321 a1.uAttributes = 0;
4315 a1.uSectorID = 0; 4322 a1.uSectorID = 0;
4316 a1.uSpriteFrameID = 0; 4323 a1.uSpriteFrameID = 0;
4317 v120 = 8 * *(short *)(v119 + 2); 4324 v120 = 8 * *(short *)(v119 + 2);
4318 LOBYTE(v120) = v120 | OBJECT_Player; 4325 LOBYTE(v120) = v120 | OBJECT_Player;
4490 } 4497 }
4491 a1.stru_24.Reset(); 4498 a1.stru_24.Reset();
4492 a1.field_48 = v3->spellnum; 4499 a1.field_48 = v3->spellnum;
4493 a1.field_4C = v2; 4500 a1.field_4C = v2;
4494 a1.field_50 = v731; 4501 a1.field_50 = v731;
4495 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 4502 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
4496 a1.uAttributes = 0; 4503 a1.uAttributes = 0;
4497 a1.vPosition.x = uRequiredMana; 4504 a1.vPosition.x = uRequiredMana;
4498 a1.vPosition.y = LODWORD(v727); 4505 a1.vPosition.y = LODWORD(v727);
4499 a1.uSectorID = 0; 4506 a1.uSectorID = 0;
4500 a1.vPosition.z = a2 + v713; 4507 a1.vPosition.z = a2 + v713;
4537 v700.x = 0; 4544 v700.x = 0;
4538 a1.stru_24.Reset(); 4545 a1.stru_24.Reset();
4539 a1.field_48 = v3->spellnum; 4546 a1.field_48 = v3->spellnum;
4540 a1.field_4C = v2; 4547 a1.field_4C = v2;
4541 a1.field_50 = v731; 4548 a1.field_50 = v731;
4542 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 4549 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
4543 a1.uAttributes = 0; 4550 a1.uAttributes = 0;
4544 a1.uSectorID = 0; 4551 a1.uSectorID = 0;
4545 a1.uSpriteFrameID = 0; 4552 a1.uSpriteFrameID = 0;
4546 v161 = v3->uPlayerID; 4553 v161 = v3->uPlayerID;
4547 a1.field_60_distance_related_prolly_lod = 0; 4554 a1.field_60_distance_related_prolly_lod = 0;
4660 v732 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (amount - 1); 4667 v732 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (amount - 1);
4661 a1.stru_24.Reset(); 4668 a1.stru_24.Reset();
4662 a1.field_48 = v3->spellnum; 4669 a1.field_48 = v3->spellnum;
4663 a1.field_4C = v2; 4670 a1.field_4C = v2;
4664 a1.field_50 = v731; 4671 a1.field_50 = v731;
4665 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 4672 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
4666 a1.vPosition.y = pParty->vPosition.y; 4673 a1.vPosition.y = pParty->vPosition.y;
4667 a1.vPosition.x = pParty->vPosition.x; 4674 a1.vPosition.x = pParty->vPosition.x;
4668 a1.uAttributes = 0; 4675 a1.uAttributes = 0;
4669 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; 4676 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
4670 a1.uSectorID = pIndoor->GetSector( 4677 a1.uSectorID = pIndoor->GetSector(
4854 } 4861 }
4855 a1.stru_24.Reset(); 4862 a1.stru_24.Reset();
4856 a1.field_48 = v3->spellnum; 4863 a1.field_48 = v3->spellnum;
4857 a1.field_4C = v2; 4864 a1.field_4C = v2;
4858 a1.field_50 = v731; 4865 a1.field_50 = v731;
4859 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 4866 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
4860 a1.uAttributes = 0; 4867 a1.uAttributes = 0;
4861 a1.vPosition.x = LODWORD(v718); 4868 a1.vPosition.x = LODWORD(v718);
4862 a1.vPosition.y = v713; 4869 a1.vPosition.y = v713;
4863 a1.uSectorID = 0; 4870 a1.uSectorID = 0;
4864 a1.vPosition.z = (int)((char *)_this + LODWORD(v725)); 4871 a1.vPosition.z = (int)((char *)_this + LODWORD(v725));
4943 LABEL_152: 4950 LABEL_152:
4944 a1.stru_24.Reset(); 4951 a1.stru_24.Reset();
4945 a1.field_48 = v3->spellnum; 4952 a1.field_48 = v3->spellnum;
4946 a1.field_50 = v731; 4953 a1.field_50 = v731;
4947 a1.field_4C = v2; 4954 a1.field_4C = v2;
4948 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 4955 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
4949 a1.vPosition.y = pParty->vPosition.y; 4956 a1.vPosition.y = pParty->vPosition.y;
4950 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; 4957 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
4951 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; 4958 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
4952 v660 = pParty->vPosition.y; 4959 v660 = pParty->vPosition.y;
4953 LABEL_153: 4960 LABEL_153:
4981 v732 = SHIDWORD(v733) / (amount - 1); 4988 v732 = SHIDWORD(v733) / (amount - 1);
4982 a1.stru_24.Reset(); 4989 a1.stru_24.Reset();
4983 a1.field_48 = v3->spellnum; 4990 a1.field_48 = v3->spellnum;
4984 a1.field_4C = v2; 4991 a1.field_4C = v2;
4985 a1.field_50 = v731; 4992 a1.field_50 = v731;
4986 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 4993 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
4987 a1.vPosition.y = pParty->vPosition.y; 4994 a1.vPosition.y = pParty->vPosition.y;
4988 a1.vPosition.x = pParty->vPosition.x; 4995 a1.vPosition.x = pParty->vPosition.x;
4989 a1.uAttributes = 0; 4996 a1.uAttributes = 0;
4990 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; 4997 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
4991 a1.uSectorID = pIndoor->GetSector( 4998 a1.uSectorID = pIndoor->GetSector(
5558 goto play_sound_and_continue; 5565 goto play_sound_and_continue;
5559 a1.stru_24.Reset(); 5566 a1.stru_24.Reset();
5560 a1.field_48 = v3->spellnum; 5567 a1.field_48 = v3->spellnum;
5561 a1.field_4C = v2; 5568 a1.field_4C = v2;
5562 a1.field_50 = v731; 5569 a1.field_50 = v731;
5563 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 5570 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
5564 a1.vPosition.y = pParty->vPosition.y; 5571 a1.vPosition.y = pParty->vPosition.y;
5565 a1.vPosition.x = pParty->vPosition.x; 5572 a1.vPosition.x = pParty->vPosition.x;
5566 a1.uAttributes = 0; 5573 a1.uAttributes = 0;
5567 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; 5574 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
5568 a1.uSectorID = pIndoor->GetSector( 5575 a1.uSectorID = pIndoor->GetSector(
5586 case 43: 5593 case 43:
5587 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) 5594 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
5588 goto LABEL_200; 5595 goto LABEL_200;
5589 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5596 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5590 goto play_sound_and_continue; 5597 goto play_sound_and_continue;
5591 a1.uItemType = 4090; 5598 a1.uType = 4090;
5592 a1.stru_24.Reset(); 5599 a1.stru_24.Reset();
5593 a1.field_48 = v3->spellnum; 5600 a1.field_48 = v3->spellnum;
5594 a1.field_4C = v2; 5601 a1.field_4C = v2;
5595 a1.field_50 = v731; 5602 a1.field_50 = v731;
5596 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 5603 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
5597 a1.vPosition.x = pParty->vPosition.x; 5604 a1.vPosition.x = pParty->vPosition.x;
5598 a1.vPosition.y = pParty->vPosition.y; 5605 a1.vPosition.y = pParty->vPosition.y;
5599 a1.uAttributes = 0; 5606 a1.uAttributes = 0;
5600 a1.uSectorID = 0; 5607 a1.uSectorID = 0;
5601 a1.uSpriteFrameID = 0; 5608 a1.uSpriteFrameID = 0;
5778 LODWORD(v733) = v366; 5785 LODWORD(v733) = v366;
5779 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5786 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5780 goto play_sound_and_continue; 5787 goto play_sound_and_continue;
5781 v726 = (Player *)sub_46A6AC((int)dword_50BF30, 100, 4096); 5788 v726 = (Player *)sub_46A6AC((int)dword_50BF30, 100, 4096);
5782 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); 5789 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u);
5783 ++a1.uItemType; 5790 ++a1.uType;
5784 a1.stru_24.Reset(); 5791 a1.stru_24.Reset();
5785 a1.field_48 = v3->spellnum; 5792 a1.field_48 = v3->spellnum;
5786 a1.field_4C = v2; 5793 a1.field_4C = v2;
5787 a1.field_50 = v731; 5794 a1.field_50 = v731;
5788 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 5795 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
5789 a1.uAttributes = 0; 5796 a1.uAttributes = 0;
5790 a1.uSectorID = 0; 5797 a1.uSectorID = 0;
5791 a1.uSpriteFrameID = 0; 5798 a1.uSpriteFrameID = 0;
5792 v368 = v3->uPlayerID; 5799 v368 = v3->uPlayerID;
5793 a1.field_60_distance_related_prolly_lod = 0; 5800 a1.field_60_distance_related_prolly_lod = 0;
6118 ShowStatusBarString(pTmpBuf2, 2u); 6125 ShowStatusBarString(pTmpBuf2, 2u);
6119 a1.stru_24.Reset(); 6126 a1.stru_24.Reset();
6120 a1.field_48 = v3->spellnum; 6127 a1.field_48 = v3->spellnum;
6121 a1.field_4C = v2; 6128 a1.field_4C = v2;
6122 a1.field_50 = v731; 6129 a1.field_50 = v731;
6123 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 6130 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
6124 a1.vPosition.x = *(short *)(v730 + 142); 6131 a1.vPosition.x = *(short *)(v730 + 142);
6125 a1.vPosition.y = *(short *)(v730 + 144); 6132 a1.vPosition.y = *(short *)(v730 + 144);
6126 v676 = *(short *)(v730 + 138); 6133 v676 = *(short *)(v730 + 138);
6127 v665 = a1.vPosition.y; 6134 v665 = a1.vPosition.y;
6128 a1.vPosition.z = *(short *)(v730 + 138); 6135 a1.vPosition.z = *(short *)(v730 + 138);
6164 } 6171 }
6165 a1.stru_24.Reset(); 6172 a1.stru_24.Reset();
6166 a1.field_48 = v3->spellnum; 6173 a1.field_48 = v3->spellnum;
6167 a1.field_4C = v2; 6174 a1.field_4C = v2;
6168 a1.field_50 = v731; 6175 a1.field_50 = v731;
6169 v60 = pObjectList->ObjectIDByItemID(a1.uItemType); 6176 v60 = pObjectList->ObjectIDByItemID(a1.uType);
6170 v61 = v426; 6177 v61 = v426;
6171 goto LABEL_1086; 6178 goto LABEL_1086;
6172 case 66: 6179 case 66:
6173 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6180 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6174 goto play_sound_and_continue; 6181 goto play_sound_and_continue;
6190 } 6197 }
6191 a1.stru_24.Reset(); 6198 a1.stru_24.Reset();
6192 a1.field_48 = v3->spellnum; 6199 a1.field_48 = v3->spellnum;
6193 a1.field_4C = v2; 6200 a1.field_4C = v2;
6194 a1.field_50 = v731; 6201 a1.field_50 = v731;
6195 v60 = pObjectList->ObjectIDByItemID(a1.uItemType); 6202 v60 = pObjectList->ObjectIDByItemID(a1.uType);
6196 v61 = v427; 6203 v61 = v427;
6197 goto LABEL_1086; 6204 goto LABEL_1086;
6198 case 63: 6205 case 63:
6199 v428 = v12 - 2; 6206 v428 = v12 - 2;
6200 if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 ) 6207 if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 )
6204 amount = v430; 6211 amount = v430;
6205 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6212 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6206 goto play_sound_and_continue; 6213 goto play_sound_and_continue;
6207 v726 = (Player *)sub_46A6AC((int)dword_50BF30, 100, 4096); 6214 v726 = (Player *)sub_46A6AC((int)dword_50BF30, 100, 4096);
6208 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); 6215 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u);
6209 ++a1.uItemType; 6216 ++a1.uType;
6210 a1.stru_24.Reset(); 6217 a1.stru_24.Reset();
6211 a1.field_48 = v3->spellnum; 6218 a1.field_48 = v3->spellnum;
6212 a1.field_4C = v2; 6219 a1.field_4C = v2;
6213 a1.field_50 = v731; 6220 a1.field_50 = v731;
6214 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 6221 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
6215 a1.uAttributes = 0; 6222 a1.uAttributes = 0;
6216 a1.uSectorID = 0; 6223 a1.uSectorID = 0;
6217 a1.uSpriteFrameID = 0; 6224 a1.uSpriteFrameID = 0;
6218 v432 = v3->uPlayerID; 6225 v432 = v3->uPlayerID;
6219 a1.field_60_distance_related_prolly_lod = 0; 6226 a1.field_60_distance_related_prolly_lod = 0;
6298 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6305 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6299 goto play_sound_and_continue; 6306 goto play_sound_and_continue;
6300 v445 = a2 >> 3; 6307 v445 = a2 >> 3;
6301 if ( (a2 & 7) == OBJECT_Item) 6308 if ( (a2 & 7) == OBJECT_Item)
6302 { 6309 {
6303 v449 = (char *)&pLayingItems[v445].stru_24; 6310 v449 = (char *)&pSpriteObjects[v445].stru_24;
6304 v450 = *(int *)v449; 6311 v450 = *(int *)v449;
6305 if ( pItemsTable->pItems[v450].uEquipType == 18 ) 6312 if ( pItemsTable->pItems[v450].uEquipType == 18 )
6306 { 6313 {
6307 party_finds_gold(*((int *)v449 + 3), 0); 6314 party_finds_gold(*((int *)v449 + 3), 0);
6308 viewparams->bRedrawGameUI = 1; 6315 viewparams->bRedrawGameUI = 1;
6309 } 6316 }
6310 else 6317 else
6311 { 6318 {
6312 sprintf(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); 6319 sprintf(pTmpBuf2, (char*)pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName);
6313 ShowStatusBarString(pTmpBuf2, 2u); 6320 ShowStatusBarString(pTmpBuf2, 2u);
6314 if ( !pParty->AddItem(&pLayingItems[v445].stru_24) ) 6321 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) )
6315 pParty->SetHoldingItem(&pLayingItems[v445].stru_24); 6322 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24);
6316 } 6323 }
6317 LayingItem::OnItemPickup(v445); 6324 SpriteObject::OnInteraction(v445);
6318 } 6325 }
6319 else 6326 else
6320 { 6327 {
6321 if ( (a2 & 7) == OBJECT_Actor) 6328 if ( (a2 & 7) == OBJECT_Actor)
6322 { 6329 {
6624 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6631 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6625 goto play_sound_and_continue; 6632 goto play_sound_and_continue;
6626 6633
6627 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); 6634 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u);
6628 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); 6635 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096);
6629 ++a1.uItemType; 6636 ++a1.uType;
6630 HIDWORD(v733) = v505; 6637 HIDWORD(v733) = v505;
6631 v690 = 0; 6638 v690 = 0;
6632 v689 = 0; 6639 v689 = 0;
6633 v688 = 0; 6640 v688 = 0;
6634 a1.stru_24.Reset(); 6641 a1.stru_24.Reset();
6635 a1.field_48 = v3->spellnum; 6642 a1.field_48 = v3->spellnum;
6636 a1.field_4C = v2; 6643 a1.field_4C = v2;
6637 a1.field_50 = v731; 6644 a1.field_50 = v731;
6638 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 6645 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
6639 a1.uAttributes = 0; 6646 a1.uAttributes = 0;
6640 a1.uSectorID = 0; 6647 a1.uSectorID = 0;
6641 a1.uSpriteFrameID = 0; 6648 a1.uSpriteFrameID = 0;
6642 v506 = v3->uPlayerID; 6649 v506 = v3->uPlayerID;
6643 a1.field_60_distance_related_prolly_lod = 0; 6650 a1.field_60_distance_related_prolly_lod = 0;
6787 goto LABEL_202; 6794 goto LABEL_202;
6788 } 6795 }
6789 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6796 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6790 goto play_sound_and_continue; 6797 goto play_sound_and_continue;
6791 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); 6798 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096);
6792 ++a1.uItemType; 6799 ++a1.uType;
6793 v726 = (Player *)v531; 6800 v726 = (Player *)v531;
6794 v696 = 0; 6801 v696 = 0;
6795 v695 = 0; 6802 v695 = 0;
6796 v694 = 0; 6803 v694 = 0;
6797 a1.stru_24.Reset(); 6804 a1.stru_24.Reset();
6798 a1.field_48 = v3->spellnum; 6805 a1.field_48 = v3->spellnum;
6799 a1.field_4C = v2; 6806 a1.field_4C = v2;
6800 a1.field_50 = v731; 6807 a1.field_50 = v731;
6801 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 6808 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
6802 a1.uAttributes = 0; 6809 a1.uAttributes = 0;
6803 a1.uSectorID = 0; 6810 a1.uSectorID = 0;
6804 a1.uSpriteFrameID = 0; 6811 a1.uSpriteFrameID = 0;
6805 v532 = v3->uPlayerID; 6812 v532 = v3->uPlayerID;
6806 a1.field_60_distance_related_prolly_lod = 0; 6813 a1.field_60_distance_related_prolly_lod = 0;
7012 } 7019 }
7013 v578 = (int)&pActors[(int)v577]; 7020 v578 = (int)&pActors[(int)v577];
7014 v721 = v578; 7021 v721 = v578;
7015 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) 7022 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 )
7016 goto LABEL_200; 7023 goto LABEL_200;
7017 ++a1.uItemType; 7024 ++a1.uType;
7018 a1.stru_24.Reset(); 7025 a1.stru_24.Reset();
7019 a1.field_48 = v3->spellnum; 7026 a1.field_48 = v3->spellnum;
7020 a1.field_4C = v2; 7027 a1.field_4C = v2;
7021 a1.field_50 = v731; 7028 a1.field_50 = v731;
7022 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 7029 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
7023 a1.uAttributes = 0; 7030 a1.uAttributes = 0;
7024 a1.uSectorID = 0; 7031 a1.uSectorID = 0;
7025 a1.uSpriteFrameID = 0; 7032 a1.uSpriteFrameID = 0;
7026 v580 = v3->uPlayerID; 7033 v580 = v3->uPlayerID;
7027 a1.field_60_distance_related_prolly_lod = 0; 7034 a1.field_60_distance_related_prolly_lod = 0;
7116 v732 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (amount - 1); 7123 v732 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (amount - 1);
7117 a1.stru_24.Reset(); 7124 a1.stru_24.Reset();
7118 a1.field_48 = v3->spellnum; 7125 a1.field_48 = v3->spellnum;
7119 a1.field_4C = v2; 7126 a1.field_4C = v2;
7120 a1.field_50 = v731; 7127 a1.field_50 = v731;
7121 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 7128 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
7122 a1.vPosition.x = pParty->vPosition.x; 7129 a1.vPosition.x = pParty->vPosition.x;
7123 a1.vPosition.y = pParty->vPosition.y; 7130 a1.vPosition.y = pParty->vPosition.y;
7124 a1.uAttributes = 0; 7131 a1.uAttributes = 0;
7125 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; 7132 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
7126 a1.uSectorID = pIndoor->GetSector( 7133 a1.uSectorID = pIndoor->GetSector(
7190 v731, 0, 0, 0); 7197 v731, 0, 0, 0);
7191 a1.stru_24.Reset(); 7198 a1.stru_24.Reset();
7192 a1.field_48 = v3->spellnum; 7199 a1.field_48 = v3->spellnum;
7193 a1.field_4C = v2; 7200 a1.field_4C = v2;
7194 a1.field_50 = v731; 7201 a1.field_50 = v731;
7195 v60 = pObjectList->ObjectIDByItemID(a1.uItemType); 7202 v60 = pObjectList->ObjectIDByItemID(a1.uType);
7196 v61 = v599; 7203 v61 = v599;
7197 LABEL_1086: 7204 LABEL_1086:
7198 v600 = pActors[v61].vPosition.y; 7205 v600 = pActors[v61].vPosition.y;
7199 v601 = pActors[v61].vPosition.x; 7206 v601 = pActors[v61].vPosition.x;
7200 a1.uObjectDescID = v60; 7207 a1.uObjectDescID = v60;
7338 v707 = 0; 7345 v707 = 0;
7339 a1.stru_24.Reset(); 7346 a1.stru_24.Reset();
7340 a1.field_48 = v3->spellnum; 7347 a1.field_48 = v3->spellnum;
7341 a1.field_4C = v2; 7348 a1.field_4C = v2;
7342 a1.field_50 = v731; 7349 a1.field_50 = v731;
7343 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uItemType); 7350 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
7344 a1.uAttributes = 0; 7351 a1.uAttributes = 0;
7345 a1.uSectorID = 0; 7352 a1.uSectorID = 0;
7346 a1.uSpriteFrameID = 0; 7353 a1.uSpriteFrameID = 0;
7347 v624 = v3->uPlayerID; 7354 v624 = v3->uPlayerID;
7348 a1.field_60_distance_related_prolly_lod = 0; 7355 a1.field_60_distance_related_prolly_lod = 0;
8112 result = 1; 8119 result = 1;
8113 } 8120 }
8114 return result; 8121 return result;
8115 } 8122 }
8116 8123
8117 //----- (0042F5ED) --------------------------------------------------------
8118 int LayingItem::Create(int yaw, int pitch, int a4, int a5)
8119 {
8120 LayingItem *v5; // eax@1
8121 signed int v6; // ebx@2
8122 char *v7; // ecx@2
8123 signed int result; // eax@6
8124 LayingItem *v9; // ebx@7
8125 int v10; // edx@11
8126 int v11; // edi@18
8127 __int16 v12; // ax@18
8128 int v13; // ST2C_4@20
8129 int v14; // eax@20
8130 int v15; // [sp-28h] [bp-38h]@14
8131 int v16; // [sp-24h] [bp-34h]@11
8132 Vec3_int_ v17; // [sp-20h] [bp-30h]@11
8133 int *v18; // [sp-14h] [bp-24h]@11
8134 int *v19; // [sp-10h] [bp-20h]@11
8135 int *v20; // [sp-Ch] [bp-1Ch]@11
8136 signed int v21; // [sp+8h] [bp-8h]@2
8137 int angle; // [sp+Ch] [bp-4h]@1
8138 int a4a; // [sp+1Ch] [bp+Ch]@20
8139 int a4b; // [sp+1Ch] [bp+Ch]@20
8140 int a5a; // [sp+20h] [bp+10h]@20
8141
8142 auto a1 = this;
8143 angle = yaw;
8144 v5 = a1;
8145 if ( !a1->uObjectDescID )
8146 return -1;
8147 v6 = 0;
8148 v7 = (char *)&pLayingItems[0].uObjectDescID;
8149 v21 = 0;
8150 do
8151 {
8152 if ( !*(short *)v7 )
8153 break;
8154 v7 += 112;
8155 ++v6;
8156 v21 = v6;
8157 }
8158 while ( (signed int)v7 < (signed int)((char *)&pObjectList->uNumObjects + 2) );
8159 if ( v6 >= 1000 )
8160 return -1;
8161 *(int *)&v5->field_62[2] = v5->vPosition.x;
8162 *(int *)&v5->field_62[6] = v5->vPosition.y;
8163 v9 = &pLayingItems[v6];
8164 *(int *)&v5->field_62[10] = v5->vPosition.z;
8165 memcpy(v9, v5, 0x70u);
8166 if ( a5 == 1 )
8167 {
8168 v20 = &v9->vPosition.z;
8169 v19 = &v9->vPosition.y;
8170 v18 = (int *)&v9->vPosition;
8171 v17.z = v5->vPosition.z;
8172 *(_QWORD *)&v17.x = *(_QWORD *)&v5->vPosition.x;
8173 v16 = 0;
8174 v10 = stru_5C6E00->uIntegerHalfPi + v9->uFacing;
8175 goto LABEL_16;
8176 }
8177 if ( a5 == 2 )
8178 {
8179 v20 = &v9->vPosition.z;
8180 v19 = &v9->vPosition.y;
8181 v18 = (int *)&v9->vPosition;
8182 v17.z = v5->vPosition.z;
8183 *(_QWORD *)&v17.x = *(_QWORD *)&v5->vPosition.x;
8184 v16 = 0;
8185 v10 = stru_5C6E00->uIntegerHalfPi + v9->uFacing;
8186 goto LABEL_14;
8187 }
8188 if ( a5 == 3 )
8189 {
8190 v20 = &v9->vPosition.z;
8191 v19 = &v9->vPosition.y;
8192 v18 = (int *)&v9->vPosition;
8193 v17.z = v5->vPosition.z;
8194 *(_QWORD *)&v17.x = *(_QWORD *)&v5->vPosition.x;
8195 v16 = 0;
8196 v10 = v9->uFacing - stru_5C6E00->uIntegerHalfPi;
8197 LABEL_14:
8198 v15 = 8;
8199 LABEL_17:
8200 Vec3_int_::Rotate(v15, v10, v16, v17, v18, v19, v20);
8201 goto LABEL_18;
8202 }
8203 if ( a5 == 4 )
8204 {
8205 v20 = &v9->vPosition.z;
8206 v19 = &v9->vPosition.y;
8207 v18 = (int *)&v9->vPosition;
8208 v17.z = v5->vPosition.z;
8209 *(_QWORD *)&v17.x = *(_QWORD *)&v5->vPosition.x;
8210 v16 = 0;
8211 v10 = v9->uFacing - stru_5C6E00->uIntegerHalfPi;
8212 LABEL_16:
8213 v15 = 24;
8214 goto LABEL_17;
8215 }
8216 LABEL_18:
8217 v11 = a4;
8218 v12 = 0;
8219 if ( a4 )
8220 {
8221 a4a = stru_5C6E00->Cos(angle);
8222 v13 = (unsigned __int64)(a4a * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16;
8223 a4b = stru_5C6E00->Sin(angle);
8224 a5a = (unsigned __int64)(a4b * (signed __int64)stru_5C6E00->Cos(pitch)) >> 16;
8225 v14 = stru_5C6E00->Sin(pitch);
8226 v9->vVelocity.x = (unsigned int)(v13 * v11) >> 16;
8227 v9->vVelocity.y = (unsigned int)(a5a * v11) >> 16;
8228 v12 = (unsigned int)(v14 * v11) >> 16;
8229 }
8230 else
8231 {
8232 v9->vVelocity.y = 0;
8233 v9->vVelocity.x = 0;
8234 }
8235 v9->vVelocity.z = v12;
8236 result = v21;
8237 if ( v21 >= (signed int)uNumLayingItems )
8238 uNumLayingItems = v21 + 1;
8239 return result;
8240 }
8241
8242 //----- (0042F7EB) -------------------------------------------------------- 8124 //----- (0042F7EB) --------------------------------------------------------
8243 bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9) 8125 bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9)
8244 { 8126 {
8245 unsigned int v9; // edi@1 8127 unsigned int v9; // edi@1
8246 signed int v10; // edx@3 8128 signed int v10; // edx@3
8250 char *v14; // ecx@10 8132 char *v14; // ecx@10
8251 int v15; // esi@17 8133 int v15; // esi@17
8252 int v16; // eax@18 8134 int v16; // eax@18
8253 int v17; // edi@20 8135 int v17; // edi@20
8254 int v18; // esi@20 8136 int v18; // esi@20
8255 //LayingItem a1a; // [sp+Ch] [bp-78h]@1 8137 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1
8256 int v21; // [sp+7Ch] [bp-8h]@1 8138 int v21; // [sp+7Ch] [bp-8h]@1
8257 unsigned int v22; // [sp+80h] [bp-4h]@1 8139 unsigned int v22; // [sp+80h] [bp-4h]@1
8258 8140
8259 v9 = uSpriteID; 8141 v9 = uSpriteID;
8260 v21 = x; 8142 v21 = x;
8261 v22 = uSpriteID; 8143 v22 = uSpriteID;
8262 8144
8263 LayingItem a1a; // [sp+Ch] [bp-78h]@1 8145 SpriteObject a1a; // [sp+Ch] [bp-78h]@1
8264 //LayingItem::LayingItem(&a1a); 8146 //SpriteObject::SpriteObject(&a1a);
8265 a1a.stru_24.Reset(); 8147 a1a.stru_24.Reset();
8266 8148
8267 if ( a9 ) 8149 if ( a9 )
8268 { 8150 {
8269 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); 8151 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24));
8272 v10 = 0; 8154 v10 = 0;
8273 a1a.field_50 = 0; 8155 a1a.field_50 = 0;
8274 a1a.field_4C = 0; 8156 a1a.field_4C = 0;
8275 a1a.field_48 = 0; 8157 a1a.field_48 = 0;
8276 a1a.field_54 = 0; 8158 a1a.field_54 = 0;
8277 a1a.uItemType = v9; 8159 a1a.uType = v9;
8278 if ( (signed int)pObjectList->uNumObjects <= 0 ) 8160 if ( (signed int)pObjectList->uNumObjects <= 0 )
8279 { 8161 {
8280 LABEL_7: 8162 LABEL_7:
8281 v12 = 0; 8163 v12 = 0;
8282 } 8164 }
8364 signed int v5; // edx@1 8246 signed int v5; // edx@1
8365 char *v6; // ecx@2 8247 char *v6; // ecx@2
8366 unsigned __int16 v7; // ax@5 8248 unsigned __int16 v7; // ax@5
8367 signed int v8; // eax@6 8249 signed int v8; // eax@6
8368 signed int v9; // eax@7 8250 signed int v9; // eax@7
8369 //LayingItem a1; // [sp+Ch] [bp-70h]@1 8251 //SpriteObject a1; // [sp+Ch] [bp-70h]@1
8370 8252
8371 v3 = x; 8253 v3 = x;
8372 v4 = y; 8254 v4 = y;
8373 8255
8374 LayingItem a1; // [sp+Ch] [bp-70h]@1 8256 SpriteObject a1; // [sp+Ch] [bp-70h]@1
8375 //LayingItem::LayingItem(&a1); 8257 //SpriteObject::SpriteObject(&a1);
8376 a1.stru_24.Reset(); 8258 a1.stru_24.Reset();
8377 8259
8378 v5 = 0; 8260 v5 = 0;
8379 a1.field_50 = 0; 8261 a1.field_50 = 0;
8380 a1.field_4C = 0; 8262 a1.field_4C = 0;
8381 a1.field_48 = 0; 8263 a1.field_48 = 0;
8382 a1.field_54 = 0; 8264 a1.field_54 = 0;
8383 a1.uItemType = 800; 8265 a1.uType = 800;
8384 if ( (signed int)pObjectList->uNumObjects <= 0 ) 8266 if ( (signed int)pObjectList->uNumObjects <= 0 )
8385 { 8267 {
8386 LABEL_5: 8268 LABEL_5:
8387 v7 = 0; 8269 v7 = 0;
8388 } 8270 }
8416 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); 8298 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0);
8417 } 8299 }
8418 } 8300 }
8419 8301
8420 //----- (0042FA22) -------------------------------------------------------- 8302 //----- (0042FA22) --------------------------------------------------------
8421 LayingItem *__cdecl sub_42FA22_mess_with_laying_item_list() 8303 SpriteObject *__cdecl sub_42FA22_mess_with_laying_item_list()
8422 { 8304 {
8423 size_t v0; // edx@1 8305 size_t v0; // edx@1
8424 int v1; // ebp@1 8306 int v1; // ebp@1
8425 LayingItem *result; // eax@1 8307 SpriteObject *result; // eax@1
8426 LayingItem *v3; // ebx@1 8308 SpriteObject *v3; // ebx@1
8427 8309
8428 v0 = 0; 8310 v0 = 0;
8429 v1 = 0; 8311 v1 = 0;
8430 //result = (char *)&pLayingItems[0].uObjectDescID; 8312 //result = (char *)&pSpriteObjects[0].uObjectDescID;
8431 result = pLayingItems; 8313 result = pSpriteObjects;
8432 v3 = pLayingItems; 8314 v3 = pSpriteObjects;
8433 do 8315 do
8434 { 8316 {
8435 if ( result->uObjectDescID ) 8317 if ( result->uObjectDescID )
8436 { 8318 {
8437 if ( v1 != v0 ) 8319 if ( v1 != v0 )
8444 } 8326 }
8445 ++result;// += 112; 8327 ++result;// += 112;
8446 ++v1; 8328 ++v1;
8447 } 8329 }
8448 //while ( (signed int)result < (signed int)((char *)&pObjectList->uNumObjects + 2) ); 8330 //while ( (signed int)result < (signed int)((char *)&pObjectList->uNumObjects + 2) );
8449 while( result <= &pLayingItems[999] ); 8331 while( result <= &pSpriteObjects[999] );
8450 uNumLayingItems = v0; 8332 uNumSpriteObjects = v0;
8451 return result; 8333 return result;
8452 } 8334 }
8453 8335
8454 //----- (0042FA66) -------------------------------------------------------- 8336 //----- (0042FA66) --------------------------------------------------------
8455 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) 8337 int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6)
8459 char *v8; // ecx@2 8341 char *v8; // ecx@2
8460 unsigned __int16 v9; // ax@5 8342 unsigned __int16 v9; // ax@5
8461 int v10; // eax@10 8343 int v10; // eax@10
8462 signed int result; // eax@11 8344 signed int result; // eax@11
8463 __int16 v12; // ax@12 8345 __int16 v12; // ax@12
8464 //LayingItem a1a; // [sp+Ch] [bp-74h]@1 8346 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1
8465 int v14; // [sp+7Ch] [bp-4h]@1 8347 int v14; // [sp+7Ch] [bp-4h]@1
8466 8348
8467 v6 = a1; 8349 v6 = a1;
8468 v7 = a2; 8350 v7 = a2;
8469 LayingItem a1a; // [sp+Ch] [bp-74h]@1 8351 SpriteObject a1a; // [sp+Ch] [bp-74h]@1
8470 //LayingItem::LayingItem(&a1a); 8352 //SpriteObject::SpriteObject(&a1a);
8471 a1a.uItemType = 600; 8353 a1a.uType = 600;
8472 a1a.stru_24.Reset(); 8354 a1a.stru_24.Reset();
8473 8355
8474 a1a.field_48 = 6; 8356 a1a.field_48 = 6;
8475 a1a.field_4C = 8; 8357 a1a.field_4C = 8;
8476 a1a.field_50 = 3; 8358 a1a.field_50 = 3;
8481 v9 = 0; 8363 v9 = 0;
8482 } 8364 }
8483 else 8365 else
8484 { 8366 {
8485 v8 = (char *)&pObjectList->pObjects->uObjectID; 8367 v8 = (char *)&pObjectList->pObjects->uObjectID;
8486 while ( (short)a1a.uItemType != *(short *)v8 ) 8368 while ( (short)a1a.uType != *(short *)v8 )
8487 { 8369 {
8488 ++v14; 8370 ++v14;
8489 v8 += 56; 8371 v8 += 56;
8490 if ( v14 >= (signed int)pObjectList->uNumObjects ) 8372 if ( v14 >= (signed int)pObjectList->uNumObjects )
8491 goto LABEL_5; 8373 goto LABEL_5;