changeset 130:1c471f3629fb

Party expressions update
author Nomad
date Mon, 11 Feb 2013 19:40:49 +0200
parents 48bea61a12a5
children 3ee983b8082b
files GUIWindow.cpp Game.cpp NPC.h Party.cpp Party.h Player.cpp Player.h PlayerFrameTable.h mm7_3.cpp mm7_4.cpp stru279.h
diffstat 11 files changed, 242 insertions(+), 292 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Mon Feb 11 18:22:21 2013 +0200
+++ b/GUIWindow.cpp	Mon Feb 11 19:40:49 2013 +0200
@@ -198,10 +198,10 @@
     v13 = pTexture_PlayerFaceDead;
   else
   {
-      uFramesetID = pPlayerFrameTable->GetFrameIdBy_field0(pPlayer->uExpressionID);
+      uFramesetID = pPlayerFrameTable->GetFrameIdByExpression(pPlayer->expression);
       if ( !uFramesetID )
         uFramesetID = 1;
-      if ( pPlayer->uExpressionID == 21 )
+      if ( pPlayer->expression == CHARACTER_EXPRESSION_21)
       {
         v15 = pPlayerFrameTable->GetFrameBy_y(
                 &pPlayer->field_1AA8,
@@ -1884,7 +1884,7 @@
                     pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x13u, 0, "", 0);
                 }
               }
-              v15 = (void *)v12->evtb;
+              v15 = (void *)v12->_anim_current_time;
               if ( v15 )
               {
                 if ( a4a < 4 )
@@ -1894,7 +1894,7 @@
                     pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x14u, 0, "", 0);
                 }
               }
-              v17 = (void *)v12->evtc;
+              v17 = (void *)v12->_anim_end_time;
               if ( v17 )
               {
                 if ( a4a < 4 )
--- a/Game.cpp	Mon Feb 11 18:22:21 2013 +0200
+++ b/Game.cpp	Mon Feb 11 19:40:49 2013 +0200
@@ -164,7 +164,7 @@
     GameUI_DrawTorchlightAndWizardEye();
   }
   GUI_UpdateWindows();
-  pParty->_4909F4();
+  pParty->UpdatePlayersAndHirelingsEmotions();
   ++stru_51076C.field_8;
   dword_5B5924 = 0;
   if (v4)
--- a/NPC.h	Mon Feb 11 18:22:21 2013 +0200
+++ b/NPC.h	Mon Feb 11 19:40:49 2013 +0200
@@ -28,8 +28,8 @@
   int joins;
   int field_24;
   unsigned int bDrawSomeAnim;
-  int evtb;
-  int evtc;
+  int _anim_current_time; //evtb
+  int _anim_end_time; //evtc
   int evtd;
   int evte;
   int evtf;
--- a/Party.cpp	Mon Feb 11 18:22:21 2013 +0200
+++ b/Party.cpp	Mon Feb 11 19:40:49 2013 +0200
@@ -1,3 +1,5 @@
+#include <assert.h>
+
 #include "Party.h"
 #include "MapInfo.h"
 #include "Time.h"
@@ -296,7 +298,13 @@
   signed int uNumPlayers; // [sp+18h] [bp-28h]@1
   ItemGen Dst; // [sp+1Ch] [bp-24h]@10
 
+
   pParty = this;
+
+  pHireling1Name[0] = 0;
+  pHireling2Name[0] = 0;
+  memset(pHirelings, 0, 2 * sizeof(*pHirelings));
+
   strcpy(this->pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]); //Zoltan
   pParty->pPlayers[0].field_1928 = 17;
   pParty->pPlayers[0].uFace = 17;
@@ -740,7 +748,7 @@
     for (uint j = 0; j < 24; ++j)
       pPlayers[i].pPlayerBuffs[j].Reset();
 
-    pPlayers[i].uExpressionID = 1;
+    pPlayers[i].expression = CHARACTER_EXPRESSION_1;
     pPlayers[i].uExpressionTimePassed = 0;
     pPlayers[i].uExpressionTimeLength = rand() % 256 + 128;
   }
@@ -864,239 +872,128 @@
 }
 
 //----- (004909F4) --------------------------------------------------------
