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