diff mm7_5.cpp @ 1401:3161094869e0

Слияние
author Ritor1
date Fri, 19 Jul 2013 12:50:44 +0600
parents eb02a65e5c82
children a519a6a412d0
line wrap: on
line diff
--- a/mm7_5.cpp	Fri Jul 19 12:50:29 2013 +0600
+++ b/mm7_5.cpp	Fri Jul 19 12:50:44 2013 +0600
@@ -16,7 +16,6 @@
 #include "Mouse.h"
 #include "Keyboard.h"
 #include "GammaControl.h"
-#include "stru11.h"
 #include "mm7_data.h"
 #include "FactionTable.h"
 #include "Vis.h"
@@ -1246,7 +1245,7 @@
                     case SCREEN_REST://close rest screen
                       if ( dword_506F14 )
                       {
-                        Rest(_506F18_num_hours_to_sleep);
+                        Rest(_506F18_num_minutes_to_sleep);
                         pParty->pPlayers[3].pConditions[2] = 0i64;
                         pParty->pPlayers[2].pConditions[2] = 0i64;
                         pParty->pPlayers[1].pConditions[2] = 0i64;
@@ -1258,7 +1257,7 @@
                       pTexture_RestUI_CurrentSkyFrame = 0;
                       pIcons_LOD->SyncLoadedFilesCount();
                       pIcons_LOD->_4114F2();
-                      _506F18_num_hours_to_sleep = 0;
+                      _506F18_num_minutes_to_sleep = 0;
                       dword_506F14 = 0;
                       dword_507B94 = 1;
                       if ( pGUIWindow_Settings )
@@ -2464,7 +2463,7 @@
           GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2,
             (int)pButton_RestUI_Wait5Minutes, pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes"
           dword_506F14 = 1;
-          _506F18_num_hours_to_sleep = 5;
+          _506F18_num_minutes_to_sleep = 5;
           continue;
         case UIMSG_Wait1Hour:
           if ( dword_506F14 == 2 )
@@ -2476,15 +2475,15 @@
           GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2,
             (int)pButton_RestUI_Wait1Hour, pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour"
           dword_506F14 = 1;
-          _506F18_num_hours_to_sleep = 60;
+          _506F18_num_minutes_to_sleep = 60;
           continue;
         case UIMSG_RentRoom:
           dword_506F14 = 2;
           RestUI_Load();
           v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute;
-          _506F18_num_hours_to_sleep = v86;
-          if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 )
-            _506F18_num_hours_to_sleep = v86 + 720;
+          _506F18_num_minutes_to_sleep = v86;
+          if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 ) // 107 = Emerald Isle tavern
+            _506F18_num_minutes_to_sleep = v86 + 12 * 60;
           dword_506F14 = 2;
           pParty->RestAndHeal();
           pParty->days_played_without_rest = 0;
@@ -2578,7 +2577,7 @@
                 HIDWORD(pParty->pPlayers[pPlayerNum].pConditions[2]) = 0;
                 v95 = rand();
                 Rest(v95 % 6 + 60);
-                _506F18_num_hours_to_sleep = 0;
+                _506F18_num_minutes_to_sleep = 0;
                 dword_506F14 = 0;
                 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
                 {
@@ -2594,7 +2593,7 @@
               }
             }
             Party::TakeFood(uRestUI_FoodRequiredToRest);
-            _506F18_num_hours_to_sleep = 480;
+            _506F18_num_minutes_to_sleep = 480;
             dword_506F14 = 2;
             pParty->RestAndHeal();
             pParty->days_played_without_rest = 0;
@@ -2615,7 +2614,7 @@
             (int)pButton_RestUI_WaitUntilDawn, pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn"
           v97 = _494820_training_time(pParty->uCurrentHour);
           dword_506F14 = 1;
-          _506F18_num_hours_to_sleep = 60 * v97 - pParty->uCurrentMinute;
+          _506F18_num_minutes_to_sleep = 60 * v97 - pParty->uCurrentMinute;
           continue;
         case UIMSG_HintSelectRemoveQuickSpellBtn:
           if ( quick_spell_at_page && byte_506550 )
