changeset 307:72faa54ff319

Events stuff moved to its file
author Gloval
date Wed, 20 Feb 2013 00:26:17 +0400
parents f16ac5e65438
children 6d584c95dcf8
files Actor.cpp Events.cpp Events.h Indoor.cpp NPC.cpp Outdoor.cpp mm7_3.cpp mm7_4.cpp mm7_data.h
diffstat 9 files changed, 1688 insertions(+), 1644 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Tue Feb 19 15:40:11 2013 +0200
+++ b/Actor.cpp	Wed Feb 20 00:26:17 2013 +0400
@@ -974,7 +974,7 @@
               0);
             pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(
               v5,
-              (unsigned int)((char *)&pLevelEVT_Events[4335].uEventID + 2));
+              (unsigned int)((char *)&pLevelEVT_Index[4335].uEventID + 2));
             v106 = 0;
             v104 = 0;
             v103 = 0;
--- a/Events.cpp	Tue Feb 19 15:40:11 2013 +0200
+++ b/Events.cpp	Wed Feb 20 00:26:17 2013 +0400
@@ -1,19 +1,44 @@
+#include <stdlib.h>
+
+#include "MapInfo.h"
+#include "Game.h"
+#include "GUIWindow.h"
+#include "GUIFont.h"
+#include "GUIButton.h"
+#include "GUIProgressBar.h"
+#include "Chest.h"
+#include "stru176.h"
+#include "LOD.h"
+#include "NPC.h"
+#include "Actor.h"
+#include "Party.h"
+#include "Math.h"
+#include "AudioPlayer.h"
+#include "Indoor.h"
+#include "Viewport.h"
+#include "texts.h"
+#include "Texture.h"
+#include "Allocator.h"
+#include "mm7_data.h"
+#include "stru123.h"
+#include "stru159.h"
 #include "Events.h"
 #include "Events2D.h"
+#include "Weather.h"
 
 
 
-Event pSomeOtherEVT_Events[4400];
+EventIndex pSomeOtherEVT_Events[4400];
 unsigned int uSomeOtherEVT_NumEvents;
 char *pSomeOtherEVT;
-Event pSomeEVT_Events[4400];
+EventIndex pSomeEVT_Events[4400];
 unsigned int uSomeEVT_NumEvents;
 char *pSomeEVT;
 
 unsigned int uGlobalEVT_NumEvents;
 unsigned int uGlobalEVT_Size;
 char pGlobalEVT[46080];
-Event pGlobalEVT_Events[4400];
+EventIndex pGlobalEVT_Index[4400];
 
 unsigned int pLevelStrOffsets[500];
 unsigned int uLevelStrNumStrings;
@@ -22,7 +47,1621 @@
 unsigned int uLevelEVT_Size;
 char pLevelStr[9216];
 char pLevelEVT[9216];
-Event pLevelEVT_Events[4400];
+EventIndex pLevelEVT_Index[4400];
 
 
 _2devent p2DEvents[525]; // weak