-void Party::_4909F4()
+void Party::UpdatePlayersAndHirelingsEmotions()
 {
-  Player *v1; // esi@2
-  unsigned int v2; // eax@3
-  __int16 v3; // cx@5
+  //Player *v1; // esi@2
+  //unsigned int v2; // eax@3
+  //__int16 v3; // cx@5
   int v4; // edx@27
-  signed int v5; // eax@52
-  PlayerFrame *v6; // edx@53
-  NPCData *v7; // esi@60
-  signed int v8; // ebp@61
-  int v9; // ebx@62
-  unsigned int v10; // edi@62
-  signed int v11; // [sp+0h] [bp-4h]@2
+  //signed int v5; // eax@52
+  //PlayerFrame *v6; // edx@53
+  //NPCData *v7; // esi@60
+  //signed int v8; // ebp@61
+  //int v9; // ebx@62
+  //unsigned int v10; // edi@62
+  //signed int v11; // [sp+0h] [bp-4h]@2
+
+  if (dword_A75070 == stru_51076C.field_8)
+    return;
 
-  if ( dword_A75070 != stru_51076C.field_8 )
+  dword_A75070 = stru_51076C.field_8;
+  //v1 = this->pPlayers;//(char *)&this->pPlayers[0].uExpressionID;
+  for (int i = 0; i < 4; ++i)
   {
-    dword_A75070 = stru_51076C.field_8;
-	v1 = this->pPlayers;//(char *)&this->pPlayers[0].uExpressionID;
-    v11 = 4;
-    do
+    auto player = pPlayers + i;
+    player->uExpressionTimePassed += (unsigned short)pMiscTimer->uTimeElapsed;
+
+
+    auto condition = player->GetMajorConditionIdx();
+    if (condition == Player::Condition_Good || condition == Player::Condition_Zombie)
     {
-      v2 = v1->GetMajorConditionIdx();
-      if ( v2 == 18 || v2 == 17 )
+      if (player->uExpressionTimePassed < player->uExpressionTimeLength)
+        continue;
+        
+      player->uExpressionTimePassed = 0;
+      if (player->expression != 1 || rand() % 5)
       {
-        v1->uExpressionTimePassed += LOWORD(pMiscTimer->uTimeElapsed);
-        if ( (unsigned __int16)v1->uExpressionTimePassed >= v1->uExpressionTimeLength )
-        {
-          if ( v1->uExpressionID != 1 || rand() % 5 )
-          {
-            v1->uExpressionTimePassed = 0;
-            v1->uExpressionID = 1;
-            v1->uExpressionTimeLength = rand() % 256 + 32;
-          }
-          else
-          {
-            v4 = rand() % 100;
-            if ( v4 >= 25 )
-            {
-              if ( v4 >= 31 )
-              {
-                if ( v4 >= 37 )
-                {
-                  if ( v4 >= 43 )
-                  {
-                    if ( v4 >= 46 )
-                    {
-                      if ( v4 >= 52 )
-                      {
-                        if ( v4 >= 58 )
-                        {
-                          if ( v4 >= 64 )
-                          {
-                            if ( v4 >= 70 )
-                            {
-                              if ( v4 >= 76 )
-                              {
-                                if ( v4 >= 82 )
-                                {
-                                  if ( v4 >= 88 )
-                                    v1->uExpressionID = (v4 >= 94) + 29;
-                                  else
-                                    v1->uExpressionID = 57;
-                                }
-                                else
-                                {
-                                  v1->uExpressionID = 56;
-                                }
-                              }
-                              else
-                              {
-                                v1->uExpressionID = 55;
-                              }
-                            }
-                            else
-                            {
-                              v1->uExpressionID = 54;
-                            }
-                          }
-                          else
-                          {
-                            v1->uExpressionID = 20;
-                          }
-                        }
-                        else
-                        {
-                          v1->uExpressionID = 19;
-                        }
-                      }
-                      else
-                      {
-                        v1->uExpressionID = 18;
-                      }
-                    }
-                    else
-                    {
-                      v1->uExpressionID = 17;
-                    }
-                  }
-                  else
-                  {
-                    v1->uExpressionID = 16;
-                  }
-                }
-                else
-                {
-                  v1->uExpressionID = 15;
-                }
-              }
-              else
-              {
-                v1->uExpressionID = 14;
-              }
-            }
-            else
-            {
-              v1->uExpressionID = 13;
-            }
-            v5 = 0;
-            v1->uExpressionTimePassed = 0;
-			if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 )
-            {
-LABEL_56:
-              v5 = 0;
-            }
-            else
-            {
-              v6 = pPlayerFrameTable->pFrames;
-              while ( v6->uSequenceID != v1->uExpressionID )
-              {
-                ++v5;
-                ++v6;
-                if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames )
-                  goto LABEL_56;
-              }
-            }
-            v1->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[v5].uAnimLength;
-          }
-        }
+        player->expression = CHARACTER_EXPRESSION_1;
+        player->uExpressionTimeLength = rand() % 256 + 32;
       }
       else
       {
-       v3 = v1->uExpressionID;
-        if ( v1->uExpressionID != 34 && v3 != 35 && v3 != 36
-          || (signed int)(pMiscTimer->uTimeElapsed + v1->uExpressionTimePassed) >= v1->uExpressionTimeLength )
+        v4 = rand() % 100;
+        if (v4 < 25)      player->expression = CHARACTER_EXPRESSION_13;
+        else if (v4 < 31) player->expression = CHARACTER_EXPRESSION_14;
+        else if (v4 < 37) player->expression = CHARACTER_EXPRESSION_15;
+        else if (v4 < 43) player->expression = CHARACTER_EXPRESSION_16;
+        else if (v4 < 46) player->expression = CHARACTER_EXPRESSION_17;
+        else if (v4 < 52) player->expression = CHARACTER_EXPRESSION_18;
+        else if (v4 < 58) player->expression = CHARACTER_EXPRESSION_19;
+        else if (v4 < 64) player->expression = CHARACTER_EXPRESSION_20;
+        else if (v4 < 70) player->expression = CHARACTER_EXPRESSION_54;
+        else if (v4 < 76) player->expression = CHARACTER_EXPRESSION_55;
+        else if (v4 < 82) player->expression = CHARACTER_EXPRESSION_56;
+        else if (v4 < 88) player->expression = CHARACTER_EXPRESSION_57;
+        else if (v4 < 94) player->expression = CHARACTER_EXPRESSION_29;
+        else              player->expression = CHARACTER_EXPRESSION_30;
+      }
+
+      for (int j = 0; j < pPlayerFrameTable->uNumFrames; ++j)
+      {
+        auto frame = pPlayerFrameTable->pFrames + j;
+        if (frame->expression == player->expression)
         {
-          v1->uExpressionTimeLength = 0;
-          v1->uExpressionTimePassed = 0;
-          switch ( v2 )
-          {
-            case 0xEu:
-              v1->uExpressionID = 98;
-              break;
-            case 0xFu:
-              v1->uExpressionID = 12;
-              break;
-            case 0x10u:
-              v1->uExpressionID = 99;
-              break;
-            case 0u:
-              v1->uExpressionID = 2;
-              break;
-            case 1u:
-              v1->uExpressionID = 3;
-              break;
-            case 2u:
-              v1->uExpressionID = 4;
-              break;
-            case 3u:
-              v1->uExpressionID = 5;
-              break;
-            case 4u:
-              v1->uExpressionID = 6;
-              break;
-            case 5u:
-              v1->uExpressionID = 7;
-              break;
-            case 6u:
-            case 8u:
-            case 0xAu:
-              v1->uExpressionID = 8;
-              break;
-            case 7u:
-            case 9u:
-            case 0xBu:
-              v1->uExpressionID = 9;
-              break;
-            case 0xCu:
-              v1->uExpressionID = 10;
-              break;
-            case 0xDu:
-              v1->uExpressionID = 11;
-              break;
-            default:
-              break;
-          }
+          player->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[j].uAnimLength;
+          break;
         }
-        else
-        {
-          v1->uExpressionTimePassed += LOWORD(pMiscTimer->uTimeElapsed);        
-		}
       }
-      ++v1;
-      --v11;
     }
