annotate mm7_3.cpp @ 2348:4100fb5c4913

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