view UICharacter.cpp @ 1266:71ebff35c428

Merge
author Grumpy7
date Thu, 13 Jun 2013 07:23:54 +0200
parents b9747d9e9b4e
children 5450af4f57ef
line wrap: on
line source

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <assert.h>

#include <algorithm> 

#include "MM7.h"

#include "MapInfo.h"
#include "Game.h"
#include "GUIWindow.h"
#include "GUIFont.h"
#include "GUIProgressBar.h"
#include "Party.h"
#include "AudioPlayer.h"
#include "Render.h"
#include "IndoorCamera.h"
#include "LOD.h"
#include "Viewport.h"
#include "Time.h"
#include "Awards.h"
#include "CastSpellInfo.h"
#include "texts.h"

#include "mm7_data.h"




int bRingsShownInCharScreen; // 5118E0


unsigned int ui_mainmenu_copyright_color;

unsigned int ui_character_default_text_color;
unsigned int ui_character_skill_highlight_color;
unsigned int ui_character_header_text_color;
unsigned int ui_character_bonus_text_color;
unsigned int ui_character_bonus_text_color_neg;
unsigned int ui_character_skill_upgradeable_color;
unsigned int ui_character_skill_default_color;
std::array<unsigned int, 6> ui_character_award_color;

unsigned int ui_game_minimap_outline_color;
unsigned int ui_game_minimap_actor_friendly_color;
unsigned int ui_game_minimap_actor_hostile_color;
unsigned int ui_game_minimap_actor_corpse_color;
unsigned int ui_game_minimap_decoration_color_1;
unsigned int ui_game_minimap_projectile_color;
unsigned int ui_game_minimap_treasure_color;
std::array<unsigned int, 24> ui_game_character_record_playerbuff_colors;

unsigned int ui_gamemenu_video_gamma_title_color;
unsigned int ui_gamemenu_keys_action_name_color;
unsigned int ui_gamemenu_keys_key_selection_blink_color_1;
unsigned int ui_gamemenu_keys_key_selection_blink_color_2;
unsigned int ui_gamemenu_keys_key_default_color;

unsigned int ui_book_quests_title_color;
unsigned int ui_book_quests_text_color;
unsigned int ui_book_autonotes_title_color;
unsigned int ui_book_autonotes_text_color;
unsigned int ui_book_map_title_color;
unsigned int ui_book_map_coordinates_color;

unsigned int ui_book_calendar_title_color;
unsigned int ui_book_calendar_time_color;
unsigned int ui_book_calendar_day_color;
unsigned int ui_book_calendar_month_color;
unsigned int ui_book_calendar_year_color;
unsigned int ui_book_calendar_moon_color;
unsigned int ui_book_calendar_location_color;

unsigned int ui_book_journal_title_color;
unsigned int ui_book_journal_text_color;
unsigned int ui_book_journal_text_shadow;

std::array<unsigned int, 16> papredoll_dbrds;
unsigned int papredoll_drhs[4];
unsigned int papredoll_dlhus[4];
unsigned int papredoll_dlhs[4];
unsigned int papredoll_dbods[5];
int paperdoll_armor_texture[4][17][3];
//int paperdoll_array_51132C[165];
unsigned int papredoll_dlaus[5];
unsigned int papredoll_dlads[4];
int papredoll_flying_feet[777]; // idb
int paperdoll_boots_texture[4][6];//0x511638
int paperdoll_cloak_collar_texture[4][10]; // weak
int paperdoll_cloak_texture[4][10];
int paperdoll_helm_texture[2][16]; //511698
int paperdoll_belt_texture[4][7];  //511718


const int paperdoll_Weapon[4][16][2] = {//4E4C30
    {{128, 205},  {30, 144},  {88,  85},  {0, 0},  {0, 0},  {0, 0},  {17, 104},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0}},
    {{131, 201},  {38, 158},  {98,  87},  {0, 0},  {0, 0},  {0, 0},  {21, 100},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0}},
    {{131, 216},  {29, 186},  {88, 119},  {0, 0},  {0, 0},  {0, 0},  {  0,  0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0}},
    {{123, 216},  {35, 184},  {98, 119},  {0, 0},  {0, 0},  {0, 0},  {  0,  0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0},  {0, 0}},
    };



const int paperdoll_Boot[4][7][2] = //4E5490
    {
    0xE, 0x11D,    0xD, 0x11D,    0xC, 0x10A,    0xA, 0xFF,    0xD, 0xF9,    0xD, 0x137,   0xC, 0x10E,
    0x14, 0x125,   0x13, 0x122,   0x15, 0x120,   0x15, 0x114,  0x13, 0x10A,  0x11, 0x13E,  0x11, 0x116,
    0x1D, 0x121,   0x1C, 0x11F,   0x1B, 0x11B,   0x1C, 0x117,  0x16, 0x116,  0x1B, 0x137,  0x1B, 0x11B,
    0x1F, 0x127,   0x1F, 0x122,   0x1B, 0x11B,   0x1D, 0x117,  0x1D, 0x116,  0x1D, 0x137,  0x1B, 0x11F,
    };
const int paperdoll_Cloak[4][10][2] = //4E5570
    {
    0x11, 0x68,  0xF, 0x68,  0x14, 0x71,  0x19, 0x6B,  0x21, 0x6F,  0x5, 0x68,  0x5, 0x68,  0x14, 0x71,  0x3, 0x6B,  0xF, 0x6F,
    0x15, 0x64,  0xB, 0x6B,  0xE, 0x67,   0x15, 0x6B,  0x1B, 0x6F,  0x3, 0x6B,  0, 0x6B,    0xE, 0x67,   0, 0x6B,    0x3, 0x6F,
    0x10, 0x8A,  0x9, 0x8B,  0x18, 0x98,  0x25, 0x91,  0x29, 0x90,  0x8, 0x8A,  0x9, 0x8B,  0x18, 0x98,  0x3, 0x91,  0x3, 0x90,
    0x14, 0x92,  0x10, 0x92, 0x15, 0x98,  0x1F, 0x91,  0x22, 0x90,  0x8, 0x92,  0xC, 0x92,  0x15, 0x98,  0x3, 0x91,  0x3, 0x90,
    };
const int paperdoll_CloakCollar[4][10][2] = //4E56B0
    {
    0x11, 0x68,  0x34, 0x64,  0x21, 0x69,  0x1D, 0x67,  0x20, 0x67,  0x21, 0x68,  0x34, 0x64,  0x21, 0x69,  0x1D, 0x67,  0x1F, 0x67,
    0x13, 0x64,  0x35, 0x66,  0x29, 0x68,  0x1F, 0x68,  0x1F, 0x6A,  0x21, 0x6A,  0x2B, 0x66,  0x26, 0x68,  0x1F, 0x68,  0x1F, 0x6A,
    0, 0,        0x30, 0x87,  0x1E, 0x86,  0x1B, 0x86,  0x1C, 0x8A,  0x21, 0x87,  0x30, 0x87,  0x1E, 0x86,  0x1B, 0x86,  0x1C, 0x8A,
    0, 0,        0x38, 0x8A,  0x24, 0x8B,  0x1D, 0x8B,  0x21, 0x8C,  0x27, 0x8A,  0x34, 0x8A,  0x24, 0x8B,  0x25, 0x8B,  0x21, 0x8C,
    };
//int dword_4E56B4; // weak
const int paperdoll_Belt[4][7][2] = //4E57F0
    {
    0x3A, 0xB6,  0x37, 0xB2,  0x34, 0xB9,  0x3A, 0xB9,  0x37, 0xB7,  0x38, 0xAC,  0x37, 0xB7,
    0x3E, 0xAD,  0x3A, 0xAC,  0x37, 0xB0,  0x3A, 0xB1,  0x39, 0xB0,  0x3C, 0xA5,  0x39, 0xB0,
    0x3B, 0xD5,  0x37, 0xD2,  0x31, 0xD5,  0x39, 0xD6,  0x37, 0xD8,  0x37, 0xD1,  0x37, 0xD8,
    0x42, 0xD2,  0x3F, 0xD0,  0x3B, 0xD7,  0x3C, 0xD5,  0x3B, 0xD6,  0x3E, 0xCF,  0x36, 0xD6,
    };
const int paperdoll_Helm[4][16][2] = //4E58D0
    {
    0x3E, 0x1F,  0x41, 0x2C,  0x37, 0x2F,  0x31, 0x32,  0x37, 0x2A,  0x39, 0x28,  0x36, 0x34,  0x41, 0x38,  0x40, 0x31,  0x40, 0x21,  0x40, 0x31,  0x3C, 0x33,  0x3D, 0x24,  0x3A, 0x1A,  0x37, 0x2A,  0x41, 0x48,
    0x41, 0x1E,  0x42, 0x2B,  0x37, 0x2F,  0x34, 0x30,  0x39, 0x29,  0x3A, 0x26,  0x36, 0x34,  0x41, 0x37,  0x42, 0x32,  0x40, 0x21,  0x40, 0x31,  0x40, 0x2F,  0x3E, 0x22,  0x3B, 0x1A,  0x39, 0x29,  0x42, 0x47,
    0x3F, 0x47,  0x41, 0x56,  0x37, 0x59,  0x32, 0x5E,  0x37, 0x58,  0x39, 0x54,  0x34, 0x61,  0x40, 0x61,  0x41, 0x5D,  0x3E, 0x4F,  0x3E, 0x5B,  0x3D, 0x5B,  0x3F, 0x4C,  0x3B, 0x45,  0x37, 0x58,  0x41, 0x74,
    0x45, 0x45,  0x46, 0x54,  0x3A, 0x55,  0x38, 0x58,  0x3C, 0x54,  0x3F, 0x52,  0x39, 0x5B,  0x45, 0x5C,  0x47, 0x5C,  0x44, 0x4B,  0x44, 0x57,  0x43, 0x55,  0x44, 0x4A,  0x3E, 0x45,  0x3C, 0x54,  0x47, 0x70,
    };
const int pPaperdoll_Beards[4] = //4E5AD0
    {
    52, 130, 56, 136,
    };
const int pPaperdoll_LeftHand[4][2] = //4E5AE0
    {
    0x67, 0x6A,
    0x65, 0x6C,
    0x74, 0x8D,
    0x74, 0x93,
    };
const int pPaperdoll_SecondLeftHand[4][2] = //4E5B00
    {
    0x1A, 0x6B,
    0x28, 0x6D,
    0x19, 0x8D,
    0x20, 0x92,
    };
const int pPaperdoll_RightHand[4][2] = //4E5B20
    {
    0x1E, 0x90,
    0x22, 0x9E,
    0x19, 0xBA,
    0x1F, 0xB8,
    };
const int pPaperdollLeftEmptyHand[4][2] = //4E5B40
    {
    0x80, 0xCD,
    0x83, 0xC9,
    0x83, 0xD8,
    0x7B, 0xD8,
    };

int pPaperdoll_BodyX = 481; // 004E4C28
int pPaperdoll_BodyY = 0;   // 004E4C2C
const int paperdoll_Armor[4][17][2] = //4E4E30
    {
    // X     Y
    0x2C, 0x67,  0x30, 0x69,  0x2D, 0x67,  0x2C, 0x64,  0x14, 0x66,  0x22, 0x67,  0x20, 0x66,  0x25, 0x66,  0x12, 0x66,//Human
    0x0A, 0x66,  0x13, 0x64,  0x0E, 0x64,  0x0A, 0x63,  0x14, 0x66,  0x0A, 0x63,  0x0A, 0x66,  0x25, 0x66,

    0x32, 0x68,  0x32, 0x69,  0x35, 0x69,  0x33, 0x68,  0x24, 0x67,  0x30, 0x69,  0x33, 0x68,  0x31, 0x69,  0x19, 0x69,
    0x19, 0x6A,  0x16, 0x66,  0x16, 0x65,  0x0F, 0x6B,  0x24, 0x67,  0x0F, 0x6B,  0x19, 0x6A,  0x31, 0x69,

    0x2A, 0x8C,  0x29, 0x8C,  0x2A, 0x89,  0x29, 0x86,  0x12, 0x87,  0x2D, 0x89,  0x2A, 0x88,  0x25, 0x87,  0x12, 0x8B,
    0x12, 0x8B,  0x11, 0x8A,  0x15, 0x87,  0x09, 0x89,  0x12, 0x87,  0x09, 0x89,  0x12, 0x8B,  0x25, 0x87,

    0x33, 0x90,  0x32, 0x90,  0x34, 0x91,  0x32, 0x8E,  0x21, 0x8B,  0x31, 0x8B,  0x33, 0x8E,  0x2F, 0x8F,  0x16, 0x8D,
    0x18, 0x8C,  0x19, 0x8C,  0x1B, 0x8E,  0x0C, 0x8C,  0x21, 0x8B,  0x0C, 0x8C,  0x18, 0x8C,  0x2F, 0x8F,
    };
const int paperdoll_shoulder[4][17][2] = //4E5050
    {
    0x64, 0x67,  0x61, 0x67,  0x65, 0x68,  0x6E, 0x74,  0x6C, 0x68,  0x61, 0x67,  0x66, 0x68,  0x6C, 0x6A,  0x6E, 0x6D,
    0x67, 0x69,  0x70, 0x67,  0x6E, 0x6D,  0x6C, 0x6F,  0x6C, 0x68,  0x6C, 0x6F,  0x67, 0x69,  0x6C, 0x6A,

    0x60, 0x6B,  0x60, 0x6C,  0x60, 0x6B,  0x61, 0x6A,  0x60, 0x69,  0x60, 0x6A,  0x60, 0x6A,  0x61, 0x69,  0x63, 0x6A,
    0x64, 0x6A,  0x61, 0x66,  0x66, 0x67,  0x64, 0x6C,  0x60, 0x69,  0x64, 0x6C,  0x64, 0x6A,  0x61, 0x69,

    0x6D, 0x8C,  0x75, 0x8C,  0, 0,        0x72, 0x8D,  0x6A, 0x89,  0, 0,        0x73, 0x8C,  0x69, 0x8C,  0x6E, 0x8D,
    0x71, 0x8D,  0x70, 0x8D,  0x72, 0x8D,  0x74, 0x8E,  0x6A, 0x89,  0x74, 0x8E,  0x71, 0x8D,  0x69, 0x8C,

    0x72, 0x91,  0x72, 0x91,  0, 0,        0x6E, 0x92,  0x6F, 0x91,  0, 0,        0, 0,        0x6E, 0x91,  0x71, 0x90,
    0x72, 0x8D,  0x72, 0x90,  0x73, 0x93,  0x73, 0x90,  0x6F, 0x91,  0x73, 0x90,  0x72, 0x8D,  0x6E, 0x91,
    };
const int dword_4E5270[4][2] = 
    {
    0, 0,
    0x61, 0x67,
    0, 0,
    0x64, 0x69,
    };

const char *dlad_texnames_by_face[25] =
    {
    "pc01lad", "pc02lad", "pc03lad", "pc04lad", "pc05lad", "pc06lad",
    "pc07lad", "pc08lad", "pc09lad", "pc10lad", "pc11lad", "pc12lad",
    "pc13lad", "pc14lad", "pc15lad", "pc16lad", "pc17lad", "pc18lad",
    "pc19lad", "pc20lad", "pc21lad", "pc22lad", "pc23lad", "pc24lad",
    "pc25lad"
    };
