diff Events.cpp @ 1057:37498d2cceed

Слияние
author Ritor1
date Thu, 23 May 2013 21:37:22 +0600
parents d48c762de563
children 1c10b24a4159
line wrap: on
line diff
--- a/Events.cpp	Thu May 23 21:36:57 2013 +0600
+++ b/Events.cpp	Thu May 23 21:37:22 2013 +0600
@@ -6,6 +6,7 @@
 
 #include "MapInfo.h"
 #include "Game.h"
+#include "Outdoor.h"
 #include "GUIWindow.h"
 #include "GUIProgressBar.h"
 #include "Chest.h"
@@ -24,6 +25,7 @@
 #include "Events.h"
 #include "Events2D.h"
 #include "UIHouses.h"
+#include "Log.h"
 #include "MM7.h"
 
 
@@ -56,7 +58,7 @@
 
 //----- (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
@@ -109,6 +111,7 @@
 		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;
@@ -117,6 +120,7 @@
 }
 
 
+
 //----- (00443EF8) --------------------------------------------------------
 void  LoadLevel_InitializeLevelEvt()
 	{
@@ -148,25 +152,117 @@
         pLevelEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num;
         pLevelEVT_Index[events_count].uEventOffsetInEVT=offset_in;			
         offset_in+=current_hdr->evt_size+1;
+
         current_hdr=(raw_event_header *)&pLevelEVT[offset_in];
         }
     uLevelEVT_NumEvents = events_count;
 
 /*
-	for (uint i = 0, j = 0; j < uLevelEVT_Size; ++i)
+EmeraldIsle::Variables:
+[0] ???
+[1] ???
+[2] Luck Fountain uses left
+[3] Gold Fountain used this week
+[4] Gold Fountain total uses
+
+Emerald Isle #111 // ???
+	OnLongTimer
+	Set(Map.Variables[0], 30)
+	Set(Map.Variables[1], 30)
+
+
+Emerald Isle #114 // month timer - manage luck fountain
+0		LocationName
+0	    if (Player.BaseLuck >= 15)
+		{
+2			SetFooterString(11) // Refreshing!
+3			return
+		}
+		else
+		{
+1			if (Map.Variables[2] >= 1)
+			{
+4				Sub(Map.Variables[2], 1)
+5				Add(Player.BaseLuck, 2)
+6				SetFooterString(25) // +2 Luck (Permament)
+7				return
+			}
+			else
+			{
+2				SetFooterString(11) // Refreshing!
+3				return
+			}
+		}
+
+8		Initialize
+9		Set	Map.Variables[2], 8
+
+
+
+Emerald Isle #115 // week timer - gold fountain in the center of town
+0	LocationName
+0	if (Map.Variables[4] < 3)
+	{
+1		if (Map.Variables[3] == 1)
 		{
-		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++;
-		}*/
+2			if (Party.Gold < 201)
+			{
+3				if (Player.BaseLuck >= 15)
+				{
+5					Add(Map.Variables[3], 1)
+6					Add(Party.Gold, 1000)
+7					Add(Map.Variables[4], 1)
+8					goto return
+				}
+				else
+				{
+4					goto 9
+				}
+			}
+		}
+	}
+9	SetFooterString(11)	// Refreshing!
+10	return
+
+11	Initialize
+12	Set(Map.Variables[3], 0)
+
+
+
+
+
+Emerald Isle #220	// day timer - monster spawner
+0	LocationName
+0	OnLongTimer
+1	if (NumAliveActors(group=20) != 0)
+2		return
+3	SpawnMonsters(1, level=1, count=10, x=-336, y=14512, z=0,  group=20)
+4	SpawnMonsters(1, level=2, count=5,  x=16,   y=16352, z=90, group=20)
+5	SpawnMonsters(1, level=1, count=10, x=480,  y=18288, z=6,  group=20)
+
+
+
+Emerald Isle #200	// margareth dock tip
+0	if (!QBits.QuestDone[17])
+	{
+1		InitiateNPCDialogue(npc=19)
+	}
+2	return
+
+
+Emerald Isle #201	// margareth armoury tip
+0	if (!QBits.QuestDone[17])
+	{
+1		InitiateNPCDialogue(npc=20)
+	}
+2	return
+*/
 	}
 
 
 //----- (0044684A) --------------------------------------------------------