+
+
+
+//----- (00443CE1) --------------------------------------------------------
+unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize)
+	{
+	FILE *pLodFile; // eax@1
+	unsigned int uTextureSize; // esi@3
+	char Args[60]; // [sp+8h] [bp-B4h]@6
+	void *ptr; // [sp+B8h] [bp-4h]@1
+	Texture DstBuf; // [sp+6Ch] [bp-50h]@1
+
+	ptr = pEvents_LOD->LoadRaw(pContainerName, 0);
+	pLodFile = pEvents_LOD->FindContainer(pContainerName, 0);
+	if ( !pLodFile )
+		Abortf("Unable to load %s", pContainerName);
+	fread(&DstBuf, 1, 48, pLodFile);
+	uTextureSize = DstBuf.uDecompressedSize;
+	if ( !DstBuf.uDecompressedSize )
+		uTextureSize = DstBuf.uTextureSize;
+	memset(&DstBuf, 0, 72);
+	if ( uTextureSize >= (signed int)uBufferSize )
+		{
+		sprintf(Args, "File %s Size %lu - Buffer size %lu", pContainerName, uTextureSize, uBufferSize);
+		Abortf(Args);
+		}
+	memcpy(pBuffer, ptr, uTextureSize);
+	pAllocator->FreeChunk(ptr);
+	return uTextureSize;
+	}
+
+//----- (00443DA1) --------------------------------------------------------
+void __cdecl Initialize_GlobalEVT()
+	{
+	struct raw_event_header
+		{ 
+		unsigned char evt_size;
+		unsigned char evt_id_l;
+		unsigned char evt_id_h;
+		unsigned char evt_sequence_num;
+		} ;
+	uint events_count;
+	unsigned int offset_in; 
+	raw_event_header *current_hdr; 
+	uGlobalEVT_NumEvents = 0;
+	uGlobalEVT_Size = LoadEventsToBuffer("global.evt", pGlobalEVT, 46080);
+	if ( !uGlobalEVT_Size )
+		return;
+	memset(pGlobalEVT_Index, 0x80, sizeof(pGlobalEVT_Index));//52800
+	events_count = uGlobalEVT_NumEvents;
+	current_hdr=(raw_event_header *)pGlobalEVT;
+	offset_in=0;
+	for (events_count = 0, offset_in = 0; offset_in < uGlobalEVT_Size; ++events_count)
+		{
+		pGlobalEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8);
+		pGlobalEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num;
+		pGlobalEVT_Index[events_count].uEventOffsetInEVT=offset_in;			
+		offset_in+=current_hdr->evt_size+1;
+		current_hdr=(raw_event_header *)&pGlobalEVT[offset_in];
+		}
+	uGlobalEVT_NumEvents = events_count;
+
+	}
+
+
+//----- (00443EF8) --------------------------------------------------------
+void  LoadLevel_InitializeLevelEvt()
+	{
+	if (!uLevelEVT_Size)
+		return;
+
+	memset(array_5B5928, 0, 3200);
+	memset(pLevelEVT_Index, 80, 52800);
+
+	uLevelEVT_NumEvents = 0;
+	dword_5B65C8 = 0;
+
+	for (uint i = 0, j = 0; j < uLevelEVT_Size; ++i)
+		{
+		pLevelEVT_Index[i].uEventID = pLevelEVT[j + 1] + ((unsigned short)pLevelEVT[j + 2] << 8);
+		pLevelEVT_Index[i].event_sequence_num = pLevelEVT[j + 3];
+		pLevelEVT_Index[i].uEventOffsetInEVT = j;
+		j += pLevelEVT[j] + 1;
+		uLevelEVT_NumEvents++;
+		}
+	}
+
+
+//----- (0044684A) --------------------------------------------------------
+void  EventProcessor(int uEventID, int a2, int a3)
+	{
+	unsigned int v3; // eax@5
+	//signed int v4; // esi@7
+	//char *v5; // eax@8
+	Player *v6; // ecx@8
+	//char *v7; // ebp@8
+	//signed int v8; // edx@10
+	//int v9; // edi@12
+	//ByteArray *v10; // esi@12
+	int v11; // eax@14
+	char *v12; // eax@15
+	//char *v13; // edi@21
+	int v14; // ebp@21
+	int v15; // edi@21
+	const char *v16; // esi@21
+	bool v17; // edx@21
+	int v18; // ecx@22
+	int v19; // ebp@36
+	signed int v20; // ecx@40
+	int v21; // eax@40
+	int v22; // edx@40
+	int v23; // eax@40
+	unsigned __int16 v24; // ax@45
+	int v25; // eax@54
+	LevelDecoration *v26; // eax@55
+	int v27; // eax@57
+	int v28; // ecx@57
+	int v29; // edx@58
+	int v30; // eax@58
+	int v31; // ecx@58
+	int v32; // esi@58
+	NPCData *v33; // ecx@58
+	int v34; // esi@59
+	int v35; // esi@60
+	int v36; // esi@61
+	int v37; // esi@62
+	int v38; // eax@78
+	int v39; // ecx@78
+	size_t v40; // edx@78
+	Actor *v41; // esi@79
+	int v42; // eax@84
+	int v43; // ecx@84
+	size_t v44; // edx@84
+	Actor *v45; // esi@85
+	void *v46; // eax@91
+	GUIWindow *v47; // eax@93
+	GUIButton *v48; // ecx@93
+	GUIButton *v49; // esi@94
+	char v50; // al@100
+	Player *v51; // esi@103
+	Player *v52; // ecx@106
+	int v53; // ecx@107
+	char v54; // al@111
+	Player *v55; // esi@114
+	Player *v56; // ecx@117
+	int v57; // ecx@118
+	signed int v58; // ebp@124
+	Player *v59; // esi@125
+	int v60; // eax@126
+	int v61; // edx@133
+	int v62; // eax@139
+	void *v63; // ebp@145
+	signed int v64; // edi@146
+	unsigned int v65; // edx@148
+	Player *v66; // ecx@148
+	int v67; // esi@148
+	signed int v68; // eax@151
+	int v69; // esi@151
+	Player *v70; // ecx@158
+	unsigned int v71; // eax@159
+	int v72; // esi@159
+	signed int v73; // eax@162
+	int v74; // esi@162
+	int v75; // edx@172
+	Player *v76; // esi@173
+	signed int v77; // ebp@186
+	int v78; // edx@186
+	Player *v79; // esi@187
+	signed int v80; // ebp@200
+	int v81; // edx@200
+	Player *v82; // esi@201
+	int v83; // eax@212
+	int v84; // ebp@220
+	signed int v85; // ebp@224
+	char v86; // al@224
+	Player *v87; // esi@227
+	Player *v88; // ecx@231
+	int v89; // ecx@232
+	int v90; // eax@243
+	const char *v91; // ecx@247
+	int v92; // eax@251
+	char *v93; // eax@252
+	int v94; // ecx@262
+	int v95; // ebp@262
+	int v96; // edx@262
+	int v97; // eax@262
+	unsigned int v98; // edx@265
+	const char *v99; // esi@267
+	int v100; // edx@267
+	//char *v101; // edi@281
+	unsigned int v102; // esi@281
+	int v103; // edi@284
+	int v104; // eax@288
+	int v105; // edx@294
+	int v106; // [sp-20h] [bp-4C8h]@278
+	signed int v107; // [sp-1Ch] [bp-4C4h]@278
+	unsigned int v108; // [sp-18h] [bp-4C0h]@278
+	signed int v109; // [sp-14h] [bp-4BCh]@278
+	signed int v110; // [sp-10h] [bp-4B8h]@278
+	int v111; // [sp-Ch] [bp-4B4h]@278
+	// Event *v112; // [sp-8h] [bp-4B0h]@5
+	int v113; // [sp-8h] [bp-4B0h]@106
+	int v114; // [sp-8h] [bp-4B0h]@117
+	signed int v115; // [sp-8h] [bp-4B0h]@231
+	unsigned int v116; // [sp-8h] [bp-4B0h]@278
+	int v117; // [sp-4h] [bp-4ACh]@106
+	int v118; // [sp-4h] [bp-4ACh]@117
+	int v119; // [sp-4h] [bp-4ACh]@231
+	int v120; // [sp-4h] [bp-4ACh]@278
+	int v121; // [sp-4h] [bp-4ACh]@294
+	int v122; // [sp+10h] [bp-498h]@4
+	//char *v123; // [sp+14h] [bp-494h]@0
+	//signed int v124; // [sp+18h] [bp-490h]@7
+	signed int v125; // [sp+1Ch] [bp-48Ch]@155
+	int v126; // [sp+1Ch] [bp-48Ch]@262
+	int v127; // [sp+20h] [bp-488h]@4
+	int v128; // [sp+24h] [bp-484h]@21
+	int v129; // [sp+24h] [bp-484h]@262
+	signed int v130; // [sp+28h] [bp-480h]@0
+	//int v131; // [sp+2Ch] [bp-47Ch]@1
+	int v132; // [sp+30h] [bp-478h]@262
+	signed int v133; // [sp+34h] [bp-474h]@1
+	int v134; // [sp+38h] [bp-470h]@262
+	int v135; // [sp+3Ch] [bp-46Ch]@262
+	int v136; // [sp+40h] [bp-468h]@40
+	int v137; // [sp+44h] [bp-464h]@40
+	int v138; // [sp+48h] [bp-460h]@40
+	int v139; // [sp+4Ch] [bp-45Ch]@40
+	ItemGen item; // [sp+50h] [bp-458h]@15
+	char Source[120]; // [sp+74h] [bp-434h]@15
+	char Str[120]; // [sp+ECh] [bp-3BCh]@21
+	Actor Dst; // [sp+164h] [bp-344h]@53
+
+	//v131 = uEventID;
+	v133 = 0;
+	dword_5B5920 = a2;
+	dword_5B65C4 = 0;
+	if ( !a1 )
+		{
+		if ( !GameUI_StatusBar_TimedStringTimeLeft )
+			ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here
+		return;
+		}
+	v127 = 2 * (uActiveCharacter == 0) + 4;
+	v122 = dword_597F18;
+	if ( _5C3420_pDecoration )
+		{
+		uSomeEVT_NumEvents = uGlobalEVT_NumEvents;
+		pSomeEVT = pGlobalEVT;
+		memcpy(pSomeEVT_Events, pGlobalEVT_Index, 52800); //4400 evts
+		}
+	else
+		{
+		uSomeEVT_NumEvents = uLevelEVT_NumEvents;
+		pSomeEVT = pLevelEVT;
+		memcpy(pSomeEVT_Events, pLevelEVT_Index, 52800);
+		}
+
+
+	//v4 = 0;
+	//v124 = 0;
+	for (uint i = 0; i < uSomeEVT_NumEvents; ++i)
+		{
+		//v5 = pSomeEVT;
+		//v6 = v123;
+		//v7 = "";
+		//while ( 1 )
+		//{
+		if ( dword_5B65C4 )
+			goto LABEL_301;
+		//v8 = v4;
+		if ( pSomeEVT_Events[i/*v4*/].uEventID == uEventID && pSomeEVT_Events[i/*v4*/].event_sequence_num == v122 )
+			{
+			//v9 = pSomeEVT_Events[v8].uEventOffsetInEVT;
+			//v10 = (ByteArray *)&v5[v9];
+			auto _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[i/*v4*/].uEventOffsetInEVT);
+
+			switch (_evt->v4)
+				{
+			case EVENT_CheckSeason:
+				if ( !sub_4465DF_check_season(_evt->v5) )
+					{
+					++v122;
+					//v4 = v124;
+					//v5 = pSomeEVT;
+					//v6 = v123;
+					//v7 = "";
+					break;
+					}
+				v11 = _evt->v6;
+				goto LABEL_130;
+			case EVENT_ShowMovie:
+				{
+				strcpy(Source, (char *)&_evt->v7);
+				v12 = (char *)&item.uExpireTime + strlen(Source) + 7;
+				if ( *v12 == 32 )
+					*v12 = 0;
+				if ( pVideoPlayer->field_54 )
+					pVideoPlayer->Unload();
+				pVideoPlayer->bStopBeforeSchedule = 0;
+				pVideoPlayer->pResetflag = 0;
+				if (pAsyncMouse)
+					pAsyncMouse->Suspend();
+				v128 = pCurrentScreen;
+				//v13 = &pSomeEVT[v9];
+				//v14 = (unsigned __int8)v13[5];
+				//v15 = (unsigned __int8)v13[6];
+				v14 = _evt->v5;
+				v15 = _evt->v6;
+				strcpy(Str, Source);
+				v16 = RemoveQuotes(Str);
+				VideoPlayer::MovieLoop(v16, 0, v14, 1);
+				if ( !_strcmpi(v16, "arbiter good") )
+					{
+					pParty->uAlignment = 0;
+					v18 = 0;
+					LOBYTE(v17) = 1;
+					SetUserInterface(v18, v17);
+					if ( !v15 || v128 == 3 )
+						{
+						pCurrentScreen = v128;
+						if ( v128 == 3 )
+							pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
+						if ( v128 == 13 )
+							pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u);
+						}
+					if (pAsyncMouse)
+						pAsyncMouse->Resume();
+					++v122;
+					//v4 = v124;
+					//v5 = pSomeEVT;
+					//v6 = v123;
+					//v7 = "";
+					break;
+					}
+				if ( !_strcmpi(v16, "arbiter evil") )
+					{
+					v18 = 2;
+					pParty->uAlignment = 2;
+					LOBYTE(v17) = 1;
+					SetUserInterface(v18, v17);
+					if ( !v15 || v128 == 3 )
+						{
+						pCurrentScreen = v128;
+						if ( v128 == 3 )
+							pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
+						if ( v128 == 13 )
+							pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u);
+						}
+					if (pAsyncMouse)
+						pAsyncMouse->Resume();
+					++v122;
+					//v4 = v124;
+					//v5 = pSomeEVT;
+					//v6 = v123;
+					//v7 = "";
+
+					break;
+					}
+				if ( !_strcmpi(v16, "pcout01") )    // moving to harmondale from emerald isle
+					{
+					Rest(0x2760u);
+					pParty->RestAndHeal();
+					pParty->field_764 = 0;
+					}
+				if ( !v15 || v128 == 3 )
+					{
+					pCurrentScreen = v128;
+					if ( v128 == 3 )
+						pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
+					if ( v128 == 13 )
+						pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u);
+					}
+				if (pAsyncMouse)
+					pAsyncMouse->Resume();
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				}
+				break;
+			case EVENT_CheckSkill:
+				{
+				v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8);
+				if ( v127 < 0 )
+					goto LABEL_47;
+				if ( v127 <= 3 )
+					{
+					v24 = pParty->pPlayers[0].pActiveSkills[3486 * v127 + _evt->v5];
+					}
+				else
+					{
+					if ( v127 == 4 )
+						{
+						v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5];
+						}
+					else
+						{
+						if ( v127 == 5 )
+							{
+							v20 = 0;
+							v21 = 3486 * v130 + _evt->v5;
+							v136 = 1;
+							LOWORD(v21) = pParty->pPlayers[0].pActiveSkills[v21];
+							v137 = v21 & 0x40;
+							v138 = v21 & 0x80;
+							v22 = v21 & 0x100;
+							v23 = v21 & 0x3F;
+							v139 = v22;
+							while ( v23 < v19 || !*(&v136 + _evt->v6) )
+								{
+								++v20;
+								if ( v20 >= 4 )
+									{
+									++v122;
+									//v4 = v124;
+									//v5 = pSomeEVT;
+									//v6 = v123;
+									//v7 = "";
+									break;
+									}
+								}
+							v11 = _evt->v11;
+							goto LABEL_130;
+							}
+LABEL_47:
+						//v10 = (ByteArray *)&v5[v9];
+						v24 = pParty->pPlayers[0].pActiveSkills[_evt->v5 + 3486 * rand() % 4];
+						}
+					}
+				v136 = 1;
+				v137 = v24 & 0x40;
+				v138 = v24 & 0x80;
+				v139 = v24 & 0x100;
+				if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) )
+					{
+					v11 = _evt->v11;
+					goto LABEL_130;
+					}
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				}
+				break;
+
+			case EVENT_SpeakNPC:
+				if ( a3 )
+					{
+					//Actor::Actor(&Dst);
+					memset(&Dst, 0, 0x344u);
+					dword_5B65D0_dialogue_actor_npc_id = _evt->v5
+						+ ((_evt->v6
+						+ ((_evt->v7
+						+ ((unsigned int)_evt->v8 << 8)) << 8)) << 8);
+					Dst.uNPC_ID = dword_5B65D0_dialogue_actor_npc_id;
+					Dst.InitializeDialogue(0);
+					}
+				else
+					{
+					bDialogueUI_InitializeActor_NPC_ID = _evt->v5
+						+ ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8);
+					}
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_ChangeEvent:
+				v25 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8);
+				if ( v25 )
+					{
+					stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = _evt->v5 - 124;
+					}
+				else
+					{
+					v26 = _5C3420_pDecoration;
+					stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = 0;
+					LOBYTE(v26->field_2) |= 0x20u;
+					}
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_SetNPCGreeting:
+				v27 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
+				v28 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
+				pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu;
+				pNPCStats->pNewNPCData[v27].greet = v28;
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_SetNPCTopic:
+				v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
+				v30 = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8);
+				v31 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
+				v32 = _evt->v9;
+				v33 = &pNPCStats->pNewNPCData[v31];
+				if ( v32 )
+					{
+					v34 = v32 - 1;
+					if ( v34 )
+						{
+						v35 = v34 - 1;
+						if ( v35 )
+							{
+							v36 = v35 - 1;
+							if ( v36 )
+								{
+								v37 = v36 - 1;
+								if ( v37 )
+									{
+									if ( v37 == 1 )
+										v33->evt_F = v30;
+									}
+								else
+									{
+									v33->evt_E = v30;
+									}
+								}
+							else
+								{
+								v33->evt_D = v30;
+								}
+							}
+						else
+							{
+							v33->evt_C = v30;
+							}
+						}
+					else
+						{
+						v33->evt_B = v30;
+						}
+					}
+				else
+					{
+					v33->evt_A = v30;
+					}
+				if ( v29 == 8 )
+					{
+					if ( v30 == 78 )
+						{
+						sub_4BD8B5();
+						ptr_507BC0->Release();
+						pParty->uFlags &= 0xFFFFFFFDu;
+						if ( EnterHouse((enum HOUSE_TYPE)170) )
+							{
+							pAudioPlayer->StopChannels(-1, -1);
+							ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0);
+							ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
+							ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
+							ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
+							ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
+							ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0);
+							ptr_F8B1E8 = pNPCTopics[90].pText;
+							}
+						}
+					}
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_NPCSetItem:
+				sub_448518_npc_set_item(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
+					_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_SetActorItem:
+				Actor::GiveItem(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
+					_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_SetNPCGroupNews:
+				pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8);
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_SetActorGroup:
+				__debugbreak();
+				*(&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);
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_ChangeGroup:
+				v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
+				v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
+				v40 = uNumActors;
+				__debugbreak();
+				if ( (signed int)uNumActors > 0 )
+					{
+					v41 = pActors;//[0].uGroup;
+					do
+						{
+						if ( v41->uGroup == v38 )
+							v41->uGroup = v39;
+						++v41;
+						--v40;
+						}
+						while ( v40 );
+					}
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_ChangeGroupAlly:
+				v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
+				v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
+				v44 = uNumActors;
+				__debugbreak();
+				if ( (signed int)uNumActors > 0 )
+					{
+					v45 = pActors;//[0].uAlly;
+					do
+						{
+						if ( v45->uGroup == v42 )
+							v45->uAlly = v43;
+						++v45;
+						--v44;
+						}
+						while ( v44 );
+					}
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_MoveNPC:
+				pNPCStats->pNewNPCData[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)].Location2D = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
+				if ( ptr_507BC0 )
+					{
+					v46 = ptr_507BC0->ptr_1C;
+					if ( v46 == (void *)165 )
+						{
+						sub_4BD8B5();
+						pVideoPlayer->Unload();
+						ptr_507BC0->Release();
+						pParty->uFlags &= 0xFFFFFFFDu;
+						_5C3420_pDecoration = (LevelDecoration *)1;
+						if ( EnterHouse((enum HOUSE_TYPE)165) )
+							{
+							pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0);
+							v47 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0);
+							ptr_507BC0 = v47;
+							v48 = v47->pControlsHead;
+							if ( v48 )
+								{
+								do
+									{
+									v49 = v48->pNext;
+									pAllocator->FreeChunk(v48);
+									v48 = v49;
+									}
+									while ( v49 );
+									v47 = ptr_507BC0;
+								}
+							v47->pControlsHead = 0;
+							ptr_507BC0->pControlsTail = 0;
+							ptr_507BC0->uNumControls = 0;
+							}
+						}
+					else
+						{
+						if ( v46 == (void *)553 )
+							pVideoPlayer->bLoopPlaying = 0;
+						}
+					}
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_Jmp:
+				//v124 = -1;
+				v122 = _evt->v5 - 1;
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_ShowFace:
+				v50 = _evt->v5;
+				if ( (unsigned __int8)v50 <= 3u )
+					{
+					v117 = 0;
+					v113 = _evt->v6;
+					v53 = (unsigned __int8)v50;
+					v52 = &pParty->pPlayers[v53];
+					v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117);
+					++v122;
+					//v4 = v124;
+					//v5 = pSomeEVT;
+					//v6 = v123;
+					//v7 = "";
+					break;
+					}
+				if ( v50 == 4 )
+					{
+					v117 = 0;
+					v113 = _evt->v6;
+					v52 = pPlayers[uActiveCharacter];
+					v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117);
+					++v122;
+					//v4 = v124;
+					//v5 = pSomeEVT;
+					//v6 = v123;
+					//v7 = "";
+					break;
+					}
+				if ( v50 != 5 )
+					{
+					v117 = 0;
+					v113 = _evt->v6;
+					v53 = rand() % 4;
+					v52 = &pParty->pPlayers[v53];
+					v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117);
+					++v122;
+					//v4 = v124;
+					//v5 = pSomeEVT;
+					//v6 = v123;
+					//v7 = "";
+					break;
+					}
+				v51 = pParty->pPlayers;
+				do
+					{
+					v51->PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
+					++v51;
+					}
+					while ( (signed int)v51 < (signed int)pParty->pHirelings );
+					//LABEL_291:
+					++v122;
+					//v4 = v124;
+					//v5 = pSomeEVT;
+					//v6 = v123;
+					//v7 = "";
+					break;
+			case EVENT_CharacterAnimation:
+				v54 = _evt->v5;
+				if ( (unsigned __int8)v54 <= 3u )
+					{
+					v118 = 0;
+					v114 = _evt->v6;
+					v57 = (unsigned __int8)v54;
+					goto LABEL_119;
+					}
+				if ( v54 == 4 )
+					{
+					v118 = 0;
+					v114 = _evt->v6;
+					v56 = pPlayers[uActiveCharacter];
+					goto LABEL_120;
+					}
+				if ( v54 != 5 )
+					{
+					v118 = 0;
+					v114 = _evt->v6;
+					v57 = rand() % 4;
+LABEL_119:
+					v56 = &pParty->pPlayers[v57];
+LABEL_120:
+					v56->PlaySound((PlayerSpeech)v114, v118);
+					++v122;
+					//v4 = v124;
+					//v5 = pSomeEVT;
+					//v6 = v123;
+					//v7 = "";
+					break;
+					}
+				v55 = pParty->pPlayers;
+				for (int iii = 0; iii < 4; ++iii)
+					{
+					v55->PlaySound((PlayerSpeech)_evt->v6, 0);
+					++v55;
+					}
+				//while ( (signed int)v55 < (signed int)pParty->pHirelings );
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_ForPartyMember:
+				v127 = _evt->v5;
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_SummonItem:
+				sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
+					_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8),
+					_evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8),
+					_evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8),
+					_evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8),
+					_evt->v25, _evt->v26, 0, 0);
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_Compare:
+				v58 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
+				if ( v127 == 5 )
+					{
+					v130 = 0;
+					v59 = pParty->pPlayers;
+					while ( 1 )
+						{
+						LOBYTE(v60) = v59->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v58);
+						if ( v60 )
+							break;
+						++v130;
+						++v59;
+						if ( (signed int)v59 >= (signed int)pParty->pHirelings )
+							{
+							++v122;
+							//v4 = v124;
+							//v5 = pSomeEVT;
+							//v6 = v123;
+							//v7 = "";
+							break;
+							}
+						}
+LABEL_129:
+					v11 = _evt->v11;
+					goto LABEL_130;
+					}
+				if ( v127 < 0 )
+					goto LABEL_139;
+				v61 = v127;
+				if ( v127 <= 3 )
+					goto LABEL_137;
+				if ( v127 == 4 )
+					{
+					if ( uActiveCharacter )
+						{
+						v6 = pPlayers[uActiveCharacter];
+						goto LABEL_138;
+						}
+					}
+				else
+					{
+					if ( v127 != 6 )
+						goto LABEL_139;
+					}
+				v61 = rand() % 4;
+				//v5 = pSomeEVT;
+LABEL_137:
+				v6 = &pParty->pPlayers[v61];
+LABEL_138:
+				//v123 = v6;
+LABEL_139:
+				LOBYTE(v62) = ((Player *)v6)->CompareVariable(
+					(enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)),
+					v58);
+LABEL_140:
+				if ( v62 )
+					goto LABEL_129;
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_IsActorAlive:
+				v62 = IsActorAlive(
+					_evt->v5,
+					_evt->v6 + ((_evt->v7 + ((_evt->v8 + ((uint)_evt->v9 << 8)) << 8)) << 8),
+					_evt->v10);
+				goto LABEL_140;
+			case EVENT_Substract:
+				v63 = (void *)(_evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8));
+				if ( _evt->v5 + ((uint)_evt->v6 << 8) == VAR_PlayerItemInHands )
+					{
+					v64 = 0;
+					if ( (void *)pParty->pPickedItem.uItemID == v63 )
+						{
+						pMouse->RemoveHoldingItem();
+						++v122;
+						//v4 = v124;
+						//v5 = pSomeEVT;
+						//v6 = v123;
+						//v7 = "";
+						break;
+						}
+					v65 = 0;
+					v66 = pPlayers[uActiveCharacter];
+					v67 = (int)v66->pInventoryIndices;
+					do
+						{
+						if ( *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v67 + 5] == v63 )
+							{
+							v66->RemoveItemAtInventoryIndex(v65);
+							++v122;
+							//v4 = v124;
+							//v5 = pSomeEVT;
+							//v6 = v123;
+							//v7 = "";
+							break;
+							}
+						++v65;
+						v67 += 4;
+						}
+						while ( (signed int)v65 < 126 );
+						v68 = 0;
+						v69 = (int)&v66->pEquipment;
+						do
+							{
+							if ( *(int *)v69 && *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v69 + 5] == v63 )
+								{
+								*(&v66->pEquipment.uOffHand + v68) = 0;
+								++v122;
+								//v4 = v124;
+								//v5 = pSomeEVT;
+								//v6 = v123;
+								//v7 = "";
+								break;
+								}
+							++v68;
+							v69 += 4;
+							}
+							while ( v68 < 16 );
+							v125 = (signed int)&pPlayers[1];
+							while ( 1 )
+								{
+								v70 = *(Player **)v125;
+								if ( !v64 )
+									{
+									v71 = 0;
+									v72 = (int)v70->pInventoryIndices;
+									do
+										{
+										if ( *(void **)&v70->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v72 + 5] == v63 )
+											{
+											v70->RemoveItemAtInventoryIndex(v71);
+											goto LABEL_169;
+											}
+										++v71;
+										v72 += 4;
+										}
+										while ( (signed int)v71 < 126 );
+										v73 = 0;
+										v74 = (int)&v70->pEquipment;
+										while ( !*(int *)v74
+											|| *(void **)&v70->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v74 + 5] != v63 )
+											{
+											++v73;
+											v74 += 4;
+											if ( v73 >= 16 )
+												goto LABEL_170;
+											}
+										*(&v70->pEquipment.uOffHand + v73) = 0;
+LABEL_169:
+										v64 = 1;
+									}
+LABEL_170:
+								v125 += 4;
+								if ( v125 > (signed int)&pPlayers[4] )
+									{
+									++v122;
+									//v4 = v124;
+									//v5 = pSomeEVT;
+									//v6 = v123;
+									//v7 = "";
+									break;
+									}
+								}
+					}
+				v75 = v127;
+				if ( v127 != 5 )
+					{
+					if ( v127 < 0 )
+						goto LABEL_183;
+					if ( v127 > 3 )
+						{
+						if ( v127 != 4 )
+							{
+							if ( v127 == 6 )
+								goto LABEL_180;
+LABEL_183:
+							((Player *)v6)->SubtractVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63);
+							++v122;
+							//v4 = v124;
+							//v5 = pSomeEVT;
+							//v6 = v123;
+							//v7 = "";
+							break;
+							}
+						if ( uActiveCharacter )
+							{
+							v6 = pPlayers[uActiveCharacter];
+							goto LABEL_182;
+							}
+LABEL_180:
+						v75 = rand() % 4;
+						//v5 = pSomeEVT;
+						}
+					v6 = &pParty->pPlayers[v75];
+LABEL_182:
+					//v123 = v6;
+					goto LABEL_183;
+					}
+				v76 = pParty->pPlayers;
+				v130 = 4;
+				do
+					{
+					v76->SubtractVariable(
+						(enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)),
+						v63);
+					++v76;
+					}
+					while ( (signed int)v76 < (signed int)pParty->pHirelings );
+					++v122;
+					//v4 = v124;
+					//v5 = pSomeEVT;
+					//v6 = v123;
+					//v7 = "";
+					break;
+			case EVENT_Set:
+				v77 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
+				v78 = v127;
+				if ( v127 != 5 )
+					{
+					if ( v127 < 0 )
+						goto LABEL_197;
+					if ( v127 > 3 )
+						{
+						if ( v127 != 4 )
+							{
+							if ( v127 == 6 )
+								goto LABEL_194;
+LABEL_197:
+							((Player *)v6)->SetVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77);
+							++v122;
+							//v4 = v124;
+							//v5 = pSomeEVT;
+							//v6 = v123;
+							//v7 = "";
+							break;
+							}
+						if ( uActiveCharacter )
+							{
+							v6 = pPlayers[uActiveCharacter];
+							goto LABEL_196;
+							}
+LABEL_194:
+						v78 = rand() % 4;
+						//v5 = pSomeEVT;
+						}
+					v6 = &pParty->pPlayers[v78];
+LABEL_196:
+					//v123 = v6;
+					goto LABEL_197;
+					}
+				v79 = pParty->pPlayers;
+				v130 = 4;
+				do
+					{
+					v79->SetVariable(
+						(enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)),
+						v77);
+					++v79;
+					}
+					while ( (signed int)v79 < (signed int)pParty->pHirelings );
+					++v122;
+					//v4 = v124;
+					//v5 = pSomeEVT;
+					//v6 = v123;
+					//v7 = "";
+					break;
+			case EVENT_Add:
+				v80 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
+				v81 = v127;
+				if ( v127 != 5 )
+					{
+					if ( v127 < 0 )
+						goto LABEL_211;
+					if ( v127 > 3 )
+						{
+						if ( v127 != 4 )
+							{
+							if ( v127 == 6 )
+								goto LABEL_208;
+LABEL_211:
+							((Player *)v6)->AddVariable(
+								(enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)),
+								v80);
+							goto LABEL_212;
+							}
+						if ( uActiveCharacter )
+							{
+							v6 = pPlayers[uActiveCharacter];
+							goto LABEL_210;
+							}
+LABEL_208:
+						v81 = rand() % 4;
+						//v5 = pSomeEVT;
+						}
+					v6 = &pParty->pPlayers[v81];
+LABEL_210:
+					//v123 = v6;
+					goto LABEL_211;
+					}
+				v82 = pParty->pPlayers;
+				v130 = 4;
+				do
+					{
+					v82->AddVariable(
+						(enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)),
+						v80);
+					++v82;
+					}
+					while ( (signed int)v82 < (signed int)pParty->pHirelings );
+LABEL_212:
+					v83 = _evt->v5 + ((uint)_evt->v6 << 8);
+					if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
+						viewparams->bRedrawGameUI = 1;
+					++v122;
+					//v4 = v124;
+					//v5 = pSomeEVT;
+					//v6 = v123;
+					//v7 = "";
+					break;
+			case EVENT_InputString:
+				if ( !dword_597F18 )
+					{
+					strcpy(
+						GameUI_StatusBar_TimedString,
+						&pLevelStr[pLevelStrOffsets[_evt->v5
+						+ ((_evt->v6
+						+ ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]);
+					v105 = v122;
+					v121 = 26;
+LABEL_295:
+					sub_4451A8_press_any_key(uEventID, v105, v121);
+LABEL_301:
+					if ( v133 == 1 )
+LABEL_302:
+					OnMapLeave();
+					return;
+					}
+				v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8);
+				if ( !_strcmpi(
+					GameUI_StatusBar_TimedString,
+					&pLevelStr[pLevelStrOffsets[_evt->v9
+					+ ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]])
+					|| !_strcmpi(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[v84]]) )
+					{
+					v11 = _evt->v17;
+LABEL_130:
+					//v124 = -1;
+LABEL_131:
+					v122 = v11 - 1;
+					}
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_RandomGoTo:
+				//v124 = -1;
+				v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0)
+					+ (_evt->v10 != 0)));
+				goto LABEL_131;
+			case EVENT_ReceiveDamage:
+				v85 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
+				v86 = _evt->v5;
+				if ( (unsigned __int8)v86 <= 3u )
+					{
+					v119 = _evt->v6;
+					v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
+					v89 = (unsigned __int8)v86;
+					goto LABEL_233;
+					}
+				if ( v86 == 4 )
+					{
+					if ( !uActiveCharacter )
+						{
+						++v122;
+						//v4 = v124;
+						//v5 = pSomeEVT;
+						//v6 = v123;
+						//v7 = "";
+						break;
+						}
+					v119 = _evt->v6;
+					v88 = pPlayers[uActiveCharacter];
+					v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
+					goto LABEL_234;
+					}
+				if ( v86 != 5 )
+					{
+					v119 = _evt->v6;
+					v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v1 << 8)) << 8)) << 8);
+					v89 = rand() % 4;
+LABEL_233:
+					v88 = &pParty->pPlayers[v89];
+LABEL_234:
+					v88->ReceiveDamage(v115, v119);
+					++v122;
+					//v4 = v124;
+					//v5 = pSomeEVT;
+					//v6 = v123;
+					//v7 = "";
+					break;
+					}
+				v87 = pParty->pPlayers;
+				do
+					{
+					v87->ReceiveDamage(v85, _evt->v6);
+					++v87;
+					}
+					while ( (signed int)v87 < (signed int)pParty->pHirelings );
+					++v122;
+					//v4 = v124;
+					//v5 = pSomeEVT;
+					//v6 = v123;
+					//v7 = "";
+					break;
+			case EVENT_ToggleIndoorLight:
+				pIndoor->ToggleLight(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9);
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_SetFacesBit:
+				sub_44892E_set_faces_bit(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
+					_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_ToggleChestFlag:
+				Chest::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
+					_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_ToggleActorFlag:
+				Actor::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
+					_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_ToggleActorGroupFlag:
+				ToggleActorGroupFlag(
+					_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
+					_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8),
+					_evt->v13);
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_SetSnow:
+				if ( !_evt->v5 )
+					pWeather->bRenderSnow = _evt->v6 != 0;
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_StatusText:
+				v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
+				if ( _5C3420_pDecoration )
+					{
+					if ( _5C3420_pDecoration == (LevelDecoration *)1 )
+						{
+						ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
+						++v122;
+						//v4 = v124;
+						//v5 = pSomeEVT;
+						//v6 = v123;
+						//v7 = "";
+						break;
+						}
+					if ( a3 == 1 )
+						{
+						v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
+						//LABEL_248:
+						ShowStatusBarString(v91, 2u);
+						++v122;
+						//v4 = v124;
+						//v5 = pSomeEVT;
+						//v6 = v123;
+						//v7 = "";
+						break;
+						}
+					}
+				else
+					{
+					if ( a3 == 1 )
+						{
+						v91 = &pLevelStr[pLevelStrOffsets[v90]];
+						ShowStatusBarString(v91, 2u);
+						++v122;
+						//v4 = v124;
+						//v5 = pSomeEVT;
+						//v6 = v123;
+						//v7 = "";
+						break;
+						}
+					}
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_ShowMessage:
+				v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
+				if ( _5C3420_pDecoration )
+					{
+					v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92];
+					byte_5B0938[0] = 0;
+					ptr_F8B1E8 = v93;
+					}
+				else
+					{
+					strcpy(byte_5B0938, &pLevelStr[pLevelStrOffsets[v92]]);
+					}
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_CastSpell:
+				sub_448DF8_cast_spell(_evt->v5, _evt->v6, _evt->v7, _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8),
+					_evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8),
+					_evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8),
+					_evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8),
+					_evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8),
+					_evt->v28 + ((_evt->v29 + ((_evt->v30 + ((uint)_evt->v31 << 8)) << 8)) << 8));
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_SetTexture:
+				sub_44861E_set_texture(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), (char *)&_evt->v9);
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_SetSprite:
+				SetDecorationSprite(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9, (char *)&_evt->v10);
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_SummonMonsters:
+				sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,
+					_evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8),
+					_evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8),
+					_evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8),
+					_evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8),
+					_evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8));
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_MouseOver:
+			case EVENT_LocationName:
+				--v122;
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_ChangeDoorState:
+				sub_449A49_door_switch_animation(_evt->v5, _evt->v6);
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_OpenChest:
+				if ( !Chest::Open(_evt->v5) )
+					goto LABEL_301;
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_MoveToMap:
+				v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
+				v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
+				v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
+				v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8);
+				v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8);
+				v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8);
+				v96 = _evt->v25;
+				v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8);
+				v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8);
+				if ( _evt->v29 || _evt->v30 )
+					{
+					if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode )
+						pRenderer->_49FD3A();
+					sub_444839_move_map(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31);
+					dword_5C3418 = uEventID;
+					dword_5C341C = v122 + 1;
+					goto LABEL_301;
+					}
+				_5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
+				_5B65A8_npcdata_uflags_or_other = v94;
+				_5B65B0_npcdata_rep_or_other = v126;
+				if ( v129 == -1 )
+					{
+					v98 = _5B65B4_npcdata_loword_house_or_other;
+					}
+				else
+					{
+					v98 = v129 & stru_5C6E00->uDoublePiMask;
+					_5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask;
+					}
+				v99 = (char *)&_evt->v31;
+				_5B65B8_npcdata_hiword_house_or_other = v95;
+				dword_5B65BC = v97;
+				v100 = v94 | v132 | v126 | v95 | v97 | v98;
+				dword_5B65C0 = v100;
+				if ( *v99 == 48 )
+					{
+					if ( v100 )
+						{
+						pParty->vPosition.x = v135;
+						pParty->vPosition.y = v132;
+						pParty->vPosition.z = v126;
+						pParty->uFallStartY = v126;
+						if ( _5B65B4_npcdata_loword_house_or_other != -1 )
+							pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other;
+						_5B65B4_npcdata_loword_house_or_other = -1;
+						v120 = 0;
+						v116 = 0;
+						v111 = 0;
+						v110 = 0;
+						v109 = -1;
+						v108 = 0;
+						v107 = 0;
+						pParty->sRotationX = v95;
+						pParty->uFallSpeed = v134;
+						dword_5B65C0 = 0;
+						dword_5B65BC = 0;
+						_5B65B8_npcdata_hiword_house_or_other = 0;
+						_5B65B0_npcdata_rep_or_other = 0;
+						_5B65AC_npcdata_fame_or_other = 0;
+						_5B65A8_npcdata_uflags_or_other = 0;
+						v106 = 232;
+LABEL_280:
+						pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120);
+						}
+					}
+				else
+					{
+					pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((_5C3420_pDecoration == 0) + 1);
+					sub_44987B(v99, 0);
+					v133 = 1;
+					if ( pCurrentScreen == SCREEN_HOUSE )
+						{
+						if ( uGameState == 2 )
+							{
+							pAudioPlayer->StopChannels(-1, -1);
+							dword_F8B19C = 0;
+							while ( sub_4BD8B5() )
+								;
+							pVideoPlayer->Unload();
+							ptr_507BC0->Release();
+							ptr_507BC0 = 0;
+							if ( pMessageQueue_50CBD0->uNumMessages )
+								pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
+							pCurrentScreen = SCREEN_GAME;
+							viewparams->bRedrawGameUI = 1;
+							array_5913D8[6] = 0;
+							pDialogueWindow->Release();
+							dword_F8B19C = 0;
+							pDialogueWindow = 0;
+							pIcons_LOD->_40F9C5();
+							}
+						goto LABEL_302;
+						}
+					}
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_PlaySound:
+				v120 = 0;
+				v116 = 0;
+				v111 = 0;
+				v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8);
+				v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
+				v108 = 0;
+				v107 = 0;
+				v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
+				goto LABEL_280;
+			case EVENT_GiveItem:
+				item.Reset();
+				//v101 = &pSomeEVT[v9];
+				v102 = _evt->v7
+					+ ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
+				pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item);
+				if ( v102 )
+					item.uItemID = v102;
+				pParty->SetHoldingItem(&item);
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_SpeakInHouse:
+				v103 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
+				if ( EnterHouse((enum HOUSE_TYPE)(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8))) )
+					{
+					if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode )
+						pRenderer->_49FD3A();
+					pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0);
+					pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0);
+					v104 = 187;
+					if ( uCurrentHouse_Animation != 167 )
+						v104 = v103;
+					ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0);
+					ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
+					ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
+					ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
+					ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
+					ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0);
+					}
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+			case EVENT_PressAnyKey:
+				v121 = 33;
+				v105 = v122 + 1;
+				goto LABEL_295;
+			case EVENT_Exit:
+				goto LABEL_301;
+			default:
+				++v122;
+				//v4 = v124;
+				//v5 = pSomeEVT;
+				//v6 = v123;
+				//v7 = "";
+				break;
+				}
+			}
+		//++v4;
+		//v124 = v4;
+		//if ( v4 >= (signed int)uSomeEVT_NumEvents )
+		//goto LABEL_301;
+		//}
+		}
+	}
+
--- a/Events.h	Tue Feb 19 15:40:11 2013 +0200
+++ b/Events.h	Wed Feb 20 00:26:17 2013 +0400
@@ -5,15 +5,20 @@
 
 /*  167 */
 #pragma pack(push, 1)