const char *dlau_texnames_by_face[25] =
    {
    "pc01lau", "pc02lau", "pc03lau", "pc04lau", "pc05lau", "pc06lau",
    "pc07lau", "pc08lau", "pc09lau", "pc10lau", "pc11lau", "pc12lau",
    "pc13lau", "pc14lau", "pc15lau", "pc16lau", "pc17lau", "pc18lau",
    "pc19lau", "pc20lau", "pc21lau", "pc22lau", "pc23lau", "pc24lau",
    "pc25lau"
    };
const char *dbod_texnames_by_face[25] =
    {
    "pc01bod", "pc02bod", "pc03bod", "pc04bod", "pc05bod", "pc06bod",
    "pc07bod", "pc08bod", "pc09bod", "pc10bod", "pc11bod", "pc12bod",
    "pc13bod", "pc14bod", "pc15bod", "pc16bod", "pc17bod", "pc18bod",
    "pc19bod", "pc20bod", "pc21bod", "pc22bod", "pc23bod", "pc24bod",
    "pc25bod"
    };
const char *drh_texnames_by_face[25] =
    {

    "pc01rh", "pc02rh", "pc03rh", "pc04rh", "pc05rh", "pc06rh",
    "pc07rh", "pc08rh", "pc09rh", "pc10rh", "pc11rh", "pc12rh",
    "pc13rh", "pc14rh", "pc15rh", "pc16rh", "pc17rh", "pc18rh",
    "pc19rh", "pc20rh", "pc21rh", "pc22rh", "pc23rh", "pc24rh",
    "pc25rh"
    };
const char *dlh_texnames_by_face[25] =
    {
    "pc01lh", "pc02lh", "pc03lh", "pc04lh", "pc05lh", "pc06lh",
    "pc07lh", "pc08lh", "pc09lh", "pc10lh", "pc11lh", "pc12lh",
    "pc13lh", "pc14lh", "pc15lh", "pc16lh", "pc17lh", "pc18lh",
    "pc19lh", "pc20lh", "pc21lh", "pc22lh", "pc23lh", "pc24lh",
    "pc25lh"
    };
const char *dlhu_texnames_by_face[25] =
    {
    "pc01lhu", "pc02lhu", "pc03lhu", "pc04lhu", "pc05lhu", "pc06lhu",
    "pc07lhu", "pc08lhu", "pc09lhu", "pc10lhu", "pc11lhu", "pc12lhu",
    "pc13lhu", "pc14lhu", "pc15lhu", "pc16lhu", "pc17lhu", "pc18lhu",
    "pc19lhu", "pc20lhu", "pc21lhu", "pc22lhu", "pc23lhu", "pc24lhu",
    "pc25lhu"
    };

const  int pArmorSkills[5]  = {PLAYER_SKILL_LEATHER, PLAYER_SKILL_CHAIN,      PLAYER_SKILL_PLATE,        PLAYER_SKILL_SHIELD,  PLAYER_SKILL_DODGE};
const int pWeaponSkills[9] = {PLAYER_SKILL_AXE,     PLAYER_SKILL_BOW,        PLAYER_SKILL_DAGGER,       PLAYER_SKILL_MACE,    PLAYER_SKILL_SPEAR,      
    PLAYER_SKILL_STAFF,    PLAYER_SKILL_SWORD,       PLAYER_SKILL_UNARMED,    PLAYER_SKILL_BLASTER};
const  int pMiscSkills[12]  = {PLAYER_SKILL_ALCHEMY, PLAYER_SKILL_ARMSMASTER, PLAYER_SKILL_BODYBUILDING, PLAYER_SKILL_ITEM_ID, PLAYER_SKILL_MONSTER_ID, 
    PLAYER_SKILL_LEARNING, PLAYER_SKILL_TRAP_DISARM, PLAYER_SKILL_MEDITATION, PLAYER_SKILL_MERCHANT, PLAYER_SKILL_PERCEPTION,
    PLAYER_SKILL_REPAIR, PLAYER_SKILL_STEALING};
const  int pMagicSkills[9]  = {PLAYER_SKILL_FIRE,    PLAYER_SKILL_AIR,        PLAYER_SKILL_WATER,        PLAYER_SKILL_EARTH,   PLAYER_SKILL_SPIRIT,    
    PLAYER_SKILL_MIND,     PLAYER_SKILL_BODY,        PLAYER_SKILL_LIGHT,      PLAYER_SKILL_DARK};




void set_default_ui_skin()
{
  ui_mainmenu_copyright_color = TargetColor(255, 255, 255);

  ui_character_default_text_color = TargetColor(255, 255, 255);
  ui_character_header_text_color = TargetColor(255, 255, 155);
  ui_character_bonus_text_color = TargetColor(0, 255, 0);
  ui_character_bonus_text_color_neg = TargetColor(255, 0, 0);

  ui_character_skill_upgradeable_color = TargetColor(0, 175, 255);
  ui_character_skill_default_color = TargetColor(255, 0, 0);
  ui_character_skill_highlight_color = TargetColor(255, 0, 0);  

  ui_character_award_color[0] = TargetColor(248, 108, 160);
  ui_character_award_color[1] = TargetColor(112, 220, 248);
  ui_character_award_color[2] = TargetColor(192, 192, 240);
  ui_character_award_color[3] = TargetColor( 64, 244,  96);
  ui_character_award_color[4] = TargetColor(232, 244,  96);
  ui_character_award_color[5] = TargetColor(240, 252, 192);
  
  ui_game_minimap_outline_color = TargetColor(0, 0, 255);
  ui_game_minimap_actor_friendly_color = TargetColor(0, 255, 0);
  ui_game_minimap_actor_hostile_color = TargetColor(255, 0, 0);
  ui_game_minimap_actor_corpse_color = TargetColor(255, 255, 0);
  ui_game_minimap_decoration_color_1 = TargetColor(255, 255, 255);
  ui_game_minimap_projectile_color = TargetColor(255, 0, 0);
  ui_game_minimap_treasure_color = TargetColor(0, 0, 255);
  ui_game_character_record_playerbuff_colors[0] = TargetColor(150, 212, 255);
  ui_game_character_record_playerbuff_colors[1] = TargetColor(225, 225, 225);
  ui_game_character_record_playerbuff_colors[2] = TargetColor(255, 128, 0);
  ui_game_character_record_playerbuff_colors[3] = TargetColor(128, 128, 128);
  ui_game_character_record_playerbuff_colors[4] = TargetColor(225, 225, 225);
  ui_game_character_record_playerbuff_colors[5] = TargetColor(255, 85, 0);
  ui_game_character_record_playerbuff_colors[6] = TargetColor(255, 128, 0);
  ui_game_character_record_playerbuff_colors[7] = TargetColor(255, 85, 0);
  ui_game_character_record_playerbuff_colors[8] = TargetColor(225, 225, 225);
  ui_game_character_record_playerbuff_colors[9] = TargetColor(235, 15, 255);
  ui_game_character_record_playerbuff_colors[10] = TargetColor(192, 192, 240);
  ui_game_character_record_playerbuff_colors[11] = TargetColor(225, 225, 225);
  ui_game_character_record_playerbuff_colors[12] = TargetColor(255, 128, 0);
  ui_game_character_record_playerbuff_colors[13] = TargetColor(150, 212, 255);
  ui_game_character_record_playerbuff_colors[14] = TargetColor(128, 128, 128);
  ui_game_character_record_playerbuff_colors[15] = TargetColor(255, 255, 155);
  ui_game_character_record_playerbuff_colors[16] = TargetColor(255, 255, 155);
  ui_game_character_record_playerbuff_colors[17] = TargetColor(255, 255, 155);
  ui_game_character_record_playerbuff_colors[18] = TargetColor(255, 255, 155);
  ui_game_character_record_playerbuff_colors[19] = TargetColor(255, 255, 155);
  ui_game_character_record_playerbuff_colors[20] = TargetColor(255, 255, 155);
  ui_game_character_record_playerbuff_colors[21] = TargetColor(255, 255, 155);
  ui_game_character_record_playerbuff_colors[22] = TargetColor(0, 128, 255);
  ui_game_character_record_playerbuff_colors[23] = TargetColor(0, 128, 255);

  ui_gamemenu_video_gamma_title_color = TargetColor(255, 255, 155);
  ui_gamemenu_keys_action_name_color = TargetColor(255, 255, 255);
  ui_gamemenu_keys_key_selection_blink_color_1 = TargetColor(50, 0, 0);
  ui_gamemenu_keys_key_selection_blink_color_2 = TargetColor(225, 205, 35);
  ui_gamemenu_keys_key_default_color = TargetColor(255, 255, 255);

  ui_book_quests_title_color = TargetColor(255, 255, 255);
  ui_book_quests_text_color = TargetColor(255, 255, 255);
  ui_book_autonotes_title_color = TargetColor(255, 255, 255);
  ui_book_autonotes_text_color = TargetColor(255, 255, 255);
  ui_book_map_title_color = TargetColor(255, 255, 255);
  ui_book_map_coordinates_color = TargetColor(255, 255, 255);

  ui_book_calendar_title_color = TargetColor(255, 255, 255);
  ui_book_calendar_time_color = TargetColor(75, 75, 75);
  ui_book_calendar_day_color = TargetColor(75, 75, 75);
  ui_book_calendar_month_color = TargetColor(75, 75, 75);
  ui_book_calendar_year_color = TargetColor(75, 75, 75);
  ui_book_calendar_moon_color = TargetColor(75, 75, 75);
  ui_book_calendar_location_color = TargetColor(75, 75, 75);

  ui_book_journal_title_color = TargetColor(255, 255, 255);
  ui_book_journal_text_color = TargetColor(255, 255, 255);
  ui_book_journal_text_shadow = TargetColor(0, 0, 0);
}




//----- (00421626) --------------------------------------------------------
GUIWindow *CharacterUI_Initialize(unsigned int _this)
{
  GUIWindow *pWindow; // edi@3

  ++pIcons_LOD->uTexturePacksCount;
  if ( !pIcons_LOD->uNumPrevLoadedFiles )
    pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;

  pEventTimer->Pause();
  pAudioPlayer->StopChannels(-1, -1);
  bRingsShownInCharScreen = false;
  CharacterUI_LoadPaperdollTextures();
  pCurrentScreen = _this;

  pWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_CharacterRecord, uActiveCharacter, 0);
  pCharacterScreen_StatsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 12, pViewport->uViewportTL_Y + 308,
                                pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureWidth,
                                pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureHeight,
                                1, 0, UIMSG_ClickStatsBtn, 0, 'S', pGlobalTXT_LocalizationStrings[216],// Stats
                                pIcons_LOD->GetTexture(papredoll_dbrds[10]),
                                pIcons_LOD->GetTexture(papredoll_dbrds[9]), 0);
  pCharacterScreen_SkillsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 102, pViewport->uViewportTL_Y + 308,
                                 pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureWidth,
                                 pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureHeight,
                                 1, 0, UIMSG_ClickSkillsBtn, 0, 'K', pGlobalTXT_LocalizationStrings[205],//Skills
                                 pIcons_LOD->GetTexture(papredoll_dbrds[8]),
                                 pIcons_LOD->GetTexture(papredoll_dbrds[7]), 0);
  pCharacterScreen_InventoryBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 192, pViewport->uViewportTL_Y + 308,
                                    pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureWidth,
                                    pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureHeight,
                                    1, 0, UIMSG_ClickInventoryBtn, 0, 'I', pGlobalTXT_LocalizationStrings[120], //Inventory
                                    pIcons_LOD->GetTexture(papredoll_dbrds[6]),
                                    pIcons_LOD->GetTexture(papredoll_dbrds[5]), 0);
  pCharacterScreen_AwardsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 282, pViewport->uViewportTL_Y + 308,
                                 pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureWidth,
                                 pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureHeight,
                                 1, 0, UIMSG_ClickAwardsBtn, 0, 'A', pGlobalTXT_LocalizationStrings[22], //Awards
                                 pIcons_LOD->GetTexture(papredoll_dbrds[4]),
                                 pIcons_LOD->GetTexture(papredoll_dbrds[3]), 0);
  pCharacterScreen_ExitBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 371, pViewport->uViewportTL_Y + 308,
                 pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureWidth,
                 pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureHeight,
                 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit
                 pIcons_LOD->GetTexture(papredoll_dbrds[2]),
                 pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0);
  pWindow->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0);
  pCharacterScreen_DetalizBtn = pWindow->CreateButton(0x258u, 0x12Cu, 30, 30, 1, 0, UIMSG_ChangeDetaliz, 0, 0, pGlobalTXT_LocalizationStrings[64], 0);
  pCharacterScreen_DollBtn = pWindow->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0);

  pWindow->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
  pWindow->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
  pWindow->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
  pWindow->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);

  pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0);
  FillAwardsData();
  return pWindow;
}

//----- (004219BE) --------------------------------------------------------
GUIWindow *CastSpellInfo::sub_4219BE()
{
  GUIWindow *v2; // ebx@1

  pEventTimer->Pause();
  pAudioPlayer->StopChannels(-1, -1);
  bRingsShownInCharScreen = 0;
  CharacterUI_LoadPaperdollTextures();
  pCurrentScreen = SCREEN_CASTING;
  v2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell_InInventory, (int)this, 0);
  pCharacterScreen_ExitBtn = v2->CreateButton(394, 318, 75, 33, 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0,
                 pGlobalTXT_LocalizationStrings[79], // Close
                 pIcons_LOD->GetTexture(papredoll_dbrds[2]),
                 pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0);
  v2->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0);
  pCharacterScreen_DollBtn = v2->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0);

  v2->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
  v2->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
  v2->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
  v2->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);

  return v2;
}






static int CharacterUI_SkillsTab_Draw__DrawSkillTable(Player *player, int x, int y, const int *skill_list, int skill_list_size, int right_margin, const char *skill_group_name)
{
  int y_offset = y;
  
  sprintf(pTmpBuf.data(), "%s\r%03d%s", skill_group_name, right_margin, pGlobalTXT_LocalizationStrings[131]); //"Level"
  pGUIWindow_CurrentMenu->DrawText(pFontArrus, x, y, ui_character_header_text_color, pTmpBuf.data(), 0, 0, 0);

  int num_skills_drawn = 0;
  for (uint i = 0; i < skill_list_size; ++i)
  {
    auto skill = (PLAYER_SKILL_TYPE)skill_list[i];
    for (uint j = 0; j < pGUIWindow_CurrentMenu->uNumControls; ++j)
    {
      auto v8 = pGUIWindow_CurrentMenu->pControlsHead;

      for (int v7 = j; v7 > 0; --v7)
        v8 = v8->pNext;

      auto v9 = v8->field_1C;
      if ((short)(v8->field_1C) >= 0)
        continue;
      if ( (v9 & 0x7FFF) != skill )
        continue;

      ++num_skills_drawn;
      y_offset = v8->uY;

      auto skill_value = player->pActiveSkills[skill];
      auto skill_level = skill_value & 0x3F;

      uint skill_color = 0;
      uint skill_mastery_color = 0;
      if (player->uSkillPoints > skill_level)
        skill_color = ui_character_skill_upgradeable_color;

      if (pGUIWindow_CurrentMenu->pCurrentPosActiveItem == j)
      {
        if (player->uSkillPoints > skill_level)
          skill_mastery_color = ui_character_bonus_text_color;
        else
          skill_mastery_color = ui_character_skill_default_color;
        skill_color = skill_mastery_color;
      }

      if (SkillToMastery(skill_value) == 1)
      {
        sprintfex(pTmpBuf.data(), "%s\r%03d%2d", pSkillNames[skill], right_margin, skill_level);
        pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf.data(), 0, 0, 0);
      }
      else
      {
        const char *skill_level_str = nullptr;

        switch (SkillToMastery(skill_value))
        {
          case 4: skill_level_str = pGlobalTXT_LocalizationStrings[96];  break; // "Grand"
          case 3: skill_level_str = pGlobalTXT_LocalizationStrings[432]; break; // Master
          case 2: skill_level_str = pGlobalTXT_LocalizationStrings[433]; break; // Expert
        }

        if (!skill_mastery_color)
          skill_mastery_color = ui_character_header_text_color;

        sprintfex(pTmpBuf.data(), "%s \f%05d%s\f%05d\r%03d%2d", pSkillNames[skill], skill_mastery_color, skill_level_str, skill_color, right_margin, skill_level);
        pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf.data(), 0, 0, 0);
      }
    }
  }

  if (!num_skills_drawn)
  {
    y_offset += LOBYTE(pFontLucida->uFontHeight) - 3;
    pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, y_offset, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0); //"None"
  }

  return y_offset;
}



