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