-struct Event
+struct EventIndex
 {
   int uEventID;
-  int field_4;
+  int event_sequence_num;
   unsigned int uEventOffsetInEVT;
 };
 #pragma pack(pop)
 
-
+// raw event struct 
+// header
+//  size_event 1 header+data
+//  event id  2 3
+// event_sequence_num
+// event data
 #pragma pack(push, 1)
 struct _evt_raw
 {
@@ -21,6 +26,7 @@
   unsigned char v1;
   unsigned char v2;
   unsigned char v3;
+
   unsigned char v4;
   unsigned char v5;
   unsigned char v6;
@@ -289,17 +295,17 @@
 
 
 
-extern Event pSomeOtherEVT_Events[4400];
+extern EventIndex pSomeOtherEVT_Events[4400];
 extern unsigned int uSomeOtherEVT_NumEvents;
 extern char *pSomeOtherEVT;
-extern Event pSomeEVT_Events[4400];
+extern EventIndex pSomeEVT_Events[4400];
 extern unsigned int uSomeEVT_NumEvents;
 extern char *pSomeEVT;
 
 extern unsigned int uGlobalEVT_NumEvents;
 extern unsigned int uGlobalEVT_Size;
 extern char pGlobalEVT[46080];
-extern Event pGlobalEVT_Events[4400];
+extern EventIndex pGlobalEVT_Index[4400];
 
 extern unsigned int pLevelStrOffsets[500];
 extern unsigned int uLevelStrNumStrings;
@@ -308,11 +314,13 @@
 extern unsigned int uLevelEVT_Size;
 extern char pLevelStr[9216];
 extern char pLevelEVT[9216];
-extern Event pLevelEVT_Events[4400];
+extern EventIndex pLevelEVT_Index[4400];
 
 
-
-
+unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize);
+void  Initialize_GlobalEVT();
+void  LoadLevel_InitializeLevelEvt();
+void  EventProcessor(int uEventID, int a2, int a3);
 
 
 