//----- (00419719) --------------------------------------------------------
void CharacterUI_SkillsTab_Draw(Player *player)
{
  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_skill", TEXTURE_16BIT_PALETTE));

  sprintfex(pTmpBuf.data(), "%s \f%05d^Pv[%s]\f00000\r177%s: \f%05d%d\f00000",
            pGlobalTXT_LocalizationStrings[206],        // Skills for
            ui_character_header_text_color,
            player->pName,
            pGlobalTXT_LocalizationStrings[207],        // Skill Points
            player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color,
            player->uSkillPoints);
  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0);

  int y = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;
  y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 24, y, pWeaponSkills, 9, 400, pGlobalTXT_LocalizationStrings[242]); // "Weapons"

  y += 2 * LOBYTE(pFontLucida->uFontHeight) - 10;
  CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 24, y, pMagicSkills, 9, 400, pGlobalTXT_LocalizationStrings[138]); // "Magic"

  y = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;
  y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 248, y, pArmorSkills, 5, 177, pGlobalTXT_LocalizationStrings[11]); // "Armor"
 
  y += 2 * LOBYTE(pFontLucida->uFontHeight) - 10;
  y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 248, y, pMiscSkills, 12, 177, pGlobalTXT_LocalizationStrings[143]); //"Misc"
}










//----- (0041A000) --------------------------------------------------------
void CharacterUI_AwardsTab_Draw(Player *player)
{
    //unsigned int v1; // esi@1
    //unsigned int v2; // ebx@1
    //unsigned int award_texture_id; // eax@1
    unsigned int result; // eax@1
    int v5; // eax@15
    char *v6; // ebx@15
    int v7; // eax@23
    int v8; // eax@24
    int v9; // eax@25
    //int v10; // eax@27
    int v11; // eax@32
    int v12; // eax@33
    int v13; // eax@34
    //signed int v14; // eax@43
    //unsigned int v15; // eax@43
    //int v16; // eax@43
    //int v17; // [sp-4h] [bp-D4h]@16
    char Source[100]; // [sp+Ch] [bp-C4h]@1
    GUIWindow a1; // [sp+70h] [bp-60h]@1
    //unsigned int v20; // [sp+C4h] [bp-Ch]@15
    //int v21; // [sp+C8h] [bp-8h]@14
    //int v22; // [sp+CCh] [bp-4h]@40

  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_award", TEXTURE_16BIT_PALETTE));
  sprintfex(pTmpBuf.data(), "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], ui_character_header_text_color);
  sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]);
  strcat(pTmpBuf.data(), Source);
  strcat(pTmpBuf.data(), "\f00000");

  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf.data(), 0, 0, 0);
  result = dword_506528;
  a1.uFrameX = 12;
  a1.uFrameY = 48;
  a1.uFrameWidth = 424;
  a1.uFrameHeight = 290;
  a1.uFrameZ = 435;
  a1.uFrameW = 337;
  if (BtnDown_flag && num_achieved_awards + dword_506528 < num_achieved_awards_2)
    result = dword_506528++ + 1;
  if (BtnUp_flag && result)
  {
    --result;
    dword_506528 = result;
  }

    if ( dword_50651C < 0 )
        {
        result += num_achieved_awards;
        dword_506528 = result;
        if ( (signed int)(num_achieved_awards + result) > num_achieved_awards_2 )
            {
            result = num_achieved_awards_2 - num_achieved_awards;
            dword_506528 = result;
            }
        }
    else if ( dword_50651C > 0 )
        {
        result -= num_achieved_awards;
        dword_506528 = result;
        if ( (result & 0x80000000u) != 0 )
            {
            result = 0;
            dword_506528 = result;
            }
        }
    //LABEL_14:
    BtnDown_flag = 0;
    BtnUp_flag = 0;
    num_achieved_awards = 0;
    dword_50651C = 0;


    for (uint i = result; i < num_achieved_awards_2; ++i)
    {
      v5 = achieved_awards[i];
      v6 = (char *)pAwards[v5].pText;//(char *)dword_723E80_award_related[v20 / 4];

            pTmpBuf[0] = 0;
            switch (v5)
            {
              case Award_Arena_PageWins:    sprintf(pTmpBuf.data(), v6, pParty->uNumArenaPageWins);     break;
              case Award_Arena_SquireWins:  sprintf(pTmpBuf.data(), v6, pParty->uNumArenaSquireWins);   break;
              case Award_Arena_KnightWins:  sprintf(pTmpBuf.data(), v6, pParty->uNumArenaKnightWins);   break;
              case Award_Arena_LordWins:    sprintf(pTmpBuf.data(), v6, pParty->uNumArenaLordWins);     break;
              case Award_ArcomageWins:      sprintf(pTmpBuf.data(), v6, pParty->uNumArcomageWins);      break;
              case Award_ArcomageLoses:     sprintf(pTmpBuf.data(), v6, pParty->uNumArcomageLoses);     break;
              case Award_Deaths:            sprintf(pTmpBuf.data(), v6, pParty->uNumDeaths);            break;
              case Award_BountiesCollected: sprintf(pTmpBuf.data(), v6, pParty->uNumBountiesCollected); break;
              case Award_Fine:              sprintf(pTmpBuf.data(), v6, pParty->uFine);                 break;
              case Award_PrisonTerms:       sprintf(pTmpBuf.data(), v6, pParty->uNumPrisonTerms);       break;
            }

            if (*pTmpBuf.data())
              v6 = pTmpBuf.data();


            a1.DrawText(pFontArrus, 0, 0, ui_character_award_color[pAwards[v5].uPriority % 6], v6, 0, 0, 0);
            a1.uFrameY = pFontArrus->CalcTextHeight(v6, &a1, 0, 0) + a1.uFrameY + 4;
            if (a1.uFrameY > a1.uFrameHeight)
              break;

            ++num_achieved_awards;
        }
 }






//----- (0041A2C1) --------------------------------------------------------
unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels)
{
  if ( (signed int)uNumPixels < 14 )
    uNumPixels = 14;
  return ((signed int)(uNumPixels - 14) >> 5) + 1;
}



//----- (0041A556) --------------------------------------------------------
void draw_leather()
{
  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Leather));
}


//----- (0041ABFD) --------------------------------------------------------
void CharacterUI_CharacterScreen_Draw(Player *player)
{
  pRenderer->ClearZBuffer(0, 479);
  switch (pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0])
  {
    case WINDOW_CharacterWindow_Stats:                                // stats
      CharacterUI_ReleaseButtons();
      sub_419379();
      CharacterUI_StatsTab_Draw(player);
      pRenderer->DrawTextureIndexed(pCharacterScreen_StatsBtn->uX,
                                    pCharacterScreen_StatsBtn->uY,
                                    pIcons_LOD->LoadTexturePtr("ib-cd1-d", TEXTURE_16BIT_PALETTE));
    break;

    case WINDOW_CharacterWindow_Skills:                                // skills
      if (dword_507CC0_activ_ch != uActiveCharacter)
      {
        CharacterUI_ReleaseButtons();
        CharacterUI_SkillsTab_CreateButtons();
      }
      sub_419379();
      CharacterUI_SkillsTab_Draw(player);
      pRenderer->DrawTextureIndexed(pCharacterScreen_SkillsBtn->uX,
                                    pCharacterScreen_SkillsBtn->uY,
                                    pIcons_LOD->LoadTexturePtr("ib-cd2-d", TEXTURE_16BIT_PALETTE));
    break;

    case WINDOW_CharacterWindow_Awards:                                // awards
      CharacterUI_ReleaseButtons();
      sub_419379();
      sub_419220();
      CharacterUI_AwardsTab_Draw(player);
      pRenderer->DrawTextureIndexed(pCharacterScreen_AwardsBtn->uX,
                                    pCharacterScreen_AwardsBtn->uY,
                                    pIcons_LOD->LoadTexturePtr("ib-cd4-d", TEXTURE_16BIT_PALETTE));
    break;

    case WINDOW_CharacterWindow_Inventory:                             // inventory and other
      CharacterUI_ReleaseButtons();
      sub_419379();
      CharacterUI_InventoryTab_Draw(player, false);
      pRenderer->DrawTextureIndexed(pCharacterScreen_InventoryBtn->uX,
                                    pCharacterScreen_InventoryBtn->uY,
                                    pIcons_LOD->LoadTexturePtr("ib-cd3-d", TEXTURE_16BIT_PALETTE));
    break;

    default: break;
  }

  if (bRingsShownInCharScreen)
    CharacterUI_DrawPaperdollWithRingOverlay(player);
  else
    CharacterUI_DrawPaperdoll(player);
}

