annotate mm7_5.cpp @ 2461:ff7f4995aa25

function MakeScreenshot()
author Ritor1
date Tue, 05 Aug 2014 17:00:35 +0600
parents f4af3b203f65
children 0f17a30149ec
rev   line source
2415
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2390
diff changeset
1 #define _CRTDBG_MAP_ALLOC
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2390
diff changeset
2 #include <stdlib.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2390
diff changeset
3 #include <crtdbg.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2390
diff changeset
4
2253
aff7a7b072b7 adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents: 2245
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
2336
d6887ee81068 header file include cleanup
Grumpy7
parents: 2334
diff changeset
6 #include "ErrorHandling.h"
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 1000
diff changeset
7 #include "LightmapBuilder.h"
0
Ritor1
parents:
diff changeset
8 #include "mm7.h"
Ritor1
parents:
diff changeset
9 #include "GUIWindow.h"
Ritor1
parents:
diff changeset
10 #include "Party.h"
Ritor1
parents:
diff changeset
11 #include "Outdoor.h"
Ritor1
parents:
diff changeset
12 #include "LOD.h"
Ritor1
parents:
diff changeset
13 #include "Actor.h"
Ritor1
parents:
diff changeset
14 #include "Viewport.h"
2037
7a9477135943 Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents: 2006
diff changeset
15 #include "OurMath.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 513
diff changeset
16 #include "SpriteObject.h"
2044
28cb79ae2f6f Time.h rename
Ritor1
parents: 2037
diff changeset
17 #include "Timer.h"
0
Ritor1
parents:
diff changeset
18 #include "stru298.h"
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
19 #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
20 #include "Level/Decoration.h"
2336
d6887ee81068 header file include cleanup
Grumpy7
parents: 2334
diff changeset
21 #include "mm7_unsorted_subs.h"
d6887ee81068 header file include cleanup
Grumpy7
parents: 2334
diff changeset
22 #include "mm7_data.h"
0
Ritor1
parents:
diff changeset
23
2207
ff8920a40c21 fixpoint_mul
Ritor1
parents: 2205
diff changeset
24
0
Ritor1
parents:
diff changeset
25 //----- (004356FF) --------------------------------------------------------
1575
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1546
diff changeset
26 void back_to_game()
0
Ritor1
parents:
diff changeset
27 {
Ritor1
parents:
diff changeset
28 dword_507BF0_is_there_popup_onscreen = 0;
Ritor1
parents:
diff changeset
29 dword_4E455C = 1;
1575
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1546
diff changeset
30
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1546
diff changeset
31 extern int no_rightlick_in_inventory;
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1546
diff changeset
32 no_rightlick_in_inventory = false;
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1546
diff changeset
33
0
Ritor1
parents:
diff changeset
34 if ( pGUIWindow_ScrollWindow )
Ritor1
parents:
diff changeset
35 free_book_subwindow();
Ritor1
parents:
diff changeset
36 if ( !pCurrentScreen && !pGUIWindow_Settings )
Ritor1
parents:
diff changeset
37 pEventTimer->Resume();
Ritor1
parents:
diff changeset
38 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
39 }
782
c47efaf23642 more tidy
zipi
parents: 766
diff changeset
40
0
Ritor1
parents:
diff changeset
41 //----- (004369DB) --------------------------------------------------------
Ritor1
parents:
diff changeset
42 void Vec3_float_::Normalize()
Ritor1
parents:
diff changeset
43 {
1025
8b492d4722d4 Intersection
Ritor1
parents: 1023
diff changeset
44 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
45 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
46 this->z = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->z;
0
Ritor1
parents:
diff changeset
47 }
Ritor1
parents:
diff changeset
48
Ritor1
parents:
diff changeset
49 //----- (00438F8F) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1384
diff changeset
50 void area_of_effect__damage_evaluate()
0
Ritor1
parents:
diff changeset
51 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
52 int attacker_type; // ecx@3
0
Ritor1
parents:
diff changeset
53 signed int v3; // eax@3
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
54 unsigned int target_id; // edi@6
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
55 int target_type; // eax@6
0
Ritor1
parents:
diff changeset
56 int v10; // edi@8
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
57 Vec3_int_ attacker_coord; // ST04_12@9
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
58 // int v12; // ST0C_4@10
0
Ritor1
parents:
diff changeset
59 int v15; // edx@15
Ritor1
parents:
diff changeset
60 int v19; // edi@15
Ritor1
parents:
diff changeset
61 int v23; // edx@18
Ritor1
parents:
diff changeset
62 int v24; // eax@18
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
63 // int v30; // eax@29
0
Ritor1
parents:
diff changeset
64 int v31; // edx@29
Ritor1
parents:
diff changeset
65 int v32; // eax@29
Ritor1
parents:
diff changeset
66 int v33; // ST24_4@29
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 513
diff changeset
67 SpriteObject *v36; // [sp+0h] [bp-28h]@0
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
68 int attacker_id; // [sp+10h] [bp-18h]@1
0
Ritor1
parents:
diff changeset
69 int v44; // [sp+14h] [bp-14h]@15
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
70 //Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2
2205
db94443ea4e7 _44100D_should_alter_right_panel()
Ritor1
parents: 2166
diff changeset
71 signed int a1; // [sp+20h] [bp-8h]@8
0
Ritor1
parents:
diff changeset
72 int v48; // [sp+24h] [bp-4h]@8
Ritor1
parents:
diff changeset
73
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
74
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
75 for ( attacker_id = 0; attacker_id < AttackerInfo.count; ++attacker_id )
0
Ritor1
parents:
diff changeset
76 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
77 attacker_type = PID_TYPE(AttackerInfo.pIDs[attacker_id]);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
78 v3 = PID_ID(AttackerInfo.pIDs[attacker_id]);
2057
b7485a6502f2 AgressorAtackInfo
Ritor1
parents: 2044
diff changeset
79
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
80 if ( attacker_type == 2 )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
81 {
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
82 v36 = &pSpriteObjects[v3];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
83 attacker_type = PID_TYPE(pSpriteObjects[v3].spell_caster_pid);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
84 v3 = PID_ID(pSpriteObjects[v3].spell_caster_pid);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
85 }
2057
b7485a6502f2 AgressorAtackInfo
Ritor1
parents: 2044
diff changeset
86
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
87 if ( AttackerInfo.field_3EC[attacker_id] & 1 )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
88 {
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
89 target_id = PID_ID(ai_near_actors_targets_pid[v3]);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
90 target_type = PID_TYPE(ai_near_actors_targets_pid[v3]) - 3;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
91 if ( target_type )
0
Ritor1
parents:
diff changeset
92 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
93 if ( target_type == 1 )//party damage from monsters(повреждения группе от монстров)
0
Ritor1
parents:
diff changeset
94 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
95 v10 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
96 a1 = pParty->vPosition.x - AttackerInfo.pXs[attacker_id];
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
97 v48 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id];
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
98 if ( a1 * a1 + v10 * v10
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
99 + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AttackerInfo.pZs[attacker_id]))
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
100 * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AttackerInfo.pZs[attacker_id]))
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
101 < (unsigned int)((AttackerInfo.field_324[attacker_id] + 32) * (AttackerInfo.field_324[attacker_id] + 32)) )
0
Ritor1
parents:
diff changeset
102 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
103 attacker_coord.x = AttackerInfo.pXs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
104 attacker_coord.y = AttackerInfo.pYs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
105 attacker_coord.z = AttackerInfo.pZs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
106 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, attacker_coord) )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
107 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
108 }
Ritor1
parents:
diff changeset
109 }
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
110 }
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
111 else//Actor damage from monsters(повреждение местного жителя)
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
112 {
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
113 if ( SHIDWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) > 0
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
114 || SHIDWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) >= 0
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
115 && LODWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime)
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
116 || pActors[target_id].CanAct() )
0
Ritor1
parents:
diff changeset
117 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
118 v15 = pActors[target_id].vPosition.y - AttackerInfo.pYs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
119 a1 = pActors[target_id].vPosition.x - AttackerInfo.pXs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
120 v44 = pActors[target_id].vPosition.z;
2390
c631b1877204 area_of_effect_damage_evaluate - fixed spells radius problem
zipi
parents: 2348
diff changeset
121 v19 = AttackerInfo.field_324[attacker_id] + pActors[target_id].uActorRadius;
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
122 v48 = v15;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
123 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
124 * (pActors[target_id].vPosition.z + (pActors[target_id].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id]) < (unsigned int)(v19 * v19) )
0
Ritor1
parents:
diff changeset
125 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
126 attacker_coord.x = AttackerInfo.pXs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
127 attacker_coord.y = AttackerInfo.pYs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
128 attacker_coord.z = AttackerInfo.pZs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
129 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
130 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
131 Vec3_int_::Normalize(&a1, &v48, &v44);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
132 AttackerInfo.vec_4B4[attacker_id].x = a1;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
133 AttackerInfo.vec_4B4[attacker_id].y = v48;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
134 AttackerInfo.vec_4B4[attacker_id].z = v44;
2310
43af6c819e88 ActorDamageFromMonster moved into Actor class
Grumpy7
parents: 2309
diff changeset
135 Actor::ActorDamageFromMonster(AttackerInfo.pIDs[attacker_id], target_id, &AttackerInfo.vec_4B4[attacker_id], AttackerInfo.field_450[attacker_id]);
0
Ritor1
parents:
diff changeset
136 }
Ritor1
parents:
diff changeset
137 }
Ritor1
parents:
diff changeset
138 }
Ritor1
parents:
diff changeset
139 }
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
140 }
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
141 else //damage from spells(повреждения от заклов(метеоритный дождь))
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
142 {
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
143 v23 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id];
2216
3f375342de12 window->GetWidth() continue
Ritor1
parents: 2215
diff changeset
144 v24 = ((signed int)pParty->uPartyHeight / 2) - AttackerInfo.pZs[attacker_id];
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
145 a1 = pParty->vPosition.x - AttackerInfo.pXs[attacker_id];
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
146 v48 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id];
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
147 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
148 {//party damage (повреждения группе)
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
149 attacker_coord.x = AttackerInfo.pXs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
150 attacker_coord.y = AttackerInfo.pYs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
151 attacker_coord.z = AttackerInfo.pZs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
152 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, attacker_coord) )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
153 {
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
154 for ( uint i = 0; i < 4; ++i )
0
Ritor1
parents:
diff changeset
155 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
156 if ( !(HIDWORD(pParty->pPlayers[i].pConditions[Condition_Dead]) | LODWORD(pParty->pPlayers[i].pConditions[Condition_Dead]))
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
157 && !pParty->pPlayers[i].pConditions[Condition_Pertified] && !pParty->pPlayers[i].pConditions[Condition_Eradicated] )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
158 DamagePlayerFromMonster(AttackerInfo.pIDs[attacker_id], AttackerInfo.field_450[attacker_id], &AttackerInfo.vec_4B4[attacker_id], i);
0
Ritor1
parents:
diff changeset
159 }
Ritor1
parents:
diff changeset
160 }
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
161 }
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
162 if ( (signed int)uNumActors > 0 )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
163 {//actors damage(повреждения другим участникам)
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
164 for ( int actorID = 0; (signed int)actorID < (signed int)uNumActors; ++actorID )
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
165 {
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
166 if ( pActors[actorID].CanAct() )
0
Ritor1
parents:
diff changeset
167 {
2205
db94443ea4e7 _44100D_should_alter_right_panel()
Ritor1
parents: 2166
diff changeset
168 //v30 = pActors[actorID].vPosition.y - AttackerInfo.pYs[attacker_id];
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
169 a1 = pActors[actorID].vPosition.x - AttackerInfo.pXs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
170 v31 = pActors[actorID].vPosition.z;
2205
db94443ea4e7 _44100D_should_alter_right_panel()
Ritor1
parents: 2166
diff changeset
171 v48 = pActors[actorID].vPosition.y - AttackerInfo.pYs[attacker_id];
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
172 v44 = pActors[actorID].vPosition.z;
2205
db94443ea4e7 _44100D_should_alter_right_panel()
Ritor1
parents: 2166
diff changeset
173 v32 = (pActors[actorID].uActorHeight / 2) - AttackerInfo.pZs[attacker_id];
2390
c631b1877204 area_of_effect_damage_evaluate - fixed spells radius problem
zipi
parents: 2348
diff changeset
174 v33 = pActors[actorID].uActorRadius + AttackerInfo.field_324[attacker_id];
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
175 if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) )
0
Ritor1
parents:
diff changeset
176 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
177 attacker_coord.x = AttackerInfo.pXs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
178 attacker_coord.y = AttackerInfo.pYs[attacker_id];
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
179 attacker_coord.z = AttackerInfo.pZs[attacker_id];
2205
db94443ea4e7 _44100D_should_alter_right_panel()
Ritor1
parents: 2166
diff changeset
180 if ( sub_407A1C(pActors[actorID].vPosition.x, pActors[actorID].vPosition.y, pActors[actorID].vPosition.z + 50, attacker_coord) )//что делает ф-ция?
0
Ritor1
parents:
diff changeset
181 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
182 Vec3_int_::Normalize(&a1, &v48, &v44);
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
183 AttackerInfo.vec_4B4[attacker_id].x = a1;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
184 AttackerInfo.vec_4B4[attacker_id].y = v48;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
185 AttackerInfo.vec_4B4[attacker_id].z = v44;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
186 switch ( attacker_type )
0
Ritor1
parents:
diff changeset
187 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
188 case OBJECT_Player:
2338
1e865e8690ba Moving some function declarations from unsorted subs to Actor.h and SpriteObject.h
Grumpy7
parents: 2336
diff changeset
189 Actor::DamageMonsterFromParty(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id]);
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
190 break;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
191 case OBJECT_Actor:
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
192 if ( v36 && pActors[v3].GetActorsRelation(&pActors[actorID]) )
2310
43af6c819e88 ActorDamageFromMonster moved into Actor class
Grumpy7
parents: 2309
diff changeset
193 Actor::ActorDamageFromMonster(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id], v36->field_61);
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
194 break;
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
195 case OBJECT_Item:
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
196 ItemDamageFromActor(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id]);
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
197 break;
0
Ritor1
parents:
diff changeset
198 }
Ritor1
parents:
diff changeset
199 }
Ritor1
parents:
diff changeset
200 }
Ritor1
parents:
diff changeset
201 }
Ritor1
parents:
diff changeset
202 }
Ritor1
parents:
diff changeset
203 }
Ritor1
parents:
diff changeset
204 }
Ritor1
parents:
diff changeset
205 }
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2057
diff changeset
206 AttackerInfo.count = 0;
0
Ritor1
parents:
diff changeset
207 }
Ritor1
parents:
diff changeset
208
Ritor1
parents:
diff changeset
209
Ritor1
parents:
diff changeset
210 //----- (0043A97E) --------------------------------------------------------
Ritor1
parents:
diff changeset
211 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2)
Ritor1
parents:
diff changeset
212 {
1979
92dfa0cafbe3 Fixing players not getting damaged by projectiles
Grumpy7
parents: 1974
diff changeset
213 if (PID_TYPE(a2) == OBJECT_Player)
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 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x;
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
216 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y;
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
217 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z;
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
218
0
Ritor1
parents:
diff changeset
219 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z);
2006
30c2b575d25c signed fixes
zipi
parents: 2000
diff changeset
220 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
221 }
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
222 else if (PID_TYPE(a2) == OBJECT_Actor)
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
223 {
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
224 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x;
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
225 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y;
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
226 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z;
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
227
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
228 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
229 switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid))
0
Ritor1
parents:
diff changeset
230 {
Ritor1
parents:
diff changeset
231 case OBJECT_Actor:
2310
43af6c819e88 ActorDamageFromMonster moved into Actor class
Grumpy7
parents: 2309
diff changeset
232 Actor::ActorDamageFromMonster(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61);
0
Ritor1
parents:
diff changeset
233 break;
Ritor1
parents:
diff changeset
234 case OBJECT_Player:
2338
1e865e8690ba Moving some function declarations from unsorted subs to Actor.h and SpriteObject.h
Grumpy7
parents: 2336
diff changeset
235 Actor::DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC);
0
Ritor1
parents:
diff changeset
236 break;
Ritor1
parents:
diff changeset
237 case OBJECT_Item:
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
238 ItemDamageFromActor(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC);
0
Ritor1
parents:
diff changeset
239 break;
Ritor1
parents:
diff changeset
240 }
Ritor1
parents:
diff changeset
241 }
Ritor1
parents:
diff changeset
242 }
Ritor1
parents:
diff changeset
243
Ritor1
parents:
diff changeset
244 //----- (0043AE12) --------------------------------------------------------
Ritor1
parents:
diff changeset
245 double __fastcall sub_43AE12(signed int a1)
Ritor1
parents:
diff changeset
246 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
247 //signed int v1; // ST00_4@1
0
Ritor1
parents:
diff changeset
248 signed int v2; // ecx@1
Ritor1
parents:
diff changeset
249 double v3; // st7@1
Ritor1
parents:
diff changeset
250 double result; // st7@6
Ritor1
parents:
diff changeset
251
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
252 v3 = (double)a1;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
253 for ( v2 = 0; v2 < 5; ++v2 )
0
Ritor1
parents:
diff changeset
254 {
Ritor1
parents:
diff changeset
255 if ( v3 < flt_4E4A80[v2 + 5] )
Ritor1
parents:
diff changeset
256 break;
Ritor1
parents:
diff changeset
257 }
Ritor1
parents:
diff changeset
258 if ( v2 <= 0 || v2 >= 5 )
Ritor1
parents:
diff changeset
259 {
Ritor1
parents:
diff changeset
260 if ( v2 )
Ritor1
parents:
diff changeset
261 result = flt_4E4A80[4];
Ritor1
parents:
diff changeset
262 else
Ritor1
parents:
diff changeset
263 result = flt_4E4A80[0];
Ritor1
parents:
diff changeset
264 }
Ritor1
parents:
diff changeset
265 else
1469
bba0944c9b27 minor fix
zipi
parents: 1459
diff changeset
266 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
267 return result;
Ritor1
parents:
diff changeset
268 }
Ritor1
parents:
diff changeset
269
Ritor1
parents:
diff changeset
270 //----- (0043B057) --------------------------------------------------------
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
271 void ItemDamageFromActor(unsigned int uObjID, unsigned int uActorID, Vec3_int_ *pVelocity)
0
Ritor1
parents:
diff changeset
272 {
Ritor1
parents:
diff changeset
273 int v6; // eax@4
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
274 int damage; // edi@4
0
Ritor1
parents:
diff changeset
275 int a2a; // [sp+Ch] [bp-4h]@8
Ritor1
parents:
diff changeset
276
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 296
diff changeset
277 if ( !pActors[uActorID].IsNotAlive() )
0
Ritor1
parents:
diff changeset
278 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
279 if ( PID_TYPE(uObjID) == OBJECT_Item)
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 839
diff changeset
280 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
281 if ( pSpriteObjects[PID_ID(uObjID)].spell_id )
0
Ritor1
parents:
diff changeset
282 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
283 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);
2293
b0f10ef66e00 stru319::CalcMagicalDamageToActor moved to Actor class
Grumpy7
parents: 2292
diff changeset
284 damage = pActors[uActorID].CalcMagicalDamageToActor((DAMAGE_TYPE)0, v6);
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
285 pActors[uActorID].sCurrentHP -= damage;
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
286 if ( damage )
0
Ritor1
parents:
diff changeset
287 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
288 if ( pActors[uActorID].sCurrentHP > 0 )
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
289 Actor::AI_Stun(uActorID, uObjID, 0);
0
Ritor1
parents:
diff changeset
290 else
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
291 Actor::Die(uActorID);
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
292 a2a = 20 * damage / (signed int)pActors[uActorID].pMonsterInfo.uHP;
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
293 if ( 20 * damage / (signed int)pActors[uActorID].pMonsterInfo.uHP > 10 )
0
Ritor1
parents:
diff changeset
294 a2a = 10;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
295 if ( !MonsterStats::BelongsToSupertype(pActors[uActorID].pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) )
0
Ritor1
parents:
diff changeset
296 {
2207
ff8920a40c21 fixpoint_mul
Ritor1
parents: 2205
diff changeset
297 pVelocity->x = fixpoint_mul(a2a, pVelocity->x);
ff8920a40c21 fixpoint_mul
Ritor1
parents: 2205
diff changeset
298 pVelocity->y = fixpoint_mul(a2a, pVelocity->y);
ff8920a40c21 fixpoint_mul
Ritor1
parents: 2205
diff changeset
299 pVelocity->z = fixpoint_mul(a2a, pVelocity->z);
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
300 pActors[uActorID].vVelocity.x = 50 * LOWORD(pVelocity->x);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
301 pActors[uActorID].vVelocity.y = 50 * LOWORD(pVelocity->y);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
302 pActors[uActorID].vVelocity.z = 50 * LOWORD(pVelocity->z);
0
Ritor1
parents:
diff changeset
303 }
2132
49de109bbab5 SavePCXScreenshot() continue
Ritor1
parents: 2120
diff changeset
304 Actor::AddBloodsplatOnDamageOverlay(uActorID, 1, damage);
0
Ritor1
parents:
diff changeset
305 }
Ritor1
parents:
diff changeset
306 else
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2114
diff changeset
307 Actor::AI_Stun(uActorID, uObjID, 0);
0
Ritor1
parents:
diff changeset
308 }
Ritor1
parents:
diff changeset
309 }
Ritor1
parents:
diff changeset
310 }
Ritor1
parents:
diff changeset
311 }
Ritor1
parents:
diff changeset
312
Ritor1
parents:
diff changeset
313
Ritor1
parents:
diff changeset
314 //----- (0043F515) --------------------------------------------------------
657
7747161ea5b5 RenderBillboard member rename
Nomad
parents: 651
diff changeset
315 void FindBillboardsLightLevels_BLV()
0
Ritor1
parents:
diff changeset
316 {
Ritor1
parents:
diff changeset
317 for (uint i = 0; i < uNumBillboardsToDraw; ++i)
Ritor1
parents:
diff changeset
318 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
319 if (pBillboardRenderList[i].field_1E & 2 || uCurrentlyLoadedLevelType == LEVEL_Indoor && !pBillboardRenderList[i].uIndoorSectorID)
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
320 pBillboardRenderList[i].dimming_level = 0;
0
Ritor1
parents:
diff changeset
321 else
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
322 pBillboardRenderList[i].dimming_level = _43F55F_get_billboard_light_level(&pBillboardRenderList[i], -1);
0
Ritor1
parents:
diff changeset
323 }
Ritor1
parents:
diff changeset
324 }
Ritor1
parents:
diff changeset
325
Ritor1
parents:
diff changeset
326 //----- (0043F55F) --------------------------------------------------------
Ritor1
parents:
diff changeset
327 int __fastcall _43F55F_get_billboard_light_level(RenderBillboard *a1, int uBaseLightLevel)
Ritor1
parents:
diff changeset
328 {
Ritor1
parents:
diff changeset
329 signed int v3; // ecx@2
Ritor1
parents:
diff changeset
330
Ritor1
parents:
diff changeset
331 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
332 v3 = pIndoor->pSectors[a1->uIndoorSectorID].uMinAmbientLightLevel;
Ritor1
parents:
diff changeset
333 else
Ritor1
parents:
diff changeset
334 {
Ritor1
parents:
diff changeset
335 if ( uBaseLightLevel == -1 )
657
7747161ea5b5 RenderBillboard member rename
Nomad
parents: 651
diff changeset
336 v3 = a1->dimming_level;
0
Ritor1
parents:
diff changeset
337 else
Ritor1
parents:
diff changeset
338 v3 = uBaseLightLevel;
Ritor1
parents:
diff changeset
339 }
430
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 417
diff changeset
340 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
341 }
Ritor1
parents:
diff changeset
342
Ritor1
parents:
diff changeset
343 //----- (0043F5C8) --------------------------------------------------------
Ritor1
parents:
diff changeset
344 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
345 {
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
346 // int v5; // esi@1
0
Ritor1
parents:
diff changeset
347 signed int v6; // edi@1
Ritor1
parents:
diff changeset
348 int v8; // eax@6
Ritor1
parents:
diff changeset
349 int v9; // ebx@6
Ritor1
parents:
diff changeset
350 unsigned int v10; // ecx@6
Ritor1
parents:
diff changeset
351 unsigned int v11; // edx@9
Ritor1
parents:
diff changeset
352 unsigned int v12; // edx@11
Ritor1
parents:
diff changeset
353 signed int v13; // ecx@12
Ritor1
parents:
diff changeset
354 BLVLightMM7 *v16; // esi@20
Ritor1
parents:
diff changeset
355 int v17; // ebx@21
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
356 // int v18; // eax@24
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
357 // int v19; // ebx@24
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
358 // unsigned int v20; // ecx@24
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
359 // int v21; // edx@25
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
360 // unsigned int v22; // edx@27
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
361 // unsigned int v23; // edx@29
0
Ritor1
parents:
diff changeset
362 signed int v24; // ecx@30
Ritor1
parents:
diff changeset
363 int v26; // ebx@35
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
364 // int v27; // eax@38
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
365 // int v28; // ebx@38
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
366 // unsigned int v29; // ecx@38
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
367 // int v30; // edx@39
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
368 // unsigned int v31; // edx@41
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
369 // unsigned int v32; // edx@43
2251
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
370 //signed int v33; // ecx@44
0
Ritor1
parents:
diff changeset
371 int v37; // [sp+Ch] [bp-18h]@37
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
372 // int v38; // [sp+10h] [bp-14h]@5
0
Ritor1
parents:
diff changeset
373 int v39; // [sp+10h] [bp-14h]@23
Ritor1
parents:
diff changeset
374 int v40; // [sp+10h] [bp-14h]@36
Ritor1
parents:
diff changeset
375 int v42; // [sp+14h] [bp-10h]@22
Ritor1
parents:
diff changeset
376 unsigned int v43; // [sp+18h] [bp-Ch]@12
Ritor1
parents:
diff changeset
377 unsigned int v44; // [sp+18h] [bp-Ch]@30
Ritor1
parents:
diff changeset
378 unsigned int v45; // [sp+18h] [bp-Ch]@44
Ritor1
parents:
diff changeset
379
Ritor1
parents:
diff changeset
380 v6 = uBaseLightLevel;
Ritor1
parents:
diff changeset
381 for (uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i)
Ritor1
parents:
diff changeset
382 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1979
diff changeset
383 MobileLight* p = &pMobileLightsStack->pLights[i];
0
Ritor1
parents:
diff changeset
384
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1979
diff changeset
385 float distX = abs(p->vPosition.x - x);
0
Ritor1
parents:
diff changeset
386 if ( distX <= p->uRadius)
Ritor1
parents:
diff changeset
387 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1979
diff changeset
388 float distY = abs(p->vPosition.y - y);
0
Ritor1
parents:
diff changeset
389 if ( distY <= p->uRadius)
Ritor1
parents:
diff changeset
390 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1979
diff changeset
391 float distZ = abs(p->vPosition.z - z);
0
Ritor1
parents:
diff changeset
392 if ( distZ <= p->uRadius)
Ritor1
parents:
diff changeset
393 {
Ritor1
parents:
diff changeset
394 v8 = distX;
Ritor1
parents:
diff changeset
395 v9 = distY;
Ritor1
parents:
diff changeset
396 v10 = distZ;
Ritor1
parents:
diff changeset
397 if (distX < distY)
Ritor1
parents:
diff changeset
398 {
Ritor1
parents:
diff changeset
399 v8 = distY;
Ritor1
parents:
diff changeset
400 v9 = distX;
Ritor1
parents:
diff changeset
401 }
Ritor1
parents:
diff changeset
402 if ( v8 < distZ )
Ritor1
parents:
diff changeset
403 {
Ritor1
parents:
diff changeset
404 v11 = v8;
Ritor1
parents:
diff changeset
405 v8 = distZ;
Ritor1
parents:
diff changeset
406 v10 = v11;
Ritor1
parents:
diff changeset
407 }
Ritor1
parents:
diff changeset
408 if ( v9 < (signed int)v10 )
Ritor1
parents:
diff changeset
409 {
Ritor1
parents:
diff changeset
410 v12 = v10;
Ritor1
parents:
diff changeset
411 v10 = v9;
Ritor1
parents:
diff changeset
412 v9 = v12;
Ritor1
parents:
diff changeset
413 }
Ritor1
parents:
diff changeset
414 v43 = ((unsigned int)(11 * v9) / 32) + (v10 / 4) + v8;
Ritor1
parents:
diff changeset
415 v13 = p->uRadius;
Ritor1
parents:
diff changeset
416 if ( (signed int)v43 < v13 )
Ritor1
parents:
diff changeset
417 v6 += ((unsigned __int64)(30i64 * (signed int)(v43 << 16) / v13) >> 16) - 30;
Ritor1
parents:
diff changeset
418 }
Ritor1
parents:
diff changeset
419 }
Ritor1
parents:
diff changeset
420 }
Ritor1
parents:
diff changeset
421 }
Ritor1
parents:
diff changeset
422
Ritor1
parents:
diff changeset
423 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
Ritor1
parents:
diff changeset
424 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1979
diff changeset
425 BLVSector* pSector = &pIndoor->pSectors[uSectorID];
0
Ritor1
parents:
diff changeset
426
Ritor1
parents:
diff changeset
427 for (uint i = 0; i < pSector->uNumLights; ++i)
Ritor1
parents:
diff changeset
428 {
Ritor1
parents:
diff changeset
429 v16 = pIndoor->pLights + pSector->pLights[i];
Ritor1
parents:
diff changeset
430 if (~v16->uAtributes & 8)
Ritor1
parents:
diff changeset
431 {
Ritor1
parents:
diff changeset
432 v17 = abs(v16->vPosition.x - x);
Ritor1
parents:
diff changeset
433 if ( v17 <= v16->uRadius )
Ritor1
parents:
diff changeset
434 {
Ritor1
parents:
diff changeset
435 v42 = abs(v16->vPosition.y - y);
Ritor1
parents:
diff changeset
436 if ( v42 <= v16->uRadius )
Ritor1
parents:
diff changeset
437 {
Ritor1
parents:
diff changeset
438 v39 = abs(v16->vPosition.z - z);
Ritor1
parents:
diff changeset
439 if ( v39 <= v16->uRadius )
Ritor1
parents:
diff changeset
440 {
2235
6ab7d7c112bb adding int_get_vector_length calls where the calls were inlined
Grumpy7
parents: 2216
diff changeset
441 v44 = int_get_vector_length(v17, v42, v39);
0
Ritor1
parents:
diff changeset
442 v24 = v16->uRadius;
Ritor1
parents:
diff changeset
443 if ( (signed int)v44 < v24 )
Ritor1
parents:
diff changeset
444 v6 += ((unsigned __int64)(30i64 * (signed int)(v44 << 16) / v24) >> 16) - 30;
Ritor1
parents:
diff changeset
445 }
Ritor1
parents:
diff changeset
446 }
Ritor1
parents:
diff changeset
447 }
Ritor1
parents:
diff changeset
448 }
Ritor1
parents:
diff changeset
449 }
Ritor1
parents:
diff changeset
450 }
Ritor1
parents:
diff changeset
451
Ritor1
parents:
diff changeset
452 for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i)
Ritor1
parents:
diff changeset
453 {
2251
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
454 //StationaryLight* p = &pStationaryLightsStack->pLights[i];
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
455 v26 = abs(pStationaryLightsStack->pLights[i].vPosition.x - x);
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
456 if ( v26 <= pStationaryLightsStack->pLights[i].uRadius)
0
Ritor1
parents:
diff changeset
457 {
2251
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
458 v40 = abs(pStationaryLightsStack->pLights[i].vPosition.y - y);
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
459 if ( v40 <= pStationaryLightsStack->pLights[i].uRadius)
0
Ritor1
parents:
diff changeset
460 {
2251
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
461 v37 = abs(pStationaryLightsStack->pLights[i].vPosition.z - z);
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
462 if ( v37 <= pStationaryLightsStack->pLights[i].uRadius)
0
Ritor1
parents:
diff changeset
463 {
2235
6ab7d7c112bb adding int_get_vector_length calls where the calls were inlined
Grumpy7
parents: 2216
diff changeset
464 v45 = int_get_vector_length(v26, v40, v37);
2251
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
465 //v33 = pStationaryLightsStack->pLights[i].uRadius;
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
466 if ( (signed int)v45 < pStationaryLightsStack->pLights[i].uRadius )
47bcb700b74b for StackLight_TerrainFace
Ritor1
parents: 2245
diff changeset
467 v6 += ((unsigned __int64)(30i64 * (signed int)(v45 << 16) / pStationaryLightsStack->pLights[i].uRadius) >> 16) - 30;
0
Ritor1
parents:
diff changeset
468 }
Ritor1
parents:
diff changeset
469 }
Ritor1
parents:
diff changeset
470 }
Ritor1
parents:
diff changeset
471 }
Ritor1
parents:
diff changeset
472
Ritor1
parents:
diff changeset
473 if ( v6 <= 31 )
Ritor1
parents:
diff changeset
474 {
Ritor1
parents:
diff changeset
475 if ( v6 < 0 )
Ritor1
parents:
diff changeset
476 v6 = 0;
Ritor1
parents:
diff changeset
477 }
Ritor1
parents:
diff changeset
478 else
Ritor1
parents:
diff changeset
479 v6 = 31;
Ritor1
parents:
diff changeset
480 return v6;
Ritor1
parents:
diff changeset
481 }
Ritor1
parents:
diff changeset
482
Ritor1
parents:
diff changeset
483
Ritor1
parents:
diff changeset
484
Ritor1
parents:
diff changeset
485 //----- (004075DB) --------------------------------------------------------
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
486 bool __fastcall sub_4075DB(int x, int y, int z, BLVFace *face)
0
Ritor1
parents:
diff changeset
487 {
Ritor1
parents:
diff changeset
488 int v8; // edi@2
Ritor1
parents:
diff changeset
489 signed int v25; // eax@22
Ritor1
parents:
diff changeset
490 bool result; // eax@25
Ritor1
parents:
diff changeset
491 signed int a3a; // [sp+24h] [bp+8h]@14
Ritor1
parents:
diff changeset
492 int a4a; // [sp+28h] [bp+Ch]@2
Ritor1
parents:
diff changeset
493
2000
985fff9fb62d constructor functions
zipi
parents: 1980
diff changeset
494 std::array<int, 52> dword_4F5CC8_ys; // idb
985fff9fb62d constructor functions
zipi
parents: 1980
diff changeset
495 std::array<int, 52> dword_4F5D98_xs; // idb
985fff9fb62d constructor functions
zipi
parents: 1980
diff changeset
496
1493
9e9a12506d51 player detection partly working
zipi
parents: 1477
diff changeset
497 //__debugbreak();
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1455
diff changeset
498
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
499 if ( face->uAttributes & FACE_XY_PLANE )
0
Ritor1
parents:
diff changeset
500 {
1616
de6e646822a6 mul <> sub0 difference
zipi
parents: 1615
diff changeset
501 a4a = x;
de6e646822a6 mul <> sub0 difference
zipi
parents: 1615
diff changeset
502 v8 = y;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
503 for(int i = 0; i < face->uNumVertices; i++)
1471
736973e11d11 sub_4075DB cleaned
zipi
parents: 1469
diff changeset
504 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
505 dword_4F5D98_xs[i] = pIndoor->pVertices[face->pVertexIDs[i]].x;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
506 dword_4F5CC8_ys[i] = pIndoor->pVertices[face->pVertexIDs[i]].y;
1471
736973e11d11 sub_4075DB cleaned
zipi
parents: 1469
diff changeset
507 }
0
Ritor1
parents:
diff changeset
508 }
Ritor1
parents:
diff changeset
509 else
Ritor1
parents:
diff changeset
510 {
1616
de6e646822a6 mul <> sub0 difference
zipi
parents: 1615
diff changeset
511 v8 = z;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
512 if ( face->uAttributes & FACE_XZ_PLANE )
0
Ritor1
parents:
diff changeset
513 {
1616
de6e646822a6 mul <> sub0 difference
zipi
parents: 1615
diff changeset
514 a4a = x;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
515 for(int i = 0; i < face->uNumVertices; i++)
1471
736973e11d11 sub_4075DB cleaned
zipi
parents: 1469
diff changeset
516 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
517 dword_4F5D98_xs[i] = pIndoor->pVertices[face->pVertexIDs[i]].x;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
518 dword_4F5CC8_ys[i] = pIndoor->pVertices[face->pVertexIDs[i]].z;
1471
736973e11d11 sub_4075DB cleaned
zipi
parents: 1469
diff changeset
519 }
0
Ritor1
parents:
diff changeset
520 }
Ritor1
parents:
diff changeset
521 else
Ritor1
parents:
diff changeset
522 {
1616
de6e646822a6 mul <> sub0 difference
zipi
parents: 1615
diff changeset
523 a4a = y;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
524 for(int i = 0; i < face->uNumVertices; i++)
1471
736973e11d11 sub_4075DB cleaned
zipi
parents: 1469
diff changeset
525 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
526 dword_4F5D98_xs[i] = pIndoor->pVertices[face->pVertexIDs[i]].y;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
527 dword_4F5CC8_ys[i] = pIndoor->pVertices[face->pVertexIDs[i]].z;
1471
736973e11d11 sub_4075DB cleaned
zipi
parents: 1469
diff changeset
528 }
0
Ritor1
parents:
diff changeset
529 }
Ritor1
parents:
diff changeset
530 }
Ritor1
parents:
diff changeset
531 a3a = 0;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
532 dword_4F5D98_xs[face->uNumVertices] = dword_4F5D98_xs[0];
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
533 dword_4F5CC8_ys[face->uNumVertices] = dword_4F5CC8_ys[0];
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
534 for(int i = 0; i < face->uNumVertices && a3a < 2; i++)
0
Ritor1
parents:
diff changeset
535 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
536 if ( dword_4F5CC8_ys[i] >= v8 ^ (dword_4F5CC8_ys[i + 1] >= v8) )
0
Ritor1
parents:
diff changeset
537 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
538 //if( dword_4F5D98_xs[i + 1] >= a4a || dword_4F5D98_xs[i] >= a4a)
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
539 if( !(dword_4F5D98_xs[i + 1] >= a4a && dword_4F5D98_xs[i] < a4a))
0
Ritor1
parents:
diff changeset
540 {
1615
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
541 if ( (dword_4F5D98_xs[i + 1] < a4a && dword_4F5D98_xs[i] >= a4a) )
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
542 ++a3a;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
543 //|| (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
544 //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
545 // + 32768) >> 16) >= a4a) )
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
546 else
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
547 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1637
diff changeset
548 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
549 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
550 ++a3a;
89dec2be255f AI visibility issue temporarily fixed
zipi
parents: 1614
diff changeset
551 }
0
Ritor1
parents:
diff changeset
552 }
Ritor1
parents:
diff changeset
553 }
Ritor1
parents:
diff changeset
554 }
Ritor1
parents:
diff changeset
555 result = 1;
Ritor1
parents:
diff changeset
556 if ( a3a != 1 )
Ritor1
parents:
diff changeset
557 result = 0;
Ritor1
parents:
diff changeset
558 return result;
Ritor1
parents:
diff changeset
559 }
Ritor1
parents:
diff changeset
560
Ritor1
parents:
diff changeset
561 //----- (004077F1) --------------------------------------------------------
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
562 bool __fastcall sub_4077F1(int a1, int a2, int a3, ODMFace *face, BSPVertexBuffer *a5)
0
Ritor1
parents:
diff changeset
563 {
Ritor1
parents:
diff changeset
564 int a4a; // [sp+28h] [bp+Ch]@2
Ritor1
parents:
diff changeset
565 signed int a5a; // [sp+2Ch] [bp+10h]@14
Ritor1
parents:
diff changeset
566
2000
985fff9fb62d constructor functions
zipi
parents: 1980
diff changeset
567 std::array<int, 52> dword_4F5B24_ys; // idb
985fff9fb62d constructor functions
zipi
parents: 1980
diff changeset
568 std::array<int, 52> dword_4F5BF4_xs; // idb
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
569
2057
b7485a6502f2 AgressorAtackInfo
Ritor1
parents: 2044
diff changeset
570 //__debugbreak(); //срабатывает при нападении стрекозавров с огнём
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1455
diff changeset
571
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
572 if ( face->uAttributes & FACE_XY_PLANE )
0
Ritor1
parents:
diff changeset
573 {
Ritor1
parents:
diff changeset
574 a4a = a1;
Ritor1
parents:
diff changeset
575 a3 = a2;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
576 for(int i = 0; i < face->uNumVertices; i++)
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
577 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
578 dword_4F5BF4_xs[i+1] = a5->pVertices[face->pVertexIDs[i]].x;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
579 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
580 }
0
Ritor1
parents:
diff changeset
581 }
Ritor1
parents:
diff changeset
582 else
Ritor1
parents:
diff changeset
583 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
584 if ( face->uAttributes & FACE_XY_PLANE )
0
Ritor1
parents:
diff changeset
585 {
Ritor1
parents:
diff changeset
586 a4a = a1;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
587 for(int i = 0; i < face->uNumVertices; i++)
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
588 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
589 dword_4F5BF4_xs[i+1] = a5->pVertices[face->pVertexIDs[i]].x;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
590 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
591 }
0
Ritor1
parents:
diff changeset
592 }
Ritor1
parents:
diff changeset
593 else
Ritor1
parents:
diff changeset
594 {
Ritor1
parents:
diff changeset
595 a4a = a2;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
596 for(int i = 0; i < face->uNumVertices; i++)
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
597 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
598 dword_4F5BF4_xs[i+1] = a5->pVertices[face->pVertexIDs[i]].y;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
599 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
600 }
0
Ritor1
parents:
diff changeset
601 }
Ritor1
parents:
diff changeset
602 }
Ritor1
parents:
diff changeset
603 a5a = 0;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
604 dword_4F5BF4_xs[face->uNumVertices + 1] = dword_4F5BF4_xs[1];
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
605 dword_4F5B24_ys[face->uNumVertices + 1] = dword_4F5B24_ys[1];
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
606 for(int i = 0; i < face->uNumVertices; i++)
0
Ritor1
parents:
diff changeset
607 {
Ritor1
parents:
diff changeset
608 if ( a5a >= 2 )
Ritor1
parents:
diff changeset
609 break;
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
610 if ( dword_4F5B24_ys[i + 1] >= a3 ^ (dword_4F5B24_ys[i + 2] >= a3) )
0
Ritor1
parents:
diff changeset
611 {
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
612 if( dword_4F5BF4_xs[i + 2] >= a4a || dword_4F5BF4_xs[i] >= a4a)
0
Ritor1
parents:
diff changeset
613 {
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
614 if (dword_4F5BF4_xs[i + 2] >= a4a && dword_4F5BF4_xs[i + 1] >= a4a)
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
615 ++a5a;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
616 else
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
617 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
618 //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
619 __int64 _a = dword_4F5B24_ys[i + 2] - dword_4F5B24_ys[i + 1];
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
620 __int64 _b = (__int64)(a3 - dword_4F5B24_ys[i + 1]) << 16;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
621
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
622 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
623 ++a5a;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
624 }
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
625 }
0
Ritor1
parents:
diff changeset
626 }
Ritor1
parents:
diff changeset
627 }
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
628
0
Ritor1
parents:
diff changeset
629 if ( a5a != 1 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
630 return false;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1520
diff changeset
631 return true;
1472
2395e99b89d0 sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents: 1471
diff changeset
632
0
Ritor1
parents:
diff changeset
633 }
Ritor1
parents:
diff changeset
634
Ritor1
parents:
diff changeset
635
Ritor1
parents:
diff changeset
636 //----- (0040F82D) --------------------------------------------------------
Ritor1
parents:
diff changeset
637 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue)
Ritor1
parents:
diff changeset
638 {
973
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
639 assert(uTextureId != -1);
ec7568e13b24 Minor code cleaning.
Nomad
parents: 972
diff changeset
640 ZBuffer_DoFill(pZBuffer, pIcons_LOD->GetTexture(uTextureId), iZValue);
0
Ritor1
parents:
diff changeset
641 }
Ritor1
parents:
diff changeset
642
Ritor1
parents:
diff changeset
643 //----- (0040F89C) --------------------------------------------------------
Ritor1
parents:
diff changeset
644 void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue)
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
645 {//срабатывает при продаже в магазине
0
Ritor1
parents:
diff changeset
646 void *v3; // eax@3
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
647 //void *v4; // esi@5
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
648 //int *v5; // edi@5
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
649 //int v6; // eax@5
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
650 // int v7; // ecx@6
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
651 // int v11; // [sp+18h] [bp-8h]@1
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
652 //void *v12; // [sp+1Ch] [bp-4h]@5
0
Ritor1
parents:
diff changeset
653
Ritor1
parents:
diff changeset
654 if ( pIcons_LOD->dword_011BA4 && pTex->uDecompressedSize )
Ritor1
parents:
diff changeset
655 v3 = pTex->UnzipPalette();
Ritor1
parents:
diff changeset
656 else
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 709
diff changeset
657 v3 = pTex->pLevelOfDetail0_prolly_alpha_mask;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
658 //v12 = v3;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
659 //v4 = v3;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
660 //v5 = pZBuffer;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
661 //v6 = 0;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
662 for ( uint i = 0; i < pTex->uTextureHeight; i++ )
0
Ritor1
parents:
diff changeset
663 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
664 for ( uint j = 0; j < pTex->uTextureWidth; j++ )
0
Ritor1
parents:
diff changeset
665 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
666 //LOBYTE(v6) = *(char *)v4;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
667 //v4 = (char *)v4 + 1;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
668 //if ( v6 )
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
669 *pZBuffer = uZValue;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
670 ++pZBuffer;
0
Ritor1
parents:
diff changeset
671 }
2215
e9625ad08541 fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents: 2207
diff changeset
672 pZBuffer += window->GetWidth() - pTex->uTextureWidth;
0
Ritor1
parents:
diff changeset
673 }
Ritor1
parents:
diff changeset
674 if ( pIcons_LOD->dword_011BA4 )
Ritor1
parents:
diff changeset
675 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
676 if ( pTex->uDecompressedSize )
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
677 free(v3);
0
Ritor1
parents:
diff changeset
678 }
Ritor1
parents:
diff changeset
679 }
Ritor1
parents:
diff changeset
680
Ritor1
parents:
diff changeset
681 //----- (0040F92A) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1455
diff changeset
682 void __fastcall ZBuffer_DoFill2(int *pZBuffer, Texture *a2, int a3)
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
683 {//срабатывает в покупке в магазине
0
Ritor1
parents:
diff changeset
684 void *v4; // eax@3
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
685 //int *v5; // edi@5
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
686 // int v6; // ecx@6
ddb803517a48 unused local variables I commented
Ritor1
parents: 2310
diff changeset
687 // int v9; // [sp+18h] [bp-4h]@1
0
Ritor1
parents:
diff changeset
688
Ritor1
parents:
diff changeset
689 if ( pIcons_LOD->dword_011BA4 && a2->uDecompressedSize )
Ritor1
parents:
diff changeset
690 v4 = a2->UnzipPalette();
Ritor1
parents:
diff changeset
691 else
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 709
diff changeset
692 v4 = a2->pLevelOfDetail0_prolly_alpha_mask;
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
693 //v5 = pZBuffer;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
694 for ( uint i = 0; i < a2->uTextureHeight; i++ )
0
Ritor1
parents:
diff changeset
695 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
696 for ( uint j = 0; j < a2->uTextureWidth; j++ )
0
Ritor1
parents:
diff changeset
697 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
698 *pZBuffer = a3;
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
699 ++pZBuffer;
0
Ritor1
parents:
diff changeset
700 }
2215
e9625ad08541 fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents: 2207
diff changeset
701 pZBuffer += window->GetWidth() - a2->uTextureWidth;
0
Ritor1
parents:
diff changeset
702 }
Ritor1
parents:
diff changeset
703 if ( pIcons_LOD->dword_011BA4 )
Ritor1
parents:
diff changeset
704 {
2114
68fbaf45ef66 _42FB5C_check_spell cleaned
Ritor1
parents: 2069
diff changeset
705 if ( a2->uDecompressedSize )
0
Ritor1
parents:
diff changeset
706 free(v4);
Ritor1
parents:
diff changeset
707 }
Ritor1
parents:
diff changeset
708 }
Ritor1
parents:
diff changeset
709
Ritor1
parents:
diff changeset
710
Ritor1
parents:
diff changeset
711 // 4E28F8: using guessed type int pCurrentScreen;
Ritor1
parents:
diff changeset
712
Ritor1
parents:
diff changeset
713 //----- (00417AD4) --------------------------------------------------------
983
1462a5f12b65 Character Skills tab drawing fixed.
Nomad
parents: 982
diff changeset
714 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
715 {
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
716 switch (uPlayerClass % 4)
269
b34b53ee874d skill_learn_ability_by_class_table[36][37]
Ritor1
parents: 264
diff changeset
717 {
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
718 case 0:
269
b34b53ee874d skill_learn_ability_by_class_table[36][37]
Ritor1
parents: 264
diff changeset
719 {
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
720 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
721 return ui_character_skillinfo_can_learn;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
722 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
723 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
724 {
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
725 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
726 return ui_character_skillinfo_cant_learn;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
727 }
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
728 return ui_character_skillinfo_can_learn_gm;
0
Ritor1
parents:
diff changeset
729 }
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
730 break;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
731
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
732 case 1:
269
b34b53ee874d skill_learn_ability_by_class_table[36][37]
Ritor1
parents: 264
diff changeset
733 {
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
734 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
735 return ui_character_skillinfo_can_learn;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
736 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
737 {
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
738 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
739 return ui_character_skillinfo_cant_learn;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
740 }
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
741 return ui_character_skillinfo_can_learn_gm;
0
Ritor1
parents:
diff changeset
742 }
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
743 break;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
744
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
745 case 2:
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
746 case 3:
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
747 {
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
748 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
749 return ui_character_skillinfo_cant_learn;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
750 return ui_character_skillinfo_can_learn;
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
751 }
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1391
diff changeset
752 break;
0
Ritor1
parents:
diff changeset
753 }
1575
43d3536a20f7 OnInventoryItemRightClick
Nomad
parents: 1546
diff changeset
754 Error("Invalid player class: %u", uPlayerClass);
1296
c423f946dc99 moving files continue
Ritor1
parents: 1273
diff changeset
755 }