# HG changeset patch # User Ritor1 # Date 1388509328 -21600 # Node ID e99081a3a66aaa0920adff6f23d0c1d35d5843b5 # Parent e378232bfd36baf652c0e0678220d352e6853a6c Arena works diff -r e378232bfd36 -r e99081a3a66a Actor.cpp --- a/Actor.cpp Tue Dec 31 16:26:08 2013 +0600 +++ b/Actor.cpp Tue Dec 31 23:02:08 2013 +0600 @@ -3899,8 +3899,8 @@ void Actor::_4BBF61_summon_actor( int a1, __int16 x, int y, int z ) { Actor *v7; // esi@5 - MonsterInfo *v9; // edi@5 - MonsterDesc *v10; // ebx@5 + //MonsterInfo *v9; // edi@5 + //MonsterDesc *v10; // ebx@5 int v12; // ebx@7 int v13; // eax@8 __int16 v16; // [sp+10h] [bp-4h]@3 @@ -3909,20 +3909,18 @@ { v16 = 0; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - { v16 = pIndoor->GetSector(x, y, z); - } v7 = &pActors[uNumActors]; v7->Reset(); - v9 = &pMonsterStats->pInfos[a1]; - v10 = &pMonsterList->pMonsters[a1 - 1]; - strcpy(v7->pActorName, v9->pName); - v7->sCurrentHP = LOWORD(v9->uHP); - memcpy(&v7->pMonsterInfo, v9, 0x58u); + //v9 = &pMonsterStats->pInfos[a1]; + //v10 = &pMonsterList->pMonsters[a1 - 1]; + strcpy(v7->pActorName, pMonsterStats->pInfos[a1].pName); + v7->sCurrentHP = LOWORD(pMonsterStats->pInfos[a1].uHP); + memcpy(&v7->pMonsterInfo, &pMonsterStats->pInfos[a1], 0x58u); v7->word_000086_some_monster_id = a1; - v7->uActorRadius = v10->uMonsterRadius; - v7->uActorHeight = v10->uMonsterHeight; - v7->uMovementSpeed = v10->uMovementSpeed; + v7->uActorRadius = pMonsterList->pMonsters[a1 - 1].uMonsterRadius; + v7->uActorHeight = pMonsterList->pMonsters[a1 - 1].uMonsterHeight; + v7->uMovementSpeed = pMonsterList->pMonsters[a1 - 1].uMovementSpeed; v7->vInitialPosition.x = x; v7->vPosition.x = x; v7->uAttributes |= 80000; @@ -3941,16 +3939,14 @@ v7->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; v7->PrepareSprites(0); for ( int i = 0; i < 4; i++) - { - pSoundList->LoadSound(v10->pSoundSampleIDs[i], 0); - } - v12 = 0; - do - { - LOWORD(v13) = pSoundList->LoadSound(v12 + word_4EE088_sound_ids[v9->uSpell1ID], 1u); - v12++; - } - while ( v13 ); + pSoundList->LoadSound(pMonsterList->pMonsters[a1 - 1].pSoundSampleIDs[i], 0); + //v12 = 0; + //do//бесконечный цикл + //{ + //LOWORD(v13) = pSoundList->LoadSound(v12 + word_4EE088_sound_ids[pMonsterStats->pInfos[a1].uSpell1ID], 1); + //v12++; + //} + //while ( v13 ); ++uNumActors; } } diff -r e378232bfd36 -r e99081a3a66a Render.cpp --- a/Render.cpp Tue Dec 31 16:26:08 2013 +0600 +++ b/Render.cpp Tue Dec 31 23:02:08 2013 +0600 @@ -1236,9 +1236,6 @@ //----- (0049DC58) -------------------------------------------------------- RenderD3D::RenderD3D() { - RenderD3D *v1; // esi@1 - - v1 = this; this->pHost = 0; this->pDirect3D = 0; this->pUnk = 0; @@ -2299,15 +2296,16 @@ lineB = (char *)lineRGB + 2 * pitch; for ( uint x = 0; x < this->field_10; x++ ) { - int p = *line_picture_data; - int for_rad = (pRenderer->uTargetGBits + pRenderer->uTargetBBits ); - int value = (pRenderer->uTargetRMask & *line_picture_data); + int p = *line_picture_data; //0x2818 + int for_rad = (pRenderer->uTargetGBits + pRenderer->uTargetBBits );//16 = 8 + 8 + int value = (pRenderer->uTargetRMask & *line_picture_data);//0 = 0xFF0000 & 0x2818 int result = (pRenderer->uTargetRMask & *line_picture_data) >> (pRenderer->uTargetGBits + pRenderer->uTargetBBits ); lineRGB[x] = (pRenderer->uTargetRMask & *line_picture_data) >> (pRenderer->uTargetGBits + pRenderer->uTargetBBits );// + pRenderer->uTargetRBits - 8); lineG[x] = (pRenderer->uTargetGMask & *line_picture_data) >> (pRenderer->uTargetBBits);// + pRenderer->uTargetGBits - 8); - int value2 = (pRenderer->uTargetGMask & *line_picture_data); + int value2 = (pRenderer->uTargetGMask & *line_picture_data); //10240 = 0xFF00 & 0x2818 int result2 = (pRenderer->uTargetGMask & *line_picture_data) >> (pRenderer->uTargetBBits); lineB[x] = (pRenderer->uTargetBMask & *line_picture_data);// << (8 - pRenderer->uTargetBBits); + int value3 = (pRenderer->uTargetBMask & *line_picture_data);//24 = 0xFF & 0x2818 line_picture_data += 2; } } diff -r e378232bfd36 -r e99081a3a66a mm7_2.cpp --- a/mm7_2.cpp Tue Dec 31 16:26:08 2013 +0600 +++ b/mm7_2.cpp Tue Dec 31 23:02:08 2013 +0600 @@ -406,12 +406,12 @@ Player *v2; // edi@9 int v3; // eax@10 signed int v4; // esi@10 - signed __int64 v5; // qax@18 + //signed __int64 v5; // qax@18 signed int v6; // ebx@34 - char *v7; // edi@34 + //char *v7; // edi@34 int v8; // eax@37 - int v9; // esi@43 - int v10; // eax@44 + //int v9; // esi@43 + //int v10; // eax@44 unsigned __int8 v11; // sf@44 unsigned __int8 v12; // of@44 signed int v13; // eax@49 @@ -428,7 +428,7 @@ GUIWindow window; // [sp+D4h] [bp-6Ch]@1 __int16 monster_ids[6]; // [sp+128h] [bp-18h]@56 int v26; // [sp+134h] [bp-Ch]@1 - int v27; // [sp+138h] [bp-8h]@23 + //int v27; // [sp+138h] [bp-8h]@23 int num_monsters; // [sp+13Ch] [bp-4h]@17 v26 = 0; @@ -442,23 +442,19 @@ if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) pIndoor->Draw(); else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) - pOutdoor->Draw(); + pOutdoor->Draw(); pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); pRenderer->BeginScene(); if ( pRenderer->pRenderD3D ) - pRenderer->FillRectFast( - pViewport->uViewportTL_X, - pViewport->uViewportTL_Y, - pViewport->uViewportBR_X - pViewport->uViewportTL_X, - pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1, - pRenderer->uTargetGMask | pRenderer->uTargetBMask); + pRenderer->FillRectFast(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pViewport->uViewportBR_X - pViewport->uViewportTL_X, + pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1, pRenderer->uTargetGMask | pRenderer->uTargetBMask); Texture* pTex = pIcons_LOD->GetTexture(uTextureID_Leather); pRenderer->GetLeather(8, 352 - v0, pTex, pTex->uTextureHeight - v0); - pRenderer->DrawTextureIndexed(8u, 347 - v0, pTexture_591428); - v1 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[575], pFontArrus, &window, 0xDu, 0); + pRenderer->DrawTextureIndexed(8, 347 - v0, pTexture_591428); + v1 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[575], pFontArrus, &window, 0xDu, 0);//Пожалуйста, подождите пока я вызываю существ. Удачи. pDialogueWindow->DrawText(pFontArrus, 13, 354 - v0, 0, v1, 0, 0, 0); pRenderer->EndScene(); pRenderer->Present(); @@ -477,43 +473,40 @@ ++pMessageQueue_50CBD0->uNumMessages; }*/ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - v2 = pParty->pPlayers.data(); - do + //v2 = pParty->pPlayers.data(); + for ( uint i = 0; i < 4; i++ ) { - v3 = v2->GetActualLevel(); + v3 = pParty->pPlayers[i].GetActualLevel(); v4 = v26; if ( v3 > v26 ) { - v26 = v2->GetActualLevel(); - v4 = v26; + v26 = pParty->pPlayers[i].GetActualLevel(); + v4 = pParty->pPlayers[i].GetActualLevel(); } - ++v2; + //++v2; } - while ( (signed int)v2 < (signed int)pParty->pHirelings.data() ); - if ( uDialogueType == 85 ) + //while ( (signed int)v2 < (signed int)pParty->pHirelings.data() ); + if ( uDialogueType == DIALOGUE_ARENA_SELECT_PAGE ) { num_monsters = v4; v4 /= 2; } - else if ( uDialogueType == 86 ) + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_SQUIRE ) { - v5 = (signed __int64)((double)v26 * 1.5); - num_monsters = v5; + //v5 = (signed __int64)((double)v26 * 1.5); + num_monsters = (int)((double)v26 * 1.5); v4 /= 2; } - else if ( uDialogueType == 87 ) + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_KNIGHT ) { - LODWORD(v5) = 2 * v4; - num_monsters = v5; + //LODWORD(v5) = 2 * v4; + num_monsters = 2 * v4; v4 /= 2; } - else + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_CHAMPION ) { - __debugbreak(); // warning C4700: uninitialized local variable 'v27' used - if ( uDialogueType == 88 ) - num_monsters = 2 * v4; - else - v4 = v27; + num_monsters = 2 * v4; + v4 /= 2; } if ( v4 < 1 ) v4 = 1; @@ -526,43 +519,44 @@ if ( num_monsters < 2 ) num_monsters = 2; v6 = 0; - v27 = 1; - v7 = (char *)&pMonsterStats->pInfos[1].uLevel; - do + //v27 = 1; + //v7 = (char *)&pMonsterStats->pInfos[1].uLevel; + for ( uint i = 1; i <= 258; i++ ) { - if ( v7[8] != 1 ) + if ( pMonsterStats->pInfos[i].uAIType != 1 )//if ( v7[8] != 1 ) { - if ( !MonsterStats::BelongsToSupertype(*((short *)v7 + 22), MONSTER_SUPERTYPE_8) ) + if ( !MonsterStats::BelongsToSupertype(pMonsterStats->pInfos[i].uID, MONSTER_SUPERTYPE_8) ) //!MonsterStats::BelongsToSupertype(*((short *)v7 + 22), MONSTER_SUPERTYPE_8) { - v8 = (unsigned __int8)*v7; - if ( v8 >= v4 ) + //v8 = (unsigned __int8)pMonsterStats->pInfos[i].uLevel; + if ( pMonsterStats->pInfos[i].uLevel >= v4 ) { - if ( v8 <= num_monsters ) - v23[v6++] = v27; + if ( pMonsterStats->pInfos[i].uLevel <= num_monsters ) + v23[v6++] = i; } } } - ++v27; - v7 += 88; + // ++v27; + //v7 += 88; } - while ( (signed int)v7 <= (signed int)&pMonsterStats->pInfos[258].uLevel ); + //while ( (signed int)v7 <= (signed int)&pMonsterStats->pInfos[258].uLevel ); num_monsters = 6; if ( v6 < 6 ) num_monsters = v6; - v9 = 0; + //v9 = 0; if ( num_monsters > 0 ) { - do + for ( uint i = 0; i < num_monsters; i++ ) { - v10 = rand(); - ++v9; - v12 = __OFSUB__(v9, num_monsters); - v11 = v9 - num_monsters < 0; - *((short *)&window.pControlsTail + v9 + 1) = v23[v10 % v6]; + //v10 = rand(); + //++v9; + //v12 = __OFSUB__(v9, num_monsters); + //v11 = v9 - num_monsters < 0; + //*((short *)&window.pControlsTail + v9 + 1) = v23[rand() % v6]; + monster_ids[i] = v23[rand() % v6]; } - while ( v11 ^ v12 ); + //while ( v11 ^ v12 ); } - if ( uDialogueType == 85 ) + if ( uDialogueType == DIALOGUE_ARENA_SELECT_PAGE ) { v16 = rand(); v17 = 3; @@ -571,7 +565,7 @@ v13 = v22; v14 = v18 + 6; } - else if ( uDialogueType == 86 ) + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_SQUIRE ) { v16 = rand(); v17 = 7; @@ -580,7 +574,7 @@ v13 = v22; v14 = v18 + 6; } - else if ( uDialogueType == 87 ) + else if ( uDialogueType == DIALOGUE_ARENA_SELECT_KNIGHT ) { v15 = rand() % 11; v13 = 200; @@ -588,23 +582,23 @@ } else { - if ( uDialogueType == 88 ) + if ( uDialogueType == DIALOGUE_ARENA_SELECT_CHAMPION ) { v13 = 500; v14 = 20; } - else - { - v14 = v27; - v13 = gold_transaction_amount; - } + //else + //{ + //v14 = v27; + //v13 = gold_transaction_amount; + //} } - i = 0; - for ( gold_transaction_amount = v26 * v13; i < v14; ++i ) + gold_transaction_amount = v26 * v13; + for ( i = 0; i < v14; ++i ) { - monster_y = pMonsterArenaPlacements[i].y; - v21 = rand(); - Actor::_4BBF61_summon_actor((unsigned __int16)monster_ids[v21 % num_monsters], pMonsterArenaPlacements[i].x, monster_y, 1); + //monster_y = pMonsterArenaPlacements[i].y; + //v21 = rand(); + Actor::_4BBF61_summon_actor(monster_ids[rand() % num_monsters], pMonsterArenaPlacements[i].x, pMonsterArenaPlacements[i].y, 1); } pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0); } diff -r e378232bfd36 -r e99081a3a66a mm7_data.cpp --- a/mm7_data.cpp Tue Dec 31 16:26:08 2013 +0600 +++ b/mm7_data.cpp Tue Dec 31 23:02:08 2013 +0600 @@ -841,7 +841,30 @@ std::array price_for_membership={100, 100, 50, 50, 50, 50, 50, 50, 50, 1000, 1000}; // weak -std::array pMonsterArenaPlacements; +std::array pMonsterArenaPlacements = + {{ + Vec2_int_(0x5F4, 0x208C), + Vec2_int_(0x88A, 0x228C), + Vec2_int_(0xC93, 0x247B), + Vec2_int_(0x1194, 0x247B), + Vec2_int_(0x14CB, 0x232C), + Vec2_int_(0x177D, 0x2098), + Vec2_int_(0x50B, 0x1E15), + Vec2_int_(0x18FF, 0x1E15), + Vec2_int_(0x50B, 0xD69), + Vec2_int_(0x18FF, 0x1B15), + Vec2_int_(0x50B, 0x1021), + Vec2_int_(0x18FF, 0x1848), + Vec2_int_(0x50B, 0x12D7), + Vec2_int_(0x18FF, 0x15A3), + Vec2_int_(0x50B, 0x14DB), + Vec2_int_(0x18FF, 0x12D7), + Vec2_int_(0x50B, 0x1848), + Vec2_int_(0x18FF, 0x1021), + Vec2_int_(0x50B, 0x1B15), + Vec2_int_(0x18FF, 0xD69), + }} +; std::array<__int16, 32> word_4F0F30 ={{ 4, 7, 10, 11, 4, 7, 10, 11, 4, 7, 10, 11,