//----- (0043CC7C) --------------------------------------------------------
void CharacterUI_DrawPaperdoll(Player *player)
{
  //signed int pSex; // eax@1
  unsigned int v6; // ecx@9
  int v7; // ecx@10
  unsigned int pMainHandNum4; // eax@14
  ItemGen *item_MainHand4; // eax@15
  int v10; // edx@15
  unsigned int pX_MainHand4; // edi@15
  unsigned int v14; // ebx@18
  Texture *v16; // ebp@27
  double v17; // st7@29
  int v18; // edi@30
  char *v19; // eax@30
  unsigned int pBowNum; // eax@37
  ItemGen *itemBow; // edi@38
  int pX_Bow; // ebx@38
  double v28; // st7@51
  char *v30; // eax@54
  unsigned int pCloakNum; // eax@59
  ItemGen *item_Cloak; // edx@60
  int v33; // eax@65
  int v34; // eax@74
  int v35; // ebx@74
  LODFile_IconsBitmaps *v38; // ecx@78
  Texture *v39; // edi@85
  double v40; // st7@87
  int v41; // edi@88
  unsigned int pArmorNum; // eax@93
  ItemGen *item_Armor; // edx@94
  int v45; // eax@98
  int v48; // ebx@106
  LODFile_IconsBitmaps *v50; // ecx@110
  Texture *v51; // edi@117
  double v52; // st7@119
  int v53; // edi@120
  char *v55; // eax@122
  unsigned int pBootNum; // eax@127
  ItemGen *item_Boot; // edi@128
  int v59; // ebx@129
  int v60; // ecx@132
  Texture *v63; // edi@145
  double v64; // st7@147
  int v65; // edi@148
  char *v66; // eax@148
  unsigned int pMainHandNum; // edx@155
  int v70; // edx@156
  unsigned int pBeltNum; // eax@160
  ItemGen *item_Belt; // edi@161
  int v73; // edx@163
  unsigned int v75; // ebx@170
  Texture *v77; // edi@181
  double v78; // st7@183
  int v79; // edi@184
  char *v80; // eax@184
  unsigned int pMainHandNum2; // eax@192
  int v83; // eax@193
  int pArmorShoulderNum; // eax@197
  int v87; // eax@197
  int v88; // eax@198
  int v89; // eax@199
  int v94; // ebx@214
  int v95; // eax@214
  char *v96; // edi@226
  double v97; // st7@228
  int v98; // edi@229
  char *v99; // eax@229
  int pX_ArmorShoulder; // eax@237
  int pY_ArmorShoulder; // ecx@237
  int v106; // edx@238
  int v107; // edx@239
  int v108; // edx@240papredoll_flying_feet
  int v109; // edi@250
  char *v110; // edx@250
  unsigned int pCloakCollarNum; // eax@259
  ItemGen *item_CloakCollar; // eax@260
  int v114; // eax@265
  int v116; // ebx@274
        double v118; // st7@286
        int v119; // edi@287
        char *v120; // eax@287
        unsigned int v122; // edi@295
        int pHelmNum; // ebx@297
        ItemGen *item_Helm; // edi@298
        int v125; // ecx@303
        unsigned int v127; // ebx@314
        Texture *v129; // edi@325
        double v130; // st7@327
        int v131; // edi@328
        char *v132; // eax@328
        unsigned int pMainHandNum3; // eax@335
        ItemGen *item_MainHand3; // eax@336
        unsigned int v138; // ebx@339
        Texture *v140; // edi@348
        double v141; // st7@350
        int v142; // edi@351
        char *v143; // eax@351
        unsigned int pShieldNum; // eax@358
        ItemGen *item_Shield; // eax@359
        int v149; // edx@359
        int pX_Shield; // ebx@362
        int v151; // ecx@363
        int v152; // ecx@364
        unsigned int v153; // eax@370
        Texture *v157; // ebp@381
        double v158; // st7@383
        char *v160; // eax@386
        unsigned int pMainHandNum5; // eax@393
        ItemGen *item_MainHand5; // eax@394
        char *v166; // [sp-8h] [bp-54h]@16
        const char *v167; // [sp-8h] [bp-54h]@23
        const char *v168; // [sp-8h] [bp-54h]@43
        const char *v169; // [sp-8h] [bp-54h]@79
        const char *v170; // [sp-8h] [bp-54h]@111
        const char *v171; // [sp-8h] [bp-54h]@141
        const char *v172; // [sp-8h] [bp-54h]@177
        const char *v173; // [sp-8h] [bp-54h]@222
        const char *v178; // [sp-8h] [bp-54h]@242
        const char *v179; // [sp-8h] [bp-54h]@280
        const char *v180; // [sp-8h] [bp-54h]@321
        char *v181; // [sp-8h] [bp-54h]@337
        const char *v182; // [sp-8h] [bp-54h]@344
        const char *v183; // [sp-8h] [bp-54h]@375
        signed int v186; // [sp-4h] [bp-50h]@202
        signed int v191; // [sp-4h] [bp-50h]@266
        signed int v192; // [sp-4h] [bp-50h]@304
        int pY_MainHand4; // [sp+10h] [bp-3Ch]@15
        int pY_Bow; // [sp+10h] [bp-3Ch]@38
        unsigned int pY_Cloak; // [sp+10h] [bp-3Ch]@74
        unsigned int pY_Armor; // [sp+10h] [bp-3Ch]@106
        int pY_Boot; // [sp+10h] [bp-3Ch]@129
        int pY_Belt; // [sp+10h] [bp-3Ch]@168
        unsigned int pY_shoulder; // [sp+10h] [bp-3Ch]@216
        unsigned int pY_CloakCollar; // [sp+10h] [bp-3Ch]@274
        int pY_Helm; // [sp+10h] [bp-3Ch]@312
        int pY_MainHand3; // [sp+10h] [bp-3Ch]@336
        int pY_Shield; // [sp+10h] [bp-3Ch]@362
        Texture *a2b; // [sp+14h] [bp-38h]@49
        int pX_Cloak; // [sp+14h] [bp-38h]@74
        int pX_Armor; // [sp+14h] [bp-38h]@106
        int pX_Boot; // [sp+14h] [bp-38h]@129
        int pX_Belt; // [sp+14h] [bp-38h]@168
        int pX_shoulder; // [sp+14h] [bp-38h]@214
        int pX_CloakCollar; // [sp+14h] [bp-38h]@274
        Texture *a2i; // [sp+14h] [bp-38h]@284
        int pX_Helm; // [sp+14h] [bp-38h]@312
        int pX_MainHand3; // [sp+14h] [bp-38h]@336
        int pBodyComplection; // [sp+24h] [bp-28h]@6
        unsigned int pBowTextureNum; // [sp+2Ch] [bp-20h]@38
        signed int v245; // [sp+34h] [bp-18h]@361
        signed int IsDwarf; // [sp+40h] [bp-Ch]@4

  pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE);
  if (player->GetRace() == CHARACTER_RACE_DWARF)
  {
    IsDwarf = 1;
    pBodyComplection = player->GetSexByVoice() == SEX_MALE ? 2 : 3;
  }
  else
  {
    IsDwarf = 0;
    pBodyComplection = player->GetSexByVoice() == SEX_MALE ? 0 : 1;
  }

  int uPlayerID = 0;
  for (uint i = 0; i < 4; ++i)
    if (pPlayers[i + 1] == player)
    {
      uPlayerID = i + 1;
      break;
    }

  pRenderer->ResetTextureClipRect();
  pRenderer->DrawTextureIndexed(467, 0, pIcons_LOD->GetTexture(uTextureID_BACKDOLL));//Ïîäëîæêà
  if ( IsPlayerWearingWatersuit[uPlayerID] )//àêâàëàíã
  {
    pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]));
    if ( !bRingsShownInCharScreen )
      pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), player->pEquipment.uArmor);
    v6 = player->pEquipment.uMainHand;
    if ( !v6 || (v7 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[v6-1], pItemsTable->pItems[v7].uEquipType != 1)
         && (pItemsTable->pItems[v7].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) )
         pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1],
         pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1]));
    pMainHandNum4 = pPlayers[uPlayerID]->pEquipment.uMainHand;
    if ( pMainHandNum4 )
    {
      item_MainHand4 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum4 - 1];
      pX_MainHand4 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item_MainHand4->uItemID].uEquipX;
      pY_MainHand4 = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item_MainHand4->uItemID].uEquipY;
      if ( item_MainHand4->uItemID == 64 )  //blaster
        v166 = "item64v1";
      else
        v166 = pItemsTable->pItems[item_MainHand4->uItemID].pIconName;
      v14 = pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE);
      if ( !( item_MainHand4->uAttributes & 0xF0 ) )
      {
        v18 = v14 + 1;
        v19 = (char *)pIcons_LOD->GetTexture(v14);
        if ( item_MainHand4->uAttributes & 2 )
          pRenderer->DrawTransparentRedShade(pX_MainHand4, pY_MainHand4, (Texture *)v19);
        else
        {
          if ( item_MainHand4->uAttributes & 1 )
            pRenderer->DrawTextureTransparent(pX_MainHand4, pY_MainHand4, (Texture *)v19);
          else
            pRenderer->DrawTransparentGreenShade(pX_MainHand4, pY_MainHand4, (Texture *)v19);
        }
      }
      if ( item_MainHand4->uAttributes & 0xF0 )
      {
        if ( ( item_MainHand4->uAttributes & 0xF0) == 16 )
          v167 = "sptext01";
        if ( ( item_MainHand4->uAttributes & 0xF0) == 32 )
          v167 = "sp28a";
        if ( (item_MainHand4->uAttributes & 0xF0) == 64 )
          v167 = "sp30a";
        if ( (item_MainHand4->uAttributes & 0xF0) == 128 )
          v167 = "sp91a";
        v16 = pIcons_LOD->LoadTexturePtr(v167, TEXTURE_16BIT_PALETTE);
        _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
        if ( _50C9A8_item_enchantment_timer <= 0 )
        {
          _50C9A8_item_enchantment_timer = 0;
          item_MainHand4->uAttributes &= 0xFFFFFF0Fu;
          ptr_50C9A4 = 0;
        }
        v17 = (double)GetTickCount() * 0.1;
        pRenderer->_4A63E6(pX_MainHand4, pY_MainHand4, pIcons_LOD->GetTexture(v14), v16, (signed __int64)v17, 0, 255);
      }
      if ( !bRingsShownInCharScreen )
        pRenderer->DrawMaskToZBuffer(pX_MainHand4, pY_MainHand4, (Texture *)v19, pMainHandNum4);
    }
  }
  else// áåç àêâàëàíãà
  {
    pBowNum = pPlayers[uPlayerID]->pEquipment.uBow; //ñíà÷àëà ðèñóåòñÿ ëóê
    if ( pBowNum )
    {
      itemBow = &pPlayers[uPlayerID]->pInventoryItems[pBowNum - 1];
      pX_Bow = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][2][0] - pItemsTable->pItems[itemBow->uItemID].uEquipX;
      pY_Bow = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][2][1] - pItemsTable->pItems[itemBow->uItemID].uEquipY;
      pBowTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[itemBow->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
      if ( !(itemBow->uAttributes & 0xF0) )// åñëè íå ïðèìåí¸í çàêë
      {
        if ( itemBow->uAttributes & 2 )
          pRenderer->DrawTransparentRedShade(pX_Bow, pY_Bow, pIcons_LOD->GetTexture(pBowTextureNum));
        else
        {
          v30 = (char *)pIcons_LOD->GetTexture(pBowTextureNum);
          if ( !(itemBow->uAttributes & 1) )//íå îïîçíàííûé ëóê çåë¸íûé
            pRenderer->DrawTransparentGreenShade(pX_Bow, pY_Bow, (Texture *)v30);
          else // îïîçíàííûé ëóê
            pRenderer->DrawTextureTransparent(pX_Bow, pY_Bow, (Texture *)v30);
        }
      }
      else
      {
        if ( (itemBow->uAttributes & 0xF0) == 16 )
          v168 = "sptext01";
        if ( (itemBow->uAttributes & 0xF0) == 32 )
          v168 = "sp28a";
        if ( (itemBow->uAttributes & 0xF0) == 64 )
          v168 = "sp30a";
        if ( (itemBow->uAttributes & 0xF0) == 128 )
          v168 = "sp91a";
        a2b = pIcons_LOD->LoadTexturePtr(v168, TEXTURE_16BIT_PALETTE);
        _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
        if ( _50C9A8_item_enchantment_timer <= 0 )
        {
          _50C9A8_item_enchantment_timer = 0;
          itemBow->uAttributes &= 0xFFFFFF0Fu;
          ptr_50C9A4 = 0;
        }
        v28 = (double)GetTickCount() * 0.1;
        pRenderer->_4A63E6(pX_Bow, pY_Bow, pIcons_LOD->GetTexture(pBowTextureNum), a2b, (signed __int64)v28, 0, 255);
      }
      if ( !bRingsShownInCharScreen )
        pRenderer->DrawMaskToZBuffer(pX_Bow, pY_Bow, pIcons_LOD->GetTexture(pBowTextureNum), pBowNum);
    }
    pCloakNum = pPlayers[uPlayerID]->pEquipment.uCloak;// ïîòîì ïëàù
    if ( pCloakNum )
    {
      item_Cloak = &pPlayers[uPlayerID]->pInventoryItems[pCloakNum - 1];
      switch ( item_Cloak->uItemID )
      {
        case ITEM_RELIC_TWILIGHT:
          v33 = 5;
          break;
        case ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP:
          v33 = 6;
          break;
        case ITEM_RARE_SUN_CLOAK:
          v33 = 7;
          break;
        case ITEM_RARE_MOON_CLOAK:
          v33 = 8;
          break;
        case ITEM_RARE_VAMPIRES_CAPE:
          v33 = 9;
          break;
        default:
          v33 = item_Cloak->uItemID - 105;
          break;
      }
      if ( v33 >= 0 && v33 < 10 )
      {
        v35 = paperdoll_cloak_texture[pBodyComplection][v33];//Texture_Cloak
        pX_Cloak = pPaperdoll_BodyX + paperdoll_Cloak[pBodyComplection][v33][0];
        pY_Cloak = pPaperdoll_BodyY + paperdoll_Cloak[pBodyComplection][v33][1];
        if ( !(item_Cloak->uAttributes & 0xF0) )
        {
          v41 = v35 + 1;
          if ( item_Cloak->uAttributes & 2 )
            pRenderer->DrawTransparentRedShade(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35));
          else
            pRenderer->DrawTextureTransparent(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35));
        }
        else
        {
          if ( (item_Cloak->uAttributes & 0xF0) == 16 )
            v169 = "sptext01";
          if ( (item_Cloak->uAttributes & 0xF0) == 32 )
            v169 = "sp28a";
          if ( (item_Cloak->uAttributes & 0xF0) != 64 )
            v169 = "sp30a";
          if ( (item_Cloak->uAttributes & 0xF0) == 128 )
            v169 = "sp91a";
          v39 = pIcons_LOD->LoadTexturePtr(v169, TEXTURE_16BIT_PALETTE);
          _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
          if ( _50C9A8_item_enchantment_timer <= 0 )
          {
            _50C9A8_item_enchantment_timer = 0;
            item_Cloak->uAttributes &= 0xFFFFFF0Fu;
            ptr_50C9A4 = 0;
          }
          v40 = (double)GetTickCount() * 0.1;
          pRenderer->_4A63E6(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35), v39, (signed __int64)v40, 0, 255);
        }
        if ( !bRingsShownInCharScreen )
          pRenderer->DrawMaskToZBuffer(pX_Cloak, pY_Cloak, pIcons_LOD->GetTexture(v35), pCloakNum);
      }
    }
    pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY,//ðèñóåòñÿ êóêëà
            pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]));
    pArmorNum = pPlayers[uPlayerID]->pEquipment.uArmor;// ïîòîì áðîíÿ
    if ( pArmorNum )
    {
      item_Armor = &pPlayers[uPlayerID]->pInventoryItems[pArmorNum - 1];
      switch ( item_Armor->uItemID )
      {
        case 504:
          v45 = 15;
          break;
        case ITEM_ARTIFACT_YORUBA:
          v45 = 14;
          break;
        case ITEM_RELIC_HARECS_LEATHER:
          v45 = 13;
          break;
        case ITEM_ELVEN_CHAINMAIL:
          v45 = 16;
          break;
        default:
          v45 = item_Armor->uItemID - 66;
          break;
      }
      if ( v45 >= 0 && v45 < 17 )
      {
        pX_Armor = pPaperdoll_BodyX + paperdoll_Armor[pBodyComplection][v45][0];
        pY_Armor = pPaperdoll_BodyY + paperdoll_Armor[pBodyComplection][v45][1];
        v48 = paperdoll_armor_texture[pBodyComplection][v45][0];
        if ( !(item_Armor->uAttributes & 0xF0) )
        {
          v53 = v48 + 1;
          if ( item_Armor->uAttributes & 2 )
            pRenderer->DrawTransparentRedShade(pX_Armor, pY_Armor, pIcons_LOD->GetTexture(v48));
          else
          {
            v55 = (char *)&pIcons_LOD->pTextures[v48];
            if ( !(item_Armor->uAttributes & 1) )
              pRenderer->DrawTransparentGreenShade(pX_Armor, pY_Armor, (Texture *)v55);
            else
              pRenderer->DrawTextureTransparent(pX_Armor, pY_Armor, (Texture *)v55);
          }
        }
        else
        {
          if ( (item_Armor->uAttributes & 0xF0) == 16 )
            v170 = "sptext01";
          if ( (item_Armor->uAttributes & 0xF0) == 32 )
            v170 = "sp28a";
          if ( (item_Armor->uAttributes & 0xF0) == 64 )
            v170 = "sp30a";
          if ( (item_Armor->uAttributes & 0xF0) == 128 )
            v170 = "sp91a";
          v51 = pIcons_LOD->LoadTexturePtr(v170, TEXTURE_16BIT_PALETTE);
          _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
          if ( _50C9A8_item_enchantment_timer <= 0 )
          {
            _50C9A8_item_enchantment_timer = 0;
            item_Armor->uAttributes &= 0xFFFFFF0Fu;
            ptr_50C9A4 = 0;
          }
          v52 = (double)GetTickCount() * 0.1;
          pRenderer->_4A63E6(pX_Armor, pY_Armor, pIcons_LOD->GetTexture(v48), v51, (signed __int64)v52, 0, 255);
        }
        if ( pPlayers[uPlayerID]->pEquipment.uMainHand //äàëåå ïëå÷è áðîíè
          && (pPlayers[uPlayerID]->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_MAIN_HAND ||
           pPlayers[uPlayerID]->GetEquippedItemSkillType(EQUIP_MAIN_HAND) == EQUIP_SHIELD &&
          !pPlayers[uPlayerID]->pEquipment.uShield) )
        {
          v94 = paperdoll_armor_texture[pBodyComplection][v45][2];
          if ( v94 == pIcons_LOD->FindTextureByName("pending") )
          {
            v94 = paperdoll_armor_texture[pBodyComplection][v45][1];
            pX_shoulder = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][v45][0];
            pY_shoulder = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][v45][1];
          }
          else
          {
            pX_shoulder = pPaperdoll_BodyX + dword_4E5270[v45][0];
            pY_shoulder = pPaperdoll_BodyY + dword_4E5270[v45][1];
          }
          if ( !(item_Armor->uAttributes & 0xF0) )
          {
            v98 = v94 + 1;
            v99 = (char *)pIcons_LOD->GetTexture(v94);
            if ( item_Armor->uAttributes & 2 )
              pRenderer->DrawTransparentRedShade(pX_shoulder, pY_shoulder, (Texture *)v99);
            else
            {
              if ( item_Armor->uAttributes & 1 )
                pRenderer->DrawTextureTransparent(pX_shoulder, pY_shoulder, (Texture *)v99);
              else
                pRenderer->DrawTransparentGreenShade(pX_shoulder, pY_shoulder, (Texture *)v99);
            }
          }
          else
          {
            if ( v94 != pIcons_LOD->FindTextureByName("pending") )
            {
              if ( item_Armor->uAttributes & 0xF0 )
              {
                if ( (item_Armor->uAttributes & 0xF0) == ITEM_AURA_EFFECT_RED )
                  v173 = "sptext01";
                if ( (item_Armor->uAttributes & 0xF0) == ITEM_AURA_EFFECT_BLUE )
                  v173 = "sp28a";
                if ( ( item_Armor->uAttributes & 0xF0) == ITEM_AURA_EFFECT_GREEN )
                  v173 = "sp30a";
                if ( (item_Armor->uAttributes & 0xF0) == ITEM_AURA_EFFECT_PURPLE )
                  v173 = "sp91a";
                v96 = (char *)pIcons_LOD->LoadTexturePtr(v173, TEXTURE_16BIT_PALETTE);
                _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
                if ( _50C9A8_item_enchantment_timer <= 0 )
                {
                  _50C9A8_item_enchantment_timer = 0;
                  item_Armor->uAttributes &= 0xFFFFFF0Fu;
                  ptr_50C9A4 = 0;
                }
                v97 = (double)GetTickCount();
                pRenderer->_4A63E6(pX_shoulder, pY_shoulder, pIcons_LOD->GetTexture(v94), (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255);
              }
            }
          }
        }
        else
        {
          v94 = paperdoll_armor_texture[pBodyComplection][v45][1];
          if ( v94 != pIcons_LOD->FindTextureByName("pending") )
          {
            pX_ArmorShoulder = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][v45][0];
            pY_ArmorShoulder = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][v45][1];
            if ( !(item_Armor->uAttributes & 0xF0) )
            {
              v109 = v94 + 1;
              v110 = (char *)pIcons_LOD->GetTexture(v94);
              if ( item_Armor->uAttributes & 2 )
                pRenderer->DrawTransparentRedShade(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)v110);
              else
              {
                if ( item_Armor->uAttributes & 1 )
                  pRenderer->DrawTextureTransparent(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)v110);
                else
                  pRenderer->DrawTransparentGreenShade(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)v110);
              }
            }
            else
            {
              if ( (item_Armor->uAttributes & 0xF0) == 16 )
                v178 = "sptext01";
              if ( (item_Armor->uAttributes & 0xF0) == 32 )
                v178 = "sp28a";
              if ( (item_Armor->uAttributes & 0xF0) == 64 )
                v178 = "sp30a";
              if ( (item_Armor->uAttributes & 0xF0) == 128 )
                v178 = "sp91a";
              v96 = (char *)pIcons_LOD->LoadTexturePtr(v178, TEXTURE_16BIT_PALETTE);
              _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
              if ( _50C9A8_item_enchantment_timer <= 0 )
              {
                _50C9A8_item_enchantment_timer = 0;
                item_Armor->uAttributes &= 0xFFFFFF0Fu;
                ptr_50C9A4 = 0;
              }
              v97 = (double)GetTickCount();
              pRenderer->_4A63E6(pX_ArmorShoulder, pY_ArmorShoulder, pIcons_LOD->GetTexture(v94), (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255);
            }
          }
        }
        if ( !bRingsShownInCharScreen )
          pRenderer->DrawMaskToZBuffer(pX_Armor, pY_Armor, (Texture *)v55, pArmorNum);
      }
    }
    pBootNum = pPlayers[uPlayerID]->pEquipment.uBoot;//äàëåå îáóâü
    if ( pBootNum )
    {
      item_Boot = &pPlayers[uPlayerID]->pInventoryItems[pBootNum - 1];
      switch ( item_Boot->uItemID )
      {
        case 529:
          v60 = 5;
          v59 = papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace];
          break;
        case 512:
          v60 = 6;
          v59 = paperdoll_boots_texture[pBodyComplection][5];
          break;
        default:
          v60 = item_Boot->uItemID - 115;
          v59 = paperdoll_boots_texture[pBodyComplection][v60];
          break;
      }
      if ( v60 >= 0 && v60 < 7 )
      {
        pX_Boot = pPaperdoll_BodyX + paperdoll_Boot[pBodyComplection][v60][0];
        pY_Boot = pPaperdoll_BodyY + paperdoll_Boot[pBodyComplection][v60][1];
        if ( !(item_Boot->uAttributes & 0xF0) )
        {
          v65 = v59 + 1;
          v66 = (char *)pIcons_LOD->GetTexture(v59);
          if ( item_Boot->uAttributes & 2 )
            pRenderer->DrawTransparentRedShade(pX_Boot, pY_Boot, (Texture *)v66);
          else
          {
            if ( item_Boot->uAttributes & 1 )
              pRenderer->DrawTextureTransparent(pX_Boot, pY_Boot, (Texture *)v66);
            else
              pRenderer->DrawTransparentGreenShade(pX_Boot, pY_Boot, (Texture *)v66);
          }
        }
        else
        {
          if ( (item_Boot->uAttributes & 0xF0) == 16 )
            v171 = "sptext01";
          if ( (item_Boot->uAttributes & 0xF0) == 32 )
            v171 = "sp28a";
          if ( (item_Boot->uAttributes & 0xF0) == 64 )
            v171 = "sp30a";
          if ( (item_Boot->uAttributes & 0xF0) == 128 )
            v171 = "sp91a";
          v63 = pIcons_LOD->LoadTexturePtr(v171, TEXTURE_16BIT_PALETTE);
          _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
          if ( _50C9A8_item_enchantment_timer <= 0 )
          {
            _50C9A8_item_enchantment_timer = 0;
            item_Boot->uAttributes &= 0xFFFFFF0Fu;
            ptr_50C9A4 = 0;
          }
          v64 = (double)GetTickCount() * 0.1;
          pRenderer->_4A63E6(pX_Boot, pY_Boot, pIcons_LOD->GetTexture(v59), v63, (signed __int64)v64, 0, 255);
        }
        if ( !bRingsShownInCharScreen )
          pRenderer->DrawMaskToZBuffer(pX_Boot, pY_Boot, (Texture *)v66, pBootNum);
      }
    }
    pMainHandNum = pPlayers[uPlayerID]->pEquipment.uMainHand;
    if ( !pMainHandNum || (v70 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[pMainHandNum -1], pItemsTable->pItems[v70].uEquipType != 1)
        && (pItemsTable->pItems[v70].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) )
                pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0],
                                                  pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1],
                                                   pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1]));
        pBeltNum = pPlayers[uPlayerID]->pEquipment.uBelt;// äàëåå ïîÿñ
        if ( pBeltNum )
        {
          item_Belt = &pPlayers[uPlayerID]->pInventoryItems[pBeltNum - 1];
        switch ( item_Belt->uItemID )
        {
          case ITEM_RILIC_TITANS_BELT:
            v73 = 5;
            break;
          case ITEM_ARTIFACT_HEROS_BELT:
            v73 = 6;
            break;
          default:
            v73 = item_Belt->uItemID - 100;
            break;
        }
        if ( v73 >= 0 && v73 < 7 )
        {
          pX_Belt = pPaperdoll_BodyX + paperdoll_Belt[pBodyComplection][v73][0];
          pY_Belt = pPaperdoll_BodyY + paperdoll_Belt[pBodyComplection][v73][1];
          if ( IsDwarf != 1 || v73 == 5 )
            v75 = paperdoll_belt_texture[pBodyComplection][v73];
          else
           v75 = paperdoll_belt_texture[pBodyComplection - 2][v73];
          if ( !(item_Belt->uAttributes & 0xF0) )
          {
            v79 = v75 + 1;
            v80 = (char *)pIcons_LOD->GetTexture(v75);
            if ( item_Belt->uAttributes & 2 )
              pRenderer->DrawTransparentRedShade(pX_Belt, pY_Belt, (Texture *)v80);
            else
            {
              if ( item_Belt->uAttributes & 1 )
                pRenderer->DrawTextureTransparent(pX_Belt, pY_Belt, (Texture *)v80);
              else
                pRenderer->DrawTransparentGreenShade(pX_Belt, pY_Belt, (Texture *)v80);
            }
            if ( !bRingsShownInCharScreen )
              pRenderer->DrawMaskToZBuffer(pX_Belt, pY_Belt, (Texture *)v80, pBeltNum);
          }
          else
          {
            if ( (item_Belt->uAttributes & 0xF0) == 16 )
              v172 = "sptext01";
            if ( (item_Belt->uAttributes & 0xF0) == 32 )
              v172 = "sp28a";
            if ( (item_Belt->uAttributes & 0xF0) == 64 )
              v172 = "sp30a";
            if ( (item_Belt->uAttributes & 0xF0) == 128 )
              v172 = "sp91a";
            v77 = pIcons_LOD->LoadTexturePtr(v172, TEXTURE_16BIT_PALETTE);
            _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
            if ( _50C9A8_item_enchantment_timer <= 0 )
            {
              _50C9A8_item_enchantment_timer = 0;
              item_Belt->uAttributes &= 0xFFFFFF0Fu;
              ptr_50C9A4 = 0;
            }
            v78 = (double)GetTickCount() * 0.1;
            pRenderer->_4A63E6(pX_Belt, pY_Belt, pIcons_LOD->GetTexture(v75), v77, (signed __int64)v78, 0, 255);
          }
        }
      }
      pMainHandNum2 = pPlayers[uPlayerID]->pEquipment.uMainHand;
      if ( pMainHandNum2 )
      {
        v83 = pPlayers[uPlayerID]->pInventoryItems[pMainHandNum2 - 1].uItemID;
        if ( pItemsTable->pItems[v83].uEquipType == 1
             || pItemsTable->pItems[v83].uSkillType == PLAYER_SKILL_SPEAR && !pPlayers[uPlayerID]->pEquipment.uShield )
          pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0],
                                            pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1],
                                            pIcons_LOD->GetTexture(papredoll_dlaus[uPlayerID - 1]));
      }
      pCloakCollarNum = pPlayers[uPlayerID]->pEquipment.uCloak;//äàëåå âîðîòíèê ïëàùà
      if ( pCloakCollarNum )
      {
        item_CloakCollar = &pPlayers[uPlayerID]->pInventoryItems[pCloakCollarNum - 1];
        switch ( item_CloakCollar->uItemID )
        {
          case 525:
            v114 = 5;
            break;
          case 530:
            v114 = 6;
            break;
          case 547:
            v114 = 7;
            break;
          case 548:
            v114 = 8;
            break;
          case 550:
            v114 = 9;
            break;
          default:
            v114 = item_CloakCollar->uItemID - 105;
        }
        if ( v114 >= 0 && v114 < 10 )
        {
          v116 = paperdoll_cloak_collar_texture[pBodyComplection][v114];
          pX_CloakCollar = pPaperdoll_BodyX + paperdoll_CloakCollar[pBodyComplection][v114][0];
          pY_CloakCollar = pPaperdoll_BodyY + paperdoll_CloakCollar[pBodyComplection][v114][1];
          if ( v116 != pIcons_LOD->FindTextureByName("pending") )
          {
            if ( !(item_CloakCollar->uAttributes & 0xF0) )
            {
              v119 = v116 + 1;
              v120 = (char *)pIcons_LOD->GetTexture(v116);
              if ( item_CloakCollar->uAttributes & 2 )
                pRenderer->DrawTransparentRedShade(pX_CloakCollar, pY_CloakCollar, (Texture *)v120);
              else
                pRenderer->DrawTextureTransparent(pX_CloakCollar, pY_CloakCollar, (Texture *)v120);
              if ( !bRingsShownInCharScreen )
                pRenderer->DrawMaskToZBuffer(pX_CloakCollar, pY_CloakCollar, (Texture *)v120, pCloakCollarNum);
            }
            else
            {
              if ( (item_CloakCollar->uAttributes & 0xF0) == 16 )
                v179 = "sptext01";
              if ( (item_CloakCollar->uAttributes & 0xF0) == 32 )
                v179 = "sp28a";
              if ( (item_CloakCollar->uAttributes & 0xF0) == 64 )
                v179 = "sp30a";
              if ( (item_CloakCollar->uAttributes & 0xF0) == 128 )
                v179 = "sp91a";
              a2i = pIcons_LOD->LoadTexturePtr(v179, TEXTURE_16BIT_PALETTE);
              _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
              if ( _50C9A8_item_enchantment_timer <= 0 )
              {
                _50C9A8_item_enchantment_timer = 0;
                item_CloakCollar->uAttributes &= 0xFFFFFF0Fu;
                ptr_50C9A4 = 0;
              }
              v118 = (double)GetTickCount() * 0.1;
              pRenderer->_4A63E6(pX_CloakCollar, pY_CloakCollar, pIcons_LOD->GetTexture(v116), a2i, (signed __int64)v118, 0, 255);
            }
          }
        }
      }
      if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 )
      {
        v122 = papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace];
        if ( v122 != pIcons_LOD->FindTextureByName("Pending") )
          pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uCurrentFace - 24],
                     pPaperdoll_BodyY + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uCurrentFace - 23],
                     pIcons_LOD->GetTexture(v122));
      }
    pHelmNum = pPlayers[uPlayerID]->pEquipment.uHelm;//äàëåå øëåì
    if ( pHelmNum )
    {
      item_Helm = &pPlayers[uPlayerID]->pInventoryItems[pHelmNum-1];
      switch ( item_Helm->uItemID )
      {
        case 521:
          v125 = 11;
          break;
        case 522:
          v125 = 12;
          break;
        case 523:
          v125 = 13;
          break;
        case 532:
          v125 = 14;
          break;
        case 544:
          v125 = 15;
          break;
        default:
          v125 = item_Helm->uItemID - 89;
      }
      if ( v125 >= 0 && v125 < 16 )
      {
        pX_Helm = pPaperdoll_BodyX + paperdoll_Helm[pBodyComplection][v125][0];
        pY_Helm = pPaperdoll_BodyY + paperdoll_Helm[pBodyComplection][v125][1];
        if ( IsDwarf != 1 || item_Helm->uItemID != 92 )
          v127 = paperdoll_helm_texture[player->GetSexByVoice()][v125];
        else
          v127 = papredoll_dbrds[11];
        if ( item_Helm->uAttributes & 0xF0 )
        {
          if ( (item_Helm->uAttributes & 0xF0) == 16 )
            v180 = "sptext01";
          if ( (item_Helm->uAttributes & 0xF0) == 32 )
            v180 = "sp28a";
          if ( (item_Helm->uAttributes & 0xF0) == 64 )
            v180 = "sp30a";
          if ( (item_Helm->uAttributes & 0xF0) == 128 )
            v180 = "sp91a";
          v129 = pIcons_LOD->LoadTexturePtr(v180, TEXTURE_16BIT_PALETTE);
          _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
          if ( _50C9A8_item_enchantment_timer <= 0 )
          {
            _50C9A8_item_enchantment_timer = 0;
            item_Helm->uAttributes &= 0xFFFFFF0Fu;
            ptr_50C9A4 = 0;
          }
          v130 = (double)GetTickCount() * 0.1;
          pRenderer->_4A63E6(pX_Helm, pY_Helm, pIcons_LOD->GetTexture(v127), v129, (signed __int64)v130, 0, 255);
        }
        else
        {
          v131 = v127 + 1;
          v132 = (char *)pIcons_LOD->GetTexture(v127);
          if ( item_Helm->uAttributes & 2 )
            pRenderer->DrawTransparentRedShade(pX_Helm, pY_Helm, (Texture *)v132);
          else
          {
            if ( item_Helm->uAttributes & 1 )
              pRenderer->DrawTextureTransparent(pX_Helm, pY_Helm, (Texture *)v132);
            else
              pRenderer->DrawTransparentGreenShade(pX_Helm, pY_Helm, (Texture *)v132);
          }
        }
        if ( !bRingsShownInCharScreen )
          pRenderer->DrawMaskToZBuffer(pX_Helm, pY_Helm, (Texture *)v132, pHelmNum);
      }
    }
    pMainHandNum3 = pPlayers[uPlayerID]->pEquipment.uMainHand;//weapon in right hand
    if ( pMainHandNum3 )
    {
      item_MainHand3 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum3 - 1];
      pX_MainHand3 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item_MainHand3->uItemID].uEquipX;
      pY_MainHand3 = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item_MainHand3->uItemID].uEquipY;
      if ( item_MainHand3->uItemID == 64 )
        v181 = "item64v1";
      else
        v181 = pItemsTable->pItems[item_MainHand3->uItemID].pIconName;
      v138 = pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE);
      if ( !(item_MainHand3->uAttributes & 0xF0) )
      {
        v142 = v138 + 1;
        v143 = (char *)pIcons_LOD->GetTexture(v138);
        if ( item_MainHand3->uAttributes & 2 )
          pRenderer->DrawTransparentRedShade(pX_MainHand3, pY_MainHand3, (Texture *)v143);
        else
        {
          if ( item_MainHand3->uAttributes & 1 )
            pRenderer->DrawTextureTransparent(pX_MainHand3, pY_MainHand3, (Texture *)v143);
          else
            pRenderer->DrawTransparentGreenShade(pX_MainHand3, pY_MainHand3, (Texture *)v143);
        }
      }
      else
      {
        if ( (item_MainHand3->uAttributes & 0xF0) == 16 )
          v182 = "sptext01";
        if ( (item_MainHand3->uAttributes & 0xF0) == 32 )
          v182 = "sp28a";
        if ( (item_MainHand3->uAttributes & 0xF0) == 64 )
           v182 = "sp30a";
        if ( (item_MainHand3->uAttributes & 0xF0) == 128 )
          v182 = "sp91a";
        v140 = pIcons_LOD->LoadTexturePtr(v182, TEXTURE_16BIT_PALETTE);
        _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
        if ( _50C9A8_item_enchantment_timer <= 0 )
        {
          _50C9A8_item_enchantment_timer = 0;
          item_MainHand3->uAttributes &= 0xFFFFFF0Fu;
          ptr_50C9A4 = 0;
        }
        v141 = (double)GetTickCount() * 0.1;
        pRenderer->_4A63E6(pX_MainHand3, pY_MainHand3, pIcons_LOD->GetTexture(v138), v140, (signed __int64)v141, 0, 255);
      }
      if ( !bRingsShownInCharScreen )
        pRenderer->DrawMaskToZBuffer(pX_MainHand3, pY_MainHand3, (Texture *)v143, pMainHandNum3);
    }
    pShieldNum = pPlayers[uPlayerID]->pEquipment.uShield;// äàëåå ùèò
    if ( pShieldNum )
    {
      item_Shield = &pPlayers[uPlayerID]->pInventoryItems[pShieldNum - 1];
      v149 = pItemsTable->pItems[item_Shield->uItemID].uSkillType;
      if ( v149 == 2 || v149 == 1 )
      {
        v151 = item_Shield->uItemID - 400;
        pX_Shield = 596;
        v245 = 1;
        switch ( item_Shield->uItemID )
        {
          case 400:
            pY_Shield = 86;
            break;
          case 403:
            pY_Shield = 28;
            break;
          case 415:
            pX_Shield = 595;
            pY_Shield = 33;
            break;
          default:
            pX_Shield = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item_Shield->uItemID].uEquipX;
            pY_Shield = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item_Shield->uItemID].uEquipY;
            break;
        }
      }
      else
      {
        v245 = 0;
        pX_Shield = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item_Shield->uItemID].uEquipX;
        pY_Shield = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item_Shield->uItemID].uEquipY;
      }
      v153 = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_Shield->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
      if ( !(item_Shield->uAttributes & 0xF0) )
      {
        if ( item_Shield->uAttributes & 2 )
          pRenderer->DrawTransparentRedShade(pX_Shield, pY_Shield, pIcons_LOD->GetTexture(v153));
        else
        {
          v160 = (char *)pIcons_LOD->GetTexture(v153);
          if ( !(item_Shield->uAttributes & 1) )
          pRenderer->DrawTransparentGreenShade(pX_Shield, pY_Shield, (Texture *)v160);
          else
            pRenderer->DrawTextureTransparent(pX_Shield, pY_Shield, (Texture *)v160);
        }
      }
      else
      {
        if ( (item_Shield->uAttributes & 0xF0) == 16 )
          v183 = "sptext01";
        if ( (item_Shield->uAttributes & 0xF0) == 32 )
          v183 = "sp28a";
        if ( (item_Shield->uAttributes & 0xF0) == 64 )
          v183 = "sp30a";
        if ( (item_Shield->uAttributes & 0xF0) == 128 )
          v183 = "sp91a";
        v157 = pIcons_LOD->LoadTexturePtr(v183, TEXTURE_16BIT_PALETTE);
        _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
        if ( _50C9A8_item_enchantment_timer <= 0 )
        {
          _50C9A8_item_enchantment_timer = 0;
          item_Shield->uAttributes &= 0xFFFFFF0Fu;
          ptr_50C9A4 = 0;
        }
        v158 = (double)GetTickCount() * 0.1;
        pRenderer->_4A63E6(pX_Shield, pY_Shield, pIcons_LOD->GetTexture(v153), v157, (signed __int64)v158, 0, 255);
        if ( v245 )
          pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdollLeftEmptyHand[pBodyComplection][0],
                 pPaperdoll_BodyY + pPaperdollLeftEmptyHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlhs[uPlayerID - 1]));
      }
      if ( !bRingsShownInCharScreen )
        pRenderer->DrawMaskToZBuffer(pX_Shield, pY_Shield, pIcons_LOD->GetTexture(v153), pShieldNum);
    }
  }
  pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_RightHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_RightHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_drhs[uPlayerID - 1]));
  pMainHandNum5 = pPlayers[uPlayerID]->pEquipment.uMainHand;
  if ( pMainHandNum5 )
  {
    item_MainHand5 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum5 - 1];
    if ( pItemsTable->pItems[item_MainHand5->uItemID].uEquipType == 1 || 
        pItemsTable->pItems[item_MainHand5->uItemID].uSkillType == PLAYER_SKILL_SPEAR && 
         !pPlayers[uPlayerID]->pEquipment.uShield )
      pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], 
                                        pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], 
                                        pIcons_LOD->GetTexture(papredoll_dlhus[uPlayerID - 1]));
  }
  if ( !bRingsShownInCharScreen )//ðèñîâàíèå ëóïû
    pRenderer->DrawTextureTransparent(603, 299, pIcons_LOD->GetTexture(uTextureID_MAGNIF_B));
  pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop));//îáðàìëåíèå
}







