Mercurial > mm7
annotate mm7_6.cpp @ 2386:41c36ecc9f32
MapsLongTimer.h
author | Ritor1 |
---|---|
date | Mon, 23 Jun 2014 23:45:14 +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 | 2 |
3 #include "Vis.h" | |
0 | 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 | 6 #include "Actor.h" |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 //----- (00427546) -------------------------------------------------------- | |
15 int stru319::_427546(int a2) | |
16 { | |
17 int result; // eax@2 | |
18 | |
19 if ( a2 >= 0 ) | |
20 { | |
21 if ( a2 >= 1 ) | |
22 result = (a2 >= 2) + 2; | |
23 else | |
24 result = 1; | |
25 } | |
26 else | |
27 { | |
28 result = 0; | |
29 } | |
30 return result; | |
31 } | |
32 | |
437 | 33 |
0 | 34 |
35 //----- (0042F184) -------------------------------------------------------- | |
295 | 36 int stru319::FindClosestActor(int pick_depth, int a3, int a4) |
0 | 37 { |
38 int v4; // edi@1 | |
39 stru319 *v5; // esi@1 | |
40 int v6; // eax@2 | |
41 int v7; // eax@4 | |
2334 | 42 // int result; // eax@5 |
43 // int *v9; // edx@8 | |
44 // signed int v10; // ebx@10 | |
45 // int v11; // edi@11 | |
2117 | 46 //Actor *v12; // esi@12 |
47 //unsigned __int16 v13; // ax@12 | |
2334 | 48 // int v14; // eax@22 |
2117 | 49 //char v15; // zf@30 |
2334 | 50 // int v16; // esi@32 |
51 // int v17; // ecx@34 | |
52 // stru319 *v18; // eax@39 | |
53 // int v19; // edx@39 | |
54 // int v20; // ecx@41 | |
55 // unsigned __int16 v21; // ax@42 | |
56 // unsigned int v22; // [sp+8h] [bp-24h]@11 | |
2117 | 57 //unsigned int v23; // [sp+Ch] [bp-20h]@7 |
0 | 58 stru319 *v24; // [sp+10h] [bp-1Ch]@1 |
2334 | 59 // unsigned int v25; // [sp+14h] [bp-18h]@8 |
60 // int *v26; // [sp+18h] [bp-14h]@8 | |
61 // int v27; // [sp+1Ch] [bp-10h]@10 | |
62 // int *v28; // [sp+20h] [bp-Ch]@10 | |
2117 | 63 //unsigned int v29; // [sp+24h] [bp-8h]@7 |
2334 | 64 // int v30; // [sp+28h] [bp-4h]@6 |
65 // int i; // [sp+38h] [bp+Ch]@33 | |
66 // signed int v32; // [sp+3Ch] [bp+10h]@32 | |
0 | 67 |
68 v4 = 0; | |
69 v5 = this; | |
70 v24 = this; | |
2153 | 71 //if ( pRenderer->pRenderD3D ) |
0 | 72 { |
73 v6 = a3 != 0; | |
74 if ( a4 ) | |
75 LOBYTE(v6) = v6 | 8; | |
295 | 76 v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1); |
0 | 77 if ( v7 != -1 ) |
78 return (unsigned __int16)v7; | |
295 | 79 else return 0; |
0 | 80 } |
2153 | 81 /*else // software impl |
0 | 82 { |
83 v30 = 0; | |
84 if ( pRenderer->pActiveZBuffer ) | |
85 { | |
692 | 86 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) |
0 | 87 { |
692 | 88 v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; |
89 v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
2117 | 90 for ( v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; v25; --v25 ) |
0 | 91 { |
2117 | 92 if ( (signed int)viewparams->uScreen_topL_X < (signed int)viewparams->uScreen_BttmR_X ) |
0 | 93 { |
94 v28 = v9; | |
95 v10 = v4; | |
2117 | 96 for ( v27 = viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X; v27; --v27 ) |
0 | 97 { |
98 v22 = *v28; | |
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 | 101 { |
2117 | 102 if ( pActors[PID_ID(v11)].uAIState != Dead ) |
0 | 103 { |
2117 | 104 if ( pActors[PID_ID(v11)].uAIState != Dying && pActors[PID_ID(v11)].uAIState != Removed |
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 | 107 { |
2117 | 108 if ( (!a4 || MonsterStats::BelongsToSupertype(pActors[PID_ID(v11)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) |
295 | 109 && v22 <= pick_depth << 16 ) |
0 | 110 { |
111 v14 = 0; | |
112 if ( v10 > 0 ) | |
113 { | |
2117 | 114 for ( v14; v14 < v30; ++v14 ) |
0 | 115 { |
116 if ( dword_50BDA0[v14] == v11 ) | |
117 break; | |
118 } | |
119 } | |
120 if ( v14 == v30 && v10 < 100 ) | |
121 { | |
122 ++v30; | |
123 dword_50BC10[v10] = v22; | |
124 dword_50BDA0[v10] = v11; | |
125 ++v10; | |
126 } | |
127 } | |
128 } | |
129 } | |
130 } | |
131 ++v28; | |
132 } | |
133 v4 = v30; | |
134 v5 = v24; | |
135 } | |
136 v9 = v26 + 640; | |
137 v26 += 640; | |
138 } | |
139 } | |
140 if ( v4 > 0 ) | |
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 | 143 for ( v32 = 1; v32 - 1 < v4; ++v32 ) |
0 | 144 { |
145 for ( i = v32; i < v4; ++i ) | |
146 { | |
147 v17 = dword_50BC10[i]; | |
2117 | 148 if ( dword_50BC10[i] < *(int *)v16 ) |
0 | 149 { |
150 dword_50BC10[i] = *(int *)v16; | |
151 *(int *)v16 = v17; | |
152 } | |
153 } | |
154 v16 += 4; | |
155 } | |
156 v5 = v24; | |
157 if ( v4 > 0 ) | |
158 { | |
159 v18 = v24; | |
2117 | 160 for ( v19 = v4; v19; --v19 ) |
0 | 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 | 163 v18 += 4; |
164 } | |
165 } | |
166 } | |
167 v20 = 0; | |
168 for ( *(int *)&v5[2000].field_0 = v4; v20 < v4; ++v20 ) | |
169 { | |
170 v21 = pActors[*(int *)&v5[4 * v20].field_0].uAIState; | |
171 if ( v21 != 4 && v21 != 5 ) | |
172 break; | |
173 } | |
174 if ( v20 != v4 ) | |
175 { | |
176 result = 8 * *(int *)&v5[4 * v20].field_0; | |
177 LOBYTE(result) = result | 3; | |
178 return result; | |
179 } | |
180 } | |
181 } | |
2153 | 182 return 0;*/ |
0 | 183 } |
184 | |
1052 | 185 |
186 |