annotate mm7_6.cpp @ 2360:63ad4e3606f4

MovieRelease();
author Ritor1
date Wed, 16 Apr 2014 17:36:47 +0600
parents ddb803517a48
children f4af3b203f65
rev   line source
2253
aff7a7b072b7 adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents: 2245
diff changeset
1 #define _CRT_SECURE_NO_WARNINGS
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
2
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1003
diff changeset
3 #include "Vis.h"
0
Ritor1
parents:
diff changeset
4 #include "Game.h"
2331
9551756f46c4 Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents: 2303
diff changeset
5 #include "MM7_data.h"
0
Ritor1
parents:
diff changeset
6 #include "Actor.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
Ritor1
parents:
diff changeset
12
Ritor1
parents:
diff changeset
13
Ritor1
parents:
diff changeset
14 //----- (00427546) --------------------------------------------------------
Ritor1
parents:
diff changeset
15 int stru319::_427546(int a2)
Ritor1
parents:
diff changeset
16 {
Ritor1
parents:
diff changeset
17 int result; // eax@2
Ritor1
parents:
diff changeset
18
Ritor1
parents:
diff changeset
19 if ( a2 >= 0 )
Ritor1
parents:
diff changeset
20 {
Ritor1
parents:
diff changeset
21 if ( a2 >= 1 )
Ritor1
parents:
diff changeset
22 result = (a2 >= 2) + 2;
Ritor1
parents:
diff changeset
23 else
Ritor1
parents:
diff changeset
24 result = 1;
Ritor1
parents:
diff changeset
25 }
Ritor1
parents:
diff changeset
26 else
Ritor1
parents:
diff changeset
27 {
Ritor1
parents:
diff changeset
28 result = 0;
Ritor1
parents:
diff changeset
29 }
Ritor1
parents:
diff changeset
30 return result;
Ritor1
parents:
diff changeset
31 }
Ritor1
parents:
diff changeset
32
437
0a1ea44b4a0a ui mesages & spellcasting
Nomad
parents: 430
diff changeset
33
0
Ritor1
parents:
diff changeset
34
Ritor1
parents:
diff changeset
35 //----- (0042F184) --------------------------------------------------------
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
36 int stru319::FindClosestActor(int pick_depth, int a3, int a4)
0
Ritor1
parents:
diff changeset
37 {
Ritor1
parents:
diff changeset
38 int v4; // edi@1
Ritor1
parents:
diff changeset
39 stru319 *v5; // esi@1
Ritor1
parents:
diff changeset
40 int v6; // eax@2
Ritor1
parents:
diff changeset
41 int v7; // eax@4
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
42 // int result; // eax@5
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
43 // int *v9; // edx@8
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
44 // signed int v10; // ebx@10
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
45 // int v11; // edi@11
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
46 //Actor *v12; // esi@12
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
47 //unsigned __int16 v13; // ax@12
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
48 // int v14; // eax@22
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
49 //char v15; // zf@30
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
50 // int v16; // esi@32
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
51 // int v17; // ecx@34
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
52 // stru319 *v18; // eax@39
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
53 // int v19; // edx@39
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
54 // int v20; // ecx@41
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
55 // unsigned __int16 v21; // ax@42
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
56 // unsigned int v22; // [sp+8h] [bp-24h]@11
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
57 //unsigned int v23; // [sp+Ch] [bp-20h]@7
0
Ritor1
parents:
diff changeset
58 stru319 *v24; // [sp+10h] [bp-1Ch]@1
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
59 // unsigned int v25; // [sp+14h] [bp-18h]@8
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
60 // int *v26; // [sp+18h] [bp-14h]@8
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
61 // int v27; // [sp+1Ch] [bp-10h]@10
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
62 // int *v28; // [sp+20h] [bp-Ch]@10
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
63 //unsigned int v29; // [sp+24h] [bp-8h]@7
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
64 // int v30; // [sp+28h] [bp-4h]@6
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
65 // int i; // [sp+38h] [bp+Ch]@33
ddb803517a48 unused local variables I commented
Ritor1
parents: 2331
diff changeset
66 // signed int v32; // [sp+3Ch] [bp+10h]@32
0
Ritor1
parents:
diff changeset
67
Ritor1
parents:
diff changeset
68 v4 = 0;
Ritor1
parents:
diff changeset
69 v5 = this;
Ritor1
parents:
diff changeset
70 v24 = this;
2153
d28d3c006077 Some Render decoupling.
Nomad
parents: 2121
diff changeset
71 //if ( pRenderer->pRenderD3D )
0
Ritor1
parents:
diff changeset
72 {
Ritor1
parents:
diff changeset
73 v6 = a3 != 0;
Ritor1
parents:
diff changeset
74 if ( a4 )
Ritor1
parents:
diff changeset
75 LOBYTE(v6) = v6 | 8;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
76 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1);
0
Ritor1
parents:
diff changeset
77 if ( v7 != -1 )
Ritor1
parents:
diff changeset
78 return (unsigned __int16)v7;
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
79 else return 0;
0
Ritor1
parents:
diff changeset
80 }
2153
d28d3c006077 Some Render decoupling.
Nomad
parents: 2121
diff changeset
81 /*else // software impl
0
Ritor1
parents:
diff changeset
82 {
Ritor1
parents:
diff changeset
83 v30 = 0;
Ritor1
parents:
diff changeset
84 if ( pRenderer->pActiveZBuffer )
Ritor1
parents:
diff changeset
85 {
692
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
86 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y )
0
Ritor1
parents:
diff changeset
87 {
692
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
88 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y];
066e2b29b30f viewport.cpp added
Gloval
parents: 651
diff changeset
89 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y];
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
90 for ( v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; v25; --v25 )
0
Ritor1
parents:
diff changeset
91 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
92 if ( (signed int)viewparams->uScreen_topL_X < (signed int)viewparams->uScreen_BttmR_X )
0
Ritor1
parents:
diff changeset
93 {
Ritor1
parents:
diff changeset
94 v28 = v9;
Ritor1
parents:
diff changeset
95 v10 = v4;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
96 for ( v27 = viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X; v27; --v27 )
0
Ritor1
parents:
diff changeset
97 {
Ritor1
parents:
diff changeset
98 v22 = *v28;
Ritor1
parents:
diff changeset
99 v11 = *v28 & 0xFFFF;
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
100 if (PID_TYPE(v11) == OBJECT_Actor)
0
Ritor1
parents:
diff changeset
101 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
102 if ( pActors[PID_ID(v11)].uAIState != Dead )
0
Ritor1
parents:
diff changeset
103 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
104 if ( pActors[PID_ID(v11)].uAIState != Dying && pActors[PID_ID(v11)].uAIState != Removed
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
105 && pActors[PID_ID(v11)].uAIState != Summoned && pActors[PID_ID(v11)].uAIState != Disabled
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
106 && (!a3 || pActors[PID_ID(v11)].GetActorsRelation(0)) )
0
Ritor1
parents:
diff changeset
107 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
108 if ( (!a4 || MonsterStats::BelongsToSupertype(pActors[PID_ID(v11)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD))
295
640a176c030f sub_42ECB5
Nomad
parents: 271
diff changeset
109 && v22 <= pick_depth << 16 )
0
Ritor1
parents:
diff changeset
110 {
Ritor1
parents:
diff changeset
111 v14 = 0;
Ritor1
parents:
diff changeset
112 if ( v10 > 0 )
Ritor1
parents:
diff changeset
113 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
114 for ( v14; v14 < v30; ++v14 )
0
Ritor1
parents:
diff changeset
115 {
Ritor1
parents:
diff changeset
116 if ( dword_50BDA0[v14] == v11 )
Ritor1
parents:
diff changeset
117 break;
Ritor1
parents:
diff changeset
118 }
Ritor1
parents:
diff changeset
119 }
Ritor1
parents:
diff changeset
120 if ( v14 == v30 && v10 < 100 )
Ritor1
parents:
diff changeset
121 {
Ritor1
parents:
diff changeset
122 ++v30;
Ritor1
parents:
diff changeset
123 dword_50BC10[v10] = v22;
Ritor1
parents:
diff changeset
124 dword_50BDA0[v10] = v11;
Ritor1
parents:
diff changeset
125 ++v10;
Ritor1
parents:
diff changeset
126 }
Ritor1
parents:
diff changeset
127 }
Ritor1
parents:
diff changeset
128 }
Ritor1
parents:
diff changeset
129 }
Ritor1
parents:
diff changeset
130 }
Ritor1
parents:
diff changeset
131 ++v28;
Ritor1
parents:
diff changeset
132 }
Ritor1
parents:
diff changeset
133 v4 = v30;
Ritor1
parents:
diff changeset
134 v5 = v24;
Ritor1
parents:
diff changeset
135 }
Ritor1
parents:
diff changeset
136 v9 = v26 + 640;
Ritor1
parents:
diff changeset
137 v26 += 640;
Ritor1
parents:
diff changeset
138 }
Ritor1
parents:
diff changeset
139 }
Ritor1
parents:
diff changeset
140 if ( v4 > 0 )
Ritor1
parents:
diff changeset
141 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
142 v16 = (int)dword_50BC10.data();
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
143 for ( v32 = 1; v32 - 1 < v4; ++v32 )
0
Ritor1
parents:
diff changeset
144 {
Ritor1
parents:
diff changeset
145 for ( i = v32; i < v4; ++i )
Ritor1
parents:
diff changeset
146 {
Ritor1
parents:
diff changeset
147 v17 = dword_50BC10[i];
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
148 if ( dword_50BC10[i] < *(int *)v16 )
0
Ritor1
parents:
diff changeset
149 {
Ritor1
parents:
diff changeset
150 dword_50BC10[i] = *(int *)v16;
Ritor1
parents:
diff changeset
151 *(int *)v16 = v17;
Ritor1
parents:
diff changeset
152 }
Ritor1
parents:
diff changeset
153 }
Ritor1
parents:
diff changeset
154 v16 += 4;
Ritor1
parents:
diff changeset
155 }
Ritor1
parents:
diff changeset
156 v5 = v24;
Ritor1
parents:
diff changeset
157 if ( v4 > 0 )
Ritor1
parents:
diff changeset
158 {
Ritor1
parents:
diff changeset
159 v18 = v24;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
160 for ( v19 = v4; v19; --v19 )
0
Ritor1
parents:
diff changeset
161 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
162 *(int *)&v18->field_0 = (*(int *)&v18[(char *)dword_50BC10.data() - (char *)v24].field_0 >> 3) & 0x1FFF;
0
Ritor1
parents:
diff changeset
163 v18 += 4;
Ritor1
parents:
diff changeset
164 }
Ritor1
parents:
diff changeset
165 }
Ritor1
parents:
diff changeset
166 }
Ritor1
parents:
diff changeset
167 v20 = 0;
Ritor1
parents:
diff changeset
168 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 )
Ritor1
parents:
diff changeset
169 {
Ritor1
parents:
diff changeset
170 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState;
Ritor1
parents:
diff changeset
171 if ( v21 != 4 && v21 != 5 )
Ritor1
parents:
diff changeset
172 break;
Ritor1
parents:
diff changeset
173 }
Ritor1
parents:
diff changeset
174 if ( v20 != v4 )
Ritor1
parents:
diff changeset
175 {
Ritor1
parents:
diff changeset
176 result = 8 * *(int *)&v5[4 * v20].field_0;
Ritor1
parents:
diff changeset
177 LOBYTE(result) = result | 3;
Ritor1
parents:
diff changeset
178 return result;
Ritor1
parents:
diff changeset
179 }
Ritor1
parents:
diff changeset
180 }
Ritor1
parents:
diff changeset
181 }
2153
d28d3c006077 Some Render decoupling.
Nomad
parents: 2121
diff changeset
182 return 0;*/
0
Ritor1
parents:
diff changeset
183 }
Ritor1
parents:
diff changeset
184
1052
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
185
d48c762de563 -nomarg
Nomad
parents: 1038
diff changeset
186