//----- (0041A2D1) --------------------------------------------------------
void CharacterUI_InventoryTab_Draw(Player *player, bool a2)
{
        Texture *v7; // esi@6
        signed int v11; // edx@6
        int v13; // eax@13
        signed int v14; // edx@13
        int v15; // eax@13
        unsigned int v17; // edi@15
        Texture *pTexture; // ebx@24
        unsigned int uCellX; // [sp+30h] [bp-8h]@5
        unsigned int uCellY; // [sp+34h] [bp-4h]@5

  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_CharacterUI_InventoryBackground));
  if (a2)
    pRenderer->DrawTextureIndexed(8, 305, pIcons_LOD->LoadTexturePtr("fr_strip", TEXTURE_16BIT_PALETTE));

  int i = 0;
  for (uint i = 0; i < 126; ++i)
  {
    int v26 = (int)(player->pInventoryIndices + i);

    if (player->pInventoryIndices[i] <= 0)
      continue;

    int item_idx = player->pInventoryIndices[i];
    auto item = &player->pInventoryItems[item_idx - 1];
    if (!item->uItemID)
      continue;

    uCellY = 32 * (i / 14) + 17;
    uCellX = 32 * (i % 14) + 14;
    uint item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
    v7 = pIcons_LOD->GetTexture(item_texture_id);

                    v11 = v7->uTextureWidth;
                    if (v11 < 14)
                        v11 = 14;

                    if ( (v11 - 14) / 32 == 0 && v7->uTextureWidth < 32)
                        uCellX += (32 - v7->uTextureWidth) / 2;
                    v13 = v11 - 14;
                    LOBYTE(v13) = v13 & 0xE0;
                    v15 = v13 + 32;
                    v14 = v7->uTextureHeight;
                    if (v14 < 14 )
                        v14 = 14;
                    v17 = uCellX + ((v15 - v7->uTextureWidth) >> 1) + pSRZBufferLineOffsets[uCellY + (( (int)((v14 - 14) & 0xFFFFFFE0) - v7->uTextureHeight + 32) >> 1)];   //added typecast. without it the value in the brackets got cat to unsigned which messed stuff up

    if (item->uAttributes & 0xF0)
    {
      switch (item->uAttributes & 0xF0)
      {
        case ITEM_AURA_EFFECT_RED:    pTexture = pIcons_LOD->LoadTexturePtr("sptext01", TEXTURE_16BIT_PALETTE); break;
        case ITEM_AURA_EFFECT_BLUE:   pTexture = pIcons_LOD->LoadTexturePtr("sp28a", TEXTURE_16BIT_PALETTE);    break;
        case ITEM_AURA_EFFECT_GREEN:  pTexture = pIcons_LOD->LoadTexturePtr("sp30a", TEXTURE_16BIT_PALETTE);    break;
        case ITEM_AURA_EFFECT_PURPLE: pTexture = pIcons_LOD->LoadTexturePtr("sp91a", TEXTURE_16BIT_PALETTE);    break;
      }

      _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
      if (_50C9A8_item_enchantment_timer <= 0)
      {
        _50C9A8_item_enchantment_timer = 0;
        LOBYTE(item->uAttributes) &= 0xF;
        ptr_50C9A4 = 0;
      }

      pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, GetTickCount() * 0.1, 0, 255);
      ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx);
    }
    else
    {
      if (item->Identified() || pCurrentScreen != SCREEN_HOUSE)
      {
        if (item->Broken())
          pRenderer->DrawTransparentRedShade(uCellX, uCellY, v7);
        else
          pRenderer->DrawTextureTransparent(uCellX, uCellY, v7);
      }
      else
        pRenderer->DrawTransparentGreenShade(uCellX, uCellY, v7);

      ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx);
      continue;
    }
  }
}



