Mercurial > mm7
comparison mm7_4.cpp @ 1513:4055b09160ae
Clean and decouple. (2)
author | yoctozepto |
---|---|
date | Mon, 02 Sep 2013 22:08:21 +0200 |
parents | a27cdb3d753e |
children | 965af46e8793 |
comparison
equal
deleted
inserted
replaced
1512:af57b3b76fe4 | 1513:4055b09160ae |
---|---|
47 #include "Lights.h" | 47 #include "Lights.h" |
48 | 48 |
49 //----- (0046CC4B) -------------------------------------------------------- | 49 //----- (0046CC4B) -------------------------------------------------------- |
50 void check_event_triggers() | 50 void check_event_triggers() |
51 { | 51 { |
52 int v0; // eax@1 | |
53 LevelDecoration *v1; // esi@2 | 52 LevelDecoration *v1; // esi@2 |
54 signed int v2; // edi@2 | 53 |
55 int v3; // ebx@2 | 54 for (size_t i = 0; i < num_event_triggers; i++) |
56 int v4; // eax@3 | 55 { |
57 int v5; // ebx@3 | 56 v1 = &pLevelDecorations[event_triggers[i]]; |
58 unsigned int v6; // ecx@3 | 57 |
59 unsigned int v7; // edx@6 | 58 if (v1->uFlags & LEVEL_DECORATION_TRIGGERED_BY_TOUCH |
60 unsigned int v8; // edx@8 | 59 && v1->vPosition.GetDistanceTo(pParty->vPosition) < v1->uTriggerRange) |
61 Actor *v9; // edi@13 | 60 { |
62 int v10; // ebx@14 | 61 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1); |
63 int v11; // eax@14 | 62 } |
64 int v12; // ebx@14 | 63 else if (v1->uFlags & LEVEL_DECORATION_TRIGGERED_BY_MONSTER) |
65 unsigned int v13; // ecx@14 | 64 { |
66 int v14; // edx@15 | 65 for (size_t j = 0; j < uNumActors; j++) |
67 unsigned int v15; // edx@17 | 66 { |
68 unsigned int v16; // edx@19 | 67 if (v1->vPosition.GetDistanceTo(pActors[j].vPosition) < v1->uTriggerRange) |
69 char *v17; // edi@25 | 68 EventProcessor(v1->field_16_event_id, 0, 1); |
70 int v18; // ebx@26 | 69 } |
71 int v19; // eax@26 | 70 } |
72 int v20; // ebx@26 | 71 else if (v1->uFlags & LEVEL_DECORATION_TRIGGERED_BY_OBJECT) |
73 unsigned int v21; // ecx@26 | 72 { |
74 int v22; // edx@27 | 73 for (size_t j = 0; j < uNumSpriteObjects; j++) |
75 unsigned int v23; // edx@29 | 74 { |
76 unsigned int v24; // edx@31 | 75 if (v1->vPosition.GetDistanceTo(pSpriteObjects[j].vPosition) < v1->uTriggerRange) |
77 int v25; // [sp+0h] [bp-24h]@3 | 76 EventProcessor(v1->field_16_event_id, 0, 1); |
78 int v26; // [sp+0h] [bp-24h]@14 | 77 } |
79 int v27; // [sp+0h] [bp-24h]@26 | 78 } |
80 int v28; // [sp+4h] [bp-20h]@3 | |
81 int v29; // [sp+4h] [bp-20h]@14 | |
82 int v30; // [sp+4h] [bp-20h]@26 | |
83 signed int v31; // [sp+8h] [bp-1Ch]@2 | |
84 int v32; // [sp+Ch] [bp-18h]@2 | |
85 int v33; // [sp+10h] [bp-14h]@2 | |
86 int i; // [sp+14h] [bp-10h]@1 | |
87 int v35; // [sp+18h] [bp-Ch]@2 | |
88 int v36; // [sp+1Ch] [bp-8h]@3 | |
89 signed int v37; // [sp+1Ch] [bp-8h]@12 | |
90 signed int v38; // [sp+20h] [bp-4h]@24 | |
91 | |
92 v0 = 0; | |
93 for ( i = 0; i < num_event_triggers; ++i ) | |
94 { | |
95 v1 = &pLevelDecorations[event_triggers[v0]]; | |
96 v2 = v1->field_18; | |
97 v3 = v1->vPosition.y; | |
98 v33 = v1->vPosition.x; | |
99 v32 = v1->vPosition.y; | |
100 v35 = v1->vPosition.z; | |
101 v31 = v1->field_18; | |
102 if (v1->uFlags & LEVEL_DECORATION_TRIGGERED_BY_TOUCH) | |
103 { | |
104 v36 = abs(v1->vPosition.x - pParty->vPosition.x); | |
105 v25 = abs(v3 - pParty->vPosition.y); | |
106 v28 = abs(v35 - pParty->vPosition.z); | |
107 v4 = v36; | |
108 v5 = v25; | |
109 v6 = v28; | |
110 if ( v36 < v25 ) | |
111 { | |
112 v4 = v25; | |
113 v5 = v36; | |
114 } | |
115 if ( v4 < v28 ) | |
116 { | |
117 v7 = v4; | |
118 v4 = v28; | |
119 v6 = v7; | |
120 } | |
121 if ( v5 < (signed int)v6 ) | |
122 { | |
123 v8 = v6; | |
124 v6 = v5; | |
125 v5 = v8; | |
126 } | |
127 if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) | |
128 EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1); | |
129 } | |
130 if (v1->uFlags & LEVEL_DECORATION_TRIGGERED_BY_MONSTER) | |
131 { | |
132 v37 = 0; | |
133 if ( (signed int)uNumActors > 0 ) | |
134 { | |
135 v9 = pActors.data();//[0].vPosition.y; | |
136 do | |
137 { | |
138 v10 = abs(v33 - v9->vPosition.x); | |
139 v29 = abs(v32 - v9->vPosition.y); | |
140 v26 = abs(v35 - v9->vPosition.z); | |
141 v11 = v10; | |
142 v12 = v29; | |
143 v13 = v26; | |
144 if ( v11 < v29 ) | |
145 { | |
146 v14 = v11; | |
147 v11 = v29; | |
148 v12 = v14; | |
149 } | |
150 if ( v11 < v26 ) | |
151 { | |
152 v15 = v11; | |
153 v11 = v26; | |
154 v13 = v15; | |
155 } | |
156 if ( v12 < (signed int)v13 ) | |
157 { | |
158 v16 = v13; | |
159 v13 = v12; | |
160 v12 = v16; | |
161 } | |
162 if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 ) | |
163 EventProcessor(v1->field_16_event_id, 0, 1); | |
164 ++v37; | |
165 ++v9; | |
166 } | |
167 while ( v37 < (signed int)uNumActors ); | |
168 } | |
169 } | |
170 if (v1->uFlags & LEVEL_DECORATION_TRIGGERED_BY_OBJECT) | |
171 { | |
172 v38 = 0; | |
173 if ( (signed int)uNumSpriteObjects > 0 ) | |
174 { | |
175 v17 = (char *)&pSpriteObjects[0].vPosition.y; | |
176 do | |
177 { | |
178 v18 = abs(v33 - *((int *)v17 - 1)); | |
179 v30 = abs(v32 - *(int *)v17); | |
180 v27 = abs(v35 - *((int *)v17 + 1)); | |
181 v19 = v18; | |
182 v20 = v30; | |
183 v21 = v27; | |
184 if ( v19 < v30 ) | |
185 { | |
186 v22 = v19; | |
187 v19 = v30; | |
188 v20 = v22; | |
189 } | |
190 if ( v19 < v27 ) | |
191 { | |
192 v23 = v19; | |
193 v19 = v27; | |
194 v21 = v23; | |
195 } | |
196 if ( v20 < (signed int)v21 ) | |
197 { | |
198 v24 = v21; | |
199 v21 = v20; | |
200 v20 = v24; | |
201 } | |
202 if ( (signed int)(((unsigned int)(11 * v20) >> 5) + (v21 >> 2) + v19) < v31 ) | |
203 EventProcessor(v1->field_16_event_id, 0, 1); | |
204 ++v38; | |
205 v17 += 112; | |
206 } | |
207 while ( v38 < (signed int)uNumSpriteObjects ); | |
208 } | |
209 } | |
210 v0 = i + 1; | |
211 } | 79 } |
212 } | 80 } |
213 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; | 81 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; |
214 | 82 |
215 //----- (0046D8E3) -------------------------------------------------------- | 83 //----- (0046D8E3) -------------------------------------------------------- |