--- a/Indoor.cpp	Tue Feb 19 15:40:11 2013 +0200
+++ b/Indoor.cpp	Wed Feb 20 00:26:17 2013 +0400
@@ -3463,14 +3463,14 @@
 int BLVFaceExtra::HasEventint()
 {
   signed int v1; // eax@1
-  Event *v2; // esi@2
+  EventIndex *v2; // esi@2
   signed int result; // eax@5
   signed int v4; // eax@6
 
   v1 = 0;
   if ( (signed int)(uLevelEVT_NumEvents - 1) <= 0 )
     goto LABEL_5;
-  v2 = pLevelEVT_Events;
+  v2 = pLevelEVT_Index;
   while ( v2->uEventID != this->uEventID )
   {
     ++v1;
@@ -3479,8 +3479,8 @@
       goto LABEL_5;
   }
   v4 = v1;
-  if ( pLevelEVT[pLevelEVT_Events[v4 + 1].uEventOffsetInEVT + 4] != 1
-    || pLevelEVT[pLevelEVT_Events[v4].uEventOffsetInEVT + 4] != 4 )
+  if ( pLevelEVT[pLevelEVT_Index[v4 + 1].uEventOffsetInEVT + 4] != 1
+    || pLevelEVT[pLevelEVT_Index[v4].uEventOffsetInEVT + 4] != 4 )
 LABEL_5:
     result = 0;
   else
--- a/NPC.cpp	Tue Feb 19 15:40:11 2013 +0200
+++ b/NPC.cpp	Wed Feb 20 00:26:17 2013 +0400
@@ -18,7 +18,7 @@
 void  InitializeTransitions();
 void  InitializeAutonotes();
 void  InitializeQuests();
-bool   CheckPortretAgainsSex(int portret_num, int sex); 
+bool   CheckPortretAgainstSex(int portret_num, int sex); 
 
 //----- (00476977) --------------------------------------------------------
 void NPCStats::InitializeNPCText()
@@ -518,7 +518,7 @@
 	}
 
 //----- (0047730C) --------------------------------------------------------
-bool  CheckPortretAgainsSex(int a1, int)
+bool  CheckPortretAgainstSex(int a1, int)
 	{
 	return true;
 	}
@@ -553,7 +553,7 @@
 		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 		0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0};
 
-	unsigned __int8 seed = (unsigned __int8)((double)(npc_uid - 1) * 0.33333334);
+	unsigned __int8 seed = (unsigned __int8)((double)(npc_uid - 1)/3.0);
 	uNPCSex = NPCSexGenTable[seed];
 	uRace = NPCRaceGenTable[seed];
 	pNPCDataBuff->uSex = uNPCSex;