-    while ( v11 );
-	v7 = pParty->pHirelings;//(char *)&pParty->pHirelings[0].evtb;
-    do
+    else if (player->expression != 34 &&
+             player->expression != 35 &&
+             player->expression != 36 ||
+             player->uExpressionTimePassed >= player->uExpressionTimeLength)
     {
-	  v8 = v7->evtc;
-      if ( v8 )
+      player->uExpressionTimeLength = 0;
+      player->uExpressionTimePassed = 0;
+
+      switch (condition)
       {
-		v9 = v7->bDrawSomeAnim;
-		v10 = pMiscTimer->uTimeElapsed + v7->evtb;
-        if ( (signed int)v10 >= v8 )
-        {
-          v9 = 0;
-          v8 = 0;
-          v10 = 0;
-          memset(v7, 0, 0x4Cu);
-          pParty->field_709 = 0;
-          //sub_44A56A();Ritor1: it's temporarily
-          viewparams->bRedrawGameUI = 1;
-        }
-		v7->evtb = v10;
-		v7->evtc = v8;
-		v7->bDrawSomeAnim = v9;
+        case Player::Condition_Dead:        player->expression = CHARACTER_EXPRESSION_DEAD;      break;
+        case Player::Condition_Pertified:   player->expression = CHARACTER_EXPRESSION_PERTIFIED; break;
+        case Player::Condition_Eradicated:  player->expression = CHARACTER_EXPRESSION_ERADICATED; break;
+        case Player::Condition_Cursed:      player->expression = CHARACTER_EXPRESSION_CURSED; break;
+        case Player::Condition_Weak:        player->expression = CHARACTER_EXPRESSION_WEAK; break;
+        case Player::Condition_Sleep:       player->expression = CHARACTER_EXPRESSION_SLEEP; break;
+        case Player::Condition_Fear:        player->expression = CHARACTER_EXPRESSION_FEAR; break;
+        case Player::Condition_Drunk:       player->expression = CHARACTER_EXPRESSION_DRUNK; break;
+        case Player::Condition_Insane:      player->expression = CHARACTER_EXPRESSION_INSANE; break;
+        case Player::Condition_Poison1:
+        case Player::Condition_Poison2:
+        case Player::Condition_Poison3:     player->expression = CHARACTER_EXPRESSION_POISONED; break;
+        case Player::Condition_Disease1:
+        case Player::Condition_Disease2:
+        case Player::Condition_Disease3:    player->expression = CHARACTER_EXPRESSION_DISEASED; break;
+        case Player::Condition_Paralyzed:   player->expression = CHARACTER_EXPRESSION_PARALYZED; break;
+        case Player::Condition_Unconcious:  player->expression = CHARACTER_EXPRESSION_UNCONCIOUS; break;
+        default:
+          assert(false);
       }
-      ++v7;
     }
