annotate Engine/Events.cpp @ 2553:48708da03b7f

Party Creation UI logic separated from MainMenu
author a.parshin
date Wed, 13 May 2015 02:20:05 +0200
parents e06a3fe9ad6e
children 30eb6dcac768
rev   line source
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1 #define _CRTDBG_MAP_ALLOC
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2 #include <stdlib.h>
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3 #include <crtdbg.h>
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
7 #include "Engine/Engine.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
8
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
9 #include "Graphics/Weather.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
10 #include "Graphics/Texture.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
11 #include "MapInfo.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
12 #include "Graphics/Render.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
13 #include "Objects/SpriteObject.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
14 #include "Objects/Chest.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
15 #include "MapsLongTimer.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
16 #include "LOD.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
17 #include "Objects/Actor.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
18 #include "Party.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
19 #include "OurMath.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
20 #include "Graphics/Indoor.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
21 #include "Graphics/Viewport.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
22 #include "texts.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
23 #include "stru123.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
24 #include "stru159.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
25 #include "Events.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
26 #include "Events2D.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
27 #include "Graphics/Level/Decoration.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
28 #include "LuaVM.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
29 #include "Graphics/DecorationList.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
30
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
31 #include "IO/Mouse.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
32
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
33 #include "GUI/UI/UITransition.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
34 #include "GUI/GUIProgressBar.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
35 #include "GUI/UI/UIHouses.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
36
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
37 #include "Media/Audio/AudioPlayer.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
38 #include "Media/MediaPlayer.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
39
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
40 std::array<EventIndex, 4400> pSomeOtherEVT_Events;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
41 signed int uSomeOtherEVT_NumEvents;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
42 char *pSomeOtherEVT;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
43 std::array<EventIndex, 4400> pSomeEVT_Events;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
44 signed int uSomeEVT_NumEvents;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
45 char *pSomeEVT;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
46
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
47 unsigned int uGlobalEVT_NumEvents;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
48 unsigned int uGlobalEVT_Size;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
49 std::array<char, 46080> pGlobalEVT;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
50 std::array<EventIndex, 4400> pGlobalEVT_Index;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
51
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
52 std::array<unsigned int, 500> pLevelStrOffsets;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
53 unsigned int uLevelStrNumStrings;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
54 unsigned int uLevelStrFileSize;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
55 signed int uLevelEVT_NumEvents;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
56 unsigned int uLevelEVT_Size;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
57 std::array<char, 9216> pLevelStr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
58 std::array<char, 9216> pLevelEVT;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
59 std::array<EventIndex, 4400> pLevelEVT_Index;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
60
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
61 _2devent p2DEvents[525];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
62
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
63
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
64
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
65 //----- (00443CE1) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
66 unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
67 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
68 FILE *pLodFile; // eax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
69 unsigned int uTextureSize; // esi@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
70 //char Args[60]; // [sp+8h] [bp-B4h]@6
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
71 void *ptr; // [sp+B8h] [bp-4h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
72 Texture DstBuf; // [sp+6Ch] [bp-50h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
73
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
74 ptr = pEvents_LOD->LoadRaw(pContainerName, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
75 pLodFile = pEvents_LOD->FindContainer(pContainerName, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
76 if ( !pLodFile )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
77 Error("Unable to load %s", pContainerName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
78
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
79 fread(&DstBuf, 1, 48, pLodFile);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
80 uTextureSize = DstBuf.uDecompressedSize;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
81 if ( !DstBuf.uDecompressedSize )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
82 uTextureSize = DstBuf.uTextureSize;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
83 memset(&DstBuf, 0, 72);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
84 if ( uTextureSize >= (signed int)uBufferSize )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
85 Error("File %s Size %lu - Buffer size %lu", pContainerName, uTextureSize, uBufferSize);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
86
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
87 memcpy(pBuffer, ptr, uTextureSize);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
88 free(ptr);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
89 return uTextureSize;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
90 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
91
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
92 //----- (00443DA1) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
93 void Initialize_GlobalEVT()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
94 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
95 struct raw_event_header
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
96 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
97 unsigned char evt_size;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
98 unsigned char evt_id_l;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
99 unsigned char evt_id_h;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
100 unsigned char evt_sequence_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
101 } ;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
102 uint events_count;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
103 unsigned int offset_in;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
104 raw_event_header *current_hdr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
105 uGlobalEVT_NumEvents = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
106 uGlobalEVT_Size = LoadEventsToBuffer("global.evt", pGlobalEVT.data(), 46080);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
107 if ( !uGlobalEVT_Size )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
108 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
109 memset(pGlobalEVT_Index.data(), 0x80, sizeof(pGlobalEVT_Index));//52800
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
110 events_count = uGlobalEVT_NumEvents;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
111 current_hdr=(raw_event_header *)pGlobalEVT.data();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
112 offset_in=0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
113 for (events_count = 0, offset_in = 0; offset_in < uGlobalEVT_Size; ++events_count)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
114 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
115 pGlobalEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
116 pGlobalEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
117 pGlobalEVT_Index[events_count].uEventOffsetInEVT=offset_in;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
118 offset_in+=current_hdr->evt_size+1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
119
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
120 current_hdr=(raw_event_header *)&pGlobalEVT[offset_in];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
121 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
122 uGlobalEVT_NumEvents = events_count;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
123
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
124 assert(uGlobalEVT_NumEvents < 4400);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
125 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
126
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
127
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
128
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
129 //----- (00443EF8) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
130 void LoadLevel_InitializeLevelEvt()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
131 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
132 struct raw_event_header
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
133 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
134 unsigned char evt_size;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
135 unsigned char evt_id_l;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
136 unsigned char evt_id_h;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
137 unsigned char evt_sequence_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
138 } ;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
139 uint events_count;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
140 unsigned int offset_in;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
141 raw_event_header *current_hdr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
142
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
143 if (!uLevelEVT_Size)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
144 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
145
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
146 memset(MapsLongTimersList, 0, 3200);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
147 memset(pLevelEVT_Index.data(), 80, sizeof(EventIndex)*4400);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
148
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
149 uLevelEVT_NumEvents = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
150 MapsLongTimers_count = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
151
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
152 current_hdr=(raw_event_header *)pLevelEVT.data();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
153 offset_in=0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
154 for (events_count = 0, offset_in = 0; offset_in < uLevelEVT_Size; ++events_count)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
155 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
156 pLevelEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
157 pLevelEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
158 pLevelEVT_Index[events_count].uEventOffsetInEVT=offset_in;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
159 offset_in+=current_hdr->evt_size+1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
160
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
161 current_hdr=(raw_event_header *)&pLevelEVT[offset_in];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
162 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
163 uLevelEVT_NumEvents = events_count;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
164
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
165 /*
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
166 EmeraldIsle::Variables:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
167 [0] ???
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
168 [1] ???
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
169 [2] Luck Fountain uses left
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
170 [3] Gold Fountain used this week
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
171 [4] Gold Fountain total uses
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
172
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
173
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
174 Emerald Isle #110 // Fire Resistance fountain
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
175 0 LocationName
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
176 0 if (Player.FireResistance < 50)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
177 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
178 1 Set(Player.FireResistance, 50)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
179 2 SetFooterString(22) // +50 Fire Resistance (temporarily)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
180 3 Add(Party.Autonotes, 2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
181 4 goto return
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
182 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
183 5 SetFooterString(11) // Refreshing!
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
184 6 return
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
185
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
186
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
187
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
188 Emerald Isle #111 // ???
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
189 Initialize
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
190 Set(Map.Variables[0], 30)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
191 Set(Map.Variables[1], 30)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
192
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
193
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
194 Emerald Isle #114 // month timer - manage luck fountain
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
195 0 LocationName
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
196 0 if (Player.BaseLuck >= 15)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
197 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
198 2 SetFooterString(11) // Refreshing!
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
199 3 return
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
200 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
201 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
202 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
203 1 if (Map.Variables[2] >= 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
204 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
205 4 Sub(Map.Variables[2], 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
206 5 Add(Player.BaseLuck, 2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
207 6 SetFooterString(25) // +2 Luck (Permament)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
208 7 return
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
209 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
210 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
211 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
212 2 SetFooterString(11) // Refreshing!
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
213 3 return
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
214 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
215 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
216
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
217 8 Initialize
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
218 9 Set Map.Variables[2], 8
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
219
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
220
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
221
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
222 Emerald Isle #115 // week timer - gold fountain in the center of town
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
223 0 LocationName
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
224 0 if (Map.Variables[4] < 3)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
225 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
226 1 if (Map.Variables[3] == 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
227 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
228 2 if (Party.Gold < 201)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
229 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
230 3 if (Player.BaseLuck >= 15)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
231 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
232 5 Add(Map.Variables[3], 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
233 6 Add(Party.Gold, 1000)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
234 7 Add(Map.Variables[4], 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
235 8 goto return
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
236 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
237 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
238 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
239 4 goto 9
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
240 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
241 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
242 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
243 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
244 9 SetFooterString(11) // Refreshing!
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
245 10 return
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
246
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
247 11 Initialize
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
248 12 Set(Map.Variables[3], 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
249
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
250
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
251
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
252
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
253
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
254 Emerald Isle #220 // day timer - monster spawner
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
255 0 LocationName
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
256 0 Initialize
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
257 1 if (NumAliveActors(group=20) != 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
258 2 return
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
259 3 SpawnMonsters(1, level=1, count=10, x=-336, y=14512, z=0, group=20)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
260 4 SpawnMonsters(1, level=2, count=5, x=16, y=16352, z=90, group=20)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
261 5 SpawnMonsters(1, level=1, count=10, x=480, y=18288, z=6, group=20)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
262
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
263
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
264
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
265 Emerald Isle #200 // margareth dock tip
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
266 0 if (!QBits.QuestDone[17])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
267 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
268 1 InitiateNPCDialogue(npc=19)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
269 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
270 2 return
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
271
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
272
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
273 Emerald Isle #201 // margareth armoury tip
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
274 0 if (!QBits.QuestDone[17])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
275 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
276 1 InitiateNPCDialogue(npc=20)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
277 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
278 2 return
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
279 */
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
280 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
281
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
282
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
283 //----- (0044684A) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
284 void EventProcessor(int uEventID, int targetObj, int canShowMessages, int entry_line)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
285 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
286 signed int v4; // esi@7
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
287 int v11; // eax@14
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
288 char *v12; // eax@15
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
289 const char *v16; // esi@21
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
290 bool v17; // edx@21
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
291 int v18; // ecx@22
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
292 int v19; // ebp@36
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
293 signed int v20; // ecx@40
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
294 int v21; // eax@40
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
295 int v22; // edx@40
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
296 int v23; // eax@40
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
297 unsigned __int16 v24; // ax@45
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
298 LevelDecoration *v26; // eax@55
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
299 int v27; // eax@57
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
300 int pEventID; // eax@58
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
301 int pNPC_ID; // ecx@58
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
302 int pIndex; // esi@58
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
303 NPCData *pNPC; // ecx@58
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
304 int v38; // eax@78
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
305 int v39; // ecx@78
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
306 int v42; // eax@84
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
307 int v43; // ecx@84
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
308 GUIButton *v48; // ecx@93
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
309 GUIButton *v49; // esi@94
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
310 signed int pValue; // ebp@124
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
311 Player *pPlayer; // esi@125
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
312 int v83; // eax@212
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
313 int v84; // ebp@220
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
314 int v90; // eax@243
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
315 const char *v91; // ecx@247
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
316 int v94; // ecx@262
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
317 int v95; // ebp@262
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
318 int v96; // edx@262
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
319 int v97; // eax@262
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
320 unsigned int v98; // edx@265
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
321 const char *v99; // esi@267
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
322 int v100; // edx@267
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
323 unsigned int v102; // esi@281
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
324 int v104; // eax@288
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
325 int v106; // [sp-20h] [bp-4C8h]@278
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
326 signed int v109; // [sp-14h] [bp-4BCh]@278
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
327 signed int v110; // [sp-10h] [bp-4B8h]@278
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
328 int curr_seq_num; // [sp+10h] [bp-498h]@4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
329 int v126; // [sp+1Ch] [bp-48Ch]@262
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
330 int player_choose; // [sp+20h] [bp-488h]@4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
331 int v128; // [sp+24h] [bp-484h]@21
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
332 int v129; // [sp+24h] [bp-484h]@262
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
333 signed int v130; // [sp+28h] [bp-480h]@0
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
334 int v132; // [sp+30h] [bp-478h]@262
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
335 signed int v133; // [sp+34h] [bp-474h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
336 int v134; // [sp+38h] [bp-470h]@262
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
337 int v135; // [sp+3Ch] [bp-46Ch]@262
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
338 int v136; // [sp+40h] [bp-468h]@40
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
339 int v137; // [sp+44h] [bp-464h]@40
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
340 int v138; // [sp+48h] [bp-460h]@40
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
341 int v139; // [sp+4Ch] [bp-45Ch]@40
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
342 ItemGen item; // [sp+50h] [bp-458h]@15
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
343 char Source[120]; // [sp+74h] [bp-434h]@15
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
344 char Str[120]; // [sp+ECh] [bp-3BCh]@21
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
345 Actor Dst; // [sp+164h] [bp-344h]@53
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
346
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
347 v133 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
348 EvtTargetObj = targetObj;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
349 dword_5B65C4_cancelEventProcessing = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
350 if ( uEventID == 114 )//for test script
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
351 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
352 if (!lua->DoFile("out01.lua"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
353 Log::Warning(L"Error opening out01.lua\n");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
354 Log::Warning(L"being tested that well\n");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
355 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
356 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
357 if ( !uEventID )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
358 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
359 if ( !GameUI_Footer_TimeLeft )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
360 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
361 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
362 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
363 player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
364 curr_seq_num = entry_line;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
365
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
366 if ( activeLevelDecoration )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
367 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
368 uSomeEVT_NumEvents = uGlobalEVT_NumEvents;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
369 pSomeEVT = pGlobalEVT.data();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
370 memcpy(pSomeEVT_Events.data(), pGlobalEVT_Index.data(), sizeof(EventIndex)*4400); //4400 evts
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
371 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
372 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
373 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
374 uSomeEVT_NumEvents = uLevelEVT_NumEvents;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
375 pSomeEVT = pLevelEVT.data();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
376 memcpy(pSomeEVT_Events.data(), pLevelEVT_Index.data(), sizeof(EventIndex)*4400);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
377 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
378
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
379 for ( v4 = 0; v4 < uSomeEVT_NumEvents; ++v4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
380 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
381 if ( dword_5B65C4_cancelEventProcessing )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
382 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
383 if ( v133 == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
384 OnMapLeave();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
385 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
386 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
387 if ( pSomeEVT_Events[v4].uEventID == uEventID && pSomeEVT_Events[v4].event_sequence_num == curr_seq_num )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
388 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
389 _evt_raw * _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[v4].uEventOffsetInEVT);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
390
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
391 switch (_evt->_e_type)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
392 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
393 case EVENT_CheckSeason:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
394 if ( !sub_4465DF_check_season(_evt->v5) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
395 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
396 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
397 //v4 = v124;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
398 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
399 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
400 v4 = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
401 curr_seq_num = _evt->v6 - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
402 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
403 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
404 case EVENT_ShowMovie:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
405 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
406 strcpy(Source, (char *)&_evt->v7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
407 v12 = (char *)&item.uExpireTime + strlen(Source) + 7;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
408 if ( *v12 == 32 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
409 *v12 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
410 if (pMediaPlayer->bPlaying_Movie)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
411 pMediaPlayer->Unload();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
412 pMediaPlayer->bStopBeforeSchedule = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
413 // pMediaPlayer->pResetflag = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
414
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
415 v128 = current_screen_type;
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
416 strcpy(Str, Source);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
417 v16 = RemoveQuotes(Str);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
418 pMediaPlayer->FullscreenMovieLoop(v16, 0/*, _evt->v5*/);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
419 if ( !_stricmp(v16, "arbiter good") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
420 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
421 pParty->alignment = PartyAlignment_Good;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
422 v18 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
423 LOBYTE(v17) = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
424 SetUserInterface(PartyAlignment_Good, v17);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
425 if (!_evt->v6 || v128 == SCREEN_BOOKS)
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
426 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
427 current_screen_type = (CURRENT_SCREEN)v128;
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
428 if (v128 == SCREEN_BOOKS)
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
429 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
430 if (v128 == SCREEN_HOUSE)
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
431 pMediaPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
432 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
433 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
434 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
435 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
436 if ( !_stricmp(v16, "arbiter evil") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
437 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
438 v18 = 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
439 pParty->alignment = PartyAlignment_Evil;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
440 LOBYTE(v17) = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
441 SetUserInterface(PartyAlignment_Evil, v17);
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
442 if (!_evt->v6 || v128 == SCREEN_BOOKS)
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
443 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
444 current_screen_type = (CURRENT_SCREEN)v128;
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
445 if (v128 == SCREEN_BOOKS)
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
446 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
447 if (v128 == SCREEN_HOUSE)
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
448 pMediaPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
449 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
450 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
451 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
452 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
453 if ( !_stricmp(v16, "pcout01") ) // moving to harmondale from emerald isle
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
454 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
455 Rest(0x2760u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
456 pParty->RestAndHeal();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
457 pParty->days_played_without_rest = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
458 }
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
459 if (!_evt->v6 || v128 == SCREEN_BOOKS)
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
460 {
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
461 current_screen_type = (CURRENT_SCREEN)v128;
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
462 if (v128 == SCREEN_BOOKS)
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
463 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
464 if (v128 == SCREEN_HOUSE)
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
465 pMediaPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
466 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
467 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
468 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
469 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
470 case EVENT_CheckSkill:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
471 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
472 v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
473 if ( player_choose < 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
474 goto LABEL_47;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
475 if ( player_choose <= 3 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
476 v24 = pParty->pPlayers[0].pActiveSkills[3486 * player_choose + _evt->v5];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
477 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
478 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
479 if ( player_choose == 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
480 v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
481 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
482 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
483 if ( player_choose == 5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
484 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
485 v20 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
486 v21 = 3486 * v130 + _evt->v5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
487 v136 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
488 LOWORD(v21) = pParty->pPlayers[0].pActiveSkills[v21];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
489 v137 = v21 & 0x40;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
490 v138 = v21 & 0x80;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
491 v22 = v21 & 0x100;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
492 v23 = v21 & 0x3F;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
493 v139 = v22;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
494 while ( v23 < v19 || !*(&v136 + _evt->v6) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
495 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
496 ++v20;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
497 if ( v20 >= 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
498 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
499 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
500 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
501 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
502 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
503 curr_seq_num = _evt->v11 - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
504 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
505 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
506 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
507 LABEL_47:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
508 //v10 = (ByteArray *)&v5[v9];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
509 v24 = pParty->pPlayers[0].pActiveSkills[_evt->v5 + 3486 * rand() % 4];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
510 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
511 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
512 v136 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
513 v137 = v24 & 0x40;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
514 v138 = v24 & 0x80;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
515 v139 = v24 & 0x100;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
516 if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
517 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
518 curr_seq_num = _evt->v11 - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
519 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
520 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
521 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
522 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
523 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
524 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
525
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
526 case EVENT_SpeakNPC:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
527 if ( canShowMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
528 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
529 //Actor::Actor(&Dst);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
530 memset(&Dst, 0, 0x344u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
531 dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
532 Dst.sNPC_ID = dword_5B65D0_dialogue_actor_npc_id;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
533 GameUI_InitializeDialogue(&Dst, false);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
534 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
535 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
536 bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
537 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
538 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
539 case EVENT_ChangeEvent:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
540 if ( EVT_DWORD(_evt->v5) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
541 stru_5E4C90_MapPersistVars._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
542 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
543 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
544 v26 = (LevelDecoration *)activeLevelDecoration;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
545 stru_5E4C90_MapPersistVars._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
546 v26->uFlags |= LEVEL_DECORATION_INVISIBLE;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
547 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
548 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
549
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
550 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
551 case EVENT_SetNPCGreeting:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
552 v27 = EVT_DWORD(_evt->v5);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
553 pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
554 pNPCStats->pNewNPCData[v27].greet = EVT_DWORD(_evt->v9);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
555 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
556 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
557 case EVENT_SetNPCTopic:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
558 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
559 //v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
560 pEventID = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
561 pNPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
562 pIndex = _evt->v9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
563 pNPC = &pNPCStats->pNewNPCData[pNPC_ID];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
564 if ( pIndex == 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
565 pNPC->evt_A = pEventID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
566 if ( pIndex == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
567 pNPC->evt_B = pEventID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
568 if ( pIndex == 2 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
569 pNPC->evt_C = pEventID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
570 if ( pIndex == 3 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
571 pNPC->evt_D = pEventID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
572 if ( pIndex == 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
573 pNPC->evt_E = pEventID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
574 if ( pIndex == 5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
575 pNPC->evt_F = pEventID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
576 if ( pNPC_ID == 8 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
577 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
578 if ( pEventID == 78 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
579 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
580 HouseDialogPressCloseBtn();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
581 window_SpeakInHouse->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
582 pParty->uFlags &= ~2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
583 if ( EnterHouse(HOUSE_DARK_GUILD_PIT) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
584 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
585 pAudioPlayer->StopChannels(-1, -1);
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
586 window_SpeakInHouse = new GUIWindow_House(0, 0, window->GetWidth(), window->GetHeight(), 170, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
587 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
588 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
589 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
590 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
591 window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
592 current_npc_text = pNPCTopics[90].pText;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
593 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
594 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
595 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
596 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
597 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
598 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
599 case EVENT_NPCSetItem:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
600 sub_448518_npc_set_item(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
601 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
602 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
603 case EVENT_SetActorItem:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
604 Actor::GiveItem(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
605 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
606 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
607 case EVENT_SetNPCGroupNews:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
608 pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
609 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
610 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
611 case EVENT_SetActorGroup:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
612 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
613 *(&pActors[0].uGroup + 0x11000000 * _evt->v8 + 209 * (_evt->v5 + ((_evt->v6 + ((uint)_evt->v7 << 8)) << 8))) = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
614 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
615 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
616 case EVENT_ChangeGroup:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
617 v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
618 v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
619 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
620 for ( uint actor_id = 0; actor_id < uNumActors; actor_id++ )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
621 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
622 if ( pActors[actor_id].uGroup == v38 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
623 pActors[actor_id].uGroup = v39;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
624 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
625 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
626 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
627 case EVENT_ChangeGroupAlly:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
628 v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
629 v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
630 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
631 for ( uint actor_id = 0; actor_id < uNumActors; actor_id++ )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
632 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
633 if ( pActors[actor_id].uGroup == v42 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
634 pActors[actor_id].uAlly = v43;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
635 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
636 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
637 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
638 case EVENT_MoveNPC:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
639 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
640 pNPCStats->pNewNPCData[EVT_DWORD(_evt->v5)].Location2D =EVT_DWORD(_evt->v9);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
641 if ( window_SpeakInHouse )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
642 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
643
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
644 if ( window_SpeakInHouse->par1C == 165 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
645 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
646 HouseDialogPressCloseBtn();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
647 pMediaPlayer->Unload();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
648 window_SpeakInHouse->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
649 pParty->uFlags &= ~2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
650 activeLevelDecoration = (LevelDecoration*)1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
651 if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
652 {
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
653 pAudioPlayer->PlaySound(SOUND_Invalid, 0, 0, -1, 0, 0, 0, 0);
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
654 window_SpeakInHouse = new GUIWindow_House(0, 0, window->GetWidth(), window->GetHeight(), 165, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
655 v48 = window_SpeakInHouse->pControlsHead;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
656 if ( window_SpeakInHouse->pControlsHead )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
657 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
658 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
659 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
660 v49 = v48->pNext;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
661 free(v48);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
662 v48 = v49;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
663 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
664 while ( v49 );
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
665 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
666 window_SpeakInHouse->pControlsHead = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
667 window_SpeakInHouse->pControlsTail = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
668 window_SpeakInHouse->uNumControls = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
669 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
670 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
671 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
672 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
673 if ( window_SpeakInHouse->par1C == 553 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
674 pMediaPlayer->bLoopPlaying = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
675 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
676 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
677
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
678 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
679 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
680 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
681 case EVENT_Jmp:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
682 curr_seq_num = _evt->v5 - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
683 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
684 v4 = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
685
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
686 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
687 case EVENT_ShowFace:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
688 if ( _evt->v5 <= 3u ) //someone
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
689 pParty->pPlayers[_evt->v5].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
690 else if ( _evt->v5 == 4 ) //active
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
691 pParty->pPlayers[uActiveCharacter].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
692 else if ( _evt->v5 == 5 ) //all players
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
693 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
694 for(int i = 0; i < 4; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
695 pParty->pPlayers[i].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
696 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
697 else //random player
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
698 pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
699 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
700 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
701 case EVENT_CharacterAnimation:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
702 if ( _evt->v5 <= 3 ) //someone
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
703 pParty->pPlayers[_evt->v5].PlaySound((PlayerSpeech) _evt->v6, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
704 else if ( _evt->v5 == 4 ) //active
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
705 pParty->pPlayers[uActiveCharacter].PlaySound((PlayerSpeech) _evt->v6, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
706 else if ( _evt->v5 == 5 ) //all
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
707 for(int i = 0; i < 4; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
708 pParty->pPlayers[i].PlaySound((PlayerSpeech) _evt->v6, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
709 else //random
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
710 pParty->pPlayers[rand() % 4].PlaySound((PlayerSpeech) _evt->v6, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
711 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
712 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
713 case EVENT_ForPartyMember:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
714 player_choose = _evt->v5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
715 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
716 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
717 case EVENT_SummonItem:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
718 SpriteObject::sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
719 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8),
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
720 _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8),
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
721 _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8),
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
722 _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8),
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
723 _evt->v25, _evt->v26, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
724 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
725 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
726 case EVENT_Compare:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
727 pValue = EVT_DWORD(_evt->v7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
728 if ( player_choose <= 3 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
729 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
730 if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
731 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
732 // v124 = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
733 curr_seq_num = _evt->v11 - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
734 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
735 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
736 else if ( player_choose == 4 ) //active
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
737 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
738 if ( uActiveCharacter )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
739 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
740 if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
741 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
742 // v124 = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
743 curr_seq_num = _evt->v11 - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
744 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
745 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
746 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
747 else if ( player_choose == 5 )//all
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
748 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
749 v130 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
750 for(int i = 1; i < 5; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
751 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
752 if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
753 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
754 // v124 = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
755 curr_seq_num = _evt->v11 - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
756 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
757 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
758 ++v130;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
759 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
760 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
761 else if ( player_choose == 6 ) //random
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
762 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
763 if ( pPlayers[rand() % 4 + 1]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
764 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
765 // v124 = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
766 curr_seq_num = _evt->v11 - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
767 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
768 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
769 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
770 v4 = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
771 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
772 case EVENT_IsActorAlive:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
773 if (IsActorAlive(EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10)))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
774 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
775 //v124 = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
776 curr_seq_num = _evt->v11 - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
777 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
778 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
779 v4 = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
780 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
781 case EVENT_Substract:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
782 pValue = EVT_DWORD(_evt->v7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
783 /*if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
784 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
785 if ( pParty->pPickedItem.uItemID == pValue )//In hand
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
786 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
787 pMouse->RemoveHoldingItem();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
788 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
789 v4 = v124;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
790 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
791 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
792 //v67 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix.data();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
793 for ( v65 = 0; v65 < 126; ++v65 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
794 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
795 v67 = &pPlayers[uActiveCharacter]->pInventoryMatrix[v65];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
796 if ( v67 > 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
797 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
798 if ( pPlayers[uActiveCharacter]->pInventoryItemList[v67 - 1].uItemID == pValue )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
799 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
800 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
801 //++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
802 //v4 = v124;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
803 goto substract;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
804 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
805 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
806 //v67 += 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
807 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
808 //while ( (signed int)v65 < 126 );
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
809 //v69 = (int)&pPlayers[uActiveCharacter]->pEquipment.pIndices;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
810 for ( v68 = 0; v68 < 16; ++v68 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
811 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
812 if ( pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->pEquipment.pIndices[v68]].uItemID == pValue )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
813 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
814 pPlayers[uActiveCharacter]->pEquipment.pIndices[v68] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
815 //++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
816 //v4 = v124;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
817 goto substract;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
818 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
819 //v69 += 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
820 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
821 for (int i = 1; i < 5; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
822 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
823 //v72 = (int)pPlayers[i]->pInventoryMatrix.data();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
824 for ( int v71 = 0; v71 < 126; ++v71 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
825 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
826 v72 = &pPlayers[i]->pInventoryMatrix[v71];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
827 if ( v72 > 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
828 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
829 if ( pPlayers[i]->pInventoryItemList[v72 - 1].uItemID == pValue )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
830 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
831 pPlayers[i]->RemoveItemAtInventoryIndex(v71);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
832 goto substract;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
833 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
834 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
835 //v72 += 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
836 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
837 for ( v73 = 0; v73 < 16; ++v73 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
838 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
839 //v74 = (int)&pPlayers[i]->pEquipment;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
840 if (pPlayers[i]->pEquipment.pIndices[v73])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
841 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
842 if (pPlayers[i]->pInventoryItemList[pPlayers[i]->pEquipment.pIndices[v73] - 1].uItemID == pValue )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
843 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
844 pPlayers[i]->pEquipment.pIndices[v73] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
845 //v74 += 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
846 goto substract;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
847 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
848 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
849 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
850 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
851 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
852 if ( player_choose <= 3 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
853 pParty->pPlayers[player_choose].SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
854 else if ( player_choose == 4 ) //active
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
855 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
856 if ( uActiveCharacter )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
857 pPlayers[uActiveCharacter]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
858 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
859 else if ( player_choose == 5 )//all
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
860 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
861 for(int i = 1; i < 5; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
862 pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
863 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
864 else if ( player_choose == 6 ) //random
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
865 pParty->pPlayers[rand() % 4].SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
866 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
867 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
868 case EVENT_Set:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
869 pValue = EVT_DWORD(_evt->v7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
870 if ( player_choose <= 3 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
871 pParty->pPlayers[player_choose].SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
872 else if ( player_choose == 4 ) //active
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
873 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
874 if ( uActiveCharacter )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
875 pPlayers[uActiveCharacter]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
876 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
877 else if ( player_choose == 5 )//all
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
878 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
879 //recheck v130
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
880 for ( int i = 1; i < 5; ++i )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
881 pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
882 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
883 else if ( player_choose == 6 ) //random
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
884 pParty->pPlayers[rand() % 4].SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
885 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
886 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
887 case EVENT_Add:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
888 pValue = EVT_DWORD(_evt->v7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
889 if ( player_choose <= 3 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
890 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
891 pPlayer = &pParty->pPlayers[player_choose];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
892 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
893 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
894 else if ( player_choose == 4 ) //active
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
895 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
896 if ( uActiveCharacter )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
897 pPlayers[uActiveCharacter]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
898 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
899 else if ( player_choose == 5 )//all
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
900 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
901 for(int i = 1; i < 5; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
902 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
903 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
904 else if ( player_choose == 6 ) //random
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
905 pParty->pPlayers[rand() % 4].AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
906 v83 = EVT_WORD(_evt->v5);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
907 if (v83 == 21 || // gold well on emerald isle
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
908 v83 == 22 || v83 == 23 || v83 == 24 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
909 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
910 //__debugbreak(); // bonfire
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
911 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
912 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
913 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
914 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
915 case EVENT_InputString:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
916 if ( !entry_line )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
917 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
918 strcpy(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
919 sub_4451A8_press_any_key(uEventID, curr_seq_num, 26);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
920 if ( v133 == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
921 OnMapLeave();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
922 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
923 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
924 v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
925 if ( !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
926 || !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[v84]]) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
927 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
928 v11 = _evt->v17;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
929 curr_seq_num = v11 - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
930 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
931 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
932 v4 = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
933 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
934 case EVENT_RandomGoTo:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
935 //v124 = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
936 v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
937 + (_evt->v10 != 0)));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
938 curr_seq_num = v11 - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
939 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
940 v4 = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
941 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
942 case EVENT_ReceiveDamage:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
943 if ( (unsigned __int8)_evt->v5 <= 3 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
944 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
945 pParty->pPlayers[(unsigned __int8)_evt->v5].ReceiveDamage(EVT_DWORD(_evt->v7 ), (DAMAGE_TYPE)_evt->v6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
946 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
947 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
948 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
949 if ( _evt->v5 == 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
950 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
951 if ( !uActiveCharacter )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
952 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
953 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
954 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
955 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
956 pPlayers[uActiveCharacter]->ReceiveDamage(EVT_DWORD(_evt->v7 ), (DAMAGE_TYPE)_evt->v6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
957 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
958 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
959 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
960 if ( _evt->v5 != 5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
961 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
962 pParty->pPlayers[rand() % 4].ReceiveDamage(EVT_DWORD(_evt->v7 ), (DAMAGE_TYPE)_evt->v6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
963 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
964 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
965 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
966 for ( uint pl_id = 0;pl_id < 4; pl_id++ )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
967 pParty->pPlayers[pl_id].ReceiveDamage(EVT_DWORD(_evt->v7 ), (DAMAGE_TYPE)_evt->v6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
968 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
969 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
970 case EVENT_ToggleIndoorLight:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
971 pIndoor->ToggleLight(EVT_DWORD(_evt->v5 ), _evt->v9);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
972 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
973 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
974 case EVENT_SetFacesBit:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
975 sub_44892E_set_faces_bit(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
976 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
977 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
978 case EVENT_ToggleChestFlag:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
979 Chest::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
980 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
981 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
982 case EVENT_ToggleActorFlag:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
983 Actor::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
984 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
985 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
986 case EVENT_ToggleActorGroupFlag:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
987 ToggleActorGroupFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
988 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
989 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
990 case EVENT_SetSnow:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
991 if ( !_evt->v5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
992 pWeather->bRenderSnow = _evt->v6 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
993 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
994 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
995 case EVENT_StatusText:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
996 v90 = EVT_DWORD(_evt->v5 );
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
997 if ( activeLevelDecoration )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
998 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
999 if ( activeLevelDecoration == (LevelDecoration*)1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1000 current_npc_text = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1001 if ( canShowMessages == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1002 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1003 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1004 //LABEL_248:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1005 ShowStatusBarString(v91, 2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1006 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1007 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1008 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1009 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1010 if ( canShowMessages == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1011 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1012 v91 = &pLevelStr[pLevelStrOffsets[v90]];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1013 ShowStatusBarString(v91, 2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1014 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1015 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1016 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1017 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1018 case EVENT_ShowMessage:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1019 if ( activeLevelDecoration )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1020 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1021 current_npc_text = pNPCTopics[EVT_DWORD(_evt->v5 )-1].pText;//(&dword_721664)[8 * v92];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1022 byte_5B0938[0] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1023 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1024 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1025 strcpy(byte_5B0938.data(), &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1026 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1027 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1028 case EVENT_CastSpell:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1029 EventCastSpell(_evt->v5, _evt->v6, _evt->v7, EVT_DWORD(_evt->v8 ),
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1030 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ),
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1031 EVT_DWORD(_evt->v24 ), EVT_DWORD(_evt->v28 ));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1032 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1033 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1034 case EVENT_SetTexture:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1035 sub_44861E_set_texture(EVT_DWORD(_evt->v5 ), (char *)&_evt->v9);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1036 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1037 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1038 case EVENT_SetSprite:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1039 SetDecorationSprite(EVT_DWORD(_evt->v5 ), _evt->v9, (char *)&_evt->v10);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1040 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1041 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1042 case EVENT_SummonMonsters:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1043 sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,EVT_DWORD(_evt->v8 ),
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1044 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ),
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1045 EVT_DWORD(_evt->v24 ));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1046 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1047 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1048 case EVENT_MouseOver:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1049 case EVENT_LocationName:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1050 --curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1051 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1052 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1053 case EVENT_ChangeDoorState:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1054 Door_switch_animation(_evt->v5, _evt->v6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1055 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1056 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1057 case EVENT_OpenChest:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1058 if ( !Chest::Open(_evt->v5) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1059 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1060 if ( v133 == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1061 OnMapLeave();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1062 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1063 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1064 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1065 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1066 case EVENT_MoveToMap:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1067 v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1068 v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1069 v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1070 v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1071 v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1072 v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1073 v96 = _evt->v25;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1074 v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1075 v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1076 if ( _evt->v29 || _evt->v30 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1077 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1078 pRenderer->Sub01();
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
1079 pDialogueWindow = new GUIWindow_Transition(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1080 dword_5C3418 = uEventID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1081 dword_5C341C = curr_seq_num + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1082 if ( v133 == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1083 OnMapLeave();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1084 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1085 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1086 _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1087 _5B65A8_npcdata_uflags_or_other = v94;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1088 _5B65B0_npcdata_rep_or_other = v126;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1089 if ( v129 == -1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1090 v98 = _5B65B4_npcdata_loword_house_or_other;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1091 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1092 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1093 v98 = v129 & stru_5C6E00->uDoublePiMask;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1094 _5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1095 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1096 v99 = (char *)&_evt->v31;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1097 _5B65B8_npcdata_hiword_house_or_other = v95;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1098 dword_5B65BC = v97;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1099 v100 = v94 | v132 | v126 | v95 | v97 | v98;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1100 dword_5B65C0 = v100;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1101 if ( *v99 == 48 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1102 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1103 if ( v100 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1104 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1105 pParty->vPosition.x = v135;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1106 pParty->vPosition.y = v132;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1107 pParty->vPosition.z = v126;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1108 pParty->uFallStartY = v126;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1109 if ( _5B65B4_npcdata_loword_house_or_other != -1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1110 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1111 _5B65B4_npcdata_loword_house_or_other = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1112 pParty->sRotationX = v95;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1113 pParty->uFallSpeed = v134;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1114 dword_5B65C0 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1115 dword_5B65BC = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1116 _5B65B8_npcdata_hiword_house_or_other = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1117 _5B65B0_npcdata_rep_or_other = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1118 _5B65AC_npcdata_fame_or_other = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1119 _5B65A8_npcdata_uflags_or_other = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1120 v106 = 232;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1121 pAudioPlayer->PlaySound((SoundID)v106, 0, 0, -1, 0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1122 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1123 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1124 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1125 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1126 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((activeLevelDecoration == NULL) + 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1127 Transition_StopSound_Autosave(v99, MapStartPoint_Party);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1128 v133 = 1;
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
1129 if ( current_screen_type == SCREEN_HOUSE )
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1130 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1131 if ( uGameState == GAME_STATE_CHANGE_LOCATION )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1132 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1133 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1134 dialog_menu_id = HOUSE_DIALOGUE_NULL;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1135 while ( HouseDialogPressCloseBtn() )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1136 ;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1137 pMediaPlayer->Unload();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1138 window_SpeakInHouse->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1139 window_SpeakInHouse = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1140 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1141 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2534
diff changeset
1142 current_screen_type = SCREEN_GAME;
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1143 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1144 pDialogueNPCCount = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1145 pDialogueWindow->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1146 dialog_menu_id = HOUSE_DIALOGUE_NULL;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1147 pDialogueWindow = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1148 pIcons_LOD->SyncLoadedFilesCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1149 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1150 OnMapLeave();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1151 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1152 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1153 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1154 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1155 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1156 case EVENT_PlaySound:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1157 v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1158 v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1159 v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1160 pAudioPlayer->PlaySound((SoundID)v106, 0, 0, v109, v110, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1161 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1162 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1163 case EVENT_GiveItem:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1164 item.Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1165 v102 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1166 pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1167 if ( v102 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1168 item.uItemID = v102;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1169 pParty->SetHoldingItem(&item);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1170 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1171 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1172 case EVENT_SpeakInHouse:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1173 if ( EnterHouse((enum HOUSE_ID)EVT_DWORD(_evt->v5)))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1174 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1175 pRenderer->Sub01();
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1176 pAudioPlayer->PlaySound(SOUND_Invalid, 0, 0, -1, 0, 0, 0, 0);
2534
1bcadc6dd203 enum SOUND_
Ritor1
parents: 2511
diff changeset
1177 pAudioPlayer->PlaySound(SOUND_enter, 814, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1178 v104 = 187;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1179 if ( uCurrentHouse_Animation != 167 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1180 v104 = EVT_DWORD(_evt->v5);
2544
c674d547cc7c GUIWindow switch logic refactored into behaviour classes
a.parshin
parents: 2541
diff changeset
1181 window_SpeakInHouse = new GUIWindow_House(0, 0, window->GetWidth(), window->GetHeight(), v104, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1182 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1183 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1184 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1185 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1186 window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1187 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1188 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1189 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1190 case EVENT_PressAnyKey:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1191 sub_4451A8_press_any_key(uEventID, curr_seq_num + 1, 33);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1192 if ( v133 == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1193 OnMapLeave();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1194 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1195 case EVENT_Exit:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1196 if ( v133 == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1197 OnMapLeave();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1198 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1199 default:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1200 ++curr_seq_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1201 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1202 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1203 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1204 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1205 if ( v133 == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1206 OnMapLeave();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1207 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1208 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1209
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1210 //----- (00444732) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1211 char *GetEventHintString(unsigned int uEventID)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1212 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1213 signed int event_index; // edx@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1214 int event_pos; // esi@4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1215 char *result; // eax@6
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1216 unsigned int str_index; // eax@9
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1217 int i; // esi@11
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1218 _evt_raw* test_evt;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1219 _evt_raw* last_evt;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1220
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1221 event_index = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1222 if ( uLevelEVT_NumEvents <= 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1223 return NULL;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1224
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1225 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1226 while ( 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1227 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1228 if ( pLevelEVT_Index[event_index].uEventID == uEventID )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1229 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1230 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1231 last_evt=test_evt;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1232 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1233 if ( test_evt->_e_type == EVENT_MouseOver )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1234 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1235 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1236 ++event_index;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1237 if ( event_index >= uLevelEVT_NumEvents )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1238 return NULL;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1239 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1240 test_evt=(_evt_raw*)&pLevelEVT[event_pos];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1241 if ( test_evt->_e_type== EVENT_SpeakInHouse )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1242 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1243 str_index = EVT_DWORD(test_evt->v5);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1244 result = (char *)p2DEvents[str_index - 1].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1245 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1246 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1247 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1248 for ( i = event_index + 1; pLevelEVT_Index[i].uEventID == uEventID; ++i )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1249 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1250 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1251 test_evt=(_evt_raw*)&pLevelEVT[event_pos];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1252 if ( test_evt->_e_type == EVENT_SpeakInHouse )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1253 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1254 str_index = EVT_DWORD(test_evt->v5);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1255 if ( str_index < 600 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1256 return (char *)p2DEvents[str_index - 1].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1257 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1258 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1259 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1260 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1261
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1262 return result;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1263 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1264
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1265 //----- (004613C4) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1266 void init_event_triggers()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1267 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1268 uint id = pDecorationList->GetDecorIdByName("Event Trigger");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1269
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1270 num_event_triggers = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1271 for (uint i = 0; i < uNumLevelDecorations; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1272 if (pLevelDecorations[i].uDecorationDescID == id)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1273 event_triggers[num_event_triggers++] = i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1274 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1275
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1276 //----- (0046CC4B) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1277 void check_event_triggers()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1278 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1279 for (size_t i = 0; i < num_event_triggers; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1280 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1281 if (pLevelDecorations[event_triggers[i]].uFlags & LEVEL_DECORATION_TRIGGERED_BY_TOUCH
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1282 && pLevelDecorations[event_triggers[i]].vPosition.GetDistanceTo(pParty->vPosition) < pLevelDecorations[event_triggers[i]].uTriggerRange)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1283 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1284 EventProcessor(pLevelDecorations[event_triggers[i]].uEventID, PID(OBJECT_Decoration, i), 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1285 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1286 else if (pLevelDecorations[event_triggers[i]].uFlags & LEVEL_DECORATION_TRIGGERED_BY_MONSTER)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1287 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1288 for (size_t j = 0; j < uNumActors; j++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1289 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1290 if (pLevelDecorations[event_triggers[i]].vPosition.GetDistanceTo(pActors[j].vPosition) < pLevelDecorations[event_triggers[i]].uTriggerRange)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1291 EventProcessor(pLevelDecorations[event_triggers[i]].uEventID, 0, 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1292 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1293 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1294 else if (pLevelDecorations[event_triggers[i]].uFlags & LEVEL_DECORATION_TRIGGERED_BY_OBJECT)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1295 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1296 for (size_t j = 0; j < uNumSpriteObjects; j++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1297 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1298 if (pLevelDecorations[event_triggers[i]].vPosition.GetDistanceTo(pSpriteObjects[j].vPosition) < pLevelDecorations[event_triggers[i]].uTriggerRange)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1299 EventProcessor(pLevelDecorations[event_triggers[i]].uEventID, 0, 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1300 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1301 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1302 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1303 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1304 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1305
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1306 //----- (004465DF) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1307 bool sub_4465DF_check_season(int a1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1308 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1309 unsigned int monthPlusOne; // eax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1310 unsigned int daysPlusOne; // edx@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1311
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1312 monthPlusOne = pParty->uCurrentMonth + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1313 daysPlusOne = pParty->uDaysPlayed + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1314
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1315 switch (a1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1316 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1317 case 3: //winter 12.21 -> 3.20
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1318 return (monthPlusOne == 12 && daysPlusOne >= 21 || monthPlusOne == 1 || monthPlusOne == 2 || monthPlusOne == 3 && daysPlusOne <= 20);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1319 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1320 case 2:// autumn/fall 9.21 -> 12.20
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1321 return (monthPlusOne == 9 && daysPlusOne >= 21 || monthPlusOne == 10 || monthPlusOne == 11 || monthPlusOne == 12 && daysPlusOne <= 20);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1322 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1323 case 1://summer 6.21 -> 9.20
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1324 return (monthPlusOne == 6 && daysPlusOne >= 21 || monthPlusOne == 7 || monthPlusOne == 8 || monthPlusOne == 9 && daysPlusOne <= 20);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1325 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1326 case 0: //spring 3.21 -> 6.20
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1327 return (monthPlusOne == 3 && daysPlusOne >= 21 || monthPlusOne == 4 || monthPlusOne == 5 || monthPlusOne == 6 && daysPlusOne <= 20);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1328 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1329 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1330 Error("Unknown season");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1331 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1332 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1333
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1334 //----- (00448CF4) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1335 void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1336 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1337 unsigned int map_id; // eax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1338 size_t old_num_actors; // ebx@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1339 AIDirection v15; // [sp+28h] [bp-34h]@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1340 SpawnPointMM7 pSpawnPoint; // [sp+44h] [bp-18h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1341
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1342 pSpawnPoint.vPosition.x = x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1343 pSpawnPoint.vPosition.y = y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1344 pSpawnPoint.vPosition.z = z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1345 pSpawnPoint.uGroup = group;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1346 pSpawnPoint.uRadius = 32;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1347 pSpawnPoint.uKind = 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1348 pSpawnPoint.uIndex = typeindex + 2 * level + level;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1349 map_id = pMapStats->GetMapInfo(pCurrentMapName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1350 if (map_id)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1351 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1352 old_num_actors = uNumActors;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1353 SpawnEncounter(&pMapStats->pInfos[map_id], &pSpawnPoint, 0, count, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1354 Actor::GetDirectionInfo(PID(OBJECT_Actor, old_num_actors), 4, &v15, 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1355 for (uint i = (unsigned int)old_num_actors; i < (unsigned int)uNumActors; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1356 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1357 pActors[i].PrepareSprites(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1358 pActors[i].uYawAngle = v15.uYawAngle;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1359 pActors[i].dword_000334_unique_name = uUniqueName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1360 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1361 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1362 }