diff Actor.cpp @ 1803:9f93b5700e2d

Merge
author Nomad
date Mon, 07 Oct 2013 11:55:35 +0200
parents 2051dfa0a00c
children 0f1543750bf8
line wrap: on
line diff
--- a/Actor.cpp	Mon Oct 07 11:52:33 2013 +0200
+++ b/Actor.cpp	Mon Oct 07 11:55:35 2013 +0200
@@ -46,55 +46,40 @@
 
 
 //----- (0041AF52) --------------------------------------------------------
-void Actor::DrawHealthBar(Actor *a1, GUIWindow *a2)
+void Actor::DrawHealthBar(Actor *actor, GUIWindow *window)
 {
-  unsigned int v2; // eax@1
-  GUIWindow *v3; // edi@1
-  unsigned int v4; // esi@1
-  signed int v5; // ebx@4
-  double v6; // st7@5
-  unsigned int v7; // eax@6
-  unsigned int v8; // ebx@10
+  unsigned int bar_length; // esi@1
+  unsigned int uX; // ebx@10
   unsigned int v9; // [sp+14h] [bp-Ch]@4
   unsigned int v10; // [sp+1Ch] [bp-4h]@4
 
-  v2 = a1->pMonsterInfo.uHP;
-  v3 = a2;
-  v4 = 25;
-  if ( (signed int)v2 > 25 )
+  bar_length = 25;
+  if ( actor->pMonsterInfo.uHP > 25 )
   {
-    v4 = 200;
-    if ( (signed int)v2 < 200 )
-      v4 = a1->pMonsterInfo.uHP;
+    bar_length = 200;
+    if ( actor->pMonsterInfo.uHP < 200 )
+      bar_length = actor->pMonsterInfo.uHP;
   }
-  v5 = a1->sCurrentHP;
-  v10 = v4;
+  v10 = bar_length;
   v9 = uTextureID_mhp_grn;
-  if ( v5 < (signed int)v2 )
+  if ( actor->sCurrentHP < actor->pMonsterInfo.uHP )
   {
-    v6 = (double)(signed int)v2;
-    v10 = (signed __int64)((double)(signed int)v4 / (double)(signed int)v2 * (double)a1->sCurrentHP);
-    if ( v5 <= (signed int)(signed __int64)(0.34 * v6) )
-    {
-      v7 = uTextureID_mhp_red;
-      v9 = v7;
-    }
-    else if ( v5 <= (signed int)(signed __int64)(v6 * 0.67) )
-    {
-      v7 = uTextureID_mhp_yel;
-      v9 = v7;
-    }
+    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;
   }
-  v8 = a2->uFrameX + (signed int)(a2->uFrameWidth - v4) / 2;
+  uX = window->uFrameX + (signed int)(window->uFrameWidth - bar_length) / 2;
 
-  pRenderer->SetTextureClipRect(v8, a2->uFrameY + 32, v8 + v4, a2->uFrameY + 52);
-  pRenderer->DrawTextureIndexed(v8, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_bd));
-  pRenderer->SetTextureClipRect(v8, v3->uFrameY + 32, v8 + v10, v3->uFrameY + 52);
-  pRenderer->DrawTextureIndexed(v8, v3->uFrameY + 34, pIcons_LOD->GetTexture(v9));
+  pRenderer->SetTextureClipRect(uX, window->uFrameY + 32, uX + bar_length, window->uFrameY + 52);
+  pRenderer->DrawTextureIndexed(uX, window->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_bd));
+  pRenderer->SetTextureClipRect(uX, window->uFrameY + 32, uX + v10, window->uFrameY + 52);
+  pRenderer->DrawTextureIndexed(uX, window->uFrameY + 34, pIcons_LOD->GetTexture(v9));
 
   pRenderer->ResetTextureClipRect();
-  pRenderer->DrawTextureIndexed(v8 - 5, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capl));
-  pRenderer->DrawTextureIndexed(v8 + v4, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capr));
+  pRenderer->DrawTextureIndexed(uX - 5, window->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capl));
+  pRenderer->DrawTextureIndexed(uX + bar_length, window->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capr));
 }
 
 //----- (00448A40) --------------------------------------------------------
@@ -227,7 +212,6 @@
   }
 }
 
-  
 //----- (0040894B) --------------------------------------------------------
 bool Actor::CanAct()
 {
@@ -1910,16 +1894,13 @@
 //----- (00403E61) --------------------------------------------------------
 void __fastcall Actor::StandAwhile(unsigned int uActorID)
 {
-  Actor *v1; // esi@1
-
-  v1 = &pActors[uActorID];
-  v1->uCurrentActionLength = rand() % 128 + 128;
-  v1->uCurrentActionTime = 0;
-  v1->uAIState = Standing;
-  v1->vVelocity.z = 0;
-  v1->vVelocity.y = 0;
-  v1->vVelocity.x = 0;
-  v1->UpdateAnimation();
+  pActors[uActorID].uCurrentActionLength = rand() % 128 + 128;
+  pActors[uActorID].uCurrentActionTime = 0;
+  pActors[uActorID].uAIState = Standing;
+  pActors[uActorID].vVelocity.z = 0;
+  pActors[uActorID].vVelocity.y = 0;
+  pActors[uActorID].vVelocity.x = 0;
+  pActors[uActorID].UpdateAnimation();
 }
 
 //----- (00403C6C) --------------------------------------------------------