Mercurial > mm7
changeset 310:4c2cdda88562
m
author | Gloval |
---|---|
date | Wed, 20 Feb 2013 01:40:18 +0400 |
parents | 6d584c95dcf8 |
children | 3c011f4ccba3 |
files | Events.cpp Events.h Player.cpp mm7_3.cpp stru176.h |
diffstat | 5 files changed, 193 insertions(+), 202 deletions(-) [+] |
line wrap: on
line diff
--- a/Events.cpp Wed Feb 20 00:28:52 2013 +0400 +++ b/Events.cpp Wed Feb 20 01:40:18 2013 +0400 @@ -261,7 +261,7 @@ int v119; // [sp-4h] [bp-4ACh]@231 int v120; // [sp-4h] [bp-4ACh]@278 int v121; // [sp-4h] [bp-4ACh]@294 - int v122; // [sp+10h] [bp-498h]@4 + int curr_seq_num; // [sp+10h] [bp-498h]@4 //char *v123; // [sp+14h] [bp-494h]@0 //signed int v124; // [sp+18h] [bp-490h]@7 signed int v125; // [sp+1Ch] [bp-48Ch]@155 @@ -294,8 +294,8 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here return; } - v127 = 2 * (uActiveCharacter == 0) + 4; - v122 = dword_597F18; + v127 = 2 * (uActiveCharacter == 0) + 4; //4 and 6 + curr_seq_num = dword_597F18; if ( _5C3420_pDecoration ) { uSomeEVT_NumEvents = uGlobalEVT_NumEvents; @@ -322,18 +322,18 @@ if ( dword_5B65C4 ) goto LABEL_301; //v8 = v4; - if ( pSomeEVT_Events[i/*v4*/].uEventID == uEventID && pSomeEVT_Events[i/*v4*/].event_sequence_num == v122 ) + if ( pSomeEVT_Events[i/*v4*/].uEventID == uEventID && pSomeEVT_Events[i/*v4*/].event_sequence_num == curr_seq_num ) { //v9 = pSomeEVT_Events[v8].uEventOffsetInEVT; //v10 = (ByteArray *)&v5[v9]; auto _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[i/*v4*/].uEventOffsetInEVT); - switch (_evt->v4) + switch (_evt->_e_type) { case EVENT_CheckSeason: if ( !sub_4465DF_check_season(_evt->v5) ) { - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -379,7 +379,7 @@ } if (pAsyncMouse) pAsyncMouse->Resume(); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -402,7 +402,7 @@ } if (pAsyncMouse) pAsyncMouse->Resume(); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -426,7 +426,7 @@ } if (pAsyncMouse) pAsyncMouse->Resume(); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -466,7 +466,7 @@ ++v20; if ( v20 >= 4 ) { - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -491,7 +491,7 @@ v11 = _evt->v11; goto LABEL_130; } - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -516,7 +516,7 @@ bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); } - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -534,7 +534,7 @@ stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = 0; LOBYTE(v26->field_2) |= 0x20u; } - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -545,13 +545,15 @@ v28 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; pNPCStats->pNewNPCData[v27].greet = v28; - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; //v7 = ""; break; case EVENT_SetNPCTopic: + { + v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); v30 = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8); v31 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); @@ -618,7 +620,8 @@ } } } - ++v122; + ++curr_seq_num; + } //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -627,7 +630,7 @@ 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); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -636,7 +639,7 @@ 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); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -644,7 +647,7 @@ 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); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -653,7 +656,7 @@ 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); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -676,7 +679,7 @@ } while ( v40 ); } - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -699,13 +702,15 @@ } while ( v44 ); } - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; //v7 = ""; break; 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); if ( ptr_507BC0 ) { @@ -745,7 +750,8 @@ pVideoPlayer->bLoopPlaying = 0; } } - ++v122; + ++curr_seq_num; + } //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -753,8 +759,8 @@ break; case EVENT_Jmp: //v124 = -1; - v122 = _evt->v5 - 1; - ++v122; + curr_seq_num = _evt->v5 - 1; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -769,7 +775,7 @@ v53 = (unsigned __int8)v50; v52 = &pParty->pPlayers[v53]; v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -782,7 +788,7 @@ v113 = _evt->v6; v52 = pPlayers[uActiveCharacter]; v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -796,7 +802,7 @@ v53 = rand() % 4; v52 = &pParty->pPlayers[v53]; v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -811,7 +817,7 @@ } while ( (signed int)v51 < (signed int)pParty->pHirelings ); //LABEL_291: - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -842,7 +848,7 @@ v56 = &pParty->pPlayers[v57]; LABEL_120: v56->PlaySound((PlayerSpeech)v114, v118); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -856,7 +862,7 @@ ++v55; } //while ( (signed int)v55 < (signed int)pParty->pHirelings ); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -864,7 +870,7 @@ break; case EVENT_ForPartyMember: v127 = _evt->v5; - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -877,7 +883,7 @@ _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8), _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), _evt->v25, _evt->v26, 0, 0); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -898,7 +904,7 @@ ++v59; if ( (signed int)v59 >= (signed int)pParty->pHirelings ) { - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -941,7 +947,7 @@ LABEL_140: if ( v62 ) goto LABEL_129; - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -961,7 +967,7 @@ if ( (void *)pParty->pPickedItem.uItemID == v63 ) { pMouse->RemoveHoldingItem(); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -976,7 +982,7 @@ if ( *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v67 + 5] == v63 ) { v66->RemoveItemAtInventoryIndex(v65); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -994,7 +1000,7 @@ if ( *(int *)v69 && *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v69 + 5] == v63 ) { *(&v66->pEquipment.uOffHand + v68) = 0; - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1042,7 +1048,7 @@ v125 += 4; if ( v125 > (signed int)&pPlayers[4] ) { - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1064,7 +1070,7 @@ goto LABEL_180; LABEL_183: ((Player *)v6)->SubtractVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1095,7 +1101,7 @@ ++v76; } while ( (signed int)v76 < (signed int)pParty->pHirelings ); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1116,7 +1122,7 @@ goto LABEL_194; LABEL_197: ((Player *)v6)->SetVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1147,7 +1153,7 @@ ++v79; } while ( (signed int)v79 < (signed int)pParty->pHirelings ); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1200,7 +1206,7 @@ v83 = _evt->v5 + ((uint)_evt->v6 << 8); if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) viewparams->bRedrawGameUI = 1; - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1214,7 +1220,7 @@ &pLevelStr[pLevelStrOffsets[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); - v105 = v122; + v105 = curr_seq_num; v121 = 26; LABEL_295: sub_4451A8_press_any_key(uEventID, v105, v121); @@ -1235,9 +1241,9 @@ LABEL_130: //v124 = -1; LABEL_131: - v122 = v11 - 1; + curr_seq_num = v11 - 1; } - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1262,7 +1268,7 @@ { if ( !uActiveCharacter ) { - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1277,13 +1283,13 @@ if ( v86 != 5 ) { v119 = _evt->v6; - v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v1 << 8)) << 8)) << 8); + v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10<< 8)) << 8)) << 8); v89 = rand() % 4; LABEL_233: v88 = &pParty->pPlayers[v89]; LABEL_234: v88->ReceiveDamage(v115, v119); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1297,7 +1303,7 @@ ++v87; } while ( (signed int)v87 < (signed int)pParty->pHirelings ); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1305,7 +1311,7 @@ break; case EVENT_ToggleIndoorLight: pIndoor->ToggleLight(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1314,7 +1320,7 @@ 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); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1323,7 +1329,7 @@ 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); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1332,7 +1338,7 @@ 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); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1343,7 +1349,7 @@ _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); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1352,7 +1358,7 @@ case EVENT_SetSnow: if ( !_evt->v5 ) pWeather->bRenderSnow = _evt->v6 != 0; - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1365,7 +1371,7 @@ if ( _5C3420_pDecoration == (LevelDecoration *)1 ) { ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1377,7 +1383,7 @@ v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; //LABEL_248: ShowStatusBarString(v91, 2u); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1391,7 +1397,7 @@ { v91 = &pLevelStr[pLevelStrOffsets[v90]]; ShowStatusBarString(v91, 2u); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1399,7 +1405,7 @@ break; } } - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1417,7 +1423,7 @@ { strcpy(byte_5B0938, &pLevelStr[pLevelStrOffsets[v92]]); } - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1430,7 +1436,7 @@ _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)); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1438,7 +1444,7 @@ break; case EVENT_SetTexture: sub_44861E_set_texture(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), (char *)&_evt->v9); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1446,7 +1452,7 @@ break; case EVENT_SetSprite: SetDecorationSprite(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9, (char *)&_evt->v10); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1459,7 +1465,7 @@ _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)); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1467,8 +1473,8 @@ break; case EVENT_MouseOver: case EVENT_LocationName: - --v122; - ++v122; + --curr_seq_num; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1476,7 +1482,7 @@ break; case EVENT_ChangeDoorState: sub_449A49_door_switch_animation(_evt->v5, _evt->v6); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1485,7 +1491,7 @@ case EVENT_OpenChest: if ( !Chest::Open(_evt->v5) ) goto LABEL_301; - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1507,7 +1513,7 @@ pRenderer->_49FD3A(); sub_444839_move_map(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); dword_5C3418 = uEventID; - dword_5C341C = v122 + 1; + dword_5C341C = curr_seq_num + 1; goto LABEL_301; } _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); @@ -1587,7 +1593,7 @@ goto LABEL_302; } } - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1612,7 +1618,7 @@ if ( v102 ) item.uItemID = v102; pParty->SetHoldingItem(&item); - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1636,7 +1642,7 @@ ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); } - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123; @@ -1644,12 +1650,12 @@ break; case EVENT_PressAnyKey: v121 = 33; - v105 = v122 + 1; + v105 = curr_seq_num + 1; goto LABEL_295; case EVENT_Exit: goto LABEL_301; default: - ++v122; + ++curr_seq_num; //v4 = v124; //v5 = pSomeEVT; //v6 = v123;
--- a/Events.h Wed Feb 20 00:28:52 2013 +0400 +++ b/Events.h Wed Feb 20 01:40:18 2013 +0400 @@ -22,12 +22,12 @@ #pragma pack(push, 1) struct _evt_raw { - unsigned char v0; + unsigned char _e_size; unsigned char v1; unsigned char v2; unsigned char v3; - unsigned char v4; + unsigned char _e_type; unsigned char v5; unsigned char v6; unsigned char v7;
--- a/Player.cpp Wed Feb 20 00:28:52 2013 +0400 +++ b/Player.cpp Wed Feb 20 01:40:18 2013 +0400 @@ -8301,7 +8301,7 @@ } if ( var <= VAR_Counter8 ) { - if ( (signed int)var >= 245 ) + if ( (signed int)var >= 0xF5 ) { *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed); *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed); @@ -8328,7 +8328,7 @@ } if ( var < VAR_Counter9 ) return; - if ( (signed int)var <= 274 ) + if ( (signed int)var <= 0x112 ) { *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed); *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed); @@ -8764,7 +8764,7 @@ //----- (0044AFFB) -------------------------------------------------------- -void Player::AddVariable(enum VariableType var, signed int val) +void Player::AddVariable(enum VariableType var_type, signed int val) { char v3; // bl@1 Player *v4; // esi@1 @@ -8793,7 +8793,7 @@ DDM_DLV_Header *v27; // eax@153 signed int v28; // eax@176 int v29; // [sp-8h] [bp-40h]@84 - signed int v30; // [sp-4h] [bp-3Ch]@4 + // signed int v30; // [sp-4h] [bp-3Ch]@4 int v31; // [sp-4h] [bp-3Ch]@84 ItemGen item; // [sp+Ch] [bp-2Ch]@45 unsigned int v33; // [sp+30h] [bp-8h]@34 @@ -8805,31 +8805,21 @@ v4 = Dst; uPlayerIdx = 0; if ( Dst == pPlayers[2] ) - { uPlayerIdx = 1; - goto LABEL_8; - } - if ( Dst == pPlayers[3] ) - { - v30 = 2; - } - else - { - if ( Dst != pPlayers[4] ) - goto LABEL_8; - v30 = 3; - } - uPlayerIdx = v30; -LABEL_8: - if ( var <= VAR_AutoNotes ) - { - if ( var != VAR_AutoNotes ) - { - if ( var <= VAR_ActualMight ) - { - if ( var != VAR_ActualMight ) + else if ( Dst == pPlayers[3] ) + uPlayerIdx = 2; + else if ( Dst == pPlayers[4] ) + uPlayerIdx = 3; + + if ( var_type <= VAR_AutoNotes ) + { + if ( var_type != VAR_AutoNotes ) + { + if ( var_type <= VAR_ActualMight ) + { + if ( var_type != VAR_ActualMight ) { - switch ( var ) + switch ( var_type ) { case VAR_RandomGold: if ( !val ) @@ -9002,11 +8992,11 @@ v19 = (__int16 *)&Dst->uMightBonus; goto LABEL_113; } - if ( var <= VAR_FireResistanceBonus ) - { - if ( var != VAR_FireResistanceBonus ) + if ( var_type <= VAR_FireResistanceBonus ) + { + if ( var_type != VAR_FireResistanceBonus ) { - switch ( var ) + switch ( var_type ) { case VAR_ActualIntellect: LABEL_66: @@ -9085,13 +9075,13 @@ pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); goto _play_anim_and_maybe_sound; } - if ( var <= VAR_DisarmTrapSkill ) - { - if ( var != VAR_DisarmTrapSkill ) + if ( var_type <= VAR_DisarmTrapSkill ) + { + if ( var_type != VAR_DisarmTrapSkill ) { - if ( var <= VAR_BodyResistanceBonus ) + if ( var_type <= VAR_BodyResistanceBonus ) { - switch ( var ) + switch ( var_type ) { case VAR_BodyResistanceBonus: v19 = &Dst->sResBodyBonus; @@ -9109,43 +9099,43 @@ v19 = &Dst->sResSpiritBonus; break; default: - if ( var != 62 ) + if ( var_type != 62 ) return; v19 = &Dst->sResMindBonus; break; } goto LABEL_113; } - if ( var == VAR_LightResistanceBonus ) + if ( var_type == VAR_LightResistanceBonus ) { v19 = &Dst->sResLightBonus; goto LABEL_113; } - if ( var == VAR_DarkResistanceBonus ) + if ( var_type == VAR_DarkResistanceBonus ) { v19 = &Dst->sResDarkBonus; goto LABEL_113; } - if ( var == VAR_MagicResistanceBonus ) + if ( var_type == VAR_MagicResistanceBonus ) { v19 = &Dst->sResMagicBonus; goto LABEL_113; } - if ( var <= VAR_MagicResistanceBonus || var > VAR_DiplomacySkill ) + if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) return; } goto LABEL_106; } - if ( var == VAR_LearningSkill ) + if ( var_type == VAR_LearningSkill ) { LABEL_106: if ( val <= VAR_BodyResistanceBonus ) { - *((short *)&Dst->pConditions[16] + var) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var) & VAR_BodyResistanceBonus; + *((short *)&Dst->pConditions[16] + var_type) = (unsigned __int8)val | *((char *)&Dst->pConditions[16] + 2 * var_type) & VAR_BodyResistanceBonus; } else { - v20 = (char *)&Dst->pConditions[16] + 2 * var; + v20 = (char *)&Dst->pConditions[16] + 2 * var_type; v21 = *(short *)v20; v22 = (unsigned __int8)val + (v21 & VAR_BodyResistanceBonus); if ( v22 > 60 ) @@ -9155,22 +9145,22 @@ } goto _play_anim_and_exit; } - if ( var <= VAR_LearningSkill ) + if ( var_type <= VAR_LearningSkill ) return; - if ( var <= VAR_Eradicated ) - { - Dst->SetCondition(var - 105, 0); + if ( var_type <= VAR_Eradicated ) + { + Dst->SetCondition(var_type - 105, 0); } else { - if ( var != VAR_MajorCondition ) + if ( var_type != VAR_MajorCondition ) { - if ( var > VAR_MajorCondition && var <= VAR_ActiveSpells ) + if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) { - if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var] <= 255 ) - byte_5E4C15[var] += val; + if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 ) + byte_5E4C15[var_type] += val; else - byte_5E4C15[var] = -1; + byte_5E4C15[var_type] = -1; } return; } @@ -9203,14 +9193,14 @@ goto _maybe_play_sound; goto _play_anim_and_maybe_sound; } - if ( var > VAR_GoldInBank ) - { - if ( var == 307 ) + if ( var_type > VAR_GoldInBank ) + { + if ( var_type == 307 ) { pParty->uNumDeaths += val; goto LABEL_173; } - switch ( var ) + switch ( var_type ) { case 308: pParty->uNumBountiesCollected += val; @@ -9234,21 +9224,21 @@ } else { - if ( var == VAR_GoldInBank ) + if ( var_type == VAR_GoldInBank ) { pParty->uNumGoldInBank += val; return; } - if ( var <= VAR_Counter8 ) - { - if ( (signed int)var >= 245 ) - { - *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed); - *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(pParty->uTimePlayed); + if ( var_type <= VAR_Counter8 ) + { + if ( (signed int)var_type >= 245 ) + { + *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed); + *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); } else { - switch ( var ) + switch ( var_type ) { case VAR_MonthEquals|VAR_CurrentSP: _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); @@ -9266,22 +9256,22 @@ } return; } - if ( var < VAR_Counter9 ) + if ( var_type < VAR_Counter9 ) return; - if ( (signed int)var <= 274 ) - { - *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed); - *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed); + if ( (signed int)var_type <= 274 ) + { + *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); + *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); goto _play_sound; } - if ( var != VAR_ReputationInCurrentLocation ) - { - if ( var <= VAR_ReputationInCurrentLocation - || var > VAR_History_28 - || (v25 = var - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) - || (pParty->field_3C.field_4F0[2 * (var - 276)] = LODWORD(pParty->uTimePlayed), + if ( var_type != VAR_ReputationInCurrentLocation ) + { + if ( var_type <= VAR_ReputationInCurrentLocation + || var_type > VAR_History_28 + || (v25 = var_type - 276, pParty->field_3C.field_4F0[2 * v25 + 1] | pParty->field_3C.field_4F0[2 * v25]) + || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), v26 = pStorylineText->StoreLine[v25].pText==0,//*(&pStorylineText->field_0 + 3 * v25) == 0, - pParty->field_3C.field_4F0[2 * (var - 276) + 1] = HIDWORD(pParty->uTimePlayed), + pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), v26) ) return; bFlashHistoryBook = 1;
--- a/mm7_3.cpp Wed Feb 20 00:28:52 2013 +0400 +++ b/mm7_3.cpp Wed Feb 20 01:40:18 2013 +0400 @@ -14268,15 +14268,15 @@ signed __int64 v14; // qax@26 int v15; // ST58_4@26 signed __int64 v16; // qax@26 - int v17; // ebx@26 + int hours; // ebx@26 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12 - signed __int64 v19; // [sp+14h] [bp-3Ch]@26 + signed __int64 seconds; // [sp+14h] [bp-3Ch]@26 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7 - int v22; // [sp+2Ch] [bp-24h]@26 - int v24; // [sp+34h] [bp-1Ch]@26 - int v25; // [sp+38h] [bp-18h]@26 + int minutes; // [sp+2Ch] [bp-24h]@26 + int month; // [sp+34h] [bp-1Ch]@26 + int weeks; // [sp+38h] [bp-18h]@26 int v26; // [sp+3Ch] [bp-14h]@15 - int v27; // [sp+3Ch] [bp-14h]@26 + int days; // [sp+3Ch] [bp-14h]@26 int v28; // [sp+40h] [bp-10h]@26 __int16 v29; // [sp+46h] [bp-Ah]@9 __int16 v30; // [sp+48h] [bp-8h]@9 @@ -14286,34 +14286,34 @@ for (uint i = 0; i < uLevelEVT_NumEvents; ++i) { - auto pEvent = pLevelEVT_Index + i; - - auto _evt = (_evt_raw *)(pLevelEVT + pEvent->uEventOffsetInEVT); - - if (_evt->v4 == 3) + auto pEvent = pLevelEVT_Index[i]; + + auto _evt = (_evt_raw *)(pLevelEVT + pEvent.uEventOffsetInEVT); + + if (_evt->_e_type == EVENT_PlaySound) { pSoundList->LoadSound( _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8), 0); } - else if (_evt->v4 == 37) - { - dword_597F18 = pEvent->event_sequence_num; - EventProcessor(pEvent->uEventID, 0, 0); + else if (_evt->_e_type == EVENT_OnMapReload) + { + dword_597F18 = pEvent.event_sequence_num; + EventProcessor(pEvent.uEventID, 0, 0); dword_597F18 = 0; } - else if (_evt->v4 == 31 || _evt->v4 == 38) + else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer) { v3 = &array_5B5928[dword_5B65C8]; v20 = pOutdoor->uLastVisitDay; if (uCurrentlyLoadedLevelType == LEVEL_Indoor) v20 = pIndoor->stru1.uLastVisitDay; - v4 = _evt->v4; + v4 = _evt->_e_type; v3->field_1C = v4; - v3->field_8 = pEvent->uEventID; - v3->field_A = pEvent->event_sequence_num; + v3->field_8 = pEvent.uEventID; + v3->field_A = pEvent.event_sequence_num; v33 = _evt->v6; v3->field_12 = v33; v32 = _evt->v7; @@ -14342,9 +14342,8 @@ { if ( v5 ) { - v3->field_4 = 0; ++dword_5B65C8; - v3->field_0 = 0; + v3->field_0_time = 0; continue; } } @@ -14352,9 +14351,8 @@ v26 / 7 != 0 && v32 != 0 || v26 != 0 || !v20) { - v3->field_4 = 0; ++dword_5B65C8; - v3->field_0 = 0; + v3->field_0_time = 0; continue; } } @@ -14362,30 +14360,30 @@ v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); v9 = v8; v10 = (signed int)v8 / 60; - v22 = v10 % 60; + minutes = v10 % 60; v11 = (signed int)(v10 / 60); v12 = v11 % 24; v13 = (signed int)(v11 / 24); - v27 = v13 % 7; + days = v13 % 7; v14 = (signed int)(v13 / 7); v15 = v14 % 4; v16 = (signed int)(v14 / 4); - v24 = v16 / 12; + month = v16 / 12; auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32; auto _2 = ((__int64)v9 << 32) | _1; - v19 = _2 % 60; + seconds = _2 % 60; //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32, // v9) // % 60; - v17 = v12; - v25 = v15; + hours = v12; + weeks = v15; v28 = v16 % 12; if ( v5 ) { - ++v24; + ++month; } else { @@ -14397,28 +14395,26 @@ { if ( v32 ) { - ++v25; + ++weeks; } else { - ++v27; - v22 = v30; - v17 = v31; - v19 = v29; - } - } - } - auto v0 = (signed __int64)((double)((v19 - + 0x3C * v22 - + 0xE10 * v17 - + 0x93A80 * v25 - + 0x15180 * v27 - + 0x24EA00 * (v28 + 12i64 * v24)) << 7) + ++days; + minutes = v30; + hours = v31; + seconds = v29; + } + } + } + v3->field_0_time = (signed __int64)((double)((seconds + + 60 * minutes + + 3600 * hours + + 0x93A80 * weeks + + 0x15180 * days + + 0x24EA00 * (v28 + 12i64 * month)) << 7) * 0.033333335); - v3->field_4 = HIDWORD(v0); ++dword_5B65C8; - v3->field_0 = v0; } } }