-	while ( v7 <= &pParty->pHirelings[1] );
+  }
+
+
+  for (int i = 0; i < 2; ++i)
+  {
+    auto hireling = pParty->pHirelings + i;
+    if (!hireling->_anim_end_time)
+      continue;
+
+    hireling->_anim_current_time += pMiscTimer->uTimeElapsed;
+    if (hireling->_anim_current_time >= hireling->_anim_end_time)
+    {
+      hireling->bDrawSomeAnim = false;
+      hireling->_anim_current_time = 0;
+      hireling->_anim_end_time = 0;
+
+      assert(sizeof(NPCData) == 0x4C);
+      memset(hireling, 0, sizeof(*hireling));
+
+      pParty->field_709 = 0;
+      sub_44A56A();//Ritor1: it's temporarily
+      viewparams->bRedrawGameUI = 1;
+    }
   }
 }
-// A75070: using guessed type int dword_A75070;
 
 //----- (00490D02) --------------------------------------------------------
 void Party::RestAndHeal()
@@ -1207,7 +1104,7 @@
 LABEL_30:
     if ( v2->pConditions[5] )
       v2->sMana = 0;
-    _4909F4();
+    UpdatePlayersAndHirelingsEmotions();
 LABEL_33:
     ++v15;
   }
--- a/Party.h	Mon Feb 11 18:22:21 2013 +0200
+++ b/Party.h	Mon Feb 11 19:40:49 2013 +0200
@@ -147,7 +147,7 @@
     field_0 = 25;
   }
 
-  void _4909F4();
+  void UpdatePlayersAndHirelingsEmotions();
   void RestAndHeal();
   unsigned int GetPartyFame();
   void CreateDefaultParty(char bGiveItems);
--- a/Player.cpp	Mon Feb 11 18:22:21 2013 +0200
+++ b/Player.cpp	Mon Feb 11 19:40:49 2013 +0200
@@ -669,24 +669,24 @@
       if ( pSoundList->pSounds[v17].pSoundData[0] )
         pPlayerNum = (sLastTrackLengthMS << 7) / 1000;
     }
