diff Events.cpp @ 552:bee46636df95

Merge
author Nomad
date Mon, 04 Mar 2013 20:29:31 +0200
parents dde1083df4b7
children f451efdb7c8b
line wrap: on
line diff
--- a/Events.cpp	Mon Mar 04 20:28:08 2013 +0200
+++ b/Events.cpp	Mon Mar 04 20:29:31 2013 +0200
@@ -338,9 +338,6 @@
 					{
 					++curr_seq_num;
 					v4 = v124;
-					
-					//v6 = v123;
-					//v7 = "";
 					break;
 					}
 				v124 = -1;
@@ -533,19 +530,16 @@
 					{
 					v26 = (LevelDecoration *)activeLevelDecoration;
 					stru_5E4C90._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0;
-					LOBYTE(v26->field_2) |= 0x20u;
+					v26->field_2 |= 0x0020;
 					}
 				++curr_seq_num;
 				v4 = v124;
-				
-				//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);
+				v27 = EVT_DWORD(_evt->v5);
 				pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu;
-				pNPCStats->pNewNPCData[v27].greet = v28;
+				pNPCStats->pNewNPCData[v27].greet = EVT_DWORD(_evt->v9);
 				++curr_seq_num;
 				v4 = v124;
 				
@@ -629,39 +623,26 @@
 				//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);
+				sub_448518_npc_set_item(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13);
 				++curr_seq_num;
 				v4 = v124;
-				
-				//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);
+				Actor::GiveItem(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13);
 				++curr_seq_num;
 				v4 = v124;
-				
-				//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);
 				++curr_seq_num;
 				v4 = v124;
-				
-				//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);
 				++curr_seq_num;
 				v4 = v124;
-				
-				//v6 = v123;
-				//v7 = "";
 				break;
 			case EVENT_ChangeGroup:
 				v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
@@ -712,11 +693,11 @@
 			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);
+				pNPCStats->pNewNPCData[EVT_DWORD(_evt->v5)].Location2D =EVT_DWORD(_evt->v9);
 				if ( window_SpeakInHouse )
 					{
-					v46 = window_SpeakInHouse->ptr_1C;
-					if ( v46 == (void *)165 )
+	
+					if ( window_SpeakInHouse->par1C == 165 )
 						{
 						sub_4BD8B5();
 						pVideoPlayer->Unload();
@@ -726,9 +707,8 @@
 						if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) )
 							{
 							pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0);
-							v47 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0);
-							window_SpeakInHouse = v47;
-							v48 = v47->pControlsHead;
+							window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0);
+							v48 = window_SpeakInHouse->pControlsHead;
 							if ( v48 )
 								{
 								do
@@ -738,33 +718,29 @@
 									v48 = v49;
 									}
 									while ( v49 );
-									v47 = window_SpeakInHouse;
 								}
-							v47->pControlsHead = 0;
+							window_SpeakInHouse->pControlsHead = 0;
 							window_SpeakInHouse->pControlsTail = 0;
 							window_SpeakInHouse->uNumControls = 0;
 							}
 						}
 					else
 						{
-						if ( v46 == (void *)553 )
+						if ( window_SpeakInHouse->par1C == 553 )
 							pVideoPlayer->bLoopPlaying = 0;
 						}
 					}
-				++curr_seq_num;
+				
 				}
+                ++curr_seq_num;
 				v4 = v124;
-				
-				//v6 = v123;
-				//v7 = "";
+
 				break;
 			case EVENT_Jmp:
 				curr_seq_num = _evt->v5 - 1;
 				++curr_seq_num;
-				//v4 = -1;
-				
-				//v6 = v123;
-				//v7 = "";
+				v4 = -1;
+
 				break;
 			case EVENT_ShowFace:
 				if ( _evt->v5 <= 3u ) //someone 
@@ -780,9 +756,7 @@
 					pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
 					++curr_seq_num;
 					v4 = v124;
-					
-					//v6 = v123;
-					//v7 = "";
+
 					break;
 			case EVENT_CharacterAnimation:
 				if ( _evt->v5 <= 3u ) //someone
@@ -795,18 +769,13 @@
 				else	//random
 					pParty->pPlayers[rand() % 4].PlaySound((PlayerSpeech) _evt->v6, 0);
 				++curr_seq_num;
-					v4 = v124;
-					
-					//v6 = v123;
-					//v7 = "";
+				v4 = v124;
+
 				break;
 			case EVENT_ForPartyMember:
 				player_choose = _evt->v5;
 				++curr_seq_num;
 				v4 = v124;
-				
-				//v6 = v123;
-				//v7 = "";
 				break;
 			case EVENT_SummonItem:
 				sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
@@ -866,8 +835,6 @@
 				}
 				++curr_seq_num;
 				v4 = v124;
