changeset 809:7bb33867d2cb

Pv[] in sprintfex
author Ritor1
date Tue, 26 Mar 2013 00:09:21 +0600
parents a49b8df4de89
children d6e84d158052 35c31a49d989
files Player.cpp UICharacter.cpp UIPopup.cpp UiGame.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7text_ru.cpp
diffstat 8 files changed, 56 insertions(+), 96 deletions(-) [+]
line wrap: on
line diff
--- a/Player.cpp	Mon Mar 25 22:04:39 2013 +0600
+++ b/Player.cpp	Tue Mar 26 00:09:21 2013 +0600
@@ -1489,7 +1489,7 @@
   }
   else
   {
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName);
+    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName);
     ShowStatusBarString(pTmpBuf, 2u);
     result = 0;
   }
@@ -3597,7 +3597,7 @@
       v25 = pGlobalTXT_LocalizationStrings[377];
     }
     v23 = pTmpBuf2;
-    sprintf(pTmpBuf2, v25, v26);
+    sprintfex(pTmpBuf2, v25, v26);
     goto LABEL_43;
   }
   return 0;
@@ -7293,10 +7293,10 @@
       case 0x10Fu:
         v3->sAgeModifier = 0;
         goto LABEL_112;
+      case 0xDDu:
+        goto LABEL_172;
       default:
         goto LABEL_167;
-      case 0xDDu:
-        goto LABEL_172;
     }
     goto LABEL_172;
   }
@@ -7544,7 +7544,7 @@
       v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
       v58 = pGlobalTXT_LocalizationStrings[382];
 LABEL_90:
-      sprintf(pTmpBuf, v58, v68);
+      sprintfex(pTmpBuf, v58, v68);
       v23 = pTmpBuf;
 LABEL_91:
       ShowStatusBarString(v23, 2u);
@@ -7600,7 +7600,7 @@
             if ( v75 > v21 || !*v17 )
             {
               v22 = pParty->pPickedItem.GetDisplayName();
-              sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22);
+              sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22);
               ShowStatusBarString(pTmpBuf, 2u);
               v65 = 0;
               v56 = 20;
--- a/UICharacter.cpp	Mon Mar 25 22:04:39 2013 +0600
+++ b/UICharacter.cpp	Tue Mar 26 00:09:21 2013 +0600
@@ -3996,7 +3996,7 @@
         pRenderer->DrawTextureIndexed(8, 8, (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0));
         v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
         sprintf(pTmpBuf, "\f%05d", v3);
-        sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], pPlayer->pName, pClassNames[pPlayer->classType]);//^Pi[%s] %s
+        sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], pPlayer->pName, pClassNames[pPlayer->classType]);//^Pi[%s] %s
         strcat(pTmpBuf, pTmpBuf2);
         if ( pPlayer->uSkillPoints )
             v4 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0);
--- a/UIPopup.cpp	Mon Mar 25 22:04:39 2013 +0600
+++ b/UIPopup.cpp	Tue Mar 26 00:09:21 2013 +0600
@@ -1767,7 +1767,7 @@
             if ( v15 > v14->uLevel )
                 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[147], v15);
             v16 = sub_4B46F8(v15) - LODWORD(v14->uExperience);
-            sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[538], v16, v15 + 1);
+            sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[538], v16, v15 + 1);
             strcat(pTmpBuf, "\n");
             strcat(pTmpBuf, pTmpBuf2);
             LOBYTE(_y) = sprintf(pTmpBuf2, "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf);
--- a/UiGame.cpp	Mon Mar 25 22:04:39 2013 +0600
+++ b/UiGame.cpp	Tue Mar 26 00:09:21 2013 +0600
@@ -626,7 +626,7 @@
       }
       v31 = pSpriteObjects[v30].stru_24.GetDisplayName();
       v28 = pTmpBuf;
-      sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[470], v31);// "Get %s"
+      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[470], v31);// "Get %s"
     }
     else
     {
--- a/mm7_3.cpp	Mon Mar 25 22:04:39 2013 +0600
+++ b/mm7_3.cpp	Tue Mar 26 00:09:21 2013 +0600
@@ -1729,113 +1729,74 @@
   v82 = (unsigned __int64)(pEventTimer->dt_in_some_format
                          * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi)
                                           / 180)) >> 16;