-    LOWORD(v14) = pPlayer2->PlayEmotion(pExpression, pPlayerNum);
+    LOWORD(v14) = pPlayer2->PlayEmotion((CHARACTER_EXPRESSION_ID)pExpression, pPlayerNum);
   }
   return v14;
 }
 // 4948B1: using guessed type int var_1C[5];
 
 //----- (00494A25) --------------------------------------------------------
-__int16 Player::PlayEmotion(int a2, int a3)
+__int16 Player::PlayEmotion(CHARACTER_EXPRESSION_ID expr, int a3)
 {
   signed int v3; // eax@1
-  unsigned __int16 v4; // dx@1
+  CHARACTER_EXPRESSION_ID v4; // dx@1
   signed int v5; // edi@15
   PlayerFrame *v6; // esi@17
   signed int v7; // eax@20
 
-  LOWORD(v3) = this->uExpressionID;
-  v4 = a2;
-  if ( (short)v3 != 4 && (short)v3 != 12 || a2 != 58 )
+  LOWORD(v3) = this->expression;
+  v4 = expr;
+  if ( (short)v3 != 4 && (short)v3 != 12 || expr != 58 )
   {
     v3 = (unsigned __int16)v3;
     if ( (signed int)(unsigned __int16)v3 >= 2 )
@@ -702,7 +702,7 @@
           goto LABEL_15;
         }
 LABEL_12:
-        if ( a2 != 34 && a2 != 35 && a2 != 36 )
+        if ( expr != 34 && expr != 35 && expr != 36 )
           return v3;
         goto LABEL_15;
       }
@@ -723,7 +723,7 @@
     else
     {
       v6 = pPlayerFrameTable->pFrames;
-      while ( v6->uSequenceID != a2 )
+      while ( v6->expression != expr )
       {
         ++v5;
         ++v6;
@@ -732,11 +732,11 @@
       }
       v7 = v5;
     }
-    v4 = a2;
+    v4 = expr;
     LOWORD(v3) = 8 * pPlayerFrameTable->pFrames[v3].uAnimLength;
     this->uExpressionTimeLength = v3;
   }
-  this->uExpressionID = v4;
+  this->expression = v4;
   viewparams->bRedrawGameUI = 1;
   return v3;
 }
@@ -2279,7 +2279,7 @@
   _ranged_dmg_bonus = 0;
   field_1A97 = 0;
 
-  uExpressionID = 0;
+  expression = CHARACTER_EXPRESSION_INVALID;
   uExpressionTimePassed = 0;
   uExpressionTimeLength = 0;
 
--- a/Player.h	Mon Feb 11 18:22:21 2013 +0200
+++ b/Player.h	Mon Feb 11 19:40:49 2013 +0200
@@ -25,6 +25,8 @@
   CHARACTER_LUCK = 0x6,
 };
 
