annotate Viewport.cpp @ 2461:ff7f4995aa25

function MakeScreenshot()
author Ritor1
date Tue, 05 Aug 2014 17:00:35 +0600
parents f4af3b203f65
children 104fdbea0386
rev   line source
2415
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2402
diff changeset
1 #define _CRTDBG_MAP_ALLOC
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2402
diff changeset
2 #include <stdlib.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2402
diff changeset
3 #include <crtdbg.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2402
diff changeset
4
2253
aff7a7b072b7 adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents: 2242
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
6 #include "Viewport.h"
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
7
2336
d6887ee81068 header file include cleanup
Grumpy7
parents: 2334
diff changeset
8 #include "mm7_unsorted_subs.h"
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
9 #include "Party.h"
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
10 #include "Indoor.h"
2037
7a9477135943 Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents: 1987
diff changeset
11 #include "OurMath.h"
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
12 #include "mm7_data.h"
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
13 #include "Actor.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
14 #include "Outdoor.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
15 #include "Events.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
16 #include "BSPModel.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
17 #include "Mouse.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
18 #include "SpriteObject.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
19 #include "ObjectList.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
20 #include "DecorationList.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
21 #include "texts.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
22 #include "Game.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
23 #include "Vis.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
24 #include "LOD.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
25 #include "GUIWindow.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
26 #include "TurnEngine.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
27 #include "stru123.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
28 #include "MM7.h"
1828
35c1e4ff6ba7 party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents: 1736
diff changeset
29 #include "Level/Decoration.h"
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
30
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
31
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
32 //----- (004C0262) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
33 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
34 {
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
35 unsigned int tl_x; // edx@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
36 unsigned int br_x; // esi@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
37 unsigned int tl_y; // edi@3
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
38 unsigned int br_y; // eax@3
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
39
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
40 tl_x = sTL_X;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
41 br_x = sBR_X;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
42 if ( sTL_X > sBR_X )
2196
628a0ad87136 Some more PVS error fixing
Grumpy7
parents: 2166
diff changeset
43 {
628a0ad87136 Some more PVS error fixing
Grumpy7
parents: 2166
diff changeset
44 br_x = sTL_X; // swap x's
628a0ad87136 Some more PVS error fixing
Grumpy7
parents: 2166
diff changeset
45 tl_x = sBR_X;
628a0ad87136 Some more PVS error fixing
Grumpy7
parents: 2166
diff changeset
46 }
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
47 tl_y = sTL_Y;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
48 br_y = sBR_Y;
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
49 if ( sTL_Y > sBR_Y )
2196
628a0ad87136 Some more PVS error fixing
Grumpy7
parents: 2166
diff changeset
50 {
628a0ad87136 Some more PVS error fixing
Grumpy7
parents: 2166
diff changeset
51 br_y = sTL_Y; // swap y's
628a0ad87136 Some more PVS error fixing
Grumpy7
parents: 2166
diff changeset
52 tl_y = sBR_Y;
628a0ad87136 Some more PVS error fixing
Grumpy7
parents: 2166
diff changeset
53 }
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
54 this->uScreen_TL_X = tl_x;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
55 this->uScreen_TL_Y = tl_y;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
56 this->uScreen_BR_X = br_x;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
57 this->uScreen_BR_Y = br_y;
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
58 this->uScreenWidth = br_x - tl_x + 1;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
59 this->uScreenHeight = br_y - tl_y + 1;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
60 this->uScreenCenterX = (signed int)(br_x + tl_x) /2;
2069
259df09dfb50 32bits almost there
Nomad
parents: 2037
diff changeset
61 //if ( pRenderer->pRenderD3D == 0 )
259df09dfb50 32bits almost there
Nomad
parents: 2037
diff changeset
62 // this->uScreenCenterY = this->uScreen_BR_Y - fixpoint_mul(field_30, uScreenHeight);
259df09dfb50 32bits almost there
Nomad
parents: 2037
diff changeset
63 //else
1987
a688e8646d72 Indoor viewport top fixed
zipi
parents: 1966
diff changeset
64 this->uScreenCenterY = (br_y + tl_y)/2;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
65 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
66 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
67
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
68 //----- (004C02F8) --------------------------------------------------------
2151
92511cd8fcdb Cleaned some variables.
Nomad
parents: 2107
diff changeset
69 void Viewport::SetFOV(int field_of_view)
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1558
diff changeset
70 {
2151
92511cd8fcdb Cleaned some variables.
Nomad
parents: 2107
diff changeset
71 this->field_of_view = field_of_view;
92511cd8fcdb Cleaned some variables.
Nomad
parents: 2107
diff changeset
72 SetScreen(uScreen_TL_X, uScreen_TL_Y, uScreen_BR_X, uScreen_BR_Y);
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1558
diff changeset
73 }
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
74
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
75 //----- (004C0312) --------------------------------------------------------
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
76 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
77 {
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
78 signed int tl_x; // ebx@1
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
79 signed int tl_y; // edi@3
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
80 signed int br_x; // edx@5
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
81 signed int br_y; // eax@7
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
82
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
83 tl_x = sTL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
84 if ( sTL_X < this->uScreen_TL_X )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
85 tl_x = this->uScreen_TL_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
86 tl_y = sTL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
87 if ( sTL_Y < this->uScreen_TL_Y )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
88 tl_y = this->uScreen_TL_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
89 br_x = sBR_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
90 if ( sBR_X > this->uScreen_BR_X )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
91 br_x = this->uScreen_BR_X;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
92 br_y = sBR_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
93 if ( sBR_Y > this->uScreen_BR_Y )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
94 br_y = this->uScreen_BR_Y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
95 this->uViewportTL_Y = tl_y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
96 this->uViewportTL_X = tl_x;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
97 this->uViewportBR_X = br_x;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
98 this->uViewportBR_Y = br_y;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
99 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
100
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
101 //----- (00443219) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
102 void ViewingParams::_443219()
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
103 {
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
104 this->sViewCenterY += 512;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
105
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
106 AdjustPosition();
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
107 }
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
108
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
109 //----- (00443225) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
110 void ViewingParams::_443225()
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
111 {
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
112 this->sViewCenterX -= 512;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
113
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
114 AdjustPosition();
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
115 }
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
116
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
117 //----- (00443231) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
118 void ViewingParams::_443231()
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
119 {
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
120 this->sViewCenterY -= 512;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
121
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
122 AdjustPosition();
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
123 }
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
124
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
125 //----- (0044323D) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
126 void ViewingParams::_44323D()
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
127 {
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
128 this->sViewCenterX += 512;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
129
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
130 AdjustPosition();
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
131 }
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
132
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
133 //----- (00443249) --------------------------------------------------------
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
134 void ViewingParams::CenterOnParty()
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
135 {
2207
ff8920a40c21 fixpoint_mul
Ritor1
parents: 2203
diff changeset
136 this->uMapBookMapZoom = fixpoint_mul(0x8000, this->uMapBookMapZoom);
1720
Ritor1
parents: 1643
diff changeset
137 if (this->uMapBookMapZoom < 384)
Ritor1
parents: 1643
diff changeset
138 this->uMapBookMapZoom = 384;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
139
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
140 this->sViewCenterX = pParty->vPosition.x;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
141 this->sViewCenterY = pParty->vPosition.y;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
142
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
143 AdjustPosition();
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
144 }
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
145
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
146 //----- (00443291) --------------------------------------------------------
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
147 void ViewingParams::CenterOnParty2()
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
148 {
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
149 int v2; // eax@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
150
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
151 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
152 v2 = 1536;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
153 else if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
154 v2 = 3072;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
155 else assert(false);
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
156
1720
Ritor1
parents: 1643
diff changeset
157 this->uMapBookMapZoom *= 2;
Ritor1
parents: 1643
diff changeset
158 if (this->uMapBookMapZoom > v2 )
Ritor1
parents: 1643
diff changeset
159 this->uMapBookMapZoom = v2;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
160
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
161 this->sViewCenterX = pParty->vPosition.x;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
162 this->sViewCenterY = pParty->vPosition.y;
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
163 AdjustPosition();
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
164 }
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
165
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
166 //----- (004432E7) --------------------------------------------------------
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
167 void ViewingParams::AdjustPosition()
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1514
diff changeset
168 {
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
169 ViewingParams *v1; // esi@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
170 int v2; // ebx@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
171 signed int v3; // edx@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
172 int v4; // ecx@1
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
173 int v5; // edi@3
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
174 int v6; // eax@3
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
175 int v7; // eax@5
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
176
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
177
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
178 v1 = this;
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
179 v2 = this->indoor_center_y;
1720
Ritor1
parents: 1643
diff changeset
180 v3 = 88 >> (this->uMapBookMapZoom / 384);
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
181 v4 = (44 - v3) << 9;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
182 if ( v1->sViewCenterY > v2 + v4 )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
183 v1->sViewCenterY = v2 + v4;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
184
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
185 v5 = v1->indoor_center_x;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
186 v6 = (v3 - 44) << 9;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
187 if ( v1->sViewCenterX < v5 + v6 )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
188 v1->sViewCenterX = v5 + v6;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
189
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
190 v7 = v2 + v6;
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
191 if ( v1->sViewCenterY < v7 )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
192 v1->sViewCenterY = v7;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
193
693
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
194 if ( v1->sViewCenterX > v5 + v4 )
e0a1fccc89b1 map render fixes
Gloval
parents: 692
diff changeset
195 v1->sViewCenterX = v5 + v4;
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
196 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
197
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
198 //----- (00443343) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
199 void ViewingParams::InitGrayPalette()
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
200 {
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
201 for (unsigned short i=0; i<256; ++i)
2069
259df09dfb50 32bits almost there
Nomad
parents: 2037
diff changeset
202 pPalette[i]=Color16(i, i, i);
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
203 }
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
204
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
205 //----- (00443365) --------------------------------------------------------
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
206 void ViewingParams::_443365()
1222
Ritor1
parents: 1051
diff changeset
207 {
Ritor1
parents: 1051
diff changeset
208 Vec3_short_ *v3; // eax@4
Ritor1
parents: 1051
diff changeset
209 Vec3_short_ *v6; // eax@12
Ritor1
parents: 1051
diff changeset
210 int minimum_y; // [sp+10h] [bp-10h]@2
Ritor1
parents: 1051
diff changeset
211 int maximum_y; // [sp+14h] [bp-Ch]@2
Ritor1
parents: 1051
diff changeset
212 int minimum_x; // [sp+18h] [bp-8h]@2
Ritor1
parents: 1051
diff changeset
213 int maximum_x; // [sp+1Ch] [bp-4h]@2
692
066e2b29b30f viewport.cpp added
Gloval
parents:
diff changeset
214
1222
Ritor1
parents: 1051
diff changeset
215 InitGrayPalette();
Ritor1
parents: 1051
diff changeset
216 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents: 1051
diff changeset
217 {
Ritor1
parents: 1051
diff changeset
218 minimum_x = 0x40000000;
Ritor1
parents: 1051
diff changeset
219 minimum_y = 0x40000000;
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
220
1222
Ritor1
parents: 1051
diff changeset
221 maximum_x = -0x40000000;
Ritor1
parents: 1051
diff changeset
222 maximum_y = -0x40000000;
Ritor1
parents: 1051
diff changeset
223 for (int i=0; i<pIndoor->pMapOutlines->uNumOutlines; ++i)
Ritor1
parents: 1051
diff changeset
224 {
Ritor1
parents: 1051
diff changeset
225 v3 = &pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uFace1ID];
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
226
1222
Ritor1
parents: 1051
diff changeset
227 if ( v3->x < minimum_x )
Ritor1
parents: 1051
diff changeset
228 minimum_x = v3->x;
Ritor1
parents: 1051
diff changeset
229 if ( v3->x > maximum_x )
Ritor1
parents: 1051
diff changeset
230 maximum_x = v3->x;
Ritor1
parents: 1051
diff changeset
231 if ( v3->y < minimum_y )
Ritor1
parents: 1051
diff changeset
232 minimum_y = v3->x;
Ritor1
parents: 1051
diff changeset
233 if ( v3->y > maximum_y )
Ritor1
parents: 1051
diff changeset
234 maximum_y = v3->x;
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
235
1222
Ritor1
parents: 1051
diff changeset
236 v6 = &pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uFace2ID];
Ritor1
parents: 1051
diff changeset
237
Ritor1
parents: 1051
diff changeset
238 if ( v6->x < minimum_x )
Ritor1
parents: 1051
diff changeset
239 minimum_x = v3->x;
Ritor1
parents: 1051
diff changeset
240 if ( v6->x > maximum_x )
Ritor1
parents: 1051
diff changeset
241 maximum_x = v3->x;
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
242
1222
Ritor1
parents: 1051
diff changeset
243 if ( v6->y < minimum_y )
Ritor1
parents: 1051
diff changeset
244 minimum_y = v3->y;
Ritor1
parents: 1051
diff changeset
245 if ( v6->y > maximum_y )
Ritor1
parents: 1051
diff changeset
246 maximum_y = v3->y;
Ritor1
parents: 1051
diff changeset
247 }
711
a5e587c8e30e some cleaning
Gloval
parents: 693
diff changeset
248
1222
Ritor1
parents: 1051
diff changeset
249 uMinimapZoom = 1024;
Ritor1
parents: 1051
diff changeset
250 indoor_center_x = (signed int)(minimum_x + maximum_x) / 2;
Ritor1
parents: 1051
diff changeset
251 field_28 = 10;
Ritor1
parents: 1051
diff changeset
252 indoor_center_y = (signed int)(minimum_y + maximum_y) / 2;
Ritor1
parents: 1051
diff changeset
253 }
Ritor1
parents: 1051
diff changeset
254 else
Ritor1
parents: 1051
diff changeset
255 {
Ritor1
parents: 1051
diff changeset
256 indoor_center_x = 0;
Ritor1
parents: 1051
diff changeset
257 indoor_center_y = 0;
Ritor1
parents: 1051
diff changeset
258 uMinimapZoom = _576E2C_current_minimap_zoom;
Ritor1
parents: 1051
diff changeset
259 field_28 = dword_576E28;
Ritor1
parents: 1051
diff changeset
260 }
1720
Ritor1
parents: 1643
diff changeset
261 uMapBookMapZoom = 384;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
262 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
263 //----- (0042213C) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
264 void OnGameViewportClick()
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
265 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
266 signed int v0; // ebx@2
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
267 POINT *v1; // esi@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
268 signed int v6; // eax@14
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
269 char *v7; // esi@15
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
270 int v9; // eax@19
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
271 unsigned int pTextureID; // eax@19
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
272 int pEventID; // ecx@21
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
273 int v15; // ecx@29
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2253
diff changeset
274 // signed int v16; // edx@30
ddb803517a48 unused local variables I commented
Ritor1
parents: 2253
diff changeset
275 // int v18; // ebx@47
ddb803517a48 unused local variables I commented
Ritor1
parents: 2253
diff changeset
276 // signed int v21; // eax@58
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
277 SpriteObject a1; // [sp+Ch] [bp-80h]@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
278 POINT a2; // [sp+84h] [bp-8h]@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
279
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
280 int clickable_distance = 512;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
281
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
282 v1 = pMouse->GetCursorPos(&a2);
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2151
diff changeset
283 //if ( pRenderer->pRenderD3D )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
284 v0 = pGame->pVisInstance->get_picked_object_zbuf_val();
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2151
diff changeset
285 //else
9bd7522cdbbb Render decoupling.
Nomad
parents: 2151
diff changeset
286 // v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[v1->y]];
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
287
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
288 if ( PID_TYPE(v0) == OBJECT_Item)
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
289 {
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
290 int item_id = PID_ID(v0);
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
291 //v21 = (signed int)(unsigned __int16)v0 >> 3;
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
292 if ( !(pObjectList->pObjects[pSpriteObjects[item_id].uObjectDescID].uFlags & 0x10) && item_id < 1000 && pSpriteObjects[item_id].uObjectDescID
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
293 && (unsigned int)v0 < 0x2000000 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
294 {
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
295 if ( pSpriteObjects[item_id].stru_24.GetItemEquipType() == 18 )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
296 {
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
297 pParty->PartyFindsGold(pSpriteObjects[item_id].stru_24.uSpecEnchantmentType, 0);
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
298 viewparams->bRedrawGameUI = 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
299 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
300 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
301 {
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
302 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[pSpriteObjects[item_id].stru_24.uItemID].pUnidentifiedName);//You found an item (%s)!
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
303 ShowStatusBarString(pTmpBuf2.data(), 2);
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
304 if ( pSpriteObjects[item_id].stru_24.uItemID == ITEM_ARTIFACT_SPLITTER )
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
305 _449B7E_toggle_bit(pParty->_quest_bits, 184, 1);
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
306 if ( pSpriteObjects[item_id].stru_24.uItemID == 455 )
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
307 _449B7E_toggle_bit(pParty->_quest_bits, 185, 1);
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
308 if ( !pParty->AddItemToParty(&pSpriteObjects[item_id].stru_24) )
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
309 pParty->SetHoldingItem(&pSpriteObjects[item_id].stru_24);
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
310 }
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
311 SpriteObject::OnInteraction(item_id);
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
312 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
313 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
314 if ( !pParty->pPickedItem.uItemID )
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
315 return;
1328
Ritor1
parents: 1321
diff changeset
316 __debugbreak();//no checker
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
317 v6 = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
318 a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
319 if ( (signed int)pObjectList->uNumObjects <= 0 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
320 LOWORD(v6) = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
321 else
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
322 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
323 v7 = (char *)&pObjectList->pObjects->uObjectID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
324 while ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID != *(short *)v7 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
325 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
326 ++v6;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
327 v7 += 56;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
328 if ( v6 >= (signed int)pObjectList->uNumObjects )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
329 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
330 LOWORD(v6) = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
331 break;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
332 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
333 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
334 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
335 a1.uObjectDescID = v6;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
336 a1.vPosition.y = pParty->vPosition.y;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
337 a1.spell_caster_pid = OBJECT_Player;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
338 a1.vPosition.x = pParty->vPosition.x;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
339 a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
340 a1.uSoundID = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
341 a1.uFacing = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
342 a1.uAttributes = 8;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
343 a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
344 a1.uSpriteFrameID = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
345 memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
346
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
347 extern int UnprojectX(int);
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
348 //v9 = UnprojectX(v1->x);
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
349 a1.Create(pParty->sRotationY + UnprojectX(v1->x), 184, 200, 0);
1709
8251e59fd7c1 ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents: 1643
diff changeset
350 pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE);
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
351 if (pTextureID != -1)
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
352 pIcons_LOD->pTextures[pTextureID].Release();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
353 pMouse->RemoveHoldingItem();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
354 pIcons_LOD->SyncLoadedFilesCount();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
355 return;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
356 }
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
357 if ( PID_TYPE(v0) == OBJECT_Actor)
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
358 {
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
359 int mon_id = PID_ID(v0);
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
360 //a2.y = v16;
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
361 if ( pActors[mon_id].uAIState == Dead )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
362 {
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
363 if ( (unsigned int)v0 < 0x2000000 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
364 {
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
365 pActors[mon_id].LootActor();
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
366 return;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
367 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
368 if ( !pParty->pPickedItem.uItemID )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
369 return;
1328
Ritor1
parents: 1321
diff changeset
370 __debugbreak();//no checker
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
371 v6 = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
372 a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
373 if ( (signed int)pObjectList->uNumObjects <= 0 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
374 LOWORD(v6) = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
375 else
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
376 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
377 v7 = (char *)&pObjectList->pObjects->uObjectID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
378 while ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID != *(short *)v7 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
379 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
380 ++v6;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
381 v7 += 56;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
382 if ( v6 >= (signed int)pObjectList->uNumObjects )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
383 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
384 LOWORD(v6) = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
385 break;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
386 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
387 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
388 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
389 a1.uObjectDescID = v6;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
390 a1.vPosition.y = pParty->vPosition.y;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
391 a1.spell_caster_pid = OBJECT_Player;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
392 a1.vPosition.x = pParty->vPosition.x;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
393 a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
394 a1.uSoundID = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
395 a1.uFacing = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
396 a1.uAttributes = 8;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
397 a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
398 a1.uSpriteFrameID = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
399 memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
400
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
401 extern int UnprojectX(int);
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
402 //v9 = UnprojectX(v1->x);
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
403 a1.Create(pParty->sRotationY + UnprojectX(v1->x), 184, 200, 0);
1709
8251e59fd7c1 ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents: 1643
diff changeset
404 pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE);
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
405 if (pTextureID != -1)
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
406 pIcons_LOD->pTextures[pTextureID].Release();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
407 pMouse->RemoveHoldingItem();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
408 pIcons_LOD->SyncLoadedFilesCount();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
409 return;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
410 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
411 if ( GetAsyncKeyState(VK_SHIFT) >= 0 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
412 {
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
413 if ( !pActors[mon_id].GetActorsRelation(0) && !(pActors[mon_id].uAttributes & 0x80000) )
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
414 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
415 if ( HIWORD(v0) >= clickable_distance)
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
416 {
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
417 if ( !pParty->pPickedItem.uItemID )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
418 return;
1328
Ritor1
parents: 1321
diff changeset
419 __debugbreak();//no checker
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
420 v6 = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
421 a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
422 if ( (signed int)pObjectList->uNumObjects <= 0 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
423 LOWORD(v6) = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
424 else
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
425 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
426 v7 = (char *)&pObjectList->pObjects->uObjectID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
427 while ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID != *(short *)v7 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
428 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
429 ++v6;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
430 v7 += 56;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
431 if ( v6 >= (signed int)pObjectList->uNumObjects )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
432 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
433 LOWORD(v6) = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
434 break;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
435 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
436 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
437 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
438 a1.uObjectDescID = v6;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
439 a1.vPosition.y = pParty->vPosition.y;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
440 a1.spell_caster_pid = OBJECT_Player;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
441 a1.vPosition.x = pParty->vPosition.x;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
442 a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
443 a1.uSoundID = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
444 a1.uFacing = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
445 a1.uAttributes = 8;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
446 a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
447 a1.uSpriteFrameID = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
448 memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
449
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
450 extern int UnprojectX(int);
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
451 //v9 = UnprojectX(v1->x);
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
452 a1.Create(pParty->sRotationY + UnprojectX(v1->x), 184, 200, 0);
1709
8251e59fd7c1 ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents: 1643
diff changeset
453 pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE);
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
454 if (pTextureID != -1)
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
455 pIcons_LOD->pTextures[pTextureID].Release();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
456 pMouse->RemoveHoldingItem();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
457 pIcons_LOD->SyncLoadedFilesCount();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
458 return;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
459 }
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
460 if ( !pActors[mon_id].CanAct() )
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
461 return;
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
462 //v18 = mon_id;
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
463 Actor::AI_FaceObject(mon_id, 4, 0, 0);
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
464 if ( !pActors[mon_id].sNPC_ID )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
465 {
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
466 if ( pNPCStats->pGroups_copy[pActors[mon_id].uGroup] )
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
467 {
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
468 if ( pNPCStats->pCatchPhrases[pNPCStats->pGroups_copy[pActors[mon_id].uGroup]] )
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
469 {
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
470 pParty->uFlags |= 2;
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
471 strcpy(byte_5B0938.data(), pNPCStats->pCatchPhrases[pNPCStats->pGroups_copy[pActors[mon_id].uGroup]]);
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
472 sub_4451A8_press_any_key(0, 0, 0);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
473 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
474 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
475 return;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
476 }
2402
8cee51ce4382 included directx 11
Ritor1
parents: 2369
diff changeset
477 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_StartNPCDialogue, mon_id, 0);
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
478 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
479 }
2242
c4f87fb3cfee for NextTurn()
Ritor1
parents: 2207
diff changeset
480 if ( pParty->bTurnBasedModeOn == true && pTurnEngine->turn_stage == TE_MOVEMENT )
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
481 {
1332
1e35cfed7928 turn engine file added
Gloval
parents: 1328
diff changeset
482 pTurnEngine->field_18 |= TE_FLAG_8;
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
483 return;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
484 }
2402
8cee51ce4382 included directx 11
Ritor1
parents: 2369
diff changeset
485 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Attack, 0, 0);
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
486 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
487 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
488 {
2242
c4f87fb3cfee for NextTurn()
Ritor1
parents: 2207
diff changeset
489 if ( pParty->bTurnBasedModeOn == true && pTurnEngine->turn_stage == TE_MOVEMENT )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
490 {
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
491 pParty->uFlags |= PARTY_FLAGS_1_FALLING;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
492 return;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
493 }
2107
85e9766d6124 sub_427769_spell to sub_427769_isSpellQuickCastableOnShiftClick
Grumpy7
parents: 2086
diff changeset
494 if ( uActiveCharacter && sub_427769_isSpellQuickCastableOnShiftClick(pPlayers[uActiveCharacter]->uQuickSpell))
2402
8cee51ce4382 included directx 11
Ritor1
parents: 2369
diff changeset
495 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_CastQuickSpell, 0, 0);
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
496 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
497 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
498 }
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
499 if ( PID_TYPE(v0) == OBJECT_Decoration)
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
500 {
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
501 if ( (signed int)(((unsigned int)v0 >> 16) - pDecorationList->pDecorations[pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].uDecorationDescID].uRadius) >= clickable_distance )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
502 {
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
503 if ( !pParty->pPickedItem.uItemID )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
504 return;
1328
Ritor1
parents: 1321
diff changeset
505 __debugbreak();//no checker
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
506 v6 = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
507 a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
508 if ( (signed int)pObjectList->uNumObjects <= 0 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
509 LOWORD(v6) = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
510 else
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
511 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
512 v7 = (char *)&pObjectList->pObjects->uObjectID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
513 while ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID != *(short *)v7 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
514 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
515 ++v6;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
516 v7 += 56;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
517 if ( v6 >= (signed int)pObjectList->uNumObjects )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
518 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
519 LOWORD(v6) = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
520 break;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
521 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
522 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
523 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
524 a1.uObjectDescID = v6;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
525 a1.vPosition.y = pParty->vPosition.y;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
526 a1.spell_caster_pid = OBJECT_Player;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
527 a1.vPosition.x = pParty->vPosition.x;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
528 a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
529 a1.uSoundID = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
530 a1.uFacing = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
531 a1.uAttributes = 8;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
532 a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
533 a1.uSpriteFrameID = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
534 memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
535
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
536 extern int UnprojectX(int);
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
537 //v9 = UnprojectX(v1->x);
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
538 a1.Create(pParty->sRotationY + UnprojectX(v1->x), 184, 200, 0);
1709
8251e59fd7c1 ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents: 1643
diff changeset
539 pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE);
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
540 if (pTextureID != -1)
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
541 pIcons_LOD->pTextures[pTextureID].Release();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
542 pMouse->RemoveHoldingItem();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
543 pIcons_LOD->SyncLoadedFilesCount();
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
544 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
545 }
1514
965af46e8793 Rename LevelDecoration::field_16_event_id to LevelDecoration::uEventID.
yoctozepto
parents: 1358
diff changeset
546 if ( !pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].uEventID )
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
547 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
548 if ( pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].IsInteractive() )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
549 {
1736
c6fe09a06712 Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
Grumpy7
parents: 1721
diff changeset
550 v15 = stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]._idx_in_stru123 - 75] + 380;
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
551 activeLevelDecoration = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3];
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
552 EventProcessor(v15, 0, 1);
2369
bddcaf5d5db2 removing non-nullptr conditions before frees, chaning 0 and NULL assignmnets to pointers to nullptr assignments
Grumpy7
parents: 2336
diff changeset
553 activeLevelDecoration = nullptr;
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
554 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
555 return;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
556 }
1514
965af46e8793 Rename LevelDecoration::field_16_event_id to LevelDecoration::uEventID.
yoctozepto
parents: 1358
diff changeset
557 pEventID = pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].uEventID;
1837
303a56458f7b viewing_angle
Ritor1
parents: 1828
diff changeset
558 EventProcessor(pEventID, (unsigned __int16)v0, 1);
303a56458f7b viewing_angle
Ritor1
parents: 1828
diff changeset
559 return;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
560 }
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
561 if ( PID_TYPE(v0) == OBJECT_BModel && HIWORD(v0) < clickable_distance)
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
562 {
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
563 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
564 {
2166
00bd098f6435 fixpoint_mul in different functions and others
Ritor1
parents: 2154
diff changeset
565 if ( !pIndoor->pFaces[PID_ID(v0)].Clickable() )
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
566 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
567 if ( !pParty->pPickedItem.uItemID )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
568 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
569 ShowNothingHereStatus();
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
570 if ( !pParty->pPickedItem.uItemID )
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
571 return;
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
572 }
1328
Ritor1
parents: 1321
diff changeset
573 __debugbreak();//no checker
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
574 v6 = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
575 a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
576 if ( (signed int)pObjectList->uNumObjects <= 0 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
577 LOWORD(v6) = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
578 else
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
579 {
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
580 v7 = (char *)&pObjectList->pObjects->uObjectID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
581 while ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID != *(short *)v7 )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
582 {
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
583 ++v6;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
584 v7 += 56;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
585 if ( v6 >= (signed int)pObjectList->uNumObjects )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
586 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
587 LOWORD(v6) = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
588 break;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
589 }
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
590 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
591 }
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
592 a1.uObjectDescID = v6;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
593 a1.vPosition.y = pParty->vPosition.y;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
594 a1.spell_caster_pid = OBJECT_Player;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
595 a1.vPosition.x = pParty->vPosition.x;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
596 a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
597 a1.uSoundID = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
598 a1.uFacing = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
599 a1.uAttributes = 8;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
600 a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
601 a1.uSpriteFrameID = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
602 memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
603
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
604 extern int UnprojectX(int);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
605 v9 = UnprojectX(v1->x);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
606 a1.Create(pParty->sRotationY + v9, 184, 200, 0);
1709
8251e59fd7c1 ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents: 1643
diff changeset
607 pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE);
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
608 if (pTextureID != -1)
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
609 pIcons_LOD->pTextures[pTextureID].Release();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
610 pMouse->RemoveHoldingItem();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
611 pIcons_LOD->SyncLoadedFilesCount();
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
612 return;
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
613 }
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
614 pEventID = pIndoor->pFaceExtras[pIndoor->pFaces[PID_ID(v0)].uFaceExtraID].uEventID;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
615 }
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
616 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
617 {
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
618 if ( !pOutdoor->pBModels[(signed int)(v0 & 0xFFFF) >> 9].pFaces[PID_ID(v0) & 0x3F].Clickable())
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
619 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
620 if ( !pParty->pPickedItem.uItemID )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
621 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
622 ShowNothingHereStatus();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
623 if ( !pParty->pPickedItem.uItemID )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
624 return;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
625 }
1328
Ritor1
parents: 1321
diff changeset
626 __debugbreak();//no checker
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
627 v6 = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
628 a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
629 if ( (signed int)pObjectList->uNumObjects <= 0 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
630 LOWORD(v6) = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
631 else
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
632 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
633 v7 = (char *)&pObjectList->pObjects->uObjectID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
634 while ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID != *(short *)v7 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
635 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
636 ++v6;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
637 v7 += 56;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
638 if ( v6 >= (signed int)pObjectList->uNumObjects )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
639 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
640 LOWORD(v6) = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
641 break;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
642 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
643 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
644 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
645 a1.uObjectDescID = v6;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
646 a1.vPosition.y = pParty->vPosition.y;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
647 a1.spell_caster_pid = OBJECT_Player;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
648 a1.vPosition.x = pParty->vPosition.x;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
649 a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
650 a1.uSoundID = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
651 a1.uFacing = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
652 a1.uAttributes = 8;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
653 a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
654 a1.uSpriteFrameID = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
655 memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
656
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
657 extern int UnprojectX(int);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
658 v9 = UnprojectX(v1->x);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
659 a1.Create(pParty->sRotationY + v9, 184, 200, 0);
1709
8251e59fd7c1 ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents: 1643
diff changeset
660 pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE);
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
661 if (pTextureID != -1)
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
662 pIcons_LOD->pTextures[pTextureID].Release();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
663 pMouse->RemoveHoldingItem();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
664 pIcons_LOD->SyncLoadedFilesCount();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
665 return;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
666 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
667 pEventID = pOutdoor->pBModels[(signed int)(v0 & 0xFFFF) >> 9].pFaces[PID_ID(v0) & 0x3F].sCogTriggeredID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
668 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
669 EventProcessor(pEventID, (unsigned __int16)v0, 1);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
670 return;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
671 }
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
672 if ( PID_TYPE(v0) != OBJECT_BModel || HIWORD(v0) >= clickable_distance )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
673 {
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
674 if ( !pParty->pPickedItem.uItemID )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
675 return;
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2037
diff changeset
676 //__debugbreak();//no checker
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
677 v6 = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
678 a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
679 if ( (signed int)pObjectList->uNumObjects <= 0 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
680 LOWORD(v6) = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
681 else
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
682 {
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
683 v7 = (char *)&pObjectList->pObjects->uObjectID;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
684 while ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID != *(short *)v7 )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
685 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
686 ++v6;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
687 v7 += 56;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
688 if ( v6 >= (signed int)pObjectList->uNumObjects )
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
689 {
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
690 LOWORD(v6) = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
691 break;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
692 }
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
693 }
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
694 }
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
695 a1.uObjectDescID = v6;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
696 a1.vPosition.y = pParty->vPosition.y;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
697 a1.spell_caster_pid = OBJECT_Player;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
698 a1.vPosition.x = pParty->vPosition.x;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
699 a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
700 a1.uSoundID = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
701 a1.uFacing = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
702 a1.uAttributes = 8;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
703 a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
704 a1.uSpriteFrameID = 0;
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
705 memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u);
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
706
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
707 extern int UnprojectX(int);
2203
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
708 //v9 = UnprojectX(v1->x);
4bfee77e900d DoInteractionWithTopmostZObject cleaned
Ritor1
parents: 2196
diff changeset
709 a1.Create(pParty->sRotationY + UnprojectX(v1->x), 184, 200, 0);
1709
8251e59fd7c1 ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
Grumpy7
parents: 1643
diff changeset
710 pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE);
1321
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
711 if (pTextureID != -1)
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
712 pIcons_LOD->pTextures[pTextureID].Release();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
713 pMouse->RemoveHoldingItem();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
714 pIcons_LOD->SyncLoadedFilesCount();
cc8d58f2bf0c clickable_distance
Ritor1
parents: 1297
diff changeset
715 return;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
716 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents: 1253
diff changeset
717 }