annotate LayingItem.cpp @ 274:a9f58ca01454

Слияние
author Ritor1
date Mon, 18 Feb 2013 16:37:17 +0600
parents 2799737f8a74
children 58b71c1af7d8
rev   line source
0
Ritor1
parents:
diff changeset
1 #include "LayingItem.h"
Ritor1
parents:
diff changeset
2 #include "Party.h"
Ritor1
parents:
diff changeset
3 #include "TurnEngine.h"
Ritor1
parents:
diff changeset
4 #include "MapInfo.h"
Ritor1
parents:
diff changeset
5
Ritor1
parents:
diff changeset
6 #include "mm7_data.h"
Ritor1
parents:
diff changeset
7
Ritor1
parents:
diff changeset
8
Ritor1
parents:
diff changeset
9
Ritor1
parents:
diff changeset
10
Ritor1
parents:
diff changeset
11 size_t uNumLayingItems;
Ritor1
parents:
diff changeset
12 LayingItem pLayingItems[1000];
Ritor1
parents:
diff changeset
13
Ritor1
parents:
diff changeset
14
Ritor1
parents:
diff changeset
15 //----- (00438E35) --------------------------------------------------------
187
49728858c35e On player voices
Nomad
parents: 0
diff changeset
16 void LayingItem::_438E35()
0
Ritor1
parents:
diff changeset
17 {
Ritor1
parents:
diff changeset
18 LayingItem *v1; // edi@1
Ritor1
parents:
diff changeset
19 MapInfo *pMapInfo; // esi@1
Ritor1
parents:
diff changeset
20 int v3; // ebx@1
Ritor1
parents:
diff changeset
21 int v4; // eax@1
Ritor1
parents:
diff changeset
22 int v5; // ebx@1
Ritor1
parents:
diff changeset
23 unsigned int v6; // ecx@1
Ritor1
parents:
diff changeset
24 int v7; // edx@2
Ritor1
parents:
diff changeset
25 unsigned int v8; // edx@4
Ritor1
parents:
diff changeset
26 unsigned int v9; // edx@6
Ritor1
parents:
diff changeset
27 unsigned int v10; // eax@7
Ritor1
parents:
diff changeset
28 signed int v11; // ebx@8
Ritor1
parents:
diff changeset
29 Player **v12; // esi@18
Ritor1
parents:
diff changeset
30 signed int v13; // edi@20
Ritor1
parents:
diff changeset
31 int v15; // [sp+Ch] [bp-Ch]@1
Ritor1
parents:
diff changeset
32 int v16; // [sp+10h] [bp-8h]@1
Ritor1
parents:
diff changeset
33 signed int v17; // [sp+14h] [bp-4h]@8
Ritor1
parents:
diff changeset
34 int v18; // [sp+14h] [bp-4h]@14
Ritor1
parents:
diff changeset
35
Ritor1
parents:
diff changeset
36 v1 = this;
Ritor1
parents:
diff changeset
37 pMapInfo = &pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)];
Ritor1
parents:
diff changeset
38 v3 = abs(pParty->vPosition.x - v1->vPosition.x);
Ritor1
parents:
diff changeset
39 v15 = abs(pParty->vPosition.y - v1->vPosition.y);
Ritor1
parents:
diff changeset
40 v16 = abs(pParty->vPosition.z + pParty->sEyelevel - v1->vPosition.z);
Ritor1
parents:
diff changeset
41 v4 = v3;
Ritor1
parents:
diff changeset
42 v5 = v15;
Ritor1
parents:
diff changeset
43 v6 = v16;
Ritor1
parents:
diff changeset
44 if ( v4 < v15 )
Ritor1
parents:
diff changeset
45 {
Ritor1
parents:
diff changeset
46 v7 = v4;
Ritor1
parents:
diff changeset
47 v4 = v15;
Ritor1
parents:
diff changeset
48 v5 = v7;
Ritor1
parents:
diff changeset
49 }
Ritor1
parents:
diff changeset
50 if ( v4 < v16 )
Ritor1
parents:
diff changeset
51 {
Ritor1
parents:
diff changeset
52 v8 = v4;
Ritor1
parents:
diff changeset
53 v4 = v16;
Ritor1
parents:
diff changeset
54 v6 = v8;
Ritor1
parents:
diff changeset
55 }
Ritor1
parents:
diff changeset
56 if ( v5 < (signed int)v6 )
Ritor1
parents:
diff changeset
57 {
Ritor1
parents:
diff changeset
58 v9 = v6;
Ritor1
parents:
diff changeset
59 v6 = v5;
Ritor1
parents:
diff changeset
60 v5 = v9;
Ritor1
parents:
diff changeset
61 }
Ritor1
parents:
diff changeset
62 v10 = ((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4;
Ritor1
parents:
diff changeset
63 if ( (signed int)v10 <= 768 )
Ritor1
parents:
diff changeset
64 {
Ritor1
parents:
diff changeset
65 v17 = 0;
Ritor1
parents:
diff changeset
66 v11 = 5;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 208
diff changeset
67 if ( pMapInfo->Trap_D20 )
0
Ritor1
parents:
diff changeset
68 {
Ritor1
parents:
diff changeset
69 do
Ritor1
parents:
diff changeset
70 {
Ritor1
parents:
diff changeset
71 ++v17;
Ritor1
parents:
diff changeset
72 v11 += rand() % 20 + 1;
Ritor1
parents:
diff changeset
73 }
237
2799737f8a74 more text parsers refactor
Gloval
parents: 208
diff changeset
74 while ( v17 < pMapInfo->Trap_D20 );
0
Ritor1
parents:
diff changeset
75 }
Ritor1
parents:
diff changeset
76 switch ( v1->uItemType )
Ritor1
parents:
diff changeset
77 {
Ritor1
parents:
diff changeset
78 case 0x32Bu:
Ritor1
parents:
diff changeset
79 v18 = 0;
Ritor1
parents:
diff changeset
80 break;
Ritor1
parents:
diff changeset
81 case 0x32Cu:
Ritor1
parents:
diff changeset
82 v18 = 1;
Ritor1
parents:
diff changeset
83 break;
Ritor1
parents:
diff changeset
84 case 0x32Du:
Ritor1
parents:
diff changeset
85 v18 = 2;
Ritor1
parents:
diff changeset
86 break;
Ritor1
parents:
diff changeset
87 default:
187
49728858c35e On player voices
Nomad
parents: 0
diff changeset
88 //LOWORD(v10) = v1->uItemType - 814;
0
Ritor1
parents:
diff changeset
89 if ( v1->uItemType != 814 )
187
49728858c35e On player voices
Nomad
parents: 0
diff changeset
90 return;
0
Ritor1
parents:
diff changeset
91 v18 = 8;
Ritor1
parents:
diff changeset
92 break;
Ritor1
parents:
diff changeset
93 }
Ritor1
parents:
diff changeset
94 v12 = &pPlayers[1];
Ritor1
parents:
diff changeset
95 do
Ritor1
parents:
diff changeset
96 {
Ritor1
parents:
diff changeset
97 if ( (*v12)->CanAct() && (v13 = (*v12)->GetPerception() + 20, rand() % v13 > 20) )
187
49728858c35e On player voices
Nomad
parents: 0
diff changeset
98 (*v12)->PlaySound(SPEECH_6, 0);
0
Ritor1
parents:
diff changeset
99 else
187
49728858c35e On player voices
Nomad
parents: 0
diff changeset
100 (*v12)->ReceiveDamage(v11, v18);
0
Ritor1
parents:
diff changeset
101 ++v12;
Ritor1
parents:
diff changeset
102 }
Ritor1
parents:
diff changeset
103 while ( (signed int)v12 <= (signed int)&pPlayers[4] );
Ritor1
parents:
diff changeset
104 }
Ritor1
parents:
diff changeset
105 }
Ritor1
parents:
diff changeset
106
Ritor1
parents:
diff changeset
107
Ritor1
parents:
diff changeset
108
Ritor1
parents:
diff changeset
109 //----- (0042F933) --------------------------------------------------------
Ritor1
parents:
diff changeset
110 void LayingItem::_42F933(unsigned int uLayingItemID)
Ritor1
parents:
diff changeset
111 {
Ritor1
parents:
diff changeset
112 unsigned int v1; // ecx@1
Ritor1
parents:
diff changeset
113 unsigned __int16 *pAttributes; // ecx@2
Ritor1
parents:
diff changeset
114 unsigned __int16 v3; // ax@2
Ritor1
parents:
diff changeset
115
207
Ritor1
parents: 0
diff changeset
116 //__debugbreak(); // find out what's going on
0
Ritor1
parents:
diff changeset
117
Ritor1
parents:
diff changeset
118 v1 = uLayingItemID;
Ritor1
parents:
diff changeset
119 pLayingItems[v1].uObjectDescID = 0;
Ritor1
parents:
diff changeset
120 if ( pParty->bTurnBasedModeOn == 1 )
Ritor1
parents:
diff changeset
121 {
Ritor1
parents:
diff changeset
122 pAttributes = &pLayingItems[v1].uAttributes;
Ritor1
parents:
diff changeset
123 v3 = *pAttributes;
Ritor1
parents:
diff changeset
124 if ( *pAttributes & 4 )
Ritor1
parents:
diff changeset
125 {
207
Ritor1
parents: 0
diff changeset
126 v3 = v3 & 0xFB;
0
Ritor1
parents:
diff changeset
127 --pTurnEngine->field_1C;
Ritor1
parents:
diff changeset
128 *pAttributes = v3;
Ritor1
parents:
diff changeset
129 }
Ritor1
parents:
diff changeset
130 }
Ritor1
parents:
diff changeset
131 }