annotate mm7_5.cpp @ 2251:47bcb700b74b

for StackLight_TerrainFace
author Ritor1
date Wed, 26 Feb 2014 20:10:43 +0600
parents 8817c398b792
children 2e02c384c62b
rev   line source
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1000
diff changeset
1 #include "MapInfo.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1000
diff changeset
2 #include "LightmapBuilder.h"
0
Ritor1
parents:
diff changeset
3 #include "mm7.h"
Ritor1
parents:
diff changeset
4 #include "GUIWindow.h"
Ritor1
parents:
diff changeset
5 #include "Party.h"
Ritor1
parents:
diff changeset
6 #include "Outdoor.h"
Ritor1
parents:
diff changeset
7 #include "LOD.h"
Ritor1
parents:
diff changeset
8 #include "Actor.h"
Ritor1
parents:
diff changeset
9 #include "Viewport.h"
2037
7a9477135943 Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents: 2006
diff changeset
10 #include "OurMath.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 513
diff changeset
11 #include "SpriteObject.h"
2044
28cb79ae2f6f Time.h rename
Ritor1
parents: 2037
diff changeset
12 #include "Timer.h"
0
Ritor1
parents:
diff changeset
13 #include "stru298.h"
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
14 #include "Lights.h"
1828
35c1e4ff6ba7 party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents: 1793
diff changeset
15 #include "Level/Decoration.h"
0
Ritor1
parents:
diff changeset
16
2207
ff8920a40c21 fixpoint_mul
Ritor1
parents: 2205
diff changeset
17
0
Ritor1
parents:
diff changeset
18 //----- (004356FF) --------------------------------------------------------
1575
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1546
diff changeset
19 void back_to_game()
0
Ritor1
parents:
diff changeset
20 {
Ritor1
parents:
diff changeset
21 dword_507BF0_is_there_popup_onscreen = 0;
Ritor1
parents:
diff changeset
22 dword_4E455C = 1;
1575
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1546
diff changeset
23
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1546
diff changeset
24 extern int no_rightlick_in_inventory;
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1546
diff changeset
25 no_rightlick_in_inventory = false;
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1546
diff changeset
26
0
Ritor1
parents:
diff changeset
27 if ( pGUIWindow_ScrollWindow )
Ritor1
parents:
diff changeset
28 free_book_subwindow();
Ritor1
parents:
diff changeset
29 if ( !pCurrentScreen && !pGUIWindow_Settings )
Ritor1
parents:
diff changeset
30 pEventTimer->Resume();
Ritor1
parents:
diff changeset
31 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
32 }
782
c47efaf23642 more tidy
zipi
parents: 766
diff changeset
33
0
Ritor1
parents:
diff changeset
34 //----- (004369DB) --------------------------------------------------------
Ritor1
parents:
diff changeset
35 void Vec3_float_::Normalize()
Ritor1
parents:
diff changeset
36 {
1025
8b492d4722d4 Intersection
Ritor1
parents: 1023
diff changeset
37 this->x = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->x;
8b492d4722d4 Intersection
Ritor1
parents: 1023
diff changeset
38 this->y = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->y;
8b492d4722d4 Intersection
Ritor1
parents: 1023
diff changeset
39 this->z = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->z;
0
Ritor1
parents:
diff changeset
40 }
Ritor1
parents:
diff changeset
41
Ritor1
parents:
diff changeset
42 //----- (00438F8F) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1384
diff changeset
43 void area_of_effect__damage_evaluate()
0
Ritor1
parents:
diff changeset
44 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
45 int attacker_type; // ecx@3
0
Ritor1
parents:
diff changeset
46 signed int v3; // eax@3
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
47 unsigned int target_id; // edi@6
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
48 int target_type; // eax@6
0
Ritor1
parents:
diff changeset
49 int v10; // edi@8
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
50 Vec3_int_ attacker_coord; // ST04_12@9
0
Ritor1
parents:
diff changeset
51 int v12; // ST0C_4@10
Ritor1
parents:
diff changeset
52 int v15; // edx@15
Ritor1
parents:
diff changeset
53 int v19; // edi@15
Ritor1
parents:
diff changeset
54 int v23; // edx@18
Ritor1
parents:
diff changeset
55 int v24; // eax@18
Ritor1
parents:
diff changeset
56 int v30; // eax@29
Ritor1
parents:
diff changeset
57 int v31; // edx@29
Ritor1
parents:
diff changeset
58 int v32; // eax@29
Ritor1
parents:
diff changeset
59 int v33; // ST24_4@29
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 513
diff changeset
60 SpriteObject *v36; // [sp+0h] [bp-28h]@0
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
61 int attacker_id; // [sp+10h] [bp-18h]@1
0
Ritor1
parents:
diff changeset
62 int v44; // [sp+14h] [bp-14h]@15
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
63 //Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2
2205
db94443ea4e7 _44100D_should_alter_right_panel()
Ritor1
parents: 2166
diff changeset
64 signed int a1; // [sp+20h] [bp-8h]@8
0
Ritor1
parents:
diff changeset
65 int v48; // [sp+24h] [bp-4h]@8
Ritor1
parents:
diff changeset
66
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
67
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
68 for ( attacker_id = 0; attacker_id < AttackerInfo.count; ++attacker_id )
0
Ritor1
parents:
diff changeset
69 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
70 attacker_type = PID_TYPE(AttackerInfo.pIDs[attacker_id]);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
71 v3 = PID_ID(AttackerInfo.pIDs[attacker_id]);
2057
b7485a6502f2 AgressorAtackInfo
Ritor1
parents: 2044
diff changeset
72
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
73 if ( attacker_type == 2 )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
74 {
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
75 v36 = &pSpriteObjects[v3];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
76 attacker_type = PID_TYPE(pSpriteObjects[v3].spell_caster_pid);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
77 v3 = PID_ID(pSpriteObjects[v3].spell_caster_pid);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
78 }
2057
b7485a6502f2 AgressorAtackInfo
Ritor1
parents: 2044
diff changeset
79
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
80 if ( AttackerInfo.field_3EC[attacker_id] & 1 )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
81 {
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
82 target_id = PID_ID(ai_near_actors_targets_pid[v3]);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
83 target_type = PID_TYPE(ai_near_actors_targets_pid[v3]) - 3;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
84 if ( target_type )
0
Ritor1
parents:
diff changeset
85 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
86 if ( target_type == 1 )//party damage from monsters(повреждения группе от монстров)
0
Ritor1
parents:
diff changeset
87 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
88 v10 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
89 a1 = pParty->vPosition.x - AttackerInfo.pXs[attacker_id];
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
90 v48 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id];
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
91 if ( a1 * a1 + v10 * v10
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
92 + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AttackerInfo.pZs[attacker_id]))
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
93 * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AttackerInfo.pZs[attacker_id]))
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
94 < (unsigned int)((AttackerInfo.field_324[attacker_id] + 32) * (AttackerInfo.field_324[attacker_id] + 32)) )
0
Ritor1
parents:
diff changeset
95 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
96 attacker_coord.x = AttackerInfo.pXs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
97 attacker_coord.y = AttackerInfo.pYs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
98 attacker_coord.z = AttackerInfo.pZs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
99 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, attacker_coord) )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
100 DamagePlayerFromMonster(AttackerInfo.pIDs[attacker_id], AttackerInfo.field_450[attacker_id], &AttackerInfo.vec_4B4[attacker_id], stru_50C198.which_player_to_attack(&pActors[v3]));
0
Ritor1
parents:
diff changeset
101 }
Ritor1
parents:
diff changeset
102 }
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
103 }
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
104 else//Actor damage from monsters(повреждение местного жителя)
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
105 {
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
106 if ( SHIDWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) > 0
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
107 || SHIDWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) >= 0
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
108 && LODWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime)
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
109 || pActors[target_id].CanAct() )
0
Ritor1
parents:
diff changeset
110 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
111 v15 = pActors[target_id].vPosition.y - AttackerInfo.pYs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
112 a1 = pActors[target_id].vPosition.x - AttackerInfo.pXs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
113 v44 = pActors[target_id].vPosition.z;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
114 v19 = AttackerInfo.pYs[attacker_id] + pActors[target_id].uActorRadius;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
115 v48 = v15;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
116 if ( a1 * a1 + v15 * v15 + (pActors[target_id].vPosition.z + (pActors[target_id].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id])
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
117 * (pActors[target_id].vPosition.z + (pActors[target_id].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id]) < (unsigned int)(v19 * v19) )
0
Ritor1
parents:
diff changeset
118 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
119 attacker_coord.x = AttackerInfo.pXs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
120 attacker_coord.y = AttackerInfo.pYs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
121 attacker_coord.z = AttackerInfo.pZs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
122 if ( sub_407A1C(pActors[target_id].vPosition.x, pActors[target_id].vPosition.y, pActors[target_id].vPosition.z + 50, attacker_coord) )
0
Ritor1
parents:
diff changeset
123 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
124 Vec3_int_::Normalize(&a1, &v48, &v44);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
125 AttackerInfo.vec_4B4[attacker_id].x = a1;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
126 AttackerInfo.vec_4B4[attacker_id].y = v48;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
127 AttackerInfo.vec_4B4[attacker_id].z = v44;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
128 ActorDamageFromMonster(AttackerInfo.pIDs[attacker_id], target_id, &AttackerInfo.vec_4B4[attacker_id], AttackerInfo.field_450[attacker_id]);
0
Ritor1
parents:
diff changeset
129 }
Ritor1
parents:
diff changeset
130 }
Ritor1
parents:
diff changeset
131 }
Ritor1
parents:
diff changeset
132 }
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
133 }
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
134 else //damage from spells(повреждения от заклов(метеоритный дождь))
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
135 {
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
136 v23 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id];
2216
3f375342de12 window->GetWidth() continue
Ritor1
parents: 2215
diff changeset
137 v24 = ((signed int)pParty->uPartyHeight / 2) - AttackerInfo.pZs[attacker_id];
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
138 a1 = pParty->vPosition.x - AttackerInfo.pXs[attacker_id];
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
139 v48 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id];
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
140 if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((AttackerInfo.field_324[attacker_id] + 32) * (AttackerInfo.field_324[attacker_id] + 32)) )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
141 {//party damage (повреждения группе)
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
142 attacker_coord.x = AttackerInfo.pXs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
143 attacker_coord.y = AttackerInfo.pYs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
144 attacker_coord.z = AttackerInfo.pZs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
145 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, attacker_coord) )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
146 {
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
147 for ( uint i = 0; i < 4; ++i )
0
Ritor1
parents:
diff changeset
148 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
149 if ( !(HIDWORD(pParty->pPlayers[i].pConditions[Condition_Dead]) | LODWORD(pParty->pPlayers[i].pConditions[Condition_Dead]))
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
150 && !pParty->pPlayers[i].pConditions[Condition_Pertified] && !pParty->pPlayers[i].pConditions[Condition_Eradicated] )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
151 DamagePlayerFromMonster(AttackerInfo.pIDs[attacker_id], AttackerInfo.field_450[attacker_id], &AttackerInfo.vec_4B4[attacker_id], i);
0
Ritor1
parents:
diff changeset
152 }
Ritor1
parents:
diff changeset
153 }
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
154 }
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
155 if ( (signed int)uNumActors > 0 )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
156 {//actors damage(повреждения другим участникам)
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
157 for ( int actorID = 0; (signed int)actorID < (signed int)uNumActors; ++actorID )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
158 {
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
159 if ( pActors[actorID].CanAct() )
0
Ritor1
parents:
diff changeset
160 {
2205
db94443ea4e7 _44100D_should_alter_right_panel()
Ritor1
parents: 2166
diff changeset
161 //v30 = pActors[actorID].vPosition.y - AttackerInfo.pYs[attacker_id];
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
162 a1 = pActors[actorID].vPosition.x - AttackerInfo.pXs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
163 v31 = pActors[actorID].vPosition.z;
2205
db94443ea4e7 _44100D_should_alter_right_panel()
Ritor1
parents: 2166
diff changeset
164 v48 = pActors[actorID].vPosition.y - AttackerInfo.pYs[attacker_id];
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
165 v44 = pActors[actorID].vPosition.z;
2205
db94443ea4e7 _44100D_should_alter_right_panel()
Ritor1
parents: 2166
diff changeset
166 v32 = (pActors[actorID].uActorHeight / 2) - AttackerInfo.pZs[attacker_id];
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
167 v33 = pActors[actorID].uActorRadius + AttackerInfo.pYs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
168 if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) )
0
Ritor1
parents:
diff changeset
169 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
170 attacker_coord.x = AttackerInfo.pXs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
171 attacker_coord.y = AttackerInfo.pYs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
172 attacker_coord.z = AttackerInfo.pZs[attacker_id];
2205
db94443ea4e7 _44100D_should_alter_right_panel()
Ritor1
parents: 2166
diff changeset
173 if ( sub_407A1C(pActors[actorID].vPosition.x, pActors[actorID].vPosition.y, pActors[actorID].vPosition.z + 50, attacker_coord) )//что делает ф-ция?
0
Ritor1
parents:
diff changeset
174 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
175 Vec3_int_::Normalize(&a1, &v48, &v44);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
176 AttackerInfo.vec_4B4[attacker_id].x = a1;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
177 AttackerInfo.vec_4B4[attacker_id].y = v48;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
178 AttackerInfo.vec_4B4[attacker_id].z = v44;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
179 switch ( attacker_type )
0
Ritor1
parents:
diff changeset
180 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
181 case OBJECT_Player:
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
182 DamageMonsterFromParty(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id]);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
183 break;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
184 case OBJECT_Actor:
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
185 if ( v36 && pActors[v3].GetActorsRelation(&pActors[actorID]) )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
186 ActorDamageFromMonster(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id], v36->field_61);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
187 break;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
188 case OBJECT_Item:
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
189 ItemDamageFromActor(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id]);
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
190 break;
0
Ritor1
parents:
diff changeset
191 }
Ritor1
parents:
diff changeset
192 }
Ritor1
parents:
diff changeset
193 }
Ritor1
parents:
diff changeset
194 }
Ritor1
parents:
diff changeset
195 }
Ritor1
parents:
diff changeset
196 }
Ritor1
parents:
diff changeset
197 }
Ritor1
parents:
diff changeset
198 }
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
199 AttackerInfo.count = 0;
0
Ritor1
parents:
diff changeset
200 }
Ritor1
parents:
diff changeset
201
Ritor1
parents:
diff changeset
202
Ritor1
parents:
diff changeset
203 //----- (0043A97E) --------------------------------------------------------
Ritor1
parents:
diff changeset
204 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2)
Ritor1
parents:
diff changeset
205 {
1979
92dfa0cafbe3 Fixing players not getting damaged by projectiles
Grumpy7
parents: 1974
diff changeset
206 if (PID_TYPE(a2) == OBJECT_Player)
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
207 {
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
208 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x;
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
209 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y;
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
210 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z;
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
211
0
Ritor1
parents:
diff changeset
212 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z);
2006
30c2b575d25c signed fixes
zipi
parents: 2000
diff changeset
213 DamagePlayerFromMonster(PID(OBJECT_Item, uLayingItemID), pSpriteObjects[uLayingItemID].field_61, &layingitem_vel_50FDFC, -1);
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
214 }
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
215 else if (PID_TYPE(a2) == OBJECT_Actor)
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
216 {
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
217 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x;
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
218 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y;
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
219 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z;
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
220
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
221 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z);
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
222 switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid))
0
Ritor1
parents:
diff changeset
223 {
Ritor1
parents:
diff changeset
224 case OBJECT_Actor:
2057
b7485a6502f2 AgressorAtackInfo
Ritor1
parents: 2044
diff changeset
225 ActorDamageFromMonster(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61);
0
Ritor1
parents:
diff changeset
226 break;
Ritor1
parents:
diff changeset
227 case OBJECT_Player:
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
228 DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC);
0
Ritor1
parents:
diff changeset
229 break;
Ritor1
parents:
diff changeset
230 case OBJECT_Item:
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
231 ItemDamageFromActor(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC);
0
Ritor1
parents:
diff changeset
232 break;
Ritor1
parents:
diff changeset
233 }
Ritor1
parents:
diff changeset
234 }
Ritor1
parents:
diff changeset
235 }
Ritor1
parents:
diff changeset
236
Ritor1
parents:
diff changeset
237 //----- (0043AE12) --------------------------------------------------------
Ritor1
parents:
diff changeset
238 double __fastcall sub_43AE12(signed int a1)
Ritor1
parents:
diff changeset
239 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
240 //signed int v1; // ST00_4@1
0
Ritor1
parents:
diff changeset
241 signed int v2; // ecx@1
Ritor1
parents:
diff changeset
242 double v3; // st7@1
Ritor1
parents:
diff changeset
243 double result; // st7@6
Ritor1
parents:
diff changeset
244
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
245 v3 = (double)a1;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
246 for ( v2 = 0; v2 < 5; ++v2 )
0
Ritor1
parents:
diff changeset
247 {
Ritor1
parents:
diff changeset
248 if ( v3 < flt_4E4A80[v2 + 5] )
Ritor1
parents:
diff changeset
249 break;
Ritor1
parents:
diff changeset
250 }
Ritor1
parents:
diff changeset
251 if ( v2 <= 0 || v2 >= 5 )
Ritor1
parents:
diff changeset
252 {
Ritor1
parents:
diff changeset
253 if ( v2 )
Ritor1
parents:
diff changeset
254 result = flt_4E4A80[4];
Ritor1
parents:
diff changeset
255 else
Ritor1
parents:
diff changeset
256 result = flt_4E4A80[0];
Ritor1
parents:
diff changeset
257 }
Ritor1
parents:
diff changeset
258 else
1469
bba0944c9b27 minor fix
zipi
parents: 1459
diff changeset
259 result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 1]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2];
0
Ritor1
parents:
diff changeset
260 return result;
Ritor1
parents:
diff changeset
261 }
Ritor1
parents:
diff changeset
262
Ritor1
parents:
diff changeset
263 //----- (0043B057) --------------------------------------------------------
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
264 void ItemDamageFromActor(unsigned int uObjID, unsigned int uActorID, Vec3_int_ *pVelocity)
0
Ritor1
parents:
diff changeset
265 {
Ritor1
parents:
diff changeset
266 int v6; // eax@4
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
267 int damage; // edi@4
0
Ritor1
parents:
diff changeset
268 int a2a; // [sp+Ch] [bp-4h]@8
Ritor1
parents:
diff changeset
269
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 296
diff changeset
270 if ( !pActors[uActorID].IsNotAlive() )
0
Ritor1
parents:
diff changeset
271 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
272 if ( PID_TYPE(uObjID) == OBJECT_Item)
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 839
diff changeset
273 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
274 if ( pSpriteObjects[PID_ID(uObjID)].spell_id )
0
Ritor1
parents:
diff changeset
275 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
276 v6 = _43AFE3_calc_spell_damage(pSpriteObjects[PID_ID(uObjID)].spell_id, pSpriteObjects[PID_ID(uObjID)].spell_level, pSpriteObjects[PID_ID(uObjID)].spell_skill, pActors[uActorID].sCurrentHP);
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
277 damage = stru_50C198.CalcMagicalDamageToActor(&pActors[uActorID], 0, v6);
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
278 pActors[uActorID].sCurrentHP -= damage;
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
279 if ( damage )
0
Ritor1
parents:
diff changeset
280 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
281 if ( pActors[uActorID].sCurrentHP > 0 )
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
282 Actor::AI_Stun(uActorID, uObjID, 0);
0
Ritor1
parents:
diff changeset
283 else
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
284 Actor::Die(uActorID);
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
285 a2a = 20 * damage / (signed int)pActors[uActorID].pMonsterInfo.uHP;
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
286 if ( 20 * damage / (signed int)pActors[uActorID].pMonsterInfo.uHP > 10 )
0
Ritor1
parents:
diff changeset
287 a2a = 10;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
288 if ( !MonsterStats::BelongsToSupertype(pActors[uActorID].pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) )
0
Ritor1
parents:
diff changeset
289 {
2207
ff8920a40c21 fixpoint_mul
Ritor1
parents: 2205
diff changeset
290 pVelocity->x = fixpoint_mul(a2a, pVelocity->x);
ff8920a40c21 fixpoint_mul
Ritor1
parents: 2205
diff changeset
291 pVelocity->y = fixpoint_mul(a2a, pVelocity->y);
ff8920a40c21 fixpoint_mul
Ritor1
parents: 2205
diff changeset
292 pVelocity->z = fixpoint_mul(a2a, pVelocity->z);
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
293 pActors[uActorID].vVelocity.x = 50 * LOWORD(pVelocity->x);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
294 pActors[uActorID].vVelocity.y = 50 * LOWORD(pVelocity->y);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
295 pActors[uActorID].vVelocity.z = 50 * LOWORD(pVelocity->z);
0
Ritor1
parents:
diff changeset
296 }
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
297 Actor::AddBloodsplatOnDamageOverlay(uActorID, 1, damage);
0
Ritor1
parents:
diff changeset
298 }
Ritor1
parents:
diff changeset
299 else
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
300 Actor::AI_Stun(uActorID, uObjID, 0);
0
Ritor1
parents:
diff changeset
301 }
Ritor1
parents:
diff changeset
302 }
Ritor1
parents:
diff changeset
303 }
Ritor1
parents:
diff changeset
304 }
Ritor1
parents:
diff changeset
305
Ritor1
parents:
diff changeset
306 //----- (0043B1B0) --------------------------------------------------------
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
307 void ActorDamageFromMonster(signed int attacker_id, unsigned int actor_id, Vec3_int_ *pVelocity, signed int a4)
0
Ritor1
parents:
diff changeset
308 {
Ritor1
parents:
diff changeset
309 int v4; // ebx@1
1924
8cd321994943 MSVS 2012 project file & some compilation warning fixes
Nomad
parents: 1916
diff changeset
310 int v6; // eax@3
0
Ritor1
parents:
diff changeset
311 __int64 v10; // qax@8
Ritor1
parents:
diff changeset
312 signed int v12; // ecx@20
Ritor1
parents:
diff changeset
313 int v13; // ecx@22
Ritor1
parents:
diff changeset
314 int v14; // edi@30
Ritor1
parents:
diff changeset
315 signed int v17; // [sp+10h] [bp-4h]@1
Ritor1
parents:
diff changeset
316 int v18; // [sp+20h] [bp+Ch]@34
Ritor1
parents:
diff changeset
317
Ritor1
parents:
diff changeset
318 v4 = 0;
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
319 v17 = attacker_id;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
320 if ( PID_TYPE(attacker_id) == OBJECT_Item)
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 839
diff changeset
321 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
322 v4 = pSpriteObjects[PID_ID(attacker_id)].field_60_distance_related_prolly_lod;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
323 v17 = pSpriteObjects[PID_ID(attacker_id)].spell_caster_pid;
0
Ritor1
parents:
diff changeset
324 }
2057
b7485a6502f2 AgressorAtackInfo
Ritor1
parents: 2044
diff changeset
325 if ( PID_TYPE(v17) == OBJECT_Actor)
0
Ritor1
parents:
diff changeset
326 {
2057
b7485a6502f2 AgressorAtackInfo
Ritor1
parents: 2044
diff changeset
327 v6 = pActors[actor_id].IsNotAlive();
0
Ritor1
parents:
diff changeset
328 if ( !v6 )
Ritor1
parents:
diff changeset
329 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
330 pActors[actor_id].uLastCharacterIDToHit = v17;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
331 if ( pActors[actor_id].uAIState == Fleeing )
2166
00bd098f6435 fixpoint_mul in different functions and others
Ritor1
parents: 2153
diff changeset
332 pActors[actor_id].uAttributes |= FACE_UNKNOW7;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
333 if ( pActors[PID_ID(v17)]._4273BB_DoesHitOtherActor(&pActors[actor_id], v4, 0) )
0
Ritor1
parents:
diff changeset
334 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
335 v10 = (unsigned int)pActors[PID_ID(v17)]._43B3E0_CalcDamage(a4);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
336 if ( (signed __int64)pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0 )
0
Ritor1
parents:
diff changeset
337 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
338 if ( pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower )
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
339 v10 = (signed int)v10 / (unsigned __int16)pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower;
0
Ritor1
parents:
diff changeset
340 }
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
341 if ( SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) >= SHIDWORD(v10)
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
342 && (SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > SHIDWORD(v10)
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
343 || LODWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > HIDWORD(v10)) )
0
Ritor1
parents:
diff changeset
344 LODWORD(v10) = 0;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
345 if ( a4 == HIDWORD(v10) )
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
346 v12 = pActors[PID_ID(v17)].pMonsterInfo.uAttack1Type;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
347 else if ( a4 - HIDWORD(v10) == 1 )
0
Ritor1
parents:
diff changeset
348 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
349 v12 = pActors[PID_ID(v17)].pMonsterInfo.uAttack2Type;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
350 if ( SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) >= SHIDWORD(v10)
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
351 && (SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > SHIDWORD(v10)
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
352 || LODWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > HIDWORD(v10)) )
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
353 LODWORD(v10) = (signed int)v10 / 2;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
354 }
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
355 else if ( a4 - HIDWORD(v10) == 2 )
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
356 v12 = LOBYTE(pSpellStats->pInfos[pActors[actor_id].pMonsterInfo.uSpell1ID].uSchool);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
357 else if ( a4 - HIDWORD(v10) == 3 )
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
358 v12 = LOBYTE(pSpellStats->pInfos[pActors[actor_id].pMonsterInfo.uSpell2ID].uSchool);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
359 else if ( a4 - HIDWORD(v10) == 4 )
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
360 v12 = pActors[PID_ID(v17)].pMonsterInfo.field_3C_some_special_attack;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
361 else
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
362 v12 = 4;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
363 v14 = stru_50C198.CalcMagicalDamageToActor(&pActors[actor_id], v12, v10);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
364 pActors[actor_id].sCurrentHP -= v14;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
365 if ( v14 )
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
366 {
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
367 if ( pActors[actor_id].sCurrentHP > 0 )
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
368 Actor::AI_Stun(actor_id, v17, 0);
0
Ritor1
parents:
diff changeset
369 else
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
370 Actor::Die(actor_id);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
371 Actor::AggroSurroundingPeasants(actor_id, 0);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
372 v18 = 20 * v14 / (signed int)pActors[actor_id].pMonsterInfo.uHP;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
373 if ( 20 * v14 / (signed int)pActors[actor_id].pMonsterInfo.uHP > 10 )
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
374 v18 = 10;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
375 if ( !MonsterStats::BelongsToSupertype(pActors[actor_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) )
0
Ritor1
parents:
diff changeset
376 {
2207
ff8920a40c21 fixpoint_mul
Ritor1
parents: 2205
diff changeset
377 pVelocity->x = fixpoint_mul(v18, pVelocity->x);
ff8920a40c21 fixpoint_mul
Ritor1
parents: 2205
diff changeset
378 pVelocity->y = fixpoint_mul(v18, pVelocity->y);
ff8920a40c21 fixpoint_mul
Ritor1
parents: 2205
diff changeset
379 pVelocity->z = fixpoint_mul(v18, pVelocity->z);
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
380 pActors[actor_id].vVelocity.x = 50 * LOWORD(pVelocity->x);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
381 pActors[actor_id].vVelocity.y = 50 * LOWORD(pVelocity->y);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
382 pActors[actor_id].vVelocity.z = 50 * LOWORD(pVelocity->z);
0
Ritor1
parents:
diff changeset
383 }
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
384 Actor::AddBloodsplatOnDamageOverlay(actor_id, 1, v14);
0
Ritor1
parents:
diff changeset
385 }
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
386 else
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
387 Actor::AI_Stun(actor_id, v17, 0);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
388 return;
0
Ritor1
parents:
diff changeset
389 }
Ritor1
parents:
diff changeset
390 }
Ritor1
parents:
diff changeset
391 }
Ritor1
parents:
diff changeset
392 }
Ritor1
parents:
diff changeset
393
Ritor1
parents:
diff changeset
394 //----- (0043F515) --------------------------------------------------------
657
7747161ea5b5 RenderBillboard member rename
Nomad
parents: 651
diff changeset
395 void FindBillboardsLightLevels_BLV()
0
Ritor1
parents:
diff changeset
396 {
Ritor1
parents:
diff changeset
397 for (uint i = 0; i < uNumBillboardsToDraw; ++i)
Ritor1
parents:
diff changeset
398 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
399 if (pBillboardRenderList[i].field_1E & 2 || uCurrentlyLoadedLevelType == LEVEL_Indoor && !pBillboardRenderList[i].uIndoorSectorID)
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
400 pBillboardRenderList[i].dimming_level = 0;
0
Ritor1
parents:
diff changeset
401 else
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
402 pBillboardRenderList[i].dimming_level = _43F55F_get_billboard_light_level(&pBillboardRenderList[i], -1);
0
Ritor1
parents:
diff changeset
403 }
Ritor1
parents:
diff changeset
404 }
Ritor1
parents:
diff changeset
405
Ritor1
parents:
diff changeset
406 //----- (0043F55F) --------------------------------------------------------
Ritor1
parents:
diff changeset
407 int __fastcall _43F55F_get_billboard_light_level(RenderBillboard *a1, int uBaseLightLevel)
Ritor1
parents:
diff changeset
408 {
Ritor1
parents:
diff changeset
409 signed int v3; // ecx@2
Ritor1
parents:
diff changeset
410
Ritor1
parents:
diff changeset
411 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
412 v3 = pIndoor->pSectors[a1->uIndoorSectorID].uMinAmbientLightLevel;
Ritor1
parents:
diff changeset
413 else
Ritor1
parents:
diff changeset
414 {
Ritor1
parents:
diff changeset
415 if ( uBaseLightLevel == -1 )
657
7747161ea5b5 RenderBillboard member rename
Nomad
parents: 651
diff changeset
416 v3 = a1->dimming_level;
0
Ritor1
parents:
diff changeset
417 else
Ritor1
parents:
diff changeset
418 v3 = uBaseLightLevel;
Ritor1
parents:
diff changeset
419 }
430
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 417
diff changeset
420 return _43F5C8_get_point_light_level_with_respect_to_lights(v3, a1->uIndoorSectorID, a1->world_x, a1->world_y, a1->world_z);
0
Ritor1
parents:
diff changeset
421 }
Ritor1
parents:
diff changeset
422
Ritor1
parents:
diff changeset
423 //----- (0043F5C8) --------------------------------------------------------
Ritor1
parents:
diff changeset
424 int __fastcall _43F5C8_get_point_light_level_with_respect_to_lights(unsigned int uBaseLightLevel, int uSectorID, float x, float y, float z)
Ritor1
parents:
diff changeset
425 {
Ritor1
parents:
diff changeset
426 int v5; // esi@1
Ritor1
parents:
diff changeset
427 signed int v6; // edi@1
Ritor1
parents:
diff changeset
428 int v8; // eax@6
Ritor1
parents:
diff changeset
429 int v9; // ebx@6
Ritor1
parents:
diff changeset
430 unsigned int v10; // ecx@6
Ritor1
parents:
diff changeset
431 unsigned int v11; // edx@9
Ritor1
parents:
diff changeset
432 unsigned int v12; // edx@11
Ritor1
parents:
diff changeset
433 signed int v13; // ecx@12
Ritor1
parents:
diff changeset
434 BLVLightMM7 *v16; // esi@20
Ritor1
parents:
diff changeset
435 int v17; // ebx@21
Ritor1
parents:
diff changeset
436 int v18; // eax@24
Ritor1
parents:
diff changeset
437 int v19; // ebx@24
Ritor1
parents:
diff changeset
438 unsigned int v20; // ecx@24
Ritor1
parents:
diff changeset
439 int v21; // edx@25
Ritor1
parents:
diff changeset
440 unsigned int v22; // edx@27
Ritor1
parents:
diff changeset
441 unsigned int v23; // edx@29
Ritor1
parents:
diff changeset
442 signed int v24; // ecx@30
Ritor1
parents:
diff changeset
443 int v26; // ebx@35
Ritor1
parents:
diff changeset
444 int v27; // eax@38
Ritor1
parents:
diff changeset
445 int v28; // ebx@38
Ritor1
parents:
diff changeset
446 unsigned int v29; // ecx@38
Ritor1
parents:
diff changeset
447 int v30; // edx@39
Ritor1
parents:
diff changeset
448 unsigned int v31; // edx@41
Ritor1
parents:
diff changeset
449 unsigned int v32; // edx@43
2251
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
450 //signed int v33; // ecx@44
0
Ritor1
parents:
diff changeset
451 int v37; // [sp+Ch] [bp-18h]@37
Ritor1
parents:
diff changeset
452 int v38; // [sp+10h] [bp-14h]@5
Ritor1
parents:
diff changeset
453 int v39; // [sp+10h] [bp-14h]@23
Ritor1
parents:
diff changeset
454 int v40; // [sp+10h] [bp-14h]@36
Ritor1
parents:
diff changeset
455 int v42; // [sp+14h] [bp-10h]@22
Ritor1
parents:
diff changeset
456 unsigned int v43; // [sp+18h] [bp-Ch]@12
Ritor1
parents:
diff changeset
457 unsigned int v44; // [sp+18h] [bp-Ch]@30
Ritor1
parents:
diff changeset
458 unsigned int v45; // [sp+18h] [bp-Ch]@44
Ritor1
parents:
diff changeset
459
Ritor1
parents:
diff changeset
460 v6 = uBaseLightLevel;
Ritor1
parents:
diff changeset
461 for (uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i)
Ritor1
parents:
diff changeset
462 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1979
diff changeset
463 MobileLight* p = &pMobileLightsStack->pLights[i];
0
Ritor1
parents:
diff changeset
464
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1979
diff changeset
465 float distX = abs(p->vPosition.x - x);
0
Ritor1
parents:
diff changeset
466 if ( distX <= p->uRadius)
Ritor1
parents:
diff changeset
467 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1979
diff changeset
468 float distY = abs(p->vPosition.y - y);
0
Ritor1
parents:
diff changeset
469 if ( distY <= p->uRadius)
Ritor1
parents:
diff changeset
470 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1979
diff changeset
471 float distZ = abs(p->vPosition.z - z);
0
Ritor1
parents:
diff changeset
472 if ( distZ <= p->uRadius)
Ritor1
parents:
diff changeset
473 {
Ritor1
parents:
diff changeset
474 v8 = distX;
Ritor1
parents:
diff changeset
475 v9 = distY;
Ritor1
parents:
diff changeset
476 v10 = distZ;
Ritor1
parents:
diff changeset
477 if (distX < distY)
Ritor1
parents:
diff changeset
478 {
Ritor1
parents:
diff changeset
479 v8 = distY;
Ritor1
parents:
diff changeset
480 v9 = distX;
Ritor1
parents:
diff changeset
481 }
Ritor1
parents:
diff changeset
482 if ( v8 < distZ )
Ritor1
parents:
diff changeset
483 {
Ritor1
parents:
diff changeset
484 v11 = v8;
Ritor1
parents:
diff changeset
485 v8 = distZ;
Ritor1
parents:
diff changeset
486 v10 = v11;
Ritor1
parents:
diff changeset
487 }
Ritor1
parents:
diff changeset
488 if ( v9 < (signed int)v10 )
Ritor1
parents:
diff changeset
489 {
Ritor1
parents:
diff changeset
490 v12 = v10;
Ritor1
parents:
diff changeset
491 v10 = v9;
Ritor1
parents:
diff changeset
492 v9 = v12;
Ritor1
parents:
diff changeset
493 }
Ritor1
parents:
diff changeset
494 v43 = ((unsigned int)(11 * v9) / 32) + (v10 / 4) + v8;
Ritor1
parents:
diff changeset
495 v13 = p->uRadius;
Ritor1
parents:
diff changeset
496 if ( (signed int)v43 < v13 )
Ritor1
parents:
diff changeset
497 v6 += ((unsigned __int64)(30i64 * (signed int)(v43 << 16) / v13) >> 16) - 30;
Ritor1
parents:
diff changeset
498 }
Ritor1
parents:
diff changeset
499 }
Ritor1
parents:
diff changeset
500 }
Ritor1
parents:
diff changeset
501 }
Ritor1
parents:
diff changeset
502
Ritor1
parents:
diff changeset
503 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
Ritor1
parents:
diff changeset
504 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1979
diff changeset
505 BLVSector* pSector = &pIndoor->pSectors[uSectorID];
0
Ritor1
parents:
diff changeset
506
Ritor1
parents:
diff changeset
507 for (uint i = 0; i < pSector->uNumLights; ++i)
Ritor1
parents:
diff changeset
508 {
Ritor1
parents:
diff changeset
509 v16 = pIndoor->pLights + pSector->pLights[i];
Ritor1
parents:
diff changeset
510 if (~v16->uAtributes & 8)
Ritor1
parents:
diff changeset
511 {
Ritor1
parents:
diff changeset
512 v17 = abs(v16->vPosition.x - x);
Ritor1
parents:
diff changeset
513 if ( v17 <= v16->uRadius )
Ritor1
parents:
diff changeset
514 {
Ritor1
parents:
diff changeset
515 v42 = abs(v16->vPosition.y - y);
Ritor1
parents:
diff changeset
516 if ( v42 <= v16->uRadius )
Ritor1
parents:
diff changeset
517 {
Ritor1
parents:
diff changeset
518 v39 = abs(v16->vPosition.z - z);
Ritor1
parents:
diff changeset
519 if ( v39 <= v16->uRadius )
Ritor1
parents:
diff changeset
520 {
2235
6ab7d7c112bb adding int_get_vector_length calls where the calls were inlined
Grumpy7
parents: 2216
diff changeset
521 v44 = int_get_vector_length(v17, v42, v39);
0
Ritor1
parents:
diff changeset
522 v24 = v16->uRadius;
Ritor1
parents:
diff changeset
523 if ( (signed int)v44 < v24 )
Ritor1
parents:
diff changeset
524 v6 += ((unsigned __int64)(30i64 * (signed int)(v44 << 16) / v24) >> 16) - 30;
Ritor1
parents:
diff changeset
525 }
Ritor1
parents:
diff changeset
526 }
Ritor1
parents:
diff changeset
527 }
Ritor1
parents:
diff changeset
528 }
Ritor1
parents:
diff changeset
529 }
Ritor1
parents:
diff changeset
530 }
Ritor1
parents:
diff changeset
531
Ritor1
parents:
diff changeset
532 for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i)
Ritor1
parents:
diff changeset
533 {
2251
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
534 //StationaryLight* p = &pStationaryLightsStack->pLights[i];
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
535 v26 = abs(pStationaryLightsStack->pLights[i].vPosition.x - x);
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
536 if ( v26 <= pStationaryLightsStack->pLights[i].uRadius)
0
Ritor1
parents:
diff changeset
537 {
2251
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
538 v40 = abs(pStationaryLightsStack->pLights[i].vPosition.y - y);
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
539 if ( v40 <= pStationaryLightsStack->pLights[i].uRadius)
0
Ritor1
parents:
diff changeset
540 {
2251
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
541 v37 = abs(pStationaryLightsStack->pLights[i].vPosition.z - z);
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
542 if ( v37 <= pStationaryLightsStack->pLights[i].uRadius)
0
Ritor1
parents:
diff changeset
543 {
2235
6ab7d7c112bb adding int_get_vector_length calls where the calls were inlined
Grumpy7
parents: 2216
diff changeset
544 v45 = int_get_vector_length(v26, v40, v37);
2251
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
545 //v33 = pStationaryLightsStack->pLights[i].uRadius;
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
546 if ( (signed int)v45 < pStationaryLightsStack->pLights[i].uRadius )
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
547 v6 += ((unsigned __int64)(30i64 * (signed int)(v45 << 16) / pStationaryLightsStack->pLights[i].uRadius) >> 16) - 30;
0
Ritor1
parents:
diff changeset
548 }
Ritor1
parents:
diff changeset
549 }
Ritor1
parents:
diff changeset
550 }
Ritor1
parents:
diff changeset
551 }
Ritor1
parents:
diff changeset
552
Ritor1
parents:
diff changeset
553 if ( v6 <= 31 )
Ritor1
parents:
diff changeset
554 {
Ritor1
parents:
diff changeset
555 if ( v6 < 0 )
Ritor1
parents:
diff changeset
556 v6 = 0;
Ritor1
parents:
diff changeset
557 }
Ritor1
parents:
diff changeset
558 else
Ritor1
parents:
diff changeset
559 v6 = 31;
Ritor1
parents:
diff changeset
560 return v6;
Ritor1
parents:
diff changeset
561 }
Ritor1
parents:
diff changeset
562
Ritor1
parents:
diff changeset
563
Ritor1
parents:
diff changeset
564 //----- (004070EF) --------------------------------------------------------
1493
9e9a12506d51 player detection partly working
zipi
parents: 1477
diff changeset
565 bool __fastcall sub_4070EF_prolly_detect_player(unsigned int uObjID, unsigned int uObj2ID)
0
Ritor1
parents:
diff changeset
566 {
Ritor1
parents:
diff changeset
567 signed int v2; // eax@1
Ritor1
parents:
diff changeset
568 int v5; // ecx@2
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
569 int obj1_sector; // eax@4
0
Ritor1
parents:
diff changeset
570 float v8; // ST24_4@5
Ritor1
parents:
diff changeset
571 double v9; // ST18_8@5
Ritor1
parents:
diff changeset
572 int v11; // ecx@6
Ritor1
parents:
diff changeset
573 signed int v12; // eax@7
Ritor1
parents:
diff changeset
574 int v13; // esi@7
Ritor1
parents:
diff changeset
575 int v14; // esi@8
Ritor1
parents:
diff changeset
576 int v15; // esi@9
1493
9e9a12506d51 player detection partly working
zipi
parents: 1477
diff changeset
577 int obj2_z; // edi@11
9e9a12506d51 player detection partly working
zipi
parents: 1477
diff changeset
578 int obj2_x; // esi@11
9e9a12506d51 player detection partly working
zipi
parents: 1477
diff changeset
579 int obj2_sector; // eax@13
0
Ritor1
parents:
diff changeset
580 float v20; // ST24_4@14
Ritor1
parents:
diff changeset
581 double v21; // ST18_8@14
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
582 int dist_x; // ebx@16
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
583 signed int dist_3d; // ecx@16
0
Ritor1
parents:
diff changeset
584 int v25; // eax@18
Ritor1
parents:
diff changeset
585 BLVFace *v29; // ebx@32
Ritor1
parents:
diff changeset
586 Vec3_short_ *v30; // esi@32
Ritor1
parents:
diff changeset
587 int v31; // eax@32
Ritor1
parents:
diff changeset
588 int v32; // ST50_4@44
Ritor1
parents:
diff changeset
589 int v33; // ST54_4@44
Ritor1
parents:
diff changeset
590 int v34; // eax@44
Ritor1
parents:
diff changeset
591 signed int v38; // esi@45
Ritor1
parents:
diff changeset
592 signed __int64 v40; // qtt@50
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
593 __int16 next_sector; // bx@58
0
Ritor1
parents:
diff changeset
594 int v43; // [sp-8h] [bp-70h]@11
Ritor1
parents:
diff changeset
595 int v44; // [sp-4h] [bp-6Ch]@11
Ritor1
parents:
diff changeset
596 int v47; // [sp+18h] [bp-50h]@20
Ritor1
parents:
diff changeset
597 int v48; // [sp+1Ch] [bp-4Ch]@20
Ritor1
parents:
diff changeset
598 int v49; // [sp+20h] [bp-48h]@20
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
599 int dist_z; // [sp+24h] [bp-44h]@16
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
600 signed int higher_z; // [sp+24h] [bp-44h]@27
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
601 signed int lower_z; // [sp+28h] [bp-40h]@26
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
602 signed int higher_y; // [sp+2Ch] [bp-3Ch]@23
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
603 signed int lower_y; // [sp+30h] [bp-38h]@22
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
604 signed int higher_x; // [sp+34h] [bp-34h]@21
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
605 signed int lower_x; // [sp+38h] [bp-30h]@20
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
606 signed int sectors_visited; // [sp+3Ch] [bp-2Ch]@28
0
Ritor1
parents:
diff changeset
607 int v58; // [sp+44h] [bp-24h]@50
Ritor1
parents:
diff changeset
608 int v59; // [sp+48h] [bp-20h]@44
1493
9e9a12506d51 player detection partly working
zipi
parents: 1477
diff changeset
609 int obj2_y; // [sp+50h] [bp-18h]@11
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
610 int obj1_x; // [sp+58h] [bp-10h]@4
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
611 int obj1_y; // [sp+5Ch] [bp-Ch]@4
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
612 int obj1_z; // [sp+60h] [bp-8h]@4
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
613 int current_sector; // [sp+64h] [bp-4h]@7
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
614 int dist_y;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
615 int v70;
0
Ritor1
parents:
diff changeset
616
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 839
diff changeset
617 v2 = PID_ID(uObjID);
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
618 switch( PID_TYPE(uObjID) )
0
Ritor1
parents:
diff changeset
619 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
620 case OBJECT_Decoration:
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
621 obj1_x = pLevelDecorations[v2].vPosition.x;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
622 obj1_y = pLevelDecorations[v2].vPosition.y;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
623 obj1_z = pLevelDecorations[v2].vPosition.z;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
624 obj1_sector = pIndoor->GetSector(obj1_x, obj1_y, obj1_z);
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
625 break;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
626 case OBJECT_Actor:
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
627 obj1_x = pActors[v2].vPosition.x;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
628 obj1_y = pActors[v2].vPosition.y;
0
Ritor1
parents:
diff changeset
629 v8 = (double)pActors[v2].uActorHeight * 0.69999999;
1493
9e9a12506d51 player detection partly working
zipi
parents: 1477
diff changeset
630 //v9 = v8 + 6.7553994e15;
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
631 //obj1_z = LODWORD(v9) + pActors[v2].vPosition.z;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
632 obj1_z = (int)v8 + pActors[v2].vPosition.z;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
633 obj1_sector = pActors[v2].uSectorID;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
634 break;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
635 case OBJECT_Item:
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
636 obj1_x = pSpriteObjects[v2].vPosition.x;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
637 obj1_y = pSpriteObjects[v2].vPosition.y;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
638 obj1_z = pSpriteObjects[v2].vPosition.z;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
639 obj1_sector = pSpriteObjects[v2].uSectorID;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
640 break;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
641 default:
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
642 return 0;
0
Ritor1
parents:
diff changeset
643 }
1493
9e9a12506d51 player detection partly working
zipi
parents: 1477
diff changeset
644 v12 = PID_ID(uObj2ID);
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
645 switch( PID_TYPE(uObj2ID) )
1493
9e9a12506d51 player detection partly working
zipi
parents: 1477
diff changeset
646 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
647 case OBJECT_Decoration:
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
648 obj2_z = pLevelDecorations[v12].vPosition.z;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
649 obj2_x = pLevelDecorations[v12].vPosition.x;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
650 obj2_y = pLevelDecorations[v12].vPosition.y;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
651 obj2_sector = pIndoor->GetSector(obj2_x, obj2_y, obj2_z);
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
652 break;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
653 case OBJECT_Player:
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
654 obj2_x = pParty->vPosition.x;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
655 obj2_z = pParty->sEyelevel + pParty->vPosition.z;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
656 obj2_y = pParty->vPosition.y;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
657 obj2_sector = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z);
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
658 break;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
659 case OBJECT_Actor:
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
660 obj2_y = pActors[v12].vPosition.y;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
661 obj2_x = pActors[v12].vPosition.x;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
662 v20 = (double)pActors[v12].uActorHeight * 0.69999999;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
663 //v21 = v20 + 6.7553994e15;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
664 //obj2_z = LODWORD(v21) + pActors[v12].vPosition.z;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
665 obj2_z = (int)v20 + pActors[v12].vPosition.z;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
666 obj2_sector = pActors[v12].uSectorID;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
667 break;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
668 case OBJECT_Item:
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
669 obj2_x = pSpriteObjects[v12].vPosition.x;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
670 obj2_z = pSpriteObjects[v12].vPosition.z;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
671 obj2_y = pSpriteObjects[v12].vPosition.y;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
672 obj2_sector = pSpriteObjects[v12].uSectorID;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
673 break;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
674 default:
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
675 return 0;
1493
9e9a12506d51 player detection partly working
zipi
parents: 1477
diff changeset
676 }
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
677 dist_x = obj2_x - obj1_x;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
678 dist_z = obj2_z - obj1_z;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
679 dist_y = obj2_y - obj1_y;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
680 dist_3d = integer_sqrt(dist_x * dist_x + dist_y * dist_y + dist_z * dist_z);
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
681 //range check
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
682 if ( dist_3d > 5120 )
0
Ritor1
parents:
diff changeset
683 return 0;
Ritor1
parents:
diff changeset
684 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
Ritor1
parents:
diff changeset
685 return 1;
Ritor1
parents:
diff changeset
686 v25 = 65536;
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
687 if ( dist_3d )
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
688 v25 = 65536 / dist_3d;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
689 v49 = dist_x * v25;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
690 v47 = dist_z * v25;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
691 v48 = dist_y * v25;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
692 if ( obj1_x < obj2_x )
0
Ritor1
parents:
diff changeset
693 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
694 lower_x = obj1_x;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
695 higher_x = obj2_x;
0
Ritor1
parents:
diff changeset
696 }
Ritor1
parents:
diff changeset
697 else
Ritor1
parents:
diff changeset
698 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
699 lower_x = obj2_x;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
700 higher_x = obj1_x;
0
Ritor1
parents:
diff changeset
701 }
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
702 if ( obj1_y < obj2_y )
0
Ritor1
parents:
diff changeset
703 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
704 lower_y = obj1_y;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
705 higher_y = obj2_y;
0
Ritor1
parents:
diff changeset
706 }
Ritor1
parents:
diff changeset
707 else
Ritor1
parents:
diff changeset
708 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
709 lower_y = obj2_y;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
710 higher_y = obj1_y;
0
Ritor1
parents:
diff changeset
711 }
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
712 if ( obj1_z < obj2_z )
0
Ritor1
parents:
diff changeset
713 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
714 lower_z = obj1_z;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
715 higher_z = obj2_z;
0
Ritor1
parents:
diff changeset
716 }
Ritor1
parents:
diff changeset
717 else
Ritor1
parents:
diff changeset
718 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
719 lower_z = obj2_z;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
720 higher_z = obj1_z;
0
Ritor1
parents:
diff changeset
721 }
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
722 sectors_visited = 0;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
723 //monster in same sector with player
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
724 if ( obj1_sector == obj2_sector )
0
Ritor1
parents:
diff changeset
725 return 1;
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
726 //search starts from monster
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
727 current_sector = obj1_sector;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
728 for( int current_portal = 0; current_portal < pIndoor->pSectors[current_sector].uNumPortals; current_portal++ )
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
729 {
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
730 v29 = &pIndoor->pFaces[pIndoor->pSectors[current_sector].pPortals[current_portal]];
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
731 v30 = &pIndoor->pVertices[*v29->pVertexIDs];
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
732 v31 = v29->pFacePlane_old.vNormal.z * (v30->z - obj1_z)
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
733 + v29->pFacePlane_old.vNormal.y * (v30->y - obj1_y)
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
734 + v29->pFacePlane_old.vNormal.x * (v30->x - obj1_x);
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
735
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
736 if ( current_sector != v29->uSectorID )
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
737 v31 = -v31;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
738
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
739 if ( v31 >= 0 && v30->x != obj1_x && v30->y != obj1_y && v30->z != obj1_z)
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
740 continue;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
741
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
742 if( lower_x > v29->pBounding.x2
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
743 || higher_x < v29->pBounding.x1
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
744 || lower_y > v29->pBounding.y2
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
745 || higher_y < v29->pBounding.y1
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
746 || lower_z > v29->pBounding.z2
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
747 || higher_z < v29->pBounding.z1 )
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
748 {
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
749 continue;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
750 }
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
751
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1637
diff changeset
752 v32 = fixpoint_mul(v29->pFacePlane_old.vNormal.x,v49);
7182930263b3 fixpoint functions renaming
zipi
parents: 1637
diff changeset
753 v33 = fixpoint_mul(v29->pFacePlane_old.vNormal.z,v47);
7182930263b3 fixpoint functions renaming
zipi
parents: 1637
diff changeset
754 v34 = fixpoint_mul(v29->pFacePlane_old.vNormal.y,v48);
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
755 v59 = v32 + v33 + v34;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
756 if ( v59 )
1493
9e9a12506d51 player detection partly working
zipi
parents: 1477
diff changeset
757 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
758 v70 = v29->pFacePlane_old.dist
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
759 + obj1_z * v29->pFacePlane_old.vNormal.z
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
760 + obj1_x * v29->pFacePlane_old.vNormal.x
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
761 + obj1_y * v29->pFacePlane_old.vNormal.y;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
762 v38 = -v70;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
763
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
764 // if ( v59 <= 0 ^ v70 <= 0 )
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
765
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
766 /* TEMPORARY
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
767 if ( v59 <= 0 && v70 <= 0 )
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
768 {
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
769 continue;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
770 }
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
771 if ( !(v59 <= 0 && v70 <= 0) )
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
772 {
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
773 continue;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
774 }
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
775 */
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
776
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
777 if( abs(v38) >> 14 > abs(v59) )
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
778 continue;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
779
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1637
diff changeset
780 v58 = fixpoint_div(v38,v59);
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
781
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
782 if( v58 < 0 )
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
783 continue;
1493
9e9a12506d51 player detection partly working
zipi
parents: 1477
diff changeset
784
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
785 if(!sub_4075DB(obj1_x + ((fixpoint_mul(v49,v58) + 32768) >> 16), obj1_y + ((fixpoint_mul(v48,v58) + 32768) >> 16),
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
786 obj1_z + ((fixpoint_mul(v47,v58) + 32768) >> 16), v29) )
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
787 {
1616
de6e646822a6 mul <> sub0 difference
zipi
parents: 1615
diff changeset
788 continue;
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
789 }
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
790
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
791 //if there is no next sector turn back
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
792 if ( v29->uSectorID == current_sector )
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
793 next_sector = v29->uBackSectorID;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
794 else
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
795 next_sector = v29->uSectorID;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
796
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
797 //no more portals, quit
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
798 if ( next_sector == current_sector )
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
799 break;
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
800
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
801 ++sectors_visited;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
802 current_sector = next_sector;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
803
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
804 //found player, quit
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
805 if ( next_sector == obj2_sector )
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
806 return 1;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
807
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
808 current_sector = next_sector;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
809
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
810 //did we hit limit for portals?
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
811 //does the next room have portals?
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
812 if ( sectors_visited < 30 && pIndoor->pSectors[current_sector].uNumPortals > 0)
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
813 {
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
814 current_portal=-1;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
815 continue;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
816 }
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
817 else
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
818 break;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
819 }
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
820 }
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
821 //did we stop in the sector where player is?
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
822 if ( current_sector != obj2_sector )
0
Ritor1
parents:
diff changeset
823 return 0;
Ritor1
parents:
diff changeset
824 return 1;
Ritor1
parents:
diff changeset
825 }
Ritor1
parents:
diff changeset
826
Ritor1
parents:
diff changeset
827 //----- (004075DB) --------------------------------------------------------
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
828 bool __fastcall sub_4075DB(int x, int y, int z, BLVFace *face)
0
Ritor1
parents:
diff changeset
829 {
Ritor1
parents:
diff changeset
830 int v8; // edi@2
Ritor1
parents:
diff changeset
831 signed int v25; // eax@22
Ritor1
parents:
diff changeset
832 bool result; // eax@25
Ritor1
parents:
diff changeset
833 signed int a3a; // [sp+24h] [bp+8h]@14
Ritor1
parents:
diff changeset
834 int a4a; // [sp+28h] [bp+Ch]@2
Ritor1
parents:
diff changeset
835
2000
985fff9fb62d constructor functions
zipi
parents: 1980
diff changeset
836 std::array<int, 52> dword_4F5CC8_ys; // idb
985fff9fb62d constructor functions
zipi
parents: 1980
diff changeset
837 std::array<int, 52> dword_4F5D98_xs; // idb
985fff9fb62d constructor functions
zipi
parents: 1980
diff changeset
838
1493
9e9a12506d51 player detection partly working
zipi
parents: 1477
diff changeset
839 //__debugbreak();
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1455
diff changeset
840
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
841 if ( face->uAttributes & FACE_XY_PLANE )
0
Ritor1
parents:
diff changeset
842 {
1616
de6e646822a6 mul <> sub0 difference
zipi
parents: 1615
diff changeset
843 a4a = x;
de6e646822a6 mul <> sub0 difference
zipi
parents: 1615
diff changeset
844 v8 = y;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
845 for(int i = 0; i < face->uNumVertices; i++)
1471
736973e11d11 sub_4075DB cleaned
zipi
parents: 1469
diff changeset
846 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
847 dword_4F5D98_xs[i] = pIndoor->pVertices[face->pVertexIDs[i]].x;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
848 dword_4F5CC8_ys[i] = pIndoor->pVertices[face->pVertexIDs[i]].y;
1471
736973e11d11 sub_4075DB cleaned
zipi
parents: 1469
diff changeset
849 }
0
Ritor1
parents:
diff changeset
850 }
Ritor1
parents:
diff changeset
851 else
Ritor1
parents:
diff changeset
852 {
1616
de6e646822a6 mul <> sub0 difference
zipi
parents: 1615
diff changeset
853 v8 = z;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
854 if ( face->uAttributes & FACE_XZ_PLANE )
0
Ritor1
parents:
diff changeset
855 {
1616
de6e646822a6 mul <> sub0 difference
zipi
parents: 1615
diff changeset
856 a4a = x;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
857 for(int i = 0; i < face->uNumVertices; i++)
1471
736973e11d11 sub_4075DB cleaned
zipi
parents: 1469
diff changeset
858 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
859 dword_4F5D98_xs[i] = pIndoor->pVertices[face->pVertexIDs[i]].x;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
860 dword_4F5CC8_ys[i] = pIndoor->pVertices[face->pVertexIDs[i]].z;
1471
736973e11d11 sub_4075DB cleaned
zipi
parents: 1469
diff changeset
861 }
0
Ritor1
parents:
diff changeset
862 }
Ritor1
parents:
diff changeset
863 else
Ritor1
parents:
diff changeset
864 {
1616
de6e646822a6 mul <> sub0 difference
zipi
parents: 1615
diff changeset
865 a4a = y;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
866 for(int i = 0; i < face->uNumVertices; i++)
1471
736973e11d11 sub_4075DB cleaned
zipi
parents: 1469
diff changeset
867 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
868 dword_4F5D98_xs[i] = pIndoor->pVertices[face->pVertexIDs[i]].y;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
869 dword_4F5CC8_ys[i] = pIndoor->pVertices[face->pVertexIDs[i]].z;
1471
736973e11d11 sub_4075DB cleaned
zipi
parents: 1469
diff changeset
870 }
0
Ritor1
parents:
diff changeset
871 }
Ritor1
parents:
diff changeset
872 }
Ritor1
parents:
diff changeset
873 a3a = 0;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
874 dword_4F5D98_xs[face->uNumVertices] = dword_4F5D98_xs[0];
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
875 dword_4F5CC8_ys[face->uNumVertices] = dword_4F5CC8_ys[0];
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
876 for(int i = 0; i < face->uNumVertices && a3a < 2; i++)
0
Ritor1
parents:
diff changeset
877 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
878 if ( dword_4F5CC8_ys[i] >= v8 ^ (dword_4F5CC8_ys[i + 1] >= v8) )
0
Ritor1
parents:
diff changeset
879 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
880 //if( dword_4F5D98_xs[i + 1] >= a4a || dword_4F5D98_xs[i] >= a4a)
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
881 if( !(dword_4F5D98_xs[i + 1] >= a4a && dword_4F5D98_xs[i] < a4a))
0
Ritor1
parents:
diff changeset
882 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
883 if ( (dword_4F5D98_xs[i + 1] < a4a && dword_4F5D98_xs[i] >= a4a) )
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
884 ++a3a;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
885 //|| (v25 = dword_4F5D98_xs[i + 1] - dword_4F5D98_xs[i],LODWORD(v26) = v25 << 16, HIDWORD(v26) = v25 >> 16,
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
886 //dword_4F5D98_xs[i] + ((signed int)(((unsigned __int64)(v26 / (dword_4F5CC4_ys[i + 2] - dword_4F5CC4_ys[i + 1])* ((v8 - dword_4F5CC4_ys[i + 1]) << 16)) >> 16)
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
887 // + 32768) >> 16) >= a4a) )
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
888 else
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
889 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1637
diff changeset
890 v25 = fixpoint_div(dword_4F5D98_xs[i + 1] - dword_4F5D98_xs[i], dword_4F5CC8_ys[i + 1] - dword_4F5CC8_ys[i]);
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
891 if( dword_4F5D98_xs[i] + (fixpoint_mul(v25, (v8 - dword_4F5CC8_ys[i]) << 16) + 0x8000 >> 16) >= a4a)
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
892 ++a3a;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
893 }
0
Ritor1
parents:
diff changeset
894 }
Ritor1
parents:
diff changeset
895 }
Ritor1
parents:
diff changeset
896 }
Ritor1
parents:
diff changeset
897 result = 1;
Ritor1
parents:
diff changeset
898 if ( a3a != 1 )
Ritor1
parents:
diff changeset
899 result = 0;
Ritor1
parents:
diff changeset
900 return result;
Ritor1
parents:
diff changeset
901 }
Ritor1
parents:
diff changeset
902
Ritor1
parents:
diff changeset
903 //----- (004077F1) --------------------------------------------------------
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
904 bool __fastcall sub_4077F1(int a1, int a2, int a3, ODMFace *face, BSPVertexBuffer *a5)
0
Ritor1
parents:
diff changeset
905 {
Ritor1
parents:
diff changeset
906 int a4a; // [sp+28h] [bp+Ch]@2
Ritor1
parents:
diff changeset
907 signed int a5a; // [sp+2Ch] [bp+10h]@14
Ritor1
parents:
diff changeset
908
2000
985fff9fb62d constructor functions
zipi
parents: 1980
diff changeset
909 std::array<int, 52> dword_4F5B24_ys; // idb
985fff9fb62d constructor functions
zipi
parents: 1980
diff changeset
910 std::array<int, 52> dword_4F5BF4_xs; // idb
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
911
2057
b7485a6502f2 AgressorAtackInfo
Ritor1
parents: 2044
diff changeset
912 //__debugbreak(); //срабатывает при нападении стрекозавров с огнём
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1455
diff changeset
913
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
914 if ( face->uAttributes & FACE_XY_PLANE )
0
Ritor1
parents:
diff changeset
915 {
Ritor1
parents:
diff changeset
916 a4a = a1;
Ritor1
parents:
diff changeset
917 a3 = a2;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
918 for(int i = 0; i < face->uNumVertices; i++)
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
919 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
920 dword_4F5BF4_xs[i+1] = a5->pVertices[face->pVertexIDs[i]].x;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
921 dword_4F5B24_ys[i+1] = a5->pVertices[face->pVertexIDs[i]].y;
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
922 }
0
Ritor1
parents:
diff changeset
923 }
Ritor1
parents:
diff changeset
924 else
Ritor1
parents:
diff changeset
925 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
926 if ( face->uAttributes & FACE_XY_PLANE )
0
Ritor1
parents:
diff changeset
927 {
Ritor1
parents:
diff changeset
928 a4a = a1;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
929 for(int i = 0; i < face->uNumVertices; i++)
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
930 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
931 dword_4F5BF4_xs[i+1] = a5->pVertices[face->pVertexIDs[i]].x;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
932 dword_4F5B24_ys[i+1] = a5->pVertices[face->pVertexIDs[i]].z;
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
933 }
0
Ritor1
parents:
diff changeset
934 }
Ritor1
parents:
diff changeset
935 else
Ritor1
parents:
diff changeset
936 {
Ritor1
parents:
diff changeset
937 a4a = a2;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
938 for(int i = 0; i < face->uNumVertices; i++)
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
939 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
940 dword_4F5BF4_xs[i+1] = a5->pVertices[face->pVertexIDs[i]].y;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
941 dword_4F5B24_ys[i+1] = a5->pVertices[face->pVertexIDs[i]].z;
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
942 }
0
Ritor1
parents:
diff changeset
943 }
Ritor1
parents:
diff changeset
944 }
Ritor1
parents:
diff changeset
945 a5a = 0;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
946 dword_4F5BF4_xs[face->uNumVertices + 1] = dword_4F5BF4_xs[1];
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
947 dword_4F5B24_ys[face->uNumVertices + 1] = dword_4F5B24_ys[1];
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
948 for(int i = 0; i < face->uNumVertices; i++)
0
Ritor1
parents:
diff changeset
949 {
Ritor1
parents:
diff changeset
950 if ( a5a >= 2 )
Ritor1
parents:
diff changeset
951 break;
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
952 if ( dword_4F5B24_ys[i + 1] >= a3 ^ (dword_4F5B24_ys[i + 2] >= a3) )
0
Ritor1
parents:
diff changeset
953 {
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
954 if( dword_4F5BF4_xs[i + 2] >= a4a || dword_4F5BF4_xs[i] >= a4a)
0
Ritor1
parents:
diff changeset
955 {
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
956 if (dword_4F5BF4_xs[i + 2] >= a4a && dword_4F5BF4_xs[i + 1] >= a4a)
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
957 ++a5a;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
958 else
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
959 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
960 //v23 = (__int64)(dword_4F5BF4_xs[i + 2] - dword_4F5BF4_xs[i + 1]) << 16;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
961 __int64 _a = dword_4F5B24_ys[i + 2] - dword_4F5B24_ys[i + 1];
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
962 __int64 _b = (__int64)(a3 - dword_4F5B24_ys[i + 1]) << 16;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
963
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
964 if (dword_4F5BF4_xs[i + 1] + ((((((__int64)(dword_4F5BF4_xs[i + 2] - dword_4F5BF4_xs[i + 1]) << 16) / _a * _b) >> 16) + 0x8000) >> 16) >= a4a)
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
965 ++a5a;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
966 }
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
967 }
0
Ritor1
parents:
diff changeset
968 }
Ritor1
parents:
diff changeset
969 }
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
970
0
Ritor1
parents:
diff changeset
971 if ( a5a != 1 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
972 return false;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
973 return true;
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
974
0
Ritor1
parents:
diff changeset
975 }
Ritor1
parents:
diff changeset
976
Ritor1
parents:
diff changeset
977 //----- (004088E9) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
978 int __fastcall sub_4088E9(int x1, int y1, int x2, int y2, int x3, int y3)
0
Ritor1
parents:
diff changeset
979 {
Ritor1
parents:
diff changeset
980 signed int result; // eax@1
Ritor1
parents:
diff changeset
981
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
982 result = integer_sqrt(abs(x2 - x1) * abs(x2 - x1) + abs(y2 - y1) * abs(y2 - y1));
0
Ritor1
parents:
diff changeset
983 if ( result )
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
984 result = abs(((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / result);
0
Ritor1
parents:
diff changeset
985 return result;
Ritor1
parents:
diff changeset
986 }
Ritor1
parents:
diff changeset
987
Ritor1
parents:
diff changeset
988 //----- (0040F82D) --------------------------------------------------------
Ritor1
parents:
diff changeset
989 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue)
Ritor1
parents:
diff changeset
990 {
973
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
991 assert(uTextureId != -1);
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
992 ZBuffer_DoFill(pZBuffer, pIcons_LOD->GetTexture(uTextureId), iZValue);
0
Ritor1
parents:
diff changeset
993 }
Ritor1
parents:
diff changeset
994
Ritor1
parents:
diff changeset
995 //----- (0040F89C) --------------------------------------------------------
Ritor1
parents:
diff changeset
996 void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue)
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
997 {//срабатывает при продаже в магазине
0
Ritor1
parents:
diff changeset
998 void *v3; // eax@3
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
999 //void *v4; // esi@5
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1000 //int *v5; // edi@5
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1001 //int v6; // eax@5
0
Ritor1
parents:
diff changeset
1002 int v7; // ecx@6
Ritor1
parents:
diff changeset
1003 int v11; // [sp+18h] [bp-8h]@1
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1004 //void *v12; // [sp+1Ch] [bp-4h]@5
0
Ritor1
parents:
diff changeset
1005
Ritor1
parents:
diff changeset
1006 if ( pIcons_LOD->dword_011BA4 && pTex->uDecompressedSize )
Ritor1
parents:
diff changeset
1007 v3 = pTex->UnzipPalette();
Ritor1
parents:
diff changeset
1008 else
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 709
diff changeset
1009 v3 = pTex->pLevelOfDetail0_prolly_alpha_mask;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1010 //v12 = v3;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1011 //v4 = v3;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1012 //v5 = pZBuffer;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1013 //v6 = 0;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1014 for ( uint i = 0; i < pTex->uTextureHeight; i++ )
0
Ritor1
parents:
diff changeset
1015 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1016 for ( uint j = 0; j < pTex->uTextureWidth; j++ )
0
Ritor1
parents:
diff changeset
1017 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1018 //LOBYTE(v6) = *(char *)v4;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1019 //v4 = (char *)v4 + 1;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1020 //if ( v6 )
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1021 *pZBuffer = uZValue;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1022 ++pZBuffer;
0
Ritor1
parents:
diff changeset
1023 }
2215
e9625ad08541 fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents: 2207
diff changeset
1024 pZBuffer += window->GetWidth() - pTex->uTextureWidth;
0
Ritor1
parents:
diff changeset
1025 }
Ritor1
parents:
diff changeset
1026 if ( pIcons_LOD->dword_011BA4 )
Ritor1
parents:
diff changeset
1027 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1028 if ( pTex->uDecompressedSize )
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1029 free(v3);
0
Ritor1
parents:
diff changeset
1030 }
Ritor1
parents:
diff changeset
1031 }
Ritor1
parents:
diff changeset
1032
Ritor1
parents:
diff changeset
1033 //----- (0040F92A) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1455
diff changeset
1034 void __fastcall ZBuffer_DoFill2(int *pZBuffer, Texture *a2, int a3)
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1035 {//срабатывает в покупке в магазине
0
Ritor1
parents:
diff changeset
1036 void *v4; // eax@3
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1037 //int *v5; // edi@5
0
Ritor1
parents:
diff changeset
1038 int v6; // ecx@6
Ritor1
parents:
diff changeset
1039 int v9; // [sp+18h] [bp-4h]@1
Ritor1
parents:
diff changeset
1040
Ritor1
parents:
diff changeset
1041 if ( pIcons_LOD->dword_011BA4 && a2->uDecompressedSize )
Ritor1
parents:
diff changeset
1042 v4 = a2->UnzipPalette();
Ritor1
parents:
diff changeset
1043 else
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 709
diff changeset
1044 v4 = a2->pLevelOfDetail0_prolly_alpha_mask;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1045 //v5 = pZBuffer;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1046 for ( uint i = 0; i < a2->uTextureHeight; i++ )
0
Ritor1
parents:
diff changeset
1047 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1048 for ( uint j = 0; j < a2->uTextureWidth; j++ )
0
Ritor1
parents:
diff changeset
1049 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1050 *pZBuffer = a3;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1051 ++pZBuffer;
0
Ritor1
parents:
diff changeset
1052 }
2215
e9625ad08541 fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents: 2207
diff changeset
1053 pZBuffer += window->GetWidth() - a2->uTextureWidth;
0
Ritor1
parents:
diff changeset
1054 }
Ritor1
parents:
diff changeset
1055 if ( pIcons_LOD->dword_011BA4 )
Ritor1
parents:
diff changeset
1056 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1057 if ( a2->uDecompressedSize )
0
Ritor1
parents:
diff changeset
1058 free(v4);
Ritor1
parents:
diff changeset
1059 }
Ritor1
parents:
diff changeset
1060 }
Ritor1
parents:
diff changeset
1061
Ritor1
parents:
diff changeset
1062 //----- (00410D99) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1455
diff changeset
1063 int __fastcall sub_410D99_get_map_index(int a1)
0
Ritor1
parents:
diff changeset
1064 {
Ritor1
parents:
diff changeset
1065 int v1; // edi@1
Ritor1
parents:
diff changeset
1066 signed int v2; // ebp@1
Ritor1
parents:
diff changeset
1067 const char **v3; // esi@2
Ritor1
parents:
diff changeset
1068 char *v4; // ebx@2
Ritor1
parents:
diff changeset
1069
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
1070 __debugbreak();//Ritor1
0
Ritor1
parents:
diff changeset
1071 v1 = a1;
Ritor1
parents:
diff changeset
1072 v2 = 1;
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1101
diff changeset
1073 if ( _stricmp(pMapStats->pInfos[1].pFilename, (const char *)&pGames_LOD->pSubIndices[a1]) )
0
Ritor1
parents:
diff changeset
1074 {
Ritor1
parents:
diff changeset
1075 v3 = (const char **)&pMapStats->pInfos[1].pFilename;
Ritor1
parents:
diff changeset
1076 v4 = (char *)&pMapStats->pInfos[1].pFilename;
Ritor1
parents:
diff changeset
1077 do
Ritor1
parents:
diff changeset
1078 {
Ritor1
parents:
diff changeset
1079 if ( !*(int *)v4 )
Ritor1
parents:
diff changeset
1080 break;
Ritor1
parents:
diff changeset
1081 v3 += 17;
Ritor1
parents:
diff changeset
1082 ++v2;
Ritor1
parents:
diff changeset
1083 v4 = (char *)v3;
Ritor1
parents:
diff changeset
1084 }
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1101
diff changeset
1085 while ( _stricmp(*v3, (const char *)&pGames_LOD->pSubIndices[v1]) );
0
Ritor1
parents:
diff changeset
1086 }
Ritor1
parents:
diff changeset
1087 return v2;
Ritor1
parents:
diff changeset
1088 }
Ritor1
parents:
diff changeset
1089
Ritor1
parents:
diff changeset
1090 // 4E28F8: using guessed type int pCurrentScreen;
Ritor1
parents:
diff changeset
1091
Ritor1
parents:
diff changeset
1092 //----- (00417AD4) --------------------------------------------------------
983
1462a5f12b65 Character Skills tab drawing fixed.
Nomad
parents: 982
diff changeset
1093 unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level)
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1094 {
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1095 switch (uPlayerClass % 4)
269
b34b53ee874d skill_learn_ability_by_class_table[36][37]
Ritor1
parents: 264
diff changeset
1096 {
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1097 case 0:
269
b34b53ee874d skill_learn_ability_by_class_table[36][37]
Ritor1
parents: 264
diff changeset
1098 {
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1099 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level)
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1100 return ui_character_skillinfo_can_learn;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1101 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level &&
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1102 byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level)
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1103 {
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1104 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType] < skill_level)
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1105 return ui_character_skillinfo_cant_learn;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1106 }
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1107 return ui_character_skillinfo_can_learn_gm;
0
Ritor1
parents:
diff changeset
1108 }
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1109 break;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1110
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1111 case 1:
269
b34b53ee874d skill_learn_ability_by_class_table[36][37]
Ritor1
parents: 264
diff changeset
1112 {
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1113 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level)
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1114 return ui_character_skillinfo_can_learn;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1115 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level)
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1116 {
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1117 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level)
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1118 return ui_character_skillinfo_cant_learn;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1119 }
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1120 return ui_character_skillinfo_can_learn_gm;
0
Ritor1
parents:
diff changeset
1121 }
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1122 break;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1123
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1124 case 2:
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1125 case 3:
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1126 {
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1127 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level)
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1128 return ui_character_skillinfo_cant_learn;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1129 return ui_character_skillinfo_can_learn;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1130 }
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
1131 break;
0
Ritor1
parents:
diff changeset
1132 }
1575
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1546
diff changeset
1133 Error("Invalid player class: %u", uPlayerClass);
1296
c423f946dc99 moving files continue
Ritor1
parents: 1273
diff changeset
1134 }