annotate mm7_3.cpp @ 2138:7cc14d9d966d

1
author Ritor1
date Thu, 02 Jan 2014 09:11:01 +0600
parents 87be06553c76
children f9b55be70c1b
rev   line source
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
1 #ifdef _MSC_VER
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
2 #define _CRT_SECURE_NO_WARNINGS
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
3 #endif
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
4
1323
bfde0563ecdc removed weather.h from indoor.h
Grumpy7
parents: 1306
diff changeset
5 #include "Weather.h"
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
6 #include "Texture.h"
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
7 #include "mm7_data.h"
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
8 #include "Sprites.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
9 #include "BSPModel.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
10 #include "LightmapBuilder.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
11 #include "DecalBuilder.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
12 #include "ParticleEngine.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
13 #include "Mouse.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
14 #include "Keyboard.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 999
diff changeset
15 #include "stru6.h"
1263
73269755dd89 arcomage renaming&cleaning
Gloval
parents: 1254
diff changeset
16 #include "FactionTable.h"
0
Ritor1
parents:
diff changeset
17 #include "MapInfo.h"
Ritor1
parents:
diff changeset
18 #include "Game.h"
Ritor1
parents:
diff changeset
19 #include "GUIWindow.h"
Ritor1
parents:
diff changeset
20 #include "GUIFont.h"
Ritor1
parents:
diff changeset
21 #include "GUIProgressBar.h"
Ritor1
parents:
diff changeset
22 #include "Party.h"
Ritor1
parents:
diff changeset
23 #include "AudioPlayer.h"
Ritor1
parents:
diff changeset
24 #include "Outdoor.h"
1277
1803172dffd9 header stuff
Grumpy7
parents: 1264
diff changeset
25 #include "Outdoor_stuff.h"
0
Ritor1
parents:
diff changeset
26 #include "Overlays.h"
Ritor1
parents:
diff changeset
27 #include "LOD.h"
Ritor1
parents:
diff changeset
28 #include "Actor.h"
Ritor1
parents:
diff changeset
29 #include "Events.h"
Ritor1
parents:
diff changeset
30 #include "Viewport.h"
2037
7a9477135943 Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents: 2030
diff changeset
31 #include "OurMath.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
32 #include "SpriteObject.h"
0
Ritor1
parents:
diff changeset
33 #include "ObjectList.h"
Ritor1
parents:
diff changeset
34 #include "PaletteManager.h"
Ritor1
parents:
diff changeset
35 #include "DecorationList.h"
Ritor1
parents:
diff changeset
36 #include "stru123.h"
2044
28cb79ae2f6f Time.h rename
Ritor1
parents: 2043
diff changeset
37 #include "Timer.h"
0
Ritor1
parents:
diff changeset
38 #include "IconFrameTable.h"
Ritor1
parents:
diff changeset
39 #include "TurnEngine.h"
Ritor1
parents:
diff changeset
40 #include "Events2D.h"
Ritor1
parents:
diff changeset
41 #include "stru176.h"
Ritor1
parents:
diff changeset
42 #include "stru298.h"
189
038a4d09406f new texts file, fix text rendender error
Gloval
parents: 185
diff changeset
43 #include "texts.h"
0
Ritor1
parents:
diff changeset
44 #include "Log.h"
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
45 #include "Lights.h"
1828
35c1e4ff6ba7 party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents: 1813
diff changeset
46 #include "Level/Decoration.h"
828
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
47
0f56abdcce94 Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents: 824
diff changeset
48 #include "MM7.h"
0
Ritor1
parents:
diff changeset
49
Ritor1
parents:
diff changeset
50 //----- (0046E44E) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1445
diff changeset
51 int _46E44E_collide_against_faces_and_portals(unsigned int b1)
0
Ritor1
parents:
diff changeset
52 {
717
Ritor1
parents: 688
diff changeset
53 BLVSector *pSector; // edi@1
0
Ritor1
parents:
diff changeset
54 signed int v2; // ebx@1
717
Ritor1
parents: 688
diff changeset
55 BLVFace *pFace; // esi@2
Ritor1
parents: 688
diff changeset
56 __int16 pNextSector; // si@10
Ritor1
parents: 688
diff changeset
57 int pArrayNum; // ecx@12
0
Ritor1
parents:
diff changeset
58 unsigned __int8 v6; // sf@12
Ritor1
parents:
diff changeset
59 unsigned __int8 v7; // of@12
Ritor1
parents:
diff changeset
60 int result; // eax@14
2138
Ritor1
parents: 2065
diff changeset
61 //int v10; // ecx@15
717
Ritor1
parents: 688
diff changeset
62 int pFloor; // eax@16
0
Ritor1
parents:
diff changeset
63 int v15; // eax@24
Ritor1
parents:
diff changeset
64 int v16; // edx@25
Ritor1
parents:
diff changeset
65 int v17; // eax@29
Ritor1
parents:
diff changeset
66 unsigned int v18; // eax@33
Ritor1
parents:
diff changeset
67 int v21; // eax@35
Ritor1
parents:
diff changeset
68 int v22; // ecx@36
Ritor1
parents:
diff changeset
69 int v23; // eax@40
Ritor1
parents:
diff changeset
70 unsigned int v24; // eax@44
Ritor1
parents:
diff changeset
71 int a3; // [sp+10h] [bp-48h]@28
Ritor1
parents:
diff changeset
72 int v26; // [sp+14h] [bp-44h]@15
Ritor1
parents:
diff changeset
73 int i; // [sp+18h] [bp-40h]@1
Ritor1
parents:
diff changeset
74 int a10; // [sp+1Ch] [bp-3Ch]@1
Ritor1
parents:
diff changeset
75 int v29; // [sp+20h] [bp-38h]@14
Ritor1
parents:
diff changeset
76 int v32; // [sp+2Ch] [bp-2Ch]@15
717
Ritor1
parents: 688
diff changeset
77 int pSectorsArray[10]; // [sp+30h] [bp-28h]@1
Ritor1
parents: 688
diff changeset
78
Ritor1
parents: 688
diff changeset
79 pSector = &pIndoor->pSectors[stru_721530.uSectorID];
2138
Ritor1
parents: 2065
diff changeset
80 i = 1;
0
Ritor1
parents:
diff changeset
81 a10 = b1;
717
Ritor1
parents: 688
diff changeset
82 pSectorsArray[0] = stru_721530.uSectorID;
2138
Ritor1
parents: 2065
diff changeset
83 for ( v2 = 0; v2 < pSector->uNumPortals; ++v2 )
717
Ritor1
parents: 688
diff changeset
84 {
Ritor1
parents: 688
diff changeset
85 pFace = &pIndoor->pFaces[pSector->pPortals[v2]];
2138
Ritor1
parents: 2065
diff changeset
86 if ( stru_721530.sMaxX <= pFace->pBounding.x2 && stru_721530.sMinX >= pFace->pBounding.x1
Ritor1
parents: 2065
diff changeset
87 && stru_721530.sMaxY <= pFace->pBounding.y2 && stru_721530.sMinY >= pFace->pBounding.y1
Ritor1
parents: 2065
diff changeset
88 && stru_721530.sMaxZ <= pFace->pBounding.z2 && stru_721530.sMinZ >= pFace->pBounding.z1
717
Ritor1
parents: 688
diff changeset
89 && abs((pFace->pFacePlane_old.dist
Ritor1
parents: 688
diff changeset
90 + stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x
Ritor1
parents: 688
diff changeset
91 + stru_721530.normal.y * pFace->pFacePlane_old.vNormal.y
Ritor1
parents: 688
diff changeset
92 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 )
Ritor1
parents: 688
diff changeset
93 {
Ritor1
parents: 688
diff changeset
94 pNextSector = pFace->uSectorID == stru_721530.uSectorID ? pFace->uBackSectorID : pFace->uSectorID;//FrontSectorID
Ritor1
parents: 688
diff changeset
95 pArrayNum = i++;
Ritor1
parents: 688
diff changeset
96 v7 = i < 10;
0
Ritor1
parents:
diff changeset
97 v6 = i - 10 < 0;
717
Ritor1
parents: 688
diff changeset
98 pSectorsArray[pArrayNum] = pNextSector;
0
Ritor1
parents:
diff changeset
99 if ( !(v6 ^ v7) )
Ritor1
parents:
diff changeset
100 break;
Ritor1
parents:
diff changeset
101 }
Ritor1
parents:
diff changeset
102 }
Ritor1
parents:
diff changeset
103 result = 0;
2138
Ritor1
parents: 2065
diff changeset
104 for ( v29 = 0; v29 < i; v29++ )
0
Ritor1
parents:
diff changeset
105 {
2138
Ritor1
parents: 2065
diff changeset
106 pSector = &pIndoor->pSectors[pSectorsArray[v29]];
Ritor1
parents: 2065
diff changeset
107 v32 = pSector->uNumFloors + pSector->uNumWalls + pSector->uNumCeilings;
Ritor1
parents: 2065
diff changeset
108 for ( v26 = 0; v26 < v32; v26++ )
0
Ritor1
parents:
diff changeset
109 {
2138
Ritor1
parents: 2065
diff changeset
110 pFloor = pSector->pFloors[v26];
Ritor1
parents: 2065
diff changeset
111 pFace = &pIndoor->pFaces[pSector->pFloors[v26]];
Ritor1
parents: 2065
diff changeset
112 if ( !pFace->Portal()
Ritor1
parents: 2065
diff changeset
113 && stru_721530.sMaxX <= pFace->pBounding.x2 && stru_721530.sMinX >= pFace->pBounding.x1
Ritor1
parents: 2065
diff changeset
114 && stru_721530.sMaxY <= pFace->pBounding.y2 && stru_721530.sMinY >= pFace->pBounding.y1
Ritor1
parents: 2065
diff changeset
115 && stru_721530.sMaxZ <= pFace->pBounding.z2 && stru_721530.sMinZ >= pFace->pBounding.z1
Ritor1
parents: 2065
diff changeset
116 && pFloor != stru_721530.field_84 )
Ritor1
parents: 2065
diff changeset
117 {
Ritor1
parents: 2065
diff changeset
118 v15 = ( pFace->pFacePlane_old.dist + stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x
Ritor1
parents: 2065
diff changeset
119 + stru_721530.normal.y * pFace->pFacePlane_old.vNormal.y
Ritor1
parents: 2065
diff changeset
120 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z ) >> 16;
0
Ritor1
parents:
diff changeset
121 if ( v15 > 0 )
Ritor1
parents:
diff changeset
122 {
2138
Ritor1
parents: 2065
diff changeset
123 v16 = ( pFace->pFacePlane_old.dist + stru_721530.normal2.x * pFace->pFacePlane_old.vNormal.x
Ritor1
parents: 2065
diff changeset
124 + stru_721530.normal2.y * pFace->pFacePlane_old.vNormal.y
Ritor1
parents: 2065
diff changeset
125 + stru_721530.normal2.z * pFace->pFacePlane_old.vNormal.z ) >> 16;
0
Ritor1
parents:
diff changeset
126 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d )
Ritor1
parents:
diff changeset
127 {
Ritor1
parents:
diff changeset
128 if ( v16 <= v15 )
Ritor1
parents:
diff changeset
129 {
Ritor1
parents:
diff changeset
130 a3 = stru_721530.field_6C;
717
Ritor1
parents: 688
diff changeset
131 if ( sub_47531C(stru_721530.prolly_normal_d, &a3, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z,
2138
Ritor1
parents: 2065
diff changeset
132 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, pFace, a10) )
0
Ritor1
parents:
diff changeset
133 {
Ritor1
parents:
diff changeset
134 v17 = a3;
Ritor1
parents:
diff changeset
135 }
Ritor1
parents:
diff changeset
136 else
Ritor1
parents:
diff changeset
137 {
Ritor1
parents:
diff changeset
138 a3 = stru_721530.field_6C + stru_721530.prolly_normal_d;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
139 if ( !sub_475D85(&stru_721530.normal, &stru_721530.direction, &a3, pFace) )
0
Ritor1
parents:
diff changeset
140 goto LABEL_34;
Ritor1
parents:
diff changeset
141 v17 = a3 - stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
142 a3 -= stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
143 }
Ritor1
parents:
diff changeset
144 if ( v17 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
145 {
Ritor1
parents:
diff changeset
146 stru_721530.field_7C = v17;
717
Ritor1
parents: 688
diff changeset
147 v18 = 8 * pSector->pFloors[v26];
0
Ritor1
parents:
diff changeset
148 LOBYTE(v18) = v18 | 6;
Ritor1
parents:
diff changeset
149 stru_721530.uFaceID = v18;
Ritor1
parents:
diff changeset
150 }
Ritor1
parents:
diff changeset
151 }
Ritor1
parents:
diff changeset
152 }
Ritor1
parents:
diff changeset
153 }
Ritor1
parents:
diff changeset
154 LABEL_34:
Ritor1
parents:
diff changeset
155 if ( !(stru_721530.field_0 & 1)
2138
Ritor1
parents: 2065
diff changeset
156 || (v21 = ( pFace->pFacePlane_old.dist + stru_721530.position.x * pFace->pFacePlane_old.vNormal.x
Ritor1
parents: 2065
diff changeset
157 + stru_721530.position.y * pFace->pFacePlane_old.vNormal.y
Ritor1
parents: 2065
diff changeset
158 + stru_721530.position.z * pFace->pFacePlane_old.vNormal.z) >> 16, v21 <= 0)
Ritor1
parents: 2065
diff changeset
159 || (v22 = ( pFace->pFacePlane_old.dist + stru_721530.field_4C * pFace->pFacePlane_old.vNormal.x
Ritor1
parents: 2065
diff changeset
160 + stru_721530.field_50 * pFace->pFacePlane_old.vNormal.y
Ritor1
parents: 2065
diff changeset
161 + stru_721530.field_54 * pFace->pFacePlane_old.vNormal.z) >> 16, v21 > stru_721530.prolly_normal_d)
Ritor1
parents: 2065
diff changeset
162 && v22 > stru_721530.prolly_normal_d || v22 > v21 )
Ritor1
parents: 2065
diff changeset
163 continue;
0
Ritor1
parents:
diff changeset
164 a3 = stru_721530.field_6C;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
165 if ( sub_47531C(stru_721530.field_8_radius, &a3, stru_721530.position.x, stru_721530.position.y, stru_721530.position.z,
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
166 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, pFace, a10) )
0
Ritor1
parents:
diff changeset
167 {
Ritor1
parents:
diff changeset
168 v23 = a3;
Ritor1
parents:
diff changeset
169 goto LABEL_43;
Ritor1
parents:
diff changeset
170 }
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
171 a3 = stru_721530.field_6C + stru_721530.field_8_radius;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
172 if ( sub_475D85(&stru_721530.position, &stru_721530.direction, &a3, pFace) )
0
Ritor1
parents:
diff changeset
173 {
Ritor1
parents:
diff changeset
174 v23 = a3 - stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
175 a3 -= stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
176 LABEL_43:
Ritor1
parents:
diff changeset
177 if ( v23 < stru_721530.field_7C )
Ritor1
parents:
diff changeset
178 {
Ritor1
parents:
diff changeset
179 stru_721530.field_7C = v23;
717
Ritor1
parents: 688
diff changeset
180 v24 = 8 * pSector->pFloors[v26];
0
Ritor1
parents:
diff changeset
181 LOBYTE(v24) = v24 | 6;
Ritor1
parents:
diff changeset
182 stru_721530.uFaceID = v24;
Ritor1
parents:
diff changeset
183 }
Ritor1
parents:
diff changeset
184 }
2138
Ritor1
parents: 2065
diff changeset
185 }
0
Ritor1
parents:
diff changeset
186 }
2138
Ritor1
parents: 2065
diff changeset
187 result = v29 + 1;
0
Ritor1
parents:
diff changeset
188 }
Ritor1
parents:
diff changeset
189 return result;
Ritor1
parents:
diff changeset
190 }
Ritor1
parents:
diff changeset
191 // 46E44E: using guessed type int var_28[10];
Ritor1
parents:
diff changeset
192
Ritor1
parents:
diff changeset
193 //----- (0046E889) --------------------------------------------------------
Ritor1
parents:
diff changeset
194 int __fastcall _46E889_collide_against_bmodels(unsigned int ecx0)
Ritor1
parents:
diff changeset
195 {
Ritor1
parents:
diff changeset
196 int result; // eax@1
Ritor1
parents:
diff changeset
197 int v3; // ebx@9
Ritor1
parents:
diff changeset
198 int v8; // eax@19
Ritor1
parents:
diff changeset
199 int v9; // ecx@20
Ritor1
parents:
diff changeset
200 int v10; // eax@24
Ritor1
parents:
diff changeset
201 unsigned int v14; // eax@28
Ritor1
parents:
diff changeset
202 int v15; // eax@30
Ritor1
parents:
diff changeset
203 int v16; // ecx@31
Ritor1
parents:
diff changeset
204 unsigned int v17; // eax@36
Ritor1
parents:
diff changeset
205 int v21; // eax@42
Ritor1
parents:
diff changeset
206 unsigned int v22; // eax@43
Ritor1
parents:
diff changeset
207 int a11; // [sp+70h] [bp-18h]@1
Ritor1
parents:
diff changeset
208 int a10; // [sp+80h] [bp-8h]@1
Ritor1
parents:
diff changeset
209 int a2; // [sp+84h] [bp-4h]@23
Ritor1
parents:
diff changeset
210
Ritor1
parents:
diff changeset
211 a11 = ecx0;
Ritor1
parents:
diff changeset
212
Ritor1
parents:
diff changeset
213 BLVFace f; // [sp+Ch] [bp-7Ch]@1
Ritor1
parents:
diff changeset
214
Ritor1
parents:
diff changeset
215 result = 0;
2138
Ritor1
parents: 2065
diff changeset
216 for ( a10 = 0; a10 < (signed int)pOutdoor->uNumBModels; ++a10 )
0
Ritor1
parents:
diff changeset
217 {
2138
Ritor1
parents: 2065
diff changeset
218 if ( stru_721530.sMaxX <= pOutdoor->pBModels[a10].sMaxX && stru_721530.sMinX >= pOutdoor->pBModels[a10].sMinX
Ritor1
parents: 2065
diff changeset
219 && stru_721530.sMaxY <= pOutdoor->pBModels[a10].sMaxY && stru_721530.sMinY >= pOutdoor->pBModels[a10].sMinY
Ritor1
parents: 2065
diff changeset
220 && stru_721530.sMaxZ <= pOutdoor->pBModels[a10].sMaxZ && stru_721530.sMinZ >= pOutdoor->pBModels[a10].sMinZ )
0
Ritor1
parents:
diff changeset
221 {
2138
Ritor1
parents: 2065
diff changeset
222 for ( v3 = 0; v3 < pOutdoor->pBModels[a10].uNumFaces; ++v3 )
0
Ritor1
parents:
diff changeset
223 {
2138
Ritor1
parents: 2065
diff changeset
224 if ( stru_721530.sMaxX <= pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.x2 && stru_721530.sMinX >= pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.x1
Ritor1
parents: 2065
diff changeset
225 && stru_721530.sMaxY <= pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.y2 && stru_721530.sMinY >= pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.y1
Ritor1
parents: 2065
diff changeset
226 && stru_721530.sMaxZ <= pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.z2 && stru_721530.sMinZ >= pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.z1 )
0
Ritor1
parents:
diff changeset
227 {
2138
Ritor1
parents: 2065
diff changeset
228 f.pFacePlane_old.vNormal.x = pOutdoor->pBModels[a10].pFaces[v3].pFacePlane.vNormal.x;
Ritor1
parents: 2065
diff changeset
229 f.pFacePlane_old.vNormal.y = pOutdoor->pBModels[a10].pFaces[v3].pFacePlane.vNormal.y;
Ritor1
parents: 2065
diff changeset
230 f.pFacePlane_old.vNormal.z = pOutdoor->pBModels[a10].pFaces[v3].pFacePlane.vNormal.z;
Ritor1
parents: 2065
diff changeset
231 f.pFacePlane_old.dist = pOutdoor->pBModels[a10].pFaces[v3].pFacePlane.dist;
Ritor1
parents: 2065
diff changeset
232 f.uAttributes = pOutdoor->pBModels[a10].pFaces[v3].uAttributes;
Ritor1
parents: 2065
diff changeset
233 f.pBounding.x1 = pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.x1;
Ritor1
parents: 2065
diff changeset
234 f.pBounding.y1 = pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.y1;
Ritor1
parents: 2065
diff changeset
235 f.pBounding.z1 = pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.z1;
Ritor1
parents: 2065
diff changeset
236 f.pBounding.x2 = pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.x2;
Ritor1
parents: 2065
diff changeset
237 f.pBounding.y2 = pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.y2;
Ritor1
parents: 2065
diff changeset
238 f.pBounding.z2 = pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.z2;
Ritor1
parents: 2065
diff changeset
239 f.zCalc1 = pOutdoor->pBModels[a10].pFaces[v3].zCalc1;
Ritor1
parents: 2065
diff changeset
240 f.zCalc2 = pOutdoor->pBModels[a10].pFaces[v3].zCalc2;
Ritor1
parents: 2065
diff changeset
241 f.zCalc3 = pOutdoor->pBModels[a10].pFaces[v3].zCalc3;
Ritor1
parents: 2065
diff changeset
242 f.pXInterceptDisplacements = pOutdoor->pBModels[a10].pFaces[v3].pXInterceptDisplacements;
Ritor1
parents: 2065
diff changeset
243 f.pYInterceptDisplacements = pOutdoor->pBModels[a10].pFaces[v3].pYInterceptDisplacements;
Ritor1
parents: 2065
diff changeset
244 f.pZInterceptDisplacements = pOutdoor->pBModels[a10].pFaces[v3].pZInterceptDisplacements;
Ritor1
parents: 2065
diff changeset
245 f.uPolygonType = (PolygonType)pOutdoor->pBModels[a10].pFaces[v3].uPolygonType;
Ritor1
parents: 2065
diff changeset
246 f.uNumVertices = pOutdoor->pBModels[a10].pFaces[v3].uNumVertices;
Ritor1
parents: 2065
diff changeset
247 f.uBitmapID = pOutdoor->pBModels[a10].pFaces[v3].uTextureID;
Ritor1
parents: 2065
diff changeset
248 f.pVertexIDs = pOutdoor->pBModels[a10].pFaces[v3].pVertexIDs;
Ritor1
parents: 2065
diff changeset
249 if ( !f.Ethereal() && !f.Portal() )
0
Ritor1
parents:
diff changeset
250 {
2138
Ritor1
parents: 2065
diff changeset
251 v8 = (f.pFacePlane_old.dist + f.pFacePlane_old.vNormal.x * stru_721530.normal.x
Ritor1
parents: 2065
diff changeset
252 + f.pFacePlane_old.vNormal.y * stru_721530.normal.y
Ritor1
parents: 2065
diff changeset
253 + f.pFacePlane_old.vNormal.z * stru_721530.normal.z ) >> 16;
Ritor1
parents: 2065
diff changeset
254 if ( v8 > 0 )
0
Ritor1
parents:
diff changeset
255 {
2138
Ritor1
parents: 2065
diff changeset
256 v9 = (f.pFacePlane_old.dist + f.pFacePlane_old.vNormal.x * stru_721530.normal2.x
Ritor1
parents: 2065
diff changeset
257 + f.pFacePlane_old.vNormal.y * stru_721530.normal2.y
Ritor1
parents: 2065
diff changeset
258 + f.pFacePlane_old.vNormal.z * stru_721530.normal2.z) >> 16;
Ritor1
parents: 2065
diff changeset
259 if ( v8 <= stru_721530.prolly_normal_d || v9 <= stru_721530.prolly_normal_d )
0
Ritor1
parents:
diff changeset
260 {
2138
Ritor1
parents: 2065
diff changeset
261 if ( v9 <= v8 )
0
Ritor1
parents:
diff changeset
262 {
2138
Ritor1
parents: 2065
diff changeset
263 a2 = stru_721530.field_6C;
Ritor1
parents: 2065
diff changeset
264 if ( sub_4754BF(stru_721530.prolly_normal_d, &a2, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z,
Ritor1
parents: 2065
diff changeset
265 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, &f, a10, a11) )
Ritor1
parents: 2065
diff changeset
266 {
Ritor1
parents: 2065
diff changeset
267 v10 = a2;
Ritor1
parents: 2065
diff changeset
268 }
Ritor1
parents: 2065
diff changeset
269 else
Ritor1
parents: 2065
diff changeset
270 {
Ritor1
parents: 2065
diff changeset
271 a2 = stru_721530.prolly_normal_d + stru_721530.field_6C;
Ritor1
parents: 2065
diff changeset
272 if ( !sub_475F30( &a2, &f, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z,
Ritor1
parents: 2065
diff changeset
273 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, a10) )
Ritor1
parents: 2065
diff changeset
274 goto LABEL_29;
Ritor1
parents: 2065
diff changeset
275 v10 = a2 - stru_721530.prolly_normal_d;
Ritor1
parents: 2065
diff changeset
276 a2 -= stru_721530.prolly_normal_d;
Ritor1
parents: 2065
diff changeset
277 }
Ritor1
parents: 2065
diff changeset
278 if ( v10 < stru_721530.field_7C )
Ritor1
parents: 2065
diff changeset
279 {
Ritor1
parents: 2065
diff changeset
280 stru_721530.field_7C = v10;
Ritor1
parents: 2065
diff changeset
281 v14 = 8 * (v3 | (a10 << 6));
Ritor1
parents: 2065
diff changeset
282 LOBYTE(v14) = v14 | 6;
Ritor1
parents: 2065
diff changeset
283 stru_721530.uFaceID = v14;
Ritor1
parents: 2065
diff changeset
284 }
Ritor1
parents: 2065
diff changeset
285 }
Ritor1
parents: 2065
diff changeset
286 }
Ritor1
parents: 2065
diff changeset
287 }
Ritor1
parents: 2065
diff changeset
288 LABEL_29:
Ritor1
parents: 2065
diff changeset
289 if ( stru_721530.field_0 & 1 )
Ritor1
parents: 2065
diff changeset
290 {
Ritor1
parents: 2065
diff changeset
291 v15 = (f.pFacePlane_old.dist + f.pFacePlane_old.vNormal.x * stru_721530.position.x
Ritor1
parents: 2065
diff changeset
292 + f.pFacePlane_old.vNormal.y * stru_721530.position.y
Ritor1
parents: 2065
diff changeset
293 + f.pFacePlane_old.vNormal.z * stru_721530.position.z) >> 16;
Ritor1
parents: 2065
diff changeset
294 if ( v15 > 0 )
Ritor1
parents: 2065
diff changeset
295 {
Ritor1
parents: 2065
diff changeset
296 v16 = (f.pFacePlane_old.dist + f.pFacePlane_old.vNormal.x * stru_721530.field_4C
Ritor1
parents: 2065
diff changeset
297 + f.pFacePlane_old.vNormal.y * stru_721530.field_50
Ritor1
parents: 2065
diff changeset
298 + f.pFacePlane_old.vNormal.z * stru_721530.field_54) >> 16;
Ritor1
parents: 2065
diff changeset
299 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d )
Ritor1
parents: 2065
diff changeset
300 {
Ritor1
parents: 2065
diff changeset
301 if ( v16 <= v15 )
Ritor1
parents: 2065
diff changeset
302 {
Ritor1
parents: 2065
diff changeset
303 a2 = stru_721530.field_6C;
Ritor1
parents: 2065
diff changeset
304 if ( sub_4754BF(stru_721530.field_8_radius, &a2, stru_721530.position.x, stru_721530.position.y, stru_721530.position.z,
Ritor1
parents: 2065
diff changeset
305 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, &f, a10, a11) )
Ritor1
parents: 2065
diff changeset
306 {
Ritor1
parents: 2065
diff changeset
307 if ( a2 < stru_721530.field_7C )
Ritor1
parents: 2065
diff changeset
308 {
Ritor1
parents: 2065
diff changeset
309 stru_721530.field_7C = a2;
Ritor1
parents: 2065
diff changeset
310 v17 = 8 * (v3 | (a10 << 6));
Ritor1
parents: 2065
diff changeset
311 LOBYTE(v17) = v17 | 6;
Ritor1
parents: 2065
diff changeset
312 stru_721530.uFaceID = v17;
Ritor1
parents: 2065
diff changeset
313 }
Ritor1
parents: 2065
diff changeset
314 }
Ritor1
parents: 2065
diff changeset
315 else
Ritor1
parents: 2065
diff changeset
316 {
Ritor1
parents: 2065
diff changeset
317 a2 = stru_721530.field_6C + stru_721530.field_8_radius;
Ritor1
parents: 2065
diff changeset
318 if ( sub_475F30(&a2, &f, stru_721530.position.x, stru_721530.position.y, stru_721530.position.z,
Ritor1
parents: 2065
diff changeset
319 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, a10) )
Ritor1
parents: 2065
diff changeset
320 {
Ritor1
parents: 2065
diff changeset
321 v21 = a2 - stru_721530.prolly_normal_d;
Ritor1
parents: 2065
diff changeset
322 a2 -= stru_721530.prolly_normal_d;
Ritor1
parents: 2065
diff changeset
323 if ( a2 < stru_721530.field_7C )
Ritor1
parents: 2065
diff changeset
324 {
Ritor1
parents: 2065
diff changeset
325 stru_721530.field_7C = v21;
Ritor1
parents: 2065
diff changeset
326 v22 = 8 * (v3 | (a10 << 6));
Ritor1
parents: 2065
diff changeset
327 LOBYTE(v22) = v22 | 6;
Ritor1
parents: 2065
diff changeset
328 stru_721530.uFaceID = v22;
Ritor1
parents: 2065
diff changeset
329 }
Ritor1
parents: 2065
diff changeset
330 }
Ritor1
parents: 2065
diff changeset
331 }
Ritor1
parents: 2065
diff changeset
332 }
0
Ritor1
parents:
diff changeset
333 }
Ritor1
parents:
diff changeset
334 }
Ritor1
parents:
diff changeset
335 }
Ritor1
parents:
diff changeset
336 }
Ritor1
parents:
diff changeset
337 }
Ritor1
parents:
diff changeset
338 }
Ritor1
parents:
diff changeset
339 }
2138
Ritor1
parents: 2065
diff changeset
340 result = a10;
0
Ritor1
parents:
diff changeset
341 }
Ritor1
parents:
diff changeset
342 return result;
Ritor1
parents:
diff changeset
343 }
Ritor1
parents:
diff changeset
344
Ritor1
parents:
diff changeset
345 //----- (0046ED1B) --------------------------------------------------------
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
346 int collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID)
0
Ritor1
parents:
diff changeset
347 {
Ritor1
parents:
diff changeset
348 uint uFaceID = -1;
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
349 int floor_level = BLV_GetFloorLevel(x, y, z, *pSectorID, &uFaceID);
0
Ritor1
parents:
diff changeset
350
Ritor1
parents:
diff changeset
351 if (floor_level != -30000 && floor_level <= z + 50)
Ritor1
parents:
diff changeset
352 {
Ritor1
parents:
diff changeset
353 *pFaceID = uFaceID;
Ritor1
parents:
diff changeset
354 return floor_level;
Ritor1
parents:
diff changeset
355 }
Ritor1
parents:
diff changeset
356
Ritor1
parents:
diff changeset
357 uint uSectorID = pIndoor->GetSector(x, y, z);
Ritor1
parents:
diff changeset
358 *pSectorID = uSectorID;
Ritor1
parents:
diff changeset
359
723
256211e8243a ODM_GetFloorLevel & BLV_GetFloorLevel
Ritor1
parents: 722
diff changeset
360 floor_level = BLV_GetFloorLevel(x, y, z, uSectorID, &uFaceID);
0
Ritor1
parents:
diff changeset
361 if (uSectorID && floor_level != -30000)
Ritor1
parents:
diff changeset
362 *pFaceID = uFaceID;
Ritor1
parents:
diff changeset
363 else return -30000;
Ritor1
parents:
diff changeset
364 return floor_level;
Ritor1
parents:
diff changeset
365 }
Ritor1
parents:
diff changeset
366
Ritor1
parents:
diff changeset
367 //----- (0046ED8A) --------------------------------------------------------
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
368 void __fastcall _46ED8A_collide_against_sprite_objects(unsigned int _this)
0
Ritor1
parents:
diff changeset
369 {
2138
Ritor1
parents: 2065
diff changeset
370 ObjectDesc *object; // edx@4
0
Ritor1
parents:
diff changeset
371 int v10; // ecx@12
Ritor1
parents:
diff changeset
372 int v11; // esi@13
2138
Ritor1
parents: 2065
diff changeset
373
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
374 if ( (signed int)uNumSpriteObjects > 0 )
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
375 {
2138
Ritor1
parents: 2065
diff changeset
376 for ( uint i = 0; i < uNumSpriteObjects; ++i )
0
Ritor1
parents:
diff changeset
377 {
2138
Ritor1
parents: 2065
diff changeset
378 if ( pSpriteObjects[i].uObjectDescID )
0
Ritor1
parents:
diff changeset
379 {
2138
Ritor1
parents: 2065
diff changeset
380 object = &pObjectList->pObjects[pSpriteObjects[i].uObjectDescID];
Ritor1
parents: 2065
diff changeset
381 if ( !(object->uFlags & OBJECT_DESC_NO_COLLISION) )
0
Ritor1
parents:
diff changeset
382 {
2138
Ritor1
parents: 2065
diff changeset
383 if ( stru_721530.sMaxX <= pSpriteObjects[i].vPosition.x + object->uRadius
Ritor1
parents: 2065
diff changeset
384 && stru_721530.sMinX >= pSpriteObjects[i].vPosition.x - object->uRadius
Ritor1
parents: 2065
diff changeset
385 && stru_721530.sMaxY <= pSpriteObjects[i].vPosition.y + object->uRadius
Ritor1
parents: 2065
diff changeset
386 && stru_721530.sMinY >= pSpriteObjects[i].vPosition.y - object->uRadius
Ritor1
parents: 2065
diff changeset
387 && stru_721530.sMaxZ <= pSpriteObjects[i].vPosition.z + object->uHeight
Ritor1
parents: 2065
diff changeset
388 && stru_721530.sMinZ >= pSpriteObjects[i].vPosition.z )
0
Ritor1
parents:
diff changeset
389 {
2138
Ritor1
parents: 2065
diff changeset
390 if ( abs(((pSpriteObjects[i].vPosition.x - stru_721530.normal.x) * stru_721530.direction.y
Ritor1
parents: 2065
diff changeset
391 - (pSpriteObjects[i].vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16) <= object->uHeight
Ritor1
parents: 2065
diff changeset
392 + stru_721530.prolly_normal_d )
0
Ritor1
parents:
diff changeset
393 {
2138
Ritor1
parents: 2065
diff changeset
394 v10 = ((pSpriteObjects[i].vPosition.x - stru_721530.normal.x) * stru_721530.direction.x
Ritor1
parents: 2065
diff changeset
395 + (pSpriteObjects[i].vPosition.y - stru_721530.normal.y) * stru_721530.direction.y) >> 16;
Ritor1
parents: 2065
diff changeset
396 if ( v10 > 0 )
0
Ritor1
parents:
diff changeset
397 {
2138
Ritor1
parents: 2065
diff changeset
398 v11 = stru_721530.normal.z + ((unsigned __int64)(stru_721530.direction.z * (signed __int64)v10) >> 16);
Ritor1
parents: 2065
diff changeset
399 if ( v11 >= pSpriteObjects[i].vPosition.z - stru_721530.prolly_normal_d )
0
Ritor1
parents:
diff changeset
400 {
2138
Ritor1
parents: 2065
diff changeset
401 if ( v11 <= object->uHeight + stru_721530.prolly_normal_d + pSpriteObjects[i].vPosition.z )
0
Ritor1
parents:
diff changeset
402 {
2138
Ritor1
parents: 2065
diff changeset
403 if ( v10 < stru_721530.field_7C )
Ritor1
parents: 2065
diff changeset
404 sub_46DEF2(_this, i);
0
Ritor1
parents:
diff changeset
405 }
Ritor1
parents:
diff changeset
406 }
Ritor1
parents:
diff changeset
407 }
Ritor1
parents:
diff changeset
408 }
Ritor1
parents:
diff changeset
409 }
Ritor1
parents:
diff changeset
410 }
Ritor1
parents:
diff changeset
411 }
Ritor1
parents:
diff changeset
412 }
Ritor1
parents:
diff changeset
413 }
Ritor1
parents:
diff changeset
414 }
Ritor1
parents:
diff changeset
415
Ritor1
parents:
diff changeset
416 //----- (0046EF01) --------------------------------------------------------
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
417 int _46EF01_collision_chech_player(int a1)
0
Ritor1
parents:
diff changeset
418 {
Ritor1
parents:
diff changeset
419 int v1; // edx@1
Ritor1
parents:
diff changeset
420 int result; // eax@1
Ritor1
parents:
diff changeset
421 int v3; // ebx@7
Ritor1
parents:
diff changeset
422 int v4; // esi@7
Ritor1
parents:
diff changeset
423 int v5; // edi@8
Ritor1
parents:
diff changeset
424 int v6; // ecx@9
Ritor1
parents:
diff changeset
425 int v7; // edi@12
Ritor1
parents:
diff changeset
426 int v8; // [sp+Ch] [bp-10h]@1
Ritor1
parents:
diff changeset
427 unsigned int v9; // [sp+10h] [bp-Ch]@1
Ritor1
parents:
diff changeset
428 int v10; // [sp+14h] [bp-8h]@7
Ritor1
parents:
diff changeset
429 int v11; // [sp+18h] [bp-4h]@7
Ritor1
parents:
diff changeset
430
Ritor1
parents:
diff changeset
431 v8 = a1;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
432 v1 = 2 * pParty->field_14_radius;
0
Ritor1
parents:
diff changeset
433 result = pParty->vPosition.x;
Ritor1
parents:
diff changeset
434 v9 = pParty->uPartyHeight;
2138
Ritor1
parents: 2065
diff changeset
435 if ( stru_721530.sMaxX <= pParty->vPosition.x + v1 && stru_721530.sMinX >= pParty->vPosition.x - v1
Ritor1
parents: 2065
diff changeset
436 && stru_721530.sMaxY <= pParty->vPosition.y + v1 && stru_721530.sMinY >= pParty->vPosition.y - v1
Ritor1
parents: 2065
diff changeset
437 && stru_721530.sMaxZ <= (signed int)(pParty->vPosition.z + pParty->uPartyHeight)
Ritor1
parents: 2065
diff changeset
438 && stru_721530.sMinZ >= pParty->vPosition.z )
0
Ritor1
parents:
diff changeset
439 {
2138
Ritor1
parents: 2065
diff changeset
440 v3 = stru_721530.prolly_normal_d + v1;
Ritor1
parents: 2065
diff changeset
441 v11 = pParty->vPosition.x - stru_721530.normal.x;
Ritor1
parents: 2065
diff changeset
442 v4 = ((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y
Ritor1
parents: 2065
diff changeset
443 - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16;
Ritor1
parents: 2065
diff changeset
444 v10 = pParty->vPosition.y - stru_721530.normal.y;
Ritor1
parents: 2065
diff changeset
445 result = abs(((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y
Ritor1
parents: 2065
diff changeset
446 - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16);
Ritor1
parents: 2065
diff changeset
447 if ( result <= stru_721530.prolly_normal_d + v1 )
0
Ritor1
parents:
diff changeset
448 {
2138
Ritor1
parents: 2065
diff changeset
449 result = v10 * stru_721530.direction.y;
Ritor1
parents: 2065
diff changeset
450 v5 = (v10 * stru_721530.direction.y + v11 * stru_721530.direction.x) >> 16;
Ritor1
parents: 2065
diff changeset
451 if ( v5 > 0 )
0
Ritor1
parents:
diff changeset
452 {
2138
Ritor1
parents: 2065
diff changeset
453 v6 = ((unsigned __int64)(stru_721530.direction.z * (signed __int64)v5) >> 16) + stru_721530.normal.z;
Ritor1
parents: 2065
diff changeset
454 result = pParty->vPosition.z;
Ritor1
parents: 2065
diff changeset
455 if ( v6 >= pParty->vPosition.z )
0
Ritor1
parents:
diff changeset
456 {
2138
Ritor1
parents: 2065
diff changeset
457 result = v9 + pParty->vPosition.z;
Ritor1
parents: 2065
diff changeset
458 if ( v6 <= (signed int)(v9 + pParty->vPosition.z) || v8 )
0
Ritor1
parents:
diff changeset
459 {
2138
Ritor1
parents: 2065
diff changeset
460 result = integer_sqrt(v3 * v3 - v4 * v4);
Ritor1
parents: 2065
diff changeset
461 v7 = v5 - integer_sqrt(v3 * v3 - v4 * v4);
Ritor1
parents: 2065
diff changeset
462 if ( v7 < 0 )
Ritor1
parents: 2065
diff changeset
463 v7 = 0;
Ritor1
parents: 2065
diff changeset
464 if ( v7 < stru_721530.field_7C )
0
Ritor1
parents:
diff changeset
465 {
2138
Ritor1
parents: 2065
diff changeset
466 stru_721530.field_7C = v7;
Ritor1
parents: 2065
diff changeset
467 stru_721530.uFaceID = 4;
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 }
Ritor1
parents:
diff changeset
474 return result;
Ritor1
parents:
diff changeset
475 }
Ritor1
parents:
diff changeset
476
Ritor1
parents:
diff changeset
477 //----- (0046F04E) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
478 int _46F04E_collide_against_portals()
0
Ritor1
parents:
diff changeset
479 {
Ritor1
parents:
diff changeset
480 unsigned int v1; // eax@1
2138
Ritor1
parents: 2065
diff changeset
481 BLVFace *face; // eax@3
0
Ritor1
parents:
diff changeset
482 int v4; // ecx@9
Ritor1
parents:
diff changeset
483 int v5; // edx@9
Ritor1
parents:
diff changeset
484 signed int result; // eax@21
Ritor1
parents:
diff changeset
485 unsigned int v10; // [sp+8h] [bp-Ch]@1
Ritor1
parents:
diff changeset
486 int a3; // [sp+Ch] [bp-8h]@13
Ritor1
parents:
diff changeset
487 int v12; // [sp+10h] [bp-4h]@15
Ritor1
parents:
diff changeset
488
Ritor1
parents:
diff changeset
489 v1 = 0xFFFFFFu;
Ritor1
parents:
diff changeset
490 v10 = 0xFFFFFFu;
2138
Ritor1
parents: 2065
diff changeset
491 for ( uint i = 0; i < pIndoor->pSectors[stru_721530.uSectorID].uNumPortals; ++i )
0
Ritor1
parents:
diff changeset
492 {
2138
Ritor1
parents: 2065
diff changeset
493 if ( pIndoor->pSectors[stru_721530.uSectorID].pPortals[i] != stru_721530.field_80 )
0
Ritor1
parents:
diff changeset
494 {
2138
Ritor1
parents: 2065
diff changeset
495 face = &pIndoor->pFaces[pIndoor->pSectors[stru_721530.uSectorID].pPortals[i]];
Ritor1
parents: 2065
diff changeset
496 if ( stru_721530.sMaxX <= face->pBounding.x2 && stru_721530.sMinX >= face->pBounding.x1
Ritor1
parents: 2065
diff changeset
497 && stru_721530.sMaxY <= face->pBounding.y2 && stru_721530.sMinY >= face->pBounding.y1
Ritor1
parents: 2065
diff changeset
498 && stru_721530.sMaxZ <= face->pBounding.z2 && stru_721530.sMinZ >= face->pBounding.z1 )
0
Ritor1
parents:
diff changeset
499 {
2138
Ritor1
parents: 2065
diff changeset
500 v4 = (stru_721530.normal.x * face->pFacePlane_old.vNormal.x + face->pFacePlane_old.dist
Ritor1
parents: 2065
diff changeset
501 + stru_721530.normal.y * face->pFacePlane_old.vNormal.y
Ritor1
parents: 2065
diff changeset
502 + stru_721530.normal.z * face->pFacePlane_old.vNormal.z) >> 16;
Ritor1
parents: 2065
diff changeset
503 v5 = (stru_721530.normal2.z * face->pFacePlane_old.vNormal.z + face->pFacePlane_old.dist
Ritor1
parents: 2065
diff changeset
504 + stru_721530.normal2.x * face->pFacePlane_old.vNormal.x
Ritor1
parents: 2065
diff changeset
505 + stru_721530.normal2.y * face->pFacePlane_old.vNormal.y) >> 16;
Ritor1
parents: 2065
diff changeset
506 if ( (v4 < stru_721530.prolly_normal_d || v5 < stru_721530.prolly_normal_d)
Ritor1
parents: 2065
diff changeset
507 && (v4 > -stru_721530.prolly_normal_d || v5 > -stru_721530.prolly_normal_d)
Ritor1
parents: 2065
diff changeset
508 && (a3 = stru_721530.field_6C, sub_475D85(&stru_721530.normal, &stru_721530.direction, &a3, face))
Ritor1
parents: 2065
diff changeset
509 && a3 < (signed int)v10 )
0
Ritor1
parents:
diff changeset
510 {
2138
Ritor1
parents: 2065
diff changeset
511 v10 = a3;
Ritor1
parents: 2065
diff changeset
512 v12 = pIndoor->pSectors[stru_721530.uSectorID].pPortals[i];
0
Ritor1
parents:
diff changeset
513 }
Ritor1
parents:
diff changeset
514 }
Ritor1
parents:
diff changeset
515 }
Ritor1
parents:
diff changeset
516 }
2138
Ritor1
parents: 2065
diff changeset
517 v1 = v10;
0
Ritor1
parents:
diff changeset
518 if ( stru_721530.field_7C >= (signed int)v1 && (signed int)v1 <= stru_721530.field_6C )
Ritor1
parents:
diff changeset
519 {
Ritor1
parents:
diff changeset
520 stru_721530.field_80 = v12;
2138
Ritor1
parents: 2065
diff changeset
521 if ( pIndoor->pFaces[v12].uSectorID == stru_721530.uSectorID )
Ritor1
parents: 2065
diff changeset
522 stru_721530.uSectorID = pIndoor->pFaces[v12].uBackSectorID;
0
Ritor1
parents:
diff changeset
523 else
2138
Ritor1
parents: 2065
diff changeset
524 stru_721530.uSectorID = pIndoor->pFaces[v12].uSectorID;
0
Ritor1
parents:
diff changeset
525 stru_721530.field_7C = 268435455;
Ritor1
parents:
diff changeset
526 result = 0;
Ritor1
parents:
diff changeset
527 }
Ritor1
parents:
diff changeset
528 else
Ritor1
parents:
diff changeset
529 {
Ritor1
parents:
diff changeset
530 result = 1;
Ritor1
parents:
diff changeset
531 }
Ritor1
parents:
diff changeset
532 return result;
Ritor1
parents:
diff changeset
533 }
Ritor1
parents:
diff changeset
534
Ritor1
parents:
diff changeset
535 //----- (0047050A) --------------------------------------------------------
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
536 int stru141_actor_collision_object::_47050A(int dt)
0
Ritor1
parents:
diff changeset
537 {
1799
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
538 //stru141_actor_collision_object *v2; // esi@1
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
539 //signed int v3; // eax@1
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
540 //int v4; // ecx@1
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
541 //int v5; // edx@1
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
542 //int v6; // edx@1
0
Ritor1
parents:
diff changeset
543 int v7; // eax@1
1799
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
544 //int v8; // eax@3
0
Ritor1
parents:
diff changeset
545 signed int result; // eax@4
1799
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
546 //int v10; // eax@5
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
547 //int v11; // eax@5
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
548 //int v12; // ebx@5
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
549 //int v13; // edx@5
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
550 //int v14; // edi@5
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
551 //int v15; // ecx@5
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
552 //int v16; // eax@5
0
Ritor1
parents:
diff changeset
553 int v17; // eax@5
Ritor1
parents:
diff changeset
554 int v18; // eax@7
1799
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
555 //int v19; // edx@9
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
556 //int v20; // edi@9
0
Ritor1
parents:
diff changeset
557 int v21; // eax@9
Ritor1
parents:
diff changeset
558 int v22; // eax@11
1799
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
559 //int v23; // edx@13
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
560 //int v24; // eax@13
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
561 //int v25; // eax@14
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
562 //int v26; // eax@16
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
563 //int v27; // eax@17
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
564 //int v28; // [sp+14h] [bp+8h]@5
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
565
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
566 //v2 = this;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
567 int speed = 1 | integer_sqrt(this->velocity.z * this->velocity.z + this->velocity.y * this->velocity.y + this->velocity.x * this->velocity.x);
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
568
1799
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
569 this->direction.x = 65536 / speed * this->velocity.x;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
570 this->direction.y = 65536 / speed * this->velocity.y;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
571 this->direction.z = 65536 / speed * this->velocity.z;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
572
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
573 this->speed = speed;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
574 this->inv_speed = 65536 / speed;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
575
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
576 if (dt)
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
577 v7 = dt;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
578 else
0
Ritor1
parents:
diff changeset
579 v7 = pEventTimer->dt_in_some_format;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
580
1799
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
581 //v8 = fixpoint_mul(v7, speed) - this->field_70; // speed * dt - something
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
582 this->field_6C = fixpoint_mul(v7, speed) - this->field_70;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
583 if ( this->field_6C > 0 )
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
584 {
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
585 //v10 = fixpoint_mul(v8, this->direction.x) + this->normal.x;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
586 this->field_4C = fixpoint_mul(this->field_6C, this->direction.x) + this->normal.x;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
587 this->normal2.x = fixpoint_mul(this->field_6C, this->direction.x) + this->normal.x;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
588 //v11 = fixpoint_mul(this->field_6C, this->direction.y) + this->normal.y;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
589 this->field_50 = fixpoint_mul(this->field_6C, this->direction.y) + this->normal.y;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
590 this->normal2.y = fixpoint_mul(this->field_6C, this->direction.y) + this->normal.y;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
591 this->normal2.z = fixpoint_mul(this->field_6C, this->direction.z) + this->normal.z;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
592 //v12 = this->position.z;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
593 //v13 = this->normal.x;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
594 //v14 = this->normal2.x;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
595 //v15 = this->prolly_normal_d;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
596 //v16 = this->position.z + fixpoint_mul(this->field_6C, this->direction.z);
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
597 //v28 = this->position.z + fixpoint_mul(this->field_6C, this->direction.z);
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
598 this->field_54 = this->position.z + fixpoint_mul(this->field_6C, this->direction.z);
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
599 v17 = this->normal.x;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
600 if ( v17 >= this->normal2.x )
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
601 v17 = this->normal2.x;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
602 this->sMaxX = v17 - this->prolly_normal_d;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
603 v18 = this->prolly_normal_d + this->normal.x;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
604 if ( this->normal.x <= this->normal2.x )
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
605 v18 = this->prolly_normal_d + this->normal2.x;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
606 //v19 = this->normal.y;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
607 //v20 = this->normal2.y;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
608 this->sMinX = v18;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
609 v21 = this->normal.y;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
610 if ( v21 >= this->normal2.y )
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
611 v21 = this->normal2.y;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
612 this->sMaxY = v21 - this->prolly_normal_d;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
613 v22 = this->prolly_normal_d + this->normal.y;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
614 if ( this->normal.y <= this->normal2.y )
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
615 v22 = this->normal2.y + this->prolly_normal_d;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
616 //v23 = this->normal2.z;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
617 this->sMinY = v22;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
618 //v24 = this->normal.z;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
619 if ( this->normal.z >= this->normal2.z )
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
620 this->sMaxZ = this->normal2.z - this->prolly_normal_d;
0
Ritor1
parents:
diff changeset
621 else
1799
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
622 this->sMaxZ = this->normal.z - this->prolly_normal_d;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
623 //this->sMaxZ = v25;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
624 //v26 = this->field_8_radius;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
625 if ( this->position.z <= this->position.z + fixpoint_mul(this->field_6C, this->direction.z) )
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
626 this->sMinZ = (this->position.z + fixpoint_mul(this->field_6C, this->direction.z)) + this->field_8_radius;
0
Ritor1
parents:
diff changeset
627 else
1799
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
628 this->sMinZ = this->position.z + this->field_8_radius;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
629 this->uFaceID = 0;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
630 this->field_80 = -1;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
631 this->field_88 = -1;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
632 //this->sMinZ = v27;
dfafcd39c67b GetSpellColor, DrawSkyD3D()(continue)
Ritor1
parents: 1787
diff changeset
633 this->field_7C = 0xFFFFFFu;
0
Ritor1
parents:
diff changeset
634 result = 0;
Ritor1
parents:
diff changeset
635 }
Ritor1
parents:
diff changeset
636 else
Ritor1
parents:
diff changeset
637 {
Ritor1
parents:
diff changeset
638 result = 1;
Ritor1
parents:
diff changeset
639 }
Ritor1
parents:
diff changeset
640 return result;
Ritor1
parents:
diff changeset
641 }
Ritor1
parents:
diff changeset
642
Ritor1
parents:
diff changeset
643 //----- (004706C6) --------------------------------------------------------
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
644 void UpdateActors_ODM()
0
Ritor1
parents:
diff changeset
645 {
Ritor1
parents:
diff changeset
646 int v3; // ebx@6
Ritor1
parents:
diff changeset
647 int v5; // eax@10
Ritor1
parents:
diff changeset
648 int v6; // ecx@10
Ritor1
parents:
diff changeset
649 signed int v8; // ebx@17
Ritor1
parents:
diff changeset
650 unsigned __int8 v10; // sf@17
Ritor1
parents:
diff changeset
651 unsigned __int16 v11; // ax@21
Ritor1
parents:
diff changeset
652 __int16 v20; // ax@42
Ritor1
parents:
diff changeset
653 int v25; // eax@45
Ritor1
parents:
diff changeset
654 signed int v26; // ecx@50
Ritor1
parents:
diff changeset
655 int v28; // eax@54
Ritor1
parents:
diff changeset
656 signed int v29; // ebx@57
Ritor1
parents:
diff changeset
657 signed int v30; // eax@57
Ritor1
parents:
diff changeset
658 int v31; // edi@57
Ritor1
parents:
diff changeset
659 signed int i; // ebx@57
Ritor1
parents:
diff changeset
660 unsigned int v33; // ecx@58
Ritor1
parents:
diff changeset
661 int v35; // edi@64
Ritor1
parents:
diff changeset
662 int v36; // eax@64
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
663 unsigned int v39; // edi@71
2138
Ritor1
parents: 2065
diff changeset
664 ODMFace *face; // edi@75
0
Ritor1
parents:
diff changeset
665 int v46; // ecx@82
Ritor1
parents:
diff changeset
666 signed int v47; // ebx@85
Ritor1
parents:
diff changeset
667 int v48; // edi@85
Ritor1
parents:
diff changeset
668 int v55; // eax@107
Ritor1
parents:
diff changeset
669 unsigned int v56; // edi@107
Ritor1
parents:
diff changeset
670 int v57; // ST10_4@107
Ritor1
parents:
diff changeset
671 unsigned int v58; // edi@107
Ritor1
parents:
diff changeset
672 unsigned int v59; // ebx@107
Ritor1
parents:
diff changeset
673 signed int v60; // eax@107
Ritor1
parents:
diff changeset
674 int v61; // eax@124
Ritor1
parents:
diff changeset
675 Vec3_int_ v62; // [sp+Ch] [bp-44h]@42
153
86a2637ba125 UpdateActors
Ritor1
parents: 152
diff changeset
676 int v63; // [sp+18h] [bp-38h]@64
0
Ritor1
parents:
diff changeset
677 int v64; // [sp+1Ch] [bp-34h]@64
Ritor1
parents:
diff changeset
678 bool v67; // [sp+28h] [bp-28h]@10
Ritor1
parents:
diff changeset
679 unsigned int v69; // [sp+30h] [bp-20h]@6
Ritor1
parents:
diff changeset
680 unsigned int v70; // [sp+34h] [bp-1Ch]@10
Ritor1
parents:
diff changeset
681 int v71; // [sp+38h] [bp-18h]@62
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
682 int uIsAboveFloor; // [sp+3Ch] [bp-14h]@10
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
683 int v72b;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
684 //int v73; // [sp+40h] [bp-10h]@17
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
685 int uIsFlying; // [sp+44h] [bp-Ch]@8
0
Ritor1
parents:
diff changeset
686 unsigned int v75; // [sp+48h] [bp-8h]@1
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
687 int uIsOnWater; // [sp+4Ch] [bp-4h]@10
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
688
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
689 for (v75 = 0; v75 < uNumActors; ++v75)
0
Ritor1
parents:
diff changeset
690 {
2138
Ritor1
parents: 2065
diff changeset
691 if ( pActors[v75].uAIState == Removed || pActors[v75].uAIState == Disabled || pActors[v75].uAIState == Summoned
Ritor1
parents: 2065
diff changeset
692 || !pActors[v75].uMovementSpeed )
Ritor1
parents: 2065
diff changeset
693 continue;
0
Ritor1
parents:
diff changeset
694 v3 = 0;
Ritor1
parents:
diff changeset
695 v69 = 0;
2138
Ritor1
parents: 2065
diff changeset
696 if ( MonsterStats::BelongsToSupertype(pActors[v75].pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) )
0
Ritor1
parents:
diff changeset
697 v3 = 1;
2138
Ritor1
parents: 2065
diff changeset
698 pActors[v75].uSectorID = 0;
Ritor1
parents: 2065
diff changeset
699 uIsFlying = pActors[v75].pMonsterInfo.uFlying;
Ritor1
parents: 2065
diff changeset
700 if ( !pActors[v75].CanAct() )
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
701 uIsFlying = 0;
2138
Ritor1
parents: 2065
diff changeset
702 v70 = IsTerrainSlopeTooHigh(pActors[v75].vPosition.x, pActors[v75].vPosition.y);
Ritor1
parents: 2065
diff changeset
703 v5 = ODM_GetFloorLevel(pActors[v75].vPosition.x, pActors[v75].vPosition.y, pActors[v75].vPosition.z,
Ritor1
parents: 2065
diff changeset
704 pActors[v75].uActorHeight, &uIsOnWater, (int *)&v69, v3);
Ritor1
parents: 2065
diff changeset
705 v6 = pActors[v75].vPosition.z;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
706 uIsAboveFloor = 0;
0
Ritor1
parents:
diff changeset
707 v67 = v69 == 0;
Ritor1
parents:
diff changeset
708 if ( v6 > v5 + 1 )
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
709 uIsAboveFloor = 1;
2138
Ritor1
parents: 2065
diff changeset
710 if ( pActors[v75].uAIState == Dead && uIsOnWater && !uIsAboveFloor )
0
Ritor1
parents:
diff changeset
711 {
2138
Ritor1
parents: 2065
diff changeset
712 pActors[v75].uAIState = Removed;
Ritor1
parents: 2065
diff changeset
713 continue;
0
Ritor1
parents:
diff changeset
714 }
2138
Ritor1
parents: 2065
diff changeset
715 if ( pActors[v75].uCurrentActionAnimation == ANIM_Walking )
0
Ritor1
parents:
diff changeset
716 {
2138
Ritor1
parents: 2065
diff changeset
717 v8 = pActors[v75].uMovementSpeed;
Ritor1
parents: 2065
diff changeset
718 if ( (signed __int64)pActors[v75].pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 )
0
Ritor1
parents:
diff changeset
719 {
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
720 v8 = (signed __int64)((double)v8 * 0.5);
0
Ritor1
parents:
diff changeset
721 }
2138
Ritor1
parents: 2065
diff changeset
722 if ( pActors[v75].uAIState == Fleeing || pActors[v75].uAIState == Pursuing )
0
Ritor1
parents:
diff changeset
723 {
Ritor1
parents:
diff changeset
724 v8 *= 2;
Ritor1
parents:
diff changeset
725 }
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
726 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 1 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
727 v8 *= flt_6BE3AC_debug_recmod1_x_1_6;
0
Ritor1
parents:
diff changeset
728 if ( v8 > 1000 )
Ritor1
parents:
diff changeset
729 v8 = 1000;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
730
2138
Ritor1
parents: 2065
diff changeset
731 pActors[v75].vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(pActors[v75].uYawAngle), v8);
Ritor1
parents: 2065
diff changeset
732 pActors[v75].vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(pActors[v75].uYawAngle), v8);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
733 if ( uIsFlying )
0
Ritor1
parents:
diff changeset
734 {
2138
Ritor1
parents: 2065
diff changeset
735 pActors[v75].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pActors[v75].uPitchAngle), v8);
0
Ritor1
parents:
diff changeset
736 }
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
737 //v7 = v68;
0
Ritor1
parents:
diff changeset
738 }
Ritor1
parents:
diff changeset
739 else
Ritor1
parents:
diff changeset
740 {
2138
Ritor1
parents: 2065
diff changeset
741 pActors[v75].vVelocity.x = fixpoint_mul(55000, pActors[v75].vVelocity.x);
Ritor1
parents: 2065
diff changeset
742 pActors[v75].vVelocity.y = fixpoint_mul(55000, pActors[v75].vVelocity.y);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
743 if ( uIsFlying )
2138
Ritor1
parents: 2065
diff changeset
744 pActors[v75].vVelocity.z = fixpoint_mul(55000, pActors[v75].vVelocity.z);
0
Ritor1
parents:
diff changeset
745 }
2138
Ritor1
parents: 2065
diff changeset
746 if ( pActors[v75].vPosition.z < v5 )
0
Ritor1
parents:
diff changeset
747 {
2138
Ritor1
parents: 2065
diff changeset
748 pActors[v75].vPosition.z = v5;
Ritor1
parents: 2065
diff changeset
749 pActors[v75].vVelocity.z = uIsFlying != 0 ? 0x14 : 0;
0
Ritor1
parents:
diff changeset
750 }
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
751 //v17 = 0;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
752 if ( !uIsAboveFloor || uIsFlying )
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
753 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
754 if ( v70 && !uIsAboveFloor && v67 )
0
Ritor1
parents:
diff changeset
755 {
2138
Ritor1
parents: 2065
diff changeset
756 pActors[v75].vPosition.z = v5;
Ritor1
parents: 2065
diff changeset
757 ODM_GetTerrainNormalAt(pActors[v75].vPosition.x, pActors[v75].vPosition.y, &v62);
0
Ritor1
parents:
diff changeset
758 v20 = GetGravityStrength();
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
759 //v21 = v62.y;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
760 //v22 = v62.z;
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
761 //v23 = v62.y * v0->vVelocity.y;
2138
Ritor1
parents: 2065
diff changeset
762 pActors[v75].vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20;
Ritor1
parents: 2065
diff changeset
763 int v73 = abs(v62.x * pActors[v75].vVelocity.x + v62.z * pActors[v75].vVelocity.z + v62.y * pActors[v75].vVelocity.y) >> 16;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
764 //v72b = v21;
2138
Ritor1
parents: 2065
diff changeset
765 pActors[v75].vVelocity.x += fixpoint_mul(v73, v62.x);
Ritor1
parents: 2065
diff changeset
766 pActors[v75].vVelocity.y += fixpoint_mul(v73, v62.y);
Ritor1
parents: 2065
diff changeset
767 pActors[v75].vVelocity.z += fixpoint_mul(v73, v62.z);
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
768 //v17 = 0;
0
Ritor1
parents:
diff changeset
769 }
Ritor1
parents:
diff changeset
770 }
Ritor1
parents:
diff changeset
771 else
Ritor1
parents:
diff changeset
772 {
2138
Ritor1
parents: 2065
diff changeset
773 pActors[v75].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
0
Ritor1
parents:
diff changeset
774 }
2138
Ritor1
parents: 2065
diff changeset
775 if ( pParty->armageddon_timer != 0 && pActors[v75].CanAct() )
0
Ritor1
parents:
diff changeset
776 {
2138
Ritor1
parents: 2065
diff changeset
777 pActors[v75].vVelocity.x += rand() % 100 - 50;
Ritor1
parents: 2065
diff changeset
778 pActors[v75].vVelocity.y += rand() % 100 - 50;
Ritor1
parents: 2065
diff changeset
779 pActors[v75].vVelocity.z += rand() % 100 - 20;
0
Ritor1
parents:
diff changeset
780 v25 = rand();
2138
Ritor1
parents: 2065
diff changeset
781 pActors[v75].uAIState = Stunned;
Ritor1
parents: 2065
diff changeset
782 pActors[v75].uYawAngle += v25 % 32 - 16;
Ritor1
parents: 2065
diff changeset
783 pActors[v75].UpdateAnimation();
0
Ritor1
parents:
diff changeset
784 }
2138
Ritor1
parents: 2065
diff changeset
785 if ( pActors[v75].vVelocity.x * pActors[v75].vVelocity.x + pActors[v75].vVelocity.y * pActors[v75].vVelocity.y < 400 && v70 == 0 )
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
786 {
2138
Ritor1
parents: 2065
diff changeset
787 pActors[v75].vVelocity.y = 0;
Ritor1
parents: 2065
diff changeset
788 pActors[v75].vVelocity.x = 0;
0
Ritor1
parents:
diff changeset
789 }
Ritor1
parents:
diff changeset
790 stru_721530.field_0 = 1;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
791 if ( !uIsFlying )
0
Ritor1
parents:
diff changeset
792 v26 = 40;
Ritor1
parents:
diff changeset
793 else
2138
Ritor1
parents: 2065
diff changeset
794 v26 = pActors[v75].uActorRadius;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
795
0
Ritor1
parents:
diff changeset
796 stru_721530.field_84 = -1;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
797 stru_721530.field_8_radius = v26;
0
Ritor1
parents:
diff changeset
798 stru_721530.prolly_normal_d = v26;
2138
Ritor1
parents: 2065
diff changeset
799 stru_721530.height = pActors[v75].uActorHeight;
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
800 stru_721530.field_70 = 0;
2138
Ritor1
parents: 2065
diff changeset
801
Ritor1
parents: 2065
diff changeset
802 for ( v69 = 0; v69 < 100; ++v69 )
0
Ritor1
parents:
diff changeset
803 {
2138
Ritor1
parents: 2065
diff changeset
804 stru_721530.position.x = pActors[v75].vPosition.x;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
805 stru_721530.normal.x = stru_721530.position.x;
2138
Ritor1
parents: 2065
diff changeset
806 stru_721530.position.y = pActors[v75].vPosition.y;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
807 stru_721530.normal.y = stru_721530.position.y;
2138
Ritor1
parents: 2065
diff changeset
808 v28 = pActors[v75].vPosition.z;
0
Ritor1
parents:
diff changeset
809 stru_721530.normal.z = v28 + v26 + 1;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
810 stru_721530.position.z = v28 - v26 + stru_721530.height - 1;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
811 if ( stru_721530.position.z < stru_721530.normal.z )
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
812 stru_721530.position.z = v28 + v26 + 1;
2138
Ritor1
parents: 2065
diff changeset
813 stru_721530.velocity.x = pActors[v75].vVelocity.x;
0
Ritor1
parents:
diff changeset
814 stru_721530.uSectorID = 0;
2138
Ritor1
parents: 2065
diff changeset
815 stru_721530.velocity.y = pActors[v75].vVelocity.y;
Ritor1
parents: 2065
diff changeset
816 stru_721530.velocity.z = pActors[v75].vVelocity.z;
0
Ritor1
parents:
diff changeset
817 if ( stru_721530._47050A(0) )
Ritor1
parents:
diff changeset
818 break;
2138
Ritor1
parents: 2065
diff changeset
819 _46E889_collide_against_bmodels(1);
Ritor1
parents: 2065
diff changeset
820 v29 = WorldPosToGridCellZ(pActors[v75].vPosition.y);
Ritor1
parents: 2065
diff changeset
821 v30 = WorldPosToGridCellX(pActors[v75].vPosition.x);
0
Ritor1
parents:
diff changeset
822 _46E26D_collide_against_sprites(v30, v29);
Ritor1
parents:
diff changeset
823 _46EF01_collision_chech_player(0);
862
f4394e320312 * PID mistake fixed
zipi
parents: 861
diff changeset
824 _46ED8A_collide_against_sprite_objects(PID(OBJECT_Actor,v75));
0
Ritor1
parents:
diff changeset
825 v31 = 0;
Ritor1
parents:
diff changeset
826 for ( i = 0; v31 < ai_arrays_size; ++v31 )
Ritor1
parents:
diff changeset
827 {
390
35a62d1948d4 More sound fixes
Nomad
parents: 377
diff changeset
828 v33 = ai_near_actors_ids[v31];
1897
436553b0603c _46DF1A_collide_against_actor cleaned up, moved to Actor.h
Grumpy7
parents: 1861
diff changeset
829 if ( v33 != v75 && Actor::_46DF1A_collide_against_actor(v33, 40) )
0
Ritor1
parents:
diff changeset
830 ++i;
Ritor1
parents:
diff changeset
831 }
Ritor1
parents:
diff changeset
832 v71 = i > 1;
Ritor1
parents:
diff changeset
833 if ( stru_721530.field_7C < stru_721530.field_6C )
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
834 v70 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
835 //v34 = 0;
0
Ritor1
parents:
diff changeset
836 v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
2138
Ritor1
parents: 2065
diff changeset
837 v36 = ODM_GetFloorLevel(stru_721530.normal2.x, stru_721530.normal2.y,
0
Ritor1
parents:
diff changeset
838 stru_721530.normal2.z - stru_721530.prolly_normal_d - 1,
2138
Ritor1
parents: 2065
diff changeset
839 pActors[v75].uActorHeight, (int *)&v63, &v64, 0);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
840 if ( uIsOnWater )
0
Ritor1
parents:
diff changeset
841 {
Ritor1
parents:
diff changeset
842 if ( v35 < v36 + 60 )
Ritor1
parents:
diff changeset
843 {
2138
Ritor1
parents: 2065
diff changeset
844 if ( pActors[v75].uAIState == Dead || pActors[v75].uAIState == Dying || pActors[v75].uAIState == Removed
Ritor1
parents: 2065
diff changeset
845 || pActors[v75].uAIState == Disabled )
0
Ritor1
parents:
diff changeset
846 {
Ritor1
parents:
diff changeset
847 if ( v64 )
Ritor1
parents:
diff changeset
848 v61 = v36 + 30;
Ritor1
parents:
diff changeset
849 else
846
39503542470c UpdateActors_ODM cleaning 2
zipi
parents: 845
diff changeset
850 v61 = v5 + 60;
2138
Ritor1
parents: 2065
diff changeset
851 sub_42F960_create_object(pActors[v75].vPosition.x, pActors[v75].vPosition.y, v61);
Ritor1
parents: 2065
diff changeset
852 pActors[v75].uAIState = Removed;
0
Ritor1
parents:
diff changeset
853 return;
Ritor1
parents:
diff changeset
854 }
Ritor1
parents:
diff changeset
855 }
Ritor1
parents:
diff changeset
856 }
Ritor1
parents:
diff changeset
857 if ( stru_721530.field_7C >= stru_721530.field_6C )
Ritor1
parents:
diff changeset
858 {
2138
Ritor1
parents: 2065
diff changeset
859 pActors[v75].vPosition.x = LOWORD(stru_721530.normal2.x);
Ritor1
parents: 2065
diff changeset
860 pActors[v75].vPosition.y = LOWORD(stru_721530.normal2.y);
Ritor1
parents: 2065
diff changeset
861 pActors[v75].vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1;
0
Ritor1
parents:
diff changeset
862 break;
Ritor1
parents:
diff changeset
863 }
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
864 //v72b = fixpoint_mul(stru_721530.field_7C, stru_721530.field_58.x);
2138
Ritor1
parents: 2065
diff changeset
865 pActors[v75].vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
866 //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
2138
Ritor1
parents: 2065
diff changeset
867 pActors[v75].vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
868 //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
2138
Ritor1
parents: 2065
diff changeset
869 pActors[v75].vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
0
Ritor1
parents:
diff changeset
870 stru_721530.field_70 += stru_721530.field_7C;
2138
Ritor1
parents: 2065
diff changeset
871 v39 = PID_ID(stru_721530.uFaceID);
Ritor1
parents: 2065
diff changeset
872 switch ( PID_TYPE(stru_721530.uFaceID) )
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
873 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
874 case OBJECT_Actor:
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
875 if ( pTurnEngine->turn_stage != 2 && pTurnEngine->turn_stage != 3 || pParty->bTurnBasedModeOn != 1 )
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
876 {
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
877 //if(pParty->bTurnBasedModeOn == 1)
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
878 //v34 = 0;
2138
Ritor1
parents: 2065
diff changeset
879 if ( pActors[v75].pMonsterInfo.uHostilityType )
0
Ritor1
parents:
diff changeset
880 {
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
881 if ( v71 == 0 )
2138
Ritor1
parents: 2065
diff changeset
882 Actor::AI_Flee(v75, stru_721530.uFaceID, 0, (AIDirection *)0);
Ritor1
parents: 2065
diff changeset
883 else
Ritor1
parents: 2065
diff changeset
884 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0);
0
Ritor1
parents:
diff changeset
885 }
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
886 else if ( v71 )
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
887 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0);
2138
Ritor1
parents: 2065
diff changeset
888 else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly )
Ritor1
parents: 2065
diff changeset
889 Actor::AI_Flee(v75, stru_721530.uFaceID, 0, (AIDirection *)0);
Ritor1
parents: 2065
diff changeset
890 else
Ritor1
parents: 2065
diff changeset
891 Actor::AI_FaceObject(v75, stru_721530.uFaceID, 0, (AIDirection *)0);
0
Ritor1
parents:
diff changeset
892 }
Ritor1
parents:
diff changeset
893 break;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
894 case OBJECT_Player:
2138
Ritor1
parents: 2065
diff changeset
895 if ( !pActors[v75].GetActorsRelation(0) )
0
Ritor1
parents:
diff changeset
896 {
2138
Ritor1
parents: 2065
diff changeset
897 Actor::AI_FaceObject(v75, stru_721530.uFaceID, 0, (AIDirection *)0);
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
898 break;
0
Ritor1
parents:
diff changeset
899 }
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
900 //v52 = HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) == 0;
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
901 //v53 = SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) < 0;
2138
Ritor1
parents: 2065
diff changeset
902 pActors[v75].vVelocity.y = 0;
Ritor1
parents: 2065
diff changeset
903 pActors[v75].vVelocity.x = 0;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
904 //if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0) )
2138
Ritor1
parents: 2065
diff changeset
905 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime < 0)
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
906 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
0
Ritor1
parents:
diff changeset
907 viewparams->bRedrawGameUI = 1;
Ritor1
parents:
diff changeset
908 break;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
909 case OBJECT_Decoration:
2138
Ritor1
parents: 2065
diff changeset
910 v47 = integer_sqrt(pActors[v75].vVelocity.x * pActors[v75].vVelocity.x + pActors[v75].vVelocity.y * pActors[v75].vVelocity.y);
Ritor1
parents: 2065
diff changeset
911 v48 = stru_5C6E00->Atan2( pActors[v75].vPosition.x - pLevelDecorations[v39].vPosition.x,
Ritor1
parents: 2065
diff changeset
912 pActors[v75].vPosition.y - pLevelDecorations[v39].vPosition.y);
Ritor1
parents: 2065
diff changeset
913 //v49 = v48;
Ritor1
parents: 2065
diff changeset
914 pActors[v75].vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v48), v47);
Ritor1
parents: 2065
diff changeset
915 pActors[v75].vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v48), v47);
0
Ritor1
parents:
diff changeset
916 break;
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
917 case OBJECT_BModel:
2138
Ritor1
parents: 2065
diff changeset
918 face = &pOutdoor->pBModels[stru_721530.uFaceID >> 9].pFaces[v39 & 0x3F];
Ritor1
parents: 2065
diff changeset
919 if ( !face->Ethereal() )
0
Ritor1
parents:
diff changeset
920 {
2138
Ritor1
parents: 2065
diff changeset
921 if ( face->uPolygonType == 3 )
0
Ritor1
parents:
diff changeset
922 {
2138
Ritor1
parents: 2065
diff changeset
923 pActors[v75].vVelocity.z = 0;
Ritor1
parents: 2065
diff changeset
924 pActors[v75].vPosition.z = LOWORD(pOutdoor->pBModels[stru_721530.uFaceID >> 9].pVertices.pVertices[face->pVertexIDs[0]].z) + 1;
Ritor1
parents: 2065
diff changeset
925 if ( pActors[v75].vVelocity.x * pActors[v75].vVelocity.x
Ritor1
parents: 2065
diff changeset
926 + pActors[v75].vVelocity.y * pActors[v75].vVelocity.y < 400 )
0
Ritor1
parents:
diff changeset
927 {
2138
Ritor1
parents: 2065
diff changeset
928 pActors[v75].vVelocity.y = 0;
Ritor1
parents: 2065
diff changeset
929 pActors[v75].vVelocity.x = 0;
0
Ritor1
parents:
diff changeset
930 }
Ritor1
parents:
diff changeset
931 }
Ritor1
parents:
diff changeset
932 else
Ritor1
parents:
diff changeset
933 {
2138
Ritor1
parents: 2065
diff changeset
934 v72b = abs(face->pFacePlane.vNormal.y * pActors[v75].vVelocity.y + face->pFacePlane.vNormal.z * pActors[v75].vVelocity.z
Ritor1
parents: 2065
diff changeset
935 + face->pFacePlane.vNormal.x * pActors[v75].vVelocity.x) >> 16;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
936 if ( (stru_721530.speed >> 3) > v72b )
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
937 v72b = stru_721530.speed >> 3;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
938
2138
Ritor1
parents: 2065
diff changeset
939 pActors[v75].vVelocity.x += fixpoint_mul(v72b, face->pFacePlane.vNormal.x);
Ritor1
parents: 2065
diff changeset
940 pActors[v75].vVelocity.y += fixpoint_mul(v72b, face->pFacePlane.vNormal.y);
Ritor1
parents: 2065
diff changeset
941 pActors[v75].vVelocity.z += fixpoint_mul(v72b, face->pFacePlane.vNormal.z);
Ritor1
parents: 2065
diff changeset
942 if ( face->uPolygonType != 4 )
0
Ritor1
parents:
diff changeset
943 {
Ritor1
parents:
diff changeset
944 v46 = stru_721530.prolly_normal_d
2138
Ritor1
parents: 2065
diff changeset
945 - ((face->pFacePlane.dist
Ritor1
parents: 2065
diff changeset
946 + face->pFacePlane.vNormal.x * pActors[v75].vPosition.x
Ritor1
parents: 2065
diff changeset
947 + face->pFacePlane.vNormal.y * pActors[v75].vPosition.y
Ritor1
parents: 2065
diff changeset
948 + face->pFacePlane.vNormal.z * pActors[v75].vPosition.z) >> 16);
0
Ritor1
parents:
diff changeset
949 if ( v46 > 0 )
Ritor1
parents:
diff changeset
950 {
2138
Ritor1
parents: 2065
diff changeset
951 pActors[v75].vPosition.x += (unsigned int)(v46 * face->pFacePlane.vNormal.x) >> 16;
Ritor1
parents: 2065
diff changeset
952 pActors[v75].vPosition.y += (unsigned int)(v46 * face->pFacePlane.vNormal.y) >> 16;
Ritor1
parents: 2065
diff changeset
953 pActors[v75].vPosition.z += (unsigned int)(v46 * face->pFacePlane.vNormal.z) >> 16;
0
Ritor1
parents:
diff changeset
954 }
2138
Ritor1
parents: 2065
diff changeset
955 pActors[v75].uYawAngle = stru_5C6E00->Atan2(pActors[v75].vVelocity.x, pActors[v75].vVelocity.y);
0
Ritor1
parents:
diff changeset
956 }
Ritor1
parents:
diff changeset
957 }
Ritor1
parents:
diff changeset
958 }
Ritor1
parents:
diff changeset
959 break;
Ritor1
parents:
diff changeset
960 }
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
961
2138
Ritor1
parents: 2065
diff changeset
962 pActors[v75].vVelocity.x = fixpoint_mul(58500, pActors[v75].vVelocity.x);
Ritor1
parents: 2065
diff changeset
963 pActors[v75].vVelocity.y = fixpoint_mul(58500, pActors[v75].vVelocity.y);
Ritor1
parents: 2065
diff changeset
964 pActors[v75].vVelocity.z = fixpoint_mul(58500, pActors[v75].vVelocity.z);
Ritor1
parents: 2065
diff changeset
965
0
Ritor1
parents:
diff changeset
966 v26 = stru_721530.prolly_normal_d;
Ritor1
parents:
diff changeset
967 }
2138
Ritor1
parents: 2065
diff changeset
968
Ritor1
parents: 2065
diff changeset
969 v58 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(pActors[v75].vPosition.x), WorldPosToGridCellZ(pActors[v75].vPosition.y) - 1) >> 1) & 1;
Ritor1
parents: 2065
diff changeset
970 v59 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(pActors[v75].vPosition.x), WorldPosToGridCellZ(pActors[v75].vPosition.y) - 1) >> 1) & 1;
Ritor1
parents: 2065
diff changeset
971 if ( WorldPosToGridCellX(pActors[v75].vPosition.x) == WorldPosToGridCellX(pActors[v75].vPosition.x)
Ritor1
parents: 2065
diff changeset
972 && WorldPosToGridCellZ(pActors[v75].vPosition.y) == WorldPosToGridCellZ(pActors[v75].vPosition.y)
Ritor1
parents: 2065
diff changeset
973 && v58 || v67 != 0 )
0
Ritor1
parents:
diff changeset
974 {
2138
Ritor1
parents: 2065
diff changeset
975 if ( MonsterStats::BelongsToSupertype(pActors[v75].pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) )
0
Ritor1
parents:
diff changeset
976 {
Ritor1
parents:
diff changeset
977 v58 = v58 == 0;
Ritor1
parents:
diff changeset
978 v59 = v59 == 0;
Ritor1
parents:
diff changeset
979 }
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
980 if ( !uIsFlying && v58 && !v59 )
0
Ritor1
parents:
diff changeset
981 {
2138
Ritor1
parents: 2065
diff changeset
982 pActors[v75].vPosition.x = pActors[v75].vPosition.x;
Ritor1
parents: 2065
diff changeset
983 pActors[v75].vPosition.y = pActors[v75].vPosition.y;
Ritor1
parents: 2065
diff changeset
984 if ( pActors[v75].CanAct() )
0
Ritor1
parents:
diff changeset
985 {
2138
Ritor1
parents: 2065
diff changeset
986 pActors[v75].uYawAngle -= 32;
Ritor1
parents: 2065
diff changeset
987 pActors[v75].uCurrentActionTime = 0;
Ritor1
parents: 2065
diff changeset
988 pActors[v75].uCurrentActionLength = 128;
Ritor1
parents: 2065
diff changeset
989 pActors[v75].uAIState = Fleeing;
0
Ritor1
parents:
diff changeset
990 }
Ritor1
parents:
diff changeset
991 }
Ritor1
parents:
diff changeset
992 }
845
8f135b689262 UpdateActors_ODM cleaning
zipi
parents: 844
diff changeset
993 }
0
Ritor1
parents:
diff changeset
994 }
Ritor1
parents:
diff changeset
995
Ritor1
parents:
diff changeset
996 //----- (0047253E) --------------------------------------------------------
Ritor1
parents:
diff changeset
997 void UpdateObjects()
Ritor1
parents:
diff changeset
998 {
Ritor1
parents:
diff changeset
999 unsigned int v0; // ebx@0
Ritor1
parents:
diff changeset
1000 //unsigned int v1; // edi@1
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1001 //char *v2; // esi@2
0
Ritor1
parents:
diff changeset
1002 //__int16 v3; // dx@5
2138
Ritor1
parents: 2065
diff changeset
1003 ObjectDesc *object; // eax@5
0
Ritor1
parents:
diff changeset
1004 int v5; // ecx@6
Ritor1
parents:
diff changeset
1005 __int16 v6; // cx@7
Ritor1
parents:
diff changeset
1006 signed int v7; // eax@9
2138
Ritor1
parents: 2065
diff changeset
1007 //unsigned int v10; // ecx@16
0
Ritor1
parents:
diff changeset
1008 signed int v11; // eax@17
Ritor1
parents:
diff changeset
1009 int v12; // edi@27
Ritor1
parents:
diff changeset
1010 int v13; // eax@27
Ritor1
parents:
diff changeset
1011 int v14; // ebx@27
Ritor1
parents:
diff changeset
1012 unsigned int v15; // ecx@27
Ritor1
parents:
diff changeset
1013 unsigned int v16; // edx@30
Ritor1
parents:
diff changeset
1014 unsigned int v17; // edx@32
Ritor1
parents:
diff changeset
1015 int v18; // [sp+4h] [bp-10h]@27
Ritor1
parents:
diff changeset
1016 int v19; // [sp+8h] [bp-Ch]@27
Ritor1
parents:
diff changeset
1017 //signed int v20; // [sp+10h] [bp-4h]@1
Ritor1
parents:
diff changeset
1018
Ritor1
parents:
diff changeset
1019 //v1 = 0;
Ritor1
parents:
diff changeset
1020 //v20 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1021 for (uint i = 0; i < uNumSpriteObjects; ++i)
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1022 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
1023 SpriteObject* item = &pSpriteObjects[i];
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1024 //v2 = (char *)&item->uSpriteFrameID;
0
Ritor1
parents:
diff changeset
1025 //do
Ritor1
parents:
diff changeset
1026 //{
Ritor1
parents:
diff changeset
1027 //LOWORD(v0) = item->uAttributes;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1028 if (item->uAttributes & OBJECT_40)
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
1029 item->uAttributes &= ~OBJECT_40;
0
Ritor1
parents:
diff changeset
1030 else
Ritor1
parents:
diff changeset
1031 {
2138
Ritor1
parents: 2065
diff changeset
1032 object = &pObjectList->pObjects[item->uObjectDescID];
430
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 424
diff changeset
1033 if (item->AttachedToActor())
58b71c1af7d8 Objects are drawn (items, spells sfx)
Nomad
parents: 424
diff changeset
1034 {
848
ceef50611567 * AI fixed (temporary)
zipi
parents: 846
diff changeset
1035 v5 = PID_ID(item->spell_target_pid);
2138
Ritor1
parents: 2065
diff changeset
1036 item->vPosition.x = pActors[v5].vPosition.x;
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1037 item->vPosition.y = pActors[v5].vPosition.y;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1038 item->vPosition.z = pActors[v5].vPosition.z + pActors[v5].uActorHeight;
2138
Ritor1
parents: 2065
diff changeset
1039 if ( !item->uObjectDescID )
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1040 continue;
2138
Ritor1
parents: 2065
diff changeset
1041 item->uSpriteFrameID += pEventTimer->uTimeElapsed;
Ritor1
parents: 2065
diff changeset
1042 if ( !(object->uFlags & OBJECT_DESC_TEMPORARY))
Ritor1
parents: 2065
diff changeset
1043 continue;
Ritor1
parents: 2065
diff changeset
1044 if ( item->uSpriteFrameID >= 0 )
0
Ritor1
parents:
diff changeset
1045 {
2138
Ritor1
parents: 2065
diff changeset
1046 v7 = object->uLifetime;
Ritor1
parents: 2065
diff changeset
1047 if (item->uAttributes & ITEM_BROKEN)
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1048 v7 = item->field_20;
2138
Ritor1
parents: 2065
diff changeset
1049 if ( item->uSpriteFrameID < v7 )
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1050 continue;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1051 }
2138
Ritor1
parents: 2065
diff changeset
1052 SpriteObject::OnInteraction(i);
Ritor1
parents: 2065
diff changeset
1053 continue;
0
Ritor1
parents:
diff changeset
1054 }
Ritor1
parents:
diff changeset
1055
Ritor1
parents:
diff changeset
1056 if ( item->uObjectDescID )
Ritor1
parents:
diff changeset
1057 {
2138
Ritor1
parents: 2065
diff changeset
1058 item->uSpriteFrameID += pEventTimer->uTimeElapsed;
Ritor1
parents: 2065
diff changeset
1059 if ( object->uFlags & OBJECT_DESC_TEMPORARY )
Ritor1
parents: 2065
diff changeset
1060 {
Ritor1
parents: 2065
diff changeset
1061 if ( item->uSpriteFrameID < 0 )
Ritor1
parents: 2065
diff changeset
1062 {
Ritor1
parents: 2065
diff changeset
1063 SpriteObject::OnInteraction(i);
Ritor1
parents: 2065
diff changeset
1064 continue;
Ritor1
parents: 2065
diff changeset
1065 }
Ritor1
parents: 2065
diff changeset
1066 v11 = object->uLifetime;
Ritor1
parents: 2065
diff changeset
1067 if (item->uAttributes & ITEM_BROKEN)
Ritor1
parents: 2065
diff changeset
1068 v11 = item->field_20;
Ritor1
parents: 2065
diff changeset
1069 }
Ritor1
parents: 2065
diff changeset
1070 if ( !(object->uFlags & OBJECT_DESC_TEMPORARY) || item->uSpriteFrameID < v11 )
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1071 {
0
Ritor1
parents:
diff changeset
1072 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1073 SpriteObject::UpdateObject_fn0_BLV(i);
0
Ritor1
parents:
diff changeset
1074 else
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
1075 SpriteObject::UpdateObject_fn0_ODM(i);
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1076 if ( pParty->bTurnBasedModeOn != 1 || !(item->uSectorID & 4) )
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1077 continue;
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1078 v12 = abs(pParty->vPosition.x - item->vPosition.x);
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1079 v18 = abs(pParty->vPosition.y - item->vPosition.y);
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1080 v19 = abs(pParty->vPosition.z - item->vPosition.z);
0
Ritor1
parents:
diff changeset
1081 v13 = v12;
Ritor1
parents:
diff changeset
1082 v14 = v18;
Ritor1
parents:
diff changeset
1083 v15 = v19;
Ritor1
parents:
diff changeset
1084 if ( v12 < v18 )
Ritor1
parents:
diff changeset
1085 {
Ritor1
parents:
diff changeset
1086 v13 = v18;
Ritor1
parents:
diff changeset
1087 v14 = v12;
Ritor1
parents:
diff changeset
1088 }
Ritor1
parents:
diff changeset
1089 if ( v13 < v19 )
Ritor1
parents:
diff changeset
1090 {
Ritor1
parents:
diff changeset
1091 v16 = v13;
Ritor1
parents:
diff changeset
1092 v13 = v19;
Ritor1
parents:
diff changeset
1093 v15 = v16;
Ritor1
parents:
diff changeset
1094 }
Ritor1
parents:
diff changeset
1095 if ( v14 < (signed int)v15 )
Ritor1
parents:
diff changeset
1096 {
Ritor1
parents:
diff changeset
1097 v17 = v15;
Ritor1
parents:
diff changeset
1098 v15 = v14;
Ritor1
parents:
diff changeset
1099 v14 = v17;
Ritor1
parents:
diff changeset
1100 }
Ritor1
parents:
diff changeset
1101 v0 = (unsigned int)(11 * v14) >> 5;
Ritor1
parents:
diff changeset
1102 if ( (signed int)(v0 + (v15 >> 2) + v13) <= 5120 )
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1103 continue;
2138
Ritor1
parents: 2065
diff changeset
1104 SpriteObject::OnInteraction(i);
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1105 continue;
0
Ritor1
parents:
diff changeset
1106 }
2138
Ritor1
parents: 2065
diff changeset
1107 if ( !(object->uFlags & OBJECT_DESC_INTERACTABLE) )
Ritor1
parents: 2065
diff changeset
1108 {
Ritor1
parents: 2065
diff changeset
1109 SpriteObject::OnInteraction(i);
1083
ddf53a2d0bf5 pointer cleaning
zipi
parents: 1080
diff changeset
1110 continue;
2138
Ritor1
parents: 2065
diff changeset
1111 }
862
f4394e320312 * PID mistake fixed
zipi
parents: 861
diff changeset
1112 _46BFFA_check_object_intercept(i, PID(OBJECT_Item,i));
0
Ritor1
parents:
diff changeset
1113 }
Ritor1
parents:
diff changeset
1114 }
Ritor1
parents:
diff changeset
1115 }
Ritor1
parents:
diff changeset
1116 }
Ritor1
parents:
diff changeset
1117
Ritor1
parents:
diff changeset
1118 //----- (0047272C) --------------------------------------------------------
831
9c3f28b31b4a Party actions in blv
Nomad
parents: 829
diff changeset
1119 int collide_against_floor_approximate(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID)
0
Ritor1
parents:
diff changeset
1120 {
Ritor1
parents:
diff changeset
1121 signed int v5; // ebx@1
Ritor1
parents:
diff changeset
1122 int result; // eax@1
Ritor1
parents:
diff changeset
1123 int v7; // [sp+10h] [bp-8h]@1
Ritor1
parents:
diff changeset
1124 signed int v8; // [sp+14h] [bp-4h]@1
Ritor1
parents:
diff changeset
1125
Ritor1
parents:
diff changeset
1126 v5 = x - 2;
Ritor1
parents:
diff changeset
1127 v7 = x;
Ritor1
parents:
diff changeset
1128 v8 = y;
Ritor1
parents:
diff changeset
1129 *pSectorID = pIndoor->GetSector(x - 2, y, z + 40);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1130 result = collide_against_floor(v5, v8, z + 40, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1131 if ( result == -30000 || !*pSectorID )
Ritor1
parents:
diff changeset
1132 {
Ritor1
parents:
diff changeset
1133 *pSectorID = pIndoor->GetSector(v7 + 2, v8, z + 40);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1134 result = collide_against_floor(v7 + 2, v8, z + 40, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1135 if ( result == -30000 || !*pSectorID )
Ritor1
parents:
diff changeset
1136 {
Ritor1
parents:
diff changeset
1137 *pSectorID = pIndoor->GetSector(v7, v8 - 2, z + 40);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1138 result = collide_against_floor(v7, v8 - 2, z + 40, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1139 if ( result == -30000 || !*pSectorID )
Ritor1
parents:
diff changeset
1140 {
Ritor1
parents:
diff changeset
1141 *pSectorID = pIndoor->GetSector(v7, v8 + 2, z + 40);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1142 result = collide_against_floor(v7, v8 + 2, z + 40, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1143 if ( result == -30000 || !*pSectorID )
Ritor1
parents:
diff changeset
1144 {
Ritor1
parents:
diff changeset
1145 *pSectorID = pIndoor->GetSector(v7, v8, z + 140);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
1146 result = collide_against_floor(v7, v8, z + 140, pSectorID, pFaceID);
0
Ritor1
parents:
diff changeset
1147 }
Ritor1
parents:
diff changeset
1148 }
Ritor1
parents:
diff changeset
1149 }
Ritor1
parents:
diff changeset
1150 }
Ritor1
parents:
diff changeset
1151 return result;
Ritor1
parents:
diff changeset
1152 }
Ritor1
parents:
diff changeset
1153
2138
Ritor1
parents: 2065
diff changeset
1154 //----- (0047531C) --------------------------------------------------------
Ritor1
parents: 2065
diff changeset
1155 bool sub_47531C(int a1, int *a2, int pos_x, int pos_y, int pos_z, int dir_x, int dir_y, int dir_z, BLVFace *face, int a10)
0
Ritor1
parents:
diff changeset
1156 {
Ritor1
parents:
diff changeset
1157 int v11; // ST1C_4@3
Ritor1
parents:
diff changeset
1158 int v12; // edi@3
Ritor1
parents:
diff changeset
1159 int v13; // esi@3
Ritor1
parents:
diff changeset
1160 int v14; // edi@4
Ritor1
parents:
diff changeset
1161 signed __int64 v15; // qtt@6
Ritor1
parents:
diff changeset
1162 __int16 v16; // si@7
Ritor1
parents:
diff changeset
1163 int a7a; // [sp+30h] [bp+18h]@7
Ritor1
parents:
diff changeset
1164 int a9b; // [sp+38h] [bp+20h]@3
Ritor1
parents:
diff changeset
1165 int a9a; // [sp+38h] [bp+20h]@3
Ritor1
parents:
diff changeset
1166 int a10b; // [sp+3Ch] [bp+24h]@3
Ritor1
parents:
diff changeset
1167 signed int a10a; // [sp+3Ch] [bp+24h]@4
Ritor1
parents:
diff changeset
1168 int a10c; // [sp+3Ch] [bp+24h]@5
Ritor1
parents:
diff changeset
1169
2138
Ritor1
parents: 2065
diff changeset
1170 if ( a10 && face->Ethereal() )
0
Ritor1
parents:
diff changeset
1171 return 0;
2138
Ritor1
parents: 2065
diff changeset
1172 v11 = (unsigned __int64)(dir_x * (signed __int64)face->pFacePlane_old.vNormal.x) >> 16;
Ritor1
parents: 2065
diff changeset
1173 a10b = (unsigned __int64)(dir_y * (signed __int64)face->pFacePlane_old.vNormal.y) >> 16;
Ritor1
parents: 2065
diff changeset
1174 a9b = (unsigned __int64)(dir_z * (signed __int64)face->pFacePlane_old.vNormal.z) >> 16;
0
Ritor1
parents:
diff changeset
1175 v12 = v11 + a9b + a10b;
Ritor1
parents:
diff changeset
1176 a9a = v11 + a9b + a10b;
Ritor1
parents:
diff changeset
1177 v13 = (a1 << 16)
2138
Ritor1
parents: 2065
diff changeset
1178 - pos_x * face->pFacePlane_old.vNormal.x
Ritor1
parents: 2065
diff changeset
1179 - pos_y * face->pFacePlane_old.vNormal.y
Ritor1
parents: 2065
diff changeset
1180 - pos_z * face->pFacePlane_old.vNormal.z
Ritor1
parents: 2065
diff changeset
1181 - face->pFacePlane_old.dist;
0
Ritor1
parents:
diff changeset
1182 if ( abs((a1 << 16)
2138
Ritor1
parents: 2065
diff changeset
1183 - pos_x * face->pFacePlane_old.vNormal.x
Ritor1
parents: 2065
diff changeset
1184 - pos_y * face->pFacePlane_old.vNormal.y
Ritor1
parents: 2065
diff changeset
1185 - pos_z * face->pFacePlane_old.vNormal.z - face->pFacePlane_old.dist) >= a1 << 16 )
0
Ritor1
parents:
diff changeset
1186 {
Ritor1
parents:
diff changeset
1187 a10c = abs(v13) >> 14;
Ritor1
parents:
diff changeset
1188 if ( a10c > abs(v12) )
Ritor1
parents:
diff changeset
1189 return 0;
Ritor1
parents:
diff changeset
1190 LODWORD(v15) = v13 << 16;
Ritor1
parents:
diff changeset
1191 HIDWORD(v15) = v13 >> 16;
2138
Ritor1
parents: 2065
diff changeset
1192 v14 = a1;
0
Ritor1
parents:
diff changeset
1193 a10a = v15 / a9a;
Ritor1
parents:
diff changeset
1194 }
Ritor1
parents:
diff changeset
1195 else
Ritor1
parents:
diff changeset
1196 {
Ritor1
parents:
diff changeset
1197 a10a = 0;
Ritor1
parents:
diff changeset
1198 v14 = abs(v13) >> 16;
Ritor1
parents:
diff changeset
1199 }
2138
Ritor1
parents: 2065
diff changeset
1200 v16 = pos_y + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)dir_y) >> 16) >> 16);
Ritor1
parents: 2065
diff changeset
1201 LOWORD(a7a) = (short)pos_x
Ritor1
parents: 2065
diff changeset
1202 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)dir_x) >> 16) >> 16)
Ritor1
parents: 2065
diff changeset
1203 - ((unsigned int)(v14 * face->pFacePlane_old.vNormal.x) >> 16);
Ritor1
parents: 2065
diff changeset
1204 HIWORD(a7a) = v16 - ((unsigned int)(v14 * face->pFacePlane_old.vNormal.y) >> 16);
Ritor1
parents: 2065
diff changeset
1205 if ( !sub_475665(face, a7a, (short)pos_z + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)dir_z) >> 16) >> 16)
Ritor1
parents: 2065
diff changeset
1206 - ((unsigned int)(v14 * face->pFacePlane_old.vNormal.z) >> 16)) )
0
Ritor1
parents:
diff changeset
1207 return 0;
2138
Ritor1
parents: 2065
diff changeset
1208 *a2 = a10a >> 16;
0
Ritor1
parents:
diff changeset
1209 if ( a10a >> 16 < 0 )
2138
Ritor1
parents: 2065
diff changeset
1210 *a2 = 0;
0
Ritor1
parents:
diff changeset
1211 return 1;
Ritor1
parents:
diff changeset
1212 }
Ritor1
parents:
diff changeset
1213
Ritor1
parents:
diff changeset
1214 //----- (004754BF) --------------------------------------------------------
2138
Ritor1
parents: 2065
diff changeset
1215 bool sub_4754BF(int a1, int *a2, int X, int Y, int Z, int dir_x, int dir_y, int dir_z, BLVFace *face, int a10, int a11)
0
Ritor1
parents:
diff changeset
1216 {
Ritor1
parents:
diff changeset
1217 int v12; // ST1C_4@3
Ritor1
parents:
diff changeset
1218 int v13; // edi@3
Ritor1
parents:
diff changeset
1219 int v14; // esi@3
Ritor1
parents:
diff changeset
1220 int v15; // edi@4
Ritor1
parents:
diff changeset
1221 signed __int64 v16; // qtt@6
Ritor1
parents:
diff changeset
1222 __int16 v17; // si@7
Ritor1
parents:
diff changeset
1223 int a7a; // [sp+30h] [bp+18h]@7
Ritor1
parents:
diff changeset
1224 int a1b; // [sp+38h] [bp+20h]@3
Ritor1
parents:
diff changeset
1225 int a1a; // [sp+38h] [bp+20h]@3
Ritor1
parents:
diff changeset
1226 int a11b; // [sp+40h] [bp+28h]@3
Ritor1
parents:
diff changeset
1227 signed int a11a; // [sp+40h] [bp+28h]@4
Ritor1
parents:
diff changeset
1228 int a11c; // [sp+40h] [bp+28h]@5
Ritor1
parents:
diff changeset
1229
2138
Ritor1
parents: 2065
diff changeset
1230 if ( a11 && face->Ethereal() )
Ritor1
parents: 2065
diff changeset
1231 return false;
Ritor1
parents: 2065
diff changeset
1232 v12 = (unsigned __int64)(dir_x * (signed __int64)face->pFacePlane_old.vNormal.x) >> 16;
Ritor1
parents: 2065
diff changeset
1233 a11b = (unsigned __int64)(dir_y * (signed __int64)face->pFacePlane_old.vNormal.y) >> 16;
Ritor1
parents: 2065
diff changeset
1234 a1b = (unsigned __int64)(dir_z * (signed __int64)face->pFacePlane_old.vNormal.z) >> 16;
0
Ritor1
parents:
diff changeset
1235 v13 = v12 + a1b + a11b;
Ritor1
parents:
diff changeset
1236 a1a = v12 + a1b + a11b;
Ritor1
parents:
diff changeset
1237 v14 = (a1 << 16)
2138
Ritor1
parents: 2065
diff changeset
1238 - X * face->pFacePlane_old.vNormal.x
Ritor1
parents: 2065
diff changeset
1239 - Y * face->pFacePlane_old.vNormal.y
Ritor1
parents: 2065
diff changeset
1240 - Z * face->pFacePlane_old.vNormal.z
Ritor1
parents: 2065
diff changeset
1241 - face->pFacePlane_old.dist;
0
Ritor1
parents:
diff changeset
1242 if ( abs((a1 << 16)
2138
Ritor1
parents: 2065
diff changeset
1243 - X * face->pFacePlane_old.vNormal.x
Ritor1
parents: 2065
diff changeset
1244 - Y * face->pFacePlane_old.vNormal.y
Ritor1
parents: 2065
diff changeset
1245 - Z * face->pFacePlane_old.vNormal.z - face->pFacePlane_old.dist) >= a1 << 16 )
0
Ritor1
parents:
diff changeset
1246 {
Ritor1
parents:
diff changeset
1247 a11c = abs(v14) >> 14;
Ritor1
parents:
diff changeset
1248 if ( a11c > abs(v13) )
2138
Ritor1
parents: 2065
diff changeset
1249 return false;
0
Ritor1
parents:
diff changeset
1250 LODWORD(v16) = v14 << 16;
Ritor1
parents:
diff changeset
1251 HIDWORD(v16) = v14 >> 16;
2138
Ritor1
parents: 2065
diff changeset
1252 v15 = a1;
0
Ritor1
parents:
diff changeset
1253 a11a = v16 / a1a;
Ritor1
parents:
diff changeset
1254 }
Ritor1
parents:
diff changeset
1255 else
Ritor1
parents:
diff changeset
1256 {
Ritor1
parents:
diff changeset
1257 a11a = 0;
Ritor1
parents:
diff changeset
1258 v15 = abs(v14) >> 16;
Ritor1
parents:
diff changeset
1259 }
2138
Ritor1
parents: 2065
diff changeset
1260 v17 = Y + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)dir_y) >> 16) >> 16);
Ritor1
parents: 2065
diff changeset
1261 LOWORD(a7a) = (short)X
Ritor1
parents: 2065
diff changeset
1262 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)dir_x) >> 16) >> 16)
Ritor1
parents: 2065
diff changeset
1263 - ((unsigned int)(v15 * face->pFacePlane_old.vNormal.x) >> 16);
Ritor1
parents: 2065
diff changeset
1264 HIWORD(a7a) = v17 - ((unsigned int)(v15 * face->pFacePlane_old.vNormal.y) >> 16);
Ritor1
parents: 2065
diff changeset
1265 if ( !sub_4759C9(face, a10, a7a, (short)Z + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)dir_z) >> 16) >> 16)
Ritor1
parents: 2065
diff changeset
1266 - ((unsigned int)(v15 * face->pFacePlane_old.vNormal.z) >> 16)) )
Ritor1
parents: 2065
diff changeset
1267 return false;
Ritor1
parents: 2065
diff changeset
1268 *a2 = a11a >> 16;
0
Ritor1
parents:
diff changeset
1269 if ( a11a >> 16 < 0 )
2138
Ritor1
parents: 2065
diff changeset
1270 *a2 = 0;
Ritor1
parents: 2065
diff changeset
1271 return true;
0
Ritor1
parents:
diff changeset
1272 }
Ritor1
parents:
diff changeset
1273
Ritor1
parents:
diff changeset
1274 //----- (00475665) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
1275 int sub_475665(BLVFace *_this, int a2, __int16 a3)
0
Ritor1
parents:
diff changeset
1276 {
Ritor1
parents:
diff changeset
1277 unsigned int v3; // eax@1
Ritor1
parents:
diff changeset
1278 Vec3_short_ *v4; // edx@3
Ritor1
parents:
diff changeset
1279 signed int v5; // eax@4
Ritor1
parents:
diff changeset
1280 int v6; // esi@4
Ritor1
parents:
diff changeset
1281 signed int v7; // eax@7
Ritor1
parents:
diff changeset
1282 Vec3_short_ *v8; // edx@8
Ritor1
parents:
diff changeset
1283 signed int v9; // eax@9
Ritor1
parents:
diff changeset
1284 int v10; // esi@9
Ritor1
parents:
diff changeset
1285 signed int v11; // eax@11
Ritor1
parents:
diff changeset
1286 Vec3_short_ *v12; // edx@12
Ritor1
parents:
diff changeset
1287 signed int v13; // eax@13
Ritor1
parents:
diff changeset
1288 int v14; // esi@13
Ritor1
parents:
diff changeset
1289 int v15; // esi@14
Ritor1
parents:
diff changeset
1290 bool v16; // edi@14
Ritor1
parents:
diff changeset
1291 int v17; // ecx@16
Ritor1
parents:
diff changeset
1292 signed int v18; // edx@16
Ritor1
parents:
diff changeset
1293 int v19; // eax@17
Ritor1
parents:
diff changeset
1294 signed int v20; // ebx@18
Ritor1
parents:
diff changeset
1295 int v21; // edi@20
Ritor1
parents:
diff changeset
1296 signed int v22; // ST14_4@22
Ritor1
parents:
diff changeset
1297 signed __int64 v23; // qtt@22
Ritor1
parents:
diff changeset
1298 signed int result; // eax@25
Ritor1
parents:
diff changeset
1299 int v25; // [sp+14h] [bp-10h]@14
Ritor1
parents:
diff changeset
1300 int v26; // [sp+1Ch] [bp-8h]@2
Ritor1
parents:
diff changeset
1301 signed int v27; // [sp+20h] [bp-4h]@2
Ritor1
parents:
diff changeset
1302 signed int v28; // [sp+30h] [bp+Ch]@2
Ritor1
parents:
diff changeset
1303 signed int v29; // [sp+30h] [bp+Ch]@7
Ritor1
parents:
diff changeset
1304 signed int v30; // [sp+30h] [bp+Ch]@11
Ritor1
parents:
diff changeset
1305 signed int v31; // [sp+30h] [bp+Ch]@14
Ritor1
parents:
diff changeset
1306
Ritor1
parents:
diff changeset
1307 v3 = _this->uAttributes;
Ritor1
parents:
diff changeset
1308 if ( BYTE1(v3) & 1 )
Ritor1
parents:
diff changeset
1309 {
Ritor1
parents:
diff changeset
1310 v28 = 0;
Ritor1
parents:
diff changeset
1311 v26 = (signed __int16)a2;
Ritor1
parents:
diff changeset
1312 v27 = SHIWORD(a2);
Ritor1
parents:
diff changeset
1313 if ( _this->uNumVertices )
Ritor1
parents:
diff changeset
1314 {
Ritor1
parents:
diff changeset
1315 v4 = pIndoor->pVertices;
Ritor1
parents:
diff changeset
1316 do
Ritor1
parents:
diff changeset
1317 {
Ritor1
parents:
diff changeset
1318 v5 = v28;
Ritor1
parents:
diff changeset
1319 v6 = 2 * v28;
Ritor1
parents:
diff changeset
1320 word_720C10_intercepts_xs[2 * v28] = _this->pXInterceptDisplacements[v28] + v4[_this->pVertexIDs[v28]].x;
Ritor1
parents:
diff changeset
1321 word_720B40_intercepts_zs[2 * v28] = _this->pYInterceptDisplacements[v5] + v4[_this->pVertexIDs[v5]].y;
Ritor1
parents:
diff changeset
1322 word_720C10_intercepts_xs[2 * v28++ + 1] = _this->pXInterceptDisplacements[v5 + 1]
Ritor1
parents:
diff changeset
1323 + v4[_this->pVertexIDs[v5 + 1]].x;
Ritor1
parents:
diff changeset
1324 word_720B40_intercepts_zs[v6 + 1] = _this->pYInterceptDisplacements[v5 + 1] + v4[_this->pVertexIDs[v5 + 1]].y;
Ritor1
parents:
diff changeset
1325 }
Ritor1
parents:
diff changeset
1326 while ( v28 < _this->uNumVertices );
Ritor1
parents:
diff changeset
1327 }
Ritor1
parents:
diff changeset
1328 }
Ritor1
parents:
diff changeset
1329 else
Ritor1
parents:
diff changeset
1330 {
Ritor1
parents:
diff changeset
1331 if ( BYTE1(v3) & 2 )
Ritor1
parents:
diff changeset
1332 {
Ritor1
parents:
diff changeset
1333 v26 = (signed __int16)a2;
Ritor1
parents:
diff changeset
1334 v7 = a3;
Ritor1
parents:
diff changeset
1335 v29 = 0;
Ritor1
parents:
diff changeset
1336 v27 = v7;
Ritor1
parents:
diff changeset
1337 if ( _this->uNumVertices )
Ritor1
parents:
diff changeset
1338 {
Ritor1
parents:
diff changeset
1339 v8 = pIndoor->pVertices;
Ritor1
parents:
diff changeset
1340 do
Ritor1
parents:
diff changeset
1341 {
Ritor1
parents:
diff changeset
1342 v9 = v29;
Ritor1
parents:
diff changeset
1343 v10 = 2 * v29;
Ritor1
parents:
diff changeset
1344 word_720C10_intercepts_xs[2 * v29] = _this->pXInterceptDisplacements[v29] + v8[_this->pVertexIDs[v29]].x;
Ritor1
parents:
diff changeset
1345 word_720B40_intercepts_zs[2 * v29] = _this->pZInterceptDisplacements[v9] + v8[_this->pVertexIDs[v9]].z;
Ritor1
parents:
diff changeset
1346 word_720C10_intercepts_xs[2 * v29++ + 1] = _this->pXInterceptDisplacements[v9 + 1] + v8[_this->pVertexIDs[v9 + 1]].x;
Ritor1
parents:
diff changeset
1347 word_720B40_intercepts_zs[v10 + 1] = _this->pZInterceptDisplacements[v9 + 1] + v8[_this->pVertexIDs[v9 + 1]].z;
Ritor1
parents:
diff changeset
1348 }
Ritor1
parents:
diff changeset
1349 while ( v29 < _this->uNumVertices );
Ritor1
parents:
diff changeset
1350 }
Ritor1
parents:
diff changeset
1351 }
Ritor1
parents:
diff changeset
1352 else
Ritor1
parents:
diff changeset
1353 {
Ritor1
parents:
diff changeset
1354 v26 = SHIWORD(a2);
Ritor1
parents:
diff changeset
1355 v11 = a3;
Ritor1
parents:
diff changeset
1356 v30 = 0;
Ritor1
parents:
diff changeset
1357 v27 = v11;
Ritor1
parents:
diff changeset
1358 if ( _this->uNumVertices )
Ritor1
parents:
diff changeset
1359 {
Ritor1
parents:
diff changeset
1360 v12 = pIndoor->pVertices;
Ritor1
parents:
diff changeset
1361 do
Ritor1
parents:
diff changeset
1362 {
Ritor1
parents:
diff changeset
1363 v13 = v30;
Ritor1
parents:
diff changeset
1364 v14 = 2 * v30;
Ritor1
parents:
diff changeset
1365 word_720C10_intercepts_xs[2 * v30] = _this->pYInterceptDisplacements[v30] + v12[_this->pVertexIDs[v30]].y;
Ritor1
parents:
diff changeset
1366 word_720B40_intercepts_zs[2 * v30] = _this->pZInterceptDisplacements[v13] + v12[_this->pVertexIDs[v13]].z;
Ritor1
parents:
diff changeset
1367 word_720C10_intercepts_xs[2 * v30++ + 1] = _this->pYInterceptDisplacements[v13 + 1] + v12[_this->pVertexIDs[v13 + 1]].y;
Ritor1
parents:
diff changeset
1368 word_720B40_intercepts_zs[v14 + 1] = _this->pZInterceptDisplacements[v13 + 1] + v12[_this->pVertexIDs[v13 + 1]].z;
Ritor1
parents:
diff changeset
1369 }
Ritor1
parents:
diff changeset
1370 while ( v30 < _this->uNumVertices );
Ritor1
parents:
diff changeset
1371 }
Ritor1
parents:
diff changeset
1372 }
Ritor1
parents:
diff changeset
1373 }
Ritor1
parents:
diff changeset
1374 v15 = 2 * _this->uNumVertices;
Ritor1
parents:
diff changeset
1375 v31 = 0;
Ritor1
parents:
diff changeset
1376 word_720C10_intercepts_xs[2 * _this->uNumVertices] = word_720C10_intercepts_xs[0];
Ritor1
parents:
diff changeset
1377 word_720B40_intercepts_zs[v15] = word_720B40_intercepts_zs[0];
Ritor1
parents:
diff changeset
1378 v25 = 0;
Ritor1
parents:
diff changeset
1379 v16 = word_720B40_intercepts_zs[0] >= v27;
Ritor1
parents:
diff changeset
1380 if ( v15 <= 0 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1381 return 0;
0
Ritor1
parents:
diff changeset
1382 do
Ritor1
parents:
diff changeset
1383 {
Ritor1
parents:
diff changeset
1384 if ( v31 >= 2 )
Ritor1
parents:
diff changeset
1385 break;
Ritor1
parents:
diff changeset
1386 v17 = v25;
Ritor1
parents:
diff changeset
1387 v18 = word_720B40_intercepts_zs[v25 + 1];
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
1388 if ( v16 ^ (v18 >= v27) )
0
Ritor1
parents:
diff changeset
1389 {
Ritor1
parents:
diff changeset
1390 v19 = word_720C10_intercepts_xs[v17 + 1];
Ritor1
parents:
diff changeset
1391 if ( v19 >= v26 )
Ritor1
parents:
diff changeset
1392 v20 = 0;
Ritor1
parents:
diff changeset
1393 else
Ritor1
parents:
diff changeset
1394 v20 = 2;
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
1395 v21 = v20 | (word_720C10_intercepts_xs[v17] < v26);
0
Ritor1
parents:
diff changeset
1396 if ( v21 != 3 )
Ritor1
parents:
diff changeset
1397 {
Ritor1
parents:
diff changeset
1398 if ( !v21
Ritor1
parents:
diff changeset
1399 || (v22 = v19 - word_720C10_intercepts_xs[v17],
Ritor1
parents:
diff changeset
1400 LODWORD(v23) = v22 << 16,
Ritor1
parents:
diff changeset
1401 HIDWORD(v23) = v22 >> 16,
Ritor1
parents:
diff changeset
1402 word_720C10_intercepts_xs[v17]
Ritor1
parents:
diff changeset
1403 + ((signed int)(((unsigned __int64)(v23
Ritor1
parents:
diff changeset
1404 / (v18 - word_720B40_intercepts_zs[v17])
Ritor1
parents:
diff changeset
1405 * ((v27 - (signed int)word_720B40_intercepts_zs[v17]) << 16)) >> 16)
Ritor1
parents:
diff changeset
1406 + 32768) >> 16) >= v26) )
Ritor1
parents:
diff changeset
1407 ++v31;
Ritor1
parents:
diff changeset
1408 }
Ritor1
parents:
diff changeset
1409 }
Ritor1
parents:
diff changeset
1410 ++v25;
Ritor1
parents:
diff changeset
1411 v16 = v18 >= v27;
Ritor1
parents:
diff changeset
1412 }
Ritor1
parents:
diff changeset
1413 while ( v25 < v15 );
Ritor1
parents:
diff changeset
1414 result = 1;
Ritor1
parents:
diff changeset
1415 if ( v31 != 1 )
Ritor1
parents:
diff changeset
1416 result = 0;
Ritor1
parents:
diff changeset
1417 return result;
Ritor1
parents:
diff changeset
1418 }
Ritor1
parents:
diff changeset
1419
Ritor1
parents:
diff changeset
1420 //----- (004759C9) --------------------------------------------------------
Ritor1
parents:
diff changeset
1421 bool __fastcall sub_4759C9(BLVFace *a1, int a2, int a3, __int16 a4)
Ritor1
parents:
diff changeset
1422 {
2138
Ritor1
parents: 2065
diff changeset
1423 //unsigned int v4; // eax@1
Ritor1
parents: 2065
diff changeset
1424 //int v5; // edx@4
0
Ritor1
parents:
diff changeset
1425 __int16 v6; // si@4
2138
Ritor1
parents: 2065
diff changeset
1426 //int v7; // edx@9
0
Ritor1
parents:
diff changeset
1427 __int16 v8; // si@9
2138
Ritor1
parents: 2065
diff changeset
1428 //int v9; // edx@13
0
Ritor1
parents:
diff changeset
1429 __int16 v10; // si@13
Ritor1
parents:
diff changeset
1430 int v11; // esi@14
Ritor1
parents:
diff changeset
1431 bool v12; // edi@14
Ritor1
parents:
diff changeset
1432 int v13; // ecx@16
Ritor1
parents:
diff changeset
1433 signed int v14; // edx@16
Ritor1
parents:
diff changeset
1434 int v15; // eax@17
Ritor1
parents:
diff changeset
1435 signed int v16; // ebx@18
Ritor1
parents:
diff changeset
1436 int v17; // edi@20
Ritor1
parents:
diff changeset
1437 signed int v18; // ST14_4@22
Ritor1
parents:
diff changeset
1438 signed __int64 v19; // qtt@22
Ritor1
parents:
diff changeset
1439 bool result; // eax@25
Ritor1
parents:
diff changeset
1440 int v21; // [sp+14h] [bp-10h]@14
Ritor1
parents:
diff changeset
1441 signed int v22; // [sp+18h] [bp-Ch]@1
Ritor1
parents:
diff changeset
1442 int v23; // [sp+1Ch] [bp-8h]@2
Ritor1
parents:
diff changeset
1443 signed int v24; // [sp+20h] [bp-4h]@2
Ritor1
parents:
diff changeset
1444 Vec3_int_ **a4a; // [sp+30h] [bp+Ch]@3
Ritor1
parents:
diff changeset
1445 Vec3_int_ **a4b; // [sp+30h] [bp+Ch]@8
Ritor1
parents:
diff changeset
1446 Vec3_int_ **a4c; // [sp+30h] [bp+Ch]@12
Ritor1
parents:
diff changeset
1447 signed int a4d; // [sp+30h] [bp+Ch]@14
Ritor1
parents:
diff changeset
1448
2138
Ritor1
parents: 2065
diff changeset
1449 //v4 = a1->uAttributes;
0
Ritor1
parents:
diff changeset
1450 v22 = 0;
2138
Ritor1
parents: 2065
diff changeset
1451 if ( BYTE1(a1->uAttributes) & 1 )
0
Ritor1
parents:
diff changeset
1452 {
Ritor1
parents:
diff changeset
1453 v23 = (signed __int16)a3;
Ritor1
parents:
diff changeset
1454 v24 = SHIWORD(a3);
Ritor1
parents:
diff changeset
1455 if ( a1->uNumVertices )
Ritor1
parents:
diff changeset
1456 {
Ritor1
parents:
diff changeset
1457 a4a = &pOutdoor->pBModels[a2].pVertices.pVertices;
Ritor1
parents:
diff changeset
1458 do
Ritor1
parents:
diff changeset
1459 {
2138
Ritor1
parents: 2065
diff changeset
1460 //v5 = 2 * v22;
0
Ritor1
parents:
diff changeset
1461 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pXInterceptDisplacements[v22] + LOWORD((*a4a)[a1->pVertexIDs[v22]].x);
Ritor1
parents:
diff changeset
1462 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pYInterceptDisplacements[v22] + LOWORD((*a4a)[a1->pVertexIDs[v22]].y);
Ritor1
parents:
diff changeset
1463 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pXInterceptDisplacements[v22 + 1] + LOWORD((*a4a)[a1->pVertexIDs[v22 + 1]].x);
2138
Ritor1
parents: 2065
diff changeset
1464 word_7209A0_intercepts_ys_plus_ys[2 * v22 + 1] = v6 = a1->pYInterceptDisplacements[v22 + 1] + LOWORD((*a4a)[a1->pVertexIDs[v22 + 1]].y);
0
Ritor1
parents:
diff changeset
1465 ++v22;
Ritor1
parents:
diff changeset
1466 }
Ritor1
parents:
diff changeset
1467 while ( v22 < a1->uNumVertices );
Ritor1
parents:
diff changeset
1468 }
Ritor1
parents:
diff changeset
1469 }
Ritor1
parents:
diff changeset
1470 else
Ritor1
parents:
diff changeset
1471 {
2138
Ritor1
parents: 2065
diff changeset
1472 if ( BYTE1(a1->uAttributes) & 2 )
0
Ritor1
parents:
diff changeset
1473 {
Ritor1
parents:
diff changeset
1474 v23 = (signed __int16)a3;
Ritor1
parents:
diff changeset
1475 v24 = a4;
Ritor1
parents:
diff changeset
1476 if ( a1->uNumVertices )
Ritor1
parents:
diff changeset
1477 {
Ritor1
parents:
diff changeset
1478 a4b = &pOutdoor->pBModels[a2].pVertices.pVertices;
Ritor1
parents:
diff changeset
1479 do
Ritor1
parents:
diff changeset
1480 {
2138
Ritor1
parents: 2065
diff changeset
1481 //v7 = 2 * v22;
0
Ritor1
parents:
diff changeset
1482 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pXInterceptDisplacements[v22] + LOWORD((*a4b)[a1->pVertexIDs[v22]].x);
Ritor1
parents:
diff changeset
1483 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pZInterceptDisplacements[v22] + LOWORD((*a4b)[a1->pVertexIDs[v22]].z);
Ritor1
parents:
diff changeset
1484 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pXInterceptDisplacements[v22 + 1] + LOWORD((*a4b)[a1->pVertexIDs[v22 + 1]].x);
2138
Ritor1
parents: 2065
diff changeset
1485 word_7209A0_intercepts_ys_plus_ys[2 * v22 + 1] = v8 = a1->pZInterceptDisplacements[v22 + 1] + LOWORD((*a4b)[a1->pVertexIDs[v22 + 1]].z);
0
Ritor1
parents:
diff changeset
1486 ++v22;
Ritor1
parents:
diff changeset
1487 }
Ritor1
parents:
diff changeset
1488 while ( v22 < a1->uNumVertices );
Ritor1
parents:
diff changeset
1489 }
Ritor1
parents:
diff changeset
1490 }
Ritor1
parents:
diff changeset
1491 else
Ritor1
parents:
diff changeset
1492 {
Ritor1
parents:
diff changeset
1493 v23 = SHIWORD(a3);
Ritor1
parents:
diff changeset
1494 v24 = a4;
Ritor1
parents:
diff changeset
1495 if ( a1->uNumVertices )
Ritor1
parents:
diff changeset
1496 {
Ritor1
parents:
diff changeset
1497 a4c = &pOutdoor->pBModels[a2].pVertices.pVertices;
Ritor1
parents:
diff changeset
1498 do
Ritor1
parents:
diff changeset
1499 {
2138
Ritor1
parents: 2065
diff changeset
1500 //v9 = 2 * v22;
0
Ritor1
parents:
diff changeset
1501 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pYInterceptDisplacements[v22] + LOWORD((*a4c)[a1->pVertexIDs[v22]].y);
Ritor1
parents:
diff changeset
1502 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pZInterceptDisplacements[v22] + LOWORD((*a4c)[a1->pVertexIDs[v22]].z);
Ritor1
parents:
diff changeset
1503 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pYInterceptDisplacements[v22 + 1] + LOWORD((*a4c)[a1->pVertexIDs[v22 + 1]].y);
2138
Ritor1
parents: 2065
diff changeset
1504 word_7209A0_intercepts_ys_plus_ys[2 * v22 + 1] = v10 = a1->pZInterceptDisplacements[v22 + 1] + LOWORD((*a4c)[a1->pVertexIDs[v22 + 1]].z);
0
Ritor1
parents:
diff changeset
1505 ++v22;
Ritor1
parents:
diff changeset
1506 }
Ritor1
parents:
diff changeset
1507 while ( v22 < a1->uNumVertices );
Ritor1
parents:
diff changeset
1508 }
Ritor1
parents:
diff changeset
1509 }
Ritor1
parents:
diff changeset
1510 }
Ritor1
parents:
diff changeset
1511 v11 = 2 * a1->uNumVertices;
Ritor1
parents:
diff changeset
1512 a4d = 0;
Ritor1
parents:
diff changeset
1513 word_720A70_intercepts_xs_plus_xs[2 * a1->uNumVertices] = word_720A70_intercepts_xs_plus_xs[0];
Ritor1
parents:
diff changeset
1514 word_7209A0_intercepts_ys_plus_ys[v11] = word_7209A0_intercepts_ys_plus_ys[0];
Ritor1
parents:
diff changeset
1515 v21 = 0;
Ritor1
parents:
diff changeset
1516 v12 = word_7209A0_intercepts_ys_plus_ys[0] >= v24;
Ritor1
parents:
diff changeset
1517 if ( v11 <= 0 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1518 return 0;
0
Ritor1
parents:
diff changeset
1519 do
Ritor1
parents:
diff changeset
1520 {
Ritor1
parents:
diff changeset
1521 if ( a4d >= 2 )
Ritor1
parents:
diff changeset
1522 break;
Ritor1
parents:
diff changeset
1523 v13 = v21;
Ritor1
parents:
diff changeset
1524 v14 = word_7209A0_intercepts_ys_plus_ys[v21 + 1];
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
1525 if ( v12 ^ (v14 >= v24) )
0
Ritor1
parents:
diff changeset
1526 {
Ritor1
parents:
diff changeset
1527 v15 = word_720A70_intercepts_xs_plus_xs[v13 + 1];
Ritor1
parents:
diff changeset
1528 if ( v15 >= v23 )
Ritor1
parents:
diff changeset
1529 v16 = 0;
Ritor1
parents:
diff changeset
1530 else
Ritor1
parents:
diff changeset
1531 v16 = 2;
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
1532 v17 = v16 | (word_720A70_intercepts_xs_plus_xs[v13] < v23);
0
Ritor1
parents:
diff changeset
1533 if ( v17 != 3 )
Ritor1
parents:
diff changeset
1534 {
Ritor1
parents:
diff changeset
1535 if ( !v17
Ritor1
parents:
diff changeset
1536 || (v18 = v15 - word_720A70_intercepts_xs_plus_xs[v13],
Ritor1
parents:
diff changeset
1537 LODWORD(v19) = v18 << 16,
Ritor1
parents:
diff changeset
1538 HIDWORD(v19) = v18 >> 16,
Ritor1
parents:
diff changeset
1539 word_720A70_intercepts_xs_plus_xs[v13]
Ritor1
parents:
diff changeset
1540 + ((signed int)(((unsigned __int64)(v19
Ritor1
parents:
diff changeset
1541 / (v14 - word_7209A0_intercepts_ys_plus_ys[v13])
Ritor1
parents:
diff changeset
1542 * ((v24 - (signed int)word_7209A0_intercepts_ys_plus_ys[v13]) << 16)) >> 16)
Ritor1
parents:
diff changeset
1543 + 32768) >> 16) >= v23) )
Ritor1
parents:
diff changeset
1544 ++a4d;
Ritor1
parents:
diff changeset
1545 }
Ritor1
parents:
diff changeset
1546 }
Ritor1
parents:
diff changeset
1547 ++v21;
Ritor1
parents:
diff changeset
1548 v12 = v14 >= v24;
Ritor1
parents:
diff changeset
1549 }
Ritor1
parents:
diff changeset
1550 while ( v21 < v11 );
Ritor1
parents:
diff changeset
1551 result = 1;
Ritor1
parents:
diff changeset
1552 if ( a4d != 1 )
Ritor1
parents:
diff changeset
1553 result = 0;
Ritor1
parents:
diff changeset
1554 return result;
Ritor1
parents:
diff changeset
1555 }
Ritor1
parents:
diff changeset
1556
Ritor1
parents:
diff changeset
1557 //----- (00475D85) --------------------------------------------------------
Ritor1
parents:
diff changeset
1558 bool __fastcall sub_475D85(Vec3_int_ *a1, Vec3_int_ *a2, int *a3, BLVFace *a4)
Ritor1
parents:
diff changeset
1559 {
Ritor1
parents:
diff changeset
1560 BLVFace *v4; // ebx@1
Ritor1
parents:
diff changeset
1561 int v5; // ST24_4@2
Ritor1
parents:
diff changeset
1562 int v6; // ST28_4@2
Ritor1
parents:
diff changeset
1563 int v7; // edi@2
Ritor1
parents:
diff changeset
1564 int v8; // eax@5
Ritor1
parents:
diff changeset
1565 signed int v9; // esi@5
Ritor1
parents:
diff changeset
1566 signed __int64 v10; // qtt@10
Ritor1
parents:
diff changeset
1567 Vec3_int_ *v11; // esi@11
Ritor1
parents:
diff changeset
1568 int v12; // ST14_4@11
Ritor1
parents:
diff changeset
1569 Vec3_int_ *v14; // [sp+Ch] [bp-18h]@1
Ritor1
parents:
diff changeset
1570 Vec3_int_ *v15; // [sp+14h] [bp-10h]@1
Ritor1
parents:
diff changeset
1571 int v16; // [sp+18h] [bp-Ch]@2
Ritor1
parents:
diff changeset
1572 int v17; // [sp+20h] [bp-4h]@10
Ritor1
parents:
diff changeset
1573 int a4b; // [sp+30h] [bp+Ch]@2
Ritor1
parents:
diff changeset
1574 int a4c; // [sp+30h] [bp+Ch]@9
Ritor1
parents:
diff changeset
1575 signed int a4a; // [sp+30h] [bp+Ch]@10
Ritor1
parents:
diff changeset
1576
Ritor1
parents:
diff changeset
1577 v4 = a4;
Ritor1
parents:
diff changeset
1578 v15 = a2;
Ritor1
parents:
diff changeset
1579 v14 = a1;
Ritor1
parents:
diff changeset
1580 if ( BYTE3(a4->uAttributes) & 0x20
Ritor1
parents:
diff changeset
1581 || (v5 = (unsigned __int64)(a2->x * (signed __int64)a4->pFacePlane_old.vNormal.x) >> 16,
Ritor1
parents:
diff changeset
1582 a4b = (unsigned __int64)(a2->y * (signed __int64)a4->pFacePlane_old.vNormal.y) >> 16,
Ritor1
parents:
diff changeset
1583 v6 = (unsigned __int64)(a2->z * (signed __int64)v4->pFacePlane_old.vNormal.z) >> 16,
Ritor1
parents:
diff changeset
1584 v7 = v5 + v6 + a4b,
Ritor1
parents:
diff changeset
1585 (v16 = v5 + v6 + a4b) == 0)
676
ecfb1b3c9a39 BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents: 675
diff changeset
1586 || v7 > 0 && !v4->Portal())
0
Ritor1
parents:
diff changeset
1587 return 0;
Ritor1
parents:
diff changeset
1588 v8 = v4->pFacePlane_old.vNormal.z * a1->z;
Ritor1
parents:
diff changeset
1589 v9 = -(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x);
Ritor1
parents:
diff changeset
1590 if ( v7 <= 0 )
Ritor1
parents:
diff changeset
1591 {
Ritor1
parents:
diff changeset
1592 if ( v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x < 0 )
Ritor1
parents:
diff changeset
1593 return 0;
Ritor1
parents:
diff changeset
1594 }
Ritor1
parents:
diff changeset
1595 else
Ritor1
parents:
diff changeset
1596 {
Ritor1
parents:
diff changeset
1597 if ( v9 < 0 )
Ritor1
parents:
diff changeset
1598 return 0;
Ritor1
parents:
diff changeset
1599 }
Ritor1
parents:
diff changeset
1600 a4c = abs(-(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x)) >> 14;
Ritor1
parents:
diff changeset
1601 if ( a4c > abs(v7)
Ritor1
parents:
diff changeset
1602 || (LODWORD(v10) = v9 << 16, HIDWORD(v10) = v9 >> 16, a4a = v10 / v16, v17 = v10 / v16, v17 > *a3 << 16)
Ritor1
parents:
diff changeset
1603 || (v11 = v14,
Ritor1
parents:
diff changeset
1604 LOWORD(v12) = LOWORD(v14->x)
Ritor1
parents:
diff changeset
1605 + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->x) >> 16) + 32768) >> 16),
Ritor1
parents:
diff changeset
1606 HIWORD(v12) = LOWORD(v11->y)
Ritor1
parents:
diff changeset
1607 + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->y) >> 16) + 32768) >> 16),
Ritor1
parents:
diff changeset
1608 !sub_475665(
Ritor1
parents:
diff changeset
1609 v4,
Ritor1
parents:
diff changeset
1610 v12,
Ritor1
parents:
diff changeset
1611 LOWORD(v11->z) + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->z) >> 16) + 32768) >> 16))) )
Ritor1
parents:
diff changeset
1612 return 0;
Ritor1
parents:
diff changeset
1613 *a3 = a4a >> 16;
Ritor1
parents:
diff changeset
1614 return 1;
Ritor1
parents:
diff changeset
1615 }
Ritor1
parents:
diff changeset
1616
Ritor1
parents:
diff changeset
1617 //----- (00475F30) --------------------------------------------------------
Ritor1
parents:
diff changeset
1618 bool __fastcall sub_475F30(int *a1, BLVFace *a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9)
Ritor1
parents:
diff changeset
1619 {
2138
Ritor1
parents: 2065
diff changeset
1620 //BLVFace *v9; // ebx@1
0
Ritor1
parents:
diff changeset
1621 int v10; // ST20_4@2
Ritor1
parents:
diff changeset
1622 int v11; // ST28_4@2
Ritor1
parents:
diff changeset
1623 int v12; // ST24_4@2
Ritor1
parents:
diff changeset
1624 char v13; // zf@2
Ritor1
parents:
diff changeset
1625 int v14; // edi@2
Ritor1
parents:
diff changeset
1626 int v15; // eax@5
Ritor1
parents:
diff changeset
1627 signed int v16; // esi@5
Ritor1
parents:
diff changeset
1628 int v17; // ST20_4@9
Ritor1
parents:
diff changeset
1629 signed __int64 v18; // qtt@10
Ritor1
parents:
diff changeset
1630 int v19; // ST14_4@11
2138
Ritor1
parents: 2065
diff changeset
1631 //int *v21; // [sp+14h] [bp-10h]@1
0
Ritor1
parents:
diff changeset
1632 int v22; // [sp+1Ch] [bp-8h]@2
Ritor1
parents:
diff changeset
1633 int v23; // [sp+1Ch] [bp-8h]@10
Ritor1
parents:
diff changeset
1634 signed int v24; // [sp+20h] [bp-4h]@10
Ritor1
parents:
diff changeset
1635
2138
Ritor1
parents: 2065
diff changeset
1636 //v9 = a2;
Ritor1
parents: 2065
diff changeset
1637 //v21 = a1;
Ritor1
parents: 2065
diff changeset
1638 if ( a2->Ethereal()
0
Ritor1
parents:
diff changeset
1639 || (v10 = (unsigned __int64)(a6 * (signed __int64)a2->pFacePlane_old.vNormal.x) >> 16,
Ritor1
parents:
diff changeset
1640 v11 = (unsigned __int64)(a7 * (signed __int64)a2->pFacePlane_old.vNormal.y) >> 16,
Ritor1
parents:
diff changeset
1641 v12 = (unsigned __int64)(a8 * (signed __int64)a2->pFacePlane_old.vNormal.z) >> 16,
Ritor1
parents:
diff changeset
1642 v13 = v10 + v12 + v11 == 0,
Ritor1
parents:
diff changeset
1643 v14 = v10 + v12 + v11,
Ritor1
parents:
diff changeset
1644 v22 = v10 + v12 + v11,
Ritor1
parents:
diff changeset
1645 v13)
676
ecfb1b3c9a39 BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents: 675
diff changeset
1646 || v14 > 0 && !a2->Portal())
0
Ritor1
parents:
diff changeset
1647 return 0;
Ritor1
parents:
diff changeset
1648 v15 = a4 * a2->pFacePlane_old.vNormal.y;
Ritor1
parents:
diff changeset
1649 v16 = -(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z);
Ritor1
parents:
diff changeset
1650 if ( v14 <= 0 )
Ritor1
parents:
diff changeset
1651 {
Ritor1
parents:
diff changeset
1652 if ( a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z < 0 )
Ritor1
parents:
diff changeset
1653 return 0;
Ritor1
parents:
diff changeset
1654 }
Ritor1
parents:
diff changeset
1655 else
Ritor1
parents:
diff changeset
1656 {
Ritor1
parents:
diff changeset
1657 if ( v16 < 0 )
Ritor1
parents:
diff changeset
1658 return 0;
Ritor1
parents:
diff changeset
1659 }
Ritor1
parents:
diff changeset
1660 v17 = abs(-(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z)) >> 14;
Ritor1
parents:
diff changeset
1661 if ( v17 > abs(v14)
2138
Ritor1
parents: 2065
diff changeset
1662 || (LODWORD(v18) = v16 << 16, HIDWORD(v18) = v16 >> 16, v24 = v18 / v22, v23 = v18 / v22, v23 > *a1 << 16)
0
Ritor1
parents:
diff changeset
1663 || (LOWORD(v19) = a3 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a6) >> 16) + 32768) >> 16),
Ritor1
parents:
diff changeset
1664 HIWORD(v19) = a4 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a7) >> 16) + 32768) >> 16),
2138
Ritor1
parents: 2065
diff changeset
1665 !sub_4759C9(a2, a9, v19,
0
Ritor1
parents:
diff changeset
1666 a5 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a8) >> 16) + 32768) >> 16))) )
Ritor1
parents:
diff changeset
1667 return 0;
2138
Ritor1
parents: 2065
diff changeset
1668 *a1 = v24 >> 16;
0
Ritor1
parents:
diff changeset
1669 return 1;
Ritor1
parents:
diff changeset
1670 }
Ritor1
parents:
diff changeset
1671
Ritor1
parents:
diff changeset
1672 //----- (004760D5) --------------------------------------------------------
Ritor1
parents:
diff changeset
1673 PartyAction ActionQueue::Next()
Ritor1
parents:
diff changeset
1674 {
Ritor1
parents:
diff changeset
1675 if (!uNumActions)
Ritor1
parents:
diff changeset
1676 return PARTY_INVALID;
Ritor1
parents:
diff changeset
1677
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
1678 PartyAction result = pActions[0];
0
Ritor1
parents:
diff changeset
1679 for (unsigned int i = 0; i < uNumActions - 1; ++i)
Ritor1
parents:
diff changeset
1680 pActions[i] = pActions[i + 1];
Ritor1
parents:
diff changeset
1681 --uNumActions;
Ritor1
parents:
diff changeset
1682
Ritor1
parents:
diff changeset
1683 return result;
Ritor1
parents:
diff changeset
1684 }
Ritor1
parents:
diff changeset
1685
Ritor1
parents:
diff changeset
1686 //----- (004775ED) --------------------------------------------------------
Ritor1
parents:
diff changeset
1687 int stru6_stru1_indoor_sw_billboard::_4775ED(float a2)
Ritor1
parents:
diff changeset
1688 {
Ritor1
parents:
diff changeset
1689 char *v2; // edi@1
Ritor1
parents:
diff changeset
1690 int v3; // eax@1
Ritor1
parents:
diff changeset
1691 char *v4; // edx@2
Ritor1
parents:
diff changeset
1692 char *v5; // esi@3
Ritor1
parents:
diff changeset
1693 double v6; // st7@6
Ritor1
parents:
diff changeset
1694 signed __int64 v7; // ST84_8@6
Ritor1
parents:
diff changeset
1695 double v8; // ST0C_8@6
Ritor1
parents:
diff changeset
1696 int v9; // esi@6
Ritor1
parents:
diff changeset
1697 double v10; // ST44_8@6
Ritor1
parents:
diff changeset
1698 int v11; // ecx@6
Ritor1
parents:
diff changeset
1699 double v12; // ST34_8@6
Ritor1
parents:
diff changeset
1700 int v13; // ecx@6
Ritor1
parents:
diff changeset
1701 double v14; // ST14_8@6
Ritor1
parents:
diff changeset
1702 double v15; // st7@8
Ritor1
parents:
diff changeset
1703 unsigned int v16; // ecx@8
Ritor1
parents:
diff changeset
1704 signed __int64 v17; // ST64_8@8
Ritor1
parents:
diff changeset
1705 double v18; // ST24_8@8
Ritor1
parents:
diff changeset
1706 int v19; // edi@8
Ritor1
parents:
diff changeset
1707 double v20; // ST3C_8@8
Ritor1
parents:
diff changeset
1708 int v21; // ecx@8
Ritor1
parents:
diff changeset
1709 double v22; // ST2C_8@8
Ritor1
parents:
diff changeset
1710 int v23; // ST9C_4@8
Ritor1
parents:
diff changeset
1711 double v24; // ST1C_8@8
Ritor1
parents:
diff changeset
1712 int *v25; // edi@8
Ritor1
parents:
diff changeset
1713 int v26; // esi@8
Ritor1
parents:
diff changeset
1714 int *v27; // edi@10
Ritor1
parents:
diff changeset
1715 int v28; // esi@10
Ritor1
parents:
diff changeset
1716 int result; // eax@12
Ritor1
parents:
diff changeset
1717 __int64 v30; // [sp+A8h] [bp-30h]@8
Ritor1
parents:
diff changeset
1718 float v31; // [sp+B0h] [bp-28h]@6
Ritor1
parents:
diff changeset
1719 float v32; // [sp+B4h] [bp-24h]@6
Ritor1
parents:
diff changeset
1720 int v33; // [sp+B8h] [bp-20h]@6
Ritor1
parents:
diff changeset
1721 int v34; // [sp+BCh] [bp-1Ch]@2
Ritor1
parents:
diff changeset
1722 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1
Ritor1
parents:
diff changeset
1723 float v36; // [sp+C4h] [bp-14h]@6
Ritor1
parents:
diff changeset
1724 int v37; // [sp+C8h] [bp-10h]@6
Ritor1
parents:
diff changeset
1725 int v38; // [sp+CCh] [bp-Ch]@1
Ritor1
parents:
diff changeset
1726 float v39; // [sp+D0h] [bp-8h]@6
Ritor1
parents:
diff changeset
1727 int *v40; // [sp+D4h] [bp-4h]@2
Ritor1
parents:
diff changeset
1728
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1729 v2 = (char *)&this->field_64[4 * this->uNumVertices];
0
Ritor1
parents:
diff changeset
1730 v38 = 0;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1731 *(int *)v2 = this->field_64[0];
0
Ritor1
parents:
diff changeset
1732 v2 += 4;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1733 *(int *)v2 = this->field_64[1];
0
Ritor1
parents:
diff changeset
1734 v2 += 4;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1735 *(int *)v2 = this->field_64[2];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1736 *((int *)v2 + 1) = this->field_64[3];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1737 v3 = this->uNumVertices;
0
Ritor1
parents:
diff changeset
1738 v35 = this;
Ritor1
parents:
diff changeset
1739 if ( v3 > 0 )
Ritor1
parents:
diff changeset
1740 {
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1741 v40 = &this->field_64[20];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1742 v4 = (char *)&this->field_64[3] + 3;
0
Ritor1
parents:
diff changeset
1743 v34 = v3;
Ritor1
parents:
diff changeset
1744 while ( 1 )
Ritor1
parents:
diff changeset
1745 {
Ritor1
parents:
diff changeset
1746 v5 = v4 - 15;
Ritor1
parents:
diff changeset
1747 if ( *(float *)(v4 - 15) <= (double)a2 && *(float *)(v4 + 1) <= (double)a2 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1748 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1749 v4 += 16;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1750 --v34;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1751 if ( !v34 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1752 return this->uNumVertices = v38;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1753 continue;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1754 }
0
Ritor1
parents:
diff changeset
1755 if ( *(float *)v5 <= (double)a2 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1756 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1757 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1758 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1759 v36 = v6;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1760 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1761 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1762 *(float *)&v37 = (double)v7 * v6;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1763 v8 = *(float *)&v37 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1764 v9 = (unsigned __int8)*v4;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1765 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1766 v10 = *(float *)&v37 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1767 v11 = (unsigned __int8)*(v4 - 2);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1768 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1769 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1770 v12 = v39 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1771 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1772 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1773 v14 = v39 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1774 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1775 //this = v35;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1776 v5 = (char *)&v30 + 4;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1777 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1778 else if ( *(float *)(v4 + 1) <= (double)a2 )
0
Ritor1
parents:
diff changeset
1779 {
Ritor1
parents:
diff changeset
1780 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5);
Ritor1
parents:
diff changeset
1781 v16 = (unsigned __int8)*v4;
Ritor1
parents:
diff changeset
1782 HIDWORD(v30) = LODWORD(a2);
Ritor1
parents:
diff changeset
1783 v17 = (unsigned __int8)v4[16] - v16;
Ritor1
parents:
diff changeset
1784 v36 = v15;
Ritor1
parents:
diff changeset
1785 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11);
Ritor1
parents:
diff changeset
1786 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7);
Ritor1
parents:
diff changeset
1787 v39 = (double)v17 * v15;
Ritor1
parents:
diff changeset
1788 v18 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
1789 v19 = (unsigned __int8)*v4;
Ritor1
parents:
diff changeset
1790 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36;
Ritor1
parents:
diff changeset
1791 v20 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
1792 v21 = (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
1793 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1);
Ritor1
parents:
diff changeset
1794 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36;
Ritor1
parents:
diff changeset
1795 v22 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
1796 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
1797 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36;
Ritor1
parents:
diff changeset
1798 v24 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
1799 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8);
Ritor1
parents:
diff changeset
1800 v25 = v40;
Ritor1
parents:
diff changeset
1801 *v40 = *(int *)v5;
Ritor1
parents:
diff changeset
1802 v26 = (int)(v5 + 4);
Ritor1
parents:
diff changeset
1803 ++v25;
Ritor1
parents:
diff changeset
1804 *v25 = *(int *)v26;
Ritor1
parents:
diff changeset
1805 v26 += 4;
Ritor1
parents:
diff changeset
1806 ++v25;
Ritor1
parents:
diff changeset
1807 ++v38;
Ritor1
parents:
diff changeset
1808 v40 += 4;
Ritor1
parents:
diff changeset
1809 *v25 = *(int *)v26;
Ritor1
parents:
diff changeset
1810 v25[1] = *(int *)(v26 + 4);
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1811 v5 = (char *)&v30 + 4;
0
Ritor1
parents:
diff changeset
1812 }
Ritor1
parents:
diff changeset
1813 v27 = v40;
Ritor1
parents:
diff changeset
1814 ++v38;
Ritor1
parents:
diff changeset
1815 *v40 = *(int *)v5;
Ritor1
parents:
diff changeset
1816 v28 = (int)(v5 + 4);
Ritor1
parents:
diff changeset
1817 ++v27;
Ritor1
parents:
diff changeset
1818 *v27 = *(int *)v28;
Ritor1
parents:
diff changeset
1819 v28 += 4;
Ritor1
parents:
diff changeset
1820 ++v27;
Ritor1
parents:
diff changeset
1821 v40 += 4;
Ritor1
parents:
diff changeset
1822 *v27 = *(int *)v28;
Ritor1
parents:
diff changeset
1823 v27[1] = *(int *)(v28 + 4);
Ritor1
parents:
diff changeset
1824 v4 += 16;
Ritor1
parents:
diff changeset
1825 --v34;
Ritor1
parents:
diff changeset
1826 if ( !v34 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1827 return this->uNumVertices = v38;
0
Ritor1
parents:
diff changeset
1828 }
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1829 }
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1830 return this->uNumVertices = v38;
0
Ritor1
parents:
diff changeset
1831 }
Ritor1
parents:
diff changeset
1832
Ritor1
parents:
diff changeset
1833 //----- (00477927) --------------------------------------------------------
Ritor1
parents:
diff changeset
1834 int stru6_stru1_indoor_sw_billboard::_477927(float a2)
Ritor1
parents:
diff changeset
1835 {
Ritor1
parents:
diff changeset
1836 char *v2; // edi@1
Ritor1
parents:
diff changeset
1837 int v3; // eax@1
Ritor1
parents:
diff changeset
1838 char *v4; // edx@2
Ritor1
parents:
diff changeset
1839 char *v5; // esi@3
Ritor1
parents:
diff changeset
1840 double v6; // st7@6
Ritor1
parents:
diff changeset
1841 signed __int64 v7; // ST84_8@6
Ritor1
parents:
diff changeset
1842 double v8; // ST0C_8@6
Ritor1
parents:
diff changeset
1843 int v9; // esi@6
Ritor1
parents:
diff changeset
1844 double v10; // ST44_8@6
Ritor1
parents:
diff changeset
1845 int v11; // ecx@6
Ritor1
parents:
diff changeset
1846 double v12; // ST34_8@6
Ritor1
parents:
diff changeset
1847 int v13; // ecx@6
Ritor1
parents:
diff changeset
1848 double v14; // ST14_8@6
Ritor1
parents:
diff changeset
1849 double v15; // st7@8
Ritor1
parents:
diff changeset
1850 unsigned int v16; // ecx@8
Ritor1
parents:
diff changeset
1851 signed __int64 v17; // ST64_8@8
Ritor1
parents:
diff changeset
1852 double v18; // ST24_8@8
Ritor1
parents:
diff changeset
1853 int v19; // edi@8
Ritor1
parents:
diff changeset
1854 double v20; // ST3C_8@8
Ritor1
parents:
diff changeset
1855 int v21; // ecx@8
Ritor1
parents:
diff changeset
1856 double v22; // ST2C_8@8
Ritor1
parents:
diff changeset
1857 int v23; // ST9C_4@8
Ritor1
parents:
diff changeset
1858 double v24; // ST1C_8@8
Ritor1
parents:
diff changeset
1859 int *v25; // edi@8
Ritor1
parents:
diff changeset
1860 int v26; // esi@8
Ritor1
parents:
diff changeset
1861 int *v27; // edi@10
Ritor1
parents:
diff changeset
1862 int v28; // esi@10
Ritor1
parents:
diff changeset
1863 int result; // eax@12
Ritor1
parents:
diff changeset
1864 __int64 v30; // [sp+A8h] [bp-30h]@8
Ritor1
parents:
diff changeset
1865 float v31; // [sp+B0h] [bp-28h]@6
Ritor1
parents:
diff changeset
1866 float v32; // [sp+B4h] [bp-24h]@6
Ritor1
parents:
diff changeset
1867 int v33; // [sp+B8h] [bp-20h]@6
Ritor1
parents:
diff changeset
1868 int v34; // [sp+BCh] [bp-1Ch]@2
Ritor1
parents:
diff changeset
1869 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1
Ritor1
parents:
diff changeset
1870 float v36; // [sp+C4h] [bp-14h]@6
Ritor1
parents:
diff changeset
1871 int v37; // [sp+C8h] [bp-10h]@6
Ritor1
parents:
diff changeset
1872 int v38; // [sp+CCh] [bp-Ch]@1
Ritor1
parents:
diff changeset
1873 float v39; // [sp+D0h] [bp-8h]@6
Ritor1
parents:
diff changeset
1874 int *v40; // [sp+D4h] [bp-4h]@2
Ritor1
parents:
diff changeset
1875
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1876 v2 = (char *)&this->field_64[4 * this->uNumVertices];
0
Ritor1
parents:
diff changeset
1877 v38 = 0;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1878 *(int *)v2 = this->field_64[0];
0
Ritor1
parents:
diff changeset
1879 v2 += 4;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1880 *(int *)v2 = this->field_64[1];
0
Ritor1
parents:
diff changeset
1881 v2 += 4;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1882 *(int *)v2 = this->field_64[2];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1883 *((int *)v2 + 1) = this->field_64[3];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1884 v3 = this->uNumVertices;
0
Ritor1
parents:
diff changeset
1885 v35 = this;
Ritor1
parents:
diff changeset
1886 if ( v3 > 0 )
Ritor1
parents:
diff changeset
1887 {
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1888 v40 = &this->field_64[20];
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1889 v4 = (char *)&this->field_64[3] + 3;
0
Ritor1
parents:
diff changeset
1890 v34 = v3;
Ritor1
parents:
diff changeset
1891 while ( 1 )
Ritor1
parents:
diff changeset
1892 {
Ritor1
parents:
diff changeset
1893 v5 = v4 - 15;
Ritor1
parents:
diff changeset
1894 if ( *(float *)(v4 - 15) >= (double)a2 && *(float *)(v4 + 1) >= (double)a2 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1895 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1896 v4 += 16;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1897 --v34;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1898 if ( !v34 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1899 return this->uNumVertices = v38;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1900 continue;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1901 }
0
Ritor1
parents:
diff changeset
1902 if ( *(float *)v5 >= (double)a2 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1903 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1904 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1905 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1906 v36 = v6;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1907 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1908 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1909 *(float *)&v37 = (double)v7 * v6;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1910 v8 = *(float *)&v37 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1911 v9 = (unsigned __int8)*v4;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1912 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1913 v10 = *(float *)&v37 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1914 v11 = (unsigned __int8)*(v4 - 2);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1915 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1916 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1917 v12 = v39 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1918 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1919 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1920 v14 = v39 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1921 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1922 //this = v35;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1923 v5 = (char *)&v30 + 4;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1924 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1925 else if ( *(float *)(v4 + 1) >= (double)a2 )
0
Ritor1
parents:
diff changeset
1926 {
Ritor1
parents:
diff changeset
1927 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5);
Ritor1
parents:
diff changeset
1928 v16 = (unsigned __int8)*v4;
Ritor1
parents:
diff changeset
1929 HIDWORD(v30) = LODWORD(a2);
Ritor1
parents:
diff changeset
1930 v17 = (unsigned __int8)v4[16] - v16;
Ritor1
parents:
diff changeset
1931 v36 = v15;
Ritor1
parents:
diff changeset
1932 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11);
Ritor1
parents:
diff changeset
1933 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7);
Ritor1
parents:
diff changeset
1934 v39 = (double)v17 * v15;
Ritor1
parents:
diff changeset
1935 v18 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
1936 v19 = (unsigned __int8)*v4;
Ritor1
parents:
diff changeset
1937 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36;
Ritor1
parents:
diff changeset
1938 v20 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
1939 v21 = (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
1940 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1);
Ritor1
parents:
diff changeset
1941 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36;
Ritor1
parents:
diff changeset
1942 v22 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
1943 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2);
Ritor1
parents:
diff changeset
1944 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36;
Ritor1
parents:
diff changeset
1945 v24 = v39 + 6.7553994e15;
Ritor1
parents:
diff changeset
1946 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8);
Ritor1
parents:
diff changeset
1947 v25 = v40;
Ritor1
parents:
diff changeset
1948 *v40 = *(int *)v5;
Ritor1
parents:
diff changeset
1949 v26 = (int)(v5 + 4);
Ritor1
parents:
diff changeset
1950 ++v25;
Ritor1
parents:
diff changeset
1951 *v25 = *(int *)v26;
Ritor1
parents:
diff changeset
1952 v26 += 4;
Ritor1
parents:
diff changeset
1953 ++v25;
Ritor1
parents:
diff changeset
1954 ++v38;
Ritor1
parents:
diff changeset
1955 v40 += 4;
Ritor1
parents:
diff changeset
1956 *v25 = *(int *)v26;
Ritor1
parents:
diff changeset
1957 v25[1] = *(int *)(v26 + 4);
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1958 v5 = (char *)&v30 + 4;
0
Ritor1
parents:
diff changeset
1959 }
Ritor1
parents:
diff changeset
1960 v27 = v40;
Ritor1
parents:
diff changeset
1961 ++v38;
Ritor1
parents:
diff changeset
1962 *v40 = *(int *)v5;
Ritor1
parents:
diff changeset
1963 v28 = (int)(v5 + 4);
Ritor1
parents:
diff changeset
1964 ++v27;
Ritor1
parents:
diff changeset
1965 *v27 = *(int *)v28;
Ritor1
parents:
diff changeset
1966 v28 += 4;
Ritor1
parents:
diff changeset
1967 ++v27;
Ritor1
parents:
diff changeset
1968 v40 += 4;
Ritor1
parents:
diff changeset
1969 *v27 = *(int *)v28;
Ritor1
parents:
diff changeset
1970 v27[1] = *(int *)(v28 + 4);
Ritor1
parents:
diff changeset
1971 v4 += 16;
Ritor1
parents:
diff changeset
1972 --v34;
Ritor1
parents:
diff changeset
1973 if ( !v34 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1974 return this->uNumVertices = v38;
0
Ritor1
parents:
diff changeset
1975 }
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
1976 }
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
1977 return this->uNumVertices = v38;
0
Ritor1
parents:
diff changeset
1978 }
Ritor1
parents:
diff changeset
1979
Ritor1
parents:
diff changeset
1980 //----- (00477C61) --------------------------------------------------------
Ritor1
parents:
diff changeset
1981 int stru6_stru1_indoor_sw_billboard::sub_477C61()
Ritor1
parents:
diff changeset
1982 {
998
e4383e6dfbef ProcessInput
Ritor1
parents: 978
diff changeset
1983 //stru6_stru1_indoor_sw_billboard *v1; // ebx@1
0
Ritor1
parents:
diff changeset
1984 int v2; // ecx@2
Ritor1
parents:
diff changeset
1985 int v3; // eax@3
Ritor1
parents:
diff changeset
1986 double v4; // st7@4
Ritor1
parents:
diff changeset
1987 double v5; // st7@5
Ritor1
parents:
diff changeset
1988 double v6; // st6@5
Ritor1
parents:
diff changeset
1989 double v7; // st5@6
Ritor1
parents:
diff changeset
1990 float v8; // ST30_4@8
Ritor1
parents:
diff changeset
1991 float v9; // ST24_4@8
Ritor1
parents:
diff changeset
1992 double v10; // st7@8
Ritor1
parents:
diff changeset
1993 double v11; // st6@8
Ritor1
parents:
diff changeset
1994 double v12; // st5@8
Ritor1
parents:
diff changeset
1995 float v13; // ST24_4@13
Ritor1
parents:
diff changeset
1996 int v14; // esi@13
Ritor1
parents:
diff changeset
1997 char *v15; // esi@15
1638
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
1998 //signed int v16; // eax@16
0
Ritor1
parents:
diff changeset
1999 __int16 v17; // fps@16
Ritor1
parents:
diff changeset
2000 unsigned __int8 v18; // c2@16
Ritor1
parents:
diff changeset
2001 unsigned __int8 v19; // c3@16
Ritor1
parents:
diff changeset
2002 double v20; // st6@16
Ritor1
parents:
diff changeset
2003 float v21; // ST18_4@17
Ritor1
parents:
diff changeset
2004 float v22; // ST2C_4@17
Ritor1
parents:
diff changeset
2005 float v23; // ST34_4@17
Ritor1
parents:
diff changeset
2006 float v24; // ST24_4@17
Ritor1
parents:
diff changeset
2007 double v25; // st7@17
Ritor1
parents:
diff changeset
2008 double v26; // st6@17
Ritor1
parents:
diff changeset
2009 float v27; // ST34_4@18
Ritor1
parents:
diff changeset
2010 float v28; // ST30_4@18
Ritor1
parents:
diff changeset
2011 int v29; // eax@19
Ritor1
parents:
diff changeset
2012 signed int v31; // [sp+8h] [bp-28h]@15
Ritor1
parents:
diff changeset
2013 float v32; // [sp+Ch] [bp-24h]@16
Ritor1
parents:
diff changeset
2014 float v33; // [sp+14h] [bp-1Ch]@16
Ritor1
parents:
diff changeset
2015 float v34; // [sp+18h] [bp-18h]@16
Ritor1
parents:
diff changeset
2016 float v35; // [sp+1Ch] [bp-14h]@17
Ritor1
parents:
diff changeset
2017 float v36; // [sp+20h] [bp-10h]@4
Ritor1
parents:
diff changeset
2018 float v37; // [sp+24h] [bp-Ch]@4
Ritor1
parents:
diff changeset
2019 float v38; // [sp+24h] [bp-Ch]@16
Ritor1
parents:
diff changeset
2020 float v39; // [sp+28h] [bp-8h]@9
Ritor1
parents:
diff changeset
2021 float v40; // [sp+28h] [bp-8h]@16
Ritor1
parents:
diff changeset
2022 float v41; // [sp+2Ch] [bp-4h]@6
Ritor1
parents:
diff changeset
2023 float v42; // [sp+2Ch] [bp-4h]@9
Ritor1
parents:
diff changeset
2024
998
e4383e6dfbef ProcessInput
Ritor1
parents: 978
diff changeset
2025 //v1 = this;
0
Ritor1
parents:
diff changeset
2026 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
2027 {
Ritor1
parents:
diff changeset
2028 v2 = 0;
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
2029 if ( this->uNumVertices > 0 )
998
e4383e6dfbef ProcessInput
Ritor1
parents: 978
diff changeset
2030 {
e4383e6dfbef ProcessInput
Ritor1
parents: 978
diff changeset
2031 v3 = (int)&this->field_14[1];
0
Ritor1
parents:
diff changeset
2032 do
Ritor1
parents:
diff changeset
2033 {
Ritor1
parents:
diff changeset
2034 v4 = *(float *)(v3 - 4);
Ritor1
parents:
diff changeset
2035 LODWORD(v37) = *(int *)v3;
Ritor1
parents:
diff changeset
2036 LODWORD(v36) = *(int *)(v3 + 4);
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2037 if (pGame->pIndoorCameraD3D->sRotationX)
0
Ritor1
parents:
diff changeset
2038 {
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2039 v5 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2040 v6 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2041 //if ( pRenderer->pRenderD3D )
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2042 //{
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
2043 v41 = pGame->pIndoorCameraD3D->fRotationYSine * v6 + pGame->pIndoorCameraD3D->fRotationYCosine * v5;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
2044 v7 = pGame->pIndoorCameraD3D->fRotationYSine * v5 - pGame->pIndoorCameraD3D->fRotationYCosine * v6;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2045 /*}
0
Ritor1
parents:
diff changeset
2046 else
Ritor1
parents:
diff changeset
2047 {
Ritor1
parents:
diff changeset
2048 v41 = pBLVRenderParams->fCosineY * v5 - pBLVRenderParams->fSineY * v6;
Ritor1
parents:
diff changeset
2049 v7 = pBLVRenderParams->fSineY * v5 + pBLVRenderParams->fCosineY * v6;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2050 }*/
0
Ritor1
parents:
diff changeset
2051 v8 = v7;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2052 v9 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z;
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
2053 v10 = pGame->pIndoorCameraD3D->fRotationXCosine * v41 - pGame->pIndoorCameraD3D->fRotationXSine * v9;
0
Ritor1
parents:
diff changeset
2054 v11 = v8;
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
2055 v12 = pGame->pIndoorCameraD3D->fRotationXCosine * v9 + pGame->pIndoorCameraD3D->fRotationXSine * v41;
0
Ritor1
parents:
diff changeset
2056 }
Ritor1
parents:
diff changeset
2057 else
Ritor1
parents:
diff changeset
2058 {
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2059 v42 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2060 v39 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2061 //if ( pRenderer->pRenderD3D )
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2062 //{
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
2063 v10 = pGame->pIndoorCameraD3D->fRotationYSine * v39 + pGame->pIndoorCameraD3D->fRotationYCosine * v42;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
2064 v11 = pGame->pIndoorCameraD3D->fRotationYSine * v42 - pGame->pIndoorCameraD3D->fRotationYCosine * v39;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2065 /*}
0
Ritor1
parents:
diff changeset
2066 else
Ritor1
parents:
diff changeset
2067 {
Ritor1
parents:
diff changeset
2068 v10 = pBLVRenderParams->fCosineY * v42 - pBLVRenderParams->fSineY * v39;
Ritor1
parents:
diff changeset
2069 v11 = pBLVRenderParams->fSineY * v42 + pBLVRenderParams->fCosineY * v39;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2070 }*/
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2071 v12 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z;
0
Ritor1
parents:
diff changeset
2072 }
Ritor1
parents:
diff changeset
2073 v13 = v12;
Ritor1
parents:
diff changeset
2074 ++v2;
Ritor1
parents:
diff changeset
2075 *(int *)(v3 + 84) = LODWORD(v13);
Ritor1
parents:
diff changeset
2076 v14 = *(int *)(v3 + 8);
Ritor1
parents:
diff changeset
2077 *(float *)(v3 + 76) = v10;
Ritor1
parents:
diff changeset
2078 *(int *)(v3 + 88) = v14;
Ritor1
parents:
diff changeset
2079 *(float *)(v3 + 80) = v11;
Ritor1
parents:
diff changeset
2080 v3 += 16;
Ritor1
parents:
diff changeset
2081 }
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
2082 while ( v2 < this->uNumVertices );
0
Ritor1
parents:
diff changeset
2083 }
Ritor1
parents:
diff changeset
2084 }
Ritor1
parents:
diff changeset
2085 else
Ritor1
parents:
diff changeset
2086 {
Ritor1
parents:
diff changeset
2087 v15 = (char *)&this->field_14[1];
Ritor1
parents:
diff changeset
2088 v31 = 3;
Ritor1
parents:
diff changeset
2089 do
Ritor1
parents:
diff changeset
2090 {
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2091 v40 = (double)stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX) * 0.0000152587890625;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2092 v32 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX) * 0.0000152587890625;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2093 v34 = (double)stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY) * 0.0000152587890625;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2094 v33 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY) * 0.0000152587890625;
1638
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
2095 //v16 = stru_5C6E00->Sin(pODMRenderParams->rotation_y);
0
Ritor1
parents:
diff changeset
2096 LODWORD(v38) = *(int *)v15;
Ritor1
parents:
diff changeset
2097 //UNDEF(v17);
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2098 v20 = *((float *)v15 - 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.x;
1090
8b59f13c9c3e a few spells fixed
zipi
parents: 1083
diff changeset
2099 //if ( v19 | v18 )
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2100 if (pGame->pIndoorCameraD3D->vPartyPos.x == 0)
0
Ritor1
parents:
diff changeset
2101 {
Ritor1
parents:
diff changeset
2102 v27 = v20;
Ritor1
parents:
diff changeset
2103 LODWORD(v35) = *((int *)v15 + 1);
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2104 v28 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
0
Ritor1
parents:
diff changeset
2105 v25 = v33 * v28 + v34 * v27;
Ritor1
parents:
diff changeset
2106 v26 = v34 * v28 - v33 * v27;
Ritor1
parents:
diff changeset
2107 }
Ritor1
parents:
diff changeset
2108 else
Ritor1
parents:
diff changeset
2109 {
Ritor1
parents:
diff changeset
2110 v21 = v20;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2111 v22 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y;
0
Ritor1
parents:
diff changeset
2112 v23 = v33 * v22 + v34 * v21;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2113 v24 = *((float *)v15 + 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.z;
0
Ritor1
parents:
diff changeset
2114 v25 = v32 * v24 + v40 * v23;
Ritor1
parents:
diff changeset
2115 v26 = v34 * v22 - v33 * v21;
Ritor1
parents:
diff changeset
2116 v35 = v40 * v24 - v32 * v23;
Ritor1
parents:
diff changeset
2117 }
Ritor1
parents:
diff changeset
2118 *((int *)v15 + 21) = LODWORD(v35);
Ritor1
parents:
diff changeset
2119 v29 = *((int *)v15 + 2);
Ritor1
parents:
diff changeset
2120 *((float *)v15 + 19) = v25;
Ritor1
parents:
diff changeset
2121 *((int *)v15 + 22) = v29;
Ritor1
parents:
diff changeset
2122 *((float *)v15 + 20) = v26;
Ritor1
parents:
diff changeset
2123 v15 += 16;
Ritor1
parents:
diff changeset
2124 --v31;
Ritor1
parents:
diff changeset
2125 }
Ritor1
parents:
diff changeset
2126 while ( v31 );
Ritor1
parents:
diff changeset
2127 }
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
2128 this->uNumVertices = 3;
0
Ritor1
parents:
diff changeset
2129 return 1;
Ritor1
parents:
diff changeset
2130 }
Ritor1
parents:
diff changeset
2131
Ritor1
parents:
diff changeset
2132 //----- (00477F63) --------------------------------------------------------
Ritor1
parents:
diff changeset
2133 bool stru6_stru1_indoor_sw_billboard::sub_477F63()
Ritor1
parents:
diff changeset
2134 {
Ritor1
parents:
diff changeset
2135 signed int v1; // ebx@1
Ritor1
parents:
diff changeset
2136 stru6_stru1_indoor_sw_billboard *v2; // esi@1
Ritor1
parents:
diff changeset
2137 double v3; // st7@2
Ritor1
parents:
diff changeset
2138 int v4; // edx@4
Ritor1
parents:
diff changeset
2139 char *v5; // ecx@5
Ritor1
parents:
diff changeset
2140 int v6; // edi@5
Ritor1
parents:
diff changeset
2141 float v7; // ST08_4@13
Ritor1
parents:
diff changeset
2142 signed int v9; // [sp+Ch] [bp-8h]@1
Ritor1
parents:
diff changeset
2143 float v10; // [sp+10h] [bp-4h]@2
Ritor1
parents:
diff changeset
2144
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
2145 stru6_stru1_indoor_sw_billboard* a1 = this;
0
Ritor1
parents:
diff changeset
2146
Ritor1
parents:
diff changeset
2147 v1 = 0;
Ritor1
parents:
diff changeset
2148 v2 = a1;
Ritor1
parents:
diff changeset
2149 v9 = 0;
Ritor1
parents:
diff changeset
2150 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
2151 {
Ritor1
parents:
diff changeset
2152 v10 = 16192.0;
1641
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
2153 v3 = (double)pBLVRenderParams->fov_rad_fixpoint * 0.000015258789;
0
Ritor1
parents:
diff changeset
2154 }
Ritor1
parents:
diff changeset
2155 else
Ritor1
parents:
diff changeset
2156 {
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
2157 v10 = (double)pODMRenderParams->shading_dist_mist;
0
Ritor1
parents:
diff changeset
2158 v3 = 8.0;
Ritor1
parents:
diff changeset
2159 }
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
2160 v4 = a1->uNumVertices;
0
Ritor1
parents:
diff changeset
2161 if ( v4 <= 0 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2162 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2163 memcpy(&v2->field_14[40], &v2->field_14[20], 16 * v4);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2164 return v2->uNumVertices != 0;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2165 }
0
Ritor1
parents:
diff changeset
2166 v5 = (char *)&a1->field_14[20];
Ritor1
parents:
diff changeset
2167 v6 = v4;
Ritor1
parents:
diff changeset
2168 do
Ritor1
parents:
diff changeset
2169 {
Ritor1
parents:
diff changeset
2170 if ( v3 >= *(float *)v5 || *(float *)v5 >= (double)v10 )
Ritor1
parents:
diff changeset
2171 {
Ritor1
parents:
diff changeset
2172 if ( v3 < *(float *)v5 )
Ritor1
parents:
diff changeset
2173 v9 = 1;
Ritor1
parents:
diff changeset
2174 else
Ritor1
parents:
diff changeset
2175 v1 = 1;
Ritor1
parents:
diff changeset
2176 }
Ritor1
parents:
diff changeset
2177 v5 += 16;
Ritor1
parents:
diff changeset
2178 --v6;
Ritor1
parents:
diff changeset
2179 }
Ritor1
parents:
diff changeset
2180 while ( v6 );
Ritor1
parents:
diff changeset
2181 if ( !v1 )
Ritor1
parents:
diff changeset
2182 {
Ritor1
parents:
diff changeset
2183 if ( v9 )
Ritor1
parents:
diff changeset
2184 {
Ritor1
parents:
diff changeset
2185 v2->_477927(v10);
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
2186 return v2->uNumVertices != 0;
0
Ritor1
parents:
diff changeset
2187 }
Ritor1
parents:
diff changeset
2188 memcpy(&v2->field_14[40], &v2->field_14[20], 16 * v4);
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
2189 return v2->uNumVertices != 0;
0
Ritor1
parents:
diff changeset
2190 }
Ritor1
parents:
diff changeset
2191 v7 = v3;
Ritor1
parents:
diff changeset
2192 _4775ED(v7);
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
2193 return v2->uNumVertices != 0;
0
Ritor1
parents:
diff changeset
2194 }
Ritor1
parents:
diff changeset
2195
Ritor1
parents:
diff changeset
2196 //----- (0047802A) --------------------------------------------------------
Ritor1
parents:
diff changeset
2197 int stru6_stru1_indoor_sw_billboard::sub_47802A()
Ritor1
parents:
diff changeset
2198 {
Ritor1
parents:
diff changeset
2199 double v6; // st7@4
Ritor1
parents:
diff changeset
2200 double v12; // st7@16
Ritor1
parents:
diff changeset
2201 signed int v16; // [sp+38h] [bp-Ch]@1
Ritor1
parents:
diff changeset
2202 int a6; // [sp+3Ch] [bp-8h]@5
Ritor1
parents:
diff changeset
2203 int a5; // [sp+40h] [bp-4h]@5
Ritor1
parents:
diff changeset
2204
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
2205 stru6_stru1_indoor_sw_billboard* a1 = this;
0
Ritor1
parents:
diff changeset
2206
Ritor1
parents:
diff changeset
2207 v16 = 0;
Ritor1
parents:
diff changeset
2208 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
Ritor1
parents:
diff changeset
2209 {
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
2210 for(int i = 0; i < a1->uNumVertices; i++)
1117
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2211 {
1641
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
2212 v6 = (double)pBLVRenderParams->fov_rad_fixpoint * 0.000015258789 / a1->field_B4[i*4];
1117
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2213 if ( pRenderer->pRenderD3D )
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2214 {
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2215 pGame->pIndoorCameraD3D->Project(
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2216 round(a1->field_B4[i*4]),
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2217 round(a1->field_B4[i*4+1]),
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2218 round(a1->field_B4[i*4+2]),
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2219 &a5,
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2220 &a6);
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2221 a1->field_B4[i*4+16] = (double)a5;
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2222 a1->field_B4[i*4+17] = (double)a6;
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2223 a1->field_B4[i*4+18] = round(a1->field_B4[i*4]);
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2224 }
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2225 else
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2226 {
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2227 a1->field_B4[i*4+16] = (double)pBLVRenderParams->uViewportCenterX - v6 * a1->field_B4[i*4+1];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2228 a1->field_B4[i*4+17] = (double)pBLVRenderParams->uViewportCenterY - v6 * a1->field_B4[i*4+2];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2229 a1->field_B4[i*4+18] = a1->field_B4[i*4];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2230 }
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2231 a1->field_B4[i*4+19] = a1->field_B4[i*4+3];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2232 if ( (double)(signed int)pViewport->uViewportTL_X <= a1->field_B4[i*4+16]
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2233 && (double)(signed int)pViewport->uViewportBR_X > a1->field_B4[i*4+16]
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2234 && (double)(signed int)pViewport->uViewportTL_Y <= a1->field_B4[i*4+17]
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2235 && (double)(signed int)pViewport->uViewportBR_Y > a1->field_B4[i*4+17] )
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2236 v16 = 1;
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2237 }
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2238 }
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2239 else
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2240 {
1390
613c77e51e38 Messed with spell effects drawing a bit.
Nomad
parents: 1345
diff changeset
2241 for(int i = 0; i < a1->uNumVertices; i++)
1117
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2242 {
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
2243 v12 = (double)pODMRenderParams->int_fov_rad / a1->field_B4[i*4];
1117
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2244 a1->field_B4[i*4+20] = (double)pViewport->uScreenCenterX - v12 * a1->field_B4[i*4+1];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2245 a1->field_B4[i*4+21] = (double)pViewport->uScreenCenterY - v12 * a1->field_B4[i*4+2];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2246 *((int *)&a1->field_B4[i*4+22]) = (int)a1->field_B4[i*4];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2247 *((int *)&a1->field_B4[i*4+23]) = a1->field_B4[i*4+3];
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2248 if ( (double)(signed int)pViewport->uViewportTL_X <= a1->field_B4[i*4+20]
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2249 && (double)(signed int)pViewport->uViewportBR_X > a1->field_B4[i*4+20]
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2250 && (double)(signed int)pViewport->uViewportTL_Y <= a1->field_B4[i*4+21]
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2251 && (double)(signed int)pViewport->uViewportBR_Y > a1->field_B4[i*4+21] )
ad89d1905b48 * stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents: 1113
diff changeset
2252 v16 = 1;
0
Ritor1
parents:
diff changeset
2253 }
Ritor1
parents:
diff changeset
2254 }
Ritor1
parents:
diff changeset
2255 return v16;
Ritor1
parents:
diff changeset
2256 }
Ritor1
parents:
diff changeset
2257
Ritor1
parents:
diff changeset
2258 // 73C84C: using guessed type char static_RenderBuildingsD3D_byte_73C84C_init_flag;
Ritor1
parents:
diff changeset
2259
Ritor1
parents:
diff changeset
2260 //----- (00479089) --------------------------------------------------------
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2261 bool __fastcall IsBModelVisible(unsigned int uModelID, int *reachable)
0
Ritor1
parents:
diff changeset
2262 {
Ritor1
parents:
diff changeset
2263 BSPModel *v2; // eax@1
Ritor1
parents:
diff changeset
2264 int v3; // edi@1
Ritor1
parents:
diff changeset
2265 int v4; // ebx@1
Ritor1
parents:
diff changeset
2266 int v5; // ST28_4@1
Ritor1
parents:
diff changeset
2267 int v6; // ecx@1
Ritor1
parents:
diff changeset
2268 int v7; // ebx@3
Ritor1
parents:
diff changeset
2269 int v8; // eax@3
Ritor1
parents:
diff changeset
2270 int v9; // eax@3
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2271 //int v10; // ebx@3
0
Ritor1
parents:
diff changeset
2272 signed int v11; // esi@6
Ritor1
parents:
diff changeset
2273 int v12; // esi@8
Ritor1
parents:
diff changeset
2274 bool result; // eax@9
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2275 //unsigned int v14; // [sp+Ch] [bp-20h]@1
0
Ritor1
parents:
diff changeset
2276 int v15; // [sp+Ch] [bp-20h]@5
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2277 //int *v16; // [sp+10h] [bp-1Ch]@1
0
Ritor1
parents:
diff changeset
2278 int v17; // [sp+1Ch] [bp-10h]@1
Ritor1
parents:
diff changeset
2279 int v18; // [sp+20h] [bp-Ch]@1
Ritor1
parents:
diff changeset
2280 int v19; // [sp+20h] [bp-Ch]@3
Ritor1
parents:
diff changeset
2281 int angle; // [sp+24h] [bp-8h]@1
Ritor1
parents:
diff changeset
2282 int v21; // [sp+28h] [bp-4h]@1
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2283 //int v22; // [sp+28h] [bp-4h]@3
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2284
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2285 //v16 = unused;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
2286 angle = (signed int)(pODMRenderParams->uCameraFovInDegrees << 11) / 360 >> 1;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2287 //v14 = uModelID;
0
Ritor1
parents:
diff changeset
2288 v2 = &pOutdoor->pBModels[uModelID];
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2289 v3 = v2->vBoundingCenter.x - pGame->pIndoorCameraD3D->vPartyPos.x;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2290 v4 = v2->vBoundingCenter.y - pGame->pIndoorCameraD3D->vPartyPos.y;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2291 v5 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY);
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2292 v21 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY);
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2293 v18 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX);
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2294 stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX);
0
Ritor1
parents:
diff changeset
2295 v6 = v5;
Ritor1
parents:
diff changeset
2296 v17 = v3 * v5 + v4 * v21;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2297 if (pGame->pIndoorCameraD3D->sRotationX)
0
Ritor1
parents:
diff changeset
2298 v17 = (unsigned __int64)(v17 * (signed __int64)v18) >> 16;
Ritor1
parents:
diff changeset
2299 v19 = v4 * v6 - v3 * v21;
Ritor1
parents:
diff changeset
2300 v7 = abs(v4);
Ritor1
parents:
diff changeset
2301 v8 = abs(v3);
322
ce39b96acf5c Killing friendly peasants subs
Nomad
parents: 317
diff changeset
2302 v9 = int_get_vector_length(v8, v7, 0);
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2303 //v10 = v14 * 188;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2304 //v22 = v9;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2305 *reachable = false;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2306 if ( v9 < pOutdoor->pBModels[uModelID].sBoundingRadius + 256 )
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2307 *reachable = true;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2308 v15 = stru_5C6E00->Sin(angle);
0
Ritor1
parents:
diff changeset
2309 if ( v19 >= 0 )
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2310 v11 = ((unsigned __int64)(v15 * (signed __int64)v17) >> 16) - ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16);
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2311 else
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2312 v11 = ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16) + ((unsigned __int64)(v15 * (signed __int64)v17) >> 16);
0
Ritor1
parents:
diff changeset
2313 v12 = v11 >> 16;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
2314 if ( v9 <= pODMRenderParams->shading_dist_mist + 2048 )
0
Ritor1
parents:
diff changeset
2315 {
79
6ad816231528 structure fixes, death crash fix
zipi
parents: 75
diff changeset
2316 //if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 )
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2317 if ( abs(v12) > pOutdoor->pBModels[uModelID].sBoundingRadius + 512 )
0
Ritor1
parents:
diff changeset
2318 {
Ritor1
parents:
diff changeset
2319 result = v12 < 0;
Ritor1
parents:
diff changeset
2320 LOBYTE(result) = v12 >= 0;
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2321 return result;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2322 }
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2323 else
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2324 return true;
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2325 }
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
2326 return false;
0
Ritor1
parents:
diff changeset
2327 }
Ritor1
parents:
diff changeset
2328
Ritor1
parents:
diff changeset
2329 //----- (00479295) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
2330 int Polygon::_479295()
0
Ritor1
parents:
diff changeset
2331 {
Ritor1
parents:
diff changeset
2332 ODMFace *v2; // esi@1
Ritor1
parents:
diff changeset
2333 int v3; // ecx@4
Ritor1
parents:
diff changeset
2334 int v4; // eax@4
Ritor1
parents:
diff changeset
2335 int v5; // edx@4
Ritor1
parents:
diff changeset
2336 int v6; // ST14_4@5
Ritor1
parents:
diff changeset
2337 int v7; // ST04_4@5
Ritor1
parents:
diff changeset
2338 stru149 *v8; // ecx@5
Ritor1
parents:
diff changeset
2339 Vec3_int_ thisa; // [sp+Ch] [bp-10h]@8
Ritor1
parents:
diff changeset
2340 int v11; // [sp+18h] [bp-4h]@4
Ritor1
parents:
diff changeset
2341
Ritor1
parents:
diff changeset
2342 v2 = this->pODMFace;
Ritor1
parents:
diff changeset
2343 if ( !v2->pFacePlane.vNormal.z )
Ritor1
parents:
diff changeset
2344 {
Ritor1
parents:
diff changeset
2345 v3 = v2->pFacePlane.vNormal.x;
Ritor1
parents:
diff changeset
2346 v4 = -v2->pFacePlane.vNormal.y;
Ritor1
parents:
diff changeset
2347 v5 = 0;
Ritor1
parents:
diff changeset
2348 v11 = 65536;
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2349 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2350 else if ( (v2->pFacePlane.vNormal.x || v2->pFacePlane.vNormal.y) && abs(v2->pFacePlane.vNormal.z) < 59082 )
0
Ritor1
parents:
diff changeset
2351 {
Ritor1
parents:
diff changeset
2352 thisa.x = -v2->pFacePlane.vNormal.y;
Ritor1
parents:
diff changeset
2353 thisa.y = v2->pFacePlane.vNormal.x;
Ritor1
parents:
diff changeset
2354 thisa.z = 0;
Ritor1
parents:
diff changeset
2355 thisa.Normalize_float();
Ritor1
parents:
diff changeset
2356 v4 = thisa.x;
Ritor1
parents:
diff changeset
2357 v3 = thisa.y;
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2358 v5 = 0;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2359 v11 = 65536;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2360 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2361 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2362 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2363 v3 = 0;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2364 v4 = 65536;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2365 v11 = 0;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2366 v5 = -65536;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
2367 }
0
Ritor1
parents:
diff changeset
2368 v6 = v11;
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
2369 sTextureDeltaU = v2->sTextureDeltaU;
0
Ritor1
parents:
diff changeset
2370 v7 = v3;
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
2371 v8 = ptr_38;
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
2372 sTextureDeltaV = v2->sTextureDeltaV;
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
2373 v8->_48616B_frustum_odm(v4, v7, 0, 0, v5, v6);
0
Ritor1
parents:
diff changeset
2374 return 1;
Ritor1
parents:
diff changeset
2375 }
Ritor1
parents:
diff changeset
2376
Ritor1
parents:
diff changeset
2377
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2378 unsigned short *LoadTgaTexture(const wchar_t *filename, int *out_width = nullptr, int *out_height = nullptr)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2379 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2380 #pragma pack(push, 1)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2381 struct TGAHeader
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2382 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2383 unsigned char tgaSkip;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2384 unsigned char colourmaptype; // type of colour map 0=none, 1=has palette
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2385 unsigned char tgaType; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2386
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2387 short colourmapstart; // first colour map entry in palette
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2388 short colourmaplength; // number of colours in palette
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2389 char colourmapbits; // number of bits per palette entry 15,16,24,32
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2390
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2391 //unsigned char tgaDontCare2[9];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2392 short xstart; // image x origin
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2393 short ystart; // image y origin
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2394
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2395 unsigned short tgaWidth;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2396 unsigned short tgaHeight;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2397 unsigned char tgaBPP;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2398
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2399 char descriptor; // image descriptor bits: 00vhaaaa
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2400 // h horizontal flip
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2401 // v vertical flip
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2402 // a alpha bits
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2403 };
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2404 #pragma pack(pop)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2405
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2406 if (out_width)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2407 *out_width = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2408 if (out_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2409 *out_height = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2410
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2411 DWORD w;
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
2412 void* file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2413 if (file == INVALID_HANDLE_VALUE)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2414 return nullptr;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2415
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2416 TGAHeader header;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2417 ReadFile(file, &header, sizeof(header), &w, nullptr);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2418 SetFilePointer(file, header.tgaSkip, nullptr, FILE_CURRENT);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2419
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2420 if (header.tgaBPP != 24 || header.tgaType != 2)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2421 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2422 CloseHandle(file);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2423 return nullptr;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2424 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2425
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2426 int imgSize = header.tgaWidth * header.tgaHeight * 3;
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
2427 unsigned char* pixels = new unsigned char[imgSize];
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2428 ReadFile(file, pixels, imgSize, &w, nullptr);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2429 CloseHandle(file);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2430
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2431 if (w != imgSize)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2432 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2433 delete [] pixels;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2434 return nullptr;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2435 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2436
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2437 if (out_width)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2438 *out_width = header.tgaWidth;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2439 if (out_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2440 *out_height = header.tgaHeight;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2441
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
2442 unsigned short* pixels_16bit = new unsigned short[imgSize / 3];
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2443 for (int i = 0; i < imgSize / 3; ++i)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2444 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2445 pixels_16bit[i] = (pixels[i * 3] / 8 & 0x1F) |
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2446 ((pixels[i * 3 + 1] / 4 & 0x3F) << 5) |
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2447 ((pixels[i * 3 + 2] / 8 & 0x1F) << 11);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2448 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2449 delete [] pixels;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2450 return pixels_16bit;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2451 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2452
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2453 unsigned short *skybox_xn, *skybox_xp,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2454 *skybox_yn, *skybox_yp,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2455 *skybox_zn, *skybox_zp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2456 int skybox_width, skybox_height;
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
2457
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2458 IDirect3DTexture2 *skybox_texture;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2459 IDirectDrawSurface4 *skybox_surface;
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
2460
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2461 bool Skybox_Initialize(const wchar_t *skybox_name)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2462 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2463 wchar_t xn_filename[1024], xp_filename[1024],
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2464 yn_filename[1024], yp_filename[1024],
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2465 zn_filename[1024], zp_filename[1024];
1165
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
2466 swprintf(xn_filename, wcslen(L"%s_xn.tga"), L"%s_xn.tga", skybox_name); swprintf(xp_filename, wcslen(L"%s_xp.tga"), L"%s_xp.tga", skybox_name);
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
2467 swprintf(yn_filename, wcslen(L"%s_yn.tga"), L"%s_yn.tga", skybox_name); swprintf(yp_filename, wcslen(L"%s_yp.tga"), L"%s_yp.tga", skybox_name);
29a8defbad9e temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents: 1160
diff changeset
2468 swprintf(zn_filename, wcslen(L"%s_zn.tga"), L"%s_zn.tga", skybox_name); swprintf(zp_filename, wcslen(L"%s_zp.tga"), L"%s_zp.tga", skybox_name);
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2469
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2470 int xn_width, xn_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2471 skybox_xn = LoadTgaTexture(xn_filename, &xn_width, &xn_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2472 if (!skybox_xn)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2473 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2474
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2475 int xp_width, xp_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2476 skybox_xp = LoadTgaTexture(xp_filename, &xp_width, &xp_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2477 if (!skybox_xp || xp_width != xn_width || xp_height != xn_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2478 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2479 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2480 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2481 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2482 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2483
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2484 int yn_width, yn_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2485 skybox_yn = LoadTgaTexture(yn_filename, &yn_width, &yn_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2486 if (!skybox_yn || yn_width != xn_width || yn_height != xn_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2487 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2488 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2489 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2490 if (skybox_yn) delete [] skybox_yn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2491 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2492 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2493
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2494 int yp_width, yp_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2495 skybox_yp = LoadTgaTexture(yp_filename, &yp_width, &yp_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2496 if (!skybox_yp || yp_width != xn_width || yp_height != xn_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2497 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2498 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2499 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2500 if (skybox_yn) delete [] skybox_yn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2501 if (skybox_yp) delete [] skybox_yp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2502 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2503 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2504
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2505 int zn_width, zn_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2506 skybox_zn = LoadTgaTexture(zn_filename, &zn_width, &zn_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2507 if (!skybox_zn || zn_width != xn_width || zn_height != xn_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2508 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2509 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2510 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2511 if (skybox_yn) delete [] skybox_yn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2512 if (skybox_yp) delete [] skybox_yp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2513 if (skybox_zn) delete [] skybox_zn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2514 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2515 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2516
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2517 int zp_width, zp_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2518 skybox_zp = LoadTgaTexture(zp_filename, &zp_width, &zp_height);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2519 if (!skybox_zp || zp_width != xn_width || zp_height != xn_height)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2520 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2521 delete [] skybox_xn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2522 if (skybox_xp) delete [] skybox_xp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2523 if (skybox_yn) delete [] skybox_yn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2524 if (skybox_yp) delete [] skybox_yp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2525 if (skybox_zn) delete [] skybox_zn;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2526 if (skybox_zp) delete [] skybox_zp;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2527 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2528 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2529
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2530 skybox_width = xn_width;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2531 skybox_height = xn_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2532
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2533
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2534 if (!pRenderer->pRenderD3D->CreateTexture(skybox_width, skybox_height, &skybox_surface, &skybox_texture,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2535 false, false, pRenderer->uMinDeviceTextureDim))
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2536 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2537
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2538 return true;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2539 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2540
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2541 struct vector
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2542 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2543 float x, y, z;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2544 };
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
2545
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2546 struct matrix
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2547 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2548 float m[4][4];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2549 };
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
2550
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2551 void VectorNormalize(vector *v)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2552 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2553 float invmag = 1.0f / sqrtf(v->x * v->x + v->y * v->y + v->z * v->z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2554 v->x *= invmag;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2555 v->y *= invmag;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2556 v->z *= invmag;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2557 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
2558
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2559 void MatrixRotationAxis(matrix *pout, CONST vector *pv, float angle)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2560 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2561 memset(pout, 0, sizeof(matrix));
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2562 pout->m[3][0] = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2563 pout->m[3][1] = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2564 pout->m[3][2] = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2565 pout->m[3][3] = 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2566
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2567 vector v;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2568 v.x = pv->x; v.y = pv->y; v.z = pv->z;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2569 VectorNormalize(&v);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2570
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2571 pout->m[0][0] = (1.0f - cos(angle)) * v.x * v.x + cos(angle);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2572 pout->m[1][0] = (1.0f - cos(angle)) * v.x * v.y - sin(angle) * v.z;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2573 pout->m[2][0] = (1.0f - cos(angle)) * v.x * v.z + sin(angle) * v.y;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2574 pout->m[0][1] = (1.0f - cos(angle)) * v.y * v.x + sin(angle) * v.z;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2575 pout->m[1][1] = (1.0f - cos(angle)) * v.y * v.y + cos(angle);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2576 pout->m[2][1] = (1.0f - cos(angle)) * v.y * v.z - sin(angle) * v.x;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2577 pout->m[0][2] = (1.0f - cos(angle)) * v.z * v.x - sin(angle) * v.y;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2578 pout->m[1][2] = (1.0f - cos(angle)) * v.z * v.y + sin(angle) * v.x;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2579 pout->m[2][2] = (1.0f - cos(angle)) * v.z * v.z + cos(angle);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2580 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
2581
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2582 void VectorTransform(const matrix *m, const vector *v, vector *out)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2583 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2584 out->x = m->m[0][0] * v->x + m->m[1][0] * v->y + m->m[2][0] * v->z + m->m[3][0];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2585 out->y = m->m[0][1] * v->x + m->m[1][1] * v->y + m->m[2][1] * v->z + m->m[3][1];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2586 out->z = m->m[0][2] * v->x + m->m[1][2] * v->y + m->m[2][2] * v->z + m->m[3][2];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2587 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2588
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2589 bool DrawSkyD3D_Skybox()
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2590 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2591 static bool initialized = false,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2592 initialization_failed = false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2593 if (initialization_failed)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2594 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2595
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2596 static int last_camera_rot_y,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2597 last_camera_rot_x;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2598 if (!initialized)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2599 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2600 if (!Skybox_Initialize(L"data/skybox/stars"))
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2601 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2602 initialization_failed = true;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2603 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2604 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2605 initialized = true;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2606
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2607 last_camera_rot_y = pParty->sRotationY + 1; // force update for the first run
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2608 last_camera_rot_x = pParty->sRotationX + 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2609 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2610
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2611 /*
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2612 r(y) =
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2613 cos y 0 sin y 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2614 0 1 0 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2615 -sin y 0 cos y 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2616 0 0 0 1
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2617
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2618 x cos y - z sin y
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2619 y
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2620 x sin y + z cos y
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2621 1
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2622
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2623
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2624
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2625 r(x) = // should be r(right) actually
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2626 1 0 0 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2627 0 cos x -sin x 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2628 0 sin x cos x 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2629 0 0 0 1
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2630
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2631
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2632 x
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2633 y cos x + z sin x
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2634 -y sin x + z cos x
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2635 1
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2636
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2637 */
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2638
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2639 if (last_camera_rot_y == pParty->sRotationY &&
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2640 last_camera_rot_x == pParty->sRotationX)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2641 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2642 draw:
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2643 struct RenderVertexD3D3 v[6];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2644
692
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
2645 v[0].pos.x = pViewport->uScreen_TL_X;
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
2646 v[0].pos.y = pViewport->uScreen_TL_Y;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2647 v[0].pos.z = 0.99989998;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2648 v[0].rhw = 1;
2006
30c2b575d25c signed fixes
zipi
parents: 2002
diff changeset
2649 v[0].diffuse = -1;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2650 v[0].specular = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2651 v[0].texcoord.x = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2652 v[0].texcoord.y = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2653
692
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
2654 v[1].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth;
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
2655 v[1].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2656 v[1].pos.z = 0.99989998;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2657 v[1].rhw = 1;
2006
30c2b575d25c signed fixes
zipi
parents: 2002
diff changeset
2658 v[1].diffuse = -1;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2659 v[1].specular = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2660 v[1].texcoord.x = (float)pViewport->uScreenWidth / skybox_width;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2661 v[1].texcoord.y = (float)pViewport->uScreenHeight / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2662
692
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
2663 v[2].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth;
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
2664 v[2].pos.y = pViewport->uScreen_TL_Y;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2665 v[2].pos.z = 0.99989998;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2666 v[2].rhw = 1;
2006
30c2b575d25c signed fixes
zipi
parents: 2002
diff changeset
2667 v[2].diffuse = -1;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2668 v[2].specular = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2669 v[2].texcoord.x = (float)pViewport->uScreenWidth / skybox_width;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2670 v[2].texcoord.y = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2671
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2672 memcpy(&v[3], &v[0], sizeof(*v));
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2673
692
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
2674 v[4].pos.x = pViewport->uScreen_TL_X;
066e2b29b30f viewport.cpp added
Gloval
parents: 688
diff changeset
2675 v[4].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2676 v[4].pos.z = 0.99989998;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2677 v[4].rhw = 1;
2006
30c2b575d25c signed fixes
zipi
parents: 2002
diff changeset
2678 v[4].diffuse = -1;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2679 v[4].specular = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2680 v[4].texcoord.x = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2681 v[4].texcoord.y = (float)pViewport->uScreenHeight / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2682
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2683 memcpy(&v[5], &v[1], sizeof(*v));
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2684
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2685 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2686 pRenderer->pRenderD3D->pDevice->SetTexture(0, skybox_texture);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2687 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v, 6, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2688 //pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v + 1, 3, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2689
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2690 return true;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2691 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2692
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2693
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2694 DDSURFACEDESC2 desc;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2695 desc.dwSize = sizeof(desc);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2696 if (!pRenderer->LockSurface_DDraw4(skybox_surface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY))
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2697 return false;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2698
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2699 last_camera_rot_y = pParty->sRotationY;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2700 last_camera_rot_x = pParty->sRotationX;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2701
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2702 float aspect = (float)pViewport->uScreenWidth / (float)pViewport->uScreenHeight;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
2703 float fov_x = 3.141592f * (pODMRenderParams->uCameraFovInDegrees + 0) / 360.0f;
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2704 float fov_y = fov_x / aspect;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2705
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2706 float ray_dx = fov_x / (float)pViewport->uScreenWidth,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2707 ray_dy = fov_y / (float)pViewport->uScreenHeight;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2708 float party_angle_x = 2 * 3.141592653589 * pParty->sRotationX / 2048.0,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2709 party_angle_y = 2 * 3.141592653589 * pParty->sRotationY / 2048.0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2710 for (int y = 0; y < pViewport->uScreenHeight; ++y)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2711 for (int x = 0; x < pViewport->uScreenWidth; ++x)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2712 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2713 float angle_x = party_angle_x - (y - pViewport->uScreenHeight / 2) * ray_dy;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2714 float angle_y = party_angle_y - (x - pViewport->uScreenWidth / 2) * ray_dx;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2715
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2716 float _dir_x_ = 1,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2717 _dir_y_ = 0,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2718 _dir_z_ = 0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2719
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2720 float dir_x_ = _dir_x_ * cosf(angle_y);// - _dir_z_ * sinf(angle_y); // rotation around y
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2721 //float dir_y_ = _dir_y_;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2722 float dir_z_ = _dir_x_ * sinf(angle_y);// + _dir_z_ * cosf(angle_y);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2723
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2724 //float dir_x = dir_x_; // rotation around x
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2725 //float dir_y = /*dir_y_ * cosf(angle_x)*/ + dir_z_ * sinf(angle_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2726 //float dir_z = /*-dir_y_ * sinf(angle_x)*/ + dir_z_ * cosf(angle_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2727
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2728 vector right; // rotate around right actually to avoid space distortion
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2729 right.x = /*dir_y * 0*/ - dir_z_ * 1;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2730 right.y = /*dir_z_ * 0 - dir_x_ * */0;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2731 right.z = dir_x_ * 1/* - dir_y_ * 0*/;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2732 //VectorNormalize(&right);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2733
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2734 matrix rightMatrix;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2735 MatrixRotationAxis(&rightMatrix, &right, angle_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2736
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2737 vector v1, v2;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2738 v1.x = dir_x_; v1.y = 0; v1.z = dir_z_;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2739 VectorTransform(&rightMatrix, &v1, &v2);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2740
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2741 float dir_x = v2.x,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2742 dir_y = v2.y,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2743 dir_z = v2.z;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2744
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2745 float abs_dir_x = fabsf(dir_x),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2746 abs_dir_y = fabsf(dir_y),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2747 abs_dir_z = fabsf(dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2748
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2749 unsigned short color = (0x1F << 11) | (0x1F << 5) | (5); //default to orange
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2750 if (abs_dir_x >= abs_dir_y)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2751 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2752 if (abs_dir_x >= abs_dir_z)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2753 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2754 if (dir_x >= 0)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2755 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2756 float instersect_y = dir_y / (2.0f * dir_x); // plane equation for this side is x + 0.5 = 0
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2757 float instersect_z = dir_z / (2.0f * dir_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2758
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2759 float u = 1.0f - (instersect_z + 0.5f),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2760 v = 1.0f - (instersect_y + 0.5f);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2761
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2762 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2763 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2764
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2765 color = skybox_xp[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2766 //color = ty * 0x1F / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2767 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2768 else
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2769 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2770 float instersect_y = dir_y / (2.0f * dir_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2771 float instersect_z = dir_z / (2.0f * dir_x);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2772
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2773 float u = 1.0f - (instersect_z + 0.5f),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2774 v = instersect_y + 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2775
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2776 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2777 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2778
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2779 color = skybox_xn[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2780 //color = tx * 0x1F / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2781 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2782 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2783 else if (dir_z >= 0)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2784 goto DIR_ZP;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2785 else
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2786 goto DIR_ZN;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2787 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2788 else if (abs_dir_y >= abs_dir_z)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2789 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2790 if (dir_y >= 0)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2791 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2792 float instersect_x = dir_x / (2.0f * dir_y);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2793 float instersect_z = dir_z / (2.0f * dir_y);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2794
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2795 float u = instersect_x + 0.5f,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2796 v = instersect_z + 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2797
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2798 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2799 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2800
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2801 color = skybox_yp[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2802 //color = tx * 0x1F / skybox_height;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2803 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2804 /*else should never be seen i guess
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2805 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2806 __debugbreak();
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2807 // -y
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2808 //Log::Warning(L"(%03u, %03u): -y", x, y);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2809 }*/
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2810 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2811 else if (dir_z >= 0)
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2812 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2813 DIR_ZP:
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2814 // +z
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2815 float instersect_x = dir_x / (2.0f * dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2816 float instersect_y = dir_y / (2.0f * dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2817 //float intersect_z = 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2818
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2819 float u = instersect_x + 0.5f,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2820 v = -instersect_y + 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2821
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2822 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2823 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2824
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2825 color = skybox_zp[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2826 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2827 else
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2828 {
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2829 DIR_ZN:
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2830 // -z
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2831 float instersect_x = -dir_x / (2.0f * dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2832 float instersect_y = -dir_y / (2.0f * dir_z);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2833 //float intersect_z = -0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2834
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2835 float u = 1.0f - instersect_x - 0.5f,
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2836 v = -instersect_y + 0.5f;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2837
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2838 int tx = u * (skybox_width - 1),
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2839 ty = v * (skybox_height - 1);
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2840
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2841 color = skybox_zn[ty * skybox_width + tx];
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2842 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2843
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2844 //pRenderer->pTargetSurface[(pViewport->uScreenY + y) * pRenderer->uTargetSurfacePitch + pViewport->uScreenX + x] = color;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2845 ((unsigned __int16 *)((char *)desc.lpSurface + y * desc.lPitch))[x] = color;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2846 }
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2847
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2848 ErrD3D((skybox_surface)->Unlock(0));
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2849 goto draw;
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
2850 }
0
Ritor1
parents:
diff changeset
2851 //----- (0047A384) --------------------------------------------------------
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
2852 void ODM_LoadAndInitialize(const char *pLevelFilename, ODMRenderParams *thisa)
0
Ritor1
parents:
diff changeset
2853 {
Ritor1
parents:
diff changeset
2854 int v2; // ebx@3
Ritor1
parents:
diff changeset
2855 unsigned int v3; // eax@3
Ritor1
parents:
diff changeset
2856 MapInfo *v4; // edi@4
Ritor1
parents:
diff changeset
2857 //int v5; // eax@8
Ritor1
parents:
diff changeset
2858 //SpawnPointMM7 *v6; // edx@14
Ritor1
parents:
diff changeset
2859 size_t v7; // eax@19
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2860 //char *v8; // eax@19
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2861 //char *v9; // eax@21
0
Ritor1
parents:
diff changeset
2862 char Source[120]; // [sp+Ch] [bp-84h]@19
Ritor1
parents:
diff changeset
2863 const char *pFilename; // [sp+84h] [bp-Ch]@1
Ritor1
parents:
diff changeset
2864 //unsigned int v12; // [sp+88h] [bp-8h]@12
Ritor1
parents:
diff changeset
2865 //int v13; // [sp+8Ch] [bp-4h]@11
Ritor1
parents:
diff changeset
2866
Ritor1
parents:
diff changeset
2867 pFilename = pLevelFilename;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1563
diff changeset
2868 //thisa->AllocSoftwareDrawBuffers();
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
2869 pODMRenderParams->Initialize();
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2870 pWeather->bRenderSnow = false;
0
Ritor1
parents:
diff changeset
2871 pRenderer->ClearZBuffer(0, 479);
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
2872 thisa = (ODMRenderParams *)1;
0
Ritor1
parents:
diff changeset
2873 GetAlertStatus();
Ritor1
parents:
diff changeset
2874 if ( qword_A750D8 )
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1563
diff changeset
2875 qword_A750D8 = 0;
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1470
diff changeset
2876 v2 = pMapStats->GetMapInfo(pCurrentMapName);
0
Ritor1
parents:
diff changeset
2877 v3 = 0;
Ritor1
parents:
diff changeset
2878 if ( v2 )
Ritor1
parents:
diff changeset
2879 {
Ritor1
parents:
diff changeset
2880 v4 = &pMapStats->pInfos[v2];
Ritor1
parents:
diff changeset
2881 v3 = v4->uRespawnIntervalDays;
Ritor1
parents:
diff changeset
2882 }
Ritor1
parents:
diff changeset
2883 else
Ritor1
parents:
diff changeset
2884 {
Ritor1
parents:
diff changeset
2885 v4 = (MapInfo *)thisa;
Ritor1
parents:
diff changeset
2886 }
767
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
2887 day_attrib &= ~DAY_ATTRIB_FOG;
0
Ritor1
parents:
diff changeset
2888 dword_6BE13C_uCurrentlyLoadedLocationID = v2;
Ritor1
parents:
diff changeset
2889 pOutdoor->Initialize(
Ritor1
parents:
diff changeset
2890 pFilename,
Ritor1
parents:
diff changeset
2891 (unsigned int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 0x3C / 0x3C / 0x18 + 1,
Ritor1
parents:
diff changeset
2892 v3,
Ritor1
parents:
diff changeset
2893 (int)&thisa);
2061
b2a434d65344 GAME_SETTINGS_* defines introduced
Nomad
parents: 2044
diff changeset
2894 if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) )
0
Ritor1
parents:
diff changeset
2895 {
Ritor1
parents:
diff changeset
2896 InitializeActors();
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
2897 InitializeSpriteObjects();
0
Ritor1
parents:
diff changeset
2898 }
2061
b2a434d65344 GAME_SETTINGS_* defines introduced
Nomad
parents: 2044
diff changeset
2899 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_2000;
0
Ritor1
parents:
diff changeset
2900 //v5 = 0;
Ritor1
parents:
diff changeset
2901 if ( !v2 )
Ritor1
parents:
diff changeset
2902 thisa = 0;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
2903 if ( thisa == (ODMRenderParams *)1 )
0
Ritor1
parents:
diff changeset
2904 {
Ritor1
parents:
diff changeset
2905 //v13 = 0;
Ritor1
parents:
diff changeset
2906 for (uint i = 0; i < pOutdoor->uNumSpawnPoints; ++i)
Ritor1
parents:
diff changeset
2907 {
Ritor1
parents:
diff changeset
2908 //v12 = 0;
Ritor1
parents:
diff changeset
2909 //while ( 1 )
Ritor1
parents:
diff changeset
2910 //{
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
2911 SpawnPointMM7* spawn = pOutdoor->pSpawnPoints + i;
0
Ritor1
parents:
diff changeset
2912 //v6 = &pOutdoor->pSpawnPoints[v12 / 0x18];
Ritor1
parents:
diff changeset
2913 if (spawn->uKind == 3 )
Ritor1
parents:
diff changeset
2914 SpawnEncounter(v4, spawn, 0, 0, 0);
Ritor1
parents:
diff changeset
2915 else
Ritor1
parents:
diff changeset
2916 v4->SpawnRandomTreasure(spawn);
Ritor1
parents:
diff changeset
2917 //++v13;
Ritor1
parents:
diff changeset
2918 //v12 += 24;
Ritor1
parents:
diff changeset
2919 //if ( v13 >= (signed int)pOutdoor->uNumSpawnPoints )
Ritor1
parents:
diff changeset
2920 // break;
Ritor1
parents:
diff changeset
2921 //v5 = 0;
Ritor1
parents:
diff changeset
2922 //}
Ritor1
parents:
diff changeset
2923 }
Ritor1
parents:
diff changeset
2924 RespawnGlobalDecorations();
Ritor1
parents:
diff changeset
2925 }
Ritor1
parents:
diff changeset
2926 pOutdoor->PrepareDecorations();
2065
87be06553c76 rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
Ritor1
parents: 2061
diff changeset
2927 pOutdoor->ArrangeSpriteObjects();
0
Ritor1
parents:
diff changeset
2928 pOutdoor->InitalizeActors(v2);
Ritor1
parents:
diff changeset
2929 pOutdoor->MessWithLUN();
Ritor1
parents:
diff changeset
2930 v7 = strlen("levels\\");
Ritor1
parents:
diff changeset
2931 strcpy(Source, &pFilename[v7]);
Ritor1
parents:
diff changeset
2932 strcpy(pOutdoor->pLevelFilename, Source);
Ritor1
parents:
diff changeset
2933 pWeather->Initialize();
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2934 pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
2935 pGame->pIndoorCameraD3D->sRotationX = pParty->sRotationX;
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
2936 //pODMRenderParams->RotationToInts();
0
Ritor1
parents:
diff changeset
2937 pOutdoor->UpdateSunlightVectors();
1638
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
2938
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
2939 float fov_rad;
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
2940 float fov_rad_inv;
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
2941 //----- (0042394D) --------------------------------------------------------
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
2942 //void IndoorCamera::Initialize(int degFov, unsigned int uViewportWidth, unsigned int uViewportHeight)
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
2943 {
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
2944 //pIndoorCamera->Initialize(65, viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1,
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
2945 // viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y + 1);
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
2946
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
2947 int uViewportWidth = viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1;
1641
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
2948
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
2949 extern float _calc_fov(int viewport_width, int angle_degree);
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
2950 fov_rad = _calc_fov(uViewportWidth, 65);
466c5e15f524 Excess wrapper (IndoorLocation_drawstru) removed.
Nomad
parents: 1640
diff changeset
2951 fov_rad_inv = 65536.0 / fov_rad;
1638
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
2952 }
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
2953 pODMRenderParams->int_fov_rad = (signed __int64)fov_rad;
ccde94f02b75 class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents: 1637
diff changeset
2954 pODMRenderParams->int_fov_rad_inv = (signed __int64)fov_rad_inv;
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2955
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2956 for (int i = 0; i < 20000; ++i)
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2957 {
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2958 array_77EC08[i].ptr_38 = &stru_8019C8;
1644
dbd6f940f26c Fixed Celestia sky a bit.
Nomad
parents: 1642
diff changeset
2959
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2960 array_77EC08[i].ptr_48 = nullptr;
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2961 }
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2962
0
Ritor1
parents:
diff changeset
2963 MM7Initialization();
Ritor1
parents:
diff changeset
2964 }
Ritor1
parents:
diff changeset
2965
Ritor1
parents:
diff changeset
2966 //----- (0047C370) --------------------------------------------------------
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2967 unsigned int GetLevelFogColor()
0
Ritor1
parents:
diff changeset
2968 {
Ritor1
parents:
diff changeset
2969 signed __int64 v1; // qax@5
Ritor1
parents:
diff changeset
2970 int v2; // eax@6
Ritor1
parents:
diff changeset
2971
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2972 if (bUnderwater)
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2973 return 0xFF258F5C;
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2974
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2975 if (day_attrib & DAY_ATTRIB_FOG)
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2976 {
767
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
2977 if ( pWeather->bNight ) // night-time fog
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
2978 {
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2979 __debugbreak(); // decompilation can be inaccurate, please send savegame to Nomad
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
2980 v2 = -(pWeather->bNight != 1);
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2981 return (v2 & 0xE0E0E1) - 0xE0E0E1;
0
Ritor1
parents:
diff changeset
2982 }
Ritor1
parents:
diff changeset
2983 else
Ritor1
parents:
diff changeset
2984 {
Ritor1
parents:
diff changeset
2985 v1 = (signed __int64)((1.0 - pOutdoor->fFogDensity) * 200.0 + pOutdoor->fFogDensity * 31.0);
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2986 return v1 | (((unsigned int)v1 | (((unsigned int)v1 | 0xFFFFFF00) << 8)) << 8);
0
Ritor1
parents:
diff changeset
2987 }
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2988 }
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2989
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
2990 return 0;
0
Ritor1
parents:
diff changeset
2991 }
Ritor1
parents:
diff changeset
2992
Ritor1
parents:
diff changeset
2993 //----- (0047C3D7) --------------------------------------------------------
Ritor1
parents:
diff changeset
2994 int __fastcall sub_47C3D7_get_fog_related_stuff(int a1, int a2, float a3)
Ritor1
parents:
diff changeset
2995 {
Ritor1
parents:
diff changeset
2996 int v3; // ecx@1
Ritor1
parents:
diff changeset
2997 double v5; // st7@10
Ritor1
parents:
diff changeset
2998 signed int v7; // ecx@11
Ritor1
parents:
diff changeset
2999 double v8; // st6@12
Ritor1
parents:
diff changeset
3000 double v9; // st7@15
Ritor1
parents:
diff changeset
3001 double v10; // st6@16
Ritor1
parents:
diff changeset
3002 float v11; // ST14_4@17
Ritor1
parents:
diff changeset
3003 double v12; // ST08_8@17
Ritor1
parents:
diff changeset
3004
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
3005 v3 = pWeather->bNight;
0
Ritor1
parents:
diff changeset
3006 if ( bUnderwater == 1 )
Ritor1
parents:
diff changeset
3007 v3 = 0;
767
45615cacad31 Fog fixed
Nomad
parents: 755
diff changeset
3008 if ( pParty->armageddon_timer || !(day_attrib & DAY_ATTRIB_FOG) && !bUnderwater )
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3009 return 0xFF000000;
0
Ritor1
parents:
diff changeset
3010 if ( v3 )
Ritor1
parents:
diff changeset
3011 {
Ritor1
parents:
diff changeset
3012 v5 = (double)day_fogrange_1;
Ritor1
parents:
diff changeset
3013 if ( a3 < v5 )
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3014 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3015 v7 = 0;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3016 if ( a3 == 0.0 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3017 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3018 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3019 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3020 goto LABEL_21;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3021 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3022 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3023 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3024 v8 = (double)day_fogrange_2;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3025 if ( a3 > v8 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3026 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3027 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3028 if ( a3 == 0.0 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3029 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3030 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3031 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3032 goto LABEL_21;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3033 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3034 v7 = (signed __int64)((a3 - v5) / (v8 - v5) * 216.0);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3035 }
0
Ritor1
parents:
diff changeset
3036 }
Ritor1
parents:
diff changeset
3037 else
Ritor1
parents:
diff changeset
3038 {
Ritor1
parents:
diff changeset
3039 v9 = (double)day_fogrange_1;
Ritor1
parents:
diff changeset
3040 if ( a3 < v9 )
Ritor1
parents:
diff changeset
3041 {
Ritor1
parents:
diff changeset
3042 v7 = 0;
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3043 if ( a3 == 0.0 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3044 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3045 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3046 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3047 goto LABEL_21;
0
Ritor1
parents:
diff changeset
3048 }
1418
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3049 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3050 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3051 v10 = (double)day_fogrange_2;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3052 if ( a3 > v10 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3053 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3054 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3055 if ( a3 == 0.0 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3056 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3057 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3058 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3059 goto LABEL_21;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3060 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3061 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3062 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3063 v11 = (a3 - v9) * 216.0 / (v10 - v9);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3064 v12 = v11 + 6.7553994e15;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3065 v7 = LODWORD(v12);
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3066 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3067 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3068 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3069 if ( v7 > 216 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3070 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3071 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3072 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3073 else
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3074 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3075 if ( a3 == 0.0 )
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3076 {
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3077 v7 = 216;
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3078 }
483b1b453986 more label cleaning
zipi
parents: 1413
diff changeset
3079 }
0
Ritor1
parents:
diff changeset
3080 LABEL_21:
Ritor1
parents:
diff changeset
3081 if ( a2 )
Ritor1
parents:
diff changeset
3082 v7 = 248;
Ritor1
parents:
diff changeset
3083 return (-1 - v7) << 24;
Ritor1
parents:
diff changeset
3084 }
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3085
0
Ritor1
parents:
diff changeset
3086 //----- (0047C4FC) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
3087 int __fastcall GetActorTintColor(int max_dimm, int min_dimm, float distance, int a4, RenderBillboard *a5)
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3088 {
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3089 //int v5; // esi@1
0
Ritor1
parents:
diff changeset
3090 signed int v6; // edx@1
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3091 //signed int result; // eax@2
0
Ritor1
parents:
diff changeset
3092 int v8; // eax@3
Ritor1
parents:
diff changeset
3093 double v9; // st7@12
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
3094 //double v10; // ST0C_8@18
0
Ritor1
parents:
diff changeset
3095 int v11; // ecx@28
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3096 //signed int v12; // edi@28
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3097 //double v13; // ST0C_8@33
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3098 //double v14; // ST0C_8@34
0
Ritor1
parents:
diff changeset
3099 double v15; // st7@44
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3100 //double v16; // ST0C_8@44
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3101 //double v17; // ST0C_8@44
0
Ritor1
parents:
diff changeset
3102 int v18; // ST14_4@44
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3103 //double v19; // ST0C_8@44
0
Ritor1
parents:
diff changeset
3104 signed int v20; // [sp+10h] [bp-4h]@10
Ritor1
parents:
diff changeset
3105 float a3a; // [sp+1Ch] [bp+8h]@33
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3106 //float a3b; // [sp+1Ch] [bp+8h]@34
0
Ritor1
parents:
diff changeset
3107 float a3c; // [sp+1Ch] [bp+8h]@44
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3108 //float a3d; // [sp+1Ch] [bp+8h]@44
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
3109 //float a4b; // [sp+20h] [bp+Ch]@18
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3110 //int a4a; // [sp+20h] [bp+Ch]@33
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3111 //float a4c; // [sp+20h] [bp+Ch]@44
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3112 //float a4d; // [sp+20h] [bp+Ch]@44
0
Ritor1
parents:
diff changeset
3113 int a5a; // [sp+24h] [bp+10h]@44
Ritor1
parents:
diff changeset
3114
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3115 //v5 = a2;
0
Ritor1
parents:
diff changeset
3116 v6 = 0;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3117
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3118 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3119 return 8 * (31 - max_dimm) | ((8 * (31 - max_dimm) | ((31 - max_dimm) << 11)) << 8);
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3120
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3121 if (pParty->armageddon_timer)
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3122 return 0xFFFF0000;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3123
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
3124 v8 = pWeather->bNight;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3125 if (bUnderwater)
0
Ritor1
parents:
diff changeset
3126 v8 = 0;
Ritor1
parents:
diff changeset
3127 if ( v8 )
Ritor1
parents:
diff changeset
3128 {
Ritor1
parents:
diff changeset
3129 v20 = 1;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3130 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 )
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3131 v20 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower;
0
Ritor1
parents:
diff changeset
3132 v9 = (double)v20 * 1024.0;
Ritor1
parents:
diff changeset
3133 if ( a4 )
1901
Ritor1
parents: 1861
diff changeset
3134 {
Ritor1
parents: 1861
diff changeset
3135 v6 = 216;
Ritor1
parents: 1861
diff changeset
3136 goto LABEL_20;
Ritor1
parents: 1861
diff changeset
3137 }
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3138 if ( distance <= v9 )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3139 {
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3140 if ( distance > 0.0 )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3141 {
750
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
3142 //a4b = distance * 216.0 / v9;
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
3143 //v10 = a4b + 6.7553994e15;
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
3144 //v6 = LODWORD(v10);
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
3145 v6 = floorf(0.5f + distance * 216.0 / v9);
23a07ead5980 Night fixed.
Nomad
parents: 741
diff changeset
3146 if (v6 > 216 )
1901
Ritor1
parents: 1861
diff changeset
3147 {
Ritor1
parents: 1861
diff changeset
3148 v6 = 216;
Ritor1
parents: 1861
diff changeset
3149 goto LABEL_20;
Ritor1
parents: 1861
diff changeset
3150 }
0
Ritor1
parents:
diff changeset
3151 }
Ritor1
parents:
diff changeset
3152 }
Ritor1
parents:
diff changeset
3153 else
Ritor1
parents:
diff changeset
3154 {
Ritor1
parents:
diff changeset
3155 v6 = 216;
Ritor1
parents:
diff changeset
3156 }
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3157 if ( distance != 0.0 )
0
Ritor1
parents:
diff changeset
3158 {
Ritor1
parents:
diff changeset
3159 LABEL_20:
Ritor1
parents:
diff changeset
3160 if ( a5 )
Ritor1
parents:
diff changeset
3161 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3);
Ritor1
parents:
diff changeset
3162 if ( v6 > 216 )
Ritor1
parents:
diff changeset
3163 v6 = 216;
Ritor1
parents:
diff changeset
3164 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8);
Ritor1
parents:
diff changeset
3165 }
1901
Ritor1
parents: 1861
diff changeset
3166 //LABEL_19:
0
Ritor1
parents:
diff changeset
3167 v6 = 216;
Ritor1
parents:
diff changeset
3168 goto LABEL_20;
Ritor1
parents:
diff changeset
3169 }
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3170
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3171
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3172
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3173 if (fabsf(distance) < 1.0e-6f)
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3174 return 0xFFF8F8F8;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3175
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3176 // dim in measured in 8-steps
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3177 v11 = 8 * (max_dimm - min_dimm);
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3178 //v12 = v11;
0
Ritor1
parents:
diff changeset
3179 if ( v11 >= 0 )
Ritor1
parents:
diff changeset
3180 {
Ritor1
parents:
diff changeset
3181 if ( v11 > 216 )
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3182 v11 = 216;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3183 }
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3184 else
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3185 v11 = 0;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3186
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3187 float fog_density_mult = 216.0f;
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3188 if (a4)
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
3189 fog_density_mult += distance / (double)pODMRenderParams->shading_dist_shade * 32.0;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3190
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3191 v6 = v11 + floorf(pOutdoor->fFogDensity * fog_density_mult + 0.5f);
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3192 /*if ( a4 )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3193 {
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3194 //a3b = pOutdoor->fFogDensity * 216.0;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3195 //v14 = a3b + 6.7553994e15;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3196 //a4a = floorf(a3b + 0.5f);//LODWORD(v14);
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3197 }
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3198 else
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3199 {
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
3200 //a3a = (distance / (double)pODMRenderParams->shading_dist_shade * 32.0 + 216.0) * pOutdoor->fFogDensity;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3201 //v13 = a3a + 6.7553994e15;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3202 //a4a = floorf(a3a + 0.5f);//LODWORD(v13);
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3203 }
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3204 v6 = a4a + v11;*/
0
Ritor1
parents:
diff changeset
3205 if ( a5 )
Ritor1
parents:
diff changeset
3206 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3);
Ritor1
parents:
diff changeset
3207 if ( v6 > 216 )
Ritor1
parents:
diff changeset
3208 v6 = 216;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3209 if ( v6 < v11 )
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3210 v6 = v11;
638
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3211 if ( v6 > 8 * pOutdoor->max_terrain_dimming_level )
ccf8b4815a1f GetActorTintColor fixed
Nomad
parents: 633
diff changeset
3212 v6 = 8 * pOutdoor->max_terrain_dimming_level;
0
Ritor1
parents:
diff changeset
3213 if ( !bUnderwater )
Ritor1
parents:
diff changeset
3214 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8);
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3215 else
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3216 {
0
Ritor1
parents:
diff changeset
3217 v15 = (double)(255 - v6) * 0.0039215689;
Ritor1
parents:
diff changeset
3218 a3c = v15;
349
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3219 //a4c = v15 * 16.0;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3220 //v16 = a4c + 6.7553994e15;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3221 a5a = floorf(v15 * 16.0 + 0.5f);//LODWORD(v16);
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3222 //a4d = a3c * 194.0;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3223 //v17 = a4d + 6.7553994e15;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3224 v18 = floorf(a3c * 194.0 + 0.5f);//LODWORD(v17);
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3225 //a3d = a3c * 153.0;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3226 //v19 = a3d + 6.7553994e15;
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3227 return (int)floorf(a3c * 153.0 + 0.5f)/*LODWORD(v19)*/ | ((v18 | (a5a << 8)) << 8);
672b83584b0f GetActorTintColor
Nomad
parents: 336
diff changeset
3228 }
0
Ritor1
parents:
diff changeset
3229 }
Ritor1
parents:
diff changeset
3230 // 6BE3C4: using guessed type char bUnderwater;
Ritor1
parents:
diff changeset
3231
Ritor1
parents:
diff changeset
3232 //----- (0047F44B) --------------------------------------------------------
1412
182d58b2a34c Harmondale falling under terrain fixed
Nomad
parents: 1411
diff changeset
3233 unsigned int WorldPosToGridCellX(int sWorldPosX)
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
3234 {
1412
182d58b2a34c Harmondale falling under terrain fixed
Nomad
parents: 1411
diff changeset
3235 return (sWorldPosX >> 9) + 64; // sar is in original exe, resulting -880 / 512 = -1
182d58b2a34c Harmondale falling under terrain fixed
Nomad
parents: 1411
diff changeset
3236 // and -880 sar 9 = -2
0
Ritor1
parents:
diff changeset
3237 }
Ritor1
parents:
diff changeset
3238
Ritor1
parents:
diff changeset
3239 //----- (0047F458) --------------------------------------------------------
1412
182d58b2a34c Harmondale falling under terrain fixed
Nomad
parents: 1411
diff changeset
3240 unsigned int WorldPosToGridCellZ(int sWorldPosZ)
67
3b4f8bd48e3b 25.01.13 (I did sky)
Ritor1
parents: 65
diff changeset
3241 {
1412
182d58b2a34c Harmondale falling under terrain fixed
Nomad
parents: 1411
diff changeset
3242 return 64 - (sWorldPosZ >> 9); // sar is in original exe, resulting -880 / 512 = -1
182d58b2a34c Harmondale falling under terrain fixed
Nomad
parents: 1411
diff changeset
3243 // and -880 sar 9 = -2
0
Ritor1
parents:
diff changeset
3244 }
Ritor1
parents:
diff changeset
3245
Ritor1
parents:
diff changeset
3246 //----- (0047F469) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
3247 int GridCellToWorldPosX(int a1)
0
Ritor1
parents:
diff changeset
3248 {
Ritor1
parents:
diff changeset
3249 return (a1 - 64) << 9;
Ritor1
parents:
diff changeset
3250 }
Ritor1
parents:
diff changeset
3251
Ritor1
parents:
diff changeset
3252 //----- (0047F476) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
3253 int GridCellToWorldPosZ(int a1)
0
Ritor1
parents:
diff changeset
3254 {
Ritor1
parents:
diff changeset
3255 return (64 - a1) << 9;
Ritor1
parents:
diff changeset
3256 }
Ritor1
parents:
diff changeset
3257
Ritor1
parents:
diff changeset
3258
Ritor1
parents:
diff changeset
3259 //----- (004811A3) --------------------------------------------------------
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
3260 void Polygon::DrawBorderTiles()
1338
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
3261 {
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
3262 //__debugbreak();
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
3263
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
3264 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false);
0
Ritor1
parents:
diff changeset
3265 pRenderer->DrawTerrainPolygon(uNumVertices, this,
1338
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
3266 pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]], false, true);
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
3267
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
3268 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true);
9749edd941c6 shading terrain
Ritor1
parents: 1331
diff changeset
3269 //pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], true, true);
0
Ritor1
parents:
diff changeset
3270 }
Ritor1
parents:
diff changeset
3271
Ritor1
parents:
diff changeset
3272
Ritor1
parents:
diff changeset
3273 //----- (00481ED9) --------------------------------------------------------
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
3274 void sub_481ED9_MessWithODMRenderParams()
0
Ritor1
parents:
diff changeset
3275 {
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3276 stru_8019C8._48616B_frustum_odm(65536, 0, 0, 0, 65536, 0);
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
3277 pODMRenderParams->uNumPolygons = 0;
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
3278 //pODMRenderParams->uNumEdges = 0;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
3279 //pODMRenderParams->uNumSpans = 0;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
3280 //pODMRenderParams->uNumSurfs = 0;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
3281 pODMRenderParams->uNumBillboards = 0;
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
3282 pODMRenderParams->field_44 = 0;
0
Ritor1
parents:
diff changeset
3283 }
Ritor1
parents:
diff changeset
3284
Ritor1
parents:
diff changeset
3285 //----- (004823F4) --------------------------------------------------------
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3286 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z)
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3287 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3288 //unsigned int v2; // ebx@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3289 //unsigned int v3; // edi@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3290 //int v4; // eax@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3291 //int v6; // esi@5
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3292 //int v7; // ecx@6
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3293 //int v8; // edx@6
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3294 //int v9; // eax@6
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3295 //int v10; // esi@10
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3296 //int v11; // [sp+14h] [bp-8h]@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3297 //int v12; // [sp+18h] [bp-4h]@1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3298
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3299 //v12 = a1;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3300 //v11 = a2;
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3301 unsigned int grid_x = WorldPosToGridCellX(pos_x);
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3302 unsigned int grid_z = WorldPosToGridCellZ(pos_z) - 1;
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3303
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3304 int party_grid_x1 = GridCellToWorldPosX(grid_x);
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3305 //dword_76D56C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3306 //dword_76D570_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3307 //dword_76D574_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x);
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3308 int party_grid_z1 = GridCellToWorldPosZ(grid_z);
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3309 //dword_76D55C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3310 //dword_76D560_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3311 //dword_76D564_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1);
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3312 int party_x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z);
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3313 int party_x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z);
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3314 int party_x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1);
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3315 int party_x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1);
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3316 //dword_76D554_terrain_cell_world_pos_around_party_y = v4;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3317 if (party_x1z1_y == party_x2z1_y &&
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3318 party_x2z1_y == party_x2z2_y &&
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3319 party_x2z2_y == party_x1z2_y )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3320 return false;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3321
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3322 int dx = abs(pos_x - party_grid_x1),
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3323 dz = abs(party_grid_z1 - pos_z);
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3324
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3325 int y1, y2, y3;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3326 if (dz >= dx)
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3327 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3328 y1 = party_x1z2_y; // lower-left triangle
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3329 y2 = party_x2z2_y; // y3 | \
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3330 y3 = party_x1z1_y; // | \
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3331 /* | \
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3332 |______ \
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3333 y1 y2 */
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3334 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3335 else
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3336 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3337 y1 = party_x2z1_y; // upper-right
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3338 y2 = party_x1z1_y; // y2_______ y1
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3339 y3 = party_x2z2_y; // \ |
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3340 /* \ |
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3341 \ |
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3342 y3 */
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3343 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3344
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3345 int y_min = min(y1, min(y2, y3)),
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3346 y_max = max(y1, max(y2, y3));
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
3347 return (y_max - y_min) > 512;
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3348
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3349 /*if ( y1 >= y2 )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3350 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3351 y_min = y2;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3352 if ( y2 < y3 )
0
Ritor1
parents:
diff changeset
3353 goto LABEL_13;
Ritor1
parents:
diff changeset
3354 LABEL_12:
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3355 y_min = y3;
0
Ritor1
parents:
diff changeset
3356 goto LABEL_13;
Ritor1
parents:
diff changeset
3357 }
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3358 else if ( y1 >= y3 )
0
Ritor1
parents:
diff changeset
3359 goto LABEL_12;
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3360 else
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3361 y_min = y1;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3362
0
Ritor1
parents:
diff changeset
3363 LABEL_13:
138
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3364 if ( y1 <= y2 )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3365 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3366 if ( y2 > y3 )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3367 y3 = y2;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3368 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3369 else
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3370 {
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3371 if ( y1 > y3 )
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3372 y3 = y1;
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3373 }
a8ec7e1e18b6 Sliding downhill & relative subs.
Nomad
parents: 130
diff changeset
3374 return y3 - v10 > 512;*/
0
Ritor1
parents:
diff changeset
3375 }
Ritor1
parents:
diff changeset
3376
Ritor1
parents:
diff changeset
3377 //----- (0048257A) --------------------------------------------------------
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3378 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *pIsOnWater, int bFloatAboveWater)
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3379 {
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3380 //unsigned int v4; // ebx@1
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3381 //unsigned int v5; // edi@1
0
Ritor1
parents:
diff changeset
3382 int result; // eax@9
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3383 //int v7; // ebx@10
0
Ritor1
parents:
diff changeset
3384 int v8; // ebx@11
Ritor1
parents:
diff changeset
3385 int v9; // eax@11
Ritor1
parents:
diff changeset
3386 int v10; // ecx@11
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3387 //int v11; // [sp+Ch] [bp-Ch]@1
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3388 //int v12; // [sp+10h] [bp-8h]@1
0
Ritor1
parents:
diff changeset
3389 int v13; // [sp+10h] [bp-8h]@11
Ritor1
parents:
diff changeset
3390 signed int v14; // [sp+14h] [bp-4h]@3
Ritor1
parents:
diff changeset
3391 int v15; // [sp+24h] [bp+Ch]@11
Ritor1
parents:
diff changeset
3392
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3393 //v11 = a1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3394 //v12 = a2;
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3395 unsigned int grid_x = WorldPosToGridCellX(a1);
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3396 unsigned int grid_z = WorldPosToGridCellZ(a2) - 1;
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3397
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3398 int grid_x1 = GridCellToWorldPosX(grid_x),
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3399 grid_x2 = GridCellToWorldPosX(grid_x + 1);
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3400 int grid_z1 = GridCellToWorldPosZ(grid_z),
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3401 grid_z2 = GridCellToWorldPosZ(grid_z + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3402
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
3403 int y_x1z1 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z),
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3404 y_x2z1 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z),
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3405 y_x2z2 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1),
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3406 y_x1z2 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3407 //v4 = WorldPosToGridCellX(a1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3408 //v5 = WorldPosToGridCellZ(v12) - 1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3409 //dword_76D538_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3410 //dword_76D53C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3411 //dword_76D540_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3412 //dword_76D544_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3413 //dword_76D528_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3414 //dword_76D52C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3415 //dword_76D530_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3416 //dword_76D534_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3417 //dword_76D518_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3418 //dword_76D51C_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3419 //dword_76D520_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5 + 1);
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3420 //dword_76D524_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5 + 1);
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 790
diff changeset
3421 *pIsOnWater = false;
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3422 if ( pOutdoor->ActuallyGetSomeOtherTileInfo(grid_x, grid_z) & 2 )
791
346f7069676a Indoor::GetSector and various stuff
Nomad
parents: 790
diff changeset
3423 *pIsOnWater = true;
0
Ritor1
parents:
diff changeset
3424 v14 = 0;
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3425 if ( !bFloatAboveWater && *pIsOnWater )
0
Ritor1
parents:
diff changeset
3426 v14 = -60;
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3427 if ( y_x1z1 != y_x2z1 ||
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3428 y_x2z1 != y_x2z2 ||
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3429 y_x2z2 != y_x1z2 )
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3430 {
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3431 if ( abs(grid_z1 - a2) >= abs(a1 - grid_x1) )
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3432 {
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3433 v8 = y_x1z2;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3434 v9 = y_x2z2;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3435 v10 = y_x1z1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3436 v15 = a1 - grid_x1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3437 v13 = a2 - grid_z2;
0
Ritor1
parents:
diff changeset
3438 }
Ritor1
parents:
diff changeset
3439 else
Ritor1
parents:
diff changeset
3440 {
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3441 v8 = y_x2z1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3442 v9 = y_x1z1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3443 v10 = y_x2z2;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3444 v15 = grid_x2 - a1;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3445 v13 = grid_z1 - a2;
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3446 }
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
3447 return v14 + v8 + fixpoint_mul(v13, (v10 - v8) * 128) + fixpoint_mul(v15, (v9 - v8) * 128);
812
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3448 }
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3449 else
9d2b911ef526 Fixed some odm terrain collision glitches.
Nomad
parents: 795
diff changeset
3450 return y_x1z1;
0
Ritor1
parents:
diff changeset
3451 }
Ritor1
parents:
diff changeset
3452
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
3453
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
3454
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
3455
0
Ritor1
parents:
diff changeset
3456
Ritor1
parents:
diff changeset
3457 //----- (00485F53) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1445
diff changeset
3458 void sr_485F53(Vec2_int_ *v)
0
Ritor1
parents:
diff changeset
3459 {
Ritor1
parents:
diff changeset
3460 ++v->y;
Ritor1
parents:
diff changeset
3461 if ( v->y > 1000 )
Ritor1
parents:
diff changeset
3462 v->y = 0;
Ritor1
parents:
diff changeset
3463 }
Ritor1
parents:
diff changeset
3464
Ritor1
parents:
diff changeset
3465 //----- (0048607B) --------------------------------------------------------
1427
Ritor1
parents: 1424
diff changeset
3466 void Polygon::Create_48607B(stru149 *a2)
0
Ritor1
parents:
diff changeset
3467 {
Ritor1
parents:
diff changeset
3468 this->pTexture = 0;
Ritor1
parents:
diff changeset
3469 this->ptr_38 = a2;
Ritor1
parents:
diff changeset
3470 }
Ritor1
parents:
diff changeset
3471
Ritor1
parents:
diff changeset
3472 //----- (00486089) --------------------------------------------------------
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
3473 void Polygon::_normalize_v_18()
0
Ritor1
parents:
diff changeset
3474 {
Ritor1
parents:
diff changeset
3475 double v2; // st7@1
Ritor1
parents:
diff changeset
3476 double v3; // st6@1
Ritor1
parents:
diff changeset
3477 double v5; // st5@1
Ritor1
parents:
diff changeset
3478
1025
8b492d4722d4 Intersection
Ritor1
parents: 999
diff changeset
3479 //v1 = this;
0
Ritor1
parents:
diff changeset
3480 v2 = (double)this->v_18.x;
Ritor1
parents:
diff changeset
3481 v3 = (double)this->v_18.y;
Ritor1
parents:
diff changeset
3482 v5 = (double)this->v_18.z;
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
3483 float len = sqrt(v5 * v5 + v3 * v3 + v2 * v2);
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
3484 if (fabsf(len) < 1e-6f)
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
3485 {
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
3486 v_18.x = 0;
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
3487 v_18.y = 0;
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
3488 v_18.z = 65536;
0
Ritor1
parents:
diff changeset
3489 }
Ritor1
parents:
diff changeset
3490 else
Ritor1
parents:
diff changeset
3491 {
1410
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
3492 v_18.x = round(v2 / len * 65536.0);
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
3493 v_18.y = round(v3 / len * 65536.0);
38df78aba732 deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents: 1401
diff changeset
3494 v_18.y = round(v5 / len * 65536.0);
0
Ritor1
parents:
diff changeset
3495 }
Ritor1
parents:
diff changeset
3496 }
Ritor1
parents:
diff changeset
3497
Ritor1
parents:
diff changeset
3498 //----- (0048616B) --------------------------------------------------------
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3499 void stru149::_48616B_frustum_odm(int a2, int a3, int a4, int a5, int a6, int a7)
0
Ritor1
parents:
diff changeset
3500 {
Ritor1
parents:
diff changeset
3501 int v7; // ebx@1
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3502 //int v8; // esi@1
0
Ritor1
parents:
diff changeset
3503 int v9; // edi@1
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3504 //int v10; // eax@1
0
Ritor1
parents:
diff changeset
3505 int v11; // edx@1
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3506 //int v12; // esi@2
499761153844 stru149
Nomad
parents: 1542
diff changeset
3507 //int v13; // eax@2
499761153844 stru149
Nomad
parents: 1542
diff changeset
3508 //int v14; // ST10_4@3
499761153844 stru149
Nomad
parents: 1542
diff changeset
3509 //int v15; // esi@3
499761153844 stru149
Nomad
parents: 1542
diff changeset
3510 //int v16; // eax@5
0
Ritor1
parents:
diff changeset
3511 int v17; // ST0C_4@6
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3512 //int v18; // eax@8
0
Ritor1
parents:
diff changeset
3513 int v19; // ST0C_4@9
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3514 //int v20; // eax@10
499761153844 stru149
Nomad
parents: 1542
diff changeset
3515 //int v21; // edx@10
499761153844 stru149
Nomad
parents: 1542
diff changeset
3516 //int v22; // eax@10
499761153844 stru149
Nomad
parents: 1542
diff changeset
3517 //int result; // eax@10
0
Ritor1
parents:
diff changeset
3518 int v24; // [sp+14h] [bp-14h]@1
Ritor1
parents:
diff changeset
3519 int v25; // [sp+18h] [bp-10h]@1
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3520 //int v26; // [sp+1Ch] [bp-Ch]@1
0
Ritor1
parents:
diff changeset
3521 int v27; // [sp+24h] [bp-4h]@1
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3522 //int v28; // [sp+30h] [bp+8h]@10
499761153844 stru149
Nomad
parents: 1542
diff changeset
3523 //int v29; // [sp+3Ch] [bp+14h]@10
0
Ritor1
parents:
diff changeset
3524
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
3525 v25 = pGame->pIndoorCameraD3D->int_cosine_x;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
3526 v7 = pGame->pIndoorCameraD3D->int_sine_y;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
3527 v27 = pGame->pIndoorCameraD3D->int_sine_x;
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3528 //v8 = -pIndoorCamera->pos.y;
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
3529 v9 = pGame->pIndoorCameraD3D->int_cosine_y;
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3530 //v26 = -pIndoorCamera->pos.z;
1642
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
3531 v11 = pGame->pIndoorCameraD3D->int_cosine_y * -pGame->pIndoorCameraD3D->vPartyPos.x + pGame->pIndoorCameraD3D->int_sine_y * -pGame->pIndoorCameraD3D->vPartyPos.y;
8971dc85b8fb More camera unifications.
Nomad
parents: 1641
diff changeset
3532 v24 = pGame->pIndoorCameraD3D->int_cosine_y * -pGame->pIndoorCameraD3D->vPartyPos.y - pGame->pIndoorCameraD3D->int_sine_y * -pGame->pIndoorCameraD3D->vPartyPos.x;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
3533 if (pGame->pIndoorCameraD3D->sRotationX)
0
Ritor1
parents:
diff changeset
3534 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
3535 this->field_0_party_dir_x = fixpoint_mul(v11, pGame->pIndoorCameraD3D->int_cosine_x) +
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
3536 fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x);
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3537 this->field_4_party_dir_y = v24;
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
3538 this->field_8_party_dir_z = fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_mul(v11, v27);
0
Ritor1
parents:
diff changeset
3539 }
Ritor1
parents:
diff changeset
3540 else
Ritor1
parents:
diff changeset
3541 {
755
e0914a9bc424 stru149 decompilation errors on some blv saves.
Nomad
parents: 750
diff changeset
3542 this->field_0_party_dir_x = v11;
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3543 this->field_4_party_dir_y = v24;
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
3544 this->field_8_party_dir_z = (-pGame->pIndoorCameraD3D->vPartyPos.z) << 16;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
3545 }
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
3546
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
3547 if (pGame->pIndoorCameraD3D->sRotationX)
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3548 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
3549 v17 = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
3550
1809
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3551 this->angle_from_north = fixpoint_mul(v17, v25) + fixpoint_mul(a4, v27);
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3552 this->angle_from_west = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7);
1844
Ritor1
parents: 1837
diff changeset
3553 this->viewing_angle_from_west_east = fixpoint_mul(a4, v25) - fixpoint_mul(v17, v27);
0
Ritor1
parents:
diff changeset
3554 }
Ritor1
parents:
diff changeset
3555 else
Ritor1
parents:
diff changeset
3556 {
1809
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3557 this->angle_from_north = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7);
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3558 this->angle_from_west = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7);
1844
Ritor1
parents: 1837
diff changeset
3559 this->viewing_angle_from_west_east = a4;
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3560 }
499761153844 stru149
Nomad
parents: 1542
diff changeset
3561
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
3562 if (pGame->pIndoorCameraD3D->sRotationX)
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3563 {
1643
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
3564 v19 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7);
7182930263b3 fixpoint functions renaming
zipi
parents: 1642
diff changeset
3565
1809
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3566 this->angle_from_east = fixpoint_mul(v19, v25) + fixpoint_mul(a7, v27);
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3567 this->angle_from_south = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7);
1844
Ritor1
parents: 1837
diff changeset
3568 this->viewing_angle_from_north_south = fixpoint_mul(a7, v25) - fixpoint_mul(v19, v27);
0
Ritor1
parents:
diff changeset
3569 }
Ritor1
parents:
diff changeset
3570 else
Ritor1
parents:
diff changeset
3571 {
1809
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3572 this->angle_from_east = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7);
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3573 this->angle_from_south = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7);
1844
Ritor1
parents: 1837
diff changeset
3574 this->viewing_angle_from_north_south = a7;
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3575 }
499761153844 stru149
Nomad
parents: 1542
diff changeset
3576
1809
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3577 this->angle_from_east = -this->angle_from_east;
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3578 this->angle_from_south = -this->angle_from_south;
1844
Ritor1
parents: 1837
diff changeset
3579 this->viewing_angle_from_north_south = -this->viewing_angle_from_north_south;
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3580
1809
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3581 this->field_24 = fixpoint_dot(this->angle_from_north, this->field_0_party_dir_x,
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3582 this->angle_from_west, this->field_4_party_dir_y,
1844
Ritor1
parents: 1837
diff changeset
3583 this->viewing_angle_from_west_east, this->field_8_party_dir_z);
1809
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3584 this->field_28 = fixpoint_dot(this->angle_from_east, this->field_0_party_dir_x,
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3585 this->angle_from_south, this->field_4_party_dir_y,
1844
Ritor1
parents: 1837
diff changeset
3586 this->viewing_angle_from_north_south, this->field_8_party_dir_z);
0
Ritor1
parents:
diff changeset
3587 }
Ritor1
parents:
diff changeset
3588
Ritor1
parents:
diff changeset
3589 //----- (0048694B) --------------------------------------------------------
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3590 void stru149::_48694B_frustum_sky()
0
Ritor1
parents:
diff changeset
3591 {
1809
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3592 this->angle_from_east = -this->angle_from_east;
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3593 this->angle_from_south = -this->angle_from_south;
1844
Ritor1
parents: 1837
diff changeset
3594 this->viewing_angle_from_north_south = -this->viewing_angle_from_north_south;
1544
499761153844 stru149
Nomad
parents: 1542
diff changeset
3595
1809
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3596 this->field_24 = fixpoint_dot(this->angle_from_north, this->field_0_party_dir_x,
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3597 this->angle_from_west, this->field_4_party_dir_y,
1844
Ritor1
parents: 1837
diff changeset
3598 this->viewing_angle_from_west_east, this->field_8_party_dir_z);
1809
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3599 this->field_28 = fixpoint_dot(this->angle_from_east, this->field_0_party_dir_x,
8f20f7e1091d original DrawSkyD3D() fix
Ritor1
parents: 1801
diff changeset
3600 this->angle_from_south, this->field_4_party_dir_y,
1844
Ritor1
parents: 1837
diff changeset
3601 this->viewing_angle_from_north_south, this->field_8_party_dir_z);
0
Ritor1
parents:
diff changeset
3602 }
Ritor1
parents:
diff changeset
3603
Ritor1
parents:
diff changeset
3604 //----- (0044100D) --------------------------------------------------------
994
3431f6abc786 GameUI clean
Nomad
parents: 978
diff changeset
3605 bool sub_44100D()
0
Ritor1
parents:
diff changeset
3606 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3607 return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS ||
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3608 pCurrentScreen > SCREEN_LOADGAME && pCurrentScreen <= SCREEN_E ||
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 554
diff changeset
3609 pCurrentScreen > SCREEN_VIDEO && pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING;
0
Ritor1
parents:
diff changeset
3610 }
Ritor1
parents:
diff changeset
3611 // 4E28F8: using guessed type int pCurrentScreen;
Ritor1
parents:
diff changeset
3612
Ritor1
parents:
diff changeset
3613 //----- (00441A4E) --------------------------------------------------------
910
Ritor1
parents: 897
diff changeset
3614 __int16 __fastcall sub_441A4E(int a1)//for blessing
0
Ritor1
parents:
diff changeset
3615 {
Ritor1
parents:
diff changeset
3616 __int16 result; // ax@1
Ritor1
parents:
diff changeset
3617 int v2; // ebx@1
Ritor1
parents:
diff changeset
3618 char *v3; // esi@1
Ritor1
parents:
diff changeset
3619 int v4; // edi@4
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
3620 bool v5; // ecx@4
1523
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
3621 SpriteFrame *pFrame; // eax@6
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
3622 //SpriteFrame *v7; // edi@6
0
Ritor1
parents:
diff changeset
3623 int v8; // eax@6
Ritor1
parents:
diff changeset
3624 unsigned __int16 v9; // ax@6
Ritor1
parents:
diff changeset
3625 RenderBillboardTransform_local0 v10; // [sp+Ch] [bp-5Ch]@1
Ritor1
parents:
diff changeset
3626 int v11; // [sp+5Ch] [bp-Ch]@6
Ritor1
parents:
diff changeset
3627 int v12; // [sp+60h] [bp-8h]@1
Ritor1
parents:
diff changeset
3628 int v13; // [sp+64h] [bp-4h]@6
Ritor1
parents:
diff changeset
3629
2002
2e6c63bdcfa9 RenderBillboardD3D initialization
zipi
parents: 1980
diff changeset
3630 v10.sParentBillboardID = -1;
0
Ritor1
parents:
diff changeset
3631 v10.pTarget = pRenderer->pTargetSurface;
Ritor1
parents:
diff changeset
3632 v10.pTargetZ = pRenderer->pActiveZBuffer;
Ritor1
parents:
diff changeset
3633 v10.uTargetPitch = pRenderer->field_10;
Ritor1
parents:
diff changeset
3634 result = 0;
Ritor1
parents:
diff changeset
3635 v2 = a1;
Ritor1
parents:
diff changeset
3636 v10.uViewportX = 0;
Ritor1
parents:
diff changeset
3637 v10.uViewportY = 0;
Ritor1
parents:
diff changeset
3638 v10.uViewportZ = 639;
Ritor1
parents:
diff changeset
3639 v10.uViewportW = 479;
Ritor1
parents:
diff changeset
3640 v12 = 0;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3641 //v3 = (char *)&pOtherOverlayList->pOverlays[0].field_C;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3642 //do
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3643 for ( uint i = 0; i < 50; ++i )
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3644 {
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3645 if ( pOtherOverlayList->pOverlays[i].field_6 > 0 )
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3646 {
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3647 result = pOtherOverlayList->pOverlays[i].field_0;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3648 if ( pOtherOverlayList->pOverlays[i].field_0 >= 300 )
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3649 {
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3650 //v4 = result;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3651 v5 = pOtherOverlayList->pOverlays[i].field_0 == v2 + 320
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
3652 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 330
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
3653 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 340
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
3654 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 350;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3655 pOtherOverlayList->pOverlays[i].field_0 = v2 + 310;
1110
cf6cd674c398 bitwise operator ambiguity reduced
Grumpy7
parents: 1104
diff changeset
3656 if ( pOtherOverlayList->pOverlays[i].field_0 == v2 + 310 || v5 )
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3657 {
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3658 if ( !pOtherOverlayList->pOverlays[i].field_0 )
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3659 {
1523
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
3660 pFrame = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID,
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3661 pOtherOverlayList->pOverlays[i].field_4);
1523
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
3662 //v7 = v6;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3663 v11 = pOtherOverlayList->pOverlays[i].field_E;
1523
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
3664 //v13 = pFrame->scale;
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
3665 v13 = (unsigned __int64)(v11 * (signed __int64)pFrame->scale) >> 16;
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3666 v10.uScreenSpaceX = pOtherOverlayList->pOverlays[i].field_8;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3667 v10.uScreenSpaceY = pOtherOverlayList->pOverlays[i].field_A;
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
3668 v10._screenspace_x_scaler_packedfloat = v13;
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
3669 v10._screenspace_y_scaler_packedfloat = v13;
1523
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
3670 v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(pFrame->uPaletteIndex, 0, 1);
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3671 v8 = pOtherOverlayList->pOverlays[i].field_2;
0
Ritor1
parents:
diff changeset
3672 v10.sZValue = 0;
Ritor1
parents:
diff changeset
3673 v10.uFlags = 0;
Ritor1
parents:
diff changeset
3674 v9 = pOverlayList->pOverlays[v8].uOverlayType;
Ritor1
parents:
diff changeset
3675 if ( !v9 || v9 == 2 )
1523
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
3676 v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]].uHeight >> 1;
53265d238d94 interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents: 1504
diff changeset
3677 result = pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]]._4AD2D1(&v10, 0);
0
Ritor1
parents:
diff changeset
3678 ++v12;
Ritor1
parents:
diff changeset
3679 if ( v12 == 5 )
Ritor1
parents:
diff changeset
3680 break;
Ritor1
parents:
diff changeset
3681 }
Ritor1
parents:
diff changeset
3682 }
Ritor1
parents:
diff changeset
3683 }
Ritor1
parents:
diff changeset
3684 }
921
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3685 //v3 += 20;
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3686 }
3696848c0413 meteorite rain and other spells fix
Ritor1
parents: 920
diff changeset
3687 //while ( (signed int)v3 < (signed int)&pOverlayList->pOverlays );
0
Ritor1
parents:
diff changeset
3688 return result;
Ritor1
parents:
diff changeset
3689 }
Ritor1
parents:
diff changeset
3690
Ritor1
parents:
diff changeset
3691 //----- (00443801) --------------------------------------------------------
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3692 void Initialize2DA()
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3693 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3694
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3695 int i;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3696 char* test_string;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3697 unsigned char c;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3698 bool break_loop;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3699 unsigned int temp_str_len;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3700 char* tmp_pos;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3701 int decode_step;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3702
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3703 if ( p2DEventsTXT_Raw )
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1563
diff changeset
3704 free(p2DEventsTXT_Raw);
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3705 p2DEventsTXT_Raw = NULL;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3706 p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3707 strtok(p2DEventsTXT_Raw, "\r");
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3708 strtok(NULL, "\r");
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3709
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3710 for (i=0;i<525;++i)
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3711 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3712 test_string = strtok(NULL, "\r") + 1;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3713 break_loop = false;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3714 decode_step=0;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3715 do
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3716 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3717 c = *(unsigned char*)test_string;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3718 temp_str_len = 0;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3719 while((c!='\t')&&(c>0))
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3720 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3721 ++temp_str_len;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3722 c=test_string[temp_str_len];
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3723 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3724 tmp_pos=test_string+temp_str_len;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3725 if (*tmp_pos == 0)
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3726 break_loop = true;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3727 *tmp_pos = 0;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3728 if (temp_str_len)
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3729 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3730 switch (decode_step)
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3731 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3732 case 2:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3733 {
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3734 if ( !_strnicmp(test_string, "wea", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3735 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3736 p2DEvents[i].uType = BuildingType_WeaponShop;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3737 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3738 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3739 if ( !_strnicmp(test_string, "arm", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3740 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3741 p2DEvents[i].uType = BuildingType_ArmorShop;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3742 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3743 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3744 if ( !_strnicmp(test_string, "mag", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3745 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3746 p2DEvents[i].uType = BuildingType_MagicShop;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3747 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3748 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3749 if ( !_strnicmp(test_string, "alc", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3750 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3751 p2DEvents[i].uType = BuildingType_AlchemistShop;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3752 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3753 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3754 if ( !_strnicmp(test_string, "sta", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3755 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3756 p2DEvents[i].uType = BuildingType_Stables;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3757 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3758 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3759 if ( !_strnicmp(test_string, "boa", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3760 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3761 p2DEvents[i].uType = BuildingType_Boats;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3762 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3763 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3764 if ( !_strnicmp(test_string, "tem", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3765 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3766 p2DEvents[i].uType = BuildingType_Temple;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3767 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3768 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3769 if ( !_strnicmp(test_string, "tra", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3770 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3771 p2DEvents[i].uType = BuildingType_Training;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3772 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3773 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3774 if ( !_strnicmp(test_string, "tow", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3775 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3776 p2DEvents[i].uType = BuildingType_TownHall;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3777 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3778 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3779
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3780 if ( !_strnicmp(test_string, "tav", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3781 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3782 p2DEvents[i].uType = BuildingType_Tavern;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3783 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3784 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3785 if ( !_strnicmp(test_string, "ban", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3786 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3787 p2DEvents[i].uType = BuildingType_Bank;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3788 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3789 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3790 if ( !_strnicmp(test_string, "fir", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3791 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3792 p2DEvents[i].uType = BuildingType_FireGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3793 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3794 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3795 if ( !_strnicmp(test_string, "air", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3796 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3797 p2DEvents[i].uType = BuildingType_AirGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3798 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3799 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3800 if ( !_strnicmp(test_string, "wat", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3801 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3802 p2DEvents[i].uType = BuildingType_WaterGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3803 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3804 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3805 if ( !_strnicmp(test_string, "ear", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3806 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3807 p2DEvents[i].uType = BuildingType_EarthGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3808 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3809 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3810 if ( !_strnicmp(test_string, "spi", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3811 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3812 p2DEvents[i].uType = BuildingType_SpiritGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3813 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3814 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3815 if ( !_strnicmp(test_string, "min", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3816 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3817 p2DEvents[i].uType = BuildingType_MindGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3818 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3819 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3820 if ( !_strnicmp(test_string, "bod", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3821 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3822 p2DEvents[i].uType = BuildingType_BodyGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3823 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3824 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3825 if ( !_strnicmp(test_string, "lig", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3826 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3827 p2DEvents[i].uType = BuildingType_LightGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3828 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3829 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3830 if ( !_strnicmp(test_string, "dar", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3831 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3832 p2DEvents[i].uType = BuildingType_DarkGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3833 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3834 }
1644
dbd6f940f26c Fixed Celestia sky a bit.
Nomad
parents: 1642
diff changeset
3835 if ( !_strnicmp(test_string, "ele", 3) ) // "Element Guild" from mm6
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3836 {
1644
dbd6f940f26c Fixed Celestia sky a bit.
Nomad
parents: 1642
diff changeset
3837 p2DEvents[i].uType = BuildingType_ElementalGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3838 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3839 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3840 if ( !_strnicmp(test_string, "sel", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3841 {
1644
dbd6f940f26c Fixed Celestia sky a bit.
Nomad
parents: 1642
diff changeset
3842 p2DEvents[i].uType = BuildingType_SelfGuild;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3843 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3844 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3845 if ( !_strnicmp(test_string, "mir", 3) )
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3846 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3847 p2DEvents[i].uType = BuildingType_16;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3848 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3849 }
1644
dbd6f940f26c Fixed Celestia sky a bit.
Nomad
parents: 1642
diff changeset
3850 if ( !_strnicmp(test_string, "mer", 3) ) // "Merc Guild" from mm6
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3851 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3852 p2DEvents[i].uType = BuildingType_TownHall;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3853 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3854 }
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
3855 p2DEvents[i].uType = BuildingType_18;
237
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3856 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3857 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3858
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3859 case 4:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3860 p2DEvents[i].uAnimationID = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3861 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3862 case 5:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3863 p2DEvents[i].pName = RemoveQuotes(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3864 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3865 case 6:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3866 p2DEvents[i].pProprieterName = RemoveQuotes(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3867 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3868 case 7:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3869 p2DEvents[i].pProprieterTitle = RemoveQuotes(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3870 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3871 case 8:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3872 p2DEvents[i].field_14 = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3873 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3874 case 9:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3875 p2DEvents[i]._state = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3876 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3877 case 10:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3878 p2DEvents[i]._rep = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3879 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3880 case 11:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3881 p2DEvents[i]._per = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3882 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3883 case 12:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3884 p2DEvents[i].fPriceMultiplier = atof(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3885 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3886 case 13:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3887 p2DEvents[i].flt_24 = atof(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3888 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3889 case 15:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3890 p2DEvents[i].field_1C = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3891 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3892 case 18:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3893 p2DEvents[i].uOpenTime = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3894 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3895 case 19:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3896 p2DEvents[i].uCloseTime = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3897 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3898 case 20:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3899 p2DEvents[i].uExitPicID = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3900 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3901 case 21:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3902 p2DEvents[i].uExitMapID = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3903 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3904 case 22:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3905 p2DEvents[i]._quest_related = atoi(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3906 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3907 case 23:
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3908 p2DEvents[i].pEnterText = RemoveQuotes(test_string);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3909 break;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3910 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3911 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3912 ++decode_step;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3913 test_string=tmp_pos+1;
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3914 } while ((decode_step<24)&&!break_loop);
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3915 }
2799737f8a74 more text parsers refactor
Gloval
parents: 226
diff changeset
3916
0
Ritor1
parents:
diff changeset
3917 }
Ritor1
parents:
diff changeset
3918
Ritor1
parents:
diff changeset
3919 //----- (00443E31) --------------------------------------------------------
601
d59398528e4f level events loading fix
Gloval
parents: 580
diff changeset
3920 void LoadLevel_InitializeLevelStr()
d59398528e4f level events loading fix
Gloval
parents: 580
diff changeset
3921 {
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3922
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3923 char Args[100];
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3924 int string_num;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3925 int max_string_length;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3926 int current_string_length;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3927 int prev_string_offset;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3928
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3929 if (sizeof(pLevelStrOffsets) != 2000)
0
Ritor1
parents:
diff changeset
3930 Log::Warning(L"pLevelStrOffsets: deserialization warning");
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
3931 memset(pLevelStrOffsets.data(), 0, 2000);
0
Ritor1
parents:
diff changeset
3932
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3933 max_string_length = 0;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3934 string_num = 1;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3935 prev_string_offset = 0;
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
3936 pLevelStrOffsets[0]=0;
0
Ritor1
parents:
diff changeset
3937 for (uint i = 0; i < uLevelStrFileSize; ++i)
Ritor1
parents:
diff changeset
3938 {
Ritor1
parents:
diff changeset
3939 if ( !pLevelStr[i] )
Ritor1
parents:
diff changeset
3940 {
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3941 pLevelStrOffsets[string_num] = i + 1;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3942 ++string_num;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3943 if ( i - prev_string_offset > max_string_length )
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3944 max_string_length = i - prev_string_offset;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3945 prev_string_offset = i;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3946 }
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3947 }
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3948
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3949 uLevelStrNumStrings = string_num - 1;
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3950 if ( max_string_length > 800 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
3951 Error("MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", max_string_length+1);
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3952
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3953 if ( uLevelStrNumStrings > 0 )
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3954 {
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
3955 for(uint i = 0; i <uLevelStrNumStrings ; ++i)
329
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3956 {
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3957 if ( RemoveQuotes(&pLevelStr[pLevelStrOffsets[i]]) != &pLevelStr[pLevelStrOffsets[i]] )
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3958 ++pLevelStrOffsets[i];
f76027321087 LoadLevel_InitializeLevelStr
Gloval
parents: 323
diff changeset
3959 }
0
Ritor1
parents:
diff changeset
3960 }
Ritor1
parents:
diff changeset
3961 }
Ritor1
parents:
diff changeset
3962
Ritor1
parents:
diff changeset
3963 //----- (00443F95) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1445
diff changeset
3964 void OnMapLeave()
0
Ritor1
parents:
diff changeset
3965 {
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
3966 _evt_raw *test_event;
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
3967 if ( uLevelEVT_NumEvents > 0 )
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
3968 {
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
3969 for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
3970 {
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
3971 test_event=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT];
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
3972 if ( test_event->_e_type == EVENT_OnMapLeave )
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
3973 {
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
3974 EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1, pLevelEVT_Index[i].event_sequence_num);
336
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
3975 }
ea55d6414029 Event_proceccor preliminary
Gloval
parents: 329
diff changeset
3976 }
0
Ritor1
parents:
diff changeset
3977 }
Ritor1
parents:
diff changeset
3978 }
Ritor1
parents:
diff changeset
3979
Ritor1
parents:
diff changeset
3980 //----- (00443FDC) --------------------------------------------------------
Ritor1
parents:
diff changeset
3981 void OnMapLoad()
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
3982 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3983 stru176 *v3; // esi@7
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3984 __int16 v4; // cx@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3985 __int16 v5; // di@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3986 int v6; // eax@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3987 signed __int64 v8; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3988 unsigned int v9; // ecx@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3989 signed __int64 v10; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3990 signed __int64 v11; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3991 int v12; // ST50_4@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3992 signed __int64 v13; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3993 signed __int64 v14; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3994 int v15; // ST58_4@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3995 signed __int64 v16; // qax@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3996 int hours; // ebx@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3997 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3998 signed __int64 seconds; // [sp+14h] [bp-3Ch]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
3999 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4000 int minutes; // [sp+2Ch] [bp-24h]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4001 int years; // [sp+34h] [bp-1Ch]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4002 int weeks; // [sp+38h] [bp-18h]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4003 int v26; // [sp+3Ch] [bp-14h]@15
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4004 int days; // [sp+3Ch] [bp-14h]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4005 int months; // [sp+40h] [bp-10h]@26
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4006 __int16 v29; // [sp+46h] [bp-Ah]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4007 __int16 v30; // [sp+48h] [bp-8h]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4008 __int16 v31; // [sp+4Ah] [bp-6h]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4009 __int16 v32; // [sp+4Ch] [bp-4h]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4010 __int16 v33; // [sp+4Eh] [bp-2h]@9
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4011
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4012 for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4013 {
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
4014 EventIndex pEvent = pLevelEVT_Index[i];
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
4015
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
4016 _evt_raw* _evt = (_evt_raw *)(&pLevelEVT[pEvent.uEventOffsetInEVT]);
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4017
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4018 if (_evt->_e_type == EVENT_PlaySound)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4019 {
601
d59398528e4f level events loading fix
Gloval
parents: 580
diff changeset
4020 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0);
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4021 }
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4022 else if (_evt->_e_type == EVENT_OnMapReload)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4023 {
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
4024 EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num);
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4025 }
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
4026 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4027 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4028 v3 = &array_5B5928_timers[dword_5B65C8_timers_count];
810
f5156b8c61ad savegame refactoring
Gloval
parents: 795
diff changeset
4029 v20 = pOutdoor->loc_time.uLastVisitDay;
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4030 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4031 v20 = pIndoor->stru1.uLastVisitDay;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4032
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4033 v3->timer_evt_type = _evt->_e_type;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4034 v3->timer_evt_ID = pEvent.uEventID;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4035 v3->timer_evt_seq_num = pEvent.event_sequence_num;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4036
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4037 v3->field_10 = _evt->v5;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4038 v3->field_12 = _evt->v6;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4039 v3->field_14 = _evt->v7;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4040 v3->field_16 = _evt->v8;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4041 v3->field_18 = _evt->v9;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4042 v3->field_1A = _evt->v10;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4043
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4044
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4045 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4046
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4047 v3->time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4048 v3->fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11;
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
4049 if (v3->timer_evt_type == EVENT_Initialize && !(short)v6 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4050 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4051 if ( v20 )
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4052 v18 = pParty->uTimePlayed - v20;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4053 else
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4054 v18 = 0i64;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4055 v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4056
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4057 if ( v26 / 7 / 4 / 12 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4058 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4059 if ( v3->field_10 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4060 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4061 ++dword_5B65C8_timers_count;
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4062 v3->next_fire_time = 0;
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4063 continue;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4064 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4065 }
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4066 if (v26 / 7 / 4 != 0 && v3->field_12 != 0 ||
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4067 v26 / 7 != 0 && v3->field_14 != 0 ||
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4068 v26 != 0 || !v20)
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4069 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4070 ++dword_5B65C8_timers_count;
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4071 v3->next_fire_time = 0;
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4072 continue;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4073 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4074 }
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4075 else
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4076 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4077 v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4078 v9 = v8;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4079 v10 = (signed int)v8 / 60;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4080 minutes = v10 % 60;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4081 v11 = (signed int)(v10 / 60);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4082 v12 = v11 % 24;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4083 v13 = (signed int)(v11 / 24);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4084 days = v13 % 7;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4085 v14 = (signed int)(v13 / 7);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4086 v15 = v14 % 4;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4087 v16 = (signed int)(v14 / 4);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4088 years = v16 / 12;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4089
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
4090 unsigned __int64 _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32;
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
4091 __int64 _2 = ((__int64)v9 << 32) | _1;
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4092
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4093 seconds = _2 % 60;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4094 //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32,
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4095 // v9)
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4096 // % 60;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4097
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4098 hours = v12;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4099 weeks = v15;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4100 months = v16 % 12;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4101 if ( v3->field_10 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4102 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4103 ++years;
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4104 }
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4105 else
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4106 {
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4107 if ( v3->field_12 )
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4108 {
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4109 ++months;
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4110 }
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4111 else
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4112 {
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4113 if ( v3->field_14 )
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4114 {
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4115 ++weeks;
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4116 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4117 else
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4118 {
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4119 ++days;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4120 minutes = v3->field_18;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4121 hours = v3->field_16;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4122 seconds = v3->field_1A;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4123 }
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4124 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4125 }
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4126 v3->next_fire_time = (signed __int64)((double)((seconds
363
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4127 + 60 * minutes
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4128 + 3600 * hours
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4129 + 0x93A80 * weeks
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4130 + 0x15180 * days
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4131 + 0x24EA00 * (months + 12i64 * years)) << 7)
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4132 * 0.033333335);
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4133
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4134 ++dword_5B65C8_timers_count;
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4135 }
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4136 }
2bc1c8d68f41 Allocator and SpellCost Tip
Gloval
parents: 351
diff changeset
4137 }
781
d170f23f70d1 tidy, code moving
zipi
parents: 774
diff changeset
4138 }
0
Ritor1
parents:
diff changeset
4139
Ritor1
parents:
diff changeset
4140 //----- (00444360) --------------------------------------------------------
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
4141 void Level_LoadEvtAndStr(const char *pLevelName)
0
Ritor1
parents:
diff changeset
4142 {
Ritor1
parents:
diff changeset
4143 char pContainerName[120]; // [sp+8h] [bp-98h]@1
Ritor1
parents:
diff changeset
4144
Ritor1
parents:
diff changeset
4145 sprintf(pContainerName, "%s.evt", pLevelName);
1541
86cb7398d2a8 mm8 icons
Nomad
parents: 1477
diff changeset
4146 uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT.data(), 9216);
0
Ritor1
parents:
diff changeset
4147
Ritor1
parents:
diff changeset
4148 sprintf(pContainerName, "%s.str", pLevelName);
1541
86cb7398d2a8 mm8 icons
Nomad
parents: 1477
diff changeset
4149 uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr.data(), 9216);
0
Ritor1
parents:
diff changeset
4150 if (uLevelStrFileSize)
Ritor1
parents:
diff changeset
4151 LoadLevel_InitializeLevelStr();
Ritor1
parents:
diff changeset
4152 }
Ritor1
parents:
diff changeset
4153
Ritor1
parents:
diff changeset
4154 //----- (00444D80) --------------------------------------------------------
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
4155 int GetTravelTime()
0
Ritor1
parents:
diff changeset
4156 {
Ritor1
parents:
diff changeset
4157 signed int v0; // esi@1
Ritor1
parents:
diff changeset
4158
Ritor1
parents:
diff changeset
4159 v0 = uDefaultTravelTime_ByFoot;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 638
diff changeset
4160 if ( CheckHiredNPCSpeciality(Guide) )
0
Ritor1
parents:
diff changeset
4161 --v0;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 638
diff changeset
4162 if ( CheckHiredNPCSpeciality(Tracker) )
0
Ritor1
parents:
diff changeset
4163 v0 -= 2;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 638
diff changeset
4164 if ( CheckHiredNPCSpeciality(Pathfinder) )
0
Ritor1
parents:
diff changeset
4165 v0 -= 3;
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 638
diff changeset
4166 if ( CheckHiredNPCSpeciality(Explorer) )
0
Ritor1
parents:
diff changeset
4167 --v0;
Ritor1
parents:
diff changeset
4168 if ( v0 < 1 )
Ritor1
parents:
diff changeset
4169 v0 = 1;
Ritor1
parents:
diff changeset
4170 return v0;
Ritor1
parents:
diff changeset
4171 }
Ritor1
parents:
diff changeset
4172 // 6BD07C: using guessed type int uDefaultTravelTime_ByFoot;
Ritor1
parents:
diff changeset
4173
Ritor1
parents:
diff changeset
4174 //----- (004451A8) --------------------------------------------------------
Ritor1
parents:
diff changeset
4175 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4)
Ritor1
parents:
diff changeset
4176 {
Ritor1
parents:
diff changeset
4177 int v3; // esi@1
Ritor1
parents:
diff changeset
4178 int v4; // edi@1
Ritor1
parents:
diff changeset
4179
Ritor1
parents:
diff changeset
4180 v3 = a2;
Ritor1
parents:
diff changeset
4181 v4 = a1;
Ritor1
parents:
diff changeset
4182 if ( !pGUIWindow2 )
Ritor1
parents:
diff changeset
4183 {
Ritor1
parents:
diff changeset
4184 if ( pParty->uFlags & 2 )
Ritor1
parents:
diff changeset
4185 pGame->Draw();
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
4186 pAudioPlayer->StopChannels(-1, -1);
0
Ritor1
parents:
diff changeset
4187 pMiscTimer->Pause();
Ritor1
parents:
diff changeset
4188 pEventTimer->Pause();
Ritor1
parents:
diff changeset
4189 dword_5C3418 = v4;
Ritor1
parents:
diff changeset
4190 dword_5C341C = v3;
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 515
diff changeset
4191 _591094_decoration = activeLevelDecoration;
948
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
4192 pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_GreetingNPC, a4, 0);
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
4193 pGUIWindow2->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
4194 pGUIWindow2->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
4195 pGUIWindow2->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
5a2dbb00c399 Code cleaning.
Nomad
parents: 945
diff changeset
4196 pGUIWindow2->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
0
Ritor1
parents:
diff changeset
4197 }
Ritor1
parents:
diff changeset
4198 }
Ritor1
parents:
diff changeset
4199
Ritor1
parents:
diff changeset
4200 //----- (004452BB) --------------------------------------------------------
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4201 void sub_4452BB()
0
Ritor1
parents:
diff changeset
4202 {
Ritor1
parents:
diff changeset
4203 pGUIWindow2->Release();
Ritor1
parents:
diff changeset
4204 pGUIWindow2 = 0;
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 515
diff changeset
4205 activeLevelDecoration = _591094_decoration;
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
4206 EventProcessor(dword_5C3418, 0, 1, dword_5C341C);
520
35f28d4c0ff9 GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents: 515
diff changeset
4207 activeLevelDecoration = NULL;
0
Ritor1
parents:
diff changeset
4208 pEventTimer->Resume();
Ritor1
parents:
diff changeset
4209 }
Ritor1
parents:
diff changeset
4210
Ritor1
parents:
diff changeset
4211 //----- (004465DF) --------------------------------------------------------
Ritor1
parents:
diff changeset
4212 int sub_4465DF_check_season(int a1)
Ritor1
parents:
diff changeset
4213 {
Ritor1
parents:
diff changeset
4214 unsigned int v1; // eax@1
Ritor1
parents:
diff changeset
4215 unsigned int v2; // edx@1
Ritor1
parents:
diff changeset
4216 int v3; // ecx@2
Ritor1
parents:
diff changeset
4217 int v4; // ecx@3
Ritor1
parents:
diff changeset
4218 char v6; // zf@9
Ritor1
parents:
diff changeset
4219
Ritor1
parents:
diff changeset
4220 v1 = pParty->uCurrentMonth + 1;
Ritor1
parents:
diff changeset
4221 v2 = pParty->uDaysPlayed + 1;
Ritor1
parents:
diff changeset
4222 if ( a1 )
Ritor1
parents:
diff changeset
4223 {
Ritor1
parents:
diff changeset
4224 v3 = a1 - 1;
Ritor1
parents:
diff changeset
4225 if ( v3 )
Ritor1
parents:
diff changeset
4226 {
Ritor1
parents:
diff changeset
4227 v4 = v3 - 1;
Ritor1
parents:
diff changeset
4228 if ( v4 )
Ritor1
parents:
diff changeset
4229 {
Ritor1
parents:
diff changeset
4230 if ( v4 != 1 )
Ritor1
parents:
diff changeset
4231 return 0;
Ritor1
parents:
diff changeset
4232 if ( v1 != 12 )
Ritor1
parents:
diff changeset
4233 {
Ritor1
parents:
diff changeset
4234 if ( (signed int)v1 >= 1 && (signed int)v1 <= 2 )
Ritor1
parents:
diff changeset
4235 return 1;
Ritor1
parents:
diff changeset
4236 v6 = v1 == 3;
Ritor1
parents:
diff changeset
4237 LABEL_24:
Ritor1
parents:
diff changeset
4238 if ( !v6 || (signed int)v2 >= 21 )
Ritor1
parents:
diff changeset
4239 return 0;
Ritor1
parents:
diff changeset
4240 return 1;
Ritor1
parents:
diff changeset
4241 }
Ritor1
parents:
diff changeset
4242 }
Ritor1
parents:
diff changeset
4243 else
Ritor1
parents:
diff changeset
4244 {
Ritor1
parents:
diff changeset
4245 if ( v1 != 9 )
Ritor1
parents:
diff changeset
4246 {
Ritor1
parents:
diff changeset
4247 if ( (signed int)v1 >= 10 && (signed int)v1 <= 11 )
Ritor1
parents:
diff changeset
4248 return 1;
Ritor1
parents:
diff changeset
4249 v6 = v1 == 12;
Ritor1
parents:
diff changeset
4250 goto LABEL_24;
Ritor1
parents:
diff changeset
4251 }
Ritor1
parents:
diff changeset
4252 }
Ritor1
parents:
diff changeset
4253 }
Ritor1
parents:
diff changeset
4254 else
Ritor1
parents:
diff changeset
4255 {
Ritor1
parents:
diff changeset
4256 if ( v1 != 6 )
Ritor1
parents:
diff changeset
4257 {
Ritor1
parents:
diff changeset
4258 if ( (signed int)v1 >= 7 && (signed int)v1 <= 8 )
Ritor1
parents:
diff changeset
4259 return 1;
Ritor1
parents:
diff changeset
4260 v6 = v1 == 9;
Ritor1
parents:
diff changeset
4261 goto LABEL_24;
Ritor1
parents:
diff changeset
4262 }
Ritor1
parents:
diff changeset
4263 }
Ritor1
parents:
diff changeset
4264 }
Ritor1
parents:
diff changeset
4265 else
Ritor1
parents:
diff changeset
4266 {
Ritor1
parents:
diff changeset
4267 if ( v1 != 3 )
Ritor1
parents:
diff changeset
4268 {
Ritor1
parents:
diff changeset
4269 if ( (signed int)v1 >= 4 && (signed int)v1 <= 5 )
Ritor1
parents:
diff changeset
4270 return 1;
Ritor1
parents:
diff changeset
4271 v6 = v1 == 6;
Ritor1
parents:
diff changeset
4272 goto LABEL_24;
Ritor1
parents:
diff changeset
4273 }
Ritor1
parents:
diff changeset
4274 }
Ritor1
parents:
diff changeset
4275 if ( (signed int)v2 >= 21 )
Ritor1
parents:
diff changeset
4276 return 1;
Ritor1
parents:
diff changeset
4277 return 0;
Ritor1
parents:
diff changeset
4278 }
Ritor1
parents:
diff changeset
4279
Ritor1
parents:
diff changeset
4280 //----- (0044861E) --------------------------------------------------------
Ritor1
parents:
diff changeset
4281 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename)
Ritor1
parents:
diff changeset
4282 {
Ritor1
parents:
diff changeset
4283 unsigned int v2; // eax@2
Ritor1
parents:
diff changeset
4284 unsigned __int16 v3; // di@2
Ritor1
parents:
diff changeset
4285 signed int v4; // esi@5
Ritor1
parents:
diff changeset
4286 BLVFace *v5; // eax@7
Ritor1
parents:
diff changeset
4287 unsigned int *v6; // eax@8
Ritor1
parents:
diff changeset
4288 char *v7; // eax@9
Ritor1
parents:
diff changeset
4289 int v8; // edi@16
Ritor1
parents:
diff changeset
4290 char *v9; // esi@16
Ritor1
parents:
diff changeset
4291 ODMFace *v10; // eax@17
Ritor1
parents:
diff changeset
4292 unsigned int *v11; // eax@19
Ritor1
parents:
diff changeset
4293 unsigned __int16 v12; // [sp+Ch] [bp-18h]@2
Ritor1
parents:
diff changeset
4294 const char *Str2; // [sp+10h] [bp-14h]@1
Ritor1
parents:
diff changeset
4295 unsigned int v14; // [sp+14h] [bp-10h]@1
Ritor1
parents:
diff changeset
4296 signed int v15; // [sp+18h] [bp-Ch]@14
Ritor1
parents:
diff changeset
4297 int v16; // [sp+1Ch] [bp-8h]@15
Ritor1
parents:
diff changeset
4298 signed int v17; // [sp+20h] [bp-4h]@4
Ritor1
parents:
diff changeset
4299 signed int v18; // [sp+20h] [bp-4h]@16
Ritor1
parents:
diff changeset
4300
Ritor1
parents:
diff changeset
4301 Str2 = pFilename;
Ritor1
parents:
diff changeset
4302 v14 = uFaceCog;
Ritor1
parents:
diff changeset
4303 if ( uFaceCog )
Ritor1
parents:
diff changeset
4304 {
Ritor1
parents:
diff changeset
4305 v2 = pBitmaps_LOD->LoadTexture(pFilename);
Ritor1
parents:
diff changeset
4306 v3 = v2;
Ritor1
parents:
diff changeset
4307 v12 = v2;
Ritor1
parents:
diff changeset
4308 if ( v2 != -1 ? (int)&pBitmaps_LOD->pTextures[v2] : 0 )
Ritor1
parents:
diff changeset
4309 {
Ritor1
parents:
diff changeset
4310 pBitmaps_LOD->pTextures[v2].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v2].palette_id1);
Ritor1
parents:
diff changeset
4311
Ritor1
parents:
diff changeset
4312 if ( uCurrentlyLoadedLevelType == 1 )
Ritor1
parents:
diff changeset
4313 {
Ritor1
parents:
diff changeset
4314 v17 = 1;
Ritor1
parents:
diff changeset
4315 if ( (signed int)pIndoor->uNumFaceExtras > 1 )
Ritor1
parents:
diff changeset
4316 {
Ritor1
parents:
diff changeset
4317 v4 = 1;
Ritor1
parents:
diff changeset
4318 do
Ritor1
parents:
diff changeset
4319 {
Ritor1
parents:
diff changeset
4320 if ( pIndoor->pFaceExtras[v4].sCogNumber == v14 )
Ritor1
parents:
diff changeset
4321 {
Ritor1
parents:
diff changeset
4322 v5 = &pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C];
Ritor1
parents:
diff changeset
4323 if ( BYTE1(v5->uAttributes) & 0x40 )
Ritor1
parents:
diff changeset
4324 {
Ritor1
parents:
diff changeset
4325 pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uBitmapID = pTextureFrameTable->FindTextureByName(
Ritor1
parents:
diff changeset
4326 Str2);
Ritor1
parents:
diff changeset
4327 v6 = (unsigned int *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uBitmapID;
Ritor1
parents:
diff changeset
4328 if ( *(_WORD *)v6 )
Ritor1
parents:
diff changeset
4329 {
Ritor1
parents:
diff changeset
4330 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(_WORD *)v6);
Ritor1
parents:
diff changeset
4331 }
Ritor1
parents:
diff changeset
4332 else
Ritor1
parents:
diff changeset
4333 {
Ritor1
parents:
diff changeset
4334 *(_WORD *)v6 = v3;
Ritor1
parents:
diff changeset
4335 v7 = (char *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uAttributes;
Ritor1
parents:
diff changeset
4336 v7[1] &= 0xBFu;
Ritor1
parents:
diff changeset
4337 }
Ritor1
parents:
diff changeset
4338 }
Ritor1
parents:
diff changeset
4339 else
Ritor1
parents:
diff changeset
4340 {
Ritor1
parents:
diff changeset
4341 v5->uBitmapID = v3;
Ritor1
parents:
diff changeset
4342 }
Ritor1
parents:
diff changeset
4343 }
Ritor1
parents:
diff changeset
4344 ++v17;
Ritor1
parents:
diff changeset
4345 ++v4;
Ritor1
parents:
diff changeset
4346 }
Ritor1
parents:
diff changeset
4347 while ( v17 < (signed int)pIndoor->uNumFaceExtras );
Ritor1
parents:
diff changeset
4348 }
Ritor1
parents:
diff changeset
4349 pParty->uFlags |= 2u;
Ritor1
parents:
diff changeset
4350 }
Ritor1
parents:
diff changeset
4351 else
Ritor1
parents:
diff changeset
4352 {
Ritor1
parents:
diff changeset
4353 v15 = 0;
Ritor1
parents:
diff changeset
4354 if ( (signed int)pOutdoor->uNumBModels > 0 )
Ritor1
parents:
diff changeset
4355 {
Ritor1
parents:
diff changeset
4356 v16 = 0;
Ritor1
parents:
diff changeset
4357 do
Ritor1
parents:
diff changeset
4358 {
Ritor1
parents:
diff changeset
4359 v8 = 0;
Ritor1
parents:
diff changeset
4360 v9 = (char *)&pOutdoor->pBModels[v16].pVertices;
Ritor1
parents:
diff changeset
4361 v18 = 0;
Ritor1
parents:
diff changeset
4362 if ( (signed int)pOutdoor->pBModels[v16].uNumFaces > 0 )
Ritor1
parents:
diff changeset
4363 {
Ritor1
parents:
diff changeset
4364 do
Ritor1
parents:
diff changeset
4365 {
Ritor1
parents:
diff changeset
4366 v10 = (ODMFace *)(v8 + *((_DWORD *)v9 + 4));
Ritor1
parents:
diff changeset
4367 if ( v10->sCogNumber == v14 )
Ritor1
parents:
diff changeset
4368 {
Ritor1
parents:
diff changeset
4369 if ( BYTE1(v10->uAttributes) & 0x40 )
Ritor1
parents:
diff changeset
4370 {
Ritor1
parents:
diff changeset
4371 *(_WORD *)(*((_DWORD *)v9 + 4) + v8 + 272) = pTextureFrameTable->FindTextureByName(
Ritor1
parents:
diff changeset
4372 Str2);
Ritor1
parents:
diff changeset
4373 v11 = (unsigned int *)(*((_DWORD *)v9 + 4) + v8 + 272);
Ritor1
parents:
diff changeset
4374 if ( *(_WORD *)v11 )
Ritor1
parents:
diff changeset
4375 {
Ritor1
parents:
diff changeset
4376 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(_WORD *)v11);
Ritor1
parents:
diff changeset
4377 }
Ritor1
parents:
diff changeset
4378 else
Ritor1
parents:
diff changeset
4379 {
Ritor1
parents:
diff changeset
4380 *(_WORD *)v11 = v12;
Ritor1
parents:
diff changeset
4381 *(_BYTE *)(*((_DWORD *)v9 + 4) + v8 + 29) &= 0xBFu;
Ritor1
parents:
diff changeset
4382 }
Ritor1
parents:
diff changeset
4383 }
Ritor1
parents:
diff changeset
4384 else
Ritor1
parents:
diff changeset
4385 {
Ritor1
parents:
diff changeset
4386 v10->uTextureID = v12;
Ritor1
parents:
diff changeset
4387 }
Ritor1
parents:
diff changeset
4388 }
Ritor1
parents:
diff changeset
4389 ++v18;
Ritor1
parents:
diff changeset
4390 v8 += 308;
Ritor1
parents:
diff changeset
4391 }
Ritor1
parents:
diff changeset
4392 while ( v18 < *((_DWORD *)v9 + 2) );
Ritor1
parents:
diff changeset
4393 }
Ritor1
parents:
diff changeset
4394 ++v15;
Ritor1
parents:
diff changeset
4395 ++v16;
Ritor1
parents:
diff changeset
4396 }
Ritor1
parents:
diff changeset
4397 while ( v15 < (signed int)pOutdoor->uNumBModels );
Ritor1
parents:
diff changeset
4398 }
Ritor1
parents:
diff changeset
4399 }
Ritor1
parents:
diff changeset
4400 pParty->uFlags |= 2u;
Ritor1
parents:
diff changeset
4401 }
Ritor1
parents:
diff changeset
4402 }
Ritor1
parents:
diff changeset
4403 }
Ritor1
parents:
diff changeset
4404
Ritor1
parents:
diff changeset
4405 //----- (0044882F) --------------------------------------------------------
1515
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
4406 void __fastcall SetDecorationSprite(uint16_t uCog, bool bHide, const char *pFileName)
0
Ritor1
parents:
diff changeset
4407 {
1515
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
4408 for (size_t i = 0; i < uNumLevelDecorations; i++)
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
4409 {
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
4410 if (pLevelDecorations[i].uCog == uCog)
0
Ritor1
parents:
diff changeset
4411 {
1515
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
4412 if (pFileName && strcmp(pFileName, "0"))
0
Ritor1
parents:
diff changeset
4413 {
1515
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
4414 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(pFileName);
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
4415 pDecorationList->InitializeDecorationSprite(pLevelDecorations[i].uDecorationDescID);
0
Ritor1
parents:
diff changeset
4416 }
1515
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
4417
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
4418 if (bHide)
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
4419 pLevelDecorations[i].uFlags &= ~LEVEL_DECORATION_INVISIBLE;
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
4420 else
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
4421 pLevelDecorations[i].uFlags |= LEVEL_DECORATION_INVISIBLE;
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
4422
46f6fc6f72fd Clean :-)
yoctozepto
parents: 1504
diff changeset
4423 pParty->uFlags |= 2u;
0
Ritor1
parents:
diff changeset
4424 }
Ritor1
parents:
diff changeset
4425 }
Ritor1
parents:
diff changeset
4426 }
Ritor1
parents:
diff changeset
4427
Ritor1
parents:
diff changeset
4428 //----- (0044892E) --------------------------------------------------------
Ritor1
parents:
diff changeset
4429 void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on)
Ritor1
parents:
diff changeset
4430 {
Ritor1
parents:
diff changeset
4431 signed int v3; // esi@2
Ritor1
parents:
diff changeset
4432 signed int v4; // ecx@4
Ritor1
parents:
diff changeset
4433 char *v5; // eax@6
Ritor1
parents:
diff changeset
4434 int v6; // edi@13
Ritor1
parents:
diff changeset
4435 char *v7; // esi@13
Ritor1
parents:
diff changeset
4436 signed int v8; // ecx@13
Ritor1
parents:
diff changeset
4437 ODMFace *v9; // eax@14
Ritor1
parents:
diff changeset
4438 int v10; // [sp+0h] [bp-Ch]@1
Ritor1
parents:
diff changeset
4439 signed int v11; // [sp+4h] [bp-8h]@11
Ritor1
parents:
diff changeset
4440 int v12; // [sp+8h] [bp-4h]@12
Ritor1
parents:
diff changeset
4441
Ritor1
parents:
diff changeset
4442 v10 = sCogNumber;
Ritor1
parents:
diff changeset
4443 if ( sCogNumber )
Ritor1
parents:
diff changeset
4444 {
Ritor1
parents:
diff changeset
4445 v3 = 1;
Ritor1
parents:
diff changeset
4446 if ( uCurrentlyLoadedLevelType == 1 )
Ritor1
parents:
diff changeset
4447 {
Ritor1
parents:
diff changeset
4448 if ( (signed int)pIndoor->uNumFaceExtras > 1 )
Ritor1
parents:
diff changeset
4449 {
Ritor1
parents:
diff changeset
4450 v4 = 1;
Ritor1
parents:
diff changeset
4451 do
Ritor1
parents:
diff changeset
4452 {
Ritor1
parents:
diff changeset
4453 if ( pIndoor->pFaceExtras[v4].sCogNumber == v10 )
Ritor1
parents:
diff changeset
4454 {
Ritor1
parents:
diff changeset
4455 v5 = (char *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uAttributes;
Ritor1
parents:
diff changeset
4456 if ( on )
Ritor1
parents:
diff changeset
4457 *(_DWORD *)v5 |= bit;
Ritor1
parents:
diff changeset
4458 else
Ritor1
parents:
diff changeset
4459 *(_DWORD *)v5 &= ~bit;
Ritor1
parents:
diff changeset
4460 }
Ritor1
parents:
diff changeset
4461 ++v3;
Ritor1
parents:
diff changeset
4462 ++v4;
Ritor1
parents:
diff changeset
4463 }
Ritor1
parents:
diff changeset
4464 while ( v3 < (signed int)pIndoor->uNumFaceExtras );
Ritor1
parents:
diff changeset
4465 }
Ritor1
parents:
diff changeset
4466 pParty->uFlags |= 2u;
Ritor1
parents:
diff changeset
4467 }
Ritor1
parents:
diff changeset
4468 else
Ritor1
parents:
diff changeset
4469 {
Ritor1
parents:
diff changeset
4470 v11 = 0;
Ritor1
parents:
diff changeset
4471 if ( (signed int)pOutdoor->uNumBModels > 0 )
Ritor1
parents:
diff changeset
4472 {
Ritor1
parents:
diff changeset
4473 v12 = 0;
Ritor1
parents:
diff changeset
4474 do
Ritor1
parents:
diff changeset
4475 {
Ritor1
parents:
diff changeset
4476 v6 = 0;
Ritor1
parents:
diff changeset
4477 v7 = (char *)&pOutdoor->pBModels[v12].pVertices;
Ritor1
parents:
diff changeset
4478 v8 = 0;
Ritor1
parents:
diff changeset
4479 if ( (signed int)pOutdoor->pBModels[v12].uNumFaces > 0 )
Ritor1
parents:
diff changeset
4480 {
Ritor1
parents:
diff changeset
4481 do
Ritor1
parents:
diff changeset
4482 {
Ritor1
parents:
diff changeset
4483 v9 = (ODMFace *)(v6 + *((_DWORD *)v7 + 4));
Ritor1
parents:
diff changeset
4484 if ( v9->sCogNumber == v10 )
Ritor1
parents:
diff changeset
4485 {
Ritor1
parents:
diff changeset
4486 if ( on )
Ritor1
parents:
diff changeset
4487 v9->uAttributes |= bit;
Ritor1
parents:
diff changeset
4488 else
Ritor1
parents:
diff changeset
4489 v9->uAttributes &= ~bit;
Ritor1
parents:
diff changeset
4490 }
Ritor1
parents:
diff changeset
4491 ++v8;
Ritor1
parents:
diff changeset
4492 v6 += 308;
Ritor1
parents:
diff changeset
4493 }
Ritor1
parents:
diff changeset
4494 while ( v8 < *((_DWORD *)v7 + 2) );
Ritor1
parents:
diff changeset
4495 }
Ritor1
parents:
diff changeset
4496 ++v11;
Ritor1
parents:
diff changeset
4497 ++v12;
Ritor1
parents:
diff changeset
4498 }
Ritor1
parents:
diff changeset
4499 while ( v11 < (signed int)pOutdoor->uNumBModels );
Ritor1
parents:
diff changeset
4500 }
Ritor1
parents:
diff changeset
4501 }
Ritor1
parents:
diff changeset
4502 pParty->uFlags |= 2u;
Ritor1
parents:
diff changeset
4503 }
Ritor1
parents:
diff changeset
4504 }
Ritor1
parents:
diff changeset
4505
Ritor1
parents:
diff changeset
4506 //----- (00448A98) --------------------------------------------------------
Ritor1
parents:
diff changeset
4507 void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle)
Ritor1
parents:
diff changeset
4508 {
Ritor1
parents:
diff changeset
4509 unsigned int v3; // ebx@1
Ritor1
parents:
diff changeset
4510 unsigned int v4; // ebp@1
Ritor1
parents:
diff changeset
4511 signed int v5; // edi@1
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4512 Actor *v6; // esi@4
0
Ritor1
parents:
diff changeset
4513 size_t v7; // ecx@10
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4514 Actor *v8; // eax@11
0
Ritor1
parents:
diff changeset
4515 unsigned __int16 v9; // dx@14
Ritor1
parents:
diff changeset
4516
Ritor1
parents:
diff changeset
4517 v4 = uGroupID;
Ritor1
parents:
diff changeset
4518 v5 = Standing;
Ritor1
parents:
diff changeset
4519 v3 = uFlag;
Ritor1
parents:
diff changeset
4520 if ( uGroupID )
Ritor1
parents:
diff changeset
4521 {
Ritor1
parents:
diff changeset
4522 if ( bToggle )
Ritor1
parents:
diff changeset
4523 {
Ritor1
parents:
diff changeset
4524 if ( (signed int)uNumActors > Standing )
Ritor1
parents:
diff changeset
4525 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
4526 v6 = pActors.data();//[0].uAttributes;
0
Ritor1
parents:
diff changeset
4527 do
Ritor1
parents:
diff changeset
4528 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4529 if ( v6->uGroup == v4 )
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4530 {
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4531 v6->uAttributes |= v3;
0
Ritor1
parents:
diff changeset
4532 if ( v3 == 0x10000 )
Ritor1
parents:
diff changeset
4533 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4534 v6->uAIState = Disabled;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4535 v6->UpdateAnimation();
0
Ritor1
parents:
diff changeset
4536 }
Ritor1
parents:
diff changeset
4537 }
Ritor1
parents:
diff changeset
4538 ++v5;
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4539 ++v6;
0
Ritor1
parents:
diff changeset
4540 }
Ritor1
parents:
diff changeset
4541 while ( v5 < (signed int)uNumActors );
Ritor1
parents:
diff changeset
4542 }
Ritor1
parents:
diff changeset
4543 }
Ritor1
parents:
diff changeset
4544 else
Ritor1
parents:
diff changeset
4545 {
Ritor1
parents:
diff changeset
4546 v7 = uNumActors;
Ritor1
parents:
diff changeset
4547 if ( (signed int)uNumActors > Standing )
Ritor1
parents:
diff changeset
4548 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
4549 v8 = pActors.data();//[0].uAIState;
0
Ritor1
parents:
diff changeset
4550 do
Ritor1
parents:
diff changeset
4551 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4552 if ( v8->uGroup == v4 )
0
Ritor1
parents:
diff changeset
4553 {
Ritor1
parents:
diff changeset
4554 if ( v3 == 0x10000 )
Ritor1
parents:
diff changeset
4555 {
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4556 v9 = v8->uAIState;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4557 if ( v8->uAIState != Dead )
0
Ritor1
parents:
diff changeset
4558 {
Ritor1
parents:
diff changeset
4559 if ( v9 != 4 && v9 != 11 )
82
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4560 v8->uAIState = Standing;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4561 }
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4562 }
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4563 LODWORD(v8->uAttributes) &= ~v3;
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4564 }
1faa29fd4c2d many type, memory, boundary fixes
zipi
parents: 81
diff changeset
4565 ++v8;
0
Ritor1
parents:
diff changeset
4566 --v7;
Ritor1
parents:
diff changeset
4567 }
Ritor1
parents:
diff changeset
4568 while ( v7 );
Ritor1
parents:
diff changeset
4569 }
Ritor1
parents:
diff changeset
4570 }
Ritor1
parents:
diff changeset
4571 }
Ritor1
parents:
diff changeset
4572 }
Ritor1
parents:
diff changeset
4573
Ritor1
parents:
diff changeset
4574 //----- (00448B45) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1445
diff changeset
4575 void GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide)
0
Ritor1
parents:
diff changeset
4576 {
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4577 if ( bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft )
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4578 GameUI_Footer_TimeLeft = 0;
0
Ritor1
parents:
diff changeset
4579 }
Ritor1
parents:
diff changeset
4580
Ritor1
parents:
diff changeset
4581 //----- (00448B67) --------------------------------------------------------
790
Nomad
parents: 789 788
diff changeset
4582 void OnTimer(int __unused)
Nomad
parents: 789 788
diff changeset
4583 {
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4584 if (pEventTimer->bPaused)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4585 return;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4586
790
Nomad
parents: 789 788
diff changeset
4587 if (__unused)
Nomad
parents: 789 788
diff changeset
4588 _5773C0_unused = 0;
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4589
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
4590 long long v13 = (signed __int64)(pParty->uTimePlayed - _5773B8_event_timer) / 128;
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4591 if (!v13)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4592 return;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4593
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4594 //uint _v2v3 = pParty->uTimePlayed;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4595 //v3 = HIDWORD(pParty->uTimePlayed);
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4596 //v2 = LODWORD(pParty->uTimePlayed);
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4597
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4598 _5773B8_event_timer = pParty->uTimePlayed;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4599
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4600 for (uint i = 0; i < dword_5B65C8_timers_count; ++i)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4601 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4602 //v4 = (char *)&array_5B5928_timers[0].field_C;
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1951
diff changeset
4603 stru176* timer = &array_5B5928_timers[i];
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4604 //while ( 1 )
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4605 //{
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4606 //v5 = *(short *)v4;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4607 if (timer->time_left_to_fire)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4608 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4609 if (v13 < timer->time_left_to_fire)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4610 timer->time_left_to_fire -= v13;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4611 else
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4612 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4613 timer->time_left_to_fire = timer->fire_interval;
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
4614 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4615 }
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4616 }
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4617 else
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4618 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4619 if (timer->next_fire_time < pParty->uTimePlayed)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4620 {
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4621 uint next_trigger_time = 1 * 60 * 60 * 24; // 1 day
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4622 if (timer->field_10)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4623 next_trigger_time = 336 * 60 * 60 * 24; // 1 year
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4624 else if (timer->field_12)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4625 next_trigger_time = 28 * 60 * 60 * 24; // 1 month
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4626 else if (timer->field_14)
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4627 next_trigger_time = 7 * 60 * 60 * 24; // 1 week
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4628
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4629 timer->next_fire_time += (next_trigger_time * 128) / 3.0f;
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
4630 if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed
789
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4631 timer->next_fire_time = pParty->uTimePlayed;
83a58d185d3c stru176 & OnTimer
Nomad
parents: 784
diff changeset
4632
1052
d48c762de563 -nomarg
Nomad
parents: 1037
diff changeset
4633 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
0
Ritor1
parents:
diff changeset
4634 }
Ritor1
parents:
diff changeset
4635 }
Ritor1
parents:
diff changeset
4636 }
Ritor1
parents:
diff changeset
4637 }
Ritor1
parents:
diff changeset
4638
Ritor1
parents:
diff changeset
4639 //----- (00481D77) --------------------------------------------------------
Ritor1
parents:
diff changeset
4640 void _outdoor_project(RenderVertexSoft *v)
Ritor1
parents:
diff changeset
4641 {
Ritor1
parents:
diff changeset
4642 double v1; // st7@1
Ritor1
parents:
diff changeset
4643 double v2; // st7@1
Ritor1
parents:
diff changeset
4644
Ritor1
parents:
diff changeset
4645 v1 = 1.0 / (v->vWorldViewPosition.x + 0.0000001);
168
ee11772d0ad2 New sky (turn on -new_sky console command)
Nomad
parents: 144
diff changeset
4646 v->_rhw = v1;
1637
2c71fa8913d2 class OutdoorCamera -> ODMRenderParams
Nomad
parents: 1632
diff changeset
4647 v2 = v1 * (double)pODMRenderParams->int_fov_rad;
0
Ritor1
parents:
diff changeset
4648 v->vWorldViewProjX = (double)pViewport->uScreenCenterX - v2 * v->vWorldViewPosition.y;
Ritor1
parents:
diff changeset
4649 v->vWorldViewProjY = (double)pViewport->uScreenCenterY - v2 * v->vWorldViewPosition.z;
Ritor1
parents:
diff changeset
4650 }
Ritor1
parents:
diff changeset
4651
Ritor1
parents:
diff changeset
4652 //----- (00448CF4) --------------------------------------------------------
Ritor1
parents:
diff changeset
4653 void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName)
Ritor1
parents:
diff changeset
4654 {
Ritor1
parents:
diff changeset
4655 __int16 v8; // di@1
Ritor1
parents:
diff changeset
4656 __int16 v9; // si@1
Ritor1
parents:
diff changeset
4657 unsigned int v10; // eax@1
Ritor1
parents:
diff changeset
4658 size_t v11; // ebx@2
Ritor1
parents:
diff changeset
4659 signed int v12; // esi@2
35
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
4660 Actor *pActor;//Actor_uYawAngle_cr *v13; // ebx@3
0
Ritor1
parents:
diff changeset
4661 AIDirection a3; // [sp+Ch] [bp-50h]@2
Ritor1
parents:
diff changeset
4662 AIDirection v15; // [sp+28h] [bp-34h]@2
Ritor1
parents:
diff changeset
4663 //SpawnPointMM7 v16; // [sp+44h] [bp-18h]@1
Ritor1
parents:
diff changeset
4664
Ritor1
parents:
diff changeset
4665 v8 = typeindex;
Ritor1
parents:
diff changeset
4666 v9 = level;
Ritor1
parents:
diff changeset
4667
Ritor1
parents:
diff changeset
4668 SpawnPointMM7 v16; // [sp+44h] [bp-18h]@1
Ritor1
parents:
diff changeset
4669 //SpawnPointMM7::SpawnPointMM7(&v16);
Ritor1
parents:
diff changeset
4670
Ritor1
parents:
diff changeset
4671 v16.vPosition.x = x;
Ritor1
parents:
diff changeset
4672 v16.vPosition.y = y;
Ritor1
parents:
diff changeset
4673 v16.vPosition.z = z;
Ritor1
parents:
diff changeset
4674 v16.uGroup = group;
Ritor1
parents:
diff changeset
4675 v16.uRadius = 32;
Ritor1
parents:
diff changeset
4676 v16.uKind = 3;
Ritor1
parents:
diff changeset
4677 v16.uIndex = v8 + 2 * v9 + v9;
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1470
diff changeset
4678 v10 = pMapStats->GetMapInfo(pCurrentMapName);
0
Ritor1
parents:
diff changeset
4679 if ( v10 )
Ritor1
parents:
diff changeset
4680 {
Ritor1
parents:
diff changeset
4681 v11 = uNumActors;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4682 SpawnEncounter(&pMapStats->pInfos[v10], &v16, 0, count, 0);
1910
8d3723ca71e6 Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents: 1905
diff changeset
4683 Actor::GetDirectionInfo(PID(OBJECT_Actor, v11), 4u, &v15, 1);
0
Ritor1
parents:
diff changeset
4684 v12 = v11;
Ritor1
parents:
diff changeset
4685 if ( (signed int)v11 < (signed int)uNumActors )
Ritor1
parents:
diff changeset
4686 {
35
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
4687 for ( pActor = &pActors[v11]; v12 < (signed int)uNumActors; ++pActor )
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
4688 {
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
4689 pActor->PrepareSprites(0);
0
Ritor1
parents:
diff changeset
4690 ++v12;
35
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
4691 pActor->uYawAngle = v15.uYawAngle;
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
4692 pActor->dword_000334_unique_name = uUniqueName;
aac67e0d2c10 uMovementSpeed = v9->uBaseSpe
Ritor1
parents: 33
diff changeset
4693 }
0
Ritor1
parents:
diff changeset
4694 }
Ritor1
parents:
diff changeset
4695 }
Ritor1
parents:
diff changeset
4696 }
Ritor1
parents:
diff changeset
4697
Ritor1
parents:
diff changeset
4698
Ritor1
parents:
diff changeset
4699 //----- (0044987B) --------------------------------------------------------
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4700 void sub_44987B(const char *pMapName, MapStartPoint start_point)
0
Ritor1
parents:
diff changeset
4701 {
Ritor1
parents:
diff changeset
4702 const char *v2; // edi@1
Ritor1
parents:
diff changeset
4703
Ritor1
parents:
diff changeset
4704 v2 = pMapName;
Ritor1
parents:
diff changeset
4705 pAudioPlayer->StopChannels(-1, -1);
434
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 433
diff changeset
4706 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None);
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1470
diff changeset
4707 if ( _stricmp(pCurrentMapName, v2) )
0
Ritor1
parents:
diff changeset
4708 SaveGame(1, 0);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4709
978
9334a8c59c8d uGameState
Ritor1
parents: 973
diff changeset
4710 uGameState = GAME_STATE_2;
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1470
diff changeset
4711 strcpy(pCurrentMapName, v2);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4712 uLevel_StartingPointType = start_point;
0
Ritor1
parents:
diff changeset
4713 }
Ritor1
parents:
diff changeset
4714 // 6BE35C: using guessed type int uLevel_StartingPointType;
Ritor1
parents:
diff changeset
4715
Ritor1
parents:
diff changeset
4716 //----- (004498D5) --------------------------------------------------------
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4717 void TeleportToStartingPoint(MapStartPoint point)
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4718 {
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4719 //unsigned int v1; // ecx@2
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4720 //int v2; // ecx@3
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4721 //int v3; // ecx@4
0
Ritor1
parents:
diff changeset
4722 unsigned __int16 v4; // ax@11
Ritor1
parents:
diff changeset
4723 signed int v5; // ecx@12
Ritor1
parents:
diff changeset
4724 LevelDecoration *v6; // edx@13
Ritor1
parents:
diff changeset
4725 signed int v7; // ecx@17
Ritor1
parents:
diff changeset
4726 int v8; // eax@17
Ritor1
parents:
diff changeset
4727 int v9; // ecx@17
Ritor1
parents:
diff changeset
4728 const char *v10; // [sp-4h] [bp-84h]@6
Ritor1
parents:
diff changeset
4729 char pName[128]; // [sp+8h] [bp-78h]@11
Ritor1
parents:
diff changeset
4730
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4731 switch (point)
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4732 {
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4733 case MapStartPoint_Party: v10 = "Party Start"; break;
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4734 case MapStartPoint_North: v10 = "North Start"; break;
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4735 case MapStartPoint_South: v10 = "South Start"; break;
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4736 case MapStartPoint_East: v10 = "East Start"; break;
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4737 case MapStartPoint_West: v10 = "West Start"; break;
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4738 default:
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4739 Error("Invalid enum value: %u", point);
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4740 }
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4741
0
Ritor1
parents:
diff changeset
4742 strcpy(pName, v10);
Ritor1
parents:
diff changeset
4743 v4 = pDecorationList->GetDecorIdByName(pName);
Ritor1
parents:
diff changeset
4744 if ( v4 )
Ritor1
parents:
diff changeset
4745 {
Ritor1
parents:
diff changeset
4746 v5 = 0;
Ritor1
parents:
diff changeset
4747 if ( (signed int)uNumLevelDecorations > 0 )
Ritor1
parents:
diff changeset
4748 {
1202
0dbf6c4dd029 arrays to std::arrays phase 1
Grumpy7
parents: 1167
diff changeset
4749 v6 = pLevelDecorations.data();
0
Ritor1
parents:
diff changeset
4750 while ( v6->uDecorationDescID != (signed __int16)v4 )
Ritor1
parents:
diff changeset
4751 {
Ritor1
parents:
diff changeset
4752 ++v5;
Ritor1
parents:
diff changeset
4753 ++v6;
Ritor1
parents:
diff changeset
4754 if ( v5 >= (signed int)uNumLevelDecorations )
Ritor1
parents:
diff changeset
4755 goto LABEL_20;
Ritor1
parents:
diff changeset
4756 }
Ritor1
parents:
diff changeset
4757 v7 = v5;
Ritor1
parents:
diff changeset
4758 pParty->vPosition.x = pLevelDecorations[v7].vPosition.x;
Ritor1
parents:
diff changeset
4759 pParty->vPosition.y = pLevelDecorations[v7].vPosition.y;
Ritor1
parents:
diff changeset
4760 pParty->vPosition.z = pLevelDecorations[v7].vPosition.z;
Ritor1
parents:
diff changeset
4761 pParty->uFallStartY = pParty->vPosition.z;
Ritor1
parents:
diff changeset
4762 v8 = (signed int)(stru_5C6E00->uIntegerHalfPi * pLevelDecorations[v7].field_1A) / 90;
Ritor1
parents:
diff changeset
4763 v9 = pLevelDecorations[v7].field_10_y_rot;
Ritor1
parents:
diff changeset
4764 pParty->sRotationY = v8;
Ritor1
parents:
diff changeset
4765 if ( v9 )
Ritor1
parents:
diff changeset
4766 pParty->sRotationY = v9;
Ritor1
parents:
diff changeset
4767 pParty->sRotationX = 0;
Ritor1
parents:
diff changeset
4768 pParty->uFallSpeed = 0;
Ritor1
parents:
diff changeset
4769 }
Ritor1
parents:
diff changeset
4770 LABEL_20:
Ritor1
parents:
diff changeset
4771 if ( dword_5B65C0 )
Ritor1
parents:
diff changeset
4772 {
Ritor1
parents:
diff changeset
4773 if ( _5B65A8_npcdata_uflags_or_other )
Ritor1
parents:
diff changeset
4774 pParty->vPosition.x = _5B65A8_npcdata_uflags_or_other;
Ritor1
parents:
diff changeset
4775 if ( _5B65AC_npcdata_fame_or_other )
Ritor1
parents:
diff changeset
4776 pParty->vPosition.y = _5B65AC_npcdata_fame_or_other;
Ritor1
parents:
diff changeset
4777 if ( _5B65B0_npcdata_rep_or_other )
Ritor1
parents:
diff changeset
4778 {
Ritor1
parents:
diff changeset
4779 pParty->vPosition.z = _5B65B0_npcdata_rep_or_other;
Ritor1
parents:
diff changeset
4780 pParty->uFallStartY = _5B65B0_npcdata_rep_or_other;
Ritor1
parents:
diff changeset
4781 }
1516
f3cd08b89476 Fix assertion error when exiting Harmondale's castle. Possibly original bug.
yoctozepto
parents: 1515
diff changeset
4782 if ( _5B65B4_npcdata_loword_house_or_other != -1 )
0
Ritor1
parents:
diff changeset
4783 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other;
Ritor1
parents:
diff changeset
4784 if ( _5B65B8_npcdata_hiword_house_or_other )
Ritor1
parents:
diff changeset
4785 pParty->sRotationX = _5B65B8_npcdata_hiword_house_or_other;
Ritor1
parents:
diff changeset
4786 if ( dword_5B65BC )
Ritor1
parents:
diff changeset
4787 pParty->uFallSpeed = dword_5B65BC;
Ritor1
parents:
diff changeset
4788 }
Ritor1
parents:
diff changeset
4789 _5B65B4_npcdata_loword_house_or_other = -1;
Ritor1
parents:
diff changeset
4790 dword_5B65C0 = 0;
Ritor1
parents:
diff changeset
4791 dword_5B65BC = 0;
Ritor1
parents:
diff changeset
4792 _5B65B8_npcdata_hiword_house_or_other = 0;
Ritor1
parents:
diff changeset
4793 _5B65B0_npcdata_rep_or_other = 0;
Ritor1
parents:
diff changeset
4794 _5B65AC_npcdata_fame_or_other = 0;
Ritor1
parents:
diff changeset
4795 _5B65A8_npcdata_uflags_or_other = 0;
Ritor1
parents:
diff changeset
4796 }
Ritor1
parents:
diff changeset
4797 }
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
4798
0
Ritor1
parents:
diff changeset
4799 //----- (00449A49) --------------------------------------------------------
2138
Ritor1
parents: 2065
diff changeset
4800 void Door_switch_animation(unsigned int uDoorID, int a2)
0
Ritor1
parents:
diff changeset
4801 {
2138
Ritor1
parents: 2065
diff changeset
4802 int old_state; // eax@1
Ritor1
parents: 2065
diff changeset
4803 signed int door_id; // esi@2
Ritor1
parents: 2065
diff changeset
4804
0
Ritor1
parents:
diff changeset
4805 if ( !pIndoor->pDoors )
2138
Ritor1
parents: 2065
diff changeset
4806 return;
Ritor1
parents: 2065
diff changeset
4807 for ( door_id = 0; door_id < 200; ++door_id )
0
Ritor1
parents:
diff changeset
4808 {
2138
Ritor1
parents: 2065
diff changeset
4809 if ( pIndoor->pDoors[door_id].uDoorID == uDoorID )
0
Ritor1
parents:
diff changeset
4810 break;
Ritor1
parents:
diff changeset
4811 }
2138
Ritor1
parents: 2065
diff changeset
4812 if ( door_id >= 200 )
0
Ritor1
parents:
diff changeset
4813 {
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1544
diff changeset
4814 Error("Unable to find Door ID: %i!", uDoorID);
0
Ritor1
parents:
diff changeset
4815 }
2138
Ritor1
parents: 2065
diff changeset
4816 old_state = pIndoor->pDoors[door_id].uState;
Ritor1
parents: 2065
diff changeset
4817 if ( a2 == 2 )
0
Ritor1
parents:
diff changeset
4818 {
2138
Ritor1
parents: 2065
diff changeset
4819 if ( pIndoor->pDoors[door_id].uState == BLVDoor::Closing || pIndoor->pDoors[door_id].uState == BLVDoor::Opening )
Ritor1
parents: 2065
diff changeset
4820 return;
Ritor1
parents: 2065
diff changeset
4821 if ( pIndoor->pDoors[door_id].uState )
Ritor1
parents: 2065
diff changeset
4822 {
Ritor1
parents: 2065
diff changeset
4823 if ( pIndoor->pDoors[door_id].uState != BLVDoor::Closed && pIndoor->pDoors[door_id].uState != BLVDoor::Closing )
Ritor1
parents: 2065
diff changeset
4824 {
Ritor1
parents: 2065
diff changeset
4825 pIndoor->pDoors[door_id].uState = BLVDoor::Closing;
Ritor1
parents: 2065
diff changeset
4826 if ( old_state == BLVDoor::Open )
Ritor1
parents: 2065
diff changeset
4827 {
Ritor1
parents: 2065
diff changeset
4828 pIndoor->pDoors[door_id].uTimeSinceTriggered = 0;
Ritor1
parents: 2065
diff changeset
4829 return;
Ritor1
parents: 2065
diff changeset
4830 }
Ritor1
parents: 2065
diff changeset
4831 if ( pIndoor->pDoors[door_id].uTimeSinceTriggered != 15360 )
Ritor1
parents: 2065
diff changeset
4832 {
Ritor1
parents: 2065
diff changeset
4833 pIndoor->pDoors[door_id].uTimeSinceTriggered = (pIndoor->pDoors[door_id].uMoveLength << 7) / pIndoor->pDoors[door_id].uOpenSpeed
Ritor1
parents: 2065
diff changeset
4834 - ((signed int)(pIndoor->pDoors[door_id].uTimeSinceTriggered * pIndoor->pDoors[door_id].uCloseSpeed)
Ritor1
parents: 2065
diff changeset
4835 / 128 << 7) / pIndoor->pDoors[door_id].uOpenSpeed;
Ritor1
parents: 2065
diff changeset
4836 return;
Ritor1
parents: 2065
diff changeset
4837 }
Ritor1
parents: 2065
diff changeset
4838 pIndoor->pDoors[door_id].uTimeSinceTriggered = 15360;
Ritor1
parents: 2065
diff changeset
4839 }
Ritor1
parents: 2065
diff changeset
4840 return;
Ritor1
parents: 2065
diff changeset
4841 }
0
Ritor1
parents:
diff changeset
4842 }
Ritor1
parents:
diff changeset
4843 else
Ritor1
parents:
diff changeset
4844 {
2138
Ritor1
parents: 2065
diff changeset
4845 if ( a2 == 0 )
0
Ritor1
parents:
diff changeset
4846 {
2138
Ritor1
parents: 2065
diff changeset
4847 if ( pIndoor->pDoors[door_id].uState != BLVDoor::Closed && pIndoor->pDoors[door_id].uState != BLVDoor::Closing )
0
Ritor1
parents:
diff changeset
4848 {
2138
Ritor1
parents: 2065
diff changeset
4849 pIndoor->pDoors[door_id].uState = BLVDoor::Closing;
Ritor1
parents: 2065
diff changeset
4850 if ( old_state == BLVDoor::Open )
0
Ritor1
parents:
diff changeset
4851 {
2138
Ritor1
parents: 2065
diff changeset
4852 pIndoor->pDoors[door_id].uTimeSinceTriggered = 0;
Ritor1
parents: 2065
diff changeset
4853 return;
0
Ritor1
parents:
diff changeset
4854 }
2138
Ritor1
parents: 2065
diff changeset
4855 if ( pIndoor->pDoors[door_id].uTimeSinceTriggered != 15360 )
0
Ritor1
parents:
diff changeset
4856 {
2138
Ritor1
parents: 2065
diff changeset
4857 pIndoor->pDoors[door_id].uTimeSinceTriggered = (pIndoor->pDoors[door_id].uMoveLength << 7) / pIndoor->pDoors[door_id].uOpenSpeed
Ritor1
parents: 2065
diff changeset
4858 - ((signed int)(pIndoor->pDoors[door_id].uTimeSinceTriggered * pIndoor->pDoors[door_id].uCloseSpeed)
Ritor1
parents: 2065
diff changeset
4859 / 128 << 7) / pIndoor->pDoors[door_id].uOpenSpeed;
Ritor1
parents: 2065
diff changeset
4860 return;
0
Ritor1
parents:
diff changeset
4861 }
2138
Ritor1
parents: 2065
diff changeset
4862 pIndoor->pDoors[door_id].uTimeSinceTriggered = 15360;
0
Ritor1
parents:
diff changeset
4863 }
2138
Ritor1
parents: 2065
diff changeset
4864 return;
0
Ritor1
parents:
diff changeset
4865 }
2138
Ritor1
parents: 2065
diff changeset
4866 if ( a2 != 1 )
Ritor1
parents: 2065
diff changeset
4867 return;
0
Ritor1
parents:
diff changeset
4868 }
2138
Ritor1
parents: 2065
diff changeset
4869 if ( old_state != BLVDoor::Open && old_state != BLVDoor::Opening )
0
Ritor1
parents:
diff changeset
4870 {
2138
Ritor1
parents: 2065
diff changeset
4871 pIndoor->pDoors[door_id].uState = BLVDoor::Opening;
Ritor1
parents: 2065
diff changeset
4872 if ( old_state == BLVDoor::Closed )
Ritor1
parents: 2065
diff changeset
4873 {
Ritor1
parents: 2065
diff changeset
4874 pIndoor->pDoors[door_id].uTimeSinceTriggered = 0;
Ritor1
parents: 2065
diff changeset
4875 return;
Ritor1
parents: 2065
diff changeset
4876 }
Ritor1
parents: 2065
diff changeset
4877 if ( pIndoor->pDoors[door_id].uTimeSinceTriggered != 15360 )
0
Ritor1
parents:
diff changeset
4878 {
2138
Ritor1
parents: 2065
diff changeset
4879 pIndoor->pDoors[door_id].uTimeSinceTriggered = (pIndoor->pDoors[door_id].uMoveLength << 7) / pIndoor->pDoors[door_id].uCloseSpeed
Ritor1
parents: 2065
diff changeset
4880 - ((signed int)(pIndoor->pDoors[door_id].uTimeSinceTriggered * pIndoor->pDoors[door_id].uOpenSpeed)
Ritor1
parents: 2065
diff changeset
4881 / 128 << 7) / pIndoor->pDoors[door_id].uCloseSpeed;
Ritor1
parents: 2065
diff changeset
4882 return;
0
Ritor1
parents:
diff changeset
4883 }
2138
Ritor1
parents: 2065
diff changeset
4884 pIndoor->pDoors[door_id].uTimeSinceTriggered = 15360;
0
Ritor1
parents:
diff changeset
4885 }
2138
Ritor1
parents: 2065
diff changeset
4886 return;
0
Ritor1
parents:
diff changeset
4887 }
Ritor1
parents:
diff changeset
4888
Ritor1
parents:
diff changeset
4889 //----- (00449B57) --------------------------------------------------------
521
663c4f618f56 Awards tab corrrection
Gloval
parents: 520
diff changeset
4890 bool _449B57_test_bit( unsigned __int8 *a1, __int16 a2 )
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
4891 {
1113
39eaa6b00141 something to bool cast (performance warning) mostly fixed
Grumpy7
parents: 1112
diff changeset
4892 return (a1[(a2 - 1) >> 3] & (0x80u >> (a2 - 1) % 8)) != 0;
0
Ritor1
parents:
diff changeset
4893 }
Ritor1
parents:
diff changeset
4894
Ritor1
parents:
diff changeset
4895 //----- (00449B7E) --------------------------------------------------------
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
4896 void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle)
0
Ritor1
parents:
diff changeset
4897 {
Ritor1
parents:
diff changeset
4898 signed int v3; // esi@1
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
4899 unsigned char set_bit; // edx@1
0
Ritor1
parents:
diff changeset
4900
Ritor1
parents:
diff changeset
4901 v3 = a2 - 1;
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
4902 set_bit = 0x80 >> v3 % 8;
0
Ritor1
parents:
diff changeset
4903 if ( bToggle )
501
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
4904 pArray[v3 / 8] |= set_bit;
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
4905 else
6fa3ff8ef729 SubtractVariables
Ritor1
parents: 488
diff changeset
4906 pArray[v3 / 8] &= ~set_bit;
0
Ritor1
parents:
diff changeset
4907 }
Ritor1
parents:
diff changeset
4908
Ritor1
parents:
diff changeset
4909 //----- (0044C175) --------------------------------------------------------
1160
502b8b2e36b4 font cleaning
Gloval
parents: 1119
diff changeset
4910 void ShowStatusBarString( const char *pString, unsigned int uNumSeconds )
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4911 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
4912 strcpy(GameUI_Footer_TimedString.data(), pString);
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4913 GameUI_Footer_TimeLeft = 1000 * uNumSeconds + GetTickCount();
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4914
2138
Ritor1
parents: 2065
diff changeset
4915 for (int i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); i > 450;
Ritor1
parents: 2065
diff changeset
4916 i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) )
1470
c987b5ed09af footer array fix
zipi
parents: 1459
diff changeset
4917 GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0;
0
Ritor1
parents:
diff changeset
4918 }
Ritor1
parents:
diff changeset
4919
Ritor1
parents:
diff changeset
4920 //----- (0044C1D0) --------------------------------------------------------
1035
306ec23b37df 004C1EE5 & other stuff
Nomad
parents: 1033
diff changeset
4921 void ShowNothingHereStatus()
0
Ritor1
parents:
diff changeset
4922 {
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 774
diff changeset
4923 if ( !GameUI_Footer_TimeLeft )
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4924 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2);// Nothing here
0
Ritor1
parents:
diff changeset
4925 }
Ritor1
parents:
diff changeset
4926
Ritor1
parents:
diff changeset
4927 //----- (0044C28B) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4928 int const_2()
0
Ritor1
parents:
diff changeset
4929 {
Ritor1
parents:
diff changeset
4930 return 2;
Ritor1
parents:
diff changeset
4931 }
Ritor1
parents:
diff changeset
4932
Ritor1
parents:
diff changeset
4933 //----- (0044C28F) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4934 bool TeleportToNWCDungeon()
0
Ritor1
parents:
diff changeset
4935 {
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1470
diff changeset
4936 if (!_stricmp("nwc.blv", pCurrentMapName))
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4937 return false;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4938
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4939 _5B65A8_npcdata_uflags_or_other = 0;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4940 _5B65AC_npcdata_fame_or_other = 0;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4941 _5B65B0_npcdata_rep_or_other = 0;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4942 _5B65B4_npcdata_loword_house_or_other = 0;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4943 _5B65B8_npcdata_hiword_house_or_other = 0;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4944 dword_5B65BC = 0;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4945 dword_5B65C0 = 0;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4946
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4947 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4948 sub_44987B("nwc.blv", MapStartPoint_Party);
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4949 pCurrentScreen = SCREEN_GAME;
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
4950 return true;
0
Ritor1
parents:
diff changeset
4951 }
Ritor1
parents:
diff changeset
4952
Ritor1
parents:
diff changeset
4953 //----- (00401000) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1445
diff changeset
4954 void mm7__vector_constructor(void *a1, int objSize, int numObjs, int ( *constructor)(int))
0
Ritor1
parents:
diff changeset
4955 {
Ritor1
parents:
diff changeset
4956 void *v4; // esi@2
2138
Ritor1
parents: 2065
diff changeset
4957
Ritor1
parents: 2065
diff changeset
4958 if ( numObjs > 0 )
0
Ritor1
parents:
diff changeset
4959 {
Ritor1
parents:
diff changeset
4960 v4 = a1;
2138
Ritor1
parents: 2065
diff changeset
4961 for ( int i = numObjs; i; --i )
0
Ritor1
parents:
diff changeset
4962 {
Ritor1
parents:
diff changeset
4963 constructor((int)v4);
Ritor1
parents:
diff changeset
4964 v4 = (char *)v4 + objSize;
Ritor1
parents:
diff changeset
4965 }
Ritor1
parents:
diff changeset
4966 }
Ritor1
parents:
diff changeset
4967 }
Ritor1
parents:
diff changeset
4968
Ritor1
parents:
diff changeset
4969 //----- (0040261D) --------------------------------------------------------
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4970 void stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8)
0
Ritor1
parents:
diff changeset
4971 {
1546
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4972 if (count < 100)
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4973 {
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4974 pIDs[count] = uID;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4975 pXs[count] = x;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4976 pYs[count] = y;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4977 pZs[count] = z;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4978 field_324[count] = a3;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4979 field_3EC[count] = a8;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4980 field_450[count++] = a7;
9a6567c6c76c stru141 & misc cleaning
Nomad
parents: 1545
diff changeset
4981 }
0
Ritor1
parents:
diff changeset
4982 }
Ritor1
parents:
diff changeset
4983
Ritor1
parents:
diff changeset
4984 //----- (00402CAE) --------------------------------------------------------
323
d720a13e2273 Very basic picking & entering houses
Nomad
parents: 322
diff changeset
4985 int stru193_math::Cos(int angle)
0
Ritor1
parents:
diff changeset
4986 {
Ritor1
parents:
diff changeset
4987 int v2; // eax@1
Ritor1
parents:
diff changeset
4988
Ritor1
parents:
diff changeset
4989 //a2: (angle - uIntegerHalfPi) for sin(angle)
Ritor1
parents:
diff changeset
4990 // (angle) for cos(angle)
Ritor1
parents:
diff changeset
4991
Ritor1
parents:
diff changeset
4992 v2 = uDoublePiMask & angle;
Ritor1
parents:
diff changeset
4993
Ritor1
parents:
diff changeset
4994 if ( v2 > uIntegerPi )
Ritor1
parents:
diff changeset
4995 v2 = uIntegerDoublePi - v2;
Ritor1
parents:
diff changeset
4996 if ( v2 >= uIntegerHalfPi )
Ritor1
parents:
diff changeset
4997 return -pCosTable[uIntegerPi - v2];
Ritor1
parents:
diff changeset
4998 else
Ritor1
parents:
diff changeset
4999 return pCosTable[v2];
Ritor1
parents:
diff changeset
5000 }
Ritor1
parents:
diff changeset
5001