Mercurial > might-and-magic-trilogy
diff GameUIs.cpp @ 107:ccc0cf95706a
Слияние
author | Ritor1 |
---|---|
date | Mon, 05 Nov 2012 09:16:17 +0600 |
parents | 6c42178c226e |
children | 062e8a8e09bc |
line wrap: on
line diff
--- a/GameUIs.cpp Mon Nov 05 09:15:53 2012 +0600 +++ b/GameUIs.cpp Mon Nov 05 09:16:17 2012 +0600 @@ -1,5 +1,6 @@ #include <direct.h> #include <io.h> +#include <assert.h> #include "GUIWindow.h" #include "GUIFont.h" @@ -15,18 +16,18 @@ { unsigned int v1; // ebp@5 unsigned int v2; // eax@5 - signed int v3; // ebp@11 + //signed int v3; // ebp@11 FILE *v4; // eax@14 FILE *v5; // eax@18 unsigned int v6; // eax@25 GUIButton *v7; // eax@27 const char *v8; // [sp-8h] [bp-26Ch]@25 - char *v9; // [sp-4h] [bp-268h]@19 + //char *v9; // [sp-4h] [bp-268h]@19 enum TEXTURE_TYPE v10; // [sp-4h] [bp-268h]@25 unsigned int uDialogueType_; // [sp+10h] [bp-254h]@1 - RGBTexture *pTex; // [sp+10h] [bp-254h]@12 - SavegameHeader *Dest; // [sp+14h] [bp-250h]@12 - const char *Str1; // [sp+18h] [bp-24Ch]@12 + //RGBTexture *pTex; // [sp+10h] [bp-254h]@12 + //SavegameHeader *Dest; // [sp+14h] [bp-250h]@12 + //const char *Str1; // [sp+18h] [bp-24Ch]@12 LODWriteableFile v15; // [sp+1Ch] [bp-248h]@1 int v16; // [sp+260h] [bp-4h]@1 @@ -51,7 +52,7 @@ pRenderer->DrawTextureIndexed( 8u, 8u, - (Texture *)(uTextureID_loadsave != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_loadsave] : 0)); + (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0)); if ( pCurrentScreen == 11 ) { v1 = uTextureID_save_up; @@ -67,7 +68,7 @@ pRenderer->DrawTextureIndexed( 351u, 302u, - (Texture *)(uTextureID_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_u] : 0)); + (Texture *)(uTextureID_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_u] : 0)); } else { @@ -90,46 +91,55 @@ uLoadGameUI_SelectedSlot = 0; } v15.AllocSubIndicesAndIO(0x12Cu, 0); - v3 = 0; - if ( (signed int)uNumSavegameFiles > 0 ) + + assert(sizeof(SavegameHeader) == 0x64); + + //v3 = 0; + for (uint i = 0; i < uNumSavegameFiles; ++i) { - Dest = pSavegameHeader; - pTex = pSavegameThumbnails; - Str1 = (const char *)pSavegameList->pSavesNames; - while ( 1 ) + //Dest = pSavegameHeader; + //pTex = pSavegameThumbnails; + //Str1 = (const char *)pSavegameList->pSavesNames; + //while ( 1 ) + //{ + sprintf(pTmpBuf, "saves\\%s", pSavegameList->pSavesNames[i]); + if (_access(pTmpBuf, 6)) { - sprintf(pTmpBuf, "saves\\%s", Str1); - if ( _access(pTmpBuf, 6) ) - break; - v15.LoadFile(pTmpBuf, 1); - v4 = v15.FindContainer("header.bin", true); - if ( v4 ) - fread(Dest, 0x64u, 1u, v4); - if ( !_strcmpi(Str1, pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7" - strcpy(Dest->pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave" - v5 = v15.FindContainer("image.pcx", true); - if ( !v5 ) - { - v9 = ""; -LABEL_22: - pSavegameUsedSlots[v3] = 0; - strcpy(Dest->pName, v9); - goto LABEL_23; - } - pTex->LoadFromFILE(v5, 0, true); + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty" + continue; + } + + v15.LoadFile(pTmpBuf, 1); + v4 = v15.FindContainer("header.bin", true); + if ( v4 ) + fread(&pSavegameHeader[i], 0x64u, 1u, v4); + if ( !_strcmpi(pSavegameList->pSavesNames[i], pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7" + strcpy(pSavegameList->pSavesNames[i], pGlobalTXT_LocalizationStrings[16]);// "Autosave" + + v5 = v15.FindContainer("image.pcx", true); + if ( !v5 ) + { + pSavegameUsedSlots[i] = 0; + strcpy(pSavegameList->pSavesNames[i], ""); + } + else + { + pSavegameThumbnails[i].LoadFromFILE(v5, 0, true); v15.CloseWriteFile(); - pSavegameUsedSlots[v3] = 1; -LABEL_23: - Str1 += 280; - ++pTex; - ++Dest; - ++v3; - if ( v3 >= (signed int)uNumSavegameFiles ) - goto LABEL_24; + pSavegameUsedSlots[i] = 1; } - v9 = pGlobalTXT_LocalizationStrings[72]; // "Empty" - goto LABEL_22; +//LABEL_23: + //Str1 += 280; + //++pTex; + //++Dest; + //++v3; + //if ( v3 >= (signed int)uNumSavegameFiles ) + // goto LABEL_24; + //} + //goto LABEL_22; } + LABEL_24: v15.FreeSubIndexAndIO(); if ( pCurrentScreen == 11 )