@@ -2667,7 +2666,7 @@
           }
           v99 = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage;
           pPlayers[uActiveCharacter]->uQuickSpell = v99;
-          stru_A750F8[uActiveCharacter + 3]._494836(v99, uActiveCharacter);
+          stru_AA1058[uActiveCharacter - 1]._494836(v99, uActiveCharacter);
           if ( uActiveCharacter )
             pPlayer10->PlaySound(SPEECH_12, 0);
           byte_506550 = 0;
@@ -3626,444 +3625,8 @@
   this->z = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->z;
 }
 
-//----- (00438526) --------------------------------------------------------
-stru11::stru11()
-{
-  stru11 *v1; // esi@1
-  signed int v2; // eax@1
-  char *v3; // edx@1
-
-  v1 = this;
-  v2 = 0;
-  this->cpuid_00000000_eax_numops = 0;
-  this->cpuid_00000001_eax = 0;
-  this->cpuid_00000001_edx = 0;
-  this->field_38 = 0;
-  this->field_3C = 0;
-  this->cpuid_80000000_edx = 0;
-  this->cpuid_80000001_eax = 0;
-  this->cpuid_80000001_edx = 0;
-  this->cpuid_80000005_ebx = 0;
-  this->cpuid_80000005_ecx = 0;
-  this->cpuid_80000005_edx = 0;
-  this->cpuid_80000006_ecx = 0;
-  this->field_AC = 0;
-  this->uProcessorManufacturer = 0;
-  LOBYTE(this->cpuid_80000002_registers2[0]) = 0;
-  v3 = (char *)&this->cpuid_00000002_eax;
-  do
-  {
-    if ( v2 < 3 )
-      *((int *)v3 - 9) = 0;
-    if ( v2 < 4 )
-      *(int *)v3 = 0;
-    if ( v2 < 12 )
-      *((int *)v3 + 17) = 0;
-    if ( v2 < 13 )
-      this->pCPUString[v2] = 0;
-    if ( v2 < 30 )
-      *((char *)this->field_40 + v2) = 0;
-    *((char *)&this->cpuid_80000002_registers2[0] + v2++ + 1) = 0;
-    v3 += 4;
-  }
-  while ( v2 < 48 );
-  CheckCPU();
-}
-
-//----- (004385B5) --------------------------------------------------------
-void stru11::CheckCPU()
-{
-  LOG_DECOMPILATION_WARNING();
-  /*
-  int v5; // [sp-4h] [bp-10h]@0
-  signed int v6; // [sp+4h] [bp-8h]@1
-  signed int v7; // [sp+8h] [bp-4h]@1
-
-  _CF = 0;
-  _OF = 0;
-  _ZF = 1;
-  _SF = 0;
-  v7 = 0;
-  __asm { pushf }
-  v6 = 3;
-  if ( v5 != (v5 ^ 0x40000) )
-  {
-    __asm { popf }
-    v6 = 4;
-    __asm { pushf }
-    if ( v5 != (v5 ^ 0x200000) )
-    {
-      v7 = 1;
-      v6 = 0;
-    }
-  }
-  if ( v6 == 3 )
-  {
-    this->field_AC = 1;
-  }
-  else
-  {
-    if ( v6 == 4 )
-    {
-      this->field_AC = 2;
-    }
-    else
-    {
-      if ( v7 )
-      {
-        this->field_AC = 2;
-        RunCPUID();
-      }
-      else
-      {
-        this->field_AC = 0;
-      }
-    }
-  }*/
-}
-
-//----- (00438659) --------------------------------------------------------
-void stru11::RunCPUID()
-{
-  __debugbreak();
-  /*stru11 *v6; // esi@1
-  unsigned int uNumOps; // edi@1
-  int uNumExtOps; // edi@16
-  char pCyrixString[16]; // [sp+Ch] [bp-60h]@1
-  char pCentaurString[16]; // [sp+1Ch] [bp-50h]@1
-  char pAMDString[16]; // [sp+2Ch] [bp-40h]@1
-  char pIntelString[16]; // [sp+3Ch] [bp-30h]@1
-  char pCPUString[16]; // [sp+4Ch] [bp-20h]@1
-  stru11 *thisa; // [sp+5Ch] [bp-10h]@1
-  char *v35; // [sp+60h] [bp-Ch]@1
-  int v36; // [sp+64h] [bp-8h]@1
-  int v37; // [sp+68h] [bp-4h]@1
-
-  thisa = this;
-  *(int *)pIntelString = *(int *)"GenuineIntel";
-  *(int *)&pIntelString[4] = *(int *)"ineIntel";
-  *(int *)&pIntelString[8] = *(int *)"ntel";
-  pIntelString[12] = aGenuineintel[12];
-  *(int *)pAMDString = *(int *)"AuthenticAMD";
-  *(int *)&pAMDString[4] = *(int *)"enticAMD";
-  *(int *)&pAMDString[8] = *(int *)"cAMD";
-  pAMDString[12] = aAuthenticamd[12];
-  *(int *)pCyrixString = *(int *)"CyrixInstead";
-  *(int *)&pCyrixString[4] = *(int *)"xInstead";
-  *(int *)&pCyrixString[8] = *(int *)"tead";
-  pCyrixString[12] = aCyrixinstead[12];
-  *(int *)pCentaurString = *(int *)"CentaurHauls";
-  *(int *)&pCentaurString[4] = *(int *)"aurHauls";
-  *(int *)&pCentaurString[8] = *(int *)"auls";
-  v37 = 0;
-  v36 = 0;
-  pCentaurString[12] = aCentaurhauls[12];
-  v35 = pCPUString;
-  pCPUString[12] = 0;
-  _EAX = 0;
-  __asm { cpuid }
-  v37 = _EAX;
-  *(int *)pCPUString = _EBX;
-  *(int *)&pCPUString[4] = _EDX;
-  *(int *)&pCPUString[8] = _ECX;
-  v6 = thisa;
-  uNumOps = _EAX;
-  thisa->cpuid_00000000_ebx_vendorstr1 = _EBX;
-  v6->cpuid_00000000_edx_vendorstr2 = *(int *)&pCPUString[4];
-  v6->cpuid_00000000_ecx_vendorstr3 = *(int *)&pCPUString[8];
-  v6->cpuid_00000000_eax_numops = _EAX;
-  strcpy(v6->pCPUString, pCPUString);
-  if ( strcmp(pIntelString, pCPUString) )
-  {
-    if ( strcmp(pAMDString, pCPUString) )
-    {
-      if ( strcmp(pCyrixString, pCPUString) )
-      {
-        if ( strcmp(pCentaurString, pCPUString) )
-          v6->uProcessorManufacturer = 0;
-        else
-          v6->uProcessorManufacturer = 4;
-      }
-      else
-      {
-        v6->uProcessorManufacturer = 3;
-      }
-    }
-    else
-    {
-      v6->uProcessorManufacturer = 2;
-    }
-  }
-  else
-  {
-    v6->uProcessorManufacturer = 1;
-  }
-  if ( uNumOps >= 1 )
-    RunCPUID_op1();
-  if ( uNumOps >= 2 )
-    RunCPUID_op2();
-  _EAX = 0x80000000u;
-  __asm { cpuid }
-  if ( !(_EAX & 0x80000000) )
-    _EAX = 0x80000000u;
-  v36 = _EAX;
-  v6->cpuid_80000000_edx = _EAX;
-  uNumExtOps = _EAX ^ 0x80000000;
-  if ( (_EAX ^ 0x80000000u) >= 1 )
-  {
-    _EAX = 0x80000001u;
-    __asm { cpuid }
-    thisa = (stru11 *)_EAX;
-    v35 = (char *)_EDX;
-    v6->cpuid_80000001_eax = _EAX;
-    v6->cpuid_80000001_edx = (int)v35;
-  }
-  if ( (unsigned int)uNumExtOps >= 4 )
-    RunCPUID_ext2_3_4();
-  if ( (unsigned int)uNumExtOps >= 5 )
-  {
-    _EAX = 0x80000005u;
-    __asm { cpuid }
-    thisa = (stru11 *)_EBX;
-    v35 = (char *)_ECX;
-    v36 = _EDX;
-    v6->cpuid_80000005_ebx = _EBX;
-    v6->cpuid_80000005_ecx = (int)v35;
-    v6->cpuid_80000005_edx = v36;
-  }
-  if ( (unsigned int)uNumExtOps >= 6 )
-  {
-    _EAX = 0x80000006u;
-    __asm { cpuid }
-    v6->cpuid_80000006_ecx = _ECX;
-  }*/
-}
-
-//----- (00438821) --------------------------------------------------------
-void stru11::RunCPUID_op1()
-{
-  __debugbreak();
-  /*stru11 *v1; // esi@1
-  unsigned int v7; // ecx@1
-  int v8; // eax@3
-  int v9; // eax@10
-  signed int v10; // eax@11
-  int v11; // ecx@11
-  int v12; // eax@15
-  signed int v13; // eax@19
-  int v14; // ecx@19
-  signed int v15; // eax@25
-  int v16; // ecx@25
-  signed int v17; // eax@34
-  int v18; // ecx@34
-
-  v1 = this;
-  _EAX = 1;
-  __asm { cpuid }
-  v7 = _EAX;
-  v1->cpuid_00000001_edx = _EDX;
-  v1->cpuid_00000001_eax = _EAX;
-  if ( (_EAX & 0x3000) == 8192 )
-  {
-    LOBYTE(v1->cpuid_80000002_registers2[0]) = 1;
-    v7 = 0;
-  }
-  v8 = (v7 >> 8) & 0xF;
-  switch ( v8 )
-  {
-    case 4:
-      v1->field_AC = 2;
-      break;
-    case 5:
-      v1->field_AC = 15;
-      break;
-    case 6:
-      v1->field_AC = 36;
-      break;
-    default:
-      v1->field_AC = 49;
-      break;
-  }
-  v9 = v1->uProcessorManufacturer;
-  if ( v9 == 1 )
-  {
-    v10 = 0;
-    v11 = v7 & 0x3FF0;
-    while ( v11 != dword_4E4948[2 * v10] )
-    {
-      ++v10;
-      if ( v10 >= 17 )
-        return;
-    }
-    v12 = dword_4E494C[2 * v10];
-    goto LABEL_39;
-  }
-  if ( v9 == 2 )
-  {
-    if ( (v7 & 0xF00) == dword_4E49D0[0] )
-    {
-      v12 = dword_4E49D4[0];
-    }
-    else
-    {
-      v13 = 1;
-      v14 = v7 & 0x3FF0;
-      while ( v14 != dword_4E49D0[2 * v13] )
-      {
-        ++v13;
-        if ( v13 >= 9 )
-          return;
-      }
-      v12 = dword_4E49D4[2 * v13];
-    }
-    goto LABEL_39;
-  }
-  if ( v9 != 3 )
-  {
-    if ( v9 != 4 )
-      return;
-    v17 = 0;
-    v18 = v7 & 0x3FF0;
-    while ( v18 != dword_4E4A40[2 * v17] )
-    {
-      ++v17;
-      if ( v17 >= 2 )
-        return;
-    }
-    v12 = dword_4E4A44[2 * v17];
-    goto LABEL_39;
-  }
-  v15 = 1;
-  v16 = v7 & 0x3FF0;
-  while ( v16 != dword_4E4A18[2 * v15] )
-  {
-    ++v15;
-    if ( v15 >= 5 )
-      goto LABEL_30;
-  }
-  v1->field_AC = dword_4E4A1C[2 * v15];
-LABEL_30:
-  v12 = 24;
-  if ( v1->field_AC == 24 )
-  {
-    if ( _EDX != 1 )
-      v12 = (((_EDX != 261) - 1) & 0xA) + 15;
-LABEL_39:
-    v1->field_AC = v12;
-  }*/
-}
-
-//----- (00438992) --------------------------------------------------------
-void stru11::RunCPUID_op2()
-{
-  __debugbreak();
-  /*
-  stru11 *v1; // edi@1
-  int v7; // eax@1
-  signed int v8; // ecx@2
-  unsigned __int8 v9; // al@3
-  signed int v10; // ecx@14
-  unsigned __int8 v11; // al@15
-  int v12; // [sp+Ch] [bp-14h]@1
-  int v13; // [sp+10h] [bp-10h]@1
-  int v14; // [sp+14h] [bp-Ch]@1
-  int v15; // [sp+18h] [bp-8h]@1
-  int *v16; // [sp+1Ch] [bp-4h]@1
-
-  v1 = this;
-  v16 = &v12;
-  _EAX = 2;
-  __asm { cpuid }
-  v12 = _EAX;
-  v13 = _EBX;
-  v14 = _ECX;
-  v15 = _EDX;
-  v1->cpuid_00000002_eax = _EAX;
-  v1->cpuid_00000002_ebx = v13;
-  v1->cpuid_00000002_ecx = v14;
-  v1->cpuid_00000002_edx = v15;
-  v7 = v1->field_AC;
-  if ( v7 == 40 )
-  {
-    v8 = 0;
-    while ( 1 )
-    {
-      v9 = *((char *)&v12 + v8);
-      if ( v9 == 64 )
-      {
-        v1->field_AC = 43;
-        return;
-      }
-      if ( v9 >= 0x41u && v9 <= 0x43u )
-      {
-        v1->field_AC = 41;
-        return;
-      }
-      if ( v9 >= 0x44u && v9 <= 0x45u )
-        break;
-      ++v8;
-      if ( v8 >= 16 )
-        return;
-    }
-    v1->field_AC = 42;
-  }
-  else
-  {
-    if ( v7 == 45 )
-    {
-      v10 = 0;
-      while ( 1 )
-      {
-        v11 = *((char *)&v12 + v10);
-        if ( v11 >= 0x40u && v11 <= 0x43u )
-        {
-          v1->field_AC = 46;
-          return;
-        }
-        if ( v11 >= 0x44u && v11 <= 0x45u )
-          break;
-        ++v10;
-        if ( v10 >= 16 )
-          return;
-      }
-      v1->field_AC = 47;
-    }
-  }*/
-}
-
-//----- (00438A67) --------------------------------------------------------
-void stru11::RunCPUID_ext2_3_4()
-{
-  __debugbreak();
-  /*stru11 *v1; // edi@1
-  stru11 *v17; // eax@1
-  int v18[3][4]; // [sp+Ch] [bp-38h]@1
-  stru11 *v19; // [sp+3Ch] [bp-8h]@1
-
-  v1 = this;
-  v19 = this;
-  _EAX = 0x80000002u;
-  __asm { cpuid }
-  v18[0][0] = _EAX;
-  *(_QWORD *)&v18[0][1] = __PAIR__(_ECX, _EBX);
-  v18[0][3] = _EDX;
-  _EAX = 0x80000003u;
-  __asm { cpuid }
-  v18[1][0] = _EAX;
-  *(_QWORD *)&v18[1][1] = __PAIR__(_ECX, _EBX);
-  v18[1][3] = _EDX;
-  _EAX = 0x80000004u;
-  __asm { cpuid }
-  v18[2][0] = _EAX;
-  *(_QWORD *)&v18[2][1] = __PAIR__(_ECX, _EBX);
-  v18[2][3] = _EDX;
-  v17 = v19;
-  memcpy(v1->cpuid_80000002_registers, v18, 0x30u);
-  memcpy((char *)&v17->cpuid_80000002_registers2[0] + 1, v18, 0x30u);*/
-}
-
 //----- (00438F8F) --------------------------------------------------------