@@ -617,7 +617,7 @@
 			}
 
 		uGeneratedPortret = uPortretMin + rand() % (uPortretMax - uPortretMin + 1);
-		if ( CheckPortretAgainsSex(uGeneratedPortret, uNPCSex))
+		if ( CheckPortretAgainstSex(uGeneratedPortret, uNPCSex))
 			break_gen = true;
 		++gen_attempts;
 		if ( gen_attempts >= 4 )
--- a/Outdoor.cpp	Tue Feb 19 15:40:11 2013 +0200
+++ b/Outdoor.cpp	Wed Feb 20 00:26:17 2013 +0400
@@ -3146,14 +3146,14 @@
 bool ODMFace::HasEventHint()
 {
   signed int v1; // eax@1
-  Event *v2; // esi@2
+  EventIndex *v2; // esi@2
   bool result; // eax@5
   signed int v4; // eax@6
 
   v1 = 0;
   if ( (signed int)(uLevelEVT_NumEvents - 1) <= 0 )
     goto LABEL_5;
-  v2 = pLevelEVT_Events;
+  v2 = pLevelEVT_Index;
   while ( v2->uEventID != this->sCogTriggeredID )
   {
     ++v1;
@@ -3162,8 +3162,8 @@
       goto LABEL_5;
   }
   v4 = v1;
-  if ( pLevelEVT[pLevelEVT_Events[v4 + 1].uEventOffsetInEVT + 4] != 1
-    || pLevelEVT[pLevelEVT_Events[v4].uEventOffsetInEVT + 4] != 4 )
+  if ( pLevelEVT[pLevelEVT_Index[v4 + 1].uEventOffsetInEVT + 4] != 1
+    || pLevelEVT[pLevelEVT_Index[v4].uEventOffsetInEVT + 4] != 4 )
 LABEL_5:
     result = 0;
   else
--- a/mm7_3.cpp	Tue Feb 19 15:40:11 2013 +0200
+++ b/mm7_3.cpp	Wed Feb 20 00:26:17 2013 +0400
@@ -14163,62 +14163,6 @@
 
 }
 
-//----- (00443CE1) --------------------------------------------------------
-unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize)
-{
-  FILE *pLodFile; // eax@1
-  unsigned int uTextureSize; // esi@3
-  char Args[60]; // [sp+8h] [bp-B4h]@6
-  void *ptr; // [sp+B8h] [bp-4h]@1
-  Texture DstBuf; // [sp+6Ch] [bp-50h]@1
-
-  ptr = pEvents_LOD->LoadRaw(pContainerName, 0);
-  pLodFile = pEvents_LOD->FindContainer(pContainerName, 0);
-  if ( !pLodFile )
-    Abortf("Unable to load %s", pContainerName);
-  fread(&DstBuf, 1, 48, pLodFile);
-  uTextureSize = DstBuf.uDecompressedSize;
-  if ( !DstBuf.uDecompressedSize )
-    uTextureSize = DstBuf.uTextureSize;
-  memset(&DstBuf, 0, 72);
-  if ( uTextureSize >= (signed int)uBufferSize )
-  {
-    sprintf(Args, "File %s Size %lu - Buffer size %lu", pContainerName, uTextureSize, uBufferSize);
-    Abortf(Args);
-  }
-  memcpy(pBuffer, ptr, uTextureSize);
-  pAllocator->FreeChunk(ptr);
-  return uTextureSize;
-}
-
-//----- (00443DA1) --------------------------------------------------------
-void __cdecl Initialize_GlobalEVT()
-{
-  signed int v0; // esi@1
-  unsigned int v1; // ecx@2
-  char *v2; // eax@2
-
-  v0 = 0;
-  uGlobalEVT_Size = LoadEventsToBuffer("global.evt", pGlobalEVT, 0xB400u);
-  if ( uGlobalEVT_Size )
-  {
-    uGlobalEVT_NumEvents = 0;
-    memset(pGlobalEVT_Events, 128, 0xCE40u);
-    v1 = uGlobalEVT_NumEvents;
-    v2 = (char *)&pGlobalEVT_Events[uGlobalEVT_NumEvents].field_4;
-    do
-    {
-      ++v1;
-      *((int *)v2 - 1) = (unsigned __int8)pGlobalEVT[v0 + 1] + ((unsigned __int8)pGlobalEVT[v0 + 2] << 8);
-      *(int *)v2 = (unsigned __int8)pGlobalEVT[v0 + 3];
-      *((int *)v2 + 1) = v0;
-      v2 += 12;
-      v0 += (unsigned __int8)pGlobalEVT[v0] + 1;
-    }
-    while ( v0 < (signed int)uGlobalEVT_Size );
-    uGlobalEVT_NumEvents = v1;
-  }
-}
 
 //----- (00443E31) --------------------------------------------------------
 void __cdecl LoadLevel_InitializeLevelStr()
@@ -14279,28 +14223,6 @@
   }
 }
 
-//----- (00443EF8) --------------------------------------------------------
-void __cdecl LoadLevel_InitializeLevelEvt()
-{
-  if (!uLevelEVT_Size)
-    return;
-
-  memset(array_5B5928, 0, 0xC80u);
-  memset(pLevelEVT_Events, 128, 0xCE40u);
-
-  uLevelEVT_NumEvents = 0;
-  dword_5B65C8 = 0;
-
-  for (uint i = 0, j = 0; j < uLevelEVT_Size; ++i)
-  {
-    pLevelEVT_Events[i].uEventID = pLevelEVT[j + 1] + ((unsigned short)pLevelEVT[j + 2] << 8);
-    pLevelEVT_Events[i].field_4 = pLevelEVT[j + 3];
-    pLevelEVT_Events[i].uEventOffsetInEVT = j;
-    j += pLevelEVT[j] + 1;
-
-    uLevelEVT_NumEvents++;
-  }
-}
 
 //----- (00443F95) --------------------------------------------------------
 void __cdecl OnMapLeave()