-void  EventProcessor(int uEventID, int targetObj, int canShowMessages)
-	{
+void EventProcessor(int uEventID, int targetObj, int canShowMessages, int entry_line)
+{
 	unsigned int v3; // eax@5
 	signed int v4; // esi@7
 	//char *v5; // eax@8
@@ -320,7 +416,8 @@
 		return;
 		}
 	player_choose = (uActiveCharacter == 0)?6:4;  //4 - active or  6 - random player if active =0
-	curr_seq_num = start_event_seq_number;
+	curr_seq_num = entry_line;
+
 	if ( activeLevelDecoration )
 		{
 		uSomeEVT_NumEvents = uGlobalEVT_NumEvents;
@@ -356,11 +453,11 @@
 			case EVENT_CheckSeason:
 				//
 				if ( !sub_4465DF_check_season(_evt->v5) )
-					{
+                {
 					++curr_seq_num;
 					v4 = v124;
 					break;
-					}
+                }
 				v124 = -1;
 				curr_seq_num = _evt->v6 - 1;
 			    ++curr_seq_num;
@@ -375,8 +472,7 @@
 					pVideoPlayer->Unload();
 				pVideoPlayer->bStopBeforeSchedule = 0;
 				pVideoPlayer->pResetflag = 0;
-				if (pAsyncMouse)
-					pAsyncMouse->Suspend();
+
 				v128 = pCurrentScreen;
 				//v13 = &pSomeEVT[v9];
 				//v14 = (unsigned __int8)v13[5];
@@ -400,8 +496,7 @@
 						if ( v128 == 13 )
 							pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
 						}
-					if (pAsyncMouse)
-						pAsyncMouse->Resume();
+
 					++curr_seq_num;
 					v4 = v124;
 					
@@ -423,8 +518,6 @@
 						if ( v128 == 13 )
 							pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
 						}
-					if (pAsyncMouse)
-						pAsyncMouse->Resume();
 					++curr_seq_num;
 					v4 = v124;
 					
@@ -447,8 +540,6 @@
 					if ( v128 == 13 )
 						pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
 					}
-				if (pAsyncMouse)
-					pAsyncMouse->Resume();
 				++curr_seq_num;
 				v4 = v124;
 				
@@ -986,13 +1077,17 @@
 					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;
+                if (v83 == 21 ||  // gold well on emerald isle
+                    v83 == 22 || v83 == 23 || v83 == 24 )
+                {
+                  __debugbreak(); // find out what these decorations are
+                    viewparams->bRedrawGameUI = true;
+                }
                 ++curr_seq_num;
                 v4 = v124;
                 break;
 			case EVENT_InputString:
-				if ( !start_event_seq_number )
+				if ( !entry_line )
 					{
 					strcpy(GameUI_Footer_TimedString, &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]);
 					v105 = curr_seq_num;
@@ -1037,7 +1132,7 @@
 					v115 = EVT_DWORD(_evt->v7 );
 					v89 = (unsigned __int8)v86;
 					v88 = &pParty->pPlayers[v89];
-					v88->ReceiveDamage(v115, v119);
+					v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119);
 					++curr_seq_num;
 					v4 = v124;
 					break;
@@ -1056,7 +1151,7 @@
 					v119 = _evt->v6;
 					v88 = pPlayers[uActiveCharacter];
 					v115 = EVT_DWORD(_evt->v7 );
-					v88->ReceiveDamage(v115, v119);
+					v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119);
 					++curr_seq_num;
 					v4 = v124;
 					break;
@@ -1067,7 +1162,7 @@
 					v115 = EVT_DWORD(_evt->v7 );
 					v89 = rand() % 4;
 					v88 = &pParty->pPlayers[v89];
-					v88->ReceiveDamage(v115, v119);
+					v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119);
 					++curr_seq_num;
 					v4 = v124;
 					
@@ -1078,7 +1173,7 @@
 				v87 = pParty->pPlayers;
 				do
 					{
-					v87->ReceiveDamage(v85, _evt->v6);
+					v87->ReceiveDamage(v85, (DAMAGE_TYPE)_evt->v6);
 					++v87;
 					}
 					while ( (signed int)v87 < (signed int)pParty->pHirelings );