annotate mm7_4.cpp @ 2248:8c5855b842dc

changing shopt stealing condition a bit
author Grumpy7
date Wed, 26 Feb 2014 01:18:42 +0100
parents 529bf95fb0d7
children 708aa31cad56
rev   line source
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2132
diff changeset
1 #include "mm7_data.h"
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2132
diff changeset
2 #include "mm7_unsorted_subs.h"
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
3 #include "Texture.h"
1016
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
4 #include "VideoPlayer.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
5 #include "Sprites.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
6 #include "BSPModel.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
7 #include "Mouse.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
8 #include "stru6.h"
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
9
c45d51b3f4f4 Included header files cleanup
Grumpy7
parents: 990
diff changeset
10 #include "LightmapBuilder.h"
341
a8ee15a20bea EnterHouse
Nomad
parents: 336
diff changeset
11 #include "MM7.h"
0
Ritor1
parents:
diff changeset
12 #include "MapInfo.h"
Ritor1
parents:
diff changeset
13 #include "Game.h"
Ritor1
parents:
diff changeset
14 #include "GUIWindow.h"
Ritor1
parents:
diff changeset
15 #include "GUIFont.h"
Ritor1
parents:
diff changeset
16 #include "Party.h"
Ritor1
parents:
diff changeset
17 #include "AudioPlayer.h"
Ritor1
parents:
diff changeset
18 #include "Outdoor.h"
1277
1803172dffd9 header stuff
Grumpy7
parents: 1275
diff changeset
19 #include "Outdoor_stuff.h"
0
Ritor1
parents:
diff changeset
20 #include "LOD.h"
Ritor1
parents:
diff changeset
21 #include "Actor.h"
Ritor1
parents:
diff changeset
22 #include "Events.h"
Ritor1
parents:
diff changeset
23 #include "Viewport.h"
Ritor1
parents:
diff changeset
24 #include "FrameTableInc.h"
2037
7a9477135943 Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents: 2030
diff changeset
25 #include "OurMath.h"
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
26 #include "SpriteObject.h"
0
Ritor1
parents:
diff changeset
27 #include "ObjectList.h"
Ritor1
parents:
diff changeset
28 #include "DecorationList.h"
2044
28cb79ae2f6f Time.h rename
Ritor1
parents: 2043
diff changeset
29 #include "Timer.h"
0
Ritor1
parents:
diff changeset
30 #include "IconFrameTable.h"
Ritor1
parents:
diff changeset
31 #include "PlayerFrameTable.h"
Ritor1
parents:
diff changeset
32 #include "Awards.h"
Ritor1
parents:
diff changeset
33 #include "TurnEngine.h"
Ritor1
parents:
diff changeset
34 #include "Events2D.h"
Ritor1
parents:
diff changeset
35 #include "stru159.h"
189
038a4d09406f new texts file, fix text rendender error
Gloval
parents: 180
diff changeset
36 #include "texts.h"
0
Ritor1
parents:
diff changeset
37 #include "Log.h"
1299
8c2f689b5f0b folder UI
Ritor1
parents: 1295
diff changeset
38 #include "UI\UIHouses.h"
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1254
diff changeset
39 #include "Lights.h"
1828
35c1e4ff6ba7 party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents: 1827
diff changeset
40 #include "Level/Decoration.h"
0
Ritor1
parents:
diff changeset
41
Ritor1
parents:
diff changeset
42 //----- (0046CC4B) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
43 void check_event_triggers()
0
Ritor1
parents:
diff changeset
44 {
1513
4055b09160ae Clean and decouple. (2)
yoctozepto
parents: 1489
diff changeset
45 for (size_t i = 0; i < num_event_triggers; i++)
0
Ritor1
parents:
diff changeset
46 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
47 if (pLevelDecorations[event_triggers[i]].uFlags & LEVEL_DECORATION_TRIGGERED_BY_TOUCH
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
48 && pLevelDecorations[event_triggers[i]].vPosition.GetDistanceTo(pParty->vPosition) < pLevelDecorations[event_triggers[i]].uTriggerRange)
0
Ritor1
parents:
diff changeset
49 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
50 EventProcessor(pLevelDecorations[event_triggers[i]].uEventID, PID(OBJECT_Decoration,i), 1);
0
Ritor1
parents:
diff changeset
51 }
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
52 else if (pLevelDecorations[event_triggers[i]].uFlags & LEVEL_DECORATION_TRIGGERED_BY_MONSTER)
0
Ritor1
parents:
diff changeset
53 {
1513
4055b09160ae Clean and decouple. (2)
yoctozepto
parents: 1489
diff changeset
54 for (size_t j = 0; j < uNumActors; j++)
0
Ritor1
parents:
diff changeset
55 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
56 if (pLevelDecorations[event_triggers[i]].vPosition.GetDistanceTo(pActors[j].vPosition) < pLevelDecorations[event_triggers[i]].uTriggerRange)
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
57 EventProcessor(pLevelDecorations[event_triggers[i]].uEventID, 0, 1);
0
Ritor1
parents:
diff changeset
58 }
Ritor1
parents:
diff changeset
59 }
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
60 else if (pLevelDecorations[event_triggers[i]].uFlags & LEVEL_DECORATION_TRIGGERED_BY_OBJECT)
0
Ritor1
parents:
diff changeset
61 {
1513
4055b09160ae Clean and decouple. (2)
yoctozepto
parents: 1489
diff changeset
62 for (size_t j = 0; j < uNumSpriteObjects; j++)
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
63 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
64 if (pLevelDecorations[event_triggers[i]].vPosition.GetDistanceTo(pSpriteObjects[j].vPosition) < pLevelDecorations[event_triggers[i]].uTriggerRange)
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
65 EventProcessor(pLevelDecorations[event_triggers[i]].uEventID, 0, 1);
0
Ritor1
parents:
diff changeset
66 }
Ritor1
parents:
diff changeset
67 }
Ritor1
parents:
diff changeset
68 }
Ritor1
parents:
diff changeset
69 }
Ritor1
parents:
diff changeset
70 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8;
Ritor1
parents:
diff changeset
71
Ritor1
parents:
diff changeset
72 //----- (0046DEF2) --------------------------------------------------------
Ritor1
parents:
diff changeset
73 unsigned int __fastcall sub_46DEF2(signed int a2, unsigned int uLayingItemID)
Ritor1
parents:
diff changeset
74 {
Ritor1
parents:
diff changeset
75 unsigned int result; // eax@1
Ritor1
parents:
diff changeset
76
Ritor1
parents:
diff changeset
77 result = uLayingItemID;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
78 if ( pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID].uFlags & 0x10 )
0
Ritor1
parents:
diff changeset
79 result = _46BFFA_check_object_intercept(uLayingItemID, a2);
Ritor1
parents:
diff changeset
80 return result;
Ritor1
parents:
diff changeset
81 }
Ritor1
parents:
diff changeset
82
Ritor1
parents:
diff changeset
83 //----- (0046E0B2) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1453
diff changeset
84 void _46E0B2_collide_against_decorations()
0
Ritor1
parents:
diff changeset
85 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
86 BLVSector *sector; // ebp@1
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
87 LevelDecoration *decor; // edi@2
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
88 DecorationDesc *decor_desc; // esi@3
0
Ritor1
parents:
diff changeset
89 int v8; // ebx@10
Ritor1
parents:
diff changeset
90 int v9; // esi@11
Ritor1
parents:
diff changeset
91 int v11; // eax@12
Ritor1
parents:
diff changeset
92 int v12; // esi@14
Ritor1
parents:
diff changeset
93 unsigned int v13; // eax@17
Ritor1
parents:
diff changeset
94 signed int i; // [sp+4h] [bp-14h]@1
Ritor1
parents:
diff changeset
95 int v15; // [sp+8h] [bp-10h]@10
Ritor1
parents:
diff changeset
96 int v16; // [sp+Ch] [bp-Ch]@10
Ritor1
parents:
diff changeset
97 int v17; // [sp+10h] [bp-8h]@10
Ritor1
parents:
diff changeset
98
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
99 sector = &pIndoor->pSectors[stru_721530.uSectorID];
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
100 for ( i = 0; i < sector->uNumDecorations; ++i )
0
Ritor1
parents:
diff changeset
101 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
102 decor = &pLevelDecorations[sector->pDecorationIDs[i]];
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
103 if (!(decor->uFlags & LEVEL_DECORATION_INVISIBLE))
0
Ritor1
parents:
diff changeset
104 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
105 decor_desc = &pDecorationList->pDecorations[decor->uDecorationDescID];
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
106 if (!decor_desc->CanMoveThrough())
0
Ritor1
parents:
diff changeset
107 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
108 if ( stru_721530.sMaxX <= decor->vPosition.x + decor_desc->uRadius && stru_721530.sMinX >= decor->vPosition.x - decor_desc->uRadius
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
109 && stru_721530.sMaxY <= decor->vPosition.y + decor_desc->uRadius && stru_721530.sMinY >= decor->vPosition.y - decor_desc->uRadius
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
110 && stru_721530.sMaxZ <= decor->vPosition.z + decor_desc->uDecorationHeight && stru_721530.sMinZ >= decor->vPosition.z )
0
Ritor1
parents:
diff changeset
111 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
112 v16 = decor->vPosition.x - stru_721530.normal.x;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
113 v15 = decor->vPosition.y - stru_721530.normal.y;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
114 v8 = stru_721530.prolly_normal_d + decor_desc->uRadius;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
115 v17 = ((decor->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
116 - (decor->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
117 if ( abs(v17) <= stru_721530.prolly_normal_d + decor_desc->uRadius )
0
Ritor1
parents:
diff changeset
118 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
119 v9 = (v16 * stru_721530.direction.x + v15 * stru_721530.direction.y) >> 16;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
120 if ( v9 > 0 )
0
Ritor1
parents:
diff changeset
121 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
122 v11 = stru_721530.normal.z + fixpoint_mul(stru_721530.direction.z, v9);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
123 if ( v11 >= decor->vPosition.z )
0
Ritor1
parents:
diff changeset
124 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
125 if ( v11 <= decor_desc->uDecorationHeight + decor->vPosition.z )
0
Ritor1
parents:
diff changeset
126 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
127 v12 = v9 - integer_sqrt(v8 * v8 - v17 * v17);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
128 if ( v12 < 0 )
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
129 v12 = 0;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
130 if ( v12 < stru_721530.field_7C )
0
Ritor1
parents:
diff changeset
131 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
132 stru_721530.field_7C = v12;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
133 v13 = 8 * sector->pDecorationIDs[i];
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
134 LOBYTE(v13) = v13 | 5;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
135 stru_721530.uFaceID = v13;
0
Ritor1
parents:
diff changeset
136 }
Ritor1
parents:
diff changeset
137 }
Ritor1
parents:
diff changeset
138 }
Ritor1
parents:
diff changeset
139 }
Ritor1
parents:
diff changeset
140 }
Ritor1
parents:
diff changeset
141 }
Ritor1
parents:
diff changeset
142 }
Ritor1
parents:
diff changeset
143 }
Ritor1
parents:
diff changeset
144 }
Ritor1
parents:
diff changeset
145 }
Ritor1
parents:
diff changeset
146
Ritor1
parents:
diff changeset
147 //----- (00487DA9) --------------------------------------------------------
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1567
diff changeset
148 void sub_487DA9()
0
Ritor1
parents:
diff changeset
149 {
1413
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1411
diff changeset
150 for (int i = 0; i < 20000; ++i)
3881d2f94eb1 UseNPCSkill
Nomad
parents: 1411
diff changeset
151 array_77EC08[i].field_108 = 0;
0
Ritor1
parents:
diff changeset
152 }
Ritor1
parents:
diff changeset
153
Ritor1
parents:
diff changeset
154 //----- (0048A959) --------------------------------------------------------
2006
30c2b575d25c signed fixes
zipi
parents: 1980
diff changeset
155 signed int ReplaceHSV(unsigned int uColor, float h_replace, float s_replace, float v_replace)
0
Ritor1
parents:
diff changeset
156 {
Ritor1
parents:
diff changeset
157 float r = ((uColor & 0x00FF0000) >> 16) / 255.0f,
Ritor1
parents:
diff changeset
158 g = ((uColor & 0x0000FF00) >> 8) / 255.0f,
Ritor1
parents:
diff changeset
159 b = (uColor & 0x000000FF) / 255.0f;
Ritor1
parents:
diff changeset
160
Ritor1
parents:
diff changeset
161 float h, s, v;
Ritor1
parents:
diff changeset
162 RGB2HSV(&h, &s, r, g, b, &v);
Ritor1
parents:
diff changeset
163
Ritor1
parents:
diff changeset
164 if ( h_replace != -1.0 )
Ritor1
parents:
diff changeset
165 h = h_replace;
Ritor1
parents:
diff changeset
166 if ( s_replace != -1.0 )
Ritor1
parents:
diff changeset
167 s = s_replace;
Ritor1
parents:
diff changeset
168 if ( v_replace != -1.0 )
Ritor1
parents:
diff changeset
169 v = v_replace;
Ritor1
parents:
diff changeset
170 HSV2RGB(&r, &g, &b, h, s, v);
Ritor1
parents:
diff changeset
171
2125
ba3de1337989 house animations working
zipi
parents: 2118
diff changeset
172 return (((uint)round_to_int(r * 255.0f) & 0xFF) << 16) |
ba3de1337989 house animations working
zipi
parents: 2118
diff changeset
173 (((uint)round_to_int(g * 255.0f) & 0xFF) << 8) |
ba3de1337989 house animations working
zipi
parents: 2118
diff changeset
174 (((uint)round_to_int(b * 255.0f) & 0xFF));
0
Ritor1
parents:
diff changeset
175 }
Ritor1
parents:
diff changeset
176
Ritor1
parents:
diff changeset
177 //----- (0048B561) --------------------------------------------------------
1029
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
178 int fixpoint_from_float(float val)
0
Ritor1
parents:
diff changeset
179 {
1029
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
180 // float X.Yf -> int XXXX YYYY
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
181 int left = floorf((val - 0.5f) + 0.5f);
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
182 int right = floorf((val - left) * 65536.0f);
c94d6a37d298 Pointing a face with mouse fixed.
Nomad
parents: 1026
diff changeset
183 return (left << 16) | right;
0
Ritor1
parents:
diff changeset
184 }
Ritor1
parents:
diff changeset
185
1640
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
186 int fixpoint_from_int(int lhv, int rhv)
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
187 {
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
188 return (lhv << 16) | rhv;
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
189 }
afc1c3514dd5 Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents: 1638
diff changeset
190
0
Ritor1
parents:
diff changeset
191 //----- (00491E3A) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
192 void sub_491E3A()
0
Ritor1
parents:
diff changeset
193 {
Ritor1
parents:
diff changeset
194 signed int v1; // esi@3
Ritor1
parents:
diff changeset
195 unsigned int v3; // eax@7
Ritor1
parents:
diff changeset
196 unsigned int v4; // edx@8
Ritor1
parents:
diff changeset
197 int v6; // edi@17
Ritor1
parents:
diff changeset
198 int v12; // eax@26
Ritor1
parents:
diff changeset
199
2163
9aa0a5d90454 fall_speed
Ritor1
parents: 2155
diff changeset
200 //__debugbreak();//Ritor1
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
201 for ( uint pl = 0; pl < 4; pl++ )
0
Ritor1
parents:
diff changeset
202 {
203
0c64754c7fd4 Voices work (at least in party creation screen)
Nomad
parents: 198
diff changeset
203 if (SoundSetAction[24][0])
0
Ritor1
parents:
diff changeset
204 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
205 v3 = 0;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
206 for ( v1 = 0; v1 < (signed int)pSoundList->sNumSounds; ++v1 )
0
Ritor1
parents:
diff changeset
207 {
2163
9aa0a5d90454 fall_speed
Ritor1
parents: 2155
diff changeset
208 int ps = 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[pl].uVoiceID) + 4998;//6728
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
209 if ( pSoundList->pSL_Sounds[v1].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[pl].uVoiceID) + 4998 )
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
210 v3 = v1;
0
Ritor1
parents:
diff changeset
211 }
764
90bcfb56c8f9 sound cleaning
Gloval
parents: 761
diff changeset
212 pSoundList->UnloadSound(v3, 1);
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
213 for ( v4 = 0; (signed int)v4 < (signed int)pSoundList->sNumSounds; ++v4 )
0
Ritor1
parents:
diff changeset
214 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
215 if ( pSoundList->pSL_Sounds[v4].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[pl].uVoiceID) + 4999 )
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
216 pSoundList->UnloadSound(v4, 1);
0
Ritor1
parents:
diff changeset
217 }
Ritor1
parents:
diff changeset
218 }
Ritor1
parents:
diff changeset
219 }
Ritor1
parents:
diff changeset
220 v6 = pIcons_LOD->uNumLoadedFiles - 1;
33
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
221 if ( v6 >= pIcons_LOD->pFacesLock )
0
Ritor1
parents:
diff changeset
222 {
Ritor1
parents:
diff changeset
223 do
Ritor1
parents:
diff changeset
224 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
225 pIcons_LOD->pTextures[v6].Release();
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
226 if ( pIcons_LOD->pHardwareTextures )
0
Ritor1
parents:
diff changeset
227 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
228 if ( pIcons_LOD->pHardwareTextures[v6] )
0
Ritor1
parents:
diff changeset
229 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
230 pIcons_LOD->pHardwareTextures[v6]->Release();
0
Ritor1
parents:
diff changeset
231 pIcons_LOD->pHardwareTextures[v6] = 0;
Ritor1
parents:
diff changeset
232 }
Ritor1
parents:
diff changeset
233 }
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
234 if ( pIcons_LOD->pHardwareSurfaces )
0
Ritor1
parents:
diff changeset
235 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
236 if ( pIcons_LOD->pHardwareSurfaces[v6] )
0
Ritor1
parents:
diff changeset
237 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
238 pIcons_LOD->pHardwareSurfaces[v6]->Release();
0
Ritor1
parents:
diff changeset
239 pIcons_LOD->pHardwareSurfaces[v6] = 0;
Ritor1
parents:
diff changeset
240 }
Ritor1
parents:
diff changeset
241 }
Ritor1
parents:
diff changeset
242 --v6;
Ritor1
parents:
diff changeset
243 }
33
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
244 while ( v6 >= pIcons_LOD->pFacesLock );
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
245 }
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
246 v12 = pIcons_LOD->pFacesLock;
a9e9c6989d04 20.01.13
Ritor1
parents: 8
diff changeset
247 pIcons_LOD->pFacesLock = 0;
0
Ritor1
parents:
diff changeset
248 pIcons_LOD->uNumLoadedFiles = v12;
Ritor1
parents:
diff changeset
249 }
Ritor1
parents:
diff changeset
250 // 4ED498: using guessed type char byte_4ED498;
Ritor1
parents:
diff changeset
251
Ritor1
parents:
diff changeset
252 //----- (00493938) --------------------------------------------------------
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
253 void _493938_regenerate()
0
Ritor1
parents:
diff changeset
254 {
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
255 int current_time; // edi@1
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
256 int last_reg_time; // qax@1
0
Ritor1
parents:
diff changeset
257 int v4; // eax@2
Ritor1
parents:
diff changeset
258 int v5; // edi@5
2030
47ab41698f9d sudden drop in flight fix
Ritor1
parents: 2023
diff changeset
259 bool cursed_flag; // ecx@5
0
Ritor1
parents:
diff changeset
260 char v7; // sf@5
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
261 int *v8; // ecx@10
0
Ritor1
parents:
diff changeset
262 int v9; // edi@15
Ritor1
parents:
diff changeset
263 signed int v10; // eax@15
Ritor1
parents:
diff changeset
264 __int16 *v11; // edx@16
Ritor1
parents:
diff changeset
265 int v12; // eax@20
Ritor1
parents:
diff changeset
266 int v13; // ebx@20
Ritor1
parents:
diff changeset
267 unsigned int *v14; // esi@21
Ritor1
parents:
diff changeset
268 unsigned int v15; // ecx@21
Ritor1
parents:
diff changeset
269 unsigned int v16; // eax@21
Ritor1
parents:
diff changeset
270 int v18; // eax@21
Ritor1
parents:
diff changeset
271 signed int v19; // eax@21
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
272 bool recovery_HP; // ebx@25
0
Ritor1
parents:
diff changeset
273 ITEM_EQUIP_TYPE v22; // edi@30
Ritor1
parents:
diff changeset
274 signed int v25; // eax@33
Ritor1
parents:
diff changeset
275 int v26; // eax@35
Ritor1
parents:
diff changeset
276 int v27; // eax@36
Ritor1
parents:
diff changeset
277 int v28; // eax@37
Ritor1
parents:
diff changeset
278 signed int v31; // ecx@53
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
279 int v41[100]; // [sp+4h] [bp-22Ch]@20
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
280 SpriteObject a1; // [sp+194h] [bp-9Ch]@15
0
Ritor1
parents:
diff changeset
281 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
282 bool has_dragon_flag; // [sp+210h] [bp-20h]@22
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
283 bool lich_jar_flag; // [sp+214h] [bp-1Ch]@25
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
284 bool zombie_flag; // [sp+218h] [bp-18h]@25
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
285 bool decrease_HP; // [sp+21Ch] [bp-14h]@25
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
286 bool lich_flag; // [sp+220h] [bp-10h]@25
0
Ritor1
parents:
diff changeset
287 int v49; // [sp+224h] [bp-Ch]@24
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
288 bool recovery_SP; // [sp+228h] [bp-8h]@25
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
289 bool redraw_flag; // [sp+22Ch] [bp-4h]@2
0
Ritor1
parents:
diff changeset
290
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
291 current_time = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
292 last_reg_time = (signed int)(signed __int64)((double)pParty->uLastRegenerationTime * 0.234375) / 60;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
293 if ( current_time >= (signed int)last_reg_time + 5 )
0
Ritor1
parents:
diff changeset
294 {
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
295 redraw_flag = false;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
296 v4 = (current_time - last_reg_time) / 5;
0
Ritor1
parents:
diff changeset
297 if (pParty->FlyActive())
Ritor1
parents:
diff changeset
298 {
Ritor1
parents:
diff changeset
299 if ( pParty->bFlying )
Ritor1
parents:
diff changeset
300 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
301 if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) )
2030
47ab41698f9d sudden drop in flight fix
Ritor1
parents: 2023
diff changeset
302 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
303 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower;
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
304 cursed_flag = pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].pConditions[Condition_Cursed];//cursed
2030
47ab41698f9d sudden drop in flight fix
Ritor1
parents: 2023
diff changeset
305 v7 = cursed_flag < v5;
47ab41698f9d sudden drop in flight fix
Ritor1
parents: 2023
diff changeset
306 //cursed_flag -= v5;
47ab41698f9d sudden drop in flight fix
Ritor1
parents: 2023
diff changeset
307 if ( !v7 )
0
Ritor1
parents:
diff changeset
308 {
Ritor1
parents:
diff changeset
309 pParty->uFlags &= 0xFFFFFFBFu;
2030
47ab41698f9d sudden drop in flight fix
Ritor1
parents: 2023
diff changeset
310 pParty->bFlying = false;
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
311 redraw_flag = true;
0
Ritor1
parents:
diff changeset
312 }
Ritor1
parents:
diff changeset
313 }
Ritor1
parents:
diff changeset
314 }
Ritor1
parents:
diff changeset
315 }
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
316
0
Ritor1
parents:
diff changeset
317 if (pParty->WaterWalkActive())
Ritor1
parents:
diff changeset
318 {
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
319 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
320 {
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
321 if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) )
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
322 { // taking on water
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2182
diff changeset
323 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].pConditions[Condition_Cursed];//&AA1058_PartyQuickSpellSound[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 2000];
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
324 v7 = *v8 < v4;
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
325 *v8 -= v4;
0
Ritor1
parents:
diff changeset
326 if ( v7 )
Ritor1
parents:
diff changeset
327 {
112
909822c91d47 pointer fixes
zipi
parents: 102
diff changeset
328 *v8 = 0;
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
329 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
330 redraw_flag = true;
0
Ritor1
parents:
diff changeset
331 }
Ritor1
parents:
diff changeset
332 }
Ritor1
parents:
diff changeset
333 }
Ritor1
parents:
diff changeset
334 }
569
f451efdb7c8b * Party buff icons drawing (right panel)
Nomad
parents: 566
diff changeset
335
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
336 if (pParty->ImmolationActive())//Æåðòâà
0
Ritor1
parents:
diff changeset
337 {
Ritor1
parents:
diff changeset
338 a3.z = 0;
Ritor1
parents:
diff changeset
339 a3.y = 0;
Ritor1
parents:
diff changeset
340 a3.x = 0;
Ritor1
parents:
diff changeset
341 a1.stru_24.Reset();
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
342 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower;
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
343 a1.spell_skill = pParty->ImmolationSkillLevel();
0
Ritor1
parents:
diff changeset
344 v10 = 0;
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 510
diff changeset
345 a1.uType = 1070;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
346 a1.spell_id = SPELL_FIRE_IMMOLATION;
0
Ritor1
parents:
diff changeset
347 if ( (signed int)pObjectList->uNumObjects <= 0 )
Ritor1
parents:
diff changeset
348 {
Ritor1
parents:
diff changeset
349 LABEL_19:
Ritor1
parents:
diff changeset
350 LOWORD(v10) = 0;
Ritor1
parents:
diff changeset
351 }
Ritor1
parents:
diff changeset
352 else
Ritor1
parents:
diff changeset
353 {
Ritor1
parents:
diff changeset
354 v11 = &pObjectList->pObjects->uObjectID;
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 917
diff changeset
355 while ( stru_4E3ACC[8].uType != *v11 )
0
Ritor1
parents:
diff changeset
356 {
Ritor1
parents:
diff changeset
357 ++v10;
Ritor1
parents:
diff changeset
358 v11 += 28;
Ritor1
parents:
diff changeset
359 if ( v10 >= (signed int)pObjectList->uNumObjects )
Ritor1
parents:
diff changeset
360 goto LABEL_19;
Ritor1
parents:
diff changeset
361 }
Ritor1
parents:
diff changeset
362 }
Ritor1
parents:
diff changeset
363 a1.uObjectDescID = v10;
Ritor1
parents:
diff changeset
364 a1.field_60_distance_related_prolly_lod = 0;
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
365 v12 = 8 * pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster;
303
3dcc9d945eeb DamageMonsterFromParty
Nomad
parents: 296
diff changeset
366 LOBYTE(v12) = v12 | OBJECT_Player;
0
Ritor1
parents:
diff changeset
367 a1.uAttributes = 0;
Ritor1
parents:
diff changeset
368 a1.uSectorID = 0;
Ritor1
parents:
diff changeset
369 a1.uSpriteFrameID = 0;
822
c232f160e6f3 Named SpriteObject spell-related fields.
Nomad
parents: 819
diff changeset
370 a1.spell_caster_pid = v12;
0
Ritor1
parents:
diff changeset
371 a1.uFacing = 0;
Ritor1
parents:
diff changeset
372 a1.uSoundID = 0;
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
373 v13 = _46A89E_immolation_effect((int)v41, 100, 307);
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
374 for ( v9 = 0; v9 < v13; ++v9 )
0
Ritor1
parents:
diff changeset
375 {
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
376 v14 = (unsigned int *)&v41[v9];
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
377 v15 = *v14;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
378 v16 = *v14;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
379 a1.vPosition.x = pActors[v16].vPosition.x;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
380 a1.vPosition.y = pActors[v16].vPosition.y;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
381 a1.vPosition.z = pActors[v16].vPosition.z;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
382 v18 = 8 * v15;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
383 LOBYTE(v18) = PID(OBJECT_Actor,v15);
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
384 a1.spell_target_pid = v18;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
385 v19 = a1.Create(0, 0, 0, 0);
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
386 DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3);
0
Ritor1
parents:
diff changeset
387 }
Ritor1
parents:
diff changeset
388 }
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
389
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
390 has_dragon_flag = false;
248
37dcbe8f3cca Dialogue stuff
Nomad
parents: 232
diff changeset
391 if (PartyHasDragon())
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
392 has_dragon_flag = true;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
393
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
394 for ( v49 = 0; v49 < 4; v49++ )
0
Ritor1
parents:
diff changeset
395 {
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
396 recovery_HP = false;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
397 recovery_SP = false;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
398 decrease_HP = false;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
399 lich_flag = false;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
400 lich_jar_flag = false;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
401 zombie_flag = false;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
402
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
403 for ( int v22 = 0; (signed int)v22 < 16; v22++ )
0
Ritor1
parents:
diff changeset
404 {
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
405 if ( pParty->pPlayers[v49].HasItemEquipped((ITEM_EQUIP_TYPE)v22) )
0
Ritor1
parents:
diff changeset
406 {
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
407 uint _idx = pParty->pPlayers[v49].pEquipment.pIndices[v22];
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
408 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID > 134 )
2030
47ab41698f9d sudden drop in flight fix
Ritor1
parents: 2023
diff changeset
409 {
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
410 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_RELIC_ETHRICS_STAFF )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
411 decrease_HP = true;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
412 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_HERMES_SANDALS )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
413 {
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
414 recovery_HP = true;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
415 recovery_SP = true;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
416 }
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
417 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_MINDS_EYE )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
418 recovery_SP = true;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
419 if ( pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_HEROS_BELT )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
420 recovery_HP = true;
0
Ritor1
parents:
diff changeset
421 }
Ritor1
parents:
diff changeset
422 else
Ritor1
parents:
diff changeset
423 {
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
424 v25 = pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uSpecEnchantmentType;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
425 if ( v25 == 37 //of Regeneration("Regenerate 1hp/x while walking, etc")
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
426 || v25 == 44 //of Life("HP (+10), Regen hpts")
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
427 || v25 == 50 //of The Phoenix("Fire Res (+30), Regen hpts") &&
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
428 || v25 == 54 )// of The Troll("End (+15), Regen hpts")
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
429 recovery_HP = true;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
430 if ( v25 == 38 //of Mana("Regenerate 1sp/x while walking, etc")
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
431 || v25 == 47 //of The Eclipse("SP (+10), Regen spts")
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
432 || v25 == 55 )//of The Unicorn("Luck (+15), Regen spts")
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
433 recovery_SP = true;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
434 if ( v25 == 66 )// of Plenty("Regenerate 1 hp/x and 1 sp/x while walking, etc.")
2030
47ab41698f9d sudden drop in flight fix
Ritor1
parents: 2023
diff changeset
435 {
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
436 recovery_HP = true;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
437 recovery_SP = true;
2030
47ab41698f9d sudden drop in flight fix
Ritor1
parents: 2023
diff changeset
438 }
0
Ritor1
parents:
diff changeset
439 }
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
440
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
441 if (recovery_HP &&
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
442 !pParty->pPlayers[v49].pConditions[Condition_Dead] &&
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
443 !pParty->pPlayers[v49].pConditions[Condition_Eradicated])
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
444 {
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
445 if ( pParty->pPlayers[v49].sHealth < pParty->pPlayers[v49].GetMaxHealth() )
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
446 ++pParty->pPlayers[v49].sHealth;
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
447 if ( pParty->pPlayers[v49].pConditions[Condition_Unconcious] && pParty->pPlayers[v49].sHealth > 0 )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
448 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = 0;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
449 redraw_flag = true;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
450 }
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
451
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
452 if (recovery_SP &&
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
453 !pParty->pPlayers[v49].pConditions[Condition_Dead] &&
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
454 !pParty->pPlayers[v49].pConditions[Condition_Eradicated])
0
Ritor1
parents:
diff changeset
455 {
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
456 if ( pParty->pPlayers[v49].sMana < pParty->pPlayers[v49].GetMaxMana() )
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
457 ++pParty->pPlayers[v49].sMana;
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
458 redraw_flag = true;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
459 }
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
460
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
461 if (decrease_HP &&
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
462 !pParty->pPlayers[v49].pConditions[Condition_Dead] &&
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
463 !pParty->pPlayers[v49].pConditions[Condition_Eradicated] )
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
464 {
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
465 --pParty->pPlayers[v49].sHealth;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
466 if ( !(pParty->pPlayers[v49].pConditions[Condition_Unconcious]) && pParty->pPlayers[v49].sHealth < 0 )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
467 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = pParty->uTimePlayed;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
468 if ( pParty->pPlayers[v49].sHealth < 1 )
0
Ritor1
parents:
diff changeset
469 {
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
470 if ( pParty->pPlayers[v49].sHealth + pParty->pPlayers[v49].uEndurance + pParty->pPlayers[v49].GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) >= 1
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
471 || (signed __int64)pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
472 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = pParty->uTimePlayed;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
473 else
0
Ritor1
parents:
diff changeset
474 {
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
475 if ( !pParty->pPlayers[v49].pConditions[Condition_Dead] )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
476 pParty->pPlayers[v49].pConditions[Condition_Dead] = pParty->uTimePlayed;
0
Ritor1
parents:
diff changeset
477 }
Ritor1
parents:
diff changeset
478 }
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
479 redraw_flag = true;
0
Ritor1
parents:
diff changeset
480 }
Ritor1
parents:
diff changeset
481 }
Ritor1
parents:
diff changeset
482 }
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
483
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
484 //regeneration
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
485 if ( pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_REGENERATION].uExpireTime > 0
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
486 && !pParty->pPlayers[v49].pConditions[Condition_Dead]
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
487 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated] )
0
Ritor1
parents:
diff changeset
488 {
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
489 pParty->pPlayers[v49].sHealth += 5 * pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_REGENERATION].uPower;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
490 if ( pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth() )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
491 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].GetMaxHealth();
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
492 if ( pParty->pPlayers[v49].pConditions[Condition_Unconcious] && pParty->pPlayers[v49].sHealth > 0 )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
493 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = 0;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
494 redraw_flag = true;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
495 }
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
496
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
497 //for warlock
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
498 if ( has_dragon_flag && pParty->pPlayers[v49].classType == PLAYER_CLASS_WARLOCK )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
499 {
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
500 if ( pParty->pPlayers[v49].sMana < pParty->pPlayers[v49].GetMaxMana() )
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
501 ++pParty->pPlayers[v49].sMana;
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
502 redraw_flag = true;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
503 }
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
504
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
505 //for lich
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
506 if ( pParty->pPlayers[v49].classType == PLAYER_CLASS_LICH )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
507 {
2085
52abdea20b9e Door_switch_animation
Ritor1
parents: 2065
diff changeset
508 for ( v31 = 0; v31 < 126; ++v31 )
0
Ritor1
parents:
diff changeset
509 {
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
510 if ( pParty->pPlayers[v49].pInventoryItemList[v31].uItemID == ITEM_LICH_JAR_FULL )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
511 lich_jar_flag = true;
0
Ritor1
parents:
diff changeset
512 }
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
513 lich_flag = true;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
514 }
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
515 if ( lich_flag && !pParty->pPlayers[v49].pConditions[Condition_Dead]
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
516 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated] )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
517 {
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
518 if ( pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth() / 2 )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
519 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].sHealth - 2;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
520 if ( pParty->pPlayers[v49].sMana > pParty->pPlayers[v49].GetMaxMana() / 2 )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
521 pParty->pPlayers[v49].sMana = pParty->pPlayers[v49].sMana - 2;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
522 }
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
523 if ( lich_jar_flag )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
524 {
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
525 if ( pParty->pPlayers[v49].sMana < pParty->pPlayers[v49].GetMaxMana() )
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
526 ++pParty->pPlayers[v49].sMana;
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
527 }
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
528
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
529 //for zombie
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
530 if ( pParty->pPlayers[v49].pConditions[Condition_Zombie] )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
531 zombie_flag = true;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
532 if ( zombie_flag && !pParty->pPlayers[v49].pConditions[Condition_Dead]
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
533 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated] )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
534 {
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
535 if ( pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth() / 2 )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
536 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].sHealth - 1;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
537 if ( pParty->pPlayers[v49].sMana > 0 )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
538 pParty->pPlayers[v49].sMana = pParty->pPlayers[v49].sMana - 1;
0
Ritor1
parents:
diff changeset
539 }
Ritor1
parents:
diff changeset
540 }
2060
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
541 pParty->uLastRegenerationTime = pParty->uTimePlayed;
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
542 if ( !viewparams->bRedrawGameUI )
72177f3603da _493938_regenerate()
Ritor1
parents: 2059
diff changeset
543 viewparams->bRedrawGameUI = redraw_flag;
0
Ritor1
parents:
diff changeset
544 }
Ritor1
parents:
diff changeset
545 }
Ritor1
parents:
diff changeset
546
Ritor1
parents:
diff changeset
547 //----- (00493F79) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
548 void init_summoned_item(stru351_summoned_item *_this, __int64 duration)
0
Ritor1
parents:
diff changeset
549 {
Ritor1
parents:
diff changeset
550 signed __int64 v2; // ST2C_8@1
Ritor1
parents:
diff changeset
551 signed __int64 v3; // qax@1
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
552 //signed __int64 v4; // ST1C_8@1
0
Ritor1
parents:
diff changeset
553 unsigned __int64 v5; // qax@1
Ritor1
parents:
diff changeset
554 unsigned int v6; // ebx@1
Ritor1
parents:
diff changeset
555
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
556 v2 = (signed __int64)((double)duration * 0.234375);
0
Ritor1
parents:
diff changeset
557 v3 = v2 / 60 / 60;
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
558 //v4 = v3;
0
Ritor1
parents:
diff changeset
559 v5 = (unsigned int)v3 / 0x18;
Ritor1
parents:
diff changeset
560 v6 = (unsigned int)(v5 / 7) >> 2;
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
561 _this->field_0_expire_second = v2 % 60;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
562 _this->field_4_expire_minute = v2 / 60 % 60;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
563 _this->field_8_expire_hour = v3 % 24;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
564 _this->field_10_expire_week = v5 / 7 & 3;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
565 _this->field_C_expire_day = (unsigned int)v5 % 0x1C;
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
566 _this->field_14_exprie_month = v6 % 0xC;
352
ec6cc5cefa4b Game starting age (1168) moved to a variable
Nomad
parents: 351
diff changeset
567 _this->field_18_expire_year = v6 / 0xC + game_starting_year;
0
Ritor1
parents:
diff changeset
568 }
Ritor1
parents:
diff changeset
569
Ritor1
parents:
diff changeset
570 //----- (00494035) --------------------------------------------------------
1031
f93d17337113 UI stuff.
Nomad
parents: 1029
diff changeset
571 void _494035_timed_effects__water_walking_damage__etc()
0
Ritor1
parents:
diff changeset
572 {
Ritor1
parents:
diff changeset
573 signed __int64 v0; // qax@1
Ritor1
parents:
diff changeset
574 unsigned int v4; // edi@1
Ritor1
parents:
diff changeset
575 signed int v12; // edi@29
Ritor1
parents:
diff changeset
576 int v24; // ecx@60
Ritor1
parents:
diff changeset
577 int v26; // ecx@64
Ritor1
parents:
diff changeset
578 int v28; // ecx@68
Ritor1
parents:
diff changeset
579 int v30; // ecx@72
Ritor1
parents:
diff changeset
580 int v32; // ecx@76
Ritor1
parents:
diff changeset
581 int v34; // ecx@80
Ritor1
parents:
diff changeset
582 int v36; // ecx@84
Ritor1
parents:
diff changeset
583 int v38; // ecx@88
Ritor1
parents:
diff changeset
584 int v40; // ecx@92
Ritor1
parents:
diff changeset
585 int v42; // ecx@96
Ritor1
parents:
diff changeset
586 bool v43; // ebx@102
Ritor1
parents:
diff changeset
587 bool v46; // edi@111
Ritor1
parents:
diff changeset
588 unsigned int v56; // [sp-8h] [bp-38h]@55
Ritor1
parents:
diff changeset
589 int v59; // [sp-4h] [bp-34h]@55
Ritor1
parents:
diff changeset
590 unsigned int v61; // [sp+14h] [bp-1Ch]@1
Ritor1
parents:
diff changeset
591 signed int a2a; // [sp+18h] [bp-18h]@47
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
592 signed int old_day; // [sp+1Ch] [bp-14h]@47
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
593 signed int old_hour;
0
Ritor1
parents:
diff changeset
594
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
595 old_day = pParty->uDaysPlayed;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
596 old_hour = pParty->uCurrentHour;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
597 //auto prev_time = pEventTimer->uTimeElapsed;
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
598 pParty->uTimePlayed += pEventTimer->uTimeElapsed;
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
599 v0 = ((signed __int64)(pParty->uTimePlayed * 0.234375) / 60)/60i64;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
600 v4 = (unsigned int)(((unsigned int)v0 / 24) / 7) >> 2;
0
Ritor1
parents:
diff changeset
601 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60;
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
602 pParty->uCurrentMinute = ((signed __int64)(pParty->uTimePlayed * 0.234375) / 60) % 60;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
603 pParty->uCurrentHour = v0 % 24;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
604 pParty->uCurrentMonthWeek = ((unsigned int)v0 / 24) / 7 & 3;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
605 pParty->uDaysPlayed = (unsigned int)((unsigned int)v0 / 24) % 28;
0
Ritor1
parents:
diff changeset
606 pParty->uCurrentMonth = v4 % 12;
352
ec6cc5cefa4b Game starting age (1168) moved to a variable
Nomad
parents: 351
diff changeset
607 pParty->uCurrentYear = v4 / 0xC + game_starting_year;
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
608 if ( pParty->uCurrentHour >= 3 && (old_hour < 3 || pParty->uDaysPlayed > old_day) ) // new day dawns
0
Ritor1
parents:
diff changeset
609 {
Ritor1
parents:
diff changeset
610 pParty->pHirelings[0].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
611 pParty->pHirelings[1].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
612
Ritor1
parents:
diff changeset
613 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
Ritor1
parents:
diff changeset
614 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false;
Ritor1
parents:
diff changeset
615
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
616 ++pParty->days_played_without_rest;
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
617 if (pParty->days_played_without_rest > 1)
0
Ritor1
parents:
diff changeset
618 {
Ritor1
parents:
diff changeset
619 for (uint i = 0; i < 4; ++i)
1361
b3ac17fd12de Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents: 1358
diff changeset
620 pParty->pPlayers[i].SetCondWeakWithBlockCheck(0);
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
621
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
622 if (pParty->uNumFoodRations)
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
623 Party::TakeFood(1);
0
Ritor1
parents:
diff changeset
624 else
Ritor1
parents:
diff changeset
625 for (uint i = 0; i < 4; ++i)
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
626 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1;
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
627
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
628 if (pParty->days_played_without_rest > 3)
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
629 for ( uint i = 0; i < 4; ++i )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
630 {
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
631 pParty->pPlayers[i].Zero();
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
632 if (!pParty->pPlayers[i].IsPertified() && !pParty->pPlayers[i].IsEradicated()
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
633 && !pParty->pPlayers[i].IsDead())
0
Ritor1
parents:
diff changeset
634 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
635 if (rand() % 100 < 5 * pParty->days_played_without_rest)
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
636 pParty->pPlayers[i].SetCondDeadWithBlockCheck(0);
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
637 if (rand() % 100 < 10 * pParty->days_played_without_rest)
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
638 pParty->pPlayers[i].SetCondInsaneWithBlockCheck(0);
0
Ritor1
parents:
diff changeset
639 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
640 }
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
641 }
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
642 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
0
Ritor1
parents:
diff changeset
643 pOutdoor->SetFog();
Ritor1
parents:
diff changeset
644
Ritor1
parents:
diff changeset
645 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
646 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
Ritor1
parents:
diff changeset
647 }
766
a464d28566a6 days_played_without_rest
Nomad
parents: 763
diff changeset
648
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
649 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed )//water damage
0
Ritor1
parents:
diff changeset
650 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
651 pParty->field_6FC = (signed __int64)pParty->uTimePlayed + 128;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
652 viewparams->bRedrawGameUI = true;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
653 for ( uint pl = 1; pl <= 4; ++pl )
0
Ritor1
parents:
diff changeset
654 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
655 if ( pPlayers[pl]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR)
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
656 || pPlayers[pl]->HasEnchantedItemEquipped(71)
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
657 || pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_WATER_WALK].uExpireTime > 0 )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
658 pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_37, 0);
0
Ritor1
parents:
diff changeset
659 else
Ritor1
parents:
diff changeset
660 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
661 if ( !pPlayers[pl]->HasUnderwaterSuitEquipped() )
0
Ritor1
parents:
diff changeset
662 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
663 pPlayers[pl]->ReceiveDamage((signed __int64)pPlayers[pl]->GetMaxHealth() * 0.1, DMGT_FIRE);
0
Ritor1
parents:
diff changeset
664 if ( pParty->uFlags & 4 )
Ritor1
parents:
diff changeset
665 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
666 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]);// Âû òîíåòå!
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 775
diff changeset
667 GameUI_Footer_TimeLeft = 128;
0
Ritor1
parents:
diff changeset
668 }
Ritor1
parents:
diff changeset
669 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
670 else
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
671 pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_37, 0);
0
Ritor1
parents:
diff changeset
672 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
673 }
0
Ritor1
parents:
diff changeset
674 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
675 if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) //lava damage
0
Ritor1
parents:
diff changeset
676 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
677 viewparams->bRedrawGameUI = true;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
678 pParty->field_6FC = (signed __int64)pParty->uTimePlayed + 128;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
679
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
680 for ( uint pl = 1; pl <= 4; pl++ )
0
Ritor1
parents:
diff changeset
681 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
682 pPlayers[pl]->ReceiveDamage((signed __int64)pPlayers[pl]->GetMaxHealth() * 0.1, DMGT_FIRE);
0
Ritor1
parents:
diff changeset
683 if ( pParty->uFlags & 0x200 )
Ritor1
parents:
diff changeset
684 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
685 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]); //Âû ãîðèòå!
783
b27dd658ea77 Taveling by foot fixed.
Nomad
parents: 775
diff changeset
686 GameUI_Footer_TimeLeft = 128;
0
Ritor1
parents:
diff changeset
687 }
Ritor1
parents:
diff changeset
688 }
Ritor1
parents:
diff changeset
689 }
Ritor1
parents:
diff changeset
690 _493938_regenerate();
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
691 uint party_condition_flag = 4;
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
692 a2a = pEventTimer->uTimeElapsed;
2063
7890930801a8 small fix
Ritor1
parents: 2062
diff changeset
693 if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING )//çàìåäëåíèå âîññòàíîâëåíèÿ ïðè áåãå
816
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
694 {
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
695 a2a *= 0.5f;
cfc65feef029 * Player Recovery Times
Nomad
parents: 809
diff changeset
696 if (a2a < 1)
0
Ritor1
parents:
diff changeset
697 a2a = 1;
Ritor1
parents:
diff changeset
698 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
699
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
700 for ( uint pl = 1; pl <= 4; pl++ )
0
Ritor1
parents:
diff changeset
701 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
702 if ( pPlayers[pl]->uTimeToRecovery )
2063
7890930801a8 small fix
Ritor1
parents: 2062
diff changeset
703 pPlayers[pl]->Recover(a2a);//âîññòàíîâëåíèå àêòèâíîñòè
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
704 if ( pPlayers[pl]->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) + pPlayers[pl]->sHealth + pPlayers[pl]->uEndurance >= 1
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
705 || (signed __int64)pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 )
0
Ritor1
parents:
diff changeset
706 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
707 if ( pPlayers[pl]->sHealth < 1 )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
708 pPlayers[pl]->SetCondition(Condition_Unconcious, 0);
0
Ritor1
parents:
diff changeset
709 }
Ritor1
parents:
diff changeset
710 else
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
711 pPlayers[pl]->SetCondition(Condition_Dead, 0);
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
712 if ( pPlayers[pl]->field_E0 )
0
Ritor1
parents:
diff changeset
713 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
714 v24 = pPlayers[pl]->field_E0 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
715 if ( v24 > 0 )
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
716 pPlayers[pl]->field_E0 = v24;
0
Ritor1
parents:
diff changeset
717 else
Ritor1
parents:
diff changeset
718 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
719 pPlayers[pl]->field_E0 = 0;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
720 viewparams->bRedrawGameUI = true;
0
Ritor1
parents:
diff changeset
721 }
Ritor1
parents:
diff changeset
722 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
723 if ( pPlayers[pl]->field_E4 )
0
Ritor1
parents:
diff changeset
724 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
725 v26 = pPlayers[pl]->field_E4 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
726 if ( v26 > 0 )
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
727 pPlayers[pl]->field_E4 = v26;
0
Ritor1
parents:
diff changeset
728 else
Ritor1
parents:
diff changeset
729 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
730 pPlayers[pl]->field_E4 = 0;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
731 viewparams->bRedrawGameUI = true;
0
Ritor1
parents:
diff changeset
732 }
Ritor1
parents:
diff changeset
733 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
734 if ( pPlayers[pl]->field_E8 )
0
Ritor1
parents:
diff changeset
735 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
736 v28 = pPlayers[pl]->field_E8 - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
737 if ( v28 > 0 )
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
738 pPlayers[pl]->field_E8 = v28;
0
Ritor1
parents:
diff changeset
739 else
Ritor1
parents:
diff changeset
740 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
741 pPlayers[pl]->field_E8 = 0;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
742 viewparams->bRedrawGameUI = true;
0
Ritor1
parents:
diff changeset
743 }
Ritor1
parents:
diff changeset
744 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
745 if ( pPlayers[pl]->field_EC )
0
Ritor1
parents:
diff changeset
746 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
747 v30 = pPlayers[pl]->field_EC - pEventTimer->uTimeElapsed;
0
Ritor1
parents:
diff changeset
748 if ( v30 > 0 )
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
749 pPlayers[pl]->field_EC = v30;
0
Ritor1
parents:
diff changeset
750 else
Ritor1
parents:
diff changeset
751 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
752 pPlayers[pl]->field_EC = 0;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
753 viewparams->bRedrawGameUI = true;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
754 }
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
755 }
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
756 if ( pPlayers[pl]->field_F0 )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
757 {
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
758 v32 = pPlayers[pl]->field_F0 - pEventTimer->uTimeElapsed;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
759 if ( v32 > 0 )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
760 pPlayers[pl]->field_F0 = v32;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
761 else
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
762 {
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
763 pPlayers[pl]->field_F0 = 0;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
764 viewparams->bRedrawGameUI = true;
0
Ritor1
parents:
diff changeset
765 }
Ritor1
parents:
diff changeset
766 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
767 if ( pPlayers[pl]->field_F4 )
0
Ritor1
parents:
diff changeset
768 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
769 v34 = pPlayers[pl]->field_F4 - pEventTimer->uTimeElapsed;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
770 if ( v34 > 0 )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
771 pPlayers[pl]->field_F4 = v34;
0
Ritor1
parents:
diff changeset
772 else
Ritor1
parents:
diff changeset
773 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
774 pPlayers[pl]->field_F4 = 0;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
775 viewparams->bRedrawGameUI = true;
0
Ritor1
parents:
diff changeset
776 }
Ritor1
parents:
diff changeset
777 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
778 if ( pPlayers[pl]->field_F8 )
0
Ritor1
parents:
diff changeset
779 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
780 v36 = pPlayers[pl]->field_F8 - pEventTimer->uTimeElapsed;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
781 if ( v36 > 0 )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
782 pPlayers[pl]->field_F8 = v36;
0
Ritor1
parents:
diff changeset
783 else
Ritor1
parents:
diff changeset
784 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
785 pPlayers[pl]->field_F8 = 0;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
786 viewparams->bRedrawGameUI = true;
0
Ritor1
parents:
diff changeset
787 }
Ritor1
parents:
diff changeset
788 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
789 if ( pPlayers[pl]->field_FC )
0
Ritor1
parents:
diff changeset
790 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
791 v38 = pPlayers[pl]->field_FC - pEventTimer->uTimeElapsed;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
792 if ( v38 > 0 )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
793 pPlayers[pl]->field_FC = v38;
0
Ritor1
parents:
diff changeset
794 else
Ritor1
parents:
diff changeset
795 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
796 pPlayers[pl]->field_FC = 0;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
797 viewparams->bRedrawGameUI = true;
0
Ritor1
parents:
diff changeset
798 }
Ritor1
parents:
diff changeset
799 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
800 if ( pPlayers[pl]->field_100 )
0
Ritor1
parents:
diff changeset
801 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
802 v40 = pPlayers[pl]->field_100 - pEventTimer->uTimeElapsed;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
803 if ( v40 > 0 )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
804 pPlayers[pl]->field_100 = v40;
0
Ritor1
parents:
diff changeset
805 else
Ritor1
parents:
diff changeset
806 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
807 pPlayers[pl]->field_100 = 0;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
808 viewparams->bRedrawGameUI = true;
0
Ritor1
parents:
diff changeset
809 }
Ritor1
parents:
diff changeset
810 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
811 if ( pPlayers[pl]->field_104 )
0
Ritor1
parents:
diff changeset
812 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
813 v42 = pPlayers[pl]->field_104 - pEventTimer->uTimeElapsed;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
814 if ( v42 > 0 )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
815 pPlayers[pl]->field_104 = v42;
0
Ritor1
parents:
diff changeset
816 else
Ritor1
parents:
diff changeset
817 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
818 pPlayers[pl]->field_104 = 0;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
819 viewparams->bRedrawGameUI = true;
0
Ritor1
parents:
diff changeset
820 }
Ritor1
parents:
diff changeset
821 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
822 if ( pPlayers[pl]->pConditions[Condition_Sleep] | pPlayers[pl]->pConditions[Condition_Paralyzed]
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
823 | pPlayers[pl]->pConditions[Condition_Unconcious] | pPlayers[pl]->pConditions[Condition_Dead]
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
824 | pPlayers[pl]->pConditions[Condition_Pertified] | pPlayers[pl]->pConditions[Condition_Eradicated] )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
825 --party_condition_flag;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
826 v43 = (signed __int64)pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime > 0; //ñïåøêà
0
Ritor1
parents:
diff changeset
827
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
828 for ( uint k = 0; k < 24; ++k )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
829 pPlayers[pl]->pPlayerBuffs[k].IsBuffExpiredToTime(pParty->uTimePlayed);
0
Ritor1
parents:
diff changeset
830
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
831 if ( v43 && (signed __int64)pPlayers[pl]->pPlayerBuffs[7].uExpireTime <= 0 )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
832 pPlayers[pl]->SetCondition(Condition_Weak, 0);
0
Ritor1
parents:
diff changeset
833 }
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
834
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
835 v46 = (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0;
0
Ritor1
parents:
diff changeset
836
Ritor1
parents:
diff changeset
837 for (uint i = 0; i < 20; ++i)
Ritor1
parents:
diff changeset
838 {
1340
22cb507446a4 turnengine refactoring continue
Gloval
parents: 1339
diff changeset
839 if (pParty->pPartyBuffs[i].IsBuffExpiredToTime(pParty->uTimePlayed) == 1)
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
840 viewparams->bRedrawGameUI = true;
0
Ritor1
parents:
diff changeset
841 }
Ritor1
parents:
diff changeset
842
1167
15ad868d972f pPartyBuffs - change plain numbers to enums
Grumpy7
parents: 1165
diff changeset
843 if ( v46 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime <= 0 )
0
Ritor1
parents:
diff changeset
844 {
Ritor1
parents:
diff changeset
845 for (uint i = 0; i < 4; ++i)
Ritor1
parents:
diff changeset
846 pParty->pPlayers[i].SetCondition(1, 0);
Ritor1
parents:
diff changeset
847 }
Ritor1
parents:
diff changeset
848
2182
e1e4a8a20b5f _46Ð6ÐС_GetActorsInViewport
Ritor1
parents: 2163
diff changeset
849 for (uint i = 0; i < 2; ++i)//Ïðîâåðêà â ñîçíàíèè ëè ïåðñ ñäåëàâøèé çàêë íà ïîë¸ò è õîæäåíèå ïî âîäå
0
Ritor1
parents:
diff changeset
850 {
2182
e1e4a8a20b5f _46Ð6ÐС_GetActorsInViewport
Ritor1
parents: 2163
diff changeset
851 SpellBuff* pBuf = &pParty->pPartyBuffs[Party_Spec_Motion_status_ids[i]];
0
Ritor1
parents:
diff changeset
852 if (pBuf->uExpireTime == 0)
Ritor1
parents:
diff changeset
853 continue;
Ritor1
parents:
diff changeset
854
Ritor1
parents:
diff changeset
855 if ( !(pBuf->uFlags & 1) )
Ritor1
parents:
diff changeset
856 {
Ritor1
parents:
diff changeset
857 if (!pPlayers[pBuf->uCaster]->CanAct())
Ritor1
parents:
diff changeset
858 {
Ritor1
parents:
diff changeset
859 pBuf->Reset();
2182
e1e4a8a20b5f _46Ð6ÐС_GetActorsInViewport
Ritor1
parents: 2163
diff changeset
860 if (Party_Spec_Motion_status_ids[i] == PARTY_BUFF_FLY )
0
Ritor1
parents:
diff changeset
861 pParty->bFlying = false;
Ritor1
parents:
diff changeset
862 }
Ritor1
parents:
diff changeset
863 }
Ritor1
parents:
diff changeset
864 }
Ritor1
parents:
diff changeset
865
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
866 if ( !party_condition_flag )
0
Ritor1
parents:
diff changeset
867 {
151
9abdd40a107b pCurrentScreen
Ritor1
parents: 150
diff changeset
868 if ( pCurrentScreen != SCREEN_REST )
0
Ritor1
parents:
diff changeset
869 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
870 for ( uint pl = 1; pl <= 4; pl++ )
0
Ritor1
parents:
diff changeset
871 {
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
872 if ( pPlayers[pl]->pConditions[Condition_Sleep] )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
873 {
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
874 pPlayers[pl]->pConditions[Condition_Sleep] = 0;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
875 party_condition_flag = 1;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
876 break;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
877 }
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
878 }
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
879 if ( !party_condition_flag || _5C35C0_force_party_death )
2062
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
880 uGameState = GAME_STATE_PARTY_DIED;
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
881 }
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
882 }
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
883
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
884 if ( uActiveCharacter )//âûáîð ñëåäóþùåãî ïîñëå ïðîïóñêàþùåãî õîä
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
885 {
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
886 if ( pCurrentScreen != SCREEN_REST )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
887 {
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
888 if ( pPlayers[uActiveCharacter]->pConditions[Condition_Sleep]
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
889 || pPlayers[uActiveCharacter]->pConditions[Condition_Paralyzed]
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
890 || pPlayers[uActiveCharacter]->pConditions[Condition_Unconcious]
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
891 || pPlayers[uActiveCharacter]->pConditions[Condition_Dead]
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
892 || pPlayers[uActiveCharacter]->pConditions[Condition_Pertified]
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
893 || pPlayers[uActiveCharacter]->pConditions[Condition_Eradicated] )
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
894 {
c2a004e7458b _494035_timed_effects__water_walking_damage__etc()
Ritor1
parents: 2060
diff changeset
895 viewparams->bRedrawGameUI = true;
0
Ritor1
parents:
diff changeset
896 uActiveCharacter = pParty->GetNextActiveCharacter();
Ritor1
parents:
diff changeset
897 }
Ritor1
parents:
diff changeset
898 }
Ritor1
parents:
diff changeset
899 }
Ritor1
parents:
diff changeset
900 }
Ritor1
parents:
diff changeset
901
Ritor1
parents:
diff changeset
902 //----- (00494820) --------------------------------------------------------
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
903 unsigned int __fastcall _494820_training_time(unsigned int a1)
0
Ritor1
parents:
diff changeset
904 {
Ritor1
parents:
diff changeset
905 signed int v1; // eax@1
Ritor1
parents:
diff changeset
906
Ritor1
parents:
diff changeset
907 v1 = 5;
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
908 if ( a1 % 24 >= 5 )
0
Ritor1
parents:
diff changeset
909 v1 = 29;
758
9f7db515a8d7 Training Hall & levelling up fixed
Nomad
parents: 749
diff changeset
910 return v1 - a1 % 24;
0
Ritor1
parents:
diff changeset
911 }
Ritor1
parents:
diff changeset
912
Ritor1
parents:
diff changeset
913 //----- (00494836) --------------------------------------------------------
2184
e0863f5beee0 SPELL_WATER_RECHARGE_ITEM
Ritor1
parents: 2182
diff changeset
914 int stru339_spell_sound::AddPartySpellSound(int uSoundID, int a6)
0
Ritor1
parents:
diff changeset
915 {
Ritor1
parents:
diff changeset
916 int v3; // esi@1
Ritor1
parents:
diff changeset
917 int result; // eax@1
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
918 //stru339_spell_sound *v5; // ebx@1
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
919 //int *v6; // edi@2
0
Ritor1
parents:
diff changeset
920 unsigned int v7; // eax@3
Ritor1
parents:
diff changeset
921 int v8; // [sp+Ch] [bp-8h]@3
Ritor1
parents:
diff changeset
922 int v9; // [sp+10h] [bp-4h]@2
Ritor1
parents:
diff changeset
923 int a2a; // [sp+1Ch] [bp+8h]@1
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
924 //return 0;
0
Ritor1
parents:
diff changeset
925 v3 = 0;
Ritor1
parents:
diff changeset
926 result = word_4EE088_sound_ids[uSoundID];
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
927 //v5 = this;
0
Ritor1
parents:
diff changeset
928 a2a = word_4EE088_sound_ids[uSoundID];
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
929 if ( word_4EE088_sound_ids[uSoundID] )
0
Ritor1
parents:
diff changeset
930 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
931 //v6 = this->pSoundsOffsets;
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
932 for ( v9 = 0; v9 < 2; ++v9 )
0
Ritor1
parents:
diff changeset
933 {
Ritor1
parents:
diff changeset
934 v7 = a2a++;
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
935 result = pSoundList->LoadSound(v7, (char *)this + v3, 44744 - v3, &v8, a6);
0
Ritor1
parents:
diff changeset
936 if ( !result )
Ritor1
parents:
diff changeset
937 break;
Ritor1
parents:
diff changeset
938 a6 += 4;
Ritor1
parents:
diff changeset
939 result = v8 + 256;
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
940 this->pSoundsOffsets[v9] = v3;
0
Ritor1
parents:
diff changeset
941 v3 += result;
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
942 this->pSoundsSizes[v9] = v8 + 256;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
943 //++v6;
0
Ritor1
parents:
diff changeset
944 }
Ritor1
parents:
diff changeset
945 }
Ritor1
parents:
diff changeset
946 return result;
Ritor1
parents:
diff changeset
947 }
Ritor1
parents:
diff changeset
948 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[];
Ritor1
parents:
diff changeset
949
Ritor1
parents:
diff changeset
950 //----- (00494AED) --------------------------------------------------------
130
1c471f3629fb Party expressions update
Nomad
parents: 121
diff changeset
951 unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression)
0
Ritor1
parents:
diff changeset
952 {
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
953 for ( uint i = 0; i < this->uNumFrames; i++ )
0
Ritor1
parents:
diff changeset
954 {
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
955 if ( this->pFrames[i].expression == expression )
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
956 return i;
0
Ritor1
parents:
diff changeset
957 }
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
958 return 0;
0
Ritor1
parents:
diff changeset
959 }
Ritor1
parents:
diff changeset
960
Ritor1
parents:
diff changeset
961 //----- (00494B10) --------------------------------------------------------
Ritor1
parents:
diff changeset
962 PlayerFrame *PlayerFrameTable::GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID)
Ritor1
parents:
diff changeset
963 {
Ritor1
parents:
diff changeset
964 unsigned int v3; // esi@1
Ritor1
parents:
diff changeset
965 __int16 v6; // dx@2
Ritor1
parents:
diff changeset
966 int v7; // edx@3
Ritor1
parents:
diff changeset
967 char *i; // eax@3
Ritor1
parents:
diff changeset
968 int v9; // ecx@5
Ritor1
parents:
diff changeset
969 PlayerFrame *result; // eax@6
Ritor1
parents:
diff changeset
970
Ritor1
parents:
diff changeset
971 v3 = uFramesetID;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
972 if ( this->pFrames[uFramesetID].uFlags & 1 && (v6 = this->pFrames[uFramesetID].uAnimLength) != 0 )
0
Ritor1
parents:
diff changeset
973 {
Ritor1
parents:
diff changeset
974 v7 = ((signed int)uFrameID >> 3) % (unsigned __int16)v6;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
975 for ( i = (char *)&this->pFrames[uFramesetID].uAnimTime; ; i += 10 )
0
Ritor1
parents:
diff changeset
976 {
Ritor1
parents:
diff changeset
977 v9 = *(short *)i;
Ritor1
parents:
diff changeset
978 if ( v7 <= v9 )
Ritor1
parents:
diff changeset
979 break;
Ritor1
parents:
diff changeset
980 v7 -= v9;
Ritor1
parents:
diff changeset
981 ++v3;
Ritor1
parents:
diff changeset
982 }
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
983 result = &this->pFrames[v3];
0
Ritor1
parents:
diff changeset
984 }
Ritor1
parents:
diff changeset
985 else
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
986 result = &this->pFrames[uFramesetID];
0
Ritor1
parents:
diff changeset
987 return result;
Ritor1
parents:
diff changeset
988 }
Ritor1
parents:
diff changeset
989
Ritor1
parents:
diff changeset
990 //----- (00494B5E) --------------------------------------------------------
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
991 PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4)
0
Ritor1
parents:
diff changeset
992 {
Ritor1
parents:
diff changeset
993 int v5; // esi@1
Ritor1
parents:
diff changeset
994 int v6; // eax@2
Ritor1
parents:
diff changeset
995
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
996 v5 = a4 + *pAnimTime;
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
997 if ( v5 < 8 * this->pFrames[*pFramesetID].uAnimTime )
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
998 *pAnimTime = v5;
0
Ritor1
parents:
diff changeset
999 else
Ritor1
parents:
diff changeset
1000 {
Ritor1
parents:
diff changeset
1001 v6 = rand() % 4 + 21;
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
1002 *pFramesetID = v6;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1003 *pAnimTime = 8 * v5 % this->pFrames[v6].uAnimTime;
554
9caf59edb1ee Cave and Temple load and even doesn't crash (for a while).
Nomad
parents: 526
diff changeset
1004 }
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1005 return &this->pFrames[*pFramesetID];
0
Ritor1
parents:
diff changeset
1006 }
Ritor1
parents:
diff changeset
1007
Ritor1
parents:
diff changeset
1008 //----- (00494BC3) --------------------------------------------------------
Ritor1
parents:
diff changeset
1009 void PlayerFrameTable::ToFile()
Ritor1
parents:
diff changeset
1010 {
Ritor1
parents:
diff changeset
1011 PlayerFrameTable *v1; // esi@1
Ritor1
parents:
diff changeset
1012 FILE *v2; // eax@1
Ritor1
parents:
diff changeset
1013 FILE *v3; // edi@1
Ritor1
parents:
diff changeset
1014
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1914
diff changeset
1015 PlayerFrameTable* Str = this;
0
Ritor1
parents:
diff changeset
1016
Ritor1
parents:
diff changeset
1017 v1 = Str;
Ritor1
parents:
diff changeset
1018 v2 = fopen("data\\dpft.bin", "wb");
Ritor1
parents:
diff changeset
1019 v3 = v2;
Ritor1
parents:
diff changeset
1020 if ( !v2 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1529
diff changeset
1021 Error("Unable to save dpft.bin");
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1022 fwrite(v1, 4, 1, v2);
0
Ritor1
parents:
diff changeset
1023 fwrite(v1->pFrames, 0xAu, v1->uNumFrames, v3);
Ritor1
parents:
diff changeset
1024 fclose(v3);
Ritor1
parents:
diff changeset
1025 }
Ritor1
parents:
diff changeset
1026
Ritor1
parents:
diff changeset
1027 //----- (00494C0F) --------------------------------------------------------
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1461
diff changeset
1028 void PlayerFrameTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
0
Ritor1
parents:
diff changeset
1029 {
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1461
diff changeset
1030 uint num_mm6_frames = data_mm6 ? *(int *)data_mm6 : 0,
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1461
diff changeset
1031 num_mm7_frames = data_mm7 ? *(int *)data_mm7 : 0,
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1461
diff changeset
1032 num_mm8_frames = data_mm8 ? *(int *)data_mm8 : 0;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1461
diff changeset
1033 uNumFrames = num_mm6_frames + num_mm7_frames + num_mm8_frames;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1461
diff changeset
1034 assert(uNumFrames);
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1461
diff changeset
1035 assert(!num_mm8_frames);
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1461
diff changeset
1036
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1567
diff changeset
1037 pFrames = (PlayerFrame *)malloc(uNumFrames * sizeof(PlayerFrame));
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1461
diff changeset
1038 memcpy(pFrames, (char *)data_mm7 + 4, num_mm7_frames * sizeof(PlayerFrame));
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1461
diff changeset
1039 memcpy(pFrames + num_mm7_frames, (char *)data_mm6 + 4, num_mm6_frames * sizeof(PlayerFrame));
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1461
diff changeset
1040 memcpy(pFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(PlayerFrame));
0
Ritor1
parents:
diff changeset
1041 }
Ritor1
parents:
diff changeset
1042
Ritor1
parents:
diff changeset
1043 //----- (00494C5A) --------------------------------------------------------
Ritor1
parents:
diff changeset
1044 int PlayerFrameTable::FromFileTxt(const char *Args)
Ritor1
parents:
diff changeset
1045 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1046 //PlayerFrameTable *v2; // ebx@1
0
Ritor1
parents:
diff changeset
1047 FILE *v3; // eax@1
Ritor1
parents:
diff changeset
1048 int v4; // esi@3
Ritor1
parents:
diff changeset
1049 void *v5; // eax@10
Ritor1
parents:
diff changeset
1050 FILE *v6; // ST0C_4@12
Ritor1
parents:
diff changeset
1051 char *i; // eax@12
Ritor1
parents:
diff changeset
1052 __int16 v8; // ax@15
Ritor1
parents:
diff changeset
1053 const char *v9; // ST10_4@15
Ritor1
parents:
diff changeset
1054 unsigned __int16 v10; // ax@15
Ritor1
parents:
diff changeset
1055 const char *v11; // ST0C_4@15
Ritor1
parents:
diff changeset
1056 int j; // esi@15
Ritor1
parents:
diff changeset
1057 int v13; // eax@17
Ritor1
parents:
diff changeset
1058 int v14; // edx@22
Ritor1
parents:
diff changeset
1059 int v15; // ecx@23
Ritor1
parents:
diff changeset
1060 int v16; // eax@24
Ritor1
parents:
diff changeset
1061 signed int k; // eax@27
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1062 //PlayerFrame *v18; // edx@28
0
Ritor1
parents:
diff changeset
1063 int v19; // esi@28
Ritor1
parents:
diff changeset
1064 int l; // ecx@29
Ritor1
parents:
diff changeset
1065 char Buf; // [sp+Ch] [bp-2F8h]@3
Ritor1
parents:
diff changeset
1066 FrameTableTxtLine v23; // [sp+200h] [bp-104h]@4
Ritor1
parents:
diff changeset
1067 FrameTableTxtLine v24; // [sp+27Ch] [bp-88h]@4
Ritor1
parents:
diff changeset
1068 int v25; // [sp+2F8h] [bp-Ch]@3
Ritor1
parents:
diff changeset
1069 int v26; // [sp+2FCh] [bp-8h]@3
Ritor1
parents:
diff changeset
1070 FILE *File; // [sp+300h] [bp-4h]@1
Ritor1
parents:
diff changeset
1071 int Argsa; // [sp+30Ch] [bp+8h]@28
Ritor1
parents:
diff changeset
1072
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1073 __debugbreak();//Ritor1;
0
Ritor1
parents:
diff changeset
1074 //TileTable::dtor((TileTable *)this);
Ritor1
parents:
diff changeset
1075 v3 = fopen(Args, "r");
Ritor1
parents:
diff changeset
1076 File = v3;
Ritor1
parents:
diff changeset
1077 if ( !v3 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1529
diff changeset
1078 Error("PlayerFrameTable::load - Unable to open file: %s.", Args);
0
Ritor1
parents:
diff changeset
1079 v4 = 0;
Ritor1
parents:
diff changeset
1080 v25 = 0;
Ritor1
parents:
diff changeset
1081 v26 = 1;
Ritor1
parents:
diff changeset
1082 if ( fgets(&Buf, 490, v3) )
Ritor1
parents:
diff changeset
1083 {
Ritor1
parents:
diff changeset
1084 do
Ritor1
parents:
diff changeset
1085 {
Ritor1
parents:
diff changeset
1086 *strchr(&Buf, 10) = 0;
703
a9c1fb7483c2 monster parser almost complete.
Gloval
parents: 701
diff changeset
1087 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24));
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
1088 if ( v24.uPropCount && *v24.pProperties[0] != 47 )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
1089 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
1090 if ( v24.uPropCount < 3 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1529
diff changeset
1091 Error("PlayerFrameTable::load, too few arguments, %s line %i.", Args, v26);
0
Ritor1
parents:
diff changeset
1092 ++v25;
Ritor1
parents:
diff changeset
1093 }
Ritor1
parents:
diff changeset
1094 ++v26;
Ritor1
parents:
diff changeset
1095 }
Ritor1
parents:
diff changeset
1096 while ( fgets(&Buf, 490, File) );
Ritor1
parents:
diff changeset
1097 v4 = v25;
Ritor1
parents:
diff changeset
1098 }
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1099 this->uNumFrames = v4;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1567
diff changeset
1100 v5 = malloc(10 * v4);
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1101 this->pFrames = (PlayerFrame *)v5;
0
Ritor1
parents:
diff changeset
1102 if ( !v5 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1529
diff changeset
1103 Error("PlayerFrameTable::load - Out of Memory!");
0
Ritor1
parents:
diff changeset
1104 v6 = File;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1105 this->uNumFrames = 0;
0
Ritor1
parents:
diff changeset
1106 fseek(v6, 0, 0);
Ritor1
parents:
diff changeset
1107 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
Ritor1
parents:
diff changeset
1108 {
Ritor1
parents:
diff changeset
1109 *strchr(&Buf, 10) = 0;
703
a9c1fb7483c2 monster parser almost complete.
Gloval
parents: 701
diff changeset
1110 memcpy(&v24, txt_file_frametable_parser(&Buf, &v23), sizeof(v24));
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
1111 if ( v24.uPropCount && *v24.pProperties[0] != 47 )
0
Ritor1
parents:
diff changeset
1112 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1113 //v8 = atoi(v24.pProperties[0]);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1114 //v9 = v24.pProperties[1];
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1115 this->pFrames[this->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)atoi(v24.pProperties[0]);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1116 //v10 = atoi(v9);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1117 //v11 = v24.pProperties[2];
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1118 this->pFrames[this->uNumFrames].uTextureID = atoi(v24.pProperties[1]);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1119 this->pFrames[this->uNumFrames].uAnimTime = atoi(v24.pProperties[2]);
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1120 this->pFrames[this->uNumFrames].uAnimLength = 0;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1121 this->pFrames[this->uNumFrames].uFlags = 0;
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 697
diff changeset
1122 for ( j = 3; j < v24.uPropCount; ++j )
0
Ritor1
parents:
diff changeset
1123 {
1104
5d5c78088274 strcmpi to stricmp conversion
Grumpy7
parents: 1093
diff changeset
1124 if ( !_stricmp(v24.pProperties[j], "New") )
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1125 this->pFrames[this->uNumFrames].uFlags |= 4;
0
Ritor1
parents:
diff changeset
1126 }
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1127 ++this->uNumFrames;
0
Ritor1
parents:
diff changeset
1128 }
Ritor1
parents:
diff changeset
1129 }
Ritor1
parents:
diff changeset
1130 fclose(File);
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1131
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1132 if ( (signed int)(this->uNumFrames - 1) > 0 )
0
Ritor1
parents:
diff changeset
1133 {
Ritor1
parents:
diff changeset
1134 v15 = 0;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1135 for ( v14 = 0; v14 < this->uNumFrames - 1; ++v14 )
0
Ritor1
parents:
diff changeset
1136 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1137 v16 = (int)&this->pFrames[v15];
0
Ritor1
parents:
diff changeset
1138 if ( !(*(char *)(v16 + 18) & 4) )
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1139 this->pFrames[v14].uFlags |= 1;
0
Ritor1
parents:
diff changeset
1140 ++v15;
Ritor1
parents:
diff changeset
1141 }
Ritor1
parents:
diff changeset
1142 }
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1143 for ( k = 0; k < (signed int)this->uNumFrames; *(short *)(Argsa + 6) = v19 )
0
Ritor1
parents:
diff changeset
1144 {
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1145 //v18 = this->pFrames;
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1146 Argsa = (int)&this->pFrames[k];
0
Ritor1
parents:
diff changeset
1147 v19 = *(short *)(Argsa + 4);
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1148 if ( this->pFrames[k].uFlags & 1 )
0
Ritor1
parents:
diff changeset
1149 {
Ritor1
parents:
diff changeset
1150 ++k;
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1151 for ( l = (int)&this->pFrames[k]; this->pFrames[k].uFlags & 1; l += 10 )
0
Ritor1
parents:
diff changeset
1152 {
Ritor1
parents:
diff changeset
1153 v19 += *(short *)(l + 4);
Ritor1
parents:
diff changeset
1154 ++k;
Ritor1
parents:
diff changeset
1155 }
2117
c7bf59066842 mm7_4-6 cleaned
Ritor1
parents: 2113
diff changeset
1156 LOWORD(v19) = this->pFrames[k].uAnimTime + v19;
0
Ritor1
parents:
diff changeset
1157 }
Ritor1
parents:
diff changeset
1158 ++k;
Ritor1
parents:
diff changeset
1159 }
Ritor1
parents:
diff changeset
1160 return 1;
Ritor1
parents:
diff changeset
1161 }
Ritor1
parents:
diff changeset
1162
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
1163
0
Ritor1
parents:
diff changeset
1164
Ritor1
parents:
diff changeset
1165 //----- (00495430) --------------------------------------------------------
1838
211dfe2d8db1 changing global char* vars to const char* vars
Grumpy7
parents: 1828
diff changeset
1166 const char * GetReputationString( signed int a1 )
607
cfca6297e4ae ArmorShop fixes
Gloval
parents: 606
diff changeset
1167 {
566
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1168 if (a1 >= 25)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1169 return pGlobalTXT_LocalizationStrings[379]; // Hated
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1170 else if (a1 >= 6)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1171 return pGlobalTXT_LocalizationStrings[392]; // Unfriendly
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1172 else if (a1 >= -5)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1173 return pGlobalTXT_LocalizationStrings[399]; // Neutral;
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1174 else if (a1 >= -24)
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1175 return pGlobalTXT_LocalizationStrings[402]; // Friendly
0
Ritor1
parents:
diff changeset
1176 else
566
fcbb3c281217 QuickRef reputation string fix
Nomad
parents: 554
diff changeset
1177 return pGlobalTXT_LocalizationStrings[434]; // Respected;
0
Ritor1
parents:
diff changeset
1178 }
Ritor1
parents:
diff changeset
1179
Ritor1
parents:
diff changeset
1180 //----- (00495461) --------------------------------------------------------
1838
211dfe2d8db1 changing global char* vars to const char* vars
Grumpy7
parents: 1828
diff changeset
1181 char *BuildDialogueString(const char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6)
0
Ritor1
parents:
diff changeset
1182 {
Ritor1
parents:
diff changeset
1183 Player *pPlayer; // ebx@3
1838
211dfe2d8db1 changing global char* vars to const char* vars
Grumpy7
parents: 1828
diff changeset
1184 const char *pText; // esi@7
0
Ritor1
parents:
diff changeset
1185 int v17; // eax@10
Ritor1
parents:
diff changeset
1186 signed __int64 v18; // qax@18
Ritor1
parents:
diff changeset
1187 unsigned __int8 *v20; // ebx@32
Ritor1
parents:
diff changeset
1188 int v21; // ecx@34
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1189 int pReputation; // eax@45
0
Ritor1
parents:
diff changeset
1190 int v29; // eax@68
Ritor1
parents:
diff changeset
1191 __int16 v55[56]; // [sp+10h] [bp-128h]@34
351
5f36449527c6 stru351 -> summoned/spell-enchanted item
Nomad
parents: 348
diff changeset
1192 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107
0
Ritor1
parents:
diff changeset
1193 char a1[100]; // [sp+B8h] [bp-80h]@3
Ritor1
parents:
diff changeset
1194 int v63; // [sp+12Ch] [bp-Ch]@32
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1195
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1196 if ( IsBadStringPtrA(lpsz, 1) )
0
Ritor1
parents:
diff changeset
1197 return "Invalid String Passed";
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1198
0
Ritor1
parents:
diff changeset
1199 a1[0] = 0;
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1200 pPlayer = &pParty->pPlayers[uPlayerID];
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1201 memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2));
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1202
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1203 NPCData *npc = nullptr;
0
Ritor1
parents:
diff changeset
1204 if ( dword_5C35D4 )
1211
fd3bea473c0c fix HouseNpcdata array addresiing
Gloval
parents: 1209
diff changeset
1205 npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0))]; //- 1
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1206 else
602
628694cd5744 Margaret working
zipi
parents: 569
diff changeset
1207 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1208
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1209 //pText = a4;
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1914
diff changeset
1210 uint len = strlen(lpsz);
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1211 for (int i = 0, dst = 0; i < len; ++i)
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1212 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1213 char c = lpsz[i];
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1214 if (c != '%')
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1215 pTmpBuf2[dst++] = c;
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1216 else
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1217 {
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1218 v17 = 10 * (int)(lpsz[i + 1] - '0') + lpsz[i + 2] - '0';
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1219
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1220 switch ( v17 )
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1221 {
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1222 case 1://Ïîäðîáíåå
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1223 strcat(pTmpBuf2.data(), npc->pName);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1224 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1225 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1226 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1227 case 2:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1228 strcat(pTmpBuf2.data(), pPlayer->pName);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1229 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1230 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1231 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1232 case 3:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1233 case 4:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1234 strcat(pTmpBuf2.data(), a1);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1235 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1236 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1237 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1238 case 5:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1239 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1240 pText = pGlobalTXT_LocalizationStrings[397];// "evening"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1241 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1242 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1243 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 11 )
0
Ritor1
parents:
diff changeset
1244 {
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1245 if ( v18 < 20 )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1246 pText = pGlobalTXT_LocalizationStrings[396];// "day"
0
Ritor1
parents:
diff changeset
1247 }
Ritor1
parents:
diff changeset
1248 else
Ritor1
parents:
diff changeset
1249 {
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1250 pText = pGlobalTXT_LocalizationStrings[395];// "morning"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1251 }
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1252 }
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1253 strcat(pTmpBuf2.data(), pText);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1254 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1255 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1256 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1257 case 6:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1258 if ( pPlayer->uSex )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1259 pText = pGlobalTXT_LocalizationStrings[387];// "lady"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1260 else
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1261 pText = pGlobalTXT_LocalizationStrings[385];// "sir"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1262 strcat(pTmpBuf2.data(), pText);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1263 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1264 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1265 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1266 case 7:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1267 if ( pPlayer->uSex )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1268 pText = pGlobalTXT_LocalizationStrings[389];// "Lady"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1269 else
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1270 pText = pGlobalTXT_LocalizationStrings[386];// "Sir"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1271 strcat(pTmpBuf2.data(), pText);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1272 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1273 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1274 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1275 case 8:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1276 v63 = 0;
1460
ff2118028c71 renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents: 1453
diff changeset
1277 v20 = (unsigned __int8 *)pPlayer->_achieved_awards_bits;
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1461
diff changeset
1278 for ( uint _i = 0; _i < 28; ++_i )
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1279 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1280 if ( (unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]) )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1281 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1282 v21 = v63;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1283 ++v63;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1284 v55[v63] = word_4EE150[i];
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1285 }
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1286 }
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1287 if ( v63 )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1288 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1289 if ( dword_A74CDC == -1 )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1290 dword_A74CDC = rand() % v63;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1291 pText = (char *)pAwards[v55[dword_A74CDC]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]];
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1292 }
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1293 else
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1294 pText = (char *)pNPCTopics[55].pText;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1295 strcat(pTmpBuf2.data(), pText);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1296 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1297 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1298 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1299 case 9:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1300 if ( npc->uSex )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1301 pText = pGlobalTXT_LocalizationStrings[384];// "her"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1302 else
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1303 pText = pGlobalTXT_LocalizationStrings[383];// "his"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1304 strcat(pTmpBuf2.data(), pText);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1305 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1306 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1307 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1308 case 10:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1309 if ( pPlayer->uSex )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1310 pText = pGlobalTXT_LocalizationStrings[389];// "Lady"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1311 else
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1312 pText = pGlobalTXT_LocalizationStrings[388];// "Lord"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1313 strcat(pTmpBuf2.data(), pText);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1314 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1315 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1316 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1317 case 11:
1827
0c75c3e7e436 cleaned up part of party.cpp, renamed byte_AE3368 to playerAlreadyPicked + 3 vars after it, moved them to party.cpp, some player.cpp bugfixes
Grumpy7
parents: 1826
diff changeset
1318 pReputation = pParty->GetPartyReputation();
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1319 if ( pReputation >= 25 )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1320 pText = pGlobalTXT_LocalizationStrings[379];
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1321 else//v25 < 25
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1322 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1323 if ( pReputation < 6 )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1324 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1325 if ( pReputation >= -5 )//6 >= v25 >= -5
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1326 pText = pGlobalTXT_LocalizationStrings[399];
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1327 else// v25 < -5
0
Ritor1
parents:
diff changeset
1328 {
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1329 if ( pReputation < -24 )//-24 > v25
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1330 pText = pGlobalTXT_LocalizationStrings[434];
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1331 else// -5 > v25 > -24
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1332 pText = pGlobalTXT_LocalizationStrings[402];
0
Ritor1
parents:
diff changeset
1333 }
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1334 }
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1335 else//25 > v25 > 6
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1336 pText = pGlobalTXT_LocalizationStrings[392];
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1337 }
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1338 strcat(pTmpBuf2.data(), pText);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1339 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1340 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1341 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1342 case 12:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1343 pReputation = npc->rep;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1344 if ( pReputation >= 25 )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1345 pText = pGlobalTXT_LocalizationStrings[379];
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1346 else
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1347 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1348 if ( pReputation < 6 )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1349 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1350 if ( pReputation >= -5 )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1351 pText = pGlobalTXT_LocalizationStrings[399];
0
Ritor1
parents:
diff changeset
1352 else
Ritor1
parents:
diff changeset
1353 {
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1354 if ( pReputation < -24 )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1355 pText = pGlobalTXT_LocalizationStrings[434];
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1356 else
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1357 pText = pGlobalTXT_LocalizationStrings[402];
0
Ritor1
parents:
diff changeset
1358 }
Ritor1
parents:
diff changeset
1359 }
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1360 else
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1361 pText = pGlobalTXT_LocalizationStrings[392];
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1362 }
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1363 strcat(pTmpBuf2.data(), pText);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1364 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1365 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1366 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1367 case 13:
2229
10c909eb6766 dword_AE336C to NPCStats::dword_AE336C_LastMispronouncedNameFirstLetter,
Grumpy7
parents: 2215
diff changeset
1368 strcat(pTmpBuf2.data(), pNPCStats->sub_495366_MispronounceName(pPlayer->pName[0], pPlayer->uSex));
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1369 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1370 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1371 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1372 case 14:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1373 if ( npc->uSex )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1374 pText = pGlobalTXT_LocalizationStrings[391];// "sister"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1375 else
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1376 pText = pGlobalTXT_LocalizationStrings[390];// "brother"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1377 strcat(pTmpBuf2.data(), pText);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1378 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1379 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1380 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1381 case 15:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1382 strcat(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[393]);// "daughter"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1383 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1384 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1385 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1386 case 16:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1387 if ( npc->uSex )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1388 pText = pGlobalTXT_LocalizationStrings[391];// "sister"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1389 else
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1390 pText = pGlobalTXT_LocalizationStrings[390];// "brother"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1391 strcat(pTmpBuf2.data(), pText);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1392 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1393 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1394 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1395 case 17://òåêñò íà¸ìíîãî ÍÏÑ
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1396 {
2115
90cc547a7927 Fixing hireling prices
Grumpy7
parents: 2103
diff changeset
1397 uint pay_percentage = pNPCStats->pProfessions[npc->uProfession].uHirePrice / 100;
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1398 if ( !pay_percentage )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1399 pay_percentage = 1;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1400 sprintf(a1, "%lu", pay_percentage);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1401 strcat(pTmpBuf2.data(), a1);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1402 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1403 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1404 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1405 }
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1406 case 18:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1407 case 19:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1408 case 20:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1409 case 21:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1410 case 22:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1411 case 26:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1412 strncpy(a1, lpsz + i + 1, 2);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1413 sprintf(a1, "%lu", atoi(a1));
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1414 strcat(pTmpBuf2.data(), a1);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1415 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1416 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1417 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1418 case 23:
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1461
diff changeset
1419 if ( pMapStats->GetMapInfo(pCurrentMapName) )
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1461
diff changeset
1420 pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName;
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1421 else
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1422 pText = pGlobalTXT_LocalizationStrings[394];// "Unknown"
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1423 strcat(pTmpBuf2.data(), pText);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1424 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1425 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1426 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1427 case 24://íàçâàíèå òîâàðà â ïðîäàæå
2069
259df09dfb50 32bits almost there
Nomad
parents: 2060
diff changeset
1428 sprintfex(a1, format_4E2D80, Color16(255, 255, 155), a3->GetDisplayName());
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1429 strcat(pTmpBuf2.data(), a1);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1430 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1431 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1432 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1433 case 25:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1434 v29 = pPlayer->GetBaseBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
0
Ritor1
parents:
diff changeset
1435 switch ( a5 )
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1436 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1437 case 3:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1438 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1439 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1440 case 4:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1441 v29 = pPlayer->GetBaseIdentifyPrice(p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1442 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1443 case 5:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1444 v29 = pPlayer->GetBaseRepairPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1445 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1446 case 6:
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1447 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1448 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1449 }
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1450 sprintfex(a1, "%lu", v29);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1451 strcat(pTmpBuf2.data(), a1);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1452 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1453 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1454 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1455 case 27://òåêñò ïðîäàæè
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1456 v29 = pPlayer->GetBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1457 if ( a5 == 3 )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1458 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1459 v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
1567
9f8b3e904e14 Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents: 1546
diff changeset
1460 if (a3->IsBroken())
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1461 v29 = 1;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1462 sprintfex(a1, "%lu", v29);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1463 strcat(pTmpBuf2.data(), a1);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1464 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1465 i += 2;
0
Ritor1
parents:
diff changeset
1466 break;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1467 }
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1468 if ( a5 != 4 )
0
Ritor1
parents:
diff changeset
1469 {
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1470 if ( a5 == 5 )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1471 v29 = pPlayer->GetPriceRepair(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1472 else
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1473 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1474 if ( a5 == 6 )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1475 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1476 v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2;
1567
9f8b3e904e14 Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents: 1546
diff changeset
1477 if (a3->IsBroken())
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1478 v29 = 1;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1479 if (!v29)
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1480 v29 = 1;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1481 sprintfex(a1, "%lu", v29);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1482 strcat(pTmpBuf2.data(), a1);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1483 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1484 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1485 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1486 }
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1487 }
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1488 sprintfex(a1, "%lu", v29);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1489 strcat(pTmpBuf2.data(), a1);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1490 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1491 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1492 break;
0
Ritor1
parents:
diff changeset
1493 }
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1494 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier));
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1495 strcat(pTmpBuf2.data(), a1);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1496 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1497 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1498 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1499 case 28://ïðîôåññèÿ
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1500 strcat(pTmpBuf2.data(), (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1501 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1502 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1503 break;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1504 case 29:
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1505 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier));
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1506 strcat(pTmpBuf2.data(), a1);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1507 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1508 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1509 break;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1510 case 30:
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1511 if ( !a6 )
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1512 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1513 strcat(pTmpBuf2.data(), a4);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1514 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1515 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1516 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1517 }
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
1518 init_summoned_item(&v56, *a6);
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1519 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1520 strcat(pTmpBuf2.data(), a1);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1521 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1522 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1523 break;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1524 case 31:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1525 case 32:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1526 case 33:
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1527 case 34:
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1528 strcat(pTmpBuf2.data(), pParty->pPlayers[v17 - 31].pName);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1529 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1530 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1531 break;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1532 default:
0
Ritor1
parents:
diff changeset
1533 if ( v17 <= 50 || v17 > 70 )
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1534 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1535 strncpy(a1, lpsz + i + 1, 2);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1536 sprintf(a1, "%lu", atoi(a1));
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1537 strcat(pTmpBuf2.data(), a1);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1538 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1539 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1540 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1541 }
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1542 if ( v17 - 51 >= 20 )
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1543 {
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1544 strcat(pTmpBuf2.data(), a4);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1545 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1546 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1547 break;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1548 }
1747
cecb080929c4 Party_stru0 renamed to PartyTimeStruct, fixed its members, renamed Party::field_3C to Party::PartyTimes, started Player::SetVariable refactoring start
Grumpy7
parents: 1709
diff changeset
1549 init_summoned_item(&v56, pParty->PartyTimes._s_times[v17-51]);
1453
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1550 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1551 strcat(pTmpBuf2.data(), a1);
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1552 dst = strlen(pTmpBuf2.data());
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1553 i += 2;
dfc9484ed94c GetDayPart and Journal_Draw
Ritor1
parents: 1424
diff changeset
1554 break;
254
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1555 }
d1af3319bc44 BuilDialogueString: replaces %xx in dialogue strings by appropriate values
Nomad
parents: 250
diff changeset
1556 }
0
Ritor1
parents:
diff changeset
1557 }
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1558 return pTmpBuf2.data();
0
Ritor1
parents:
diff changeset
1559 }
Ritor1
parents:
diff changeset
1560
Ritor1
parents:
diff changeset
1561 //----- (0049B04D) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1562 void stru154::GetFacePlaneAndClassify(ODMFace *a2, BSPVertexBuffer *a3)
0
Ritor1
parents:
diff changeset
1563 {
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1564 //stru154 *v3; // edi@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1565 //signed int v4; // eax@1
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1566 //signed int result; // eax@9
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1567 //signed int v6; // [sp-8h] [bp-18h]@8
0
Ritor1
parents:
diff changeset
1568 Vec3_float_ v; // [sp+4h] [bp-Ch]@1
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1569 float v7;
0
Ritor1
parents:
diff changeset
1570
Ritor1
parents:
diff changeset
1571 v.x = 0.0;
Ritor1
parents:
diff changeset
1572 v.y = 0.0;
Ritor1
parents:
diff changeset
1573 v.z = 0.0;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1574 GetFacePlane(a2, a3, &v, &v7);
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1575
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1576 if (fabsf(a2->pFacePlane.vNormal.z) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1577 polygonType = POLYGON_VerticalWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1578 else if (fabsf(a2->pFacePlane.vNormal.x) < 1e-6f &&
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1579 fabsf(a2->pFacePlane.vNormal.y) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1580 polygonType = POLYGON_Floor;
0
Ritor1
parents:
diff changeset
1581 else
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1582 polygonType = POLYGON_InBetweenFloorAndWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1583
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1584 face_plane.vNormal.x = v.x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1585 face_plane.vNormal.y = v.y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1586 face_plane.vNormal.z = v.z;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1587 face_plane.dist = v7;
0
Ritor1
parents:
diff changeset
1588 }
Ritor1
parents:
diff changeset
1589
Ritor1
parents:
diff changeset
1590 //----- (0049B0C9) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1591 void stru154::ClassifyPolygon(Vec3_float_ *pNormal, float dist)
0
Ritor1
parents:
diff changeset
1592 {
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1593 if (fabsf(pNormal->z) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1594 polygonType = POLYGON_VerticalWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1595 else if (fabsf(pNormal->x) < 1e-6f &&
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1596 fabsf(pNormal->y) < 1e-6f)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1597 polygonType = POLYGON_Floor;
0
Ritor1
parents:
diff changeset
1598 else
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1599 polygonType = POLYGON_InBetweenFloorAndWall;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1600
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1601 face_plane.vNormal.x = pNormal->x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1602 face_plane.dist = dist;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1603 face_plane.vNormal.y = pNormal->y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1604 face_plane.vNormal.z = pNormal->z;
0
Ritor1
parents:
diff changeset
1605 }
Ritor1
parents:
diff changeset
1606
Ritor1
parents:
diff changeset
1607 //----- (0049B13D) --------------------------------------------------------
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1608 void stru154::GetFacePlane(ODMFace *pFace, BSPVertexBuffer *pVertices, Vec3_float_ *pOutNormal, float *pOutDist)
0
Ritor1
parents:
diff changeset
1609 {
Ritor1
parents:
diff changeset
1610 Vec3_float_ *v19; // eax@3
Ritor1
parents:
diff changeset
1611 Vec3_float_ v2; // [sp+4h] [bp-64h]@3
Ritor1
parents:
diff changeset
1612 float v26; // [sp+1Ch] [bp-4Ch]@3
Ritor1
parents:
diff changeset
1613 float v27; // [sp+20h] [bp-48h]@3
Ritor1
parents:
diff changeset
1614 float v28; // [sp+24h] [bp-44h]@3
Ritor1
parents:
diff changeset
1615 Vec3_float_ v1; // [sp+40h] [bp-28h]@1
Ritor1
parents:
diff changeset
1616 Vec3_float_ v38; // [sp+58h] [bp-10h]@3
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1617
0
Ritor1
parents:
diff changeset
1618 v1.x = 0.0;
Ritor1
parents:
diff changeset
1619 v1.y = 0.0;
Ritor1
parents:
diff changeset
1620 v1.z = 0.0;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1621
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1622 if (pFace->uNumVertices >= 2)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1623 {
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1624 for ( int i = 0; i < pFace->uNumVertices - 2; i++ )
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1625 {
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1626 v1.x = pVertices->pVertices[pFace->pVertexIDs[i + 1]].x - pVertices->pVertices[pFace->pVertexIDs[i]].x;
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1627 v1.y = pVertices->pVertices[pFace->pVertexIDs[i + 1]].y - pVertices->pVertices[pFace->pVertexIDs[i]].y;
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1628 v1.z = pVertices->pVertices[pFace->pVertexIDs[i + 1]].z - pVertices->pVertices[pFace->pVertexIDs[i]].z;
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1629
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1630 v26 = pVertices->pVertices[pFace->pVertexIDs[i + 2]].x - pVertices->pVertices[pFace->pVertexIDs[i + 1]].x;
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1631 v27 = pVertices->pVertices[pFace->pVertexIDs[i + 2]].y - pVertices->pVertices[pFace->pVertexIDs[i + 1]].y;
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1632 v28 = pVertices->pVertices[pFace->pVertexIDs[i + 2]].z - pVertices->pVertices[pFace->pVertexIDs[i + 1]].z;
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1633
0
Ritor1
parents:
diff changeset
1634 v19 = Vec3_float_::Cross(&v1, &v2, v26, v27, v28);
Ritor1
parents:
diff changeset
1635 v38.x = v19->x;
Ritor1
parents:
diff changeset
1636 v38.y = v19->y;
Ritor1
parents:
diff changeset
1637 v38.z = v19->z;
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1638 if ( v38.x != 0.0 || v38.y != 0.0 || v38.z != 0.0)
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1639 {
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1640 v38.Normalize();
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1641
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1642 pOutNormal->x = v38.x;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1643 pOutNormal->y = v38.y;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1644 pOutNormal->z = v38.z;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1645
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1646 *pOutDist = -(pVertices->pVertices[pFace->pVertexIDs[i]].x * v38.x
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1647 + pVertices->pVertices[pFace->pVertexIDs[i]].y * v38.y
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1648 + pVertices->pVertices[pFace->pVertexIDs[i]].z * v38.z);
734
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1649 return;
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1650 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1651 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1652 }
2f4e33c1ed24 stru154
Nomad
parents: 731
diff changeset
1653
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1654 pOutNormal->x = (double)(pFace->pFacePlane.vNormal.x & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.vNormal.x >> 16);
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1655 pOutNormal->y = (double)(pFace->pFacePlane.vNormal.y & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.vNormal.y >> 16);
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1656 pOutNormal->z = (double)(pFace->pFacePlane.vNormal.z & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.vNormal.z >> 16);
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1657 *pOutDist = (double)(pFace->pFacePlane.dist & 0xFFFF) / 65535.0f + (double)(pFace->pFacePlane.dist >> 16);
0
Ritor1
parents:
diff changeset
1658 }
Ritor1
parents:
diff changeset
1659
Ritor1
parents:
diff changeset
1660 //----- (0049D700) --------------------------------------------------------
Ritor1
parents:
diff changeset
1661 unsigned int __fastcall GetMaxMipLevels(unsigned int uDim)
Ritor1
parents:
diff changeset
1662 {
Ritor1
parents:
diff changeset
1663 int v2; // ecx@1
Ritor1
parents:
diff changeset
1664 unsigned int v3; // eax@1
Ritor1
parents:
diff changeset
1665
Ritor1
parents:
diff changeset
1666 v2 = 0;
2103
2318216e5206 stru_AA1058[i]._494836() continue
Ritor1
parents: 2102
diff changeset
1667 v3 = uDim - 1;
0
Ritor1
parents:
diff changeset
1668 while ( v3 & 1 )
Ritor1
parents:
diff changeset
1669 {
Ritor1
parents:
diff changeset
1670 v3 >>= 1;
Ritor1
parents:
diff changeset
1671 ++v2;
Ritor1
parents:
diff changeset
1672 }
Ritor1
parents:
diff changeset
1673 return v3 == 0 ? v2 : 0;
Ritor1
parents:
diff changeset
1674 }
Ritor1
parents:
diff changeset
1675
Ritor1
parents:
diff changeset
1676 //----- (004B1447) --------------------------------------------------------
2246
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1677 void sub_4B1447_party_fine(int shopId, int stealingResult, int fineToAdd)
0
Ritor1
parents:
diff changeset
1678 {
Ritor1
parents:
diff changeset
1679 signed int v3; // esi@1
Ritor1
parents:
diff changeset
1680 DDM_DLV_Header *v7; // eax@14
Ritor1
parents:
diff changeset
1681
2246
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1682 if ( stealingResult == 0 || stealingResult == 1)
0
Ritor1
parents:
diff changeset
1683 {
2246
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1684 if ( pParty->uFine < 4000000 )
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1685 {
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1686 if ( fineToAdd + pParty->uFine < 0 )
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1687 pParty->uFine = 0;
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1688 else if ( fineToAdd + pParty->uFine > 4000000 )
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1689 pParty->uFine = 4000000;
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1690 else
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1691 pParty->uFine += fineToAdd;
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1692 }
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1693 if ( pParty->uFine )
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1694 {
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1695 for ( uint i = 1; i <= 4; ++i )
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1696 {
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1697 if ( !_449B57_test_bit(pPlayers[i]->_achieved_awards_bits, 1) )
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1698 _449B7E_toggle_bit(pPlayers[i]->_achieved_awards_bits, 1, 1);
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1699 }
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1700 }
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1701 if (stealingResult == 1)
1754
421c29d4ab3e UITransition.cpp cleaning(continue)
Ritor1
parents: 1747
diff changeset
1702 v3 = 2;
2246
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1703 else
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1704 v3 = 1;
0
Ritor1
parents:
diff changeset
1705 }
Ritor1
parents:
diff changeset
1706 else
2246
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1707 v3 = 2;
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1708 pParty->PartyTimes._shop_ban_times[shopId] = pParty->uTimePlayed + 368640;
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1709 pParty->InTheShopFlags[shopId] = 1;
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1710 v7 = &pOutdoor->ddm;
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1711 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1712 v7 = &pIndoor->dlv;
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1713 v7->uReputation += v3;
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1714 if ( v7->uReputation > 10000 )
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
1715 v7->uReputation = 10000;
0
Ritor1
parents:
diff changeset
1716 }
Ritor1
parents:
diff changeset
1717
Ritor1
parents:
diff changeset
1718
Ritor1
parents:
diff changeset
1719 //----- (004B1ECE) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
1720 void OracleDialogue()
0
Ritor1
parents:
diff changeset
1721 {
Ritor1
parents:
diff changeset
1722 __int16 *v0; // edi@1
Ritor1
parents:
diff changeset
1723 int v1; // ebx@3
Ritor1
parents:
diff changeset
1724 Player *v2; // esi@3
Ritor1
parents:
diff changeset
1725 int v3; // eax@4
Ritor1
parents:
diff changeset
1726 signed int v4; // eax@9
Ritor1
parents:
diff changeset
1727 int v5; // ebx@11
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
1728 Player *v6; // esi@13
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
1729 ItemGen *v7; // eax@14
0
Ritor1
parents:
diff changeset
1730 signed int v8; // edi@14
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
1731 ItemGen *v9; // [sp+Ch] [bp-Ch]@11
0
Ritor1
parents:
diff changeset
1732 signed int v10; // [sp+10h] [bp-8h]@13
Ritor1
parents:
diff changeset
1733 int v11; // [sp+14h] [bp-4h]@1
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
1734 Player *v12; // [sp+14h] [bp-4h]@11
0
Ritor1
parents:
diff changeset
1735
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
1736 contract_approved = 0;
0
Ritor1
parents:
diff changeset
1737 v11 = 0;
Ritor1
parents:
diff changeset
1738 uDialogueType = 84;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
1739 current_npc_text = (char *)pNPCTopics[667].pText;
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1740 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data();
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1741 //while ( 1 )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1742 for ( uint i = 0; i <= 53; i++ )
0
Ritor1
parents:
diff changeset
1743 {
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
1744 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) )
0
Ritor1
parents:
diff changeset
1745 {
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1746 //v1 = 0;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1747 //v2 = pParty->pPlayers.data();
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1748 for ( uint pl = 0; pl < 4; pl++ )
0
Ritor1
parents:
diff changeset
1749 {
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1750 //LOBYTE(v3) = pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0+1));
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1751 if ( pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0+1)) )
0
Ritor1
parents:
diff changeset
1752 break;
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1753 //++v2;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1754 //++v1;
0
Ritor1
parents:
diff changeset
1755 }
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1756 //while ( (signed int)v2 < (signed int)pParty->pHirelings.data() );
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1757 //if ( v1 == 4 )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1758 //break;
0
Ritor1
parents:
diff changeset
1759 }
Ritor1
parents:
diff changeset
1760 ++v11;
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1761 //v0 += 2;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1762 //if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1763 //break;
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
1764 }
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
1765 if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
1766 {
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
1767 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
1768 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
1769 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
1770 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4);
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
1771 }
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
1772 if ( contract_approved == 601 )
0
Ritor1
parents:
diff changeset
1773 {
Ritor1
parents:
diff changeset
1774 v5 = 0;
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1775 //v12 = pParty->pPlayers.data();//[0].uClass;
0
Ritor1
parents:
diff changeset
1776 v9 = 0;
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1777 //while ( 1 )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1778 for ( uint i = 0; i < 4; i++ )
0
Ritor1
parents:
diff changeset
1779 {
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1780 if ( pParty->pPlayers[i].classType == PLAYER_CLASS_LICH )
0
Ritor1
parents:
diff changeset
1781 {
Ritor1
parents:
diff changeset
1782 v10 = 0;
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1783 //v6 = pParty->pPlayers.data();//[0].pInventoryItems[0].field_1A;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1784 for ( uint pl = 0; pl < 4; pl++ )
0
Ritor1
parents:
diff changeset
1785 {
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1786 for ( v8 = 0; v8 < 126; v8++ )//138
0
Ritor1
parents:
diff changeset
1787 {
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1788 if ( pParty->pPlayers[pl].pInventoryItemList[v8].uItemID == ITEM_LICH_JAR_FULL )
0
Ritor1
parents:
diff changeset
1789 {
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1790 if ( !pParty->pPlayers[pl].pInventoryItemList[v8].uHolderPlayer )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1791 v9 = &pParty->pPlayers[pl].pInventoryItemList[v8];
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1792 if ( pParty->pPlayers[pl].pInventoryItemList[v8].uHolderPlayer == v5 )
0
Ritor1
parents:
diff changeset
1793 v10 = 1;
Ritor1
parents:
diff changeset
1794 }
Ritor1
parents:
diff changeset
1795 }
89
98cd93e14777 pointer fixes
zipi
parents: 87
diff changeset
1796 }
0
Ritor1
parents:
diff changeset
1797 if ( !v10 )
Ritor1
parents:
diff changeset
1798 break;
Ritor1
parents:
diff changeset
1799 }
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1800 // ++v12;
0
Ritor1
parents:
diff changeset
1801 ++v5;
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1802 // if ( v12 > &pParty->pPlayers[3] )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
1803 // return;
0
Ritor1
parents:
diff changeset
1804 }
Ritor1
parents:
diff changeset
1805 if ( v9 )
377
243418228760 GetIdentifiedName
Gloval
parents: 373
diff changeset
1806 v9->uHolderPlayer = v5;
0
Ritor1
parents:
diff changeset
1807 }
Ritor1
parents:
diff changeset
1808 }
Ritor1
parents:
diff changeset
1809
Ritor1
parents:
diff changeset
1810 //----- (004B254D) --------------------------------------------------------
2239
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
1811 const char * _4B254D_SkillMasteryTeacher(int trainerInfo)
0
Ritor1
parents:
diff changeset
1812 {
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1813 int teacherLevel; // edx@1
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1814 int skillBeingTaught; // ecx@1
955
Ritor1
parents: 917
diff changeset
1815 int pClassType; // eax@7
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1816 int currClassMaxMastery; // eax@7
2237
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1817 int pointsInSkillWOutMastery; // ebx@7
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1818 int classBaseId; // eax@8
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1819 unsigned int skillMastery; // eax@29
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1820 unsigned __int16 pointsInSkill; // [sp+1Ch] [bp-10h]@7
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1821 int masteryLevelBeingTaught; // [sp+24h] [bp-8h]@7
0
Ritor1
parents:
diff changeset
1822
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
1823 contract_approved = 0;
2239
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
1824 teacherLevel = (trainerInfo - 200) % 3;
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
1825 skillBeingTaught = (trainerInfo - 200) / 3;
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
1826 Player* activePlayer = pPlayers[uActiveCharacter];
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
1827 pClassType = activePlayer->classType;
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1828 currClassMaxMastery = byte_4ED970_skill_learn_ability_by_class_table[pClassType][skillBeingTaught];
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1829 masteryLevelBeingTaught = teacherLevel + 2;
2239
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
1830 dword_F8B1B0_MasteryBeingTaught = masteryLevelBeingTaught;
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1831 if ( currClassMaxMastery < masteryLevelBeingTaught )
0
Ritor1
parents:
diff changeset
1832 {
2237
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1833 classBaseId = pClassType - pClassType % 4;
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1834 if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 1][skillBeingTaught] >= masteryLevelBeingTaught)
2237
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1835 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 1]);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. You have to be promoted to %s to learn this skill level.
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1836 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 2][skillBeingTaught] >= masteryLevelBeingTaught
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1837 && byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 3][skillBeingTaught] >= masteryLevelBeingTaught)
2237
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1838 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[634], pClassNames[classBaseId + 2], pClassNames[classBaseId + 3]);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s èëè %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. You have to be promoted to %s or %s to learn this skill level.
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1839 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 2][skillBeingTaught] >= masteryLevelBeingTaught)
2237
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1840 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 2]);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. You have to be promoted to %s to learn this skill level.
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1841 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 3][skillBeingTaught] >= masteryLevelBeingTaught)
2237
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1842 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 3]);//Âû äîëæíû äîñòè÷ü çâàíèÿ %s äëÿ îáó÷åíèÿ ýòîìó óðîâíþ íàâûêà. You have to be promoted to %s to learn this skill level.
0
Ritor1
parents:
diff changeset
1843 else
2237
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1844 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Ýòîò óðîâåíü íàâûêà íå ìîæåò áûòü ïîñòèãíóò êëàññîì %s. This skill level can not be learned by the %s class.
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
1845 return pTmpBuf.data();
0
Ritor1
parents:
diff changeset
1846 }
2239
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
1847 if ( !activePlayer->CanAct() )
2237
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1848 return pNPCTopics[122].pText; //Not in your condition!
2239
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
1849 pointsInSkill = activePlayer->pActiveSkills[skillBeingTaught];
2237
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1850 pointsInSkillWOutMastery = pointsInSkill & 0x3F;
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1851 if ( !pointsInSkillWOutMastery )
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1852 return pNPCTopics[131].pText; //You must know the skill before you can become an expert in it!
d903816e972e _4B254D_SkillMasteryTeacher adding case, removing nested ifs, adding some comments
Grumpy7
parents: 2236
diff changeset
1853 skillMastery = SkillToMastery(pointsInSkill);
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1854 if ( (signed int)skillMastery > teacherLevel + 1 )
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1855 return pNPCTopics[teacherLevel + 128].pText; // You are already an SKILLLEVEL in this skill.
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1856 dword_F8B1AC_award_bit_number = skillBeingTaught;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1857 if ( masteryLevelBeingTaught == 2 && pointsInSkillWOutMastery < 4
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1858 || masteryLevelBeingTaught == 3 && pointsInSkillWOutMastery < 7
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1859 || masteryLevelBeingTaught == 4 && pointsInSkillWOutMastery < 10
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1860 )
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1861 return pNPCTopics[127].pText; //"You don't meet the requirements, and cannot be taught until you do."
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1862 switch (dword_F8B1AC_award_bit_number)
0
Ritor1
parents:
diff changeset
1863 {
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1864 case PLAYER_SKILL_STAFF:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1865 case PLAYER_SKILL_SWORD:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1866 case PLAYER_SKILL_DAGGER:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1867 case PLAYER_SKILL_AXE:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1868 case PLAYER_SKILL_SPEAR:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1869 case PLAYER_SKILL_BOW:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1870 case PLAYER_SKILL_MACE:
2240
1fc4223bddf6 dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents: 2239
diff changeset
1871 case PLAYER_SKILL_ARMSMASTER:
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1872 switch (masteryLevelBeingTaught)
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1873 {
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1874 case 2:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1875 gold_transaction_amount = 2000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1876 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1877 case 3:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1878 gold_transaction_amount = 5000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1879 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1880 case 4:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1881 gold_transaction_amount = 8000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1882 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1883 }
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1884 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1885 case PLAYER_SKILL_BLASTER:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1886 switch (masteryLevelBeingTaught)
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1887 {
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1888 case 2:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1889 gold_transaction_amount = 0;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1890 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1891 case 3:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1892 gold_transaction_amount = 0;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1893 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1894 case 4:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1895 gold_transaction_amount = 0;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1896 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1897 }
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1898 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1899 case PLAYER_SKILL_SHIELD:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1900 case PLAYER_SKILL_LEATHER:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1901 case PLAYER_SKILL_CHAIN:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1902 case PLAYER_SKILL_PLATE:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1903 switch (masteryLevelBeingTaught)
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1904 {
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1905 case 2:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1906 gold_transaction_amount = 1000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1907 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1908 case 3:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1909 gold_transaction_amount = 3000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1910 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1911 case 4:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1912 gold_transaction_amount = 7000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1913 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1914 }
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1915 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1916 case PLAYER_SKILL_FIRE:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1917 case PLAYER_SKILL_AIR:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1918 case PLAYER_SKILL_WATER:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1919 case PLAYER_SKILL_EARTH:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1920 case PLAYER_SKILL_SPIRIT:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1921 case PLAYER_SKILL_MIND:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1922 case PLAYER_SKILL_BODY:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1923 switch (masteryLevelBeingTaught)
0
Ritor1
parents:
diff changeset
1924 {
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1925 case 2:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1926 gold_transaction_amount = 1000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1927 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1928 case 3:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1929 gold_transaction_amount = 4000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1930 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1931 case 4:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1932 gold_transaction_amount = 8000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1933 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1934 }
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1935 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1936 case PLAYER_SKILL_LIGHT:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1937 switch (masteryLevelBeingTaught)
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1938 {
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1939 case 2:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1940 gold_transaction_amount = 2000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1941 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1942 case 3:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1943 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 114) )
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1944 return pNPCTopics[127].pText;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1945 gold_transaction_amount = 5000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1946 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1947 case 4:
2239
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
1948 if ( !activePlayer->ProfessionOrGuildFlagsCorrect(0x22u, 1) ||
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
1949 !activePlayer->ProfessionOrGuildFlagsCorrect(0x1Au, 1))
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1950 return pNPCTopics[127].pText;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1951 gold_transaction_amount = 8000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1952 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1953 }
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1954 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1955 case PLAYER_SKILL_DARK:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1956 switch (masteryLevelBeingTaught)
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1957 {
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1958 case 2:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1959 gold_transaction_amount = 2000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1960 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1961 case 3:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1962 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 110) )
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1963 return pNPCTopics[127].pText;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1964 gold_transaction_amount = 5000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1965 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1966 case 4:
2239
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
1967 if ( !activePlayer->ProfessionOrGuildFlagsCorrect(0x23u, 1)
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
1968 || !activePlayer->ProfessionOrGuildFlagsCorrect(0x1Bu, 1))
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1969 return pNPCTopics[127].pText;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1970 gold_transaction_amount = 8000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1971 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1972 }
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1973 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1974 case PLAYER_SKILL_ITEM_ID:
2240
1fc4223bddf6 dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents: 2239
diff changeset
1975 case PLAYER_SKILL_REPAIR:
1fc4223bddf6 dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents: 2239
diff changeset
1976 case PLAYER_SKILL_MEDITATION:
1fc4223bddf6 dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents: 2239
diff changeset
1977 case PLAYER_SKILL_PERCEPTION:
1fc4223bddf6 dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents: 2239
diff changeset
1978 case PLAYER_SKILL_TRAP_DISARM:
1fc4223bddf6 dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents: 2239
diff changeset
1979 case PLAYER_SKILL_MONSTER_ID:
1fc4223bddf6 dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents: 2239
diff changeset
1980 case PLAYER_SKILL_STEALING:
1fc4223bddf6 dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents: 2239
diff changeset
1981 case PLAYER_SKILL_ALCHEMY:
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1982 switch (masteryLevelBeingTaught)
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1983 {
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1984 case 2:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1985 gold_transaction_amount = 500;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1986 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1987 case 3:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1988 gold_transaction_amount = 2500;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1989 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1990 case 4:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1991 gold_transaction_amount = 6000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1992 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1993 }
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1994 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1995 case PLAYER_SKILL_MERCHANT:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1996 switch (masteryLevelBeingTaught)
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1997 {
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1998 case 2:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
1999 gold_transaction_amount = 2000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2000 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2001 case 3:
2239
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
2002 if ( activePlayer->GetBaseWillpower() < 50 )
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2003 return pNPCTopics[127].pText;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2004 gold_transaction_amount = 5000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2005 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2006 case 4:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2007 gold_transaction_amount = 8000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2008 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2009 }
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2010 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2011 case PLAYER_SKILL_BODYBUILDING:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2012 switch (masteryLevelBeingTaught)
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2013 {
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2014 case 2:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2015 gold_transaction_amount = 500;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2016 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2017 case 3:
2239
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
2018 if ( activePlayer->GetBaseEndurance() < 50 )
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2019 return pNPCTopics[127].pText;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2020 gold_transaction_amount = 2500;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2021 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2022 case 4:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2023 gold_transaction_amount = 6000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2024 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2025 }
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2026 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2027 case PLAYER_SKILL_DIPLOMACY:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2028 Error("Diplomacy not used");
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2029 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2030 case PLAYER_SKILL_TIEVERY:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2031 Error("Thievery not used");
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2032 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2033 case PLAYER_SKILL_DODGE:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2034 switch (masteryLevelBeingTaught)
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2035 {
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2036 case 2:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2037 gold_transaction_amount = 2000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2038 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2039 case 3:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2040 gold_transaction_amount = 5000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2041 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2042 case 4:
2239
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
2043 if ( (activePlayer->pActiveSkills[PLAYER_SKILL_UNARMED] & 63) < 0xA )
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2044 return pNPCTopics[127].pText;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2045 gold_transaction_amount = 8000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2046 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2047 }
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2048 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2049 case PLAYER_SKILL_UNARMED:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2050 switch (masteryLevelBeingTaught)
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2051 {
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2052 case 2:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2053 gold_transaction_amount = 2000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2054 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2055 case 3:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2056 gold_transaction_amount = 5000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2057 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2058 case 4:
2239
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
2059 if ( (activePlayer->pActiveSkills[PLAYER_SKILL_DODGE] & 63) < 0xA )
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2060 return pNPCTopics[127].pText;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2061 gold_transaction_amount = 8000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2062 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2063 }
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2064 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2065 case PLAYER_SKILL_LEARNING:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2066 switch (masteryLevelBeingTaught)
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2067 {
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2068 case 2:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2069 gold_transaction_amount = 2000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2070 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2071 case 3:
2239
699bd6ee5ad0 dword_F8B1B0 to dword_F8B1B0_MasteryBeingTaught, some final touches to _4B254D_SkillMasteryTeacher
Grumpy7
parents: 2238
diff changeset
2072 if ( activePlayer->GetBaseIntelligence() < 50 )
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2073 return pNPCTopics[127].pText;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2074 gold_transaction_amount = 5000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2075 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2076 case 4:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2077 gold_transaction_amount = 8000;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2078 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2079 }
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2080 break;
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2081 default:
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2082 Error("Unknown skill");
955
Ritor1
parents: 917
diff changeset
2083 }
267
ac44e716d051 DrawDialogueUI logic restored
Nomad
parents: 264
diff changeset
2084 if ( gold_transaction_amount > pParty->uNumGold )
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2085 return pNPCTopics[124].pText; //You don't have enough gold!
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
2086 contract_approved = 1;
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2087 if ( masteryLevelBeingTaught == 2 )
0
Ritor1
parents:
diff changeset
2088 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2089 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//Ïîëó÷èòü ñòåïåíü ^Pr[%s] â íàâûêå ^Pr[%s] çà ^I[%lu] çîëîò^L[îé;ûõ;ûõ]
955
Ritor1
parents: 917
diff changeset
2090 pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ýêñïåðò
0
Ritor1
parents:
diff changeset
2091 }
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2092 if ( masteryLevelBeingTaught == 3 )
0
Ritor1
parents:
diff changeset
2093 {
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2094 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
955
Ritor1
parents: 917
diff changeset
2095 pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Ìàñòåð
0
Ritor1
parents:
diff changeset
2096 }
2238
f66d8be6ad5b _4B254D_SkillMasteryTeacher unrolling switches
Grumpy7
parents: 2237
diff changeset
2097 if ( masteryLevelBeingTaught == 4 )
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2098 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
955
Ritor1
parents: 917
diff changeset
2099 pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Âåëèêèé Ìàãèñòð
1205
8c02e6f74b29 arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents: 1202
diff changeset
2100 return pTmpBuf2.data();
0
Ritor1
parents:
diff changeset
2101 }
Ritor1
parents:
diff changeset
2102
Ritor1
parents:
diff changeset
2103 //----- (004B3E1E) --------------------------------------------------------
1458
934074e7fcc1 ModalWindow
Nomad
parents: 1453
diff changeset
2104 void sub_4B3E1E()
0
Ritor1
parents:
diff changeset
2105 {
Ritor1
parents:
diff changeset
2106 NPCData *v0; // ST40_4@1
Ritor1
parents:
diff changeset
2107 signed int v1; // edi@1
165
Ritor1
parents: 152
diff changeset
2108 //GUIWindow *v2; // ecx@1
0
Ritor1
parents:
diff changeset
2109
167
90521fb9766c NPCDialogue fix
Ritor1
parents: 165
diff changeset
2110 __debugbreak();
602
628694cd5744 Margaret working
zipi
parents: 569
diff changeset
2111 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID);
0
Ritor1
parents:
diff changeset
2112 v1 = 0;
Ritor1
parents:
diff changeset
2113 pDialogueWindow->eWindowType = WINDOW_MainMenu;
Ritor1
parents:
diff changeset
2114 pDialogueWindow->Release();
2215
e9625ad08541 fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents: 2197
diff changeset
2115 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Dialogue, 1, 0);
291
0ea5fbd16edb NPC mostly done
Gloval
parents: 290
diff changeset
2116 if ( pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) )
0
Ritor1
parents:
diff changeset
2117 {
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2118 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0);
0
Ritor1
parents:
diff changeset
2119 v1 = 1;
Ritor1
parents:
diff changeset
2120 }
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2121 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
2122 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1);
0
Ritor1
parents:
diff changeset
2123 }
Ritor1
parents:
diff changeset
2124
Ritor1
parents:
diff changeset
2125
Ritor1
parents:
diff changeset
2126 //----- (004B3FE5) --------------------------------------------------------
2246
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
2127 //Originally called _4B254D_SkillMasteryTeacher to have contract_approved assigned, to be able to set some button name.
0be4f17b7986 shop stealing cleaned up a bit
Grumpy7
parents: 2241
diff changeset
2128 //But it the name gets immediately overwritten
2240
1fc4223bddf6 dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents: 2239
diff changeset
2129 void _4B3FE5_training_dialogue(int a4)
0
Ritor1
parents:
diff changeset
2130 {
1838
211dfe2d8db1 changing global char* vars to const char* vars
Grumpy7
parents: 1828
diff changeset
2131 const char *v2; // edi@1
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2132
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2241
diff changeset
2133 //__debugbreak();
2240
1fc4223bddf6 dword_F8B1B0_MasteryBeingTaught removing redundant case bodies
Grumpy7
parents: 2239
diff changeset
2134 uDialogueType = DIALOGUE_SKILL_TRAINER;
827
085eb19b7ffd mr.Malvik
Ritor1
parents: 823
diff changeset
2135 current_npc_text = (char *)pNPCTopics[a4 + 168].pText;
2241
9df0477a5e2b restoring deleted line in mm7_4.cpp
Grumpy7
parents: 2240
diff changeset
2136 _4B254D_SkillMasteryTeacher(a4); //might be needed because of contract_approved ?
0
Ritor1
parents:
diff changeset
2137 pDialogueWindow->Release();
2215
e9625ad08541 fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents: 2197
diff changeset
2138 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 350, WINDOW_MainMenu, a4, 0);
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2139 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0,
948
5a2dbb00c399 Code cleaning.
Nomad
parents: 940
diff changeset
2140 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
832
dfd683c4f538 Hotkeys fixed
Nomad
parents: 830
diff changeset
2141 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2142 v2 = "";
484
4bd56919f075 avard quest guild bits
Gloval
parents: 481
diff changeset
2143 if ( contract_approved )
0
Ritor1
parents:
diff changeset
2144 v2 = pGlobalTXT_LocalizationStrings[535];
2245
8817c398b792 for RasterLine2D
Ritor1
parents: 2241
diff changeset
2145 pDialogueWindow->CreateButton(480, 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0);
972
c8a0f6d89c70 Some inqury on selecting Knight bug.
Nomad
parents: 964
diff changeset
2146 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2);
747
585490c29945 House dialogue ids appended
Nomad
parents: 746
diff changeset
2147 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
0
Ritor1
parents:
diff changeset
2148 }
Ritor1
parents:
diff changeset
2149 // F8B19C: using guessed type int dword_F8B19C;
Ritor1
parents:
diff changeset
2150 // F8B1A8: using guessed type int dword_F8B1A8;
Ritor1
parents:
diff changeset
2151
Ritor1
parents:
diff changeset
2152 //----- (004B46A5) --------------------------------------------------------
1006
e865f349aa41 ui cleanup
Gloval
parents: 990
diff changeset
2153 void __fastcall DrawTextAtStatusBar( const char *Str, int a5 )
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
2154 {
471
c43f156a95c9 ArmorShopDialog crash fixed. All shops show its items
Gloval
parents: 470
diff changeset
2155 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar);
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2156 pPrimaryWindow->DrawText(pFontLucida, pFontLucida->AlignText_Center(450, Str) + 11, 357, a5, Str, 0, 0, 0);
0
Ritor1
parents:
diff changeset
2157 }
Ritor1
parents:
diff changeset
2158
Ritor1
parents:
diff changeset
2159 //----- (004B46F8) --------------------------------------------------------
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
2160 __int64 GetExperienceRequiredForLevel(int level)
0
Ritor1
parents:
diff changeset
2161 {
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
2162 __int64 v1; // eax@1
0
Ritor1
parents:
diff changeset
2163 int i; // edx@1
Ritor1
parents:
diff changeset
2164
Ritor1
parents:
diff changeset
2165 v1 = 0;
1459
2ca62c9e7b3c Function names
Nomad
parents: 1458
diff changeset
2166 for ( i = 0; i < level; ++i )
0
Ritor1
parents:
diff changeset
2167 v1 += i + 1;
Ritor1
parents:
diff changeset
2168 return 1000 * v1;
Ritor1
parents:
diff changeset
2169 }
Ritor1
parents:
diff changeset
2170
Ritor1
parents:
diff changeset
2171 //----- (004BC49B) --------------------------------------------------------
651
2bf48d11d742 Training hall UI fixed
Nomad
parents: 648
diff changeset
2172 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType)
652
1ff57450f090 * Some fixes to TravelByTransport
Nomad
parents: 651
diff changeset
2173 {
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2174 NPCData *speakingNPC; // ebp@1
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2175 int npc_event_id; // ecx@10
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2176 char *v13; // [sp-8h] [bp-18h]@60
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
2177
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2178 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID);
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2179 uDialogueType = newDialogueType;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2180 if (!speakingNPC->uFlags)
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2181 speakingNPC->uFlags = 1;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2182 if(newDialogueType == DIALOGUE_PROFESSION_DETAILS)
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2183 dialogue_show_profession_details = ~dialogue_show_profession_details;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2184 else if(newDialogueType == DIALOGUE_76)
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2185 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2186 if (speakingNPC->Hired())
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2187 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2188 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2189 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2190 for ( uint i = 0; i < (unsigned int)pNPCStats->uNumNewNPCs; ++i )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2191 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2192 if ( pNPCStats->pNewNPCData[i].uFlags & 0x80 && !strcmp(speakingNPC->pName, pNPCStats->pNewNPCData[i].pName) )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2193 pNPCStats->pNewNPCData[i].uFlags &= 0x7Fu;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2194 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2195 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2196 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2197 memset(&pParty->pHirelings[0], 0, sizeof(NPCData));
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2198 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2199 memset(&pParty->pHirelings[1], 0, sizeof(NPCData));
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2200 pParty->hirelingScrollPosition = 0;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2201 pParty->CountHirelings();
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2202 dword_591084 = 0;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2203 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2204 dword_7241C8 = 0;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2205 return;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2206 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2207 if ( pParty->pHirelings[0].pName && pParty->pHirelings[1].pName )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2208 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full""
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2209 else
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2210 {
2115
90cc547a7927 Fixing hireling prices
Grumpy7
parents: 2103
diff changeset
2211 if ( speakingNPC->uProfession != 51 ) //burglars have no hiring price
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2212 {
2115
90cc547a7927 Fixing hireling prices
Grumpy7
parents: 2103
diff changeset
2213 if ( pParty->uNumGold < pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice )
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2214 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2215 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2216 dialogue_show_profession_details = false;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2217 uDialogueType = 13;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2218 if ( uActiveCharacter )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2219 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2220 if ( !dword_7241C8 )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2221 pGame->Draw();
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2222 dword_7241C8 = 0;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2223 return;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2224 }
2115
90cc547a7927 Fixing hireling prices
Grumpy7
parents: 2103
diff changeset
2225 Party::TakeGold(pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice);
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2226 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2227 LOBYTE(speakingNPC->uFlags) |= 0x80u;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2228 if ( pParty->pHirelings[0].pName )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2229 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2230 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1]));
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2231 v13 = pParty->pHireling2Name;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2232 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2233 else
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2234 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2235 memcpy(&pParty->pHirelings[0], speakingNPC, sizeof(pParty->pHirelings[0]));
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2236 v13 = pParty->pHireling1Name;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2237 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2238 strcpy(v13, speakingNPC->pName);
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2239 pParty->hirelingScrollPosition = 0;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2240 pParty->CountHirelings();
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2241 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2242 if ( sDialogue_SpeakingActorNPC_ID >= 0 )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2243 pDialogue_SpeakingActor->uAIState = Removed;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2244 if ( uActiveCharacter )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2245 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0);
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2246 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2247 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2248 else if ( (signed int)newDialogueType > DIALOGUE_84 && (signed int)newDialogueType <= DIALOGUE_ARENA_SELECT_CHAMPION ) //âûáîð óðîâíÿ ñëîæíîñòè áîÿ
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2249 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2250 ArenaFight();
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2251 return;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2252 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2253 else if(newDialogueType == DIALOGUE_USE_NPC_ABILITY)
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2254 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2255 if (UseNPCSkill((NPCProf)speakingNPC->uProfession) == 0)
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2256 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2257 if ( speakingNPC->uProfession != GateMaster )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2258 speakingNPC->bHasUsedTheAbility = 1;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2259 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2260 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2261 else
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2262 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2); //"Your packs are already full!"
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2263 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2264 else if(newDialogueType == DIALOGUE_13)
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2265 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2266 if (!speakingNPC->Hired())
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2267 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2268 sub_4B3E1E();
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2269 dialogue_show_profession_details = false;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2270 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2271 else
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2272 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2273 for ( uint i = 0; i < (signed int)pNPCStats->uNumNewNPCs; ++i )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2274 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2275 if ( pNPCStats->pNewNPCData[i].uFlags & 0x80 && !strcmp(speakingNPC->pName, pNPCStats->pNewNPCData[i].pName) )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2276 pNPCStats->pNewNPCData[i].uFlags &= 0x7Fu;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2277 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2278 if ( pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName) )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2279 memset(&pParty->pHirelings[0], 0, sizeof(NPCData));
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2280 else if ( pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName) )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2281 memset(&pParty->pHirelings[1], 0, sizeof(NPCData));
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2282 pParty->hirelingScrollPosition = 0;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2283 pParty->CountHirelings();
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2284 dword_591084 = 0;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2285 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2286 dword_7241C8 = 0;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2287 return;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2288 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2289 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2290 else if(newDialogueType >= DIALOGUE_EVT_A && newDialogueType <= DIALOGUE_EVT_F)
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2291 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2292 switch(newDialogueType)
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2293 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2294 case DIALOGUE_EVT_A: npc_event_id = speakingNPC->evt_A; break;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2295 case DIALOGUE_EVT_B: npc_event_id = speakingNPC->evt_B; break;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2296 case DIALOGUE_EVT_C: npc_event_id = speakingNPC->evt_C; break;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2297 case DIALOGUE_EVT_D: npc_event_id = speakingNPC->evt_D; break;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2298 case DIALOGUE_EVT_E: npc_event_id = speakingNPC->evt_E; break;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2299 case DIALOGUE_EVT_F: npc_event_id = speakingNPC->evt_F; break;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2300 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2301 if ( (npc_event_id >= 200) && (npc_event_id <= 310) )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2302 _4B3FE5_training_dialogue(npc_event_id); //200-310
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2303 else if (( npc_event_id >= 400) && (npc_event_id <= 410) )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2304 { //400-410
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2305 dword_F8B1D8 = newDialogueType;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2306 DrawJoinGuildWindow(npc_event_id - 400);
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2307 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2308 else
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2309 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2310 switch ( npc_event_id )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2311 {
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2312 case 139:
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2313 OracleDialogue();
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2314 break;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2315 case 311:
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2316 CheckBountyRespawnAndAward();
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2317 break;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2318 case 399:
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2319 Arena_SelectionFightLevel();
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2320 break;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2321 default:
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2322 activeLevelDecoration = (LevelDecoration*)1;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2323 current_npc_text = 0;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2324 EventProcessor(npc_event_id, 0, 1);
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2325 activeLevelDecoration = NULL;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2326 break;
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2327 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2328 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2329 }
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2330 if ( !dword_7241C8 )
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2331 pGame->Draw();
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2086
diff changeset
2332 dword_7241C8 = 0;
656
6abf5b610585 OnSelectNPCDialogueOption clean
zipi
parents: 655
diff changeset
2333 }
0
Ritor1
parents:
diff changeset
2334
Ritor1
parents:
diff changeset
2335 //----- (004BDAAF) --------------------------------------------------------
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2044
diff changeset
2336 bool MerchandiseTest(ItemGen *item, int _2da_idx)
0
Ritor1
parents:
diff changeset
2337 {
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
2338 bool test;
0
Ritor1
parents:
diff changeset
2339
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2340 if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771)
1567
9f8b3e904e14 Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents: 1546
diff changeset
2341 && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->IsStolen())
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2044
diff changeset
2342 return false;
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2343 switch( p2DEvents[_2da_idx - 1].uType )
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2344 {
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
2345 case BuildingType_WeaponShop:
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2346 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2044
diff changeset
2347 test = item->GetItemEquipType() <= EQUIP_BOW;
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2348 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2349 }
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
2350 case BuildingType_ArmorShop:
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2351 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2044
diff changeset
2352 test = item->GetItemEquipType() >= EQUIP_ARMOUR && item->GetItemEquipType() <= EQUIP_BOOTS;
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2353 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2354 }
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
2355 case BuildingType_MagicShop:
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2356 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2044
diff changeset
2357 test = item->GetPlayerSkillType() == PLAYER_SKILL_MISC || item->GetItemEquipType() == EQIUP_ANY;
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2358 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2359 }
1411
2423bc2af692 +InitializaDialogueOptions
Nomad
parents: 1410
diff changeset
2360 case BuildingType_AlchemistShop:
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2361 {
2059
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2044
diff changeset
2362 test = item->GetItemEquipType() == EQUIP_REAGENT || item->GetItemEquipType() == EQUIP_POTION
f9698295c0bd AttackerInfo, MerchandiseTest
Ritor1
parents: 2044
diff changeset
2363 || (item->GetItemEquipType() > EQUIP_POTION && !(item->GetItemEquipType() != EQUIP_MESSAGE_SCROLL
907
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2364 || (signed int)item->uItemID < 740) && item->uItemID != 771);
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2365 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2366 }
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2367 default:
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2368 {
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2369 test = false;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2370 break;
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2371 }
f3ccfc765502 RentRoom
Ritor1
parents: 898
diff changeset
2372 }
702
efde64b3e147 sub_4BDAAF clean
zipi
parents: 701
diff changeset
2373 return test;
2235
6ab7d7c112bb adding int_get_vector_length calls where the calls were inlined
Grumpy7
parents: 2233
diff changeset
2374 }