-void __cdecl area_of_effect__damage_evaluate()
+void area_of_effect__damage_evaluate()
 {
   int v0; // edx@1
   char *v1; // esi@2
@@ -4295,7 +3858,7 @@
 //----- (0043A97E) --------------------------------------------------------
 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2)
 {
-  if ( PID_TYPE(a2) == OBJECT_BLVDoor)
+  if (PID_TYPE(a2) == OBJECT_BLVDoor)
   {
     layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x;
     layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y;
@@ -4552,13 +4115,6 @@
   }
 }
 
-// A750D8: using guessed type __int64 qword_A750D8;
-
-
-// A750D8: using guessed type __int64 qword_A750D8;
-
-
-// A750D8: using guessed type __int64 qword_A750D8;
 
 //----- (0043F515) --------------------------------------------------------
 void FindBillboardsLightLevels_BLV()
@@ -5353,12 +4909,6 @@
   return result;
 }
 
-//----- (0040DEDB) --------------------------------------------------------
-unsigned int __stdcall R8G8B8_to_TargetFormat(int uColor)
-{
-  return TargetColor((unsigned __int8)uColor, BYTE1(uColor), BYTE2(uColor));
-}
-
 //----- (0040DEF3) --------------------------------------------------------
 unsigned short TargetColor( unsigned __int16 r, unsigned __int16 g, unsigned __int16 b )
 {
@@ -5938,79 +5488,46 @@
   }
 }
 
