Skip to content
This repository was archived by the owner on Jan 15, 2026. It is now read-only.

Commit 8d05d55

Browse files
author
serpentiem
committed
Exp Fix
1 parent f575fe9 commit 8d05d55

File tree

6 files changed

+115
-65
lines changed

6 files changed

+115
-65
lines changed

Kyrie/Kyrie.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import Window;
2323

2424
using namespace Windows;
2525

26-
#define debug true
26+
#define debug false
2727

2828
uint32 DllMain
2929
(

Mary/Exp.ixx

Lines changed: 63 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module;
22
#include <string.h> // snprintf
33

44
#include "../Core/RapidJSON.h"
5+
6+
#include <initializer_list>
57
export module Exp;
68

79
import Core;
@@ -50,71 +52,58 @@ export struct ExpData
5052

5153
return *this;
5254
}
55+
56+
ExpData & operator=(const std::initializer_list<int> &)
57+
{
58+
Log("Reset");
59+
60+
SetMemory
61+
(
62+
this,
63+
0,
64+
sizeof(*this)
65+
);
66+
67+
return *this;
68+
}
5369
};
5470

55-
export ExpData expDataDante = {};
71+
export ExpData missionExpDataDante = {};
72+
export ExpData sessionExpDataDante = {};
5673
export ExpData savedExpDataDante[SAVE_COUNT] = {};
5774

58-
export ExpData expDataVergil = {};
75+
export ExpData missionExpDataVergil = {};
76+
export ExpData sessionExpDataVergil = {};
5977
export ExpData savedExpDataVergil[SAVE_COUNT] = {};
6078

6179

6280

63-
void CopySavedToActive()
64-
{
65-
auto saveIndex = g_saveIndex;
66-
if (saveIndex >= SAVE_COUNT)
67-
{
68-
return;
69-
}
70-
71-
expDataDante = savedExpDataDante [saveIndex];
72-
expDataVergil = savedExpDataVergil[saveIndex];
73-
}
7481

7582

83+
namespaceStart(Exp);
7684

77-
void CopyActiveToSaved()
85+
export void InitSession()
7886
{
79-
auto saveIndex = g_saveIndex;
80-
if (saveIndex >= SAVE_COUNT)
81-
{
82-
return;
83-
}
87+
LogFunction();
8488

85-
savedExpDataDante [saveIndex] = expDataDante;
86-
savedExpDataVergil[saveIndex] = expDataVergil;
89+
sessionExpDataDante = {};
90+
sessionExpDataVergil = {};
8791
}
8892

89-
90-
91-
92-
void ResetExpData()
93+
export void SceneMissionStart()
9394
{
9495
LogFunction();
9596

96-
SetMemory
97-
(
98-
&expDataDante,
99-
0,
100-
sizeof(ExpData)
101-
);
102-
103-
SetMemory
104-
(
105-
&expDataVergil,
106-
0,
107-
sizeof(ExpData)
108-
);
97+
missionExpDataDante = sessionExpDataDante;
98+
missionExpDataVergil = sessionExpDataVergil;
10999
}
110100

111-
namespaceStart(Exp);
112-
113-
export void InitSession()
101+
export void SceneMissionResult()
114102
{
115103
LogFunction();
116104

117-
ResetExpData();
105+
sessionExpDataDante = missionExpDataDante;
106+
sessionExpDataVergil = missionExpDataVergil;
118107
}
119108

120109
namespaceEnd();
@@ -150,6 +139,10 @@ bool Max()
150139

151140

152141

142+
143+
#pragma region JSON
144+
145+
153146
namespaceStart(JSON);
154147

155148
#include "../Core/JSON.h"
@@ -254,6 +247,12 @@ void ToExp()
254247

255248
namespaceEnd();
256249

250+
#pragma endregion
251+
252+
253+
254+
255+
257256

258257

259258
export void SaveExp()
@@ -267,7 +266,20 @@ export void SaveExp()
267266

268267

269268

270-
CopyActiveToSaved();
269+
auto saveIndex = g_saveIndex;
270+
if (saveIndex >= SAVE_COUNT)
271+
{
272+
return;
273+
}
274+
275+
if (g_scene == SCENE::GAME)
276+
{
277+
sessionExpDataDante = missionExpDataDante;
278+
sessionExpDataVergil = missionExpDataVergil;
279+
}
280+
281+
savedExpDataDante [saveIndex] = sessionExpDataDante;
282+
savedExpDataVergil[saveIndex] = sessionExpDataVergil;
271283

272284

273285

@@ -354,7 +366,14 @@ export void LoadExp()
354366

355367

356368

357-
CopySavedToActive();
369+
auto saveIndex = g_saveIndex;
370+
if (saveIndex >= SAVE_COUNT)
371+
{
372+
return;
373+
}
374+
375+
sessionExpDataDante = savedExpDataDante [saveIndex];
376+
sessionExpDataVergil = savedExpDataVergil[saveIndex];
358377
}
359378

360379

Mary/GUI.ixx

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22

3+
// @Todo: g_showWelcome or just make g_show consider activeConfig.welcome
34
// @Todo: Add missing move descriptions.
45
// @Todo: Move GamepadClose calls to end of window.
56
// @Clean
@@ -5614,7 +5615,7 @@ else if (tabIndex == TAB::DANTE)
56145615

