Mercurial > mm7
diff Actor.cpp @ 1849:794f6ac640f4
Actor::ToggleFlag, sub_448518_npc_set_item cleanup
author | Grumpy7 |
---|---|
date | Sun, 13 Oct 2013 08:03:14 +0200 |
parents | 35c1e4ff6ba7 |
children | 521ffedabe19 |
line wrap: on
line diff
--- a/Actor.cpp Sun Oct 13 07:18:03 2013 +0200 +++ b/Actor.cpp Sun Oct 13 08:03:14 2013 +0200 @@ -54,23 +54,26 @@ unsigned int v9; // [sp+14h] [bp-Ch]@4 unsigned int v10; // [sp+1Ch] [bp-4h]@4 - bar_length = 25; - if ( actor->pMonsterInfo.uHP > 25 ) - { + if (actor->pMonsterInfo.uHP <= 25) + bar_length = 25; + else if ( actor->pMonsterInfo.uHP < 200 ) + bar_length = actor->pMonsterInfo.uHP; + else bar_length = 200; - if ( actor->pMonsterInfo.uHP < 200 ) - bar_length = actor->pMonsterInfo.uHP; - } + v10 = bar_length; - v9 = uTextureID_mhp_grn; + if ( actor->sCurrentHP <= (0.34 * actor->pMonsterInfo.uHP) ) + v9 = uTextureID_mhp_red; + else if ( actor->sCurrentHP <= ( 0.67 * actor->pMonsterInfo.uHP) ) + v9 = uTextureID_mhp_yel; + else + v9 = uTextureID_mhp_grn; + if ( actor->sCurrentHP < actor->pMonsterInfo.uHP ) { v10 = bar_length / actor->pMonsterInfo.uHP * actor->sCurrentHP; - if ( actor->sCurrentHP <= (signed int)(signed __int64)(0.34 * (double)(signed int)actor->pMonsterInfo.uHP) ) - v9 = uTextureID_mhp_red; - else if ( actor->sCurrentHP <= (signed int)(signed __int64)((double)(signed int)actor->pMonsterInfo.uHP * 0.67) ) - v9 = uTextureID_mhp_yel; } + uX = window->uFrameX + (signed int)(window->uFrameWidth - bar_length) / 2; pRenderer->SetTextureClipRect(uX, window->uFrameY + 32, uX + bar_length, window->uFrameY + 52); @@ -107,58 +110,28 @@ //----- (00448518) -------------------------------------------------------- void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3) { - signed int v3; // eax@1 - int *v4; // edi@2 - signed int v5; // eax@6 - char *v6; // ecx@6 - char *v7; // eax@11 - ItemGen *v8; // ecx@15 - - v3 = 0; - if ( (signed int)uNumActors > 0 ) + for (int i = 0; i < uNumActors; i++) { - v4 = (int *)&pActors[0].sNPC_ID; - while ( *(short *)v4 != npc ) + if (pActors[uNumActors].sNPC_ID == npc) { - ++v3; - v4 += 209; - if ( v3 >= (signed int)uNumActors ) - return; - } - v5 = v3; - v6 = (char *)&pActors[v5].uCarriedItemID; - if ( a3 ) - { - if ( *(short *)v6 ) + Actor* currActor = &pActors[i]; + if ( a3 ) { - if ( pActors[v5].array_000234[0].uItemID ) - { - v7 = (char *)&pActors[v5].array_000234[1]; - if ( !*(int *)v7 ) - *(int *)v7 = item; - } - else - { - pActors[v5].array_000234[0].uItemID = item; - } + if ( currActor->uCarriedItemID == 0) + currActor->uCarriedItemID = item; + else if ( currActor->array_000234[0].uItemID == 0) + currActor->array_000234[0].uItemID = item; + else if ( currActor->array_000234[1].uItemID == 0) + currActor->array_000234[1].uItemID = item; } else { - *(short *)v6 = item; - } - } - else - { - if ( *(short *)v6 == item ) - { - *(short *)v6 = 0; - } - else - { - v8 = pActors[v5].array_000234; - if ( pActors[v5].array_000234[0].uItemID == item - || (v8 = &pActors[v5].array_000234[1], pActors[v5].array_000234[1].uItemID == item) ) - v8->Reset(); + if ( currActor->uCarriedItemID == item ) + currActor->uCarriedItemID = 0; + else if ( currActor->array_000234[0].uItemID == item ) + currActor->array_000234[0].Reset(); + else if ( currActor->array_000234[1].uItemID == item ) + currActor->array_000234[1].Reset(); } } }