-//----- (004179BC) --------------------------------------------------------
-void __fastcall sub_4179BC_draw_tooltip( const char *a1, const char *a2 )
-    {
-  const char *v2; // ebx@1
-  const char *v3; // edi@1
-  unsigned int v4; // eax@1
-  GUIWindow Dst; // [sp+Ch] [bp-5Ch]@1
-  POINT v6; // [sp+60h] [bp-8h]@1
-
-  v2 = a2;
-  v3 = a1;
-  memset(&Dst, 0, 0x54u);
-  Dst.uFrameWidth = 384;
-  Dst.uFrameHeight = 256;
-  Dst.uFrameX = 128;
-  Dst.uFrameY = pMouse->GetCursorPos(&v6)->y + 30;
-  Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(v2, &Dst, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24;
-  Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
-  Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
-  Dst.DrawMessageBox(0);
-  Dst.uFrameX += 12;
-  Dst.uFrameWidth -= 24;
-  Dst.uFrameY += 12;
-  Dst.uFrameHeight -= 12;
-  Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
-  Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
-  v4 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-  sprintf(pTmpBuf.data(), format_4E2D80, v4, v3);
-  Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u);
-  Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0);
-}
-
 //----- (00417AD4) --------------------------------------------------------
 unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level)
-{
-  int v8; // eax@10
-  int v12; // eax@14
-  unsigned int yellow; // [sp+Ch] [bp-Ch]@1
-  unsigned int red; // [sp+10h] [bp-8h]@1
-  unsigned int white; // [sp+14h] [bp-4h]@1
-
-  white = TargetColor(0xFFu, 0xFFu, 0xFFu);
-  red = TargetColor(0xFFu, 0, 0);
-  yellow = TargetColor(0xFFu, 0xFFu, 0);
-  if ( !(uPlayerClass % 4) )
+{  
+  switch (uPlayerClass % 4)
   {
-    if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level )
-      return white;
-    if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level
-      && byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level )
+    case 0:
     {
-      v12 = byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType];
-      if ( v12 < skill_level )
-        return red;
+      if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level)
+        return ui_character_skillinfo_can_learn;
+      if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level &&
+          byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level)
+      {
+        if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType] < skill_level)
+          return ui_character_skillinfo_cant_learn;
+      }
+      return ui_character_skillinfo_can_learn_gm;
     }
-    return yellow;
-  }
-  if ( (uPlayerClass % 4) == 1 )
-  {
-    if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level )
-      return white;
-    if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level )
+    break;
+
+    case 1:
     {
-      v8 = byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType];
-      if ( v8 < skill_level)
-        return red;
+      if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level)
+        return ui_character_skillinfo_can_learn;
+      if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level)
+      {
+        if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level)
+          return ui_character_skillinfo_cant_learn;
+      }
+      return ui_character_skillinfo_can_learn_gm;
     }
-    return yellow;
+    break;
+
+    case 2:
+    case 3:
+    {
+      if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level)
+        return ui_character_skillinfo_cant_learn;
+      return ui_character_skillinfo_can_learn;
+    }
+    break;
   }
-  if ( (uPlayerClass % 4) == 2 || (uPlayerClass % 4) == 3 )
-  {
-    if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level )
-      return red;
-  }
-  return white;
+  assert(false);
 }
\ No newline at end of file