# HG changeset patch # User Nomad # Date 1369326365 -7200 # Node ID d48c762de5632fbec372cb833345f9f4f441f9ad # Parent 05c62d1661823553f02220d0b5943fbebd04e029 -nomarg diff -r 05c62d166182 -r d48c762de563 Actor.cpp --- a/Actor.cpp Thu May 23 14:08:26 2013 +0200 +++ b/Actor.cpp Thu May 23 18:26:05 2013 +0200 @@ -3156,14 +3156,14 @@ unsigned int v8; // ecx@1 char v9; // zf@1 AIDirection *v10; // esi@6 - int v12; // ecx@19 - unsigned int v13; // eax@19 + //int v12; // ecx@19 + //unsigned int v13; // eax@19 AIDirection a3; // [sp+Ch] [bp-5Ch]@7 - AIDirection v15; // [sp+28h] [bp-40h]@7 + //AIDirection v15; // [sp+28h] [bp-40h]@7 AIDirection v16; // [sp+44h] [bp-24h]@7 - unsigned int v17; // [sp+60h] [bp-8h]@1 + //unsigned int v17; // [sp+60h] [bp-8h]@1 unsigned int v18; // [sp+64h] [bp-4h]@1 - int v19; // [sp+70h] [bp+8h]@19 + //int v19; // [sp+70h] [bp+8h]@19 v5 = uActorID; v6 = 0; @@ -3171,7 +3171,6 @@ v18 = a2; v8 = PID(OBJECT_Actor,uActorID); v9 = v7->pMonsterInfo.uFlying == 0; - v17 = v5; if ( !v9 && !pParty->bFlying ) { if ( v7->pMonsterInfo.uMissleAttack1Type ) @@ -3179,12 +3178,11 @@ else v6 = pParty->uPartyHeight; } + v10 = pDir; if ( !pDir ) { - memcpy(&v15, Actor::GetDirectionInfo(v8, a2, &a3, v6), sizeof(v15)); - memcpy(&v16, &v15, sizeof(v16)); - v5 = v17; + memcpy(&v16, Actor::GetDirectionInfo(v8, a2, &a3, v6), sizeof(v16)); v10 = &v16; } if ( MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) @@ -3209,16 +3207,10 @@ v18 = 16; if ( arg0 % 2 ) v18 = -16; - v12 = ((unsigned __int64)(stru_5C6E00->Cos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle) * (signed __int64)v10->uDistanceXZ) >> 16) - + pParty->vPosition.x; - v13 = stru_5C6E00->uIntegerPi + v10->uYawAngle; - v17 = v12; - v19 = stru_5C6E00->Sin(v18 + v13); + v7->uYawAngle = stru_5C6E00->Atan2( - v17 - v7->vPosition.x, - pParty->vPosition.y - + ((unsigned __int64)(v19 * (signed __int64)v10->uDistanceXZ) >> 16) - - v7->vPosition.y); + pParty->vPosition.x + fixpoint_sub0(stru_5C6E00->Cos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.x, + pParty->vPosition.y + fixpoint_sub0(stru_5C6E00->Sin(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.y); if ( uActionLength ) v7->uCurrentActionLength = uActionLength; else diff -r 05c62d166182 -r d48c762de563 Chest.cpp --- a/Chest.cpp Thu May 23 14:08:26 2013 +0200 +++ b/Chest.cpp Thu May 23 18:26:05 2013 +0200 @@ -66,10 +66,10 @@ char *v26; // edx@29 unsigned __int16 v27; // ax@32 //SpriteObject a1; // [sp+14h] [bp-B0h]@28 - int v29; // [sp+84h] [bp-40h]@16 - int v30; // [sp+88h] [bp-3Ch]@16 - int v31; // [sp+8Ch] [bp-38h]@16 - int v32; // [sp+90h] [bp-34h]@16 + int v29[4]; // [sp+84h] [bp-40h]@16 + //int v30; // [sp+88h] [bp-3Ch]@16 + //int v31; // [sp+8Ch] [bp-38h]@16 + //int v32; // [sp+90h] [bp-34h]@16 float v33; // [sp+94h] [bp-30h]@23 //char *v34; // [sp+98h] [bp-2Ch]@5 int v35; // [sp+9Ch] [bp-28h]@16 @@ -105,10 +105,10 @@ goto LABEL_12; if ( pPlayers[uActiveCharacter]->GetDisarmTrap() < 2 * pMapStats->pInfos[v2].LockX5 ) { - v29 = 811; - v30 = 812; - v31 = 813; - v32 = 814; + v29[0] = 811; + v29[1] = 812; + v29[2] = 813; + v29[3] = 814; v5 = rand() % 4; v6 = PID_ID(EvtTargetObj); v35 = v5; diff -r 05c62d166182 -r d48c762de563 Events.cpp --- a/Events.cpp Thu May 23 14:08:26 2013 +0200 +++ b/Events.cpp Thu May 23 18:26:05 2013 +0200 @@ -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; @@ -980,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; diff -r 05c62d166182 -r d48c762de563 Events.h --- a/Events.h Thu May 23 14:08:26 2013 +0200 +++ b/Events.h Thu May 23 18:26:05 2013 +0200 @@ -99,7 +99,7 @@ EVENT_ForPartyMember = 0x23, EVENT_Jmp = 0x24, EVENT_OnMapReload = 0x25, - EVENT_OnLongTimer = 0x26, + EVENT_Initialize = 0x26, EVENT_SetNPCTopic = 0x27, EVENT_MoveNPC = 0x28, EVENT_GiveItem = 0x29, @@ -256,7 +256,12 @@ VAR_Stoned = 0x78, VAR_Eradicated = 0x79, VAR_MajorCondition = 0x7A, - VAR_MapPersistentVariable_0 = 0x7B, + VAR_MapPersistentVariable_0 = 123, + VAR_MapPersistentVariable_1 = 124, + VAR_MapPersistentVariable_2 = 125, + VAR_MapPersistentVariable_3 = 126, + VAR_MapPersistentVariable_4 = 127, + VAR_MapPersistentVariable_5 = 0x80, VAR_NPCs = 0xD6, VAR_Reputation = 0xD7, VAR_ActiveSpells = 0xDE, @@ -321,9 +326,9 @@ 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); +void Initialize_GlobalEVT(); +void LoadLevel_InitializeLevelEvt(); +void EventProcessor(int uEventID, int a2, int a3, int entry_line = 0); diff -r 05c62d166182 -r d48c762de563 Outdoor.h --- a/Outdoor.h Thu May 23 14:08:26 2013 +0200 +++ b/Outdoor.h Thu May 23 18:26:05 2013 +0200 @@ -3,6 +3,7 @@ #include "Indoor.h" #include "TileFrameTable.h" #include "Weather.h" +#include "BSPModel.h" #define DAY_ATTRIB_FOG 1 @@ -195,7 +196,7 @@ unsigned int uNumBModels; struct OutdoorLocationTerrain pTerrain; void *pCmap; - struct BSPModel *pBModels; + BSPModel *pBModels; unsigned int numFaceIDListElems; unsigned __int16 *pFaceIDLIST; unsigned int *pOMAP; diff -r 05c62d166182 -r d48c762de563 Party.h --- a/Party.h Thu May 23 14:08:26 2013 +0200 +++ b/Party.h Thu May 23 18:26:05 2013 +0200 @@ -17,6 +17,8 @@ PARTY_QUEST_EMERALD_LUTE_ACTIVE = 5, PARTY_QUEST_EMERALD_HAT_ACTIVE = 6, + PARTY_QUEST_EMERALD_MARGARETH_OFF = 17, + PARTY_QUEST_EVENMORN_MAP_FOUND = 64, PARTY_QUEST_FINISHED_EMERALD_ISLE = 136, PARTY_QUEST_FOUNTAIN_HARMONDALE = 206, diff -r 05c62d166182 -r d48c762de563 UIHouses.cpp --- a/UIHouses.cpp Thu May 23 14:08:26 2013 +0200 +++ b/UIHouses.cpp Thu May 23 18:26:05 2013 +0200 @@ -531,8 +531,7 @@ return 0; } } - if ( !start_event_seq_number ) - pAudioPlayer->StopChannels(-1, -1); + pAudioPlayer->StopChannels(-1, -1); uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; diff -r 05c62d166182 -r d48c762de563 UIPartyCreation.cpp --- a/UIPartyCreation.cpp Thu May 23 14:08:26 2013 +0200 +++ b/UIPartyCreation.cpp Thu May 23 18:26:05 2013 +0200 @@ -657,10 +657,10 @@ } while ( uControlParamd < 9 ); - pPlayerCreationUI_BtnOK = pGUIWindow_CurrentMenu->CreateButton(580, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickOK, 0, 0xD, "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE), 0); - pPlayerCreationUI_BtnReset = pGUIWindow_CurrentMenu->CreateButton(527, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickReset, 0, 0x43, "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE2), 0); - pPlayerCreationUI_BtnMinus = pGUIWindow_CurrentMenu->CreateButton(523, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickMinus, 0, 0x2D, "", pTexture_buttminu, 0); - pPlayerCreationUI_BtnPlus = pGUIWindow_CurrentMenu->CreateButton(613, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickPlus, 1, 0x2B, "", pTexture_buttplus, 0); + pPlayerCreationUI_BtnOK = pGUIWindow_CurrentMenu->CreateButton(580, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickOK, 0, '\r', "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE), 0); + pPlayerCreationUI_BtnReset = pGUIWindow_CurrentMenu->CreateButton(527, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickReset, 0, 'C', "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE2), 0); + pPlayerCreationUI_BtnMinus = pGUIWindow_CurrentMenu->CreateButton(523, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickMinus, 0, '-', "", pTexture_buttminu, 0); + pPlayerCreationUI_BtnPlus = pGUIWindow_CurrentMenu->CreateButton(613, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickPlus, 1, '+', "", pTexture_buttplus, 0); pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); } diff -r 05c62d166182 -r d48c762de563 mm7_2.cpp --- a/mm7_2.cpp Thu May 23 14:08:26 2013 +0200 +++ b/mm7_2.cpp Thu May 23 18:26:05 2013 +0200 @@ -3820,33 +3820,31 @@ MonsterDesc *v8; // edi@16 unsigned __int16 v9; // ax@16 int v10; // ebx@16 - int v11; // edi@16 - int v12; // eax@16 - int v13; // ecx@16 - int v14; // ebx@16 + //int v11; // edi@16 + //int v12; // eax@16 + //int v13; // ecx@16 + //int v14; // ebx@16 const char *v15; // [sp-4h] [bp-24h]@2 - unsigned __int16 v16; // [sp+0h] [bp-20h]@1 - int v17; // [sp+4h] [bp-1Ch]@1 + //unsigned __int16 v16; // [sp+0h] [bp-20h]@1 + //int v17; // [sp+4h] [bp-1Ch]@1 unsigned int uFaceID; // [sp+8h] [bp-18h]@16 int v19; // [sp+Ch] [bp-14h]@16 size_t v20; // [sp+10h] [bp-10h]@6 int v21; // [sp+14h] [bp-Ch]@14 - int v22; // [sp+18h] [bp-8h]@14 + //int v22; // [sp+18h] [bp-8h]@14 unsigned int v23; // [sp+1Ch] [bp-4h]@6 - v16 = a2; - v17 = a1; + //v16 = a2; + //v17 = a1; if ( a2 == 4 ) { v15 = "Elemental Light C"; } - else - { - if ( a2 == 3 ) + else if ( a2 == 3 ) v15 = "Elemental Light B"; else v15 = "Elemental Light A"; - } + v23 = pMonsterList->GetMonsterIDByName(v15); v3 = 0; v20 = uNumActors; @@ -3855,7 +3853,7 @@ v4 = pActors;//[0].uAIState; while ( v4->uAIState != Removed ) { - ++v3; + ++v3; ++v4; if ( v3 >= (signed int)uNumActors ) break; @@ -3866,7 +3864,7 @@ if ( v20 != uNumActors || (result = uNumActors + 1, (signed int)(uNumActors + 1) < 500) ) { v21 = 0; - v22 = pParty->vPosition.z; + //v22 = pParty->vPosition.z; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) v21 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); v6 = &pActors[v20]; @@ -3886,22 +3884,21 @@ v6->pMonsterInfo.uExp = 0; v6->uMovementSpeed = v9; v10 = rand() % 2048; - v11 = ((unsigned __int64)(stru_5C6E00->Cos(v10) * (signed __int64)v19) >> 16) + pParty->vPosition.x; + //v11 = pParty->vPosition.x + fixpoint_sub0(stru_5C6E00->Cos(v10), v19); uFaceID = stru_5C6E00->Sin(v10); - v23 = (unsigned __int64)(uFaceID * (signed __int64)v19) >> 16; - v12 = pParty->vPosition.y; - v13 = (unsigned __int64)(uFaceID * (signed __int64)v19) >> 16; - v6->vInitialPosition.x = v11; - v14 = v13 + v12; - LOWORD(v12) = v22; - v6->vInitialPosition.z = v22; - v6->vPosition.z = v12; - LOWORD(v12) = v21; - v6->vPosition.x = v11; - v6->vInitialPosition.y = v14; - v6->vPosition.y = v14; + //v12 = pParty->vPosition.y; + //v13 = fixpoint_sub0(uFaceID, v19); + //v14 = pParty->vPosition.y + fixpoint_sub0(uFaceID, v19); + //LOWORD(v12) = v22; + v6->vInitialPosition.x = pParty->vPosition.x + fixpoint_sub0(stru_5C6E00->Cos(v10), v19); + v6->vPosition.x = v6->vInitialPosition.x; + v6->vInitialPosition.y = pParty->vPosition.y + fixpoint_sub0(uFaceID, v19); + v6->vPosition.y = v6->vInitialPosition.y; + v6->vInitialPosition.z = pParty->vPosition.z; + v6->vPosition.z = v6->vInitialPosition.z; + //LOWORD(v12) = v21; v6->uTetherDistance = 256; - v6->uSectorID = v12; + v6->uSectorID = v21; v6->PrepareSprites(0); v6->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; v6->uAlly = 9999; @@ -3911,19 +3908,17 @@ v6->uCurrentActionLength = 256; v6->UpdateAnimation(); if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor - || (v22 = pParty->vPosition.z, - result = pIndoor->GetSector(v11, v14, pParty->vPosition.z), + || (result = pIndoor->GetSector(v6->vPosition.x, v6->vPosition.y, v6->vPosition.z), result == v21) - && (result = BLV_GetFloorLevel(v11, v14, v22, result, &uFaceID), result != -30000) - && (result = abs(result - v22), result <= 1024) ) + && (result = BLV_GetFloorLevel(v6->vPosition.x, v6->vPosition.y, v6->vPosition.z, result, &uFaceID), result != -30000) + && (result = abs(result - pParty->vPosition.z), result <= 1024) ) { if ( v20 == uNumActors ) ++uNumActors; - v6->uSummonerID = PID(OBJECT_Player,v17); - result = v6->pActorBuffs[2].Apply( - pParty->uTimePlayed + (signed __int64)((double)(a3 << 7) * 0.033333335), - v16, - v17, + v6->uSummonerID = PID(OBJECT_Player, a1); + result = v6->pActorBuffs[2].Apply(pParty->uTimePlayed + (a3 * 128) / 30.0f, + a2, + a1, 0, 0); } @@ -7207,14 +7202,6 @@ if ( wParam == VK_ESCAPE ) { pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, window_SpeakInHouse != 0, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - v12 = window_SpeakInHouse == 0; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = !v12; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ return 0; } if ( wParam <= VK_HOME ) @@ -7231,7 +7218,7 @@ SendMessageA(hWnd, WM_COMMAND, v37, v38); return 0; } - if ( pCurrentScreen + if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE ) return 0; } @@ -9322,7 +9309,7 @@ char test[1024]; sprintfex(test, "^Pi[%s]: знахар^R[ь;ка;]", "Золтан"); - + bool bNoMargareth = false; if (pCmdLine && *pCmdLine) { if (wcsstr(pCmdLine, L"-usedefs")) @@ -9349,6 +9336,8 @@ bNoCD = true; if (wcsstr(pCmdLine, L"-new_sky")) new_sky = true; + if (wcsstr(pCmdLine, L"-nomarg")) + bNoMargareth = true; } @@ -9424,6 +9413,9 @@ bFlashQuestBook = true; pGame->pCShow->PlayMovie(MOVIE_Emerald, 0); SaveNewGame(); + + if (bNoMargareth) + _449B7E_toggle_bit(pParty->_quest_bits, PARTY_QUEST_EMERALD_MARGARETH_OFF, 1); pGame->Loop(); if (uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU) diff -r 05c62d166182 -r d48c762de563 mm7_3.cpp --- a/mm7_3.cpp Thu May 23 14:08:26 2013 +0200 +++ b/mm7_3.cpp Thu May 23 18:26:05 2013 +0200 @@ -11855,11 +11855,9 @@ for (uint i = 0; i < uLevelEVT_NumEvents; ++i) { test_event=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT]; - if ( test_event->_e_type== EVENT_OnMapLeave ) - { - start_event_seq_number = pLevelEVT_Index[i].event_sequence_num; - EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1); - start_event_seq_number = 0; + if ( test_event->_e_type == EVENT_OnMapLeave ) + { + EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1, pLevelEVT_Index[i].event_sequence_num); } } } @@ -11909,11 +11907,9 @@ } else if (_evt->_e_type == EVENT_OnMapReload) { - start_event_seq_number = pEvent.event_sequence_num; - EventProcessor(pEvent.uEventID, 0, 0); - start_event_seq_number = 0; + EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num); } - else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer) + else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize) { v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; v20 = pOutdoor->loc_time.uLastVisitDay; @@ -11936,7 +11932,7 @@ v3->time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11; v3->fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11; - if (v3->timer_evt_type == EVENT_OnLongTimer && !(short)v6 ) + if (v3->timer_evt_type == EVENT_Initialize && !(short)v6 ) { if ( v20 ) v18 = pParty->uTimePlayed - v20; @@ -12157,8 +12153,7 @@ { if ( pParty->uFlags & 2 ) pGame->Draw(); - if ( !start_event_seq_number ) - pAudioPlayer->StopChannels(-1, -1); + pAudioPlayer->StopChannels(-1, -1); pMiscTimer->Pause(); pEventTimer->Pause(); dword_5C3418 = v4; @@ -12178,9 +12173,7 @@ pGUIWindow2->Release(); pGUIWindow2 = 0; activeLevelDecoration = _591094_decoration; - start_event_seq_number = dword_5C341C; - EventProcessor(dword_5C3418, 0, 1); - start_event_seq_number = 0; + EventProcessor(dword_5C3418, 0, 1, dword_5C341C); activeLevelDecoration = NULL; pEventTimer->Resume(); } @@ -12381,7 +12374,7 @@ } //----- (004466C4) -------------------------------------------------------- -int NPC_EventProcessor( int npc_event_id ) +int NPC_EventProcessor(int npc_event_id, int entry_line) { signed int event_index; // ebp@1 int evt_seq_num; // esi@3 @@ -12392,7 +12385,7 @@ event_index = 0; if ( !npc_event_id ) return 0; - evt_seq_num = start_event_seq_number; + evt_seq_num = entry_line; pSomeOtherEVT = pGlobalEVT; uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents; memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400); @@ -12842,11 +12835,7 @@ else { timer->time_left_to_fire = timer->fire_interval; - - start_event_seq_number = timer->timer_evt_seq_num; - EventProcessor(timer->timer_evt_ID, 0, 1); - - start_event_seq_number = 0; + EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); } } else @@ -12862,13 +12851,10 @@ next_trigger_time = 7 * 60 * 60 * 24; // 1 week timer->next_fire_time += (next_trigger_time * 128) / 3.0f; - if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row is big time interval has lapsed + if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed timer->next_fire_time = pParty->uTimePlayed; - start_event_seq_number = timer->timer_evt_seq_num; - EventProcessor(timer->timer_evt_ID, 0, 1); - - start_event_seq_number = 0; + EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); } } } diff -r 05c62d166182 -r d48c762de563 mm7_5.cpp --- a/mm7_5.cpp Thu May 23 14:08:26 2013 +0200 +++ b/mm7_5.cpp Thu May 23 18:26:05 2013 +0200 @@ -1638,10 +1638,8 @@ } else { - start_event_seq_number = dword_5C341C; - EventProcessor(dword_5C3418, 0, 1); - } - start_event_seq_number = 0; + EventProcessor(dword_5C3418, 0, 1, dword_5C341C); + } if ( !_strcmpi(byte_6BE3B0, "d05.blv") ) pParty->uTimePlayed += 1474560i64; continue; @@ -1649,7 +1647,6 @@ CloseWindowBackground(); pVideoPlayer->Unload(); DialogueEnding(); - start_event_seq_number = 0; viewparams->bRedrawGameUI = true; continue; case UIMSG_CycleCharacters: diff -r 05c62d166182 -r d48c762de563 mm7_6.cpp --- a/mm7_6.cpp Thu May 23 14:08:26 2013 +0200 +++ b/mm7_6.cpp Thu May 23 18:26:05 2013 +0200 @@ -7446,15 +7446,18 @@ } //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; - for ( uint i = 0; i < 30; ++i ) + + + // WUT? double event trigger + /*for ( uint i = 0; i < 30; ++i ) { if ( pKeyActionMap->pToggleTypes[i] ) v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]); else v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]); - if ( v14 && i == 9 ) + if ( v14 ) { - if ( !pCurrentScreen ) + if (pCurrentScreen == SCREEN_GAME) { pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); continue; @@ -7480,7 +7483,7 @@ //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); } } - } + }*/ if ( !pEventTimer->bPaused ) { for ( uint i = 0; i < 30; ++i ) @@ -7699,13 +7702,6 @@ } else { - /* if ( dword_50C9E8 < 40 ) - { - dword_50C9EC[3 * dword_50C9E8] = 25; - dword_50C9EC[3 * dword_50C9E8 + 1] = 0; - dword_50C9EC[3 * dword_50C9E8 + 2] = 0; - ++dword_50C9E8; - }*/ pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); } break; diff -r 05c62d166182 -r d48c762de563 mm7_data.cpp --- a/mm7_data.cpp Thu May 23 14:08:26 2013 +0200 +++ b/mm7_data.cpp Thu May 23 18:26:05 2013 +0200 @@ -1306,7 +1306,6 @@ struct Texture *pTexture_outside; // idb struct Texture *pTexture_Dialogue_Background; _UNKNOWN unk_597F10; // weak -int start_event_seq_number; // weak char byte_5B0938[2000]; int EvtTargetObj; // 0x5B5920 int _unused_5B5924_is_travel_ui_drawn = false; // 005B5924 diff -r 05c62d166182 -r d48c762de563 mm7_data.h --- a/mm7_data.h Thu May 23 14:08:26 2013 +0200 +++ b/mm7_data.h Thu May 23 18:26:05 2013 +0200 @@ -799,7 +799,6 @@ extern struct Texture *pTexture_outside; // idb extern struct Texture *pTexture_Dialogue_Background; extern _UNKNOWN unk_597F10; // weak -extern int start_event_seq_number; // weak extern char byte_5B0938[2000]; extern int EvtTargetObj; // weak extern int _unused_5B5924_is_travel_ui_drawn; // 005B5924 @@ -1383,7 +1382,7 @@ int sub_4465DF_check_season(int a1); int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb // void __cdecl crt_construct_5773C4(); -int NPC_EventProcessor(int npc_event_id); +int NPC_EventProcessor(int npc_event_id, int entry_line = 0); 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);