mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
- store game vars in the new config file.
This commit is contained in:
parent
249f6e9d62
commit
7023e1e992
1 changed files with 16 additions and 6 deletions
|
@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "savegame.h"
|
#include "savegame.h"
|
||||||
#include "scriplib.h"
|
#include "scriplib.h"
|
||||||
#include "gamecvars.h"
|
#include "gamecvars.h"
|
||||||
|
#include "gameconfigfile.h"
|
||||||
|
|
||||||
#include "vfs.h"
|
#include "vfs.h"
|
||||||
|
|
||||||
|
@ -4258,17 +4259,26 @@ badindex:
|
||||||
insptr++;
|
insptr++;
|
||||||
dispatch();
|
dispatch();
|
||||||
}
|
}
|
||||||
|
extern FString currentGame;
|
||||||
|
FString section = currentGame + ".Gamevars";
|
||||||
|
GameConfig->SetSection(section);
|
||||||
switch (VM_DECODE_INST(tw))
|
switch (VM_DECODE_INST(tw))
|
||||||
{
|
{
|
||||||
case CON_SAVEGAMEVAR:
|
case CON_SAVEGAMEVAR:
|
||||||
|
{
|
||||||
nValue = Gv_GetVar(*insptr);
|
nValue = Gv_GetVar(*insptr);
|
||||||
SCRIPT_PutNumber(ud.config.scripthandle, "Gamevars", aGameVars[*insptr++].szLabel, nValue, FALSE, FALSE);
|
FStringf vs("%d", nValue);
|
||||||
|
GameConfig->SetValueForKey(aGameVars[*insptr++].szLabel, vs);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case CON_READGAMEVAR:
|
case CON_READGAMEVAR:
|
||||||
SCRIPT_GetNumber(ud.config.scripthandle, "Gamevars", aGameVars[*insptr].szLabel, &nValue);
|
{
|
||||||
|
auto str = GameConfig->GetValueForKey(aGameVars[*insptr].szLabel);
|
||||||
|
if (str) nValue = (int)strtoll(str, nullptr, 0);
|
||||||
Gv_SetVar(*insptr++, nValue);
|
Gv_SetVar(*insptr++, nValue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
dispatch();
|
dispatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue