Add Sfall version opcodes (#200)

This commit is contained in:
Alexander Batalov 2022-12-22 20:18:07 +03:00
parent c85cda4b48
commit 17a4ee8a68
1 changed files with 25 additions and 0 deletions

View File

@ -17,6 +17,10 @@
namespace fallout {
static constexpr int kVersionMajor = 4;
static constexpr int kVersionMinor = 3;
static constexpr int kVersionPatch = 4;
// read_byte
static void opReadByte(Program* program)
{
@ -119,6 +123,24 @@ static void opListEnd(Program* program)
sfallListsDestroy(listId);
}
// sfall_ver_major
static void opGetVersionMajor(Program* program)
{
programStackPushInteger(program, kVersionMajor);
}
// sfall_ver_minor
static void opGetVersionMinor(Program* program)
{
programStackPushInteger(program, kVersionMinor);
}
// sfall_ver_build
static void opGetVersionPatch(Program* program)
{
programStackPushInteger(program, kVersionPatch);
}
// get_weapon_ammo_pid
static void opGetWeaponAmmoPid(Program* program)
{
@ -271,6 +293,9 @@ void sfallOpcodesInit()
interpreterRegisterOpcode(0x820D, opListBegin);
interpreterRegisterOpcode(0x820E, opListNext);
interpreterRegisterOpcode(0x820F, opListEnd);
interpreterRegisterOpcode(0x8210, opGetVersionMajor);
interpreterRegisterOpcode(0x8211, opGetVersionMinor);
interpreterRegisterOpcode(0x8212, opGetVersionPatch);
interpreterRegisterOpcode(0x8217, opGetWeaponAmmoPid);
interpreterRegisterOpcode(0x8219, opGetWeaponAmmoCount);
interpreterRegisterOpcode(0x821A, opSetWeaponAmmoCount);