changeset 2457:17ac6a47f8fb

speed actors
author Ritor1
date Sat, 26 Jul 2014 10:42:29 +0600
parents 83174b7b3763
children d53da932f594
files Actor.cpp Keyboard.cpp
diffstat 2 files changed, 14 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Sat Jul 26 08:39:35 2014 +0600
+++ b/Actor.cpp	Sat Jul 26 10:42:29 2014 +0600
@@ -1130,7 +1130,6 @@
 //----- (00403F58) --------------------------------------------------------
 void Actor::AI_StandOrBored(unsigned int uActorID, signed int uObjID, int uActionLength, AIDirection *a4)
 {
-  //движется или стоит определяется случайно(1 - движется, 0 - стоит)
   if (rand() % 2)//0 or 1
     AI_Bored(uActorID, uObjID, a4);
   else
@@ -1179,7 +1178,6 @@
 //----- (00403C6C) --------------------------------------------------------
 void Actor::AI_MeleeAttack(unsigned int uActorID, signed int sTargetPid, struct AIDirection *arg0)
 {
-  //Actor *v3; // ebx@1
   int16_t v6; // esi@6
   int16_t v7; // edi@6
   signed int v8; // eax@7
@@ -1192,7 +1190,6 @@
 
   assert(uActorID < uNumActors);
 
-  //v3 = &pActors[uActorID];
   if ( pActors[uActorID].pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY && pActors[uActorID].pMonsterInfo.uAIType == 1 )
   {
     Actor::AI_Stand(uActorID, sTargetPid, 0, arg0);
@@ -4569,6 +4566,8 @@
   int v1; // eax@4
   int v9; // edi@10
   int v13; // edx@24
+  int v15; // ebx@26
+  unsigned int v17; // esi@27
   int v18; // ecx@31
   signed int v19; // edi@31
   signed int v25; // eax@40
@@ -4624,12 +4623,14 @@
     {
       for ( uint j = 1; j < v45; ++j )
       {
+        v15 = ai_near_actors_distances[v13];
         if ( ai_near_actors_distances[v13] > ai_near_actors_distances[j] )
         {
+          v17 = ai_near_actors_ids[v13];
           ai_near_actors_ids[v13] = ai_near_actors_ids[j];
-          ai_near_actors_ids[j] = ai_near_actors_ids[v13];
+          ai_near_actors_ids[j] = v17;
           ai_near_actors_distances[v13] = ai_near_actors_distances[j];
-          ai_near_actors_distances[j] = ai_near_actors_distances[v13];
+          ai_near_actors_distances[j] = v15;
         }
       }
       ++v13;
--- a/Keyboard.cpp	Sat Jul 26 08:39:35 2014 +0600
+++ b/Keyboard.cpp	Sat Jul 26 10:42:29 2014 +0600
@@ -30,7 +30,8 @@
 struct KeyboardActionMapping *pKeyActionMap;
 
 
-class CKeyListElement{
+class CKeyListElement
+{
 public:
   std::string m_keyName;
   unsigned char m_keyDefaultCode;
@@ -152,8 +153,6 @@
 //----- (00459E3F) --------------------------------------------------------
 void KeyboardActionMapping::ResetKeys()
 {
-  //Функция GetAsyncKeyState определяет, является ли клавиша отпущенной или нажатой во время вызова функции
-  //и была ли клавиша нажата после предыдущего вызова GetAsyncKeyState.
   for (uint i = 0; i < 30; ++i)
     pToggleTypes[i] = (KeyToggleType)GetAsyncKeyState(pVirtualKeyCodesMapping[i]);
 }
@@ -161,17 +160,14 @@
 //----- (00459E5A) --------------------------------------------------------
 void KeyboardActionMapping::EnterText(int a2, int max_string_len, GUIWindow *pWindow)
 {
-  KeyboardActionMapping *v4; // esi@1
-
-  v4 = this;
   memset(this->pPressedKeysBuffer, 0, 0x101u);
-  v4->uNumKeysPressed = 0;
+  this->uNumKeysPressed = 0;
   if ( a2 )
-    v4->field_204 = 2;
+    this->field_204 = 2;
   else
-    v4->field_204 = 1;
-  v4->max_input_string_len = max_string_len;
-  v4->pWindow = pWindow;
+    this->field_204 = 1;
+  this->max_input_string_len = max_string_len;
+  this->pWindow = pWindow;
   pWindow->receives_keyboard_input_2 = WINDOW_INPUT_IN_PROGRESS;
 }
 
@@ -200,13 +196,9 @@
       }
     }
     else if ( a2 == VK_RETURN )
-    {
       pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CONFIRMED);
-    }
     else if ( a2 == VK_ESCAPE )
-    {
       pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
-    }
     else if (this->uNumKeysPressed < this->max_input_string_len)
     {
       if ( pKeyActionMap->field_204 == 1 )
@@ -239,8 +231,6 @@
 }
 // 506E68: using guessed type int uGameMenuUI_CurentlySelectedKeyIdx;
 
-
-
 //----- (00459FFC) --------------------------------------------------------
 void KeyboardActionMapping::ReadMappings()
 {
@@ -255,13 +245,9 @@
 
     ReadWindowsRegistryString(keyName, str, 32, "DEFAULT");
     if ( strcmp(str, "DEFAULT") && ( TranslateKeyNameToKeyCode(str) != -1) )
-    {
       pVirtualKeyCodesMapping[commandId] = TranslateKeyNameToKeyCode(str);
-    }
     else
-    {
       pVirtualKeyCodesMapping[commandId] = commandDefaultKeyCode;
-    }
     pToggleTypes[commandId] = toggType;
   }
 
@@ -353,28 +339,6 @@
 //----- (0046A14B) --------------------------------------------------------
 void OnPressSpace()
 {
-  //SHORT v0; // ax@2
-  /*int *v1; // eax@2
-  char *v2; // ebx@5
-  unsigned int v3; // esi@5
-  signed int v4; // edi@7
-  unsigned int v5; // edx@7
-  int v6; // ecx@8
-  int v7; // eax@8
-  int v8; // ecx@17
-  int *v9; // esi@22
-  signed int v10; // ebx@22
-  int i; // edi@23
-  int v12; // edx@24
-  int v13; // ecx@24
-  int j; // esi@28
-  int v16; // [sp+4h] [bp-1Ch]@0
-  char *v17; // [sp+8h] [bp-18h]@5
-  unsigned int v18; // [sp+Ch] [bp-14h]@5
-  int v19; // [sp+10h] [bp-10h]@8
-  int *v20; // [sp+14h] [bp-Ch]@5
-  int *v21; // [sp+18h] [bp-8h]@7
-  int v22; // [sp+1Ch] [bp-4h]@4*/
 
   //if ( pRenderer->pRenderD3D )
   {
@@ -497,14 +461,10 @@
 void Keyboard::ProcessInputActions()
 {
   char v4; // al@9
-  //char v8; // bl@100
   unsigned __int16 v9; // ax@102
   int spell_price; // eax@103
-//  char v14; // al@159
-//  unsigned int v15; // eax@168
   PartyAction partyAction; // [sp-14h] [bp-1Ch]@20
   InputAction inputAction; // [sp+0h] [bp-8h]@7
-  //int v24; // [sp+4h] [bp-4h]@87
 
   pGame->pKeyboardInstance->EnterCriticalSection();
   Keyboard* pKeyboard = pGame->pKeyboardInstance;
@@ -847,8 +807,7 @@
             pPartyActionQueue->Add(partyAction);
             break;
           case INPUT_FlyDown:
-            if ( !pCurrentScreen
-              && !pEventTimer->bPaused )
+            if ( !pCurrentScreen && !pEventTimer->bPaused )
             {
               partyAction = (PartyAction)14;
               pPartyActionQueue->Add(partyAction);