static void CharacterUI_DrawItem(int x, int y, ItemGen *item, int id)
{
  auto item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);

  if (item->uAttributes & 0xF0) // enchant animation
  {
    Texture *enchantment_texture = nullptr;
    switch (item->uAttributes & 0xF0)
    {
      case ITEM_AURA_EFFECT_RED:    enchantment_texture = pIcons_LOD->LoadTexturePtr("sptext01", TEXTURE_16BIT_PALETTE); break;
      case ITEM_AURA_EFFECT_BLUE:   enchantment_texture = pIcons_LOD->LoadTexturePtr("sp28a", TEXTURE_16BIT_PALETTE);    break;
      case ITEM_AURA_EFFECT_GREEN:  enchantment_texture = pIcons_LOD->LoadTexturePtr("sp30a", TEXTURE_16BIT_PALETTE);    break;
      case ITEM_AURA_EFFECT_PURPLE: enchantment_texture = pIcons_LOD->LoadTexturePtr("sp91a", TEXTURE_16BIT_PALETTE);    break;
    }

    _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed;
    if (_50C9A8_item_enchantment_timer <= 0)
    {
      _50C9A8_item_enchantment_timer = 0;
      item->uAttributes &= 0xFFFFFF0F;
      ptr_50C9A4 = 0;
    }
    pRenderer->_4A63E6(x, y, item_texture, enchantment_texture, GetTickCount() * 0.1, 0, 255);
  }
  else
  {
    if (item->Broken())
      pRenderer->DrawTransparentRedShade(x, y, item_texture);
    else if (!item->Identified())
      pRenderer->DrawTransparentGreenShade(x, y, item_texture);
    else
      pRenderer->DrawTextureTransparent(x, y, item_texture);

    pRenderer->ZBuffer_Fill_2(x, y, item_texture, id);
  }
}


//----- (0043E825) --------------------------------------------------------
void CharacterUI_DrawPaperdollWithRingOverlay(Player *player)
{
  CharacterUI_DrawPaperdoll(player);

  pRenderer->DrawTextureTransparent(0x1D9u, 0, pIcons_LOD->GetTexture(uTextureID_BACKHAND));
  pRenderer->DrawTextureTransparent(0x1D4u, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop));
  pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX,
                                pCharacterScreen_DetalizBtn->uY,
                                pIcons_LOD->GetTexture(uTextureID_detaliz_close_button));

  for (uint i = 0; i < 6; ++i)
  {
    if (!player->pEquipment.uRings[i])
      continue;
    
    static int pPaperdollRingsX[6] = {0x1EA, 0x21A, 0x248, 0x1EA, 0x21A, 0x248};
    static int pPaperdollRingsY[6] = {0x0CA, 0x0CA, 0x0CA, 0x0FA, 0x0FA, 0x0FA};

    CharacterUI_DrawItem(pPaperdollRingsX[i],
                         pPaperdollRingsY[i],
                         &player->pInventoryItems[player->pEquipment.uRings[i] - 1],
                         player->pEquipment.uRings[i]);
  }


  if (player->pEquipment.uAmulet)
  {
    CharacterUI_DrawItem(493, 91,
                         &player->pInventoryItems[player->pEquipment.uAmulet - 1],
                         player->pEquipment.uAmulet);
  }

  if (player->pEquipment.uGlove)
  {
    CharacterUI_DrawItem(586, 88,
                         &player->pInventoryItems[player->pEquipment.uGlove - 1],
                         player->pEquipment.uGlove);
  }
}

