annotate Viewport.cpp @ 1297:5450af4f57ef

moving files mm7_x ending
author Ritor1
date Wed, 19 Jun 2013 17:06:58 +0600
parents fac7751b2dc9
children cc8d58f2bf0c
rev   line source
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
1 #include "Viewport.h"
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
2
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
3 #include "Party.h"
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
4 #include "Indoor.h"
1051
05c62d166182 004C1D2B cleaned
Nomad
parents: 1027
diff changeset
5 #include "Math.h"
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
6 #include "mm7_data.h"
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
7 #include "Actor.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
8 #include "Outdoor.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
9 #include "Events.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
10 #include "BSPModel.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
11 #include "Mouse.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
12 #include "SpriteObject.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
13 #include "ObjectList.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
14 #include "DecorationList.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
15 #include "texts.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
16 #include "Game.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
17 #include "Vis.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
18 #include "LOD.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
19 #include "GUIWindow.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
20 #include "TurnEngine.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
21 #include "stru123.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
22 #include "MM7.h"
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
23
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
24
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
25 //----- (004C0262) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
26 void Viewport::SetScreen( signed int sTL_X, signed int sTL_Y, signed int sBR_X, signed int sBR_Y )
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
27 {
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
28 unsigned int tl_x; // edx@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
29 unsigned int br_x; // esi@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
30 unsigned int tl_y; // edi@3
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
31 unsigned int br_y; // eax@3
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
32
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
33 tl_x = sTL_X;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
34 br_x = sBR_X;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
35 if ( sTL_X > sBR_X )
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
36 {
1027
Nomad
parents: 949
diff changeset
37 __debugbreak(); // check this code
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
38 br_x = sBR_X ^ sTL_X ^ sBR_X; // swap x's
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
39 tl_x = br_x ^ sBR_X ^ sTL_X;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
40 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
41 tl_y = sTL_Y;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
42 br_y = sBR_Y;
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
43 if ( sTL_Y > sBR_Y )
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
44 {
1027
Nomad
parents: 949
diff changeset
45 __debugbreak(); // check this code
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
46 br_y = sBR_Y ^ sTL_Y ^ sBR_Y; // swap y's
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
47 tl_y = br_y ^ sBR_Y ^ sTL_Y;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
48 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
49 this->uScreen_TL_X = tl_x;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
50 this->uScreen_TL_Y = tl_y;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
51 this->uScreen_BR_X = br_x;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
52 this->uScreen_BR_Y = br_y;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
53 this->uScreenWidth = br_x - tl_x + 1;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
54 this->uScreenHeight = br_y - tl_y + 1;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
55 this->uScreenCenterX = (signed int)(br_x + tl_x) /2;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
56 if ( pRenderer->pRenderD3D == 0 )
871
710cf848ad24 Particle engine made working.
Nomad
parents: 762
diff changeset
57 this->uScreenCenterY = this->uScreen_BR_Y - fixpoint_sub0(field_30, uScreenHeight);
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
58 else
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
59 this->uScreenCenterY = uScreenHeight/2;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
60 SetViewport(this->uScreen_TL_X, this->uScreen_TL_Y, this->uScreen_BR_X, this->uScreen_BR_Y);
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
61 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
62
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
63 //----- (004C02F8) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
64 void Viewport::_4C02F8(int a2)
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
65 {
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
66 this->field_30 = a2;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
67 SetScreen(this->uScreen_TL_X, this->uScreen_TL_Y, this->uScreen_BR_X, this->uScreen_BR_Y);
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
68 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
69
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
70 //----- (004C0312) --------------------------------------------------------
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
71 void Viewport::SetViewport( signed int sTL_X, signed int sTL_Y, signed int sBR_X, signed int sBR_Y )
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
72 {
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
73 signed int tl_x; // ebx@1
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
74 signed int tl_y; // edi@3
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
75 signed int br_x; // edx@5
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
76 signed int br_y; // eax@7
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
77
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
78 tl_x = sTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
79 if ( sTL_X < this->uScreen_TL_X )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
80 tl_x = this->uScreen_TL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
81 tl_y = sTL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
82 if ( sTL_Y < this->uScreen_TL_Y )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
83 tl_y = this->uScreen_TL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
84 br_x = sBR_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
85 if ( sBR_X > this->uScreen_BR_X )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
86 br_x = this->uScreen_BR_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
87 br_y = sBR_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
88 if ( sBR_Y > this->uScreen_BR_Y )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
89 br_y = this->uScreen_BR_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
90 this->uViewportTL_Y = tl_y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
91 this->uViewportTL_X = tl_x;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
92 this->uViewportBR_X = br_x;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
93 this->uViewportBR_Y = br_y;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
94 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
95
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
96 //----- (00443219) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
97 void ViewingParams::_443219()
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
98 {
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
99 this->sViewCenterY += 512;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
100 AdjustPosition();
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
101 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
102
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
103 //----- (00443225) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
104 void ViewingParams::_443225()
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
105 {
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
106 this->sViewCenterX -= 512;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
107 AdjustPosition();
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
108 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
109
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
110 //----- (00443231) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
111 void ViewingParams::_443231()
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
112 {
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
113 this->sViewCenterY -= 512;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
114 AdjustPosition();
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
115 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
116
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
117 //----- (0044323D) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
118 void ViewingParams::_44323D()
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
119 {
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
120 this->sViewCenterX += 512;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
121 AdjustPosition();
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
122 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
123
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
124 //----- (00443249) --------------------------------------------------------
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
125 void ViewingParams::CenterOnParty()
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
126 {
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
127 int v1; // edx@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
128
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
129 v1 = (unsigned __int64)((signed __int64)this->field_2C << 15) >> 16;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
130 this->field_2C = v1;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
131 if ( v1 < 384 )
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
132 this->field_2C = 384;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
133 this->sViewCenterX = pParty->vPosition.x;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
134 this->sViewCenterY = pParty->vPosition.y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
135 AdjustPosition();
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
136 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
137
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
138 //----- (00443291) --------------------------------------------------------
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
139 void ViewingParams::CenterOnParty2()
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
140 {
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
141 int v1; // edx@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
142 int v2; // eax@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
143
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
144 v1 = 2 * this->field_2C;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
145 v2 = 1536;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
146 this->field_2C = v1;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
147 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
148 v2 = 3072;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
149 if ( v1 > v2 )
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
150 this->field_2C = v2;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
151 this->sViewCenterX = pParty->vPosition.x;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
152 this->sViewCenterY = pParty->vPosition.y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
153 AdjustPosition();
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
154 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
155
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
156 //----- (004432E7) --------------------------------------------------------
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
157 void ViewingParams::AdjustPosition()
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
158 {
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
159 ViewingParams *v1; // esi@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
160 int v2; // ebx@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
161 signed int v3; // edx@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
162 int v4; // ecx@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
163 int v5; // edi@3
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
164 int v6; // eax@3
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
165 int v7; // eax@5
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
166
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
167
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
168 v1 = this;
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
169 v2 = this->indoor_center_y;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
170 v3 = 88 >> this->field_2C / 384;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
171 v4 = (44 - v3) << 9;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
172 if ( v1->sViewCenterY > v2 + v4 )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
173 v1->sViewCenterY = v2 + v4;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
174
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
175 v5 = v1->indoor_center_x;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
176 v6 = (v3 - 44) << 9;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
177 if ( v1->sViewCenterX < v5 + v6 )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
178 v1->sViewCenterX = v5 + v6;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
179
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
180 v7 = v2 + v6;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
181 if ( v1->sViewCenterY < v7 )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
182 v1->sViewCenterY = v7;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
183
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
184 if ( v1->sViewCenterX > v5 + v4 )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
185 v1->sViewCenterX = v5 + v4;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
186 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
187
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
188 //----- (00443343) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
189 void ViewingParams::InitGrayPalette()
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
190 {
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
191 for (unsigned short i=0; i<256; ++i)
949
Nomad
parents: 871
diff changeset
192 pPalette[i]=TargetColor(i, i, i);
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
193 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
194
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
195 //----- (00443365) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
196 void ViewingParams::_443365()
1222
Ritor1
parents: 1051
diff changeset
197 {
Ritor1
parents: 1051
diff changeset
198 Vec3_short_ *v3; // eax@4
Ritor1
parents: 1051
diff changeset
199 Vec3_short_ *v6; // eax@12
Ritor1
parents: 1051
diff changeset
200 int minimum_y; // [sp+10h] [bp-10h]@2
Ritor1
parents: 1051
diff changeset
201 int maximum_y; // [sp+14h] [bp-Ch]@2
Ritor1
parents: 1051
diff changeset
202 int minimum_x; // [sp+18h] [bp-8h]@2
Ritor1
parents: 1051
diff changeset
203 int maximum_x; // [sp+1Ch] [bp-4h]@2
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
204
1222
Ritor1
parents: 1051
diff changeset
205 InitGrayPalette();
Ritor1
parents: 1051
diff changeset
206 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents: 1051
diff changeset
207 {
Ritor1
parents: 1051
diff changeset
208 minimum_x = 0x40000000;
Ritor1
parents: 1051
diff changeset
209 minimum_y = 0x40000000;
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
210
1222
Ritor1
parents: 1051
diff changeset
211 maximum_x = -0x40000000;
Ritor1
parents: 1051
diff changeset
212 maximum_y = -0x40000000;
Ritor1
parents: 1051
diff changeset
213 for (int i=0; i<pIndoor->pMapOutlines->uNumOutlines; ++i)
Ritor1
parents: 1051
diff changeset
214 {
Ritor1
parents: 1051
diff changeset
215 v3 = &pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uFace1ID];
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
216
1222
Ritor1
parents: 1051
diff changeset
217 if ( v3->x < minimum_x )
Ritor1
parents: 1051
diff changeset
218 minimum_x = v3->x;
Ritor1
parents: 1051
diff changeset
219 if ( v3->x > maximum_x )
Ritor1
parents: 1051
diff changeset
220 maximum_x = v3->x;
Ritor1
parents: 1051
diff changeset
221 if ( v3->y < minimum_y )
Ritor1
parents: 1051
diff changeset
222 minimum_y = v3->x;
Ritor1
parents: 1051
diff changeset
223 if ( v3->y > maximum_y )
Ritor1
parents: 1051
diff changeset
224 maximum_y = v3->x;
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
225
1222
Ritor1
parents: 1051
diff changeset
226 v6 = &pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uFace2ID];
Ritor1
parents: 1051
diff changeset
227
Ritor1
parents: 1051
diff changeset
228 if ( v6->x < minimum_x )
Ritor1
parents: 1051
diff changeset
229 minimum_x = v3->x;
Ritor1
parents: 1051
diff changeset
230 if ( v6->x > maximum_x )
Ritor1
parents: 1051
diff changeset
231 maximum_x = v3->x;
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
232
1222
Ritor1
parents: 1051
diff changeset
233 if ( v6->y < minimum_y )
Ritor1
parents: 1051
diff changeset
234 minimum_y = v3->y;
Ritor1
parents: 1051
diff changeset
235 if ( v6->y > maximum_y )
Ritor1
parents: 1051
diff changeset
236 maximum_y = v3->y;
Ritor1
parents: 1051
diff changeset
237 }
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
238
1222
Ritor1
parents: 1051
diff changeset
239 uMinimapZoom = 1024;
Ritor1
parents: 1051
diff changeset
240 indoor_center_x = (signed int)(minimum_x + maximum_x) / 2;
Ritor1
parents: 1051
diff changeset
241 field_28 = 10;
Ritor1
parents: 1051
diff changeset
242 indoor_center_y = (signed int)(minimum_y + maximum_y) / 2;
Ritor1
parents: 1051
diff changeset
243 }
Ritor1
parents: 1051
diff changeset
244 else
Ritor1
parents: 1051
diff changeset
245 {
Ritor1
parents: 1051
diff changeset
246 indoor_center_x = 0;
Ritor1
parents: 1051
diff changeset
247 indoor_center_y = 0;
Ritor1
parents: 1051
diff changeset
248 uMinimapZoom = _576E2C_current_minimap_zoom;
Ritor1
parents: 1051
diff changeset
249 field_28 = dword_576E28;
Ritor1
parents: 1051
diff changeset
250 }
Ritor1
parents: 1051
diff changeset
251 field_2C = 384;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
252 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
253 //----- (0042213C) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
254 void OnGameViewportClick()
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
255 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
256 signed int v0; // ebx@2
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
257 POINT *v1; // esi@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
258 signed int v2; // eax@9
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
259 BLVFace *v3; // eax@10
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
260 unsigned int v4; // eax@11
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
261 unsigned __int16 v5; // dx@14
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
262 signed int v6; // eax@14
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
263 char *v7; // esi@15
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
264 //int *v8; // eax@19
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
265 int v9; // eax@19
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
266 unsigned int v10; // eax@19
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
267 int v11; // ecx@21
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
268 ODMFace *v12; // eax@22
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
269 LevelDecoration *v13; // esi@24
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
270 __int16 v14; // ax@25
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
271 int v15; // ecx@29
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
272 signed int v16; // edx@30
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
273 Actor *v17; // esi@30
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
274 int v18; // ebx@47
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
275 unsigned __int16 v19; // ax@50
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
276 const char *v20; // eax@51
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
277 signed int v21; // eax@58
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
278 ItemGen *v22; // esi@62
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
279 unsigned int v23; // eax@62
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
280 SpriteObject a1; // [sp+Ch] [bp-80h]@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
281 //POINT v25; // [sp+7Ch] [bp-10h]@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
282 POINT a2; // [sp+84h] [bp-8h]@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
283
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
284 v1 = pMouse->GetCursorPos(&a2);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
285 if ( pRenderer->pRenderD3D )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
286 v0 = pGame->pVisInstance->get_picked_object_zbuf_val();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
287 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
288 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
289 v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[v1->y]];
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
290 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
291
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
292 if ( PID_TYPE(v0) == OBJECT_Item)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
293 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
294 a2.y = (signed int)(unsigned __int16)v0 >> 3;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
295 v21 = (signed int)(unsigned __int16)v0 >> 3;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
296 if ( !(pObjectList->pObjects[pSpriteObjects[v21].uObjectDescID].uFlags & 0x10) && a2.y < 1000 && pSpriteObjects[v21].uObjectDescID
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
297 && (unsigned int)v0 < 0x2000000 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
298 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
299 v22 = &pSpriteObjects[v21].stru_24;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
300 v23 = pSpriteObjects[v21].stru_24.uItemID;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
301 if ( pItemsTable->pItems[v23].uEquipType == 18 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
302 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
303 party_finds_gold(v22->uSpecEnchantmentType, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
304 viewparams->bRedrawGameUI = 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
305 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
306 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
307 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
308 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v23].pUnidentifiedName);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
309 ShowStatusBarString(pTmpBuf2.data(), 2u);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
310 if ( v22->uItemID == 506 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
311 _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
312 if ( v22->uItemID == 455 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
313 _449B7E_toggle_bit(pParty->_quest_bits, 185, 1u);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
314 if ( !pParty->AddItem(v22) )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
315 pParty->SetHoldingItem(v22);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
316 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
317 SpriteObject::OnInteraction(a2.y);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
318 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
319 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
320 v4 = pParty->pPickedItem.uItemID;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
321 if ( !pParty->pPickedItem.uItemID )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
322 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
323 goto LABEL_14;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
324 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
325 if ( PID_TYPE(v0) != OBJECT_Actor)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
326 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
327 if ( PID_TYPE(v0) == OBJECT_Decoration)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
328 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
329 v13 = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3];
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
330 if ( (signed int)(((unsigned int)v0 >> 16) - pDecorationList->pDecorations[v13->uDecorationDescID].uRadius) >= 512 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
331 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
332 v4 = pParty->pPickedItem.uItemID;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
333 if ( !pParty->pPickedItem.uItemID )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
334 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
335 goto LABEL_14;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
336 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
337 v14 = v13->field_16_event_id;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
338 if ( !v14 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
339 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
340 if ( pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].IsInteractive() )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
341 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
342 v15 = stru_5E4C90._decor_events[v13->_idx_in_stru123 - 75] + 380;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
343 activeLevelDecoration = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3];
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
344 EventProcessor(v15, 0, 1);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
345 activeLevelDecoration = NULL;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
346 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
347 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
348 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
349 v11 = v14;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
350 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
351 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
352 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
353 if ( PID_TYPE(v0) != OBJECT_BModel || HIWORD(v0) >= 512 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
354 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
355 v4 = pParty->pPickedItem.uItemID;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
356 if ( !pParty->pPickedItem.uItemID )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
357 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
358 goto LABEL_14;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
359 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
360 v2 = PID_ID(v0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
361 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
362 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
363 v3 = &pIndoor->pFaces[v2];
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
364 if ( !(v3->uAttributes & 0x2000000) )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
365 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
366 LABEL_11:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
367 v4 = pParty->pPickedItem.uItemID;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
368 if ( !pParty->pPickedItem.uItemID )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
369 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
370 ShowNothingHereStatus();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
371 v4 = pParty->pPickedItem.uItemID;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
372 if ( !pParty->pPickedItem.uItemID )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
373 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
374 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
375 LABEL_14:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
376 v5 = pItemsTable->pItems[v4].uSpriteID;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
377 v6 = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
378 a1.uType = v5;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
379 if ( (signed int)pObjectList->uNumObjects <= 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
380 LOWORD(v6) = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
381 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
382 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
383 v7 = (char *)&pObjectList->pObjects->uObjectID;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
384 while ( v5 != *(short *)v7 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
385 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
386 ++v6;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
387 v7 += 56;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
388 if ( v6 >= (signed int)pObjectList->uNumObjects )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
389 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
390 LOWORD(v6) = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
391 break;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
392 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
393 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
394 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
395 a1.uObjectDescID = v6;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
396 a1.vPosition.y = pParty->vPosition.y;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
397 a1.spell_caster_pid = OBJECT_Player;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
398 a1.vPosition.x = pParty->vPosition.x;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
399 a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
400 a1.uSoundID = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
401 a1.uFacing = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
402 a1.uAttributes = 8;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
403 a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
404 a1.uSpriteFrameID = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
405 memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
406
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
407 extern int UnprojectX(int);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
408 v9 = UnprojectX(v1->x);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
409 a1.Create(pParty->sRotationY + v9, 184, 200, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
410 v10 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
411 if (v10 != -1)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
412 pIcons_LOD->pTextures[v10].Release();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
413 pMouse->RemoveHoldingItem();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
414 pIcons_LOD->SyncLoadedFilesCount();
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
415 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
416 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
417 v11 = pIndoor->pFaceExtras[v3->uFaceExtraID].uEventID;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
418 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
419 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
420 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
421 v12 = &pOutdoor->pBModels[(signed int)(v0 & 0xFFFF) >> 9].pFaces[v2 & 0x3F];
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
422 if ( !v12->Clickable())
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
423 goto LABEL_11;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
424 v11 = v12->sCogTriggeredID;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
425 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
426 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
427 EventProcessor(v11, (unsigned __int16)v0, 1);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
428 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
429 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
430 v16 = (signed int)(unsigned __int16)v0 >> 3;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
431 a2.y = v16;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
432 v17 = &pActors[v16];
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
433 if ( v17->uAIState == 5 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
434 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
435 if ( (unsigned int)v0 < 0x2000000 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
436 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
437 stru_50C198.LootActor(&pActors[v16]);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
438 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
439 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
440 v4 = pParty->pPickedItem.uItemID;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
441 if ( !pParty->pPickedItem.uItemID )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
442 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
443 goto LABEL_14;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
444 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
445 if ( GetAsyncKeyState(VK_SHIFT) >= 0 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
446 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
447 if ( !v17->GetActorsRelation(0) && !(BYTE2(v17->uAttributes) & 8) )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
448 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
449 if ( HIWORD(v0) >= 512)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
450 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
451 v4 = pParty->pPickedItem.uItemID;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
452 if ( !pParty->pPickedItem.uItemID )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
453 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
454 goto LABEL_14;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
455 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
456 if ( !v17->CanAct() )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
457 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
458 v18 = a2.y;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
459 Actor::AI_FaceObject(a2.y, 4u, 0, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
460 if ( !v17->sNPC_ID )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
461 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
462 v19 = pNPCStats->pGroups_copy[v17->uGroup];
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
463 if ( v19 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
464 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
465 v20 = pNPCStats->pCatchPhrases[v19];
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
466 if ( v20 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
467 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
468 pParty->uFlags |= 2u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
469 strcpy(byte_5B0938.data(), v20);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
470 sub_4451A8_press_any_key(0, 0, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
471 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
472 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
473 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
474 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
475 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
476 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
477 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_StartNPCDialogue;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
478 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v18;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
479 LABEL_42:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
480 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
481 ++pMessageQueue_50CBD0->uNumMessages;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
482 return;*/
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
483 pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v18, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
484 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
485 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
486 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
487 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
488 pTurnEngine->field_18 |= 8u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
489 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
490 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
491 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
492 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
493 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Attack;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
494 goto LABEL_41;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
495 }*/
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
496 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
497 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
498 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
499 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
500 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
501 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
502 pParty->uFlags |= PARTY_FLAGS_1_FALLING;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
503 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
504 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
505 if ( uActiveCharacter
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
506 && sub_427769_spell(pPlayers[uActiveCharacter]->uQuickSpell))
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
507 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
508 pMessageQueue_50CBD0->AddMessage(UIMSG_CastQuickSpell, 0, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
509 /*&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
510 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_CastQuickSpell;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
511 LABEL_41:
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
512 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
513 goto LABEL_42;*/
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
514 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
515 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
516 }