diff Game.cpp @ 2198:d9caf2b3d8d5

draw FlyAction and WaterWalk icons
author Ritor1
date Sun, 02 Feb 2014 00:10:40 +0600
parents 42c8807225a2
children 44d956d4f838
line wrap: on
line diff
--- a/Game.cpp	Fri Jan 31 17:30:36 2014 +0600
+++ b/Game.cpp	Sun Feb 02 00:10:40 2014 +0600
@@ -3731,53 +3731,50 @@
           byte_506550 = 0;
           continue;
         case UIMSG_SpellBook_PressTab://перелистывание страниц клавишей Tab
+        {
           if ( !uActiveCharacter )
             continue;
-          pNPCData4 = 0;
+          int skill_count = 0;
           uAction = 0;
           for ( uint i = 0; i < 9; i++ )
           {
             if ( pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_FIRE + i] )
             {
               if ( pPlayers[uActiveCharacter]->lastOpenedSpellbookPage == i )
-                uAction = (int)pNPCData4;
-              v102 = (int)pNPCData4;
-              pNPCData4 = (NPCData *)((char *)pNPCData4 + 1);
-              v217[v102] = i;
+                uAction = skill_count;
+              v217[skill_count++] = i;
             }
           }
-          if ( !pNPCData4 )
-          {
-            v127 = rand() % 2 + 204;
-            pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0);
-            continue;
-          }
-          if ( GetAsyncKeyState(16) )
-          {
-            --uAction;
-            if ( uAction < 0 )
-              uAction = (int)((char *)pNPCData4 - 1);
-          }
+          if ( !skill_count )//нет скиллов
+            pAudioPlayer->PlaySound((SoundID)(rand() % 2 + 204), 0, 0, -1, 0, 0, 0, 0);
           else
           {
-            ++uAction;
-            if ( uAction >= (signed int)pNPCData4 )
-              uAction = 0;
+            if ( GetAsyncKeyState(16) )
+            {
+              --uAction;
+              if ( uAction < 0 )
+                uAction = skill_count - 1;
+            }
+            else
+            {
+              ++uAction;
+              if ( uAction >= skill_count )
+                uAction = 0;
+            }
+            OnCloseSpellBookPage();
+            pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]);
+            pGUIWindow_CurrentMenu->OpenSpellBook();
+            pAudioPlayer->PlaySound((SoundID)(rand() % 2 + 204), 0, 0, -1, 0, 0, 0, 0);
           }
-          OnCloseSpellBookPage();
-          pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]);
-          pGUIWindow_CurrentMenu->OpenSpellBook();
-          v127 = rand() % 2 + 204;
-          pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0);
           continue;
+        }
         case UIMSG_OpenSpellbookPage:
           if ( pTurnEngine->turn_stage == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage )
             continue;
           OnCloseSpellBookPage();
           pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam;
           pGUIWindow_CurrentMenu->OpenSpellBook();
-          v127 = rand() % 2 + 204;
-          pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0);
+          pAudioPlayer->PlaySound((SoundID)(rand() % 2 + 204), 0, 0, -1, 0, 0, 0, 0);
           continue;
         case UIMSG_SelectSpell:
         {