+
+
 /*  332 */
 enum CHARACTER_ATTRIBUTE_TYPE
 {
@@ -201,6 +203,65 @@
 
 
 
+enum CHARACTER_EXPRESSION_ID: unsigned __int16
+{
+  CHARACTER_EXPRESSION_INVALID = 0,
+  CHARACTER_EXPRESSION_1 = 1,
+  CHARACTER_EXPRESSION_CURSED = 2,
+  CHARACTER_EXPRESSION_WEAK = 3,
+  CHARACTER_EXPRESSION_SLEEP = 4,
+  CHARACTER_EXPRESSION_FEAR = 5,
+  CHARACTER_EXPRESSION_DRUNK = 6,
+  CHARACTER_EXPRESSION_INSANE = 7,
+  CHARACTER_EXPRESSION_POISONED = 8,
+  CHARACTER_EXPRESSION_DISEASED = 9,
+  CHARACTER_EXPRESSION_PARALYZED = 10,
+  CHARACTER_EXPRESSION_UNCONCIOUS = 11,
+  CHARACTER_EXPRESSION_PERTIFIED = 12,
+  CHARACTER_EXPRESSION_13 = 13,
+  CHARACTER_EXPRESSION_14 = 14,
+  CHARACTER_EXPRESSION_15 = 15,
+  CHARACTER_EXPRESSION_16 = 16,
+  CHARACTER_EXPRESSION_17 = 17,
+  CHARACTER_EXPRESSION_18 = 18,
+  CHARACTER_EXPRESSION_19 = 19,
+  CHARACTER_EXPRESSION_20 = 20,
+  CHARACTER_EXPRESSION_21 = 21,
+  CHARACTER_EXPRESSION_22 = 22,
+  CHARACTER_EXPRESSION_23 = 23,
+  CHARACTER_EXPRESSION_24 = 24,
+  CHARACTER_EXPRESSION_25 = 25,
+  CHARACTER_EXPRESSION_26 = 26,
+  CHARACTER_EXPRESSION_27 = 27,
+  CHARACTER_EXPRESSION_28 = 28,
+  CHARACTER_EXPRESSION_29 = 29,
+  CHARACTER_EXPRESSION_30 = 30,
+  CHARACTER_EXPRESSION_31 = 31,
+  CHARACTER_EXPRESSION_32 = 32,
+  CHARACTER_EXPRESSION_33 = 33,
+  CHARACTER_EXPRESSION_34 = 34,
+  CHARACTER_EXPRESSION_35 = 35,
+  CHARACTER_EXPRESSION_36 = 36,
+  CHARACTER_EXPRESSION_37 = 37,
+  CHARACTER_EXPRESSION_38 = 38,
+  CHARACTER_EXPRESSION_39 = 39,
+  
+  // ?
+
+  CHARACTER_EXPRESSION_46 = 46,
+
+  CHARACTER_EXPRESSION_54 = 54,
+  CHARACTER_EXPRESSION_55 = 55,
+  CHARACTER_EXPRESSION_56 = 56,
+  CHARACTER_EXPRESSION_57 = 57,
+
+  // ?
+
+  CHARACTER_EXPRESSION_DEAD = 98,
+  CHARACTER_EXPRESSION_ERADICATED = 99,
+};
+
+
 enum PLAYER_SEX: unsigned __int8
 {
   SEX_MALE = 0,
@@ -220,7 +281,7 @@
     Condition_Insane = 5,
     Condition_Poison1 = 6,
     Condition_Disease1 = 7,
-    Condition_Posion2 = 8,
+    Condition_Poison2 = 8,
     Condition_Disease2 = 9,
     Condition_Poison3 = 10,
     Condition_Disease3 = 11,
@@ -336,7 +397,7 @@
   int SetCondition(unsigned int uConditionIdx, int a3);
   int _49327B(unsigned int uClass, int a3);
   __int16 PlaySound(int a2, int a3);
-  __int16 PlayEmotion(int a2, int a3);
+  __int16 PlayEmotion(CHARACTER_EXPRESSION_ID expression, int a3);
   char _4160CA(int a2);
   unsigned int GetItemIDAtInventoryIndex(int *a2);
   int _4B6FF9();
@@ -499,7 +560,7 @@
   char _health_related;
   char uFullManaBonus;
   char _mana_related;
-  unsigned __int16 uExpressionID;
+  CHARACTER_EXPRESSION_ID expression;
   unsigned __int16 uExpressionTimePassed;
   unsigned __int16 uExpressionTimeLength;
   __int16 field_1AA2;
--- a/PlayerFrameTable.h	Mon Feb 11 18:22:21 2013 +0200
+++ b/PlayerFrameTable.h	Mon Feb 11 19:40:49 2013 +0200
@@ -1,12 +1,12 @@
 #pragma once
-
+#include "Player.h"
 
 
 /*   46 */
 #pragma pack(push, 1)
 struct PlayerFrame
 {
-  __int16 uSequenceID;
+  CHARACTER_EXPRESSION_ID expression;
   unsigned __int16 uTextureID;
   __int16 uAnimTime;
   __int16 uAnimLength;
@@ -23,7 +23,7 @@
     uNumFrames(0), pFrames(nullptr)
   {}
 
-  unsigned int GetFrameIdBy_field0(int uField0);
+  unsigned int GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression);
   PlayerFrame *GetFrameBy_x(unsigned int uFramesetID, unsigned int uFrameID);
   PlayerFrame *GetFrameBy_y(int *a2, int *a3, int a4);
   void ToFile();
--- a/mm7_3.cpp	Mon Feb 11 18:22:21 2013 +0200
+++ b/mm7_3.cpp	Mon Feb 11 19:40:49 2013 +0200
@@ -2734,7 +2734,7 @@
       do
       {
         if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(529, 8) )
-          (*v41)->PlayEmotion(46, 0);
+          (*v41)->PlayEmotion(CHARACTER_EXPRESSION_46, 0);
         ++v41;
       }
       while ( (signed int)v41 <= (signed int)&pPlayers[4] );
@@ -16307,13 +16307,13 @@
         v20 = v19 - 1;
         if ( !v20 )
         {
-          v23 = v0->evtb;
+          v23 = v0->_anim_current_time;
           goto LABEL_63;
         }
         v21 = v20 - 1;
         if ( !v21 )
         {
-          v23 = v0->evtc;
+          v23 = v0->_anim_end_time;
           goto LABEL_63;
         }
         v22 = v21 - 1;
@@ -17231,12 +17231,12 @@
                 }
                 else
                 {
-                  v33->evtc = v30;
+                  v33->_anim_end_time = v30;
                 }
               }
               else
               {
-                v33->evtb = v30;
+                v33->_anim_current_time = v30;
               }
             }
             else
