annotate UISaveLoad.cpp @ 943:ffc32cabc5f5

Party conditions for debug menu
author Ritor1
date Wed, 01 May 2013 17:06:18 +0600
parents ae747684f644
children 9be9afdbeac3
rev   line source
706
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
1 #include <assert.h>
847
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
2 #include <io.h>
706
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
3 #include "MM7.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
4
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
5 #include "MapInfo.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
6 #include "Game.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
7 #include "GUIWindow.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
8 #include "GUIFont.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
9 #include "GUIProgressBar.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
10 #include "Party.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
11 #include "AudioPlayer.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
12 #include "Outdoor.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
13 #include "IndoorCamera.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
14 #include "Overlays.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
15 #include "Monsters.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
16 #include "Arcomage.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
17 #include "LOD.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
18 #include "Actor.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
19 #include "Allocator.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
20 #include "Events.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
21 #include "Viewport.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
22 #include "FrameTableInc.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
23 #include "Math.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
24 #include "SpriteObject.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
25 #include "ObjectList.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
26 #include "Chest.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
27 #include "PaletteManager.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
28 #include "DecorationList.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
29 #include "SaveLoad.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
30 #include "stru123.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
31 #include "Time.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
32 #include "IconFrameTable.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
33 #include "Awards.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
34 #include "Autonotes.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
35 #include "stru160.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
36 #include "TurnEngine.h"
924
a78f08dbeb88 CastSpellInfo
Ritor1
parents: 847
diff changeset
37 #include "CastSpellInfo.h"
706
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
38 #include "Weather.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
39 #include "stru298.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
40 #include "StorylineTextTable.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
41 #include "Events2D.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
42 #include "texts.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
43 #include "stru351.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
44
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
45 #include "mm7_data.h"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
46
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
47
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
48 //----- (004601B7) --------------------------------------------------------
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
49 void GameUI_MainMenu_DoDrawLoad(int a1)
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
50 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
51 unsigned __int16 v1; // bx@1
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
52 unsigned int v2; // edi@4
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
53 unsigned int v3; // eax@4
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
54 unsigned int v4; // eax@8
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
55 int v5; // edi@8
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
56 unsigned int v6; // eax@8
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
57 unsigned int pMapID; // eax@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
58 signed __int64 v8; // qax@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
59 unsigned int v9; // ebx@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
60 unsigned __int64 v10; // qax@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
61 __int64 v11; // qax@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
62 char v12; // di@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
63 unsigned __int64 v13; // qtt@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
64 unsigned int v14; // ecx@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
65 __int64 pOurHour; // qax@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
66 int v16; // edi@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
67 signed int pHour; // ebx@22
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
68 //const char *v18; // ST14_4@32
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
69 int v19; // eax@32
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
70 const char *v20; // ST18_4@32
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
71 int v21; // eax@32
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
72 //const char *v22; // ST14_4@32
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
73 int v23; // eax@32
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
74 const char *pSlotName; // edi@36
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
75 int v25; // eax@43
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
76 GUIWindow pWindow; // [sp+Ch] [bp-78h]@8
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
77 /*unsigned int Dst; // [sp+Ch] [bp-78h]@8
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
78 unsigned int v27; // [sp+10h] [bp-74h]@8
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
79 int v28; // [sp+14h] [bp-70h]@8
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
80 int v29; // [sp+18h] [bp-6Ch]@8
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
81 unsigned int v30; // [sp+1Ch] [bp-68h]@8
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
82 unsigned int v31; // [sp+20h] [bp-64h]@8*/
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
83 int pMinutes; // [sp+60h] [bp-24h]@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
84 int pMonthNum; // [sp+68h] [bp-1Ch]@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
85 unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
86 __int64 pAMPM2; // [sp+74h] [bp-10h]@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
87 int pYear; // [sp+7Ch] [bp-8h]@10
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
88 int a4; // [sp+80h] [bp-4h]@1
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
89 int pFilesID;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
90
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
91 v1 = 255;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
92 a4 = a1;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
93 GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0xFF);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
94 GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0x9B);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
95 pRenderer->BeginScene();
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
96 if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LOADINGPROC )
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
97 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
98 pRenderer->DrawTextureIndexed(8, 8, uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
99 if ( a4 )
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
100 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
101 v2 = uTextureID_save_up;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
102 v3 = uTextureID_LS_saveU;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
103 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
104 else
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
105 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
106 v2 = uTextureID_load_up;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
107 v3 = uTextureID_LS_loadU;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
108 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
109 pRenderer->DrawTextureIndexed(241, 302, (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0));
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
110 pRenderer->DrawTextureIndexed(18, 139, (Texture *)(v2 != -1 ? &pIcons_LOD->pTextures[v2] : 0));
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
111 pRenderer->DrawTextureIndexed(351, 302, (Texture *)(uTextureID_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_u] : 0));
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
112 v1 = 255;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
113 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
114 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] )
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
115 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
116 memset(&pWindow, 0, 0x54);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
117 pWindow.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
118 v4 = pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
119 pWindow.uFrameWidth = 220;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
120 v4 += 157;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
121 pWindow.uFrameY = v4;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
122 v5 = pFontSmallnum->uFontHeight;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
123 pWindow.uFrameZ = pWindow.uFrameX + 219;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
124 pWindow.uFrameHeight = v5;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
125 pWindow.uFrameW = v5 + v4 - 1;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
126 v6 = uLoadGameUI_SelectedSlot;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
127 if (pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels)
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
128 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
129 pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, pSavegameThumbnails + uLoadGameUI_SelectedSlot);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
130 v6 = uLoadGameUI_SelectedSlot;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
131 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
132 pMapID = pMapStats->GetMapInfo(pSavegameHeader[v6].pLocationName);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
133 pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapID].pName, 3);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
134 v8 = (signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60;
847
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
135 pMinutes = (int)(((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) >> 32);
706
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
136 v9 = v8;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
137 v8 /= 60i64;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
138 pAMPM2 = v8;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
139 v10 = (unsigned int)v8 / 24;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
140 pSaveFiles = v10;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
141 v11 = (unsigned int)(v10 / 7);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
142 v12 = v11;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
143 LODWORD(v13) = (unsigned int)v11 >> 2;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
144 HIDWORD(v13) = HIDWORD(v11);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
145 pMonthNum = v13 % 12;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
146 pYear = v13 / 12;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
147 pMinutes = (int)__PAIR__(pMinutes, v9) % 60;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
148 pOurHour = pAMPM2 % 24;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
149 v14 = (unsigned __int64)(pAMPM2 % 24) >> 32;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
150 LODWORD(pAMPM2) = pAMPM2 % 24;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
151 HIDWORD(pOurHour) = pSaveFiles % 28;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
152 pYear += game_starting_year;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
153 v16 = v12 & 3;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
154 pWindow.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
155 HIDWORD(pAMPM2) = v14 == 0 && ((signed int)v14 > 0 || (unsigned int)pOurHour >= 12)
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
156 && (signed int)v14 <= 0 && (v14 != 0 || (unsigned int)pOurHour < 24);
847
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
157 if ( v14 != 0 || ((signed int)v14 <= 0) && (unsigned int)pOurHour <= 12 )
706
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
158 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
159 if ( !(v14 | (unsigned int)pOurHour) )
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
160 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
161 pSaveFiles = 0;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
162 pHour = 12;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
163 goto LABEL_23;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
164 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
165 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
166 else
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
167 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
168 v14 = (__PAIR__(v14, (unsigned int)pOurHour) - 12) >> 32;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
169 LODWORD(pOurHour) = pOurHour - 12;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
170 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
171 pHour = pOurHour;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
172 pSaveFiles = v14;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
173 LABEL_23:
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
174 auto day = aDayNames[HIDWORD(pOurHour) % 7];
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
175 auto ampm = aAMPMNames[HIDWORD(pAMPM2)];
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
176 auto month = aMonthNames[pMonthNum];
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
177 //sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
178 sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", day, pHour, pMinutes, ampm, 7 * v16 + HIDWORD(pOurHour) % 7 + 1, month, pYear);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
179 pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf, 3u);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
180 v1 = 255;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
181 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
182 if ( pGUIWindow_CurrentMenu->field_40 == 2 )
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
183 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
184 pGUIWindow_CurrentMenu->field_40 = 0;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
185 strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, (const char *)pKeyActionMap->pPressedKeysBuffer);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
186 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
187 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
188 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)83;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
189 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
190 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
191 ++pMessageQueue_50CBD0->uNumMessages;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
192 }*/
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
193 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
194 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
195 else
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
196 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
197 if ( pGUIWindow_CurrentMenu->field_40 == 3 )
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
198 pGUIWindow_CurrentMenu->field_40 = 0;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
199 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
200 if (GetCurrentMenuID() == MENU_LOADINGPROC)
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
201 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
202 //v18 = pGlobalTXT_LocalizationStrings[135];
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
203 v19 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[135]);//"Çàãðóçêà"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
204 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v19 + 25, 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
205 v20 = (const char *)(pSavegameHeader + uLoadGameUI_SelectedSlot);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
206 v21 = pFontSmallnum->AlignText_Center(0xBA, (const char *)pSavegameHeader + 100 * uLoadGameUI_SelectedSlot);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
207 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v21 + 25, 0x106, 0, v20, 185, 0);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
208 //v22 = pGlobalTXT_LocalizationStrings[165];
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
209 v23 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[165]);//"Ïîæàëóéñòà, ïîæîæäèòå"
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
210 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v23 + 25, 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
211 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
212 else
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
213 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
214 if ( a4 )
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
215 pSaveFiles = 40;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
216 else
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
217 pSaveFiles = uNumSavegameFiles;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
218 a4 = 199;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
219 pFilesID = pSaveListPosition;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
220 pSlotName = (const char *)(&pSavegameHeader[pSaveListPosition]);//draw name for save slot
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
221 do
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
222 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
223 if ( pFilesID >= (signed int)pSaveFiles )
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
224 break;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
225 short clr;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
226 HIDWORD(pAMPM2) = clr = (pFilesID == uLoadGameUI_SelectedSlot ? GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v1, v1, 0x64) : 0);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
227 if ( pGUIWindow_CurrentMenu->field_40 != 1 || pFilesID != uLoadGameUI_SelectedSlot )
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
228 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
229 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, pSlotName, 185, 0);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
230 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
231 else
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
232 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
233 v25 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
234 pGUIWindow_CurrentMenu->DrawFlashingInputCursor(v25 + 27, a4, pFontSmallnum);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
235 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
236 a4 += 21;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
237 ++pFilesID;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
238 pSlotName += 100;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
239 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
240 while ( a4 < 346 );
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
241 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
242 pRenderer->EndScene();
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
243 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
244 // 6A0C9C: using guessed type int dword_6A0C9C;
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
245
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
246 //----- (004606F7) --------------------------------------------------------
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
247 void __cdecl GameUI_MainMenu_DrawLoad()
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
248 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
249 GameUI_MainMenu_DoDrawLoad(0);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
250 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
251
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
252 //----- (004606FE) --------------------------------------------------------
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
253 void __cdecl sub_4606FE()
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
254 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
255 GameUI_MainMenu_DoDrawLoad(1);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
256 }
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
257
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
258
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
259 void __cdecl FreeSavegameThumbnails()
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
260 {
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
261 for (int i = 0; i < 40; ++i)
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
262 //pAllocator->FreeChunk(pSavegameThumbnails[i].pPixels);
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
263 pSavegameThumbnails[i].Release();
d6236f6a9882 Rough function rearranging to new files
Gloval
parents: 701
diff changeset
264 }
847
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
265
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
266 //----- (0045E361) --------------------------------------------------------
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
267 void __fastcall GameUI_DrawLoadMenu(unsigned int uDialogueType)
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
268 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
269 unsigned int v1; // ebp@5
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
270 unsigned int v2; // eax@5
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
271 //signed int v3; // ebp@11
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
272 FILE *v4; // eax@14
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
273 FILE *v5; // eax@18
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
274 unsigned int v6; // eax@25
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
275 GUIButton *v7; // eax@27
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
276 const char *v8; // [sp-8h] [bp-26Ch]@25
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
277 //char *v9; // [sp-4h] [bp-268h]@19
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
278 enum TEXTURE_TYPE v10; // [sp-4h] [bp-268h]@25
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
279 unsigned int uDialogueType_; // [sp+10h] [bp-254h]@1
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
280 //RGBTexture *pTex; // [sp+10h] [bp-254h]@12
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
281 //SavegameHeader *Dest; // [sp+14h] [bp-250h]@12
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
282 //const char *Str1; // [sp+18h] [bp-24Ch]@12
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
283 LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
284 int v16; // [sp+260h] [bp-4h]@1
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
285
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
286 uDialogueType_ = uDialogueType;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
287 dword_6BE138 = -1;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
288 pIcons_LOD->_inlined_sub2();
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
289
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
290 memset(pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots));
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
291 memset(pSavegameThumbnails, 0, 45 * sizeof(RGBTexture));
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
292 uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
293 uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
294 uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
295 uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
296 uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
297 uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
298 if ( uDialogueType_ )
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
299 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
300 pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
301 if ( pCurrentScreen == SCREEN_SAVEGAME )
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
302 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
303 v1 = uTextureID_save_up;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
304 v2 = uTextureID_LS_saveU;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
305 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
306 else
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
307 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
308 v1 = uTextureID_load_up;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
309 v2 = uTextureID_LS_loadU;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
310 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
311 pRenderer->DrawTextureIndexed(241, 302, (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0));
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
312 pRenderer->DrawTextureIndexed(18, 141, (Texture *)(v1 != -1 ? (int)&pIcons_LOD->pTextures[v1] : 0));
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
313 pRenderer->DrawTextureIndexed(351, 302, (Texture *)(uTextureID_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_u] : 0));
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
314 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
315 else
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
316 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
317 pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
318 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
319 pGUIWindow_CurrentMenu = GUIWindow::Create(saveload_dlg_xs[uDialogueType_], saveload_dlg_ys[uDialogueType_], saveload_dlg_zs[uDialogueType_],
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
320 saveload_dlg_ws[uDialogueType_], WINDOW_MainMenu_Load, 0, 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
321 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);// "Reading..."
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
322 pRenderer->Present();
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
323 pSavegameList->Initialize(0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
324 if ( pSaveListPosition > (signed int)uNumSavegameFiles )
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
325 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
326 pSaveListPosition = 0;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
327 uLoadGameUI_SelectedSlot = 0;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
328 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
329 pLODFile.AllocSubIndicesAndIO(0x12C, 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
330 assert(sizeof(SavegameHeader) == 0x64);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
331 //v3 = 0;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
332 for (uint i = 0; i < uNumSavegameFiles; ++i)
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
333 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
334
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
335 sprintf(pTmpBuf, "saves\\%s", pSavegameList->pFileList[i].pSaveFileName);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
336 if (_access(pTmpBuf, 6))
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
337 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
338 pSavegameUsedSlots[i] = 0;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
339 strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty"
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
340 continue;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
341 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
342 pLODFile.LoadFile(pTmpBuf, 1);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
343 v4 = pLODFile.FindContainer("header.bin", true);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
344 if ( v4 )
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
345 fread(&pSavegameHeader[i], 0x64, 1, v4);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
346 if ( !_strcmpi(pSavegameList->pFileList[i].pSaveFileName, pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7"
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
347 strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave"
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
348 v5 = pLODFile.FindContainer("image.pcx", true);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
349 if ( !v5 )
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
350 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
351 pSavegameUsedSlots[i] = 0;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
352 strcpy(pSavegameList->pFileList[i].pSaveFileName, "");
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
353 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
354 else
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
355 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
356 pSavegameThumbnails[i].LoadFromFILE(v5, 0, true);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
357 pLODFile.CloseWriteFile();
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
358 pSavegameUsedSlots[i] = 1;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
359 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
360 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
361
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
362 //LABEL_24:
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
363 pLODFile.FreeSubIndexAndIO();
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
364 if ( pCurrentScreen == SCREEN_SAVEGAME )
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
365 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
366 uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
367 uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD",TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
368 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
369 else
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
370 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
371 uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
372 uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_loadD",TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
373 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
374 uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
375 uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
376 pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
377 pGUIWindow_CurrentMenu->CreateButton(21, 219, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
378 pGUIWindow_CurrentMenu->CreateButton(21, 240, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
379 pGUIWindow_CurrentMenu->CreateButton(21, 261, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
380 pGUIWindow_CurrentMenu->CreateButton(21, 282, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
381 pGUIWindow_CurrentMenu->CreateButton(21, 303, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
382 pGUIWindow_CurrentMenu->CreateButton(21, 324, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
383 pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_LoadSlot, 0, 0, "",
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
384 pIcons_LOD->GetTexture(uTextureID_LS_), 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
385 pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "",
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
386 pIcons_LOD->GetTexture(uTextureID_x_d), 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
387 pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "",
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
388 pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
389 pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 0x143, 0x11, 0x11, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "",
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
390 pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
391
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
392 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
393
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
394 //----- (0045E93E) --------------------------------------------------------
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
395 void GameUI_DrawSaveMenu()
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
396 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
397 unsigned int v0; // ebp@4
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
398 unsigned int v1; // eax@4
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
399 char *v3; // eax@7
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
400 FILE *v4; // eax@11
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
401 FILE *v5; // eax@11
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
402 LODWriteableFile v11; // [sp+1Ch] [bp-248h]@1
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
403
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
404 ++pIcons_LOD->uTexturePacksCount;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
405 if ( !pIcons_LOD->uNumPrevLoadedFiles )
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
406 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
407 memset(pSavegameUsedSlots, 0, 0xB4u);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
408 memset(&pSavegameThumbnails, 0, 0x708u);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
409 uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
410 uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
411 uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
412 uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
413 uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
414 uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
415 pRenderer->DrawTextureIndexed( 8u, 8u,
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
416 (Texture *)(uTextureID_loadsave != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
417 if ( pCurrentScreen == SCREEN_SAVEGAME )
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
418 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
419 v0 = uTextureID_save_up;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
420 v1 = uTextureID_LS_saveU;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
421 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
422 else
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
423 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
424 v0 = uTextureID_load_up;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
425 v1 = uTextureID_LS_loadU;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
426 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
427 pRenderer->DrawTextureIndexed(0xF1u, 0x12Eu, (Texture *)(v1 != -1 ? (int)&pIcons_LOD->pTextures[v1] : 0));
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
428 pRenderer->DrawTextureIndexed(0x15Fu, 0x12Eu,
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
429 (Texture *)(uTextureID_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_u] : 0));
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
430 pRenderer->DrawTextureIndexed(0x12u, 0x8Du, (Texture *)(v0 != -1 ? (int)&pIcons_LOD->pTextures[v0] : 0));
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
431 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
432 pRenderer->Present();
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
433 pSavegameList->Initialize(1u);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
434 v11.AllocSubIndicesAndIO(0x12Cu, 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
435 //v2 = pSavegameUsedSlots;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
436 // Dest = pSavegameHeader;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
437 // this_ = pSavegameThumbnails;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
438 // v8 = (char *)pSavegameList->pSavesNames;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
439 for (uint i = 0; i < 40; ++i)
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
440 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
441 v3 = pSavegameList->pFileList[i].pSaveFileName;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
442 if ( !*pSavegameList->pFileList[i].pSaveFileName )
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
443 v3 = "1.mm7";
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
444 sprintf(pTmpBuf, "saves\\%s", v3);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
445 if ( _access(pTmpBuf, 0) || _access(pTmpBuf, 6) )
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
446 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
447 pSavegameUsedSlots[i] = 0;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
448 strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
449 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
450 else
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
451 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
452 v11.LoadFile(pTmpBuf, 1);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
453 v4 = v11.FindContainer("header.bin", 1);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
454 fread(&pSavegameHeader[i], 100, 1u, v4);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
455 v5 = v11.FindContainer("image.pcx", 1);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
456 if ( v5 )
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
457 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
458 pSavegameThumbnails[i].LoadFromFILE(v5, 0, 1u);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
459 v11.CloseWriteFile();
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
460 pSavegameUsedSlots[i] = 1;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
461 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
462 else
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
463 {
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
464 pSavegameUsedSlots[i] = 0;
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
465 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
466 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
467
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
468 }
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
469
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
470 v11.FreeSubIndexAndIO();
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
471 uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
472 uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
473 uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
474 uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
475 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_17, 0, 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
476 pGUIWindow_CurrentMenu->CreateButton(21u, 198u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
477 pGUIWindow_CurrentMenu->CreateButton(21u, 218u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 1u, 0, "", 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
478 pGUIWindow_CurrentMenu->CreateButton(21u, 238u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 2u, 0, "", 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
479 pGUIWindow_CurrentMenu->CreateButton(21u, 258u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 3u, 0, "", 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
480 pGUIWindow_CurrentMenu->CreateButton(21u, 278u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 4u, 0, "", 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
481 pGUIWindow_CurrentMenu->CreateButton(21u, 298u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 5u, 0, "", 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
482 pGUIWindow_CurrentMenu->CreateButton(21u, 318u, 0xBFu, 0x12u, 1, 0, UIMSG_SelectLoadSlot, 6u, 0, "", 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
483 pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0x69u, 0x28u, 1, 0, UIMSG_LoadSlot, 0, 0, "",
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
484 (Texture *)(uTextureID_LS_ != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_LS_] : 0), 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
485 pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(0x15Eu, 0x12Eu, 0x69u, 0x28u, 1, 0, UIMSG_Cancel, 0, 0, "",
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
486 (Texture *)(uTextureID_x_d != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_d] : 0), 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
487 pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton( 0xD7u, 0xC7u, 0x11u, 0x11u, 1, 0, UIMSG_ArrowUp, 0, 0, "",
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
488 (Texture *)(uTextureID_AR_UP_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_UP_DN] : 0), 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
489 pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton( 0xD7u, 0x143u, 0x11u, 0x11u, 1, 0, UIMSG_DownArrow, 0x22u, 0, "",
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
490 (Texture *)(uTextureID_AR_DN_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_DN_DN] : 0), 0);
e398541aee60 fixed party save position
Gloval
parents: 832
diff changeset
491 }