-				//v6 = v123;
-				//v7 = "";
 				break;
 			case EVENT_IsActorAlive:
 				 if  (IsActorAlive(EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10)))
@@ -882,106 +849,66 @@
 				pValue = EVT_DWORD(_evt->v7);
 				if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands )
 				{
-					v64 = 0;
-					if ( pParty->pPickedItem.uItemID == pValue )
+					if ( pParty->pPickedItem.uItemID == pValue )//In hand
 					{
 						pMouse->RemoveHoldingItem();
 						++curr_seq_num;
 						v4 = v124;
-						
-						//v6 = v123;
-						//v7 = "";
 						break;
 					}
-					v65 = 0;
-					v66 = pPlayers[uActiveCharacter];
-					v67 = (int)v66->pInventoryIndices;
-					do
+					v67 = (int)pPlayers[uActiveCharacter]->pInventoryIndices;
+					for ( v65 = 0; v65 < 126; ++v65 )
 					{
-						if ( (int)&v66->pInventoryItems[v67] == pValue )
+						if ( (int)&pPlayers[uActiveCharacter]->pInventoryItems[v67] == pValue )
 						{
-							v66->RemoveItemAtInventoryIndex(v65);
+							pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65);
 							++curr_seq_num;
 							v4 = v124;
-							
-							//v6 = v123;
-							//v7 = "";
 							break;
 						}
-						++v65;
 						v67 += 4;
 					}
 					while ( (signed int)v65 < 126 );
-						v68 = 0;
-						v69 = (int)&v66->pEquipment;
-						do
+					v69 = (int)&pPlayers[uActiveCharacter]->pEquipment;
+					for ( v68 = 0; v68 < 16; ++v68 )
+					{
+						if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItems[v69] == pValue )
 						{
-							if ( *(int *)v69 && (int)&v66->pInventoryItems[v69] == pValue )
+							*(&pPlayers[uActiveCharacter]->pEquipment.uOffHand + v68) = 0;
+							++curr_seq_num;
+							v4 = v124;
+							break;
+						}
+						v69 += 4;
+					}
+					for (int i = 1; i < 5; i++)
+					{
+						v72 = (int)pPlayers[i]->pInventoryIndices;
+						for ( int v71 = 0; v71 < 126; ++v71 )
+						{
+							if ( (int)&pPlayers[i]->pInventoryItems[v72] == pValue )
 							{
-								*(&v66->pEquipment.uOffHand + v68) = 0;
-								++curr_seq_num;
-								v4 = v124;
-								
-								//v6 = v123;
-								//v7 = "";
+								pPlayers[i]->RemoveItemAtInventoryIndex(v71);
 								break;
 							}
-							++v68;
-							v69 += 4;
+							v72 += 4;
 						}
-						while ( v68 < 16 );
-							pPlayer = pPlayers[1];
-							while ( 1 )
-							{
-								v70 = pPlayer;
-								if ( !v64 )
-								{
-									v71 = 0;
-									v72 = (int)v70->pInventoryIndices;
-									do
-									{
-										if ( (int)&v70->pInventoryItems[v72] == pValue )
-										{
-											v70->RemoveItemAtInventoryIndex(v71);
-											goto LABEL_169;
-										}
-										++v71;
-										v72 += 4;
-									}
-									while ( (signed int)v71 < 126 );
-										v73 = 0;
-										v74 = (int)&v70->pEquipment;
-										while ( !*(int *)v74 || (int)&v70->pInventoryItems[v74] != pValue )
-										{
-											++v73;
-											v74 += 4;
-											if ( v73 >= 16 )
-												goto LABEL_170;
-										}
-										*(&v70->pEquipment.uOffHand + v73) = 0;
-LABEL_169:
-										v64 = 1;
-								}
-LABEL_170:
-								pPlayer += 4;
-								if ( pPlayer > pPlayers[4] )
-								{
-									//++curr_seq_num;
-									v4 = v124;
-									
-									//v6 = v123;
-									//v7 = "";
-									break;
-								}
-							}
+						v73 = 0;
+						v74 = (int)&pPlayers[i]->pEquipment;
+						while ( !*(int *)v74 || (int)&pPlayer->pInventoryItems[v74] != pValue )
+						{
+							++v73;
+							v74 += 4;
+							if ( v73 >= 16 )
+								break;
+						}
+						*(&pPlayers[i]->pEquipment.uOffHand + v73) = 0;
 					}
+				}
 				if ( player_choose <= 3 )
 				{
 					pPlayer = &pParty->pPlayers[player_choose];
 					pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-					++curr_seq_num;
-					v4 = v124;
-					break;
 				}
 				else if ( player_choose == 4 ) //active
 				{
@@ -989,9 +916,6 @@
 					{
 						pPlayer = pPlayers[uActiveCharacter];
 						pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-						++curr_seq_num;
-						v4 = v124;
-						break;
 					}
 				}
 				else 	if ( player_choose == 5 )//all