@@ -17388,13 +17388,13 @@
 LABEL_108:
               v52 = &pParty->pPlayers[v53];
 LABEL_109:
-              v52->PlayEmotion(v113, v117);
+              v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117);
               goto LABEL_291;
             }
             v51 = pParty->pPlayers;
             do
             {
-              v51->PlayEmotion(_evt->v6, 0);
+              v51->PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
               ++v51;
             }
             while ( (signed int)v51 < (signed int)pParty->pHirelings );
@@ -19443,25 +19443,17 @@
 //----- (0044A56A) --------------------------------------------------------
 void __cdecl sub_44A56A()
 {
-  signed int v0; // edi@1
-  NPCData *v1; // esi@2
-
   pParty->field_70A = 0;
-  v0 = 0;
-  if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
-  {
-    v1 = pNPCStats->pNewNPCData;
-    do
-    {
-      if ( v1->uFlags & 0x80 && (!pParty->pHirelings[0].pName || strcmp(v1->pName, pParty->pHirelings[0].pName)) )
-      {
-        if ( !pParty->pHirelings[1].pName || strcmp(v1->pName, pParty->pHirelings[1].pName) )
-          ++pParty->field_70A;
-      }
-      ++v0;
-      ++v1;
-    }
-    while ( v0 < (signed int)pNPCStats->uNumNewNPCs );
+
+  for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i)
+  {
+    auto npc = pNPCStats->pNewNPCData + i;
+    if (npc->uFlags & 0x80 &&
+        (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName)))
+    {
+      if (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName))
+        ++pParty->field_70A;
+    }
   }
 }
 
--- a/mm7_4.cpp	Mon Feb 11 18:22:21 2013 +0200
+++ b/mm7_4.cpp	Mon Feb 11 19:40:49 2013 +0200
@@ -3128,7 +3128,7 @@
         v10 = (unsigned __int8)pTmpBuf[i];
         if ( pParty->pHirelings[v10].bDrawSomeAnim == 1 )
         {
-          uFrameID = pParty->pHirelings[v10].evtb;
+          uFrameID = pParty->pHirelings[v10]._anim_current_time;
           v11 = pHiredNPCsIconsOffsetsX[v9];
           v12 = pHiredNPCsIconsOffsetsY[v9];
           v17 = v11;
@@ -3236,14 +3236,14 @@
     }
       v7 = 0;
       for (uint j = 0; j < pPlayerFrameTable->uNumFrames; ++j)
-        if (pPlayerFrameTable->pFrames[j].uSequenceID == pPlayer->uExpressionID)
+        if (pPlayerFrameTable->pFrames[j].expression == pPlayer->expression)
         {
           v7 = j;
           break;
         }
     if ( v7 == 0 )
       v7 = 1;
-    if (pPlayer->uExpressionID == 21 )
+    if (pPlayer->expression == CHARACTER_EXPRESSION_21)
       pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->field_1AA8, &pPlayer->field_1AA4, pMiscTimer->uTimeElapsed);
     else
       pFrame = pPlayerFrameTable->GetFrameBy_x(v7, pPlayer->uExpressionTimePassed);
@@ -3968,7 +3968,7 @@
         }
         v13 = pPlayers[v12];
       }
-      v13->PlayEmotion(37, v58);
+      v13->PlayEmotion(CHARACTER_EXPRESSION_37, v58);
 LABEL_39:
       ++v12;
       if ( v12 > 4 )
@@ -4309,7 +4309,7 @@
 
 
 //----- (00494AED) --------------------------------------------------------