@@ -14312,7 +14234,7 @@
   v0 = 0;
   if ( (signed int)uLevelEVT_NumEvents > 0 )
   {
-    v1 = (char *)&pLevelEVT_Events[0].field_4;
+    v1 = (char *)&pLevelEVT_Index[0].event_sequence_num;
     do
     {
       if ( pLevelEVT[*((short *)v1 + 2) + 4] == 53 )
@@ -14364,7 +14286,7 @@
 
   for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
   {
-    auto pEvent = pLevelEVT_Events + i;
+    auto pEvent = pLevelEVT_Index + i;
 
     auto _evt = (_evt_raw *)(pLevelEVT + pEvent->uEventOffsetInEVT);
 
@@ -14377,7 +14299,7 @@
     }
     else if (_evt->v4 == 37)
     {
-      dword_597F18 = pEvent->field_4;
+      dword_597F18 = pEvent->event_sequence_num;
       EventProcessor(pEvent->uEventID, 0, 0);
       dword_597F18 = 0;
     }
@@ -14391,7 +14313,7 @@
       v4 = _evt->v4;
       v3->field_1C = v4;
       v3->field_8 = pEvent->uEventID;
-      v3->field_A = pEvent->field_4;
+      v3->field_A = pEvent->event_sequence_num;
       v33 = _evt->v6;
       v3->field_12 = v33;
       v32 = _evt->v7;
@@ -15817,7 +15739,7 @@
   v3 = dword_597F18;
   pSomeOtherEVT = pGlobalEVT;
   uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents;
-  memcpy(pSomeOtherEVT_Events, pGlobalEVT_Events, 0xCE40u);
+  memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, 0xCE40u);
   v4 = 1;
   v12 = 1;
   v11 = 0;
@@ -15826,7 +15748,7 @@
   do
   {
     v5 = v1;
-    if ( (void *)pSomeOtherEVT_Events[v1].uEventID == v13 && pSomeOtherEVT_Events[v5].field_4 == v3 )
+    if ( (void *)pSomeOtherEVT_Events[v1].uEventID == v13 && pSomeOtherEVT_Events[v5].event_sequence_num == v3 )
     {
       v6 = pSomeOtherEVT_Events[v5].uEventOffsetInEVT;
       v7 = &pSomeOtherEVT[v6];
@@ -15887,1527 +15809,6 @@
 }
 
 
-//----- (0044684A) --------------------------------------------------------
-void __fastcall EventProcessor(int uEventID, int a2, int a3)
-{
-  unsigned int v3; // eax@5
-  //signed int v4; // esi@7
-  //char *v5; // eax@8
-  Player *v6; // ecx@8
-  //char *v7; // ebp@8
-  //signed int v8; // edx@10
-  //int v9; // edi@12
-  //ByteArray *v10; // esi@12
-  int v11; // eax@14
-  char *v12; // eax@15
-  //char *v13; // edi@21
-  int v14; // ebp@21
-  int v15; // edi@21
-  const char *v16; // esi@21
-  bool v17; // edx@21
-  int v18; // ecx@22
-  int v19; // ebp@36
-  signed int v20; // ecx@40
-  int v21; // eax@40
-  int v22; // edx@40
-  int v23; // eax@40
-  unsigned __int16 v24; // ax@45
-  int v25; // eax@54
-  LevelDecoration *v26; // eax@55
-  int v27; // eax@57
-  int v28; // ecx@57
-  int v29; // edx@58
-  int v30; // eax@58
-  int v31; // ecx@58
-  int v32; // esi@58
-  NPCData *v33; // ecx@58
-  int v34; // esi@59
-  int v35; // esi@60
-  int v36; // esi@61
-  int v37; // esi@62
-  int v38; // eax@78
-  int v39; // ecx@78
-  size_t v40; // edx@78
-  Actor *v41; // esi@79
-  int v42; // eax@84
-  int v43; // ecx@84
-  size_t v44; // edx@84
-  Actor *v45; // esi@85
-  void *v46; // eax@91
-  GUIWindow *v47; // eax@93
-  GUIButton *v48; // ecx@93
-  GUIButton *v49; // esi@94
-  char v50; // al@100
-  Player *v51; // esi@103
-  Player *v52; // ecx@106
-  int v53; // ecx@107
-  char v54; // al@111
-  Player *v55; // esi@114
-  Player *v56; // ecx@117
-  int v57; // ecx@118
-  signed int v58; // ebp@124
-  Player *v59; // esi@125
-  int v60; // eax@126
-  int v61; // edx@133
-  int v62; // eax@139
-  void *v63; // ebp@145
-  signed int v64; // edi@146
-  unsigned int v65; // edx@148
-  Player *v66; // ecx@148
-  int v67; // esi@148
-  signed int v68; // eax@151
-  int v69; // esi@151
-  Player *v70; // ecx@158
-  unsigned int v71; // eax@159
-  int v72; // esi@159
-  signed int v73; // eax@162
-  int v74; // esi@162
-  int v75; // edx@172
-  Player *v76; // esi@173
-  signed int v77; // ebp@186
-  int v78; // edx@186
-  Player *v79; // esi@187
-  signed int v80; // ebp@200
-  int v81; // edx@200
-  Player *v82; // esi@201
-  int v83; // eax@212
-  int v84; // ebp@220
-  signed int v85; // ebp@224
-  char v86; // al@224
-  Player *v87; // esi@227
-  Player *v88; // ecx@231
-  int v89; // ecx@232
-  int v90; // eax@243
-  const char *v91; // ecx@247
-  int v92; // eax@251
-  char *v93; // eax@252
-  int v94; // ecx@262
-  int v95; // ebp@262
-  int v96; // edx@262
-  int v97; // eax@262
-  unsigned int v98; // edx@265
-  const char *v99; // esi@267
-  int v100; // edx@267
-  //char *v101; // edi@281
-  unsigned int v102; // esi@281
-  int v103; // edi@284
-  int v104; // eax@288
-  int v105; // edx@294
-  int v106; // [sp-20h] [bp-4C8h]@278
-  signed int v107; // [sp-1Ch] [bp-4C4h]@278
-  unsigned int v108; // [sp-18h] [bp-4C0h]@278
-  signed int v109; // [sp-14h] [bp-4BCh]@278
-  signed int v110; // [sp-10h] [bp-4B8h]@278
-  int v111; // [sp-Ch] [bp-4B4h]@278
-  Event *v112; // [sp-8h] [bp-4B0h]@5
-  int v113; // [sp-8h] [bp-4B0h]@106
-  int v114; // [sp-8h] [bp-4B0h]@117
-  signed int v115; // [sp-8h] [bp-4B0h]@231
-  unsigned int v116; // [sp-8h] [bp-4B0h]@278
-  int v117; // [sp-4h] [bp-4ACh]@106
-  int v118; // [sp-4h] [bp-4ACh]@117
-  int v119; // [sp-4h] [bp-4ACh]@231
-  int v120; // [sp-4h] [bp-4ACh]@278
-  int v121; // [sp-4h] [bp-4ACh]@294
-  int v122; // [sp+10h] [bp-498h]@4
-  //char *v123; // [sp+14h] [bp-494h]@0
-  //signed int v124; // [sp+18h] [bp-490h]@7
-  signed int v125; // [sp+1Ch] [bp-48Ch]@155
-  int v126; // [sp+1Ch] [bp-48Ch]@262
-  int v127; // [sp+20h] [bp-488h]@4
-  int v128; // [sp+24h] [bp-484h]@21
-  int v129; // [sp+24h] [bp-484h]@262
-  signed int v130; // [sp+28h] [bp-480h]@0
-  //int v131; // [sp+2Ch] [bp-47Ch]@1
-  int v132; // [sp+30h] [bp-478h]@262
-  signed int v133; // [sp+34h] [bp-474h]@1
-  int v134; // [sp+38h] [bp-470h]@262
-  int v135; // [sp+3Ch] [bp-46Ch]@262
-  int v136; // [sp+40h] [bp-468h]@40
-  int v137; // [sp+44h] [bp-464h]@40
-  int v138; // [sp+48h] [bp-460h]@40
-  int v139; // [sp+4Ch] [bp-45Ch]@40
-  ItemGen item; // [sp+50h] [bp-458h]@15
-  char Source[120]; // [sp+74h] [bp-434h]@15
-  char Str[120]; // [sp+ECh] [bp-3BCh]@21
-  Actor Dst; // [sp+164h] [bp-344h]@53
-
-  //v131 = uEventID;
-  v133 = 0;
-  dword_5B5920 = a2;
-  dword_5B65C4 = 0;
-  if ( !a1 )
-  {
-    if ( !GameUI_StatusBar_TimedStringTimeLeft )
-      ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here
-    return;
-  }
-  v127 = 2 * (uActiveCharacter == 0) + 4;
-  v122 = dword_597F18;
-  if ( _5C3420_pDecoration )
-  {
-    v3 = uGlobalEVT_NumEvents;
-    pSomeEVT = pGlobalEVT;
-    v112 = pGlobalEVT_Events;
-  }
-  else
-  {
-    v3 = uLevelEVT_NumEvents;
-    pSomeEVT = pLevelEVT;
-    v112 = pLevelEVT_Events;
-  }
-  uSomeEVT_NumEvents = v3;
-  memcpy(pSomeEVT_Events, v112, 0xCE40u);
-  //v4 = 0;
-  //v124 = 0;
-  for (uint i = 0; i < uSomeEVT_NumEvents; ++i)
-  {
-    //v5 = pSomeEVT;
-    //v6 = v123;
-    //v7 = "";
-    //while ( 1 )
-    //{
-      if ( dword_5B65C4 )
-        goto LABEL_301;
-      //v8 = v4;
-      if ( pSomeEVT_Events[i/*v4*/].uEventID == uEventID && pSomeEVT_Events[i/*v4*/].field_4 == v122 )
-      {
-        //v9 = pSomeEVT_Events[v8].uEventOffsetInEVT;
-        //v10 = (ByteArray *)&v5[v9];
-        auto _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[i/*v4*/].uEventOffsetInEVT);
-
-        switch (_evt->v4)
-        {
-          case EVENT_CheckSeason:
-            if ( !sub_4465DF_check_season(_evt->v5) )
-            {
-              ++v122;
-              //v4 = v124;
-              //v5 = pSomeEVT;
-              //v6 = v123;
-              //v7 = "";
-              break;
-            }
-            v11 = _evt->v6;
-            goto LABEL_130;
-          case EVENT_ShowMovie:
-            strcpy(Source, (char *)&_evt->v7);
-            v12 = (char *)&item.uExpireTime + strlen(Source) + 7;
-            if ( *v12 == 32 )
-              *v12 = 0;
-            if ( pVideoPlayer->field_54 )
-              pVideoPlayer->Unload();
-            pVideoPlayer->bStopBeforeSchedule = 0;
-            pVideoPlayer->pResetflag = 0;
-            if (pAsyncMouse)
-              pAsyncMouse->Suspend();
-            v128 = pCurrentScreen;
-            //v13 = &pSomeEVT[v9];
-            //v14 = (unsigned __int8)v13[5];
-            //v15 = (unsigned __int8)v13[6];
-            v14 = _evt->v5;
-            v15 = _evt->v6;
-            strcpy(Str, Source);
-            v16 = RemoveQuotes(Str);
-            VideoPlayer::MovieLoop(v16, 0, v14, 1);
-            if ( !_strcmpi(v16, "arbiter good") )
-            {
-              pParty->uAlignment = 0;
-              v18 = 0;
-              LOBYTE(v17) = 1;
-              SetUserInterface(v18, v17);
-              if ( !v15 || v128 == 3 )
-              {
-                pCurrentScreen = v128;
-                if ( v128 == 3 )
-                  pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
-                if ( v128 == 13 )
-                  pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u);
-              }
-              if (pAsyncMouse)
-                pAsyncMouse->Resume();
-              ++v122;
-              //v4 = v124;
-              //v5 = pSomeEVT;
-              //v6 = v123;
-              //v7 = "";
-              break;
-            }
-            if ( !_strcmpi(v16, "arbiter evil") )
-            {
-              v18 = 2;
-              pParty->uAlignment = 2;
-              LOBYTE(v17) = 1;
-              SetUserInterface(v18, v17);
-              if ( !v15 || v128 == 3 )
-              {
-                pCurrentScreen = v128;
-                if ( v128 == 3 )
-                  pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
-                if ( v128 == 13 )
-                  pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u);
-              }
-              if (pAsyncMouse)
-                pAsyncMouse->Resume();
-              ++v122;
-              //v4 = v124;
-              //v5 = pSomeEVT;
-              //v6 = v123;
-              //v7 = "";
-              break;
-            }
-            if ( !_strcmpi(v16, "pcout01") )    // moving to harmondale from emerald isle
-            {
-              Rest(0x2760u);
-              pParty->RestAndHeal();
-              pParty->field_764 = 0;
-            }
-            if ( !v15 || v128 == 3 )
-            {
-              pCurrentScreen = v128;
-              if ( v128 == 3 )
-                pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
-              if ( v128 == 13 )
-                pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u);
-            }
-            if (pAsyncMouse)
-              pAsyncMouse->Resume();
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_CheckSkill:
-            v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8);
-            if ( v127 < 0 )
-              goto LABEL_47;
-            if ( v127 <= 3 )
-            {
-              v24 = pParty->pPlayers[0].pActiveSkills[3486 * v127 + _evt->v5];
-            }
-            else
-            {
-              if ( v127 == 4 )
-              {
-                v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5];
-              }
-              else
-              {
-                if ( v127 == 5 )
-                {
-                  v20 = 0;
-                  v21 = 3486 * v130 + _evt->v5;
-                  v136 = 1;
-                  LOWORD(v21) = pParty->pPlayers[0].pActiveSkills[v21];
-                  v137 = v21 & 0x40;
-                  v138 = v21 & 0x80;
-                  v22 = v21 & 0x100;
-                  v23 = v21 & 0x3F;
-                  v139 = v22;
-                  while ( v23 < v19 || !*(&v136 + _evt->v6) )
-                  {
-                    ++v20;
-                    if ( v20 >= 4 )
-                    {
-                      ++v122;
-                      //v4 = v124;
-                      //v5 = pSomeEVT;
-                      //v6 = v123;
-                      //v7 = "";
-                      break;
-                    }
-                  }
-                  v11 = _evt->v11;
-                  goto LABEL_130;
-                }
-LABEL_47:
-                //v10 = (ByteArray *)&v5[v9];
-                v24 = pParty->pPlayers[0].pActiveSkills[_evt->v5 + 3486 * rand() % 4];
-              }
-            }
-            v136 = 1;
-            v137 = v24 & 0x40;
-            v138 = v24 & 0x80;
-            v139 = v24 & 0x100;
-            if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) )
-            {
-              v11 = _evt->v11;
-              goto LABEL_130;
-            }
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_SpeakNPC:
-            if ( a3 )
-            {
-              //Actor::Actor(&Dst);
-              memset(&Dst, 0, 0x344u);
-              dword_5B65D0_dialogue_actor_npc_id = _evt->v5
-                                                 + ((_evt->v6
-                                                   + ((_evt->v7
-                                                     + ((unsigned int)_evt->v8 << 8)) << 8)) << 8);
-              Dst.uNPC_ID = dword_5B65D0_dialogue_actor_npc_id;
-              Dst.InitializeDialogue(0);
-            }
-            else
-            {
-              bDialogueUI_InitializeActor_NPC_ID = _evt->v5
-                                                 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8);
-            }
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_ChangeEvent:
-            v25 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8);
-            if ( v25 )
-            {
-              stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = _evt->v5 - 124;
-            }
-            else
-            {
-              v26 = _5C3420_pDecoration;
-              stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = 0;
-              LOBYTE(v26->field_2) |= 0x20u;
-            }
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_SetNPCGreeting:
-            v27 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
-            v28 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
-            pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu;
-            pNPCStats->pNewNPCData[v27].greet = v28;
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_SetNPCTopic:
-            v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
-            v30 = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8);
-            v31 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
-            v32 = _evt->v9;
-            v33 = &pNPCStats->pNewNPCData[v31];
-            if ( v32 )
-            {
-              v34 = v32 - 1;
-              if ( v34 )
-              {
-                v35 = v34 - 1;
-                if ( v35 )
-                {
-                  v36 = v35 - 1;
-                  if ( v36 )
-                  {
-                    v37 = v36 - 1;
-                    if ( v37 )
-                    {
-                      if ( v37 == 1 )
-                        v33->evt_F = v30;
-                    }
-                    else
-                    {
-                      v33->evt_E = v30;
-                    }
-                  }
-                  else
-                  {
-                    v33->evt_D = v30;
-                  }
-                }
-                else
-                {
-                  v33->evt_C = v30;
-                }
-              }
-              else
-              {
-                v33->evt_B = v30;
-              }
-            }
-            else
-            {
-              v33->evt_A = v30;
-            }
-            if ( v29 == 8 )
-            {
-              if ( v30 == 78 )
-              {
-                sub_4BD8B5();
-                ptr_507BC0->Release();
-                pParty->uFlags &= 0xFFFFFFFDu;
-                if ( EnterHouse((enum HOUSE_TYPE)170) )
-                {
-                  pAudioPlayer->StopChannels(-1, -1);
-                  ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0);
-                  ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
-                  ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
-                  ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
-                  ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
-                  ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0);
-                  ptr_F8B1E8 = pNPCTopics[90].pText;
-                }
-              }
-            }
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_NPCSetItem:
-            sub_448518_npc_set_item(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
-              _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_SetActorItem:
-            Actor::GiveItem(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
-              _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_SetNPCGroupNews:
-            pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8);
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_SetActorGroup:
-            __debugbreak();
-            *(&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);
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_ChangeGroup:
-            v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
-            v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
-            v40 = uNumActors;
-            __debugbreak();
-            if ( (signed int)uNumActors > 0 )
-            {
-              v41 = pActors;//[0].uGroup;
-              do
-              {
-                if ( v41->uGroup == v38 )
-                v41->uGroup = v39;
-                ++v41;
-                --v40;
-              }
-              while ( v40 );
-            }
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_ChangeGroupAlly:
-            v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
-            v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
-            v44 = uNumActors;
-            __debugbreak();
-            if ( (signed int)uNumActors > 0 )
-            {
-              v45 = pActors;//[0].uAlly;
-              do
-              {
-                if ( v45->uGroup == v42 )
-                v45->uAlly = v43;
-                ++v45;
-                --v44;
-              }
-              while ( v44 );
-            }
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_MoveNPC:
-            pNPCStats->pNewNPCData[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)].Location2D = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
-            if ( ptr_507BC0 )
-            {
-              v46 = ptr_507BC0->ptr_1C;
-              if ( v46 == (void *)165 )
-              {
-                sub_4BD8B5();
-                pVideoPlayer->Unload();
-                ptr_507BC0->Release();
-                pParty->uFlags &= 0xFFFFFFFDu;
-                _5C3420_pDecoration = (LevelDecoration *)1;
-                if ( EnterHouse((enum HOUSE_TYPE)165) )
-                {
-                  pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0);
-                  v47 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0);
-                  ptr_507BC0 = v47;
-                  v48 = v47->pControlsHead;
-                  if ( v48 )
-                  {
-                    do
-                    {
-                      v49 = v48->pNext;
-                      pAllocator->FreeChunk(v48);
-                      v48 = v49;
-                    }
-                    while ( v49 );
-                    v47 = ptr_507BC0;
-                  }
-                  v47->pControlsHead = 0;
-                  ptr_507BC0->pControlsTail = 0;
-                  ptr_507BC0->uNumControls = 0;
-                }
-              }
-              else
-              {
-                if ( v46 == (void *)553 )
-                  pVideoPlayer->bLoopPlaying = 0;
-              }
-            }
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_Jmp:
-            //v124 = -1;
-            v122 = _evt->v5 - 1;
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_ShowFace:
-            v50 = _evt->v5;
-            if ( (unsigned __int8)v50 <= 3u )
-            {
-              v117 = 0;
-              v113 = _evt->v6;
-              v53 = (unsigned __int8)v50;
-              v52 = &pParty->pPlayers[v53];
-              v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117);
-              ++v122;
-              //v4 = v124;
-              //v5 = pSomeEVT;
-              //v6 = v123;
-              //v7 = "";
-              break;
-            }
-            if ( v50 == 4 )
-            {
-              v117 = 0;
-              v113 = _evt->v6;
-              v52 = pPlayers[uActiveCharacter];
-              v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117);
-              ++v122;
-              //v4 = v124;
-              //v5 = pSomeEVT;
-              //v6 = v123;
-              //v7 = "";
-              break;
-            }
-            if ( v50 != 5 )
-            {
-              v117 = 0;
-              v113 = _evt->v6;
-              v53 = rand() % 4;
-              v52 = &pParty->pPlayers[v53];
-              v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117);
-              ++v122;
-              //v4 = v124;
-              //v5 = pSomeEVT;
-              //v6 = v123;
-              //v7 = "";
-              break;
-            }
-            v51 = pParty->pPlayers;
-            do
-            {
-              v51->PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
-              ++v51;
-            }
-            while ( (signed int)v51 < (signed int)pParty->pHirelings );
-//LABEL_291:
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_CharacterAnimation:
-            v54 = _evt->v5;
-            if ( (unsigned __int8)v54 <= 3u )
-            {
-              v118 = 0;
-              v114 = _evt->v6;
-              v57 = (unsigned __int8)v54;
-              goto LABEL_119;
-            }
-            if ( v54 == 4 )
-            {
-              v118 = 0;
-              v114 = _evt->v6;
-              v56 = pPlayers[uActiveCharacter];
-              goto LABEL_120;
-            }
-            if ( v54 != 5 )
-            {
-              v118 = 0;
-              v114 = _evt->v6;
-              v57 = rand() % 4;
-LABEL_119:
-              v56 = &pParty->pPlayers[v57];
-LABEL_120:
-              v56->PlaySound((PlayerSpeech)v114, v118);
-              ++v122;
-              //v4 = v124;
-              //v5 = pSomeEVT;
-              //v6 = v123;
-              //v7 = "";
-              break;
-            }
-            v55 = pParty->pPlayers;
-            for (int iii = 0; iii < 4; ++iii)
-            {
-              v55->PlaySound((PlayerSpeech)_evt->v6, 0);
-              ++v55;
-            }
-            //while ( (signed int)v55 < (signed int)pParty->pHirelings );
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_ForPartyMember:
-            v127 = _evt->v5;
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_SummonItem:
-            sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
-              _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8),
-              _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8),
-              _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8),
-              _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8),
-              _evt->v25, _evt->v26, 0, 0);
-              ++v122;
-              //v4 = v124;
-              //v5 = pSomeEVT;
-              //v6 = v123;
-              //v7 = "";
-              break;
-          case EVENT_Compare:
-            v58 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
-            if ( v127 == 5 )
-            {
-              v130 = 0;
-              v59 = pParty->pPlayers;
-              while ( 1 )
-              {
-                LOBYTE(v60) = v59->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v58);
-                if ( v60 )
-                  break;
-                ++v130;
-                ++v59;
-                if ( (signed int)v59 >= (signed int)pParty->pHirelings )
-                {
-                  ++v122;
-                  //v4 = v124;
-                  //v5 = pSomeEVT;
-                  //v6 = v123;
-                  //v7 = "";
-                  break;
-                }
-              }
-LABEL_129:
-              v11 = _evt->v11;
-              goto LABEL_130;
-            }
-            if ( v127 < 0 )
-              goto LABEL_139;
-            v61 = v127;
-            if ( v127 <= 3 )
-              goto LABEL_137;
-            if ( v127 == 4 )
-            {
-              if ( uActiveCharacter )
-              {
-                v6 = pPlayers[uActiveCharacter];
-                goto LABEL_138;
-              }
-            }
-            else
-            {
-              if ( v127 != 6 )
-                goto LABEL_139;
-            }
-            v61 = rand() % 4;
-            //v5 = pSomeEVT;
-LABEL_137:
-            v6 = &pParty->pPlayers[v61];
-LABEL_138:
-            //v123 = v6;
-LABEL_139:
-            LOBYTE(v62) = ((Player *)v6)->CompareVariable(
-                            (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)),
-                            v58);
-LABEL_140:
-            if ( v62 )
-              goto LABEL_129;
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_IsActorAlive:
-            v62 = IsActorAlive(
-                    _evt->v5,
-                    _evt->v6 + ((_evt->v7 + ((_evt->v8 + ((uint)_evt->v9 << 8)) << 8)) << 8),
-                    _evt->v10);
-            goto LABEL_140;
-          case EVENT_Substract:
-            v63 = (void *)(_evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8));
-            if ( _evt->v5 + ((uint)_evt->v6 << 8) == VAR_PlayerItemInHands )
-            {
-              v64 = 0;
-              if ( (void *)pParty->pPickedItem.uItemID == v63 )
-              {
-                pMouse->RemoveHoldingItem();
-                ++v122;
-                //v4 = v124;
-                //v5 = pSomeEVT;
-                //v6 = v123;
-                //v7 = "";
-                break;
-              }
-              v65 = 0;
-              v66 = pPlayers[uActiveCharacter];
-              v67 = (int)v66->pInventoryIndices;
-              do
-              {
-                if ( *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v67 + 5] == v63 )
-                {
-                  v66->RemoveItemAtInventoryIndex(v65);
-                  ++v122;
-                  //v4 = v124;
-                  //v5 = pSomeEVT;
-                  //v6 = v123;
-                  //v7 = "";
-                  break;
-                }
-                ++v65;
-                v67 += 4;
-              }
-              while ( (signed int)v65 < 126 );
-              v68 = 0;
-              v69 = (int)&v66->pEquipment;
-              do
-              {
-                if ( *(int *)v69 && *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v69 + 5] == v63 )
-                {
-                  *(&v66->pEquipment.uOffHand + v68) = 0;
-                  ++v122;
-                  //v4 = v124;
-                  //v5 = pSomeEVT;
-                  //v6 = v123;
-                  //v7 = "";
-                  break;
-                }
-                ++v68;
-                v69 += 4;
-              }
-              while ( v68 < 16 );
-              v125 = (signed int)&pPlayers[1];
-              while ( 1 )
-              {
-                v70 = *(Player **)v125;
-                if ( !v64 )
-                {
-                  v71 = 0;
-                  v72 = (int)v70->pInventoryIndices;
-                  do
-                  {
-                    if ( *(void **)&v70->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v72 + 5] == v63 )
-                    {
-                      v70->RemoveItemAtInventoryIndex(v71);
-                      goto LABEL_169;
-                    }
-                    ++v71;
-                    v72 += 4;
-                  }
-                  while ( (signed int)v71 < 126 );
-                  v73 = 0;
-                  v74 = (int)&v70->pEquipment;
-                  while ( !*(int *)v74
-                       || *(void **)&v70->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v74 + 5] != v63 )
-                  {
-                    ++v73;
-                    v74 += 4;
-                    if ( v73 >= 16 )
-                      goto LABEL_170;
-                  }
-                  *(&v70->pEquipment.uOffHand + v73) = 0;
-LABEL_169:
-                  v64 = 1;
-                }
-LABEL_170:
-                v125 += 4;
-                if ( v125 > (signed int)&pPlayers[4] )
-                {
-                  ++v122;
-                  //v4 = v124;
-                  //v5 = pSomeEVT;
-                  //v6 = v123;
-                  //v7 = "";
-                  break;
-                }
-              }
-            }
-            v75 = v127;
-            if ( v127 != 5 )
-            {
-              if ( v127 < 0 )
-                goto LABEL_183;
-              if ( v127 > 3 )
-              {
-                if ( v127 != 4 )
-                {
-                  if ( v127 == 6 )
-                    goto LABEL_180;
-LABEL_183:
-                  ((Player *)v6)->SubtractVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63);
-                  ++v122;
-                  //v4 = v124;
-                  //v5 = pSomeEVT;
-                  //v6 = v123;
-                  //v7 = "";
-                  break;
-                }
-                if ( uActiveCharacter )
-                {
-                  v6 = pPlayers[uActiveCharacter];
-                  goto LABEL_182;
-                }
-LABEL_180:
-                v75 = rand() % 4;
-                //v5 = pSomeEVT;
-              }
-              v6 = &pParty->pPlayers[v75];
-LABEL_182:
-              //v123 = v6;
-              goto LABEL_183;
-            }
-            v76 = pParty->pPlayers;
-            v130 = 4;
-            do
-            {
-              v76->SubtractVariable(
-                (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)),
-                v63);
-              ++v76;
-            }
-            while ( (signed int)v76 < (signed int)pParty->pHirelings );
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_Set:
-            v77 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
-            v78 = v127;
-            if ( v127 != 5 )
-            {
-              if ( v127 < 0 )
-                goto LABEL_197;
-              if ( v127 > 3 )
-              {
-                if ( v127 != 4 )
-                {
-                  if ( v127 == 6 )
-                    goto LABEL_194;
-LABEL_197:
-                  ((Player *)v6)->SetVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77);
-                  ++v122;
-                  //v4 = v124;
-                  //v5 = pSomeEVT;
-                  //v6 = v123;
-                  //v7 = "";
-                  break;
-                }
-                if ( uActiveCharacter )
-                {
-                  v6 = pPlayers[uActiveCharacter];
-                  goto LABEL_196;
-                }
-LABEL_194:
-                v78 = rand() % 4;
-                //v5 = pSomeEVT;
-              }
-              v6 = &pParty->pPlayers[v78];
-LABEL_196:
-              //v123 = v6;
-              goto LABEL_197;
-            }
-            v79 = pParty->pPlayers;
-            v130 = 4;
-            do
-            {
-              v79->SetVariable(
-                (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)),
-                v77);
-              ++v79;
-            }
-            while ( (signed int)v79 < (signed int)pParty->pHirelings );
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_Add:
-            v80 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
-            v81 = v127;
-            if ( v127 != 5 )
-            {
-              if ( v127 < 0 )
-                goto LABEL_211;
-              if ( v127 > 3 )
-              {
-                if ( v127 != 4 )
-                {
-                  if ( v127 == 6 )
-                    goto LABEL_208;
-LABEL_211:
-                  ((Player *)v6)->AddVariable(
-                    (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)),
-                    v80);
-                  goto LABEL_212;
-                }
-                if ( uActiveCharacter )
-                {
-                  v6 = pPlayers[uActiveCharacter];
-                  goto LABEL_210;
-                }
-LABEL_208:
-                v81 = rand() % 4;
-                //v5 = pSomeEVT;
-              }
-              v6 = &pParty->pPlayers[v81];
-LABEL_210:
-              //v123 = v6;
-              goto LABEL_211;
-            }
-            v82 = pParty->pPlayers;
-            v130 = 4;
-            do
-            {
-              v82->AddVariable(
-                (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)),
-                v80);
-              ++v82;
-            }
-            while ( (signed int)v82 < (signed int)pParty->pHirelings );
-LABEL_212:
-            v83 = _evt->v5 + ((uint)_evt->v6 << 8);
-            if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
-              viewparams->bRedrawGameUI = 1;
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_InputString:
-            if ( !dword_597F18 )
-            {
-              strcpy(
-                GameUI_StatusBar_TimedString,
-                &pLevelStr[pLevelStrOffsets[_evt->v5
-                                          + ((_evt->v6
-                                            + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]);
-              v105 = v122;
-              v121 = 26;
-LABEL_295:
-              sub_4451A8_press_any_key(uEventID, v105, v121);
-LABEL_301:
-              if ( v133 == 1 )
-LABEL_302:
-                OnMapLeave();
-              return;
-            }
-            v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8);
-            if ( !_strcmpi(
-                    GameUI_StatusBar_TimedString,
-                    &pLevelStr[pLevelStrOffsets[_evt->v9
-                                              + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]])
-              || !_strcmpi(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[v84]]) )
-            {
-              v11 = _evt->v17;
-LABEL_130:
-              //v124 = -1;
-LABEL_131:
-              v122 = v11 - 1;
-            }
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_RandomGoTo:
-            //v124 = -1;
-            v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0)
-                                    + (_evt->v10 != 0)));
-            goto LABEL_131;
-          case EVENT_ReceiveDamage:
-            v85 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
-            v86 = _evt->v5;
-            if ( (unsigned __int8)v86 <= 3u )
-            {
-              v119 = _evt->v6;
-              v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
-              v89 = (unsigned __int8)v86;
-              goto LABEL_233;
-            }
-            if ( v86 == 4 )
-            {
-              if ( !uActiveCharacter )
-              {
-                ++v122;
-                //v4 = v124;
-                //v5 = pSomeEVT;
-                //v6 = v123;
-                //v7 = "";
-                break;
-              }
-              v119 = _evt->v6;
-              v88 = pPlayers[uActiveCharacter];
-              v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
-              goto LABEL_234;
-            }
-            if ( v86 != 5 )
-            {
-              v119 = _evt->v6;
-              v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v1 << 8)) << 8)) << 8);
-              v89 = rand() % 4;
-LABEL_233:
-              v88 = &pParty->pPlayers[v89];
-LABEL_234:
-              v88->ReceiveDamage(v115, v119);
-              ++v122;
-              //v4 = v124;
-              //v5 = pSomeEVT;
-              //v6 = v123;
-              //v7 = "";
-              break;
-            }
-            v87 = pParty->pPlayers;
-            do
-            {
-              v87->ReceiveDamage(v85, _evt->v6);
-              ++v87;
-            }
-            while ( (signed int)v87 < (signed int)pParty->pHirelings );
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_ToggleIndoorLight:
-            pIndoor->ToggleLight(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9);
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_SetFacesBit:
-            sub_44892E_set_faces_bit(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
-              _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_ToggleChestFlag:
-            Chest::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
-              _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_ToggleActorFlag:
-            Actor::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
-              _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_ToggleActorGroupFlag:
-            ToggleActorGroupFlag(
-              _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
-              _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8),
-              _evt->v13);
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_SetSnow:
-            if ( !_evt->v5 )
-              pWeather->bRenderSnow = _evt->v6 != 0;
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_StatusText:
-            v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
-            if ( _5C3420_pDecoration )
-            {
-              if ( _5C3420_pDecoration == (LevelDecoration *)1 )
-              {
-                ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
-                ++v122;
-                //v4 = v124;
-                //v5 = pSomeEVT;
-                //v6 = v123;
-                //v7 = "";
-                break;
-              }
-              if ( a3 == 1 )
-              {
-                v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
-//LABEL_248:
-                ShowStatusBarString(v91, 2u);
-                ++v122;
-                //v4 = v124;
-                //v5 = pSomeEVT;
-                //v6 = v123;
-                //v7 = "";
-                break;
-              }
-            }
-            else
-            {
-              if ( a3 == 1 )
-              {
-                v91 = &pLevelStr[pLevelStrOffsets[v90]];
-                ShowStatusBarString(v91, 2u);
-                ++v122;
-                //v4 = v124;
-                //v5 = pSomeEVT;
-                //v6 = v123;
-                //v7 = "";
-                break;
-              }
-            }
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_ShowMessage:
-            v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
-            if ( _5C3420_pDecoration )
-            {
-              v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92];
-              byte_5B0938[0] = 0;
-              ptr_F8B1E8 = v93;
-            }
-            else
-            {
-              strcpy(byte_5B0938, &pLevelStr[pLevelStrOffsets[v92]]);
-            }
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_CastSpell:
-            sub_448DF8_cast_spell(_evt->v5, _evt->v6, _evt->v7, _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8),
-              _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8),
-              _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8),
-              _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8),
-              _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8),
-              _evt->v28 + ((_evt->v29 + ((_evt->v30 + ((uint)_evt->v31 << 8)) << 8)) << 8));
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_SetTexture:
-            sub_44861E_set_texture(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), (char *)&_evt->v9);
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_SetSprite:
-            SetDecorationSprite(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9, (char *)&_evt->v10);
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_SummonMonsters:
-            sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,
-              _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8),
-              _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8),
-              _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8),
-              _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8),
-              _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8));
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_MouseOver:
-          case EVENT_LocationName:
-            --v122;
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_ChangeDoorState:
-            sub_449A49_door_switch_animation(_evt->v5, _evt->v6);
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_OpenChest:
-            if ( !Chest::Open(_evt->v5) )
-              goto LABEL_301;
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_MoveToMap:
-            v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
-            v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
-            v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
-            v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8);
-            v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8);
-            v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8);
-            v96 = _evt->v25;
-            v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8);
-            v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8);
-            if ( _evt->v29 || _evt->v30 )
-            {
-              if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode )
-                pRenderer->_49FD3A();
-              sub_444839_move_map(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31);
-              dword_5C3418 = uEventID;
-              dword_5C341C = v122 + 1;
-              goto LABEL_301;
-            }
-            _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
-            _5B65A8_npcdata_uflags_or_other = v94;
-            _5B65B0_npcdata_rep_or_other = v126;
-            if ( v129 == -1 )
-            {
-              v98 = _5B65B4_npcdata_loword_house_or_other;
-            }
-            else
-            {
-              v98 = v129 & stru_5C6E00->uDoublePiMask;
-              _5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask;
-            }
-            v99 = (char *)&_evt->v31;
-            _5B65B8_npcdata_hiword_house_or_other = v95;
-            dword_5B65BC = v97;
-            v100 = v94 | v132 | v126 | v95 | v97 | v98;
-            dword_5B65C0 = v100;
-            if ( *v99 == 48 )
-            {
-              if ( v100 )
-              {
-                pParty->vPosition.x = v135;
-                pParty->vPosition.y = v132;
-                pParty->vPosition.z = v126;
-                pParty->uFallStartY = v126;
-                if ( _5B65B4_npcdata_loword_house_or_other != -1 )
-                  pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other;
-                _5B65B4_npcdata_loword_house_or_other = -1;
-                v120 = 0;
-                v116 = 0;
-                v111 = 0;
-                v110 = 0;
-                v109 = -1;
-                v108 = 0;
-                v107 = 0;
-                pParty->sRotationX = v95;
-                pParty->uFallSpeed = v134;
-                dword_5B65C0 = 0;
-                dword_5B65BC = 0;
-                _5B65B8_npcdata_hiword_house_or_other = 0;
-                _5B65B0_npcdata_rep_or_other = 0;
-                _5B65AC_npcdata_fame_or_other = 0;
-                _5B65A8_npcdata_uflags_or_other = 0;
-                v106 = 232;
-LABEL_280:
-                pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120);
-              }
-            }
-            else
-            {
-              pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((_5C3420_pDecoration == 0) + 1);
-              sub_44987B(v99, 0);
-              v133 = 1;
-              if ( pCurrentScreen == SCREEN_HOUSE )
-              {
-                if ( uGameState == 2 )
-                {
-                  pAudioPlayer->StopChannels(-1, -1);
-                  dword_F8B19C = 0;
-                  while ( sub_4BD8B5() )
-                    ;
-                  pVideoPlayer->Unload();
-                  ptr_507BC0->Release();
-                  ptr_507BC0 = 0;
-                  if ( pMessageQueue_50CBD0->uNumMessages )
-                    pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-                  pCurrentScreen = SCREEN_GAME;
-                  viewparams->bRedrawGameUI = 1;
-                  array_5913D8[6] = 0;
-                  pDialogueWindow->Release();
-                  dword_F8B19C = 0;
-                  pDialogueWindow = 0;
-                  pIcons_LOD->_40F9C5();
-                }
-                goto LABEL_302;
-              }
-            }
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_PlaySound:
-            v120 = 0;
-            v116 = 0;
-            v111 = 0;
-            v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8);
-            v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
-            v108 = 0;
-            v107 = 0;
-            v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
-            goto LABEL_280;
-          case EVENT_GiveItem:
-            item.Reset();
-            //v101 = &pSomeEVT[v9];
-            v102 = _evt->v7
-                 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
-            pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item);
-            if ( v102 )
-              item.uItemID = v102;
-            pParty->SetHoldingItem(&item);
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_SpeakInHouse:
-            v103 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
-            if ( EnterHouse((enum HOUSE_TYPE)(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8))) )
-            {
-              if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode )
-                pRenderer->_49FD3A();
-              pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0);
-              pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0);
-              v104 = 187;
-              if ( uCurrentHouse_Animation != 167 )
-                v104 = v103;
-              ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0);
-              ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
-              ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
-              ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
-              ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
-              ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0);
-            }
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-          case EVENT_PressAnyKey:
-            v121 = 33;
-            v105 = v122 + 1;
-            goto LABEL_295;
-          case EVENT_Exit:
-            goto LABEL_301;
-          default:
-            ++v122;
-            //v4 = v124;
-            //v5 = pSomeEVT;
-            //v6 = v123;
-            //v7 = "";
-            break;
-        }
-      }
-      //++v4;
-      //v124 = v4;
-      //if ( v4 >= (signed int)uSomeEVT_NumEvents )
-        //goto LABEL_301;
-    //}
-  }
-}
-
-
 
 //----- (0044861E) --------------------------------------------------------
 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename)