@@ -1000,32 +924,25 @@
 					for(int i = 0; i < 4; ++i)
 					{
 						if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
-						{
-							++curr_seq_num;
 							break;
-						}
 					}
 					++v130;
-					break;
 				}
 				else if ( player_choose == 6 ) //random
 				{
 					player_choose = rand() % 4;
 					pPlayer = &pParty->pPlayers[player_choose];
 					pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-					++curr_seq_num;
-					v4 = v124;
-					break;
 				}
+				++curr_seq_num;
+				v4 = v124;
+				break;
 			case EVENT_Set:
 				pValue = EVT_DWORD(_evt->v7);
 				if ( player_choose <= 3 )
 				{
 					pPlayer = &pParty->pPlayers[player_choose];
 					pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-					++curr_seq_num;
-					v4 = v124;
-					break;
 				}
 				else if ( player_choose == 4 ) //active
 				{
@@ -1033,40 +950,31 @@
 					{
 						pPlayer = pPlayers[uActiveCharacter];
 						pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-						++curr_seq_num;
-						v4 = v124;
-						break;
 					}
 				}
 				else if ( player_choose == 5 )//all
 				{
+                  //recheck v130
 					for(int i = 1; i < 5; ++i)
 						pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-					++curr_seq_num;
-					v4 = v124;
-					break;
+
 				}
 				else if ( player_choose == 6 ) //random
 				{
 					player_choose = rand() % 4;
 					pPlayer = &pParty->pPlayers[player_choose];
 					pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-					++curr_seq_num;
-					v4 = v124;
-					break;
+
 				}
+                ++curr_seq_num;
+                v4 = v124;
+                break;
 			case EVENT_Add:
 				pValue = EVT_DWORD(_evt->v7);
 				if ( player_choose <= 3 )
 				{
 					pPlayer = &pParty->pPlayers[player_choose];
 					pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-					v83 = EVT_WORD(_evt->v5);
-					if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
-						viewparams->bRedrawGameUI = 1;
-					++curr_seq_num;
-					v4 = v124;
-					break;
 				}
 				else if ( player_choose == 4 ) //active
 				{
@@ -1074,12 +982,6 @@
 					{
 						pPlayer = pPlayers[uActiveCharacter];
 						pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-						v83 = EVT_WORD(_evt->v5);
-						if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
-							viewparams->bRedrawGameUI = 1;
-						++curr_seq_num;
-						v4 = v124;
-						break;
 					}
 				}
 				else if ( player_choose == 5 )//all
@@ -1087,29 +989,24 @@
 					//v130 = 0;
 					for(int i = 1; i < 5; ++i)
 						pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-					v83 = EVT_WORD(_evt->v5);
-					if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
-						viewparams->bRedrawGameUI = 1;
-					++curr_seq_num;
-					v4 = v124;
-					break;
+
 				}
 				else if ( player_choose == 6 ) //random
 				{
 					player_choose = rand() % 4;
 					pPlayer = &pParty->pPlayers[player_choose];
 					pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-					v83 = EVT_WORD(_evt->v5);
-					if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
-						viewparams->bRedrawGameUI = 1;
-					++curr_seq_num;
-					v4 = v124;
-					break;
 				}
+                v83 = EVT_WORD(_evt->v5);
+                if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
+                    viewparams->bRedrawGameUI = 1;
+                ++curr_seq_num;
+                v4 = v124;
+                break;
 			case EVENT_InputString:
 				if ( !start_event_seq_number )
 					{
-					strcpy(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]);
+					strcpy(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]);
 					v105 = curr_seq_num;
 					v121 = 26;
 LABEL_295:
@@ -1140,14 +1037,16 @@
 				//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;
+                curr_seq_num = v11 - 1;
+                   ++curr_seq_num;
+                   v4 = v124;
 			case EVENT_ReceiveDamage:
-				v85 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
+				v85 = EVT_DWORD(_evt->v7 );
 				v86 = _evt->v5;
 				if ( (unsigned __int8)v86 <= 3u )
 					{
 					v119 = _evt->v6;
-					v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
+					v115 = EVT_DWORD(_evt->v7 );
 					v89 = (unsigned __int8)v86;
 					goto LABEL_233;
 					}
@@ -1164,13 +1063,13 @@
 						}
 					v119 = _evt->v6;
 					v88 = pPlayers[uActiveCharacter];
-					v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
+					v115 = EVT_DWORD(_evt->v7 );
 					goto LABEL_234;
 					}
 				if ( v86 != 5 )
 					{
 					v119 = _evt->v6;
-					v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10<< 8)) << 8)) << 8);
+					v115 = EVT_DWORD(_evt->v7 );
 					v89 = rand() % 4;
 LABEL_233:
 					v88 = &pParty->pPlayers[v89];