-LABEL_87:
+//LABEL_87:
   while ( pPartyActionQueue->uNumActions )
   {
     switch ( pPartyActionQueue->Next() )
     {
       case PARTY_TurnLeft:
-        v12 = uTurnSpeed;
         if ( uTurnSpeed )
-          goto LABEL_58;
-        v13 = (double)v82 * fTurnSpeedMultiplier;
-        v14 = angle + (unsigned __int64)(signed __int64)v13;
+        {
+          v14 = angle + uTurnSpeed;
+          angle = stru_5C6E00->uDoublePiMask & v14;
+          break;
+        }
+        v14 = angle + (unsigned __int64)(signed __int64)(double)v82 * fTurnSpeedMultiplier;
         angle = stru_5C6E00->uDoublePiMask & v14;
-        goto LABEL_87;
+        break;
       case PARTY_TurnRight:
-        LODWORD(v15) = uTurnSpeed;
         if ( uTurnSpeed )
         {
-          angle = stru_5C6E00->uDoublePiMask & (angle - v15);
-          goto LABEL_87;
+          angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed);
+          break;
         }
         v16 = (double)v82 * fTurnSpeedMultiplier;
-        //{
-        v15 = (signed __int64)v16;
-        angle = stru_5C6E00->uDoublePiMask & (angle - v15);
-        goto LABEL_87;
-        //}
+        angle = stru_5C6E00->uDoublePiMask & (angle - (signed __int64)v16);
+        break;
       case PARTY_FastTurnLeft:
-        v12 = uTurnSpeed;
         if ( uTurnSpeed )
         {
-LABEL_58:
-          v14 = angle + v12;
+          v14 = angle + uTurnSpeed;
         }
         else
         {
-          v13 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82;
-          v14 = angle + (unsigned __int64)(signed __int64)v13;
+          v14 = angle + (unsigned __int64)(signed __int64)(fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82;
         }
         angle = stru_5C6E00->uDoublePiMask & v14;
-        goto LABEL_87;
+        break;
       case PARTY_FastTurnRight:
         LODWORD(v15) = uTurnSpeed;
         if ( !uTurnSpeed )
         {
-          v16 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82;
-          v15 = (signed __int64)v16;
+          v15 = (signed __int64)(fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82;
         }
         angle = stru_5C6E00->uDoublePiMask & (angle - v15);
-        goto LABEL_87;
-      case PARTY_StrafeLeft://Ctrl + <-
-        __debugbreak();
-        v17 = stru_5C6E00->Sin(angle);
-        v18 = (double)v81;
-        //v88 = v18;
-        v78 = (unsigned __int64)(v17 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16;
-        v2 -= v78;
-        v19 = stru_5C6E00->Cos(angle);
-        v78 = (unsigned __int64)(v19 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16;
-        v1 += v78;
+        break;
+      case PARTY_StrafeLeft:
+        v2 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
+        v1 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
         v78 = 1;
-        goto LABEL_87;
+        break;
       case PARTY_StrafeRight:
-        __debugbreak();
-        v20 = stru_5C6E00->Sin(angle);
-        v21 = (double)v81;
-        //v88 = v21;
-        v78 = (unsigned __int64)(v20 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16;
-        v2 += v78;
-        v22 = stru_5C6E00->Cos(angle);
-        v78 = (unsigned __int64)(v22 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16;
-        //goto LABEL_68;
-        v1 -= v78;
+        v2 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
+        v1 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
         v78 = 1;
-        goto LABEL_87;
+        break;
       case PARTY_WalkForward:
-        __debugbreak();
-        v23 = stru_5C6E00->Cos(angle);
-        v24 = (double)v81;
-        //v88 = v24;
-        v78 = (unsigned __int64)(v23 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16;
-        v2 += v78;
-        v25 = stru_5C6E00->Sin(angle);
-        v78 = (unsigned __int64)(v25 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16;
-        v1 += v78;
+        v2 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier)) >> 16;
+        v1 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier)) >> 16;
         v78 = 1;
-        goto LABEL_87;
+        break;
       case PARTY_WalkBackward:
-        __debugbreak();
-        v26 = stru_5C6E00->Cos(angle);
-        v27 = (double)v81;
-        //v88 = v27;
-        v78 = (unsigned __int64)(v26 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16;
-        v2 -= v78;
-        v28 = stru_5C6E00->Sin(angle);
-        v78 = (unsigned __int64)(v28 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16;
-        v1 -= v78;
+        v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
+        v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
         v78 = 1;
-        goto LABEL_87;
+        break;
       case PARTY_RunForward:
-        //v29 = stru_5C6E00->Cos(angle);
-        //v30 = (double)v81;
-        //v88 = (double)v81;
         v2 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16;
-        //v31 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
         v1 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16;
         v72 = 1;
-        goto LABEL_87;
+        break;
       case PARTY_RunBackward:
         //v32 = stru_5C6E00->SinCos(angle);
         //v33 = (double)v81;
@@ -1850,9 +1811,8 @@
         if ( _view_angle > 128 )
           _view_angle = 128;
         v35 = uActiveCharacter;
-        if ( !uActiveCharacter )
-          goto LABEL_87;
-        pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_63, 0);
+        if ( uActiveCharacter )
+          pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_63, 0);
         break;
       case PARTY_LookDown:
         _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
@@ -1873,7 +1833,7 @@
         }
         break;
       default:
-        goto LABEL_87;
+        break;
     }
   }
   v36 = 0;
@@ -12324,7 +12284,7 @@
   }
   else if ( v10 )
   {
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[409], pMapInfo->pName);// "Do you wish to leave %s?"
+    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[409], pMapInfo->pName);// "Do you wish to leave %s?"
     v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf, &v8, 0, 0)) / 2 + 101;
     v8.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf, 3);
   }