--- a/mm7_4.cpp	Tue Feb 19 15:40:11 2013 +0200
+++ b/mm7_4.cpp	Wed Feb 20 00:26:17 2013 +0400
@@ -5740,16 +5740,13 @@
   pTexture_IC_KNIGHT[8] = pIcons_LOD->LoadTexturePtr("IC_SORC", TEXTURE_16BIT_PALETTE);
   pTexture_MAKETOP = pIcons_LOD->LoadTexturePtr("MAKETOP", TEXTURE_16BIT_PALETTE);
   pTexture_MAKESKY = pIcons_LOD->LoadTexturePtr("MAKESKY", TEXTURE_16BIT_PALETTE);
-  uX = 0;
-  do // load PlayerPortraits texture
+  for(uX=0;uX < 22;++uX ) // load PlayerPortraits texture
   {
     sprintf(pTmpBuf, "%s01", pPlayerPortraitsNames[uX]);
     v1 = pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE);
-    v2 = uX * 4;
-    ++uX;
-    *(Texture **)((char *)pPlayerPortraits + v2) = &pIcons_LOD->pTextures[v1];
-  }
-  while ( uX < 22 );
+    pPlayerPortraits[uX] = &pIcons_LOD->pTextures[v1];
+
+  }
   pTexture_PlayerFaceMask = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("FACEMASK", TEXTURE_16BIT_PALETTE)];
   pTexture_buttminu  = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("buttminu", TEXTURE_16BIT_PALETTE)];
   pTexture_buttplus  = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("buttplus", TEXTURE_16BIT_PALETTE)];
