changeset 514:0bbc39457b25

Merge
author Nomad
date Fri, 01 Mar 2013 18:23:49 +0200
parents 3ee1e351e710 (current diff) 968f4053da7f (diff)
children cb0ad52d6a26 aaefd101c3b1 69ef7c749e18
files
diffstat 1 files changed, 92 insertions(+), 142 deletions(-) [+]
line wrap: on
line diff
--- a/Events.cpp	Fri Mar 01 18:22:43 2013 +0200
+++ b/Events.cpp	Fri Mar 01 18:23:49 2013 +0200
@@ -824,49 +824,46 @@
 			case EVENT_Compare:
 				pValue = EVT_DWORD(_evt->v7);
 				if ( player_choose <= 3 )
-					{
+				{
 					if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
-						{
+					{
 						v124 = -1;
 						curr_seq_num = _evt->v11 - 1;
-						};
 					}
+				}
 				else if ( player_choose == 4 ) //active
+				{
+					if ( uActiveCharacter )
 					{
-					if ( uActiveCharacter )
+						if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
 						{
-						if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
-							{
 							v124 = -1;
 							curr_seq_num = _evt->v11 - 1;
-							};
 						}
 					}
+				}
 				else 	if ( player_choose == 5 )//all
-					{
+				{
 					v130=0;
-					for(int i=0; i<4; ++i)
+					for(int i = 0; i < 5; ++i)
+					{
+						if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
 						{
-						if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
-							{
 							v124 = -1;
 							curr_seq_num = _evt->v11 - 1;
 							break;
-							};
-
+						}
 						++v130;
-						}
-
 					}
+				}
 				else if ( player_choose == 6 ) //random
-					{
+				{
 					if ( pPlayers[rand() % 4]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
-						{
+					{
 						v124 = -1;
 						curr_seq_num = _evt->v11 - 1;
-						}
 					}
-			
+				}
 				++curr_seq_num;
 				v4 = v124;
 				//v6 = v123;
@@ -978,13 +975,12 @@
 								}
 							}
 					}
-				v75 = player_choose;
 				if ( player_choose <= 3 )
 				{
-					pPlayer = &pParty->pPlayers[v75];
+					pPlayer = &pParty->pPlayers[player_choose];
 					pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
 					++curr_seq_num;
-					//v4 = v124;
+					v4 = v124;
 					break;
 				}
 				else if ( player_choose == 4 ) //active
@@ -1000,8 +996,8 @@
 				}
 				else 	if ( player_choose == 5 )//all
 				{
-					v130=0;
-					for(int i=0; i<4; ++i)
+					v130 = 0;
+					for(int i = 0; i < 4; ++i)
 					{
 						if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
 						{
@@ -1014,148 +1010,102 @@
 				}
 				else if ( player_choose == 6 ) //random
 				{
-					v75 = rand() % 4;
-					pPlayer = &pParty->pPlayers[v75];
+					player_choose = rand() % 4;
+					pPlayer = &pParty->pPlayers[player_choose];
 					pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
 					++curr_seq_num;
 					v4 = v124;
 					break;
 				}
-/*				if ( player_choose != 5 )
+			case EVENT_Set:
+				pValue = EVT_DWORD(_evt->v7);
+				if ( player_choose <= 3 )
 				{
-					if ( player_choose < 0 )
-						goto LABEL_183;
-					//if ( player_choose > 3 )
-					//{
-						if ( player_choose != 4 )
-						{
-							if ( player_choose == 6 )
-								goto LABEL_180;
-LABEL_183:
-							((Player *)v6)->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-							++curr_seq_num;
-							v4 = v124;
-							
-							//v6 = v123;
-							//v7 = "";
-							break;
-						}
-						if ( uActiveCharacter )
-						{
-							v6 = pPlayers[uActiveCharacter];
-							goto LABEL_182;
-						}
-LABEL_180:
-						v75 = rand() % 4;
-						
-					//}
-					v6 = &pParty->pPlayers[v75];
-LABEL_182:
-					//v123 = v6;
-					goto LABEL_183;
+					pPlayer = &pParty->pPlayers[player_choose];
+					pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
+					++curr_seq_num;
+					v4 = v124;
+					break;
 				}
-				v130=0;
-				for(int i=0; i<4; ++i)
+				else if ( player_choose == 4 ) //active
 				{
-					if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
+					if ( uActiveCharacter )
 					{
+						pPlayer = pPlayers[uActiveCharacter];
+						pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
 						++curr_seq_num;
+						v4 = v124;
 						break;
 					}
 				}
-				++v130;
-				break;*/
-			case EVENT_Set:
-				v77 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
-				v78 = player_choose;
-				if ( player_choose != 5 )
-					{
-					if ( player_choose < 0 )
-						goto LABEL_197;
-					if ( player_choose > 3 )
-						{
-						if ( player_choose != 4 )
-							{
-							if ( player_choose == 6 )
-								goto LABEL_194;
-LABEL_197:
-							((Player *)v6)->SetVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77);
-							++curr_seq_num;
-							v4 = v124;
-							
-							//v6 = v123;
-							//v7 = "";
-							break;
-							}
-						if ( uActiveCharacter )
-							{
-							v6 = pPlayers[uActiveCharacter];
-							goto LABEL_196;
-							}
-LABEL_194:
-						v78 = rand() % 4;
-						
-						}
-					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 );
+				else if ( player_choose == 5 )//all
+				{
+					for(int i = 1; i < 5; ++i)
+						pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
 					++curr_seq_num;
 					v4 = v124;
-					
-					//v6 = v123;
-					//v7 = "";
 					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;
+				}
 			case EVENT_Add:
 				pValue = EVT_DWORD(_evt->v7);
-				//v81 = player_choose;
-				if ( player_choose != 5 )
-					{
-					if ( player_choose < 0 )
-						goto LABEL_211;
-					if ( player_choose > 3 )
-						{
-						if ( player_choose != 4 )
-							{
-							if ( player_choose == 6 )
-								goto LABEL_208;
-LABEL_211:
-							((Player *)v6)->AddVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), pValue);
-							goto LABEL_212;
-							}
-						if ( uActiveCharacter )
-							{
-							v6 = pPlayers[uActiveCharacter];
-							goto LABEL_210;
-							}
-LABEL_208:
-						player_choose = rand() % 4;
-						
-						}
-					v6 = &pParty->pPlayers[player_choose];
-LABEL_210:
-					//v123 = v6;
-					goto LABEL_211;
-					}
-				v130 = 0;
-				for(int i=1; i<5; ++i)
-					pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
-LABEL_212:
+				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
+				{
+					if ( uActiveCharacter )
+					{
+						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
+				{
+					//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;
+				}
 			case EVENT_InputString:
 				if ( !start_event_seq_number )
 					{