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