-unsigned int PlayerFrameTable::GetFrameIdBy_field0(int uField0)
+unsigned int PlayerFrameTable::GetFrameIdByExpression(CHARACTER_EXPRESSION_ID expression)
 {
   unsigned int _uNumFrames; // edx@1
   unsigned int result; // eax@1
@@ -4325,7 +4325,7 @@
   else
   {
     v4 = this->pFrames;
-    while ( v4->uSequenceID != uField0 )
+    while ( v4->expression != expression )
     {
       ++result;
       ++v4;
@@ -4492,7 +4492,7 @@
     {
       v8 = atoi(v24.pProperties[0]);
       v9 = v24.pProperties[1];
-      v2->pFrames[v2->uNumFrames].uSequenceID = v8;
+      v2->pFrames[v2->uNumFrames].expression = (CHARACTER_EXPRESSION_ID)v8;
       v10 = atoi(v9);
       v11 = v24.pProperties[2];
       v2->pFrames[v2->uNumFrames].uTextureID = v10;
@@ -9241,7 +9241,7 @@
     ++v6;
   }
   while ( v6 <= &pParty->pPlayers[3] );
-  pParty->_4909F4();
+  pParty->UpdatePlayersAndHirelingsEmotions();
 }
 // 507B94: using guessed type int dword_507B94;
 
@@ -9506,10 +9506,10 @@
           v3 = v2->bDrawSomeAnim;
           break;
         case 20:
-          v3 = v2->evtb;
+          v3 = v2->_anim_current_time;
           break;
         case 21:
-          v3 = v2->evtc;
+          v3 = v2->_anim_end_time;
           break;
         default:
           if ( a1 != 22 )
@@ -9630,14 +9630,14 @@
                 v2->bDrawSomeAnim = 0;
               break;
             case 20:
-              v9 = v2->evtb;
+              v9 = v2->_anim_current_time;
               if ( v9 >= 400 && v9 <= 416 )
-                v2->evtb = 0;
+                v2->_anim_current_time = 0;
               break;
             case 21:
-              v8 = v2->evtc;
+              v8 = v2->_anim_end_time;
               if ( v8 >= 400 && v8 <= 416 )
-                v2->evtc = 0;
+                v2->_anim_end_time = 0;
               break;
             case 22:
               v7 = v2->evtd;
@@ -10321,7 +10321,7 @@
           v20 = v19 - 1;
           if ( !v20 )
           {
-			v15 = (char *)pNPCTopics[v58->evtb-1].pTopic;//(&dword_721660)[8 * v58->evtb];
+            v15 = (char *)pNPCTopics[v58->_anim_current_time-1].pTopic;//(&dword_721660)[8 * v58->evtb];
             if ( !v15 )
             {
               v16->uControlParam = 0;
@@ -10337,7 +10337,7 @@
           v21 = v20 - 1;
           if ( !v21 )
           {
-            v23 = v58->evtc;
+            v23 = v58->_anim_end_time;
             goto LABEL_33;
           }
           v22 = v21 - 1;
@@ -11417,7 +11417,7 @@
               0);
         }
       }
-      v7 = (void *)v17->evtb;
+      v7 = (void *)v17->_anim_current_time;
       if ( v7 )
       {
         if ( v1 < 4 )
@@ -11438,7 +11438,7 @@
               0);
         }
       }
-      v9 = (void *)v17->evtc;
+      v9 = (void *)v17->_anim_end_time;
       if ( v9 )
       {
         if ( v1 < 4 )
@@ -12837,12 +12837,12 @@
   }
   if ( v3 == 20 )
   {
-    v4 = v2->evtb;
+    v4 = v2->_anim_current_time;
     goto LABEL_74;
   }
   if ( v3 == 21 )
   {
-    v4 = v2->evtc;
+    v4 = v2->_anim_end_time;
 LABEL_74:
     if ( v4 < 200 || v4 > 310 )
     {
--- a/stru279.h	Mon Feb 11 18:22:21 2013 +0200
+++ b/stru279.h	Mon Feb 11 19:40:49 2013 +0200
@@ -8,12 +8,12 @@
   //----- (0043B506) --------------------------------------------------------
   stru279()
   {
-  this->field_4 = 0;
-  this->field_8 = 0;
-  this->field_C = 0;
-  this->field_10 = 0;
-  this->field_14 = 0;
-  this->registry_debug_flags = 0;
+    this->field_4 = 0;
+    this->field_8 = 0;
+    this->field_C = 0;
+    this->field_10 = 0;
+    this->field_14 = 0;
+    this->registry_debug_flags = 0;
   }