@@ -14723,7 +14720,7 @@
   }
   else
   {
-    v2 = (char *)&pLevelEVT_Events[0].uEventOffsetInEVT;
+    v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT;
     while ( 1 )
     {
       if ( *((int *)v2 - 2) == uEventID )
@@ -14749,7 +14746,7 @@
     }
     else
     {
-      for ( i = (char *)pLevelEVT_Events + 4 * (3 * v1 + 3); *(int *)i == uEventID; i += 12 )
+      for ( i = (char *)pLevelEVT_Index + 4 * (3 * v1 + 3); *(int *)i == uEventID; i += 12 )
       {
         v8 = *((int *)i + 2);
         if ( pLevelEVT[v8 + 4] == 2 )
--- a/mm7_data.h	Tue Feb 19 15:40:11 2013 +0200
+++ b/mm7_data.h	Wed Feb 20 00:26:17 2013 +0400
@@ -2000,10 +2000,9 @@
 void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap);
 int __fastcall DrawBook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074); // idb
 void Initialize2DA();
-unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize);
-void __cdecl Initialize_GlobalEVT();
+
 void __cdecl LoadLevel_InitializeLevelStr();
-void __cdecl LoadLevel_InitializeLevelEvt();
+
 void __cdecl OnMapLeave();
 void /*__usercall*/ OnMapLoad();
 void __thiscall Level_LoadEvtAndStr(const char *pLevelName);
@@ -2030,7 +2029,7 @@
 int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb
 // void __cdecl crt_construct_5773C4();
 bool __thiscall sub_4466C4(void *_this);
-void __fastcall EventProcessor(int a1, int a2, int a3);
+
 void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3);
 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename);
 void __fastcall SetDecorationSprite(unsigned int uCog, int a2, const char *pFileName); // idb