diff Events.cpp @ 1172:d5dae0b4b98a

Слияние
author Ritor1
date Fri, 24 May 2013 10:53:46 +0600
parents 1c10b24a4159
children 5d5c78088274
line wrap: on
line diff
--- a/Events.cpp	Fri May 24 10:53:33 2013 +0600
+++ b/Events.cpp	Fri May 24 10:53:46 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,132 @@
         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 #110 // Fire Resistance fountain
+0	LocationName
+0	if (Player.FireResistance < 50)
+	{
+1		Set(Player.FireResistance, 50)
+2		SetFooterString(22)	// +50 Fire Resistance (temporarily)
+3		Add(Party.Autonotes, 2)
+4		goto return
+	}
+5	SetFooterString(11)	// Refreshing!
+6	return
+
+
+
+Emerald Isle #111 // ???
+	Initialize
+	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
 		{
-		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++;
-		}*/
+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] == 0)
+		{
+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	Initialize
+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 +431,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 +468,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;
@@ -980,13 +1092,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;