comparison UI/UIPopup.cpp @ 2195:70b63fe6587c

fixing a few bugs reported by PVS
author Grumpy7
date Thu, 30 Jan 2014 23:03:04 +0100
parents c13ae8d8471f
children 3f375342de12
comparison
equal deleted inserted replaced
2194:d0e321190c86 2195:70b63fe6587c
290 else if (inspect_item->GetItemEquipType() == EQUIP_REAGENT) 290 else if (inspect_item->GetItemEquipType() == EQUIP_REAGENT)
291 sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], inspect_item->GetDamageDice()); //"Power" 291 sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], inspect_item->GetDamageDice()); //"Power"
292 else if ( inspect_item->uEnchantmentType ) 292 else if ( inspect_item->uEnchantmentType )
293 sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->m_enchantmentStrength); //"Special" 293 sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->m_enchantmentStrength); //"Special"
294 else if ( inspect_item->uSpecEnchantmentType ) 294 else if ( inspect_item->uSpecEnchantmentType )
295 sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement, inspect_item->m_enchantmentStrength); 295 sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement);
296 else if ( inspect_item->uNumCharges ) 296 else if ( inspect_item->uNumCharges )
297 sprintf(out_text + 200, "%s: %lu", pGlobalTXT_LocalizationStrings[464], inspect_item->uNumCharges); //"Charges" 297 sprintf(out_text + 200, "%s: %lu", pGlobalTXT_LocalizationStrings[464], inspect_item->uNumCharges); //"Charges"
298 } 298 }
299 iteminfo_window.uFrameWidth -= 12; 299 iteminfo_window.uFrameWidth -= 12;
300 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; 300 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
448 DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18 448 DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18
449 DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18 449 DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18
450 RECT v84; // [sp+ECh] [bp-100h]@26 450 RECT v84; // [sp+ECh] [bp-100h]@26
451 const char *string_name[10]; // [sp+FCh] [bp-F0h]@145 451 const char *string_name[10]; // [sp+FCh] [bp-F0h]@145
452 const char *content[11]; // [sp+124h] [bp-C8h]@127 452 const char *content[11]; // [sp+124h] [bp-C8h]@127
453 unsigned char resistances[11]; // [sp+124h] [bp-C8h]@127
453 RenderBillboardTransform_local0 v106; // [sp+150h] [bp-9Ch]@3 454 RenderBillboardTransform_local0 v106; // [sp+150h] [bp-9Ch]@3
454 unsigned int v107; // [sp+1A0h] [bp-4Ch]@18 455 unsigned int v107; // [sp+1A0h] [bp-4Ch]@18
455 unsigned __int16 *v108; // [sp+1A4h] [bp-48h]@34 456 unsigned __int16 *v108; // [sp+1A4h] [bp-48h]@34
456 unsigned int v109; // [sp+1A8h] [bp-44h]@32 457 unsigned int v109; // [sp+1A8h] [bp-44h]@32
457 LPVOID v110; // [sp+1ACh] [bp-40h]@28 458 LPVOID v110; // [sp+1ACh] [bp-40h]@28
732 grandmaster_level = 1;// 733 grandmaster_level = 1;//
733 for_effects = 1; 734 for_effects = 1;
734 } 735 }
735 736
736 window->DrawText(pFontSmallnum, 12, 196, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[631], 0, 0, 0);//Effects 737 window->DrawText(pFontSmallnum, 12, 196, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[631], 0, 0, 0);//Effects
737 if ( !for_effects ) 738 if ( !for_effects && false)
738 window->DrawText(pFontSmallnum, 28, LOBYTE(pFontSmallnum->uFontHeight) + 193, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[630], 0, 0, 0);//? 739 window->DrawText(pFontSmallnum, 28, LOBYTE(pFontSmallnum->uFontHeight) + 193, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[630], 0, 0, 0);//?
739 else 740 else
740 { 741 {
741 pText = ""; 742 pText = "";
742 pTextHeight = LOBYTE(pFontSmallnum->uFontHeight) + 193; 743 pTextHeight = LOBYTE(pFontSmallnum->uFontHeight) + 193;
743 for ( uint i = 1; i <= 21; ++i ) 744 for ( uint i = 1; i <= 21; ++i )
744 { 745 {
745 if ( pActors[uActorID].pActorBuffs[i].uExpireTime > 0 ) 746 if ( pActors[uActorID].pActorBuffs[i].uExpireTime > 0 )
746 { 747 {
747 switch ( i - 1 ) 748 switch ( i )
748 { 749 {
749 case 0: 750 case ACTOR_BUFF_CHARM:
750 pTextColorID = 60; 751 pTextColorID = 60;
751 pText = pGlobalTXT_LocalizationStrings[591];//Charmed 752 pText = pGlobalTXT_LocalizationStrings[591];//Charmed
752 break; 753 break;
753 case 1: 754 case ACTOR_BUFF_SUMMONED:
754 pTextColorID = 82; 755 pTextColorID = 82;
755 pText = pGlobalTXT_LocalizationStrings[649];//Summoned 756 pText = pGlobalTXT_LocalizationStrings[649];//Summoned
756 break; 757 break;
757 case 2: 758 case ACTOR_BUFF_SHRINK:
758 pTextColorID = 92; 759 pTextColorID = 92;
759 pText = pGlobalTXT_LocalizationStrings[592];//Shrunk 760 pText = pGlobalTXT_LocalizationStrings[592];//Shrunk
760 break; 761 break;
761 case 3: 762 case ACTOR_BUFF_AFRAID:
762 pTextColorID = 63; 763 pTextColorID = 63;
763 pText = pGlobalTXT_LocalizationStrings[4];//Afraid 764 pText = pGlobalTXT_LocalizationStrings[4];//Afraid
764 break; 765 break;
765 case 4: 766 case ACTOR_BUFF_STONED:
766 pText = pGlobalTXT_LocalizationStrings[220];//Stoned 767 pText = pGlobalTXT_LocalizationStrings[220];//Stoned
767 pTextColorID = 81; 768 pTextColorID = 81;
768 break; 769 break;
769 case 5: 770 case ACTOR_BUFF_PARALYZED:
770 pText = pGlobalTXT_LocalizationStrings[162];//Paralyzed 771 pText = pGlobalTXT_LocalizationStrings[162];//Paralyzed
771 pTextColorID = 81; 772 pTextColorID = 81;
772 break; 773 break;
773 case 6: 774 case ACTOR_BUFF_SLOWED:
774 pText = pGlobalTXT_LocalizationStrings[593];//Slowed 775 pText = pGlobalTXT_LocalizationStrings[593];//Slowed
775 pTextColorID = 35; 776 pTextColorID = 35;
776 break; 777 break;
777 case 8: 778 case ACTOR_BUFF_BERSERK:
778 pText = pGlobalTXT_LocalizationStrings[608];//Berserk 779 pText = pGlobalTXT_LocalizationStrings[608];//Berserk
779 pTextColorID = 62; 780 pTextColorID = 62;
780 break; 781 break;
781 case 7: 782 case ACTOR_BUFF_SOMETHING_THAT_HALVES_AC:
782 case 9: 783 case ACTOR_BUFF_MASS_DISTORTION:
783 pText = ""; 784 pText = "";
784 pTextColorID = 0; 785 pTextColorID = 0;
785 continue; 786 continue;
786 case 10: 787 case ACTOR_BUFF_FATE:
787 pTextColorID = 47; 788 pTextColorID = 47;
788 pText = pGlobalTXT_LocalizationStrings[221];//Fate 789 pText = pGlobalTXT_LocalizationStrings[221];//Fate
789 break; 790 break;
790 case 11: 791 case ACTOR_BUFF_ENSLAVED:
791 pTextColorID = 66; 792 pTextColorID = 66;
792 pText = pGlobalTXT_LocalizationStrings[607];//Enslaved 793 pText = pGlobalTXT_LocalizationStrings[607];//Enslaved
793 break; 794 break;
794 case 12: 795 case ACTOR_BUFF_DAY_OF_PROTECTION:
795 pTextColorID = 85; 796 pTextColorID = 85;
796 pText = pGlobalTXT_LocalizationStrings[610];//Day of Protection 797 pText = pGlobalTXT_LocalizationStrings[610];//Day of Protection
797 break; 798 break;
798 case 13: 799 case ACTOR_BUFF_HOUR_OF_POWER:
799 pTextColorID = 86; 800 pTextColorID = 86;
800 pText = pGlobalTXT_LocalizationStrings[609];//Hour of Power 801 pText = pGlobalTXT_LocalizationStrings[609];//Hour of Power
801 break; 802 break;
802 case 14: 803 case ACTOR_BUFF_SHIELD:
803 pTextColorID = 17; 804 pTextColorID = 17;
804 pText = pGlobalTXT_LocalizationStrings[279];//Shield 805 pText = pGlobalTXT_LocalizationStrings[279];//Shield
805 break; 806 break;
806 case 15: 807 case ACTOR_BUFF_STONESKIN:
807 pTextColorID = 38; 808 pTextColorID = 38;
808 pText = pGlobalTXT_LocalizationStrings[442];//Stoneskin 809 pText = pGlobalTXT_LocalizationStrings[442];//Stoneskin
809 break; 810 break;
810 case 16: 811 case ACTOR_BUFF_BLESS:
811 pTextColorID = 46; 812 pTextColorID = 46;
812 pText = pGlobalTXT_LocalizationStrings[443];//Bless 813 pText = pGlobalTXT_LocalizationStrings[443];//Bless
813 break; 814 break;
814 case 17: 815 case ACTOR_BUFF_HEROISM:
815 pTextColorID = 51; 816 pTextColorID = 51;
816 pText = pGlobalTXT_LocalizationStrings[440];//Heroism 817 pText = pGlobalTXT_LocalizationStrings[440];//Heroism
817 break; 818 break;
818 case 18: 819 case ACTOR_BUFF_HASTE:
819 pTextColorID = 5; 820 pTextColorID = 5;
820 pText = pGlobalTXT_LocalizationStrings[441];//Haste 821 pText = pGlobalTXT_LocalizationStrings[441];//Haste
821 break; 822 break;
822 case 19: 823 case ACTOR_BUFF_PAIN_REFLECTION:
823 pTextColorID = 95; 824 pTextColorID = 95;
824 pText = pGlobalTXT_LocalizationStrings[229];//Pain Reflection 825 pText = pGlobalTXT_LocalizationStrings[229];//Pain Reflection
825 break; 826 break;
826 case 20: 827 case ACTOR_BUFF_PAIN_HAMMERHANDS:
827 pTextColorID = 73; 828 pTextColorID = 73;
828 pText = pGlobalTXT_LocalizationStrings[228];//Hammerhands 829 pText = pGlobalTXT_LocalizationStrings[228];//Hammerhands
829 break; 830 break;
830 default: 831 default:
831 pText = ""; 832 pText = "";
832 break; 833 break;
833 } 834 }
834 if ( pText != "" ) 835 if ( _stricmp(pText, "" ))
835 { 836 {
836 window->DrawText(pFontSmallnum, 28, pTextHeight, GetSpellColor(pTextColorID), pText, 0, 0, 0); 837 window->DrawText(pFontSmallnum, 28, pTextHeight, GetSpellColor(pTextColorID), pText, 0, 0, 0);
837 pTextHeight = pTextHeight + *(char *)((int)pFontSmallnum + 5) - 3; 838 pTextHeight = pTextHeight + *(char *)((int)pFontSmallnum + 5) - 3;
838 } 839 }
839 } 840 }
840 } 841 }
841 if ( pText == "" ) 842 if ( !_stricmp(pText,"" ))
842 window->DrawText(pFontSmallnum, 28, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[153], 0, 0, 0);//Νες 843 window->DrawText(pFontSmallnum, 28, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[153], 0, 0, 0);//Νες
843 } 844 }
844 845
845 if ( normal_level ) 846 if ( normal_level )
846 { 847 {
849 pTextHeight = v106.uViewportY + LOBYTE(pFontSmallnum->uFontHeight) - 3; 850 pTextHeight = v106.uViewportY + LOBYTE(pFontSmallnum->uFontHeight) - 3;
850 sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[12], 0, pActors[uActorID].pMonsterInfo.uAC);//Armor Class 851 sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[12], 0, pActors[uActorID].pMonsterInfo.uAC);//Armor Class
851 } 852 }
852 else 853 else
853 { 854 {
854 sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]);//? 855 sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]);//? - [630] actually displays a question mark
855 window->DrawText(pFontSmallnum, 150, (int)v106.uViewportY, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); 856 window->DrawText(pFontSmallnum, 150, (int)v106.uViewportY, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0);
856 pTextHeight = v106.uViewportY + LOBYTE(pFontSmallnum->uFontHeight) - 3; 857 pTextHeight = v106.uViewportY + LOBYTE(pFontSmallnum->uFontHeight) - 3;
857 sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[12], 0, (unsigned int)pGlobalTXT_LocalizationStrings[630]);//? 858 sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[12], 0, pGlobalTXT_LocalizationStrings[630]);//? - [630] actually displays a question mark
858 } 859 }
859 window->DrawText(pFontSmallnum, 150, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); 860 window->DrawText(pFontSmallnum, 150, pTextHeight, Color16(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0);
860 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 6 + LOBYTE(pFontSmallnum->uFontHeight); 861 pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 6 + LOBYTE(pFontSmallnum->uFontHeight);
861 862
862 content[0] = pGlobalTXT_LocalizationStrings[87]; 863 content[0] = pGlobalTXT_LocalizationStrings[87];
936 string_name[6] = pGlobalTXT_LocalizationStrings[29]; 937 string_name[6] = pGlobalTXT_LocalizationStrings[29];
937 string_name[7] = pGlobalTXT_LocalizationStrings[133]; 938 string_name[7] = pGlobalTXT_LocalizationStrings[133];
938 string_name[8] = pGlobalTXT_LocalizationStrings[54]; 939 string_name[8] = pGlobalTXT_LocalizationStrings[54];
939 string_name[9] = pGlobalTXT_LocalizationStrings[624]; 940 string_name[9] = pGlobalTXT_LocalizationStrings[624];
940 941
941 content[0] = (char *)pActors[uActorID].pMonsterInfo.uResFire; 942 resistances[0] = pActors[uActorID].pMonsterInfo.uResFire;
942 content[1] = (char *)pActors[uActorID].pMonsterInfo.uResAir; 943 resistances[1] = pActors[uActorID].pMonsterInfo.uResAir;
943 content[2] = (char *)pActors[uActorID].pMonsterInfo.uResWater; 944 resistances[2] = pActors[uActorID].pMonsterInfo.uResWater;
944 content[3] = (char *)pActors[uActorID].pMonsterInfo.uResEarth; 945 resistances[3] = pActors[uActorID].pMonsterInfo.uResEarth;
945 content[4] = (char *)pActors[uActorID].pMonsterInfo.uResMind; 946 resistances[4] = pActors[uActorID].pMonsterInfo.uResMind;
946 content[5] = (char *)pActors[uActorID].pMonsterInfo.uResSpirit; 947 resistances[5] = pActors[uActorID].pMonsterInfo.uResSpirit;
947 content[6] = (char *)pActors[uActorID].pMonsterInfo.uResBody; 948 resistances[6] = pActors[uActorID].pMonsterInfo.uResBody;
948 content[7] = (char *)pActors[uActorID].pMonsterInfo.uResLight; 949 resistances[7] = pActors[uActorID].pMonsterInfo.uResLight;
949 content[8] = (char *)pActors[uActorID].pMonsterInfo.uResPhysical; 950 resistances[8] = pActors[uActorID].pMonsterInfo.uResPhysical;
950 content[9] = (char *)pActors[uActorID].pMonsterInfo.uResDark; 951 resistances[9] = pActors[uActorID].pMonsterInfo.uResDark;
951 952
952 if ( grandmaster_level ) 953 if ( grandmaster_level )
953 { 954 {
954 for ( uint i = 0; i < 10; i++ ) 955 for ( uint i = 0; i < 10; i++ )
955 { 956 {
956 if ( content[i] == (char *)200 ) 957 if ( resistances[i] == 200 )
957 { 958 {
958 pText = pGlobalTXT_LocalizationStrings[625];//Immune 959 pText = pGlobalTXT_LocalizationStrings[625];//Immune
959 } 960 }
960 else 961 else
961 { 962 {
962 if ( content[i] ) 963 if ( resistances[i] )
963 pText = pGlobalTXT_LocalizationStrings[627];//Resistant 964 pText = pGlobalTXT_LocalizationStrings[627];//Resistant
964 else 965 else
965 pText = pGlobalTXT_LocalizationStrings[153];//None 966 pText = pGlobalTXT_LocalizationStrings[153];//None
966 } 967 }
967 sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", string_name[i], 0, pText); 968 sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", string_name[i], 0, pText);