@@ -12369,7 +12329,7 @@
   pTexture_outside = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("outside", TEXTURE_16BIT_PALETTE)];
   v1 = pMapStats->GetMapInfo(pCurrentMapName);
   if ( v1 )
-    sprintf(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s"
+    sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s"
   else
     strcpy(sHouseName, pGlobalTXT_LocalizationStrings[79]);// "Exit"
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ChangeLocation, 0, (int)sHouseName);
@@ -12438,9 +12398,9 @@
       v6 = v3;
       v5 = pGlobalTXT_LocalizationStrings[128]; // "It will take %d days to travel to %s."
     }
-    sprintf(pTmpBuf, v5, v6, v1->pName);
+    sprintfex(pTmpBuf, v5, v6, v1->pName);
     strcat(pTmpBuf, "\n \n");
-    sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[v9].pName);
+    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[v9].pName);
     strcat(pTmpBuf, pTmpBuf2);
     v4 = pFontCreate->CalcTextHeight(pTmpBuf, &v7, 0, 0);
     v7.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, pTmpBuf, 3u);
--- a/mm7_4.cpp	Mon Mar 25 22:04:39 2013 +0600
+++ b/mm7_4.cpp	Tue Mar 26 00:09:21 2013 +0600
@@ -7154,7 +7154,7 @@
     v24 = pSkillNames[v17];
     v21 = pGlobalTXT_LocalizationStrings[225];
 LABEL_90:
-    sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27);
+    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534], v21, v24, v27);
   }
   return pTmpBuf2;
 }
@@ -7879,7 +7879,7 @@
   {
     pDialogueWindow->Release();
     pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
-    sprintf(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName);
+    sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName);
     pBtn_ExitCancel = pDialogueWindow->CreateButton( 566, 445, 75, 33, 1, 0, 0x71u, 0, 0x4Eu,
                    pGlobalTXT_LocalizationStrings[34],// "Cancel"
                    (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0),0);
--- a/mm7_5.cpp	Mon Mar 25 22:04:39 2013 +0600
+++ b/mm7_5.cpp	Tue Mar 26 00:09:21 2013 +0600
@@ -2726,7 +2726,7 @@
             v173 = pSpellStats->pInfos[quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName;
             v157 = pGlobalTXT_LocalizationStrings[483];
 _sprintex_2args_draw_status_and_continue:
-            sprintf(pTmpBuf, v157, v173);
+            sprintfex(pTmpBuf, v157, v173);
           }
           else
           {
@@ -2756,7 +2756,7 @@
             v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName;
             v161 = pGlobalTXT_LocalizationStrings[486];
           }
-          sprintf(pTmpBuf, v161, v178);
+          sprintfex(pTmpBuf, v161, v178);
           sub_41C0B8_set_status_string(pTmpBuf);
           //goto LABEL_91;
           v0 = 1;
@@ -5108,7 +5108,7 @@
       v50 = (int)pMonster;
       pMonsterName = (char *)uDamageAmount;
       pPlayerName = player->pName;             // "%s inflicts %lu points killing %s"
-      sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[175], player->pName, uDamageAmount, pMonster);
+      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[175], player->pName, uDamageAmount, pMonster);
       ShowStatusBarString(pTmpBuf, 2u);
     }
   }
--- a/mm7text_ru.cpp	Mon Mar 25 22:04:39 2013 +0600
+++ b/mm7text_ru.cpp	Tue Mar 26 00:09:21 2013 +0600
@@ -1328,16 +1328,16 @@
         switch (src[2])
         {
           case 'I': case 'i':
+          case 'V': case 'v':
+          case 'R': case 'r':
+          case 'D': case 'd':
+          case 'T': case 't':
           {
             strncpy(dst, name_begin, name_len);
             dst += name_len;
           }
           break;
 
-          case 'R': case 'r':
-          case 'D': case 'd':
-          case 'V': case 'v':
-          case 'T': case 't':
           case 'P': case 'p':
           {
             auto token_begin = src;