56155616
Function
56165617
(
5617-
expDataDante,
5618+
missionExpDataDante,
56185619
shopHelpersDante,
56195620
countof(shopHelpersDante)
56205621
);
@@ -5627,7 +5628,7 @@ else if (tabIndex == TAB::VERGIL)
56275628

56285629
Function
56295630
(
5630-
expDataVergil,
5631+
missionExpDataVergil,
56315632
shopHelpersVergil,
56325633
countof(shopHelpersVergil)
56335634
);
@@ -5756,12 +5757,24 @@ void ExpWindow()
57565757
height
57575758
)
57585759
);
5760+
5761+
// // Center
5762+
// ImGui::SetNextWindowPos
5763+
// (
5764+
// ImVec2
5765+
// (
5766+
// ((g_renderSize.x - width ) / 2),
5767+
// ((g_renderSize.y - height) / 2)
5768+
// )
5769+
// );
5770+
5771+
// Top Right
57595772
ImGui::SetNextWindowPos
57605773
(
57615774
ImVec2
57625775
(
5763-
((g_renderSize.x - width ) / 2),
5764-
((g_renderSize.y - height) / 2)
5776+
(g_renderSize.x - width),
5777+
0
57655778
)
57665779
);
57675780
}
@@ -5924,15 +5937,18 @@ void ExpWindow()
59245937

59255938
FunctionOnce
59265939
(
5927-
expDataDante,
5928-
"Dante Active",
5940+
missionExpDataDante,
5941+
"Dante Mission",
5942+
shopHelpersDante,
5943+
countof(shopHelpersDante)
5944+
);
5945+
FunctionOnce
5946+
(
5947+
sessionExpDataDante,
5948+
"Dante Session",
59295949
shopHelpersDante,
59305950
countof(shopHelpersDante)
59315951
);
5932-
//ImGui::Text("");
5933-
5934-
5935-
59365952
FunctionLoop
59375953
(
59385954
savedExpDataDante,
@@ -5944,17 +5960,20 @@ void ExpWindow()
59445960

59455961

59465962

5947-
59485963
FunctionOnce
59495964
(
5950-
expDataVergil,
5951-
"Vergil Active",
5965+
missionExpDataVergil,
5966+
"Vergil Mission",
5967+
shopHelpersVergil,
5968+
countof(shopHelpersVergil)
5969+
);
5970+
FunctionOnce
5971+
(
5972+
sessionExpDataVergil,
5973+
"Vergil Session",
59525974
shopHelpersVergil,
59535975
countof(shopHelpersVergil)
59545976
);
5955-
//ImGui::Text("");
5956-
5957-
59585977
FunctionLoop
59595978
(
59605979
savedExpDataVergil,
@@ -5966,6 +5985,13 @@ void ExpWindow()
59665985

59675986

59685987

5988+
5989+
5990+
5991+
5992+
5993+
5994+
59695995
auto Content = [&](PlayerActorData & actorData)
59705996
{
59715997
ImGui::PushItemWidth(200);

Mary/Scene.ixx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Core;
66

77
import Actor;
88
import Config;
9+
import Exp;
910
import Global;
1011
import Vars;
1112

@@ -15,6 +16,8 @@ import Vars;
1516

1617
namespaceStart(Item);
1718

19+
// @Research: Main & MissionSelect seem redundant.
20+
1821
void SceneMain()
1922
{
2023
if (!activeConfig.Actor.enable)
@@ -175,7 +178,7 @@ void SceneHandler()
175178
Log(funcName);
176179

177180
Actor::SceneMissionStart();
178-
181+
Exp::SceneMissionStart();
179182
Item::SceneMissionStart();
180183

181184
break;
@@ -184,6 +187,8 @@ void SceneHandler()
184187
{
185188
Log(funcName);
186189

190+
Exp::SceneMissionResult();
191+
187192
break;
188193
}
189194
case GAME_OVER:

ddmk.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3049,8 +3049,8 @@ let helpersMary =
30493049
c += NEW_LINE;
30503050

30513051
c += Tabs() + "ExpData * expDataAddr =" + NEW_LINE;
3052-
c += Tabs() + "(character == CHARACTER::DANTE ) ? &expDataDante :" + NEW_LINE;
3053-
c += Tabs() + "(character == CHARACTER::VERGIL) ? &expDataVergil :" + NEW_LINE;
3052+
c += Tabs() + "(character == CHARACTER::DANTE ) ? &missionExpDataDante :" + NEW_LINE;
3053+
c += Tabs() + "(character == CHARACTER::VERGIL) ? &missionExpDataVergil :" + NEW_LINE;
30543054
c += Tabs() + "0;" + NEW_LINE;
30553055
c += NEW_LINE;
30563056

dinput8.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ byte32 DllMain
224224
{
225225
if (reason == DLL_PROCESS_ATTACH)
226226
{
227-
Core_Log_Init("logs", "dinput8.txt");
227+
InitLog("logs", "dinput8.txt");
228228

229229
Log("Session started.");
230230

0 commit comments

Comments
 (0)