@@ -1197,7 +1096,7 @@
 					//v7 = "";
 					break;
 			case EVENT_ToggleIndoorLight:
-				pIndoor->ToggleLight(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9);
+				pIndoor->ToggleLight(EVT_DWORD(_evt->v5 ), _evt->v9);
 				++curr_seq_num;
 				v4 = v124;
 				
@@ -1205,8 +1104,7 @@
 				//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);
+				sub_44892E_set_faces_bit(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13);
 				++curr_seq_num;
 				v4 = v124;
 				
@@ -1214,8 +1112,7 @@
 				//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);
+				Chest::ToggleFlag(EVT_DWORD(_evt->v5 ),	EVT_DWORD(_evt->v9 ), _evt->v13);
 				++curr_seq_num;
 				v4 = v124;
 				
@@ -1223,8 +1120,7 @@
 				//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);
+				Actor::ToggleFlag(EVT_DWORD(_evt->v5 ),	EVT_DWORD(_evt->v9 ), _evt->v13);
 				++curr_seq_num;
 				v4 = v124;
 				
@@ -1232,10 +1128,7 @@
 				//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);
+				ToggleActorGroupFlag(EVT_DWORD(_evt->v5 ),	EVT_DWORD(_evt->v9 ), _evt->v13);
 				++curr_seq_num;
 				v4 = v124;
 				
@@ -1252,30 +1145,18 @@
 				//v7 = "";
 				break;
 			case EVENT_StatusText:
-				v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
+				v90 = EVT_DWORD(_evt->v5 );
 				if ( activeLevelDecoration )
 					{
-					if ( activeLevelDecoration == (void*)1 )
+					if ( activeLevelDecoration == (LevelDecoration*)1 )
 						{
 						ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
-						++curr_seq_num;
-						v4 = v124;
-						
-						//v6 = v123;
-						//v7 = "";
-						break;
 						}
 					if ( canShowMessages == 1 )
 						{
 						v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
 						//LABEL_248:
 						ShowStatusBarString(v91, 2u);
-						++curr_seq_num;
-						v4 = v124;
-						
-						//v6 = v123;
-						//v7 = "";
-						break;
 						}
 					}
 				else
@@ -1284,12 +1165,6 @@
 						{
 						v91 = &pLevelStr[pLevelStrOffsets[v90]];
 						ShowStatusBarString(v91, 2u);
-						++curr_seq_num;
-						v4 = v124;
-						
-						//v6 = v123;
-						//v7 = "";
-						break;
 						}
 					}
 				++curr_seq_num;
@@ -1299,7 +1174,7 @@
 				//v7 = "";
 				break;
 			case EVENT_ShowMessage:
-				v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
+				v92 = EVT_DWORD(_evt->v5 );
 				if ( activeLevelDecoration )
 					{
 					v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92];
@@ -1317,20 +1192,15 @@
 				//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));
+				sub_448DF8_cast_spell(_evt->v5, _evt->v6, _evt->v7, EVT_DWORD(_evt->v8 ),
+                    EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ),
+                    EVT_DWORD(_evt->v24 ), EVT_DWORD(_evt->v28 ));
 				++curr_seq_num;
 				v4 = v124;
-				
-				//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);
+				sub_44861E_set_texture(EVT_DWORD(_evt->v5 ), (char *)&_evt->v9);
 				++curr_seq_num;
 				v4 = v124;
 				
@@ -1338,7 +1208,7 @@
 				//v7 = "";
 				break;
 			case EVENT_SetSprite:
-				SetDecorationSprite(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9, (char *)&_evt->v10);
+				SetDecorationSprite(EVT_DWORD(_evt->v5 ), _evt->v9, (char *)&_evt->v10);
 				++curr_seq_num;
 				v4 = v124;
 				
@@ -1346,12 +1216,9 @@
 				//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));
+				sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,EVT_DWORD(_evt->v8 ),
+                    EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ),
+                    EVT_DWORD(_evt->v24 ));
 				++curr_seq_num;
 				v4 = v124;
 				
@@ -1520,13 +1387,13 @@
 					pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0);
 					v104 = 187;
 					if ( uCurrentHouse_Animation != 167 )
-						v104 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
+						v104 = EVT_DWORD(_evt->v5);
 					window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0);
 					window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, 0x6Eu, 1, 49, "", 0);
 					window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, 0x6Eu, 2, 50, "", 0);
 					window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, 0x6Eu, 3, 51, "", 0);
 					window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, 0x6Eu, 4, 52, "", 0);
-					window_SpeakInHouse->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0);
+					window_SpeakInHouse->CreateButton(  0,   0,  0, 0, 1,  0, 0xB0u, 0, 9u, "", 0);
 					}
 				++curr_seq_num;
 				v4 = v124;