//----- (0043BCA7) --------------------------------------------------------
void CharacterUI_LoadPaperdollTextures()
{
  int v0; // edi@7
  enum CHARACTER_RACE pRace; // ebx@7
  signed int pSex; // eax@7
  int v3; // ebx@10
  Player *pPlayer; // edi@12
  unsigned __int8 v5; // cl@12
  int v6; // edi@16
  unsigned int v7; // eax@16
  Player *pPlayer2; // ebx@16
  char *v9; // ebx@16
  char v10; // al@16
  signed int v11; // edi@21
  unsigned int v22; // eax@76
  int v23; // ecx@76
  unsigned int v24; // eax@78
  int v25; // ecx@78
  int v26; // ebx@79
  unsigned int v27; // eax@80
  int v28; // ecx@80
  int v30; // [sp+10h] [bp-28h]@5
  signed int v32; // [sp+10h] [bp-28h]@75
  signed int v33; // [sp+10h] [bp-28h]@77
  int v34; // [sp+10h] [bp-28h]@79
  int pItemTXTNum; // [sp+14h] [bp-24h]@75
  int v37; // [sp+14h] [bp-24h]@77
  signed int v38; // [sp+14h] [bp-24h]@79
  int v42; // [sp+20h] [bp-18h]@6
  int v43; // [sp+20h] [bp-18h]@73
  char pContainer[128]; // [sp+24h] [bp-14h]@12

  uTextureID_MAGNIF_B = pIcons_LOD->LoadTexture("MAGNIF-B", TEXTURE_16BIT_PALETTE);
  //if ( !pParty->uAlignment || pParty->uAlignment == 1 || pParty->uAlignment == 2 )
  uTextureID_BACKDOLL = pIcons_LOD->LoadTexture("BACKDOLL", TEXTURE_16BIT_PALETTE);
  uTextureID_right_panel_loop = uTextureID_right_panel;
  v30 = 0;
  uTextureID_BACKHAND = pIcons_LOD->LoadTexture("BACKHAND", TEXTURE_16BIT_PALETTE);
  uTextureID_detaliz_close_button = uExitCancelTextureId;
  do
  {
    v42 = v30 + 1;
    if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(v30 + 1) )
    {
      v0 = v30;
      pRace = pPlayers[v30 + 1]->GetRace();
      pSex = pPlayers[v30 + 1]->GetSexByVoice();
      if ( pRace && pRace != 1 && pRace != 2 )//race == 3
        v3 = (pSex != 0) + 3;
      else
        v3 = (pSex != 0) + 1;
      wsprintfA(pContainer, "pc23v%dBod", v3);
      papredoll_dbods[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);//Body texture
      wsprintfA(pContainer, "pc23v%dlad", v3);
      papredoll_dlads[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Hand
      wsprintfA(pContainer, "pc23v%dlau", v3);
      papredoll_dlaus[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Hand2
      wsprintfA(pContainer, "pc23v%drh", v3);
      papredoll_drhs[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Right Hand
      wsprintfA(pContainer, "pc23v%dlh", v3);
      papredoll_dlhs[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);// Left Fist
      wsprintfA(pContainer, "pc23v%dlhu", v3);
      papredoll_dlhus[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); // Left Fist 2
      pPlayer = pPlayers[v0 + 1];
      v5 = pPlayer->uCurrentFace;
      if ( v5 == 12 || v5 == 13 )
        papredoll_dbrds[(char)v5] = 0;
      papredoll_flying_feet[pPlayer->uCurrentFace] = 0;
      IsPlayerWearingWatersuit[v30 + 1] = 1;
    }
    else
    {
      papredoll_dbods[v30] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
      papredoll_dlads[v30] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
      papredoll_dlaus[v30] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
      papredoll_drhs[v30] = pIcons_LOD->LoadTexture(drh_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
      papredoll_dlhs[v30] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
      papredoll_dlhus[v30] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
      v10 = pPlayers[v30 + 1]->uCurrentFace;
      if ( v10 == 12 || v10 == 13 )
      {
        wsprintfA(pContainer, "pc%02dbrd", v10 + 1);
        papredoll_dbrds[v10] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      }
      wsprintfA(pContainer, "item281pc%02d", v10 + 1);
      papredoll_flying_feet[pPlayers[v30 + 1]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      IsPlayerWearingWatersuit[v30 + 1] = 0;
    }
    ++v30;
  }
  while ( v42 < 4 );
  uTextureID_ar_up_up = pIcons_LOD->LoadTexture("ar_up_up", TEXTURE_16BIT_PALETTE);
  uTextureID_ar_up_dn = pIcons_LOD->LoadTexture("ar_up_dn", TEXTURE_16BIT_PALETTE);
  uTextureID_ar_dn_up = pIcons_LOD->LoadTexture("ar_dn_up", TEXTURE_16BIT_PALETTE);
  uTextureID_ar_dn_dn = pIcons_LOD->LoadTexture("ar_dn_dn", TEXTURE_16BIT_PALETTE);
  papredoll_dbrds[9] = pIcons_LOD->LoadTexture("ib-cd1-d", TEXTURE_16BIT_PALETTE);
  papredoll_dbrds[7] = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE);
  papredoll_dbrds[5] = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE);
  papredoll_dbrds[3] = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE);
  papredoll_dbrds[1] = pIcons_LOD->LoadTexture("ib-cd5-d", TEXTURE_16BIT_PALETTE);
  for ( v11 = 0; v11 < 54; ++v11 )// test equipment
  {
    party_has_equipment[v11] = 0;
    if ( pParty->pPickedItem.uItemID != v11 + 66 )
    {
      for ( uint i = 0; i < 4; ++i)
      {
        if ( Player_has_item(v11 + 66, &pParty->pPlayers[i], 0) )
          party_has_equipment[v11] = 1;
      }
    }
  }
  memset(byte_5111F6.data(), 0, 16);
  for (uint i = 0; i < 4; ++i)
  {
    auto player = pParty->pPlayers + i;

    if (Player_has_item(ITEM_ARTICACT_GOVERNONS_ARMOR, player, 1))    byte_5111F6[0] = 1;
    if (Player_has_item(ITEM_ARTIFACT_YORUBA, player, 1))             byte_5111F6[1] = 1;
    if (Player_has_item(ITEM_RELIC_HARECS_LEATHER, player, 1))        byte_5111F6[2] = 1;
    if (Player_has_item(ITEM_ARTIFACT_LEAGUE_BOOTS, player, 1))       byte_5111F6[3] = 1;
    if (Player_has_item(ITEM_RELIC_TALEDONS_HELM, player, 1))         byte_5111F6[4] = 1;
    if (Player_has_item(ITEM_RELIC_SCHOLARS_CAP, player, 1))          byte_5111F6[5] = 1;
    if (Player_has_item(ITEM_RELIC_PHYNAXIAN_CROWN, player, 1))       byte_5111F6[6] = 1;
    if (Player_has_item(ITEM_ARTIFACT_MINDS_EYE, player, 1))          byte_5111F6[7] = 1;
    if (Player_has_item(ITEM_RARE_SHADOWS_MASK, player, 1))           byte_5111F6[8] = 1;
    if (Player_has_item(ITEM_RILIC_TITANS_BELT, player, 1))           byte_5111F6[9] = 1;
    if (Player_has_item(ITEM_ARTIFACT_HEROS_BELT, player, 1))         byte_5111F6[10] = 1;
    if (Player_has_item(ITEM_RELIC_TWILIGHT, player, 1))              byte_5111F6[11] = 1;
    if (Player_has_item(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, player, 1)) byte_5111F6[12] = 1;
    if (Player_has_item(ITEM_RARE_SUN_CLOAK, player, 1))              byte_5111F6[13] = 1;
    if (Player_has_item(ITEM_RARE_MOON_CLOAK, player, 1))             byte_5111F6[14] = 1;
    if (Player_has_item(ITEM_RARE_VAMPIRES_CAPE, player, 1))          byte_5111F6[15] = 1;
    if (Player_has_item(ITEM_ELVEN_CHAINMAIL, player, 1))             byte_5111F6[16] = 1;
  }


  for (uint i = 0; i < 2; ++i)
  {
    for ( uint j = 0; j < 5; ++j )//Belt
    {
      GetItemTextureFilename(pContainer, j + 100, i + 1, 0);
      paperdoll_belt_texture[i][j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    }
    GetItemTextureFilename(pContainer, 535, i + 1, 0);
    paperdoll_belt_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    for ( uint j = 0; j < 11; ++j )//Helm
    {
      GetItemTextureFilename(pContainer, j + 89, i + 1, 0);
      paperdoll_helm_texture[i][j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    }
    GetItemTextureFilename(pContainer, 521, i + 1, 0);
    paperdoll_helm_texture[i][11] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    GetItemTextureFilename(pContainer, 522, i + 1, 0);
    paperdoll_helm_texture[i][12] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    GetItemTextureFilename(pContainer, 523, i + 1, 0);
    paperdoll_helm_texture[i][13] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    GetItemTextureFilename(pContainer, 532, i + 1, 0);
    paperdoll_helm_texture[i][14] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    GetItemTextureFilename(pContainer, 544, i + 1, 0);
    paperdoll_helm_texture[i][15] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    if ( _43ED6F_check_party_races(true) )
      papredoll_dbrds[11] = pIcons_LOD->LoadTexture("item092v3", TEXTURE_16BIT_PALETTE);
  }
  v43 = 0;
  for (uint i = 0; i < 4; ++i)
  {
    if ( sub_43EDB9_get_some_race_sex_relation_2(i) )
    {
      GetItemTextureFilename(pContainer, 524, i + 1, 0);
      paperdoll_belt_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);//Titans belt
      pItemTXTNum = 66;
      for ( v32 = 0; v32 < 13; ++v32 )//simple armor
      {
        GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 0);
        paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
        GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 1);
        paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
        GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 2);
        paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
        pItemTXTNum++;
      }
      GetItemTextureFilename(pContainer, 516, i + 1, 0);//artefacts
      paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 516, i + 1, 1);
      paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 516, i + 1, 2);
      paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 505, i + 1, 0);
      paperdoll_armor_texture[i][v32 + 1][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 505, i + 1, 1);
      paperdoll_armor_texture[i][v32 + 1][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 505, i + 1, 2);
      paperdoll_armor_texture[i][v32 + 1][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 504, i + 1, 0);
      paperdoll_armor_texture[i][v32 + 2][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 504, i + 1, 1);
      paperdoll_armor_texture[i][v32 + 2][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 504, i + 1, 2);
      paperdoll_armor_texture[i][v32 + 2][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 533, i + 1, 0);
      paperdoll_armor_texture[i][v32 + 3][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 533, i + 1, 1);
      paperdoll_armor_texture[i][v32 + 3][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 533, i + 1, 2);
      paperdoll_armor_texture[i][v32 + 3][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      for ( v33 = 0; v33 < 5; ++v33 )//boots
      {
        GetItemTextureFilename(pContainer, v33 + 115, i + 1, 0);
        paperdoll_boots_texture[i][v33] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      }
      GetItemTextureFilename(pContainer, 512, i + 1, 0);
      paperdoll_boots_texture[i][v33] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      for ( v38 = 0; v38 < 5; ++v38 )//Cloak
      {
        GetItemTextureFilename(pContainer, v38 + 105, i + 1, 0);
        paperdoll_cloak_texture[i][v38] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
        GetItemTextureFilename(pContainer, v38 + 105, i + 1, 1);
        paperdoll_cloak_collar_texture[i][v38] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      }
      GetItemTextureFilename(pContainer, 525, i + 1, 0);
      paperdoll_cloak_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 530, i + 1, 0);
      paperdoll_cloak_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 547, i + 1, 0);
      paperdoll_cloak_texture[i][7] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 548, i + 1, 0);
      paperdoll_cloak_texture[i][8] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 550, i + 1, 0);
      paperdoll_cloak_texture[i][9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 525, i + 1, 1);
      paperdoll_cloak_collar_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 530, i + 1, 1);
      paperdoll_cloak_collar_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 547, i + 1, 1);
      paperdoll_cloak_collar_texture[i][7] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 548, i + 1, 1);
      paperdoll_cloak_collar_texture[i][8] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
      GetItemTextureFilename(pContainer, 550, i + 1, 1);
      paperdoll_cloak_collar_texture[i][9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
    }
    else
    {
      v26 = v43;
    }
    v43 = v26 + 40;
  }
}

//----- (00419401) --------------------------------------------------------
void CharacterUI_SkillsTab_CreateButtons()
    {
    // unsigned int v0; // ecx@3
    GUIButton *pButton; // eax@3
    unsigned int current_Y; // esi@8
    int buttons_count; // [sp+10h] [bp-14h]@1
    int first_rows; // [sp+14h] [bp-10h]@19
    int skill_id; // [sp+18h] [bp-Ch]@8
    Player *curr_player; // [sp+1Ch] [bp-8h]@8
    int i;
    int uCurrFontHeght;

    buttons_count = 0;
    if ( dword_507CC0_activ_ch )
        CharacterUI_ReleaseButtons();
    dword_507CC0_activ_ch = uActiveCharacter;
    for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext )
        {
        if ( pButton->msg == UIMSG_InventoryLeftClick )
            {
            dword_50698C_uX = pButton->uX;
            dword_506988_uY = pButton->uY;
            dword_506984_uZ = pButton->uZ;
            dword_506980_uW = pButton->uW;
            pButton->uW = 0;
            pButton->uZ = 0;
            pButton->uY = 0;
            pButton->uX = 0;
            }
        }
    first_rows = 0;
    //  a5 = pGUIWindow_CurrentMenu->uNumControls;
    curr_player = &pParty->pPlayers[uActiveCharacter-1];

    uCurrFontHeght=pFontLucida->uFontHeight;
    current_Y = 2 *uCurrFontHeght  + 13;
    for(i=0; i<9;++i)
        {
        skill_id = pWeaponSkills[i];
        if ( curr_player->pActiveSkills[skill_id] & 0x3F )
            {
            current_Y += uCurrFontHeght - 3;
            ++buttons_count;
            ++first_rows;
            pGUIWindow_CurrentMenu->CreateButton(24, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0);
            }
        }
    if ( !first_rows )
        current_Y += uCurrFontHeght - 3;        
    current_Y += 2 * uCurrFontHeght - 6;
    for(i=0; i<9;++i)       
        {
        skill_id = pMagicSkills[i];
        if ( curr_player->pActiveSkills[skill_id] & 0x3F && buttons_count < 15 )
            {
            current_Y += uCurrFontHeght - 3;
            ++buttons_count;
            pGUIWindow_CurrentMenu->CreateButton(24, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0);
            }
        }
    first_rows = 0;      
    current_Y = 2 * uCurrFontHeght + 13;
    for(i=0; i<5;++i) 
        {
        skill_id = pArmorSkills[i];
        if ( curr_player->pActiveSkills[skill_id] & 0x3F )
            {
            current_Y+= uCurrFontHeght - 3;
            ++buttons_count;
            ++first_rows;
            pGUIWindow_CurrentMenu->CreateButton(246, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0);
            }
        }
    if ( !first_rows )
        current_Y += uCurrFontHeght - 3;           
    current_Y += 2 * uCurrFontHeght - 6;
    for(i=0; i<12; ++i)
        {
        skill_id = pMiscSkills[i];
        if ( curr_player->pActiveSkills[skill_id] & 0x3F )
            {
            current_Y += uCurrFontHeght - 3;
            ++buttons_count;
            pGUIWindow_CurrentMenu->CreateButton(246, current_Y, 204, uCurrFontHeght - 3, 3, skill_id | 0x8000, UIMSG_SkillUp, skill_id, 0, "", 0, 0);
            }
        }

    if ( buttons_count )
        pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(buttons_count, 1, 0, pGUIWindow_CurrentMenu->uNumControls);
    }



//----- (00418511) --------------------------------------------------------
    void CharacterUI_StatsTab_Draw( Player *player )
        {
        //Player *pPlayer; // edi@1
        //unsigned int v4; // eax@2
        int v7; // ebp@4
        int v8; // eax@4
        unsigned int v9; // eax@4
        int v10; // ST34_4@4
        int v13; // ebp@4
        int v14; // eax@4
        unsigned int v15; // eax@4
        int v19; // ebp@4
        int v20; // eax@4
        unsigned int v21; // eax@4
        int v25; // ebp@4
        int v26; // eax@4
        unsigned int v27; // eax@4
        int v31; // ebp@4
        int v32; // eax@4
        unsigned int v33; // eax@4
        int v37; // ebp@4
        int v38; // eax@4
        unsigned int v39; // eax@4
        int v43; // ebp@4
        int v44; // eax@4
        unsigned int v45; // eax@4
        signed int v49; // eax@6
        unsigned int v50; // eax@6
        int v53; // eax@8
        unsigned int v54; // eax@8
        int v58; // ebp@8
        int v59; // eax@8
        unsigned int v60; // eax@8
        unsigned int v62; // eax@8
        signed int v64; // eax@8
        //unsigned __int8 v66; // al@8
        char *v67; // eax@9
        signed int v70; // ebp@11
        signed int v71; // eax@11
        unsigned int v72; // eax@11
        int v75; // ebp@13
        int v76; // eax@13
        unsigned int v77; // eax@13
        char *v78; // ecx@14
        unsigned int v81; // eax@16
        int v83; // eax@16
        char *v85; // eax@16
        int v87; // eax@16
        char *v89; // eax@16
        int v90; // eax@16
        unsigned int v92; // eax@19
        int v93; // eax@19
        unsigned int v95; // eax@22
        int v96; // eax@22
        unsigned int v98; // eax@25
        int v99; // eax@25
        unsigned int v101; // eax@27
        int v102; // eax@27
        unsigned int v104; // eax@30
        unsigned int v106; // eax@32
        int v107; // eax@33
        unsigned int v109; // eax@36
        unsigned int v111; // eax@38
        const char *a2; // [sp+14h] [bp-Ch]@4
        const char *a2a; // [sp+14h] [bp-Ch]@6
        const char *a2b; // [sp+14h] [bp-Ch]@11
        const char *a2c; // [sp+14h] [bp-Ch]@16
        const char *a2d; // [sp+14h] [bp-Ch]@19
        const char *a2e; // [sp+14h] [bp-Ch]@22
        const char *a2f; // [sp+14h] [bp-Ch]@25
        const char *a2g; // [sp+14h] [bp-Ch]@27
        const char *a2h; // [sp+14h] [bp-Ch]@33
        int v131; // [sp+18h] [bp-8h]@16
        int v132; // [sp+18h] [bp-8h]@19
        int v133; // [sp+18h] [bp-8h]@22
        int v134; // [sp+18h] [bp-8h]@25
        int v135; // [sp+18h] [bp-8h]@27
        int v136; // [sp+18h] [bp-8h]@33

        //pPlayer = &pParty->pPlayers[uPlayerID-1];
        //pPlayer = player;
  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_stats", TEXTURE_16BIT_PALETTE));
  sprintf(pTmpBuf.data(), "\f%05d", ui_character_header_text_color);
  sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]);//"^Pi[%s] %s" / "%s the %s"
  strcat(pTmpBuf.data(), pTmpBuf2.data());
  sprintfex(pTmpBuf2.data(),  "\f00000\r180%s: \f%05d%d\f00000\n\n\n",
            pGlobalTXT_LocalizationStrings[207], // "Skill points"
            player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color,
            player->uSkillPoints);
  strcat(pTmpBuf.data(), pTmpBuf2.data());
  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 18, 0, pTmpBuf.data(), 0, 0, 0);

  v10 = 53;
  v7 = player->GetBaseStrength();
  v8 = player->GetActualMight();
  v9 = UI_GetHealthManaStringColor(v8, v7);
  sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[144], v9, v8, v7);//Might
  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);

  v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
  v13 = player->GetBaseIntelligence();
  v14 = player->GetActualIntelligence();
  v15 = UI_GetHealthManaStringColor(v14, v13);
  sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[116], v15, v14, v13);//Intellect
  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);

  v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
  v19 = player->GetBaseWillpower();
  v20 = player->GetActualWillpower();
  v21 = UI_GetHealthManaStringColor(v20, v19);
  sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[163], v21, v20, v19);//
  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);

  v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
  v25 = player->GetBaseEndurance();
  v26 = player->GetActualEndurance();
  v27 = UI_GetHealthManaStringColor(v26, v25);
  sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[75], v27, v26, v25);//
  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);

  v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
  v31 = player->GetBaseAccuracy();
  v32 = player->GetActualAccuracy();
  v33 = UI_GetHealthManaStringColor(v32, v31);
  sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[1], v33, v32, v31);
  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);

        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        v37 = player->GetBaseSpeed();
        v38 = player->GetActualSpeed();
        v39 = UI_GetHealthManaStringColor(v38, v37);
        sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[211], v39, v38, v37);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);

        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        v43 = player->GetBaseLuck();
        v44 = player->GetActualLuck();
        v45 = UI_GetHealthManaStringColor(v44, v43);
        sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[136], v45, v44, v43);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);

        a2 = "%s\f%05u\r424%d\f00000 /\t185%d\n";
        v10 += 2 * LOBYTE(pFontArrus->uFontHeight) + 5;
        if ( player->GetMaxHealth() >= 1000 )
            a2 = "%s\f%05u\r388%d\f00000 / %d\n";
        v49 = player->GetMaxHealth();
        v50 = UI_GetHealthManaStringColor(player->sHealth, v49);
        sprintf(pTmpBuf.data(), a2, pGlobalTXT_LocalizationStrings[108], v50, player->sHealth, v49);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);

        a2a = "%s\f%05u\r424%d\f00000 /\t185%d\n";
        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        if ( player->GetMaxMana() >= 1000 )
            a2a = "%s\f%05u\r388%d\f00000 / %d\n";
        v53 = player->GetMaxMana();
        v54 = UI_GetHealthManaStringColor(player->sMana, v53);
        sprintf(pTmpBuf.data(), a2a, pGlobalTXT_LocalizationStrings[212], v54, player->sMana, v53);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);

        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        v58 = player->GetBaseAC();
        v59 = player->GetActualAC();
        v60 = UI_GetHealthManaStringColor(v59, v58);
        sprintf(pTmpBuf.data(), "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[12], v60, v59, v58);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf.data(), 0, 0, 0);

        v10 += 2 * LOBYTE(pFontArrus->uFontHeight) - 2;
        v62 = player->GetMajorConditionIdx();
        v64 = GetConditionDrawColor(v62);
        sprintf(pTmpBuf.data(), "%s: \f%05d%s\n", pGlobalTXT_LocalizationStrings[47], v64, aCharacterConditionNames[v62]);
        pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v10, 0, pTmpBuf.data(), 226, 0);

        v10 += LOBYTE(pFontArrus->uFontHeight) + - 1;
        if (player->uQuickSpell)
            v67 = pSpellStats->pInfos[player->uQuickSpell].pShortName;
        else
            v67 = pGlobalTXT_LocalizationStrings[153];
        sprintf(pTmpBuf.data(), "%s: %s", pGlobalTXT_LocalizationStrings[172], v67);
        pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v10, 0, pTmpBuf.data(), 226, 0);

        v10 = 50;
        v70 = player->GetBaseAge();
        v71 = player->GetActualAge();
        v72 = UI_GetHealthManaStringColor(v71, v70);
        sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[5], v72, v71, v70);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);

        a2b = "%s\f%05u\t100%d\f00000 / %d\n";
        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        if ( player->GetBaseLevel() > 99 )
            a2b = "%s\f%05u\t180%d\f00000 / %d\n";
        v75 = player->GetBaseLevel();
        v76 = player->GetActualLevel();
        v77 = UI_GetHealthManaStringColor(v76, v75);
        sprintf(pTmpBuf.data(), a2b, pGlobalTXT_LocalizationStrings[131], v77, v76, v75);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);

        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        if (player->uExperience <= 9999999)
            v78 = pGlobalTXT_LocalizationStrings[83]; // "Experience"
        else
            v78 = pGlobalTXT_LocalizationStrings[17]; // "Exp."
        v81 = player->GetExperienceDisplayColor();
        sprintf(pTmpBuf.data(), "%s\r180\f%05d%lu\f00000\n\n", v78, v81, LODWORD(player->uExperience));
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);

        v10 += 2 * LOBYTE(pFontArrus->uFontHeight);
        v83 = player->GetActualAttack(0);
        sprintf(pTmpBuf.data(), "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[18], v83);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);

        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        v85 = player->GetMeleeDamageString();
        sprintf(pTmpBuf.data(), "%s\t100 %s\n", pGlobalTXT_LocalizationStrings[53], v85);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);

        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        v87 = player->GetRangedAttack();
        sprintf(pTmpBuf.data(), "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[203], v87);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);

        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        v89 = player->GetRangedDamageString();
        sprintf(pTmpBuf.data(), "%s\t100 %s\n\n", pGlobalTXT_LocalizationStrings[53], v89);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);

        a2c = format_4E2E10;
        v10 += 2 * LOBYTE(pFontArrus->uFontHeight) - 4;
        v131 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE);
        v90 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE);
        if ( v131 > 99 || v90 > 99 )
            a2c = "%s\f%05u\t180%d\f00000 / %d\n";
        v92 = UI_GetHealthManaStringColor(v131, v90);
        sprintf(pTmpBuf.data(), a2c, pGlobalTXT_LocalizationStrings[87], v92, v131, v90);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);

        a2d = format_4E2E10;
        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        v132 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR);
        v93 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR);
        if ( v132 > 99 || v93 > 99 )
            a2d = "%s\f%05u\t180%d\f00000 / %d\n";
        v95 = UI_GetHealthManaStringColor(v132, v93);
        sprintf(pTmpBuf.data(), a2d, pGlobalTXT_LocalizationStrings[6], v95, v132, v93);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);

        a2e = format_4E2E10;
        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        v133 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER);
        v96 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER);
        if ( v133 > 99 || v96 > 99 )
            a2e = "%s\f%05u\t180%d\f00000 / %d\n";
        v98 = UI_GetHealthManaStringColor(v133, v96);
        sprintf(pTmpBuf.data(), a2e, pGlobalTXT_LocalizationStrings[240], v98, v133, v96);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);

        a2f = format_4E2E10;
        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        v134 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
        v99 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH);
        if ( v134 > 99 )
            a2f = "%s\f%05u\t180%d\f00000 / %d\n";
        v101 = UI_GetHealthManaStringColor(v134, v99);
        sprintf(pTmpBuf.data(), a2f, pGlobalTXT_LocalizationStrings[70], v101, v134, v99);
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);

        a2g = format_4E2E10;
        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        v135 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
        v102 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND);
        if ( v135 > 99 || v102 > 99 )
            a2g = "%s\f%05u\t180%d\f00000 / %d\n";
        v104 = UI_GetHealthManaStringColor(v135, v102);
        sprintf(pTmpBuf.data(), a2g, pGlobalTXT_LocalizationStrings[142], v104, v135, v102);
        if ( player->classType == PLAYER_CLASS_LICH && v102 == 200 )
        {
            v106 = UI_GetHealthManaStringColor(v135, 200);
            sprintf(pTmpBuf.data(), format_4E2E00, pGlobalTXT_LocalizationStrings[142], v106, pGlobalTXT_LocalizationStrings[625]);
        }
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);

        a2h = format_4E2E10;
        v10 += LOBYTE(pFontArrus->uFontHeight) - 2;
        v136 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
        v107 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY);
        if ( v136 > 99 || v107 > 99 )
            a2h = "%s\f%05u\t180%d\f00000 / %d\n";
        v109 = UI_GetHealthManaStringColor(v136, v107);
        sprintf(pTmpBuf.data(), a2h, pGlobalTXT_LocalizationStrings[29], v109, v136, v107);
        if ( player->classType == PLAYER_CLASS_LICH && v107 == 200 )
        {
            v111 = UI_GetHealthManaStringColor(v136, 200);
            sprintf(pTmpBuf.data(), format_4E2E00, pGlobalTXT_LocalizationStrings[29], v111, pGlobalTXT_LocalizationStrings[625]);
        }
        pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf.data(), 0, 0, 0);
}

bool awardSort (int i,int j) { 
    if (pAwards[i].uPriority == 0)  //none
    {
        return false;
    }
    else if (pAwards[j].uPriority == 0)
    {
        return true;
    }
    else if(pAwards[i].uPriority == 1)  //fines,arena stuff,etc
    {
        return false;
    }
    else if(pAwards[j].uPriority == 1)
    {
        return true;
    }
    else if(pAwards[i].uPriority == 5) //joined guilds
    {
        return false;
    }
    else if(pAwards[j].uPriority == 5)
    {
        return true;
    }
    else
    {
        return (pAwards[i].uPriority<pAwards[j].uPriority);
    }
}

//----- (00419100) --------------------------------------------------------
void FillAwardsData()
{
        auto pPlayer = pPlayers[uActiveCharacter];

        memset(achieved_awards.data(), 0, 4000);
        num_achieved_awards = 0;

        memset(pTmpBuf2.data(), 0, 0x7D0u);
        BtnDown_flag = 0;
        BtnUp_flag = 0;
        dword_50651C = 0;
        dword_506528 = 0;
        for (int i = 0; i < 105; ++i)
        {
            if ( _449B57_test_bit(pPlayer->_guilds_member_bits, i) && pAwards[i].pText )
            {
                achieved_awards[num_achieved_awards++] = (AwardType)i;
            }
        }
        num_achieved_awards_2 = num_achieved_awards;
        num_achieved_awards = 0;

        //sort awards index 
        if (num_achieved_awards_2 > 0)
        {
            std::stable_sort(achieved_awards.begin(), achieved_awards.end(), awardSort);
        }
    }


//----- (0043EF2B) --------------------------------------------------------
void WetsuitOn( unsigned int uPlayerID )
    { 
    CHARACTER_RACE player_race; // edi@2
    signed int player_sex; // eax@2
    int texture_num; // ecx@5
    char pContainer[20]; // [sp+4h] [bp-1Ch]@7
 
    if ( uPlayerID> 0 )
        {
        player_race = pPlayers[uPlayerID]->GetRace();
        player_sex = pPlayers[uPlayerID]->GetSexByVoice();
        if ( player_race == CHARACTER_RACE_DWARF  )
            texture_num = (player_sex != 0) + 3;
        else 
            texture_num = (player_sex != 0) + 1;
        wsprintfA(pContainer, "pc23v%dBod", texture_num);
        papredoll_dbods[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
        wsprintfA(pContainer, "pc23v%dlad", texture_num);
        papredoll_dlads[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
        wsprintfA(pContainer, "pc23v%dlau", texture_num);
        papredoll_dlaus[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
        wsprintfA(pContainer, "pc23v%drh", texture_num);
        papredoll_drhs[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
        wsprintfA(pContainer, "pc23v%dlh", texture_num);
        papredoll_dlhs[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
        wsprintfA(pContainer, "pc23v%dlhu", texture_num);
        papredoll_dlhus[uPlayerID - 1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);

        if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 )
            papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace] = 0;

        papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace] = 0;
        IsPlayerWearingWatersuit[uPlayerID] = 1;
        }
    }

//----- (0043F0BD) --------------------------------------------------------
void WetsuitOff( unsigned int uPlayerID )
    {
    char pContainer[20]; // [sp+0h] [bp-18h]@4

    if (uPlayerID > 0 )
        {
        papredoll_dbods[uPlayerID - 1] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE);
        papredoll_dlads[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE);
        papredoll_dlaus[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE);
        papredoll_drhs [uPlayerID - 1] = pIcons_LOD->LoadTexture(drh_texnames_by_face [pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE);
        papredoll_dlhs [uPlayerID - 1] = pIcons_LOD->LoadTexture(dlh_texnames_by_face [pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE);
        papredoll_dlhus[uPlayerID - 1] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[uPlayerID]->uCurrentFace], TEXTURE_16BIT_PALETTE);

        if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 )
            {
            wsprintfA(pContainer, "pc%02dbrd", pPlayers[uPlayerID]->uCurrentFace + 1);
            papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
            }
        wsprintfA(pContainer, "item281pc%02d", pPlayers[uPlayerID]->uCurrentFace + 1);
        papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
        IsPlayerWearingWatersuit[uPlayerID] = 0;
        }
    }