Refactored ASM code of script opcode handlers

Included call_offset_xx functions for AllowUnsafeScripting=2 (#288)
This commit is contained in:
NovaRain
2020-03-19 12:55:01 +08:00
parent accdeae6ad
commit dfdcd86134
24 changed files with 468 additions and 885 deletions
+71
View File
@@ -0,0 +1,71 @@
/*
* sfall
* Copyright (C) 2008-2020 The sfall team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
/*
MACROS for operators assembly code
Notes:
- DO NOT add any comments within macros
- every macro should contain __asm {} block
- every assembly line should start with __asm and should NOT have semicolon in the end!
- use this macros outside of other __asm {} blocks (obviously)
*/
/*
Gets argument from stack to eax and puts its type to edx register
eax register must contain the script_ptr
jlabel - name of the jump label in case the value type is not INT
return: eax - arg value
*/
#define _GET_ARG_INT(jlabel) __asm { \
__asm mov edx, eax \
__asm call fo::funcoffs::interpretPopShort_ \
__asm xchg eax, edx \
__asm call fo::funcoffs::interpretPopLong_ \
__asm cmp dx, VAR_TYPE_INT \
__asm jnz jlabel \
}
#define _GET_ARG(outVal, outType) __asm { \
__asm call fo::funcoffs::interpretPopShort_ \
__asm mov outType, eax \
__asm mov eax, ebx \
__asm call fo::funcoffs::interpretPopLong_ \
__asm mov outVal, eax \
}
/*
Returns the value to the script
eax and ebx register must contain the script_ptr
edx register must contain the returned value
*/
#define _RET_VAL_INT __asm { \
__asm call fo::funcoffs::interpretPushLong_ \
__asm mov edx, VAR_TYPE_INT \
__asm mov eax, ebx \
__asm call fo::funcoffs::interpretPushShort_ \
}
#define _J_RET_VAL_TYPE(type) __asm { \
__asm call fo::funcoffs::interpretPushLong_ \
__asm mov edx, type \
__asm mov eax, ebx \
__asm jmp fo::funcoffs::interpretPushShort_ \
}
+3 -1
View File
@@ -688,7 +688,9 @@ enum KillType : long
KILL_TYPE_count
};
#define PLAYER_ID (18000)
enum {
PLAYER_ID = 18000
};
#define OBJFLAG_CAN_WEAR_ITEMS (0xF000000)
+3 -59
View File
@@ -15,11 +15,12 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
/*
* FALLOUT2.EXE structs, function offsets and wrappers are included from here.
*/
* FALLOUT2.EXE structs, function offsets and wrappers are included from here.
*/
#include "Enums.h"
#include "FunctionOffsets.h"
@@ -27,60 +28,3 @@
#include "EngineUtils.h"
#include "Variables.h"
#include "Functions.h"
// TODO: move/rename these
#define MSG_FILE_COMBAT (0x56D368)
#define MSG_FILE_AI (0x56D510)
#define MSG_FILE_SCRNAME (0x56D754)
#define MSG_FILE_MISC (0x58E940)
#define MSG_FILE_CUSTOM (0x58EA98)
#define MSG_FILE_INVENTRY (0x59E814)
#define MSG_FILE_ITEM (0x59E980)
#define MSG_FILE_LSGAME (0x613D28)
#define MSG_FILE_MAP (0x631D48)
#define MSG_FILE_OPTIONS (0x6637E8)
#define MSG_FILE_PERK (0x6642D4)
#define MSG_FILE_PIPBOY (0x664348)
#define MSG_FILE_QUESTS (0x664410)
#define MSG_FILE_PROTO (0x6647FC)
#define MSG_FILE_SCRIPT (0x667724)
#define MSG_FILE_SKILL (0x668080)
#define MSG_FILE_SKILLDEX (0x6680F8)
#define MSG_FILE_STAT (0x66817C)
#define MSG_FILE_TRAIT (0x66BE38)
#define MSG_FILE_WORLDMAP (0x672FB0)
/*
Gets argument from stack to eax and puts its type to edx register
eax register must contain the script_ptr
jlabel - name of the jump label in case the value type is not INT
return: eax - arg value
*/
#define _GET_ARG_INT(jlabel) __asm { \
__asm mov edx, eax \
__asm call fo::funcoffs::interpretPopShort_ \
__asm xchg eax, edx \
__asm call fo::funcoffs::interpretPopLong_ \
__asm cmp dx, VAR_TYPE_INT \
__asm jnz jlabel \
}
/*
Returns the value to the script
eax and ebx register must contain the script_ptr
edx register must contain the returned value
*/
#define _RET_VAL_INT __asm { \
__asm call fo::funcoffs::interpretPushLong_ \
__asm mov edx, VAR_TYPE_INT \
__asm mov eax, ebx \
__asm call fo::funcoffs::interpretPushShort_ \
}
#define _J_RET_VAL_TYPE(type) __asm { \
__asm call fo::funcoffs::interpretPushLong_ \
__asm mov edx, type \
__asm mov eax, ebx \
__asm jmp fo::funcoffs::interpretPushShort_ \
}
+1
View File
@@ -79,6 +79,7 @@ WRAP_WATCOM_FUNC0(long, intface_is_hidden)
WRAP_WATCOM_FUNC0(void, intface_redraw)
WRAP_WATCOM_FUNC0(void, intface_toggle_item_state)
WRAP_WATCOM_FUNC1(void, intface_update_ac, long, animate)
WRAP_WATCOM_FUNC2(void, intface_update_move_points, long, ap, long, freeAP)
WRAP_WATCOM_FUNC0(void, intface_use_item)
WRAP_WATCOM_FUNC2(long, inven_unwield, GameObject*, critter, long, slot)
WRAP_WATCOM_FUNC0(long, is_pc_sneak_working)
+21
View File
@@ -28,6 +28,27 @@
namespace sfall
{
#define MSG_FILE_COMBAT (0x56D368)
#define MSG_FILE_AI (0x56D510)
#define MSG_FILE_SCRNAME (0x56D754)
#define MSG_FILE_MISC (0x58E940)
#define MSG_FILE_CUSTOM (0x58EA98)
#define MSG_FILE_INVENTRY (0x59E814)
#define MSG_FILE_ITEM (0x59E980)
#define MSG_FILE_LSGAME (0x613D28)
#define MSG_FILE_MAP (0x631D48)
#define MSG_FILE_OPTIONS (0x6637E8)
#define MSG_FILE_PERK (0x6642D4)
#define MSG_FILE_PIPBOY (0x664348)
#define MSG_FILE_QUESTS (0x664410)
#define MSG_FILE_PROTO (0x6647FC)
#define MSG_FILE_SCRIPT (0x667724)
#define MSG_FILE_SKILL (0x668080)
#define MSG_FILE_SKILLDEX (0x6680F8)
#define MSG_FILE_STAT (0x66817C)
#define MSG_FILE_TRAIT (0x66BE38)
#define MSG_FILE_WORLDMAP (0x672FB0)
typedef std::unordered_map<int, std::unique_ptr<fo::MessageList>> ExtraGameMessageListsMap;
extern ExtraGameMessageListsMap gExtraGameMsgLists;
extern const fo::MessageList* gameMsgFiles[];
+2 -2
View File
@@ -35,7 +35,7 @@ long Objects::uniqueID = UniqueID::Start; // current counter id, saving to sfall
// player ID = 18000, all party members have ID = 18000 + its pid (file number of prototype)
long __fastcall Objects::SetObjectUniqueID(fo::GameObject* obj) {
long id = obj->id;
if (id > UniqueID::Start || (id >= PLAYER_ID && id < 83536)) return id; // 65535 maximum possible number of prototypes
if (id > UniqueID::Start || (id >= fo::PLAYER_ID && id < 83536)) return id; // 65535 maximum possible number of prototypes
if ((DWORD)uniqueID >= (DWORD)UniqueID::End) uniqueID = UniqueID::Start;
obj->id = ++uniqueID;
@@ -88,7 +88,7 @@ static void map_fix_critter_id() {
long npcStartID = 4096;
fo::GameObject* obj = fo::func::obj_find_first();
while (obj) {
if (obj->Type() == fo::OBJ_TYPE_CRITTER && obj->id < PLAYER_ID) {
if (obj->Type() == fo::OBJ_TYPE_CRITTER && obj->id < fo::PLAYER_ID) {
obj->id = npcStartID++;
}
obj = fo::func::obj_find_next();
+5 -5
View File
@@ -187,7 +187,7 @@ void _stdcall RestoreDefaultPerks() {
IgnoringDefaultPerks = 0;
}
void _stdcall SetPerkboxTitle(char* name) {
void __fastcall Perks::SetPerkboxTitle(const char* name) {
if (name[0] == '\0') {
PerkBoxTitle[0] = 0;
SafeWrite32(0x43C77D, 0x488CB);
@@ -1258,20 +1258,20 @@ static void FastShotTraitFix() {
///////////////////////////////////////////////////////////////////////////////
void _stdcall SetPerkValue(int id, int value, DWORD offset) {
void __fastcall Perks::SetPerkValue(int id, int param, int value) {
if (id < 0 || id >= PERK_count) return;
*(DWORD*)((DWORD)(&perks[id]) + offset) = value;
*(DWORD*)((DWORD)(&perks[id]) + param) = value;
perksReInit = true;
}
void _stdcall SetPerkName(int id, char* value) {
void Perks::SetPerkName(int id, const char* value) {
if (id < 0 || id >= PERK_count) return;
strncpy_s(&Name[id * maxNameLen], maxNameLen, value, _TRUNCATE);
perks[id].name = &Name[maxNameLen * id];
perksReInit = true;
}
void _stdcall SetPerkDesc(int id, char* value) {
void Perks::SetPerkDesc(int id, const char* value) {
if (id < 0 || id >= PERK_count) return;
strncpy_s(&Desc[id * descLen], descLen, value, _TRUNCATE);
perks[id].description = &Desc[descLen * id];
+5 -6
View File
@@ -41,6 +41,11 @@ public:
static DWORD HasFakeTraitOwner(const char* name, long objId);
static long PerkLevelMod;
static void __fastcall SetPerkboxTitle(const char* title);
static void __fastcall SetPerkValue(int id, int param, int value);
static void SetPerkName(int id, const char* value);
static void SetPerkDesc(int id, const char* value);
};
void PerksEnterCharScreen();
@@ -49,12 +54,6 @@ void PerksAcceptCharScreen();
void _stdcall ApplyHeaveHoFix();
void _stdcall SetPerkValue(int id, int value, DWORD offset);
void _stdcall SetPerkName(int id, char* value);
void _stdcall SetPerkDesc(int id, char* value);
void _stdcall SetPerkboxTitle(char* title);
void _stdcall IgnoreDefaultPerks();
void _stdcall RestoreDefaultPerks();
void _stdcall AddPerkMode(DWORD mode);
@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "..\..\..\FalloutEngine\AsmMacros.h"
#include "..\..\..\FalloutEngine\Fallout2.h"
#include "..\..\..\Version.h"
#include "..\..\HookScripts.h"
#include "..\..\ScriptExtender.h"
@@ -16,9 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "..\..\..\FalloutEngine\AsmMacros.h"
#include "..\..\..\FalloutEngine\Fallout2.h"
#include "..\..\..\main.h"
#include "..\..\..\InputFuncs.h"
#include "..\..\..\FalloutEngine\Fallout2.h"
#include "..\..\Graphics.h"
#include "..\..\ScriptExtender.h"
#include "..\..\ScriptShaders.h"
@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "..\..\..\FalloutEngine\AsmMacros.h"
#include "..\..\..\FalloutEngine\Fallout2.h"
#include "..\..\..\InputFuncs.h"
#include "..\..\BarBoxes.h"
#include "..\..\LoadGameHook.h"
+3 -3
View File
@@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "..\..\..\FalloutEngine\AsmMacros.h"
#include "..\..\..\FalloutEngine\Fallout2.h"
#include "..\..\..\SafeWrite.h"
//#include "..\..\ScriptExtender.h"
#include "Memory.h"
@@ -233,14 +233,14 @@ end:
static void __fastcall CallOffsetInternal(fo::Program* script, DWORD func) {
func = (func >> 2) - 0x1d2;
DWORD args[5];
DWORD illegalArg = 0;
long illegalArg = 0;
int argCount = func % 5;
for (int i = argCount; i >= 0; i--) {
if ((short)fo::func::interpretPopShort(script) != (short)VAR_TYPE_INT) illegalArg++;
args[i] = fo::func::interpretPopLong(script);
}
if (illegalArg || args[0] < 0x410010 || args[0] > 0x4FCE34) {
if (illegalArg || (checkValidMemAddr && (args[0] < 0x410010 || args[0] > 0x4FCE34))) {
args[0] = 0;
} else {
__asm {
+6 -13
View File
@@ -18,9 +18,10 @@
#include <cstring>
#include "..\..\..\Utils.h"
#include "..\..\..\FalloutEngine\AsmMacros.h"
#include "..\..\..\FalloutEngine\Fallout2.h"
#include "..\..\..\Utils.h"
#include "..\..\AI.h"
#include "..\..\Combat.h"
#include "..\..\Criticals.h"
@@ -145,13 +146,9 @@ fail:
void __declspec(naked) op_mod_kill_counter() {
__asm {
push ecx;
call fo::funcoffs::interpretPopShort_;
mov esi, eax; // type
_GET_ARG(ecx, esi); // get mod value
mov eax, ebx;
call fo::funcoffs::interpretPopLong_;
mov ecx, eax; // mod value
mov eax, ebx;
_GET_ARG_INT(end); // get kill type value
_GET_ARG_INT(end); // get kill type value
cmp si, VAR_TYPE_INT;
jnz end;
cmp extraKillCounter, 1;
@@ -450,13 +447,9 @@ fail:
void __declspec(naked) op_set_bodypart_hit_modifier() {
__asm {
push ecx;
call fo::funcoffs::interpretPopShort_;
mov esi, eax; // type
_GET_ARG(ecx, esi); // get body value
mov eax, ebx;
call fo::funcoffs::interpretPopLong_;
mov ecx, eax; // body value
mov eax, ebx;
_GET_ARG_INT(end); // get modifier value
_GET_ARG_INT(end); // get modifier value
cmp si, VAR_TYPE_INT;
jnz end;
cmp eax, 8; // Body_Head - Body_Uncalled
+33 -109
View File
@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "..\..\..\FalloutEngine\AsmMacros.h"
#include "..\..\..\FalloutEngine\Fallout2.h"
#include "..\..\Perks.h"
#include "..\..\ScriptExtender.h"
#include "..\OpcodeContext.h"
@@ -68,106 +70,32 @@ void sf_get_perk_available(OpcodeContext& ctx) {
ctx.setReturn(result);
}
void __declspec(naked) op_set_perk_name() {
__asm {
pushad;
mov ecx, eax;
call fo::funcoffs::interpretPopShort_;
mov esi, eax;
mov eax, ecx;
call fo::funcoffs::interpretPopLong_;
mov edi, eax;
mov eax, ecx;
call fo::funcoffs::interpretPopShort_;
mov edx, eax;
mov eax, ecx;
call fo::funcoffs::interpretPopLong_;
cmp dx, VAR_TYPE_INT;
jnz end;
cmp si, VAR_TYPE_STR2;
jz next;
cmp si, VAR_TYPE_STR;
jnz end;
next:
mov ebx, edi;
mov edx, esi;
mov esi, eax;
mov eax, ecx;
call fo::funcoffs::interpretGetString_;
push eax;
push esi;
call SetPerkName;
jmp end;
end:
popad;
retn;
}
void sf_set_perk_name(OpcodeContext& ctx) {
Perks::SetPerkName(ctx.arg(0).rawValue(), ctx.arg(1).strValue());
}
void __declspec(naked) op_set_perk_desc() {
__asm {
pushad;
mov ecx, eax;
call fo::funcoffs::interpretPopShort_;
mov esi, eax;
mov eax, ecx;
call fo::funcoffs::interpretPopLong_;
mov edi, eax;
mov eax, ecx;
call fo::funcoffs::interpretPopShort_;
mov edx, eax;
mov eax, ecx;
call fo::funcoffs::interpretPopLong_;
cmp dx, VAR_TYPE_INT;
jnz end;
cmp si, VAR_TYPE_STR2;
jz next;
cmp si, VAR_TYPE_STR;
jnz end;
next:
mov ebx, edi;
mov edx, esi;
mov esi, eax;
mov eax, ecx;
call fo::funcoffs::interpretGetString_;
push eax;
push esi;
call SetPerkDesc;
jmp end;
end:
popad;
retn;
}
void sf_set_perk_desc(OpcodeContext& ctx) {
Perks::SetPerkDesc(ctx.arg(0).rawValue(), ctx.arg(1).strValue());
}
void __declspec(naked) op_set_perk_value() {
__asm {
pushad;
sub edx, 0x5e0 - 8; // offset of value into perk struct; edx = ((edx/4) - 0x178 + 0x8) * 4
push edx;
mov ecx, eax;
call fo::funcoffs::interpretPopShort_;
mov esi, eax;
mov eax, ecx;
call fo::funcoffs::interpretPopLong_;
mov edi, eax;
mov eax, ecx;
call fo::funcoffs::interpretPopShort_;
mov edx, eax;
mov eax, ecx;
call fo::funcoffs::interpretPopLong_;
cmp dx, VAR_TYPE_INT;
jnz fail;
cmp si, VAR_TYPE_INT;
jnz fail;
__asm { // edx - opcode
push edi;
push eax;
call SetPerkValue;
jmp end;
fail:
add esp, 4;
push ecx;
sub edx, 0x5E0 - 8; // offset of value into perk struct: edx = ((edx/4) - 0x178 + 0x8) * 4
mov edi, edx;
_GET_ARG(ecx, esi);
mov eax, ebx;
_GET_ARG_INT(end);
cmp si, VAR_TYPE_INT;
jne end;
push ecx; // value
mov edx, edi; // param (offset)
mov ecx, eax; // perk id
call Perks::SetPerkValue;
end:
popad;
pop ecx;
pop edi;
retn;
}
}
@@ -189,7 +117,7 @@ const char* notPartyMemberErr = "%s() - the object is not a party member.";
void sf_set_selectable_perk_npc(OpcodeContext& ctx) {
auto obj = ctx.arg(0).object();
if (obj->Type() == fo::ObjType::OBJ_TYPE_CRITTER && fo::func::isPartyMember(obj)) {
Perks::SetSelectablePerk(ctx.arg(1).strValue(), ctx.arg(2).rawValue(), ctx.arg(3).rawValue(), ctx.arg(4).strValue(), (obj->id != PLAYER_ID) ? obj->id : 0);
Perks::SetSelectablePerk(ctx.arg(1).strValue(), ctx.arg(2).rawValue(), ctx.arg(3).rawValue(), ctx.arg(4).strValue(), (obj->id != fo::PLAYER_ID) ? obj->id : 0);
} else {
ctx.printOpcodeError(notPartyMemberErr, ctx.getMetaruleName());
ctx.setReturn(-1);
@@ -199,7 +127,7 @@ void sf_set_selectable_perk_npc(OpcodeContext& ctx) {
void sf_set_fake_perk_npc(OpcodeContext& ctx) {
auto obj = ctx.arg(0).object();
if (obj->Type() == fo::ObjType::OBJ_TYPE_CRITTER && fo::func::isPartyMember(obj)) {
Perks::SetFakePerk(ctx.arg(1).strValue(), ctx.arg(2).rawValue(), ctx.arg(3).rawValue(), ctx.arg(4).strValue(), (obj->id != PLAYER_ID) ? obj->id : 0);
Perks::SetFakePerk(ctx.arg(1).strValue(), ctx.arg(2).rawValue(), ctx.arg(3).rawValue(), ctx.arg(4).strValue(), (obj->id != fo::PLAYER_ID) ? obj->id : 0);
} else {
ctx.printOpcodeError(notPartyMemberErr, ctx.getMetaruleName());
ctx.setReturn(-1);
@@ -209,7 +137,7 @@ void sf_set_fake_perk_npc(OpcodeContext& ctx) {
void sf_set_fake_trait_npc(OpcodeContext& ctx) {
auto obj = ctx.arg(0).object();
if (obj->Type() == fo::ObjType::OBJ_TYPE_CRITTER && fo::func::isPartyMember(obj)) {
Perks::SetFakeTrait(ctx.arg(1).strValue(), ctx.arg(2).rawValue(), ctx.arg(3).rawValue(), ctx.arg(4).strValue(), (obj->id != PLAYER_ID) ? obj->id : 0);
Perks::SetFakeTrait(ctx.arg(1).strValue(), ctx.arg(2).rawValue(), ctx.arg(3).rawValue(), ctx.arg(4).strValue(), (obj->id != fo::PLAYER_ID) ? obj->id : 0);
} else {
ctx.printOpcodeError(notPartyMemberErr, ctx.getMetaruleName());
ctx.setReturn(-1);
@@ -218,25 +146,21 @@ void sf_set_fake_trait_npc(OpcodeContext& ctx) {
void __declspec(naked) op_set_perkbox_title() {
__asm {
mov esi, ecx;
push ebx;
push ecx;
mov ecx, eax;
call fo::funcoffs::interpretPopShort_;
mov edx, eax;
mov eax, ecx;
call fo::funcoffs::interpretPopLong_;
mov ecx, eax; // keep script
_GET_ARG(ebx, edx);
cmp dx, VAR_TYPE_STR2;
jz next;
cmp dx, VAR_TYPE_STR;
jnz end;
next:
mov ebx, eax;
mov eax, ecx;
mov eax, ecx; // script
call fo::funcoffs::interpretGetString_;
push eax;
call SetPerkboxTitle;
mov ecx, eax;
call Perks::SetPerkboxTitle;
end:
pop ecx;
mov ecx, esi;
pop ebx;
retn;
}
@@ -281,7 +205,7 @@ void sf_has_fake_perk_npc(OpcodeContext& ctx) {
long result = 0;
auto obj = ctx.arg(0).object();
if (obj->Type() == fo::ObjType::OBJ_TYPE_CRITTER && fo::func::isPartyMember(obj)) {
result = Perks::HasFakePerkOwner(ctx.arg(1).strValue(), (obj->id != PLAYER_ID) ? obj->id : 0);
result = Perks::HasFakePerkOwner(ctx.arg(1).strValue(), (obj->id != fo::PLAYER_ID) ? obj->id : 0);
} else {
ctx.printOpcodeError(notPartyMemberErr, ctx.getMetaruleName());
}
@@ -292,7 +216,7 @@ void sf_has_fake_trait_npc(OpcodeContext& ctx) {
long result = 0;
auto obj = ctx.arg(0).object();
if (obj->Type() == fo::ObjType::OBJ_TYPE_CRITTER && fo::func::isPartyMember(obj)) {
result = Perks::HasFakeTraitOwner(ctx.arg(1).strValue(), (obj->id != PLAYER_ID) ? obj->id : 0);
result = Perks::HasFakeTraitOwner(ctx.arg(1).strValue(), (obj->id != fo::PLAYER_ID) ? obj->id : 0);
} else {
ctx.printOpcodeError(notPartyMemberErr, ctx.getMetaruleName());
}
+2 -2
View File
@@ -31,9 +31,9 @@ void __declspec() op_set_perk_freq();
void sf_get_perk_available(OpcodeContext&);
void __declspec() op_set_perk_name();
void sf_set_perk_name(OpcodeContext&);
void __declspec() op_set_perk_desc();
void sf_set_perk_desc(OpcodeContext&);
void __declspec() op_set_perk_value();
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -40,9 +40,9 @@ void sf_get_critter_base_stat(OpcodeContext&);
void sf_get_critter_extra_stat(OpcodeContext&);
void __declspec() op_set_critter_skill_points();
void sf_set_critter_skill_points(OpcodeContext&);
void __declspec() op_get_critter_skill_points();
void sf_get_critter_skill_points(OpcodeContext&);
void __declspec() op_set_available_skill_points();
@@ -52,21 +52,21 @@ void __declspec() op_mod_skill_points_per_level();
void __declspec() op_get_critter_current_ap();
void __declspec() op_set_critter_current_ap();
void sf_set_critter_current_ap(OpcodeContext&);
void __declspec() op_set_pickpocket_max();
void __declspec() op_set_hit_chance_max();
void __declspec() op_set_critter_hit_chance_mod();
void sf_set_critter_hit_chance_mod(OpcodeContext&);
void __declspec() op_set_base_hit_chance_mod();
void __declspec() op_set_critter_pickpocket_mod();
void sf_set_critter_pickpocket_mod(OpcodeContext&);
void __declspec() op_set_base_pickpocket_mod();
void __declspec() op_set_critter_skill_mod();
void sf_set_critter_skill_mod(OpcodeContext&);
void __declspec() op_set_base_skill_mod();
+12 -54
View File
@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "..\..\..\FalloutEngine\AsmMacros.h"
#include "..\..\..\FalloutEngine\Fallout2.h"
#include "..\..\..\SafeWrite.h"
#include "..\..\LoadGameHook.h"
#include "..\..\ScriptExtender.h"
@@ -150,66 +152,22 @@ void __declspec(naked) op_get_world_map_y_pos() {
void __declspec(naked) op_set_world_map_pos() {
__asm {
push ebx;
push ecx;
push edx;
push edi;
push esi;
mov ecx, eax;
call fo::funcoffs::interpretPopShort_;
mov esi, eax;
mov eax, ecx;
call fo::funcoffs::interpretPopLong_;
mov edi, eax;
mov eax, ecx;
call fo::funcoffs::interpretPopShort_;
mov edx, eax;
mov eax, ecx;
call fo::funcoffs::interpretPopLong_;
cmp dx, VAR_TYPE_INT;
jnz end;
cmp si, VAR_TYPE_INT;
jnz end;
mov ds:[FO_VAR_world_xpos], eax;
mov ds:[FO_VAR_world_ypos], edi;
_GET_ARG(ecx, esi); // get y value
mov eax, ebx;
_GET_ARG_INT(end); // get x value
cmp si, VAR_TYPE_INT;
jne end;
mov ds:[FO_VAR_world_xpos], eax;
mov ds:[FO_VAR_world_ypos], ecx;
end:
pop esi;
pop edi;
pop edx;
pop ecx;
pop ebx;
pop ecx;
retn;
}
}
void __declspec(naked) op_set_map_time_multi() {
__asm {
push ebx;
push ecx;
push edx;
mov ecx, eax;
call fo::funcoffs::interpretPopShort_;
mov edx, eax;
mov eax, ecx;
call fo::funcoffs::interpretPopLong_;
cmp dx, VAR_TYPE_FLOAT;
jz paramWasFloat;
cmp dx, VAR_TYPE_INT;
jnz fail;
push eax;
fild dword ptr [esp];
fstp dword ptr [esp];
jmp end;
paramWasFloat:
push eax;
end:
call SetMapMulti;
fail:
pop edx;
pop ecx;
pop ebx;
retn;
}
void sf_set_map_time_multi(OpcodeContext& ctx) {
Worldmap::SetMapMulti(ctx.arg(0).asFloat());
}
void sf_set_car_intface_art(OpcodeContext& ctx) {
+1 -1
View File
@@ -40,7 +40,7 @@ void __declspec() op_get_world_map_y_pos();
void __declspec() op_set_world_map_pos();
void __declspec() op_set_map_time_multi();
void sf_set_map_time_multi(OpcodeContext&);
void sf_set_car_intface_art(OpcodeContext&);
+151 -148
View File
@@ -63,153 +63,163 @@ static void* opcodes[opcodeCount];
// { argument 1 type, argument 2 type, ...}
// }
static SfallOpcodeInfo opcodeInfoArray[] = {
{0x15a, "set_pc_base_stat", sf_set_pc_base_stat, 2, false, 0, {ARG_INT, ARG_INT}},
{0x15b, "set_pc_extra_stat", sf_set_pc_extra_stat, 2, false, 0, {ARG_INT, ARG_INT}},
{0x15c, "get_pc_base_stat", sf_get_pc_base_stat, 1, true, 0, {ARG_INT}},
{0x15d, "get_pc_extra_stat", sf_get_pc_extra_stat, 1, true, 0, {ARG_INT}},
{0x15e, "set_critter_base_stat", sf_set_critter_base_stat, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x15f, "set_critter_extra_stat", sf_set_critter_extra_stat, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x160, "get_critter_base_stat", sf_get_critter_base_stat, 2, true, 0, {ARG_OBJECT, ARG_INT}},
{0x161, "get_critter_extra_stat", sf_get_critter_extra_stat, 2, true, 0, {ARG_OBJECT, ARG_INT}},
{0x163, "get_year", sf_get_year, 0, true},
{0x16c, "key_pressed", sf_key_pressed, 1, true, 0, {ARG_INT}},
{0x171, "force_encounter", sf_force_encounter, 1, false, 0, {ARG_INT}},
{0x175, "set_dm_model", sf_set_dm_model, 1, false, 0, {ARG_STRING}},
{0x176, "set_df_model", sf_set_df_model, 1, false, 0, {ARG_STRING}},
{0x177, "set_movie_path", sf_set_movie_path, 2, false, 0, {ARG_STRING, ARG_INT}},
{0x15a, "set_pc_base_stat", sf_set_pc_base_stat, 2, false, 0, {ARG_INT, ARG_INT}},
{0x15b, "set_pc_extra_stat", sf_set_pc_extra_stat, 2, false, 0, {ARG_INT, ARG_INT}},
{0x15c, "get_pc_base_stat", sf_get_pc_base_stat, 1, true, 0, {ARG_INT}},
{0x15d, "get_pc_extra_stat", sf_get_pc_extra_stat, 1, true, 0, {ARG_INT}},
{0x15e, "set_critter_base_stat", sf_set_critter_base_stat, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x15f, "set_critter_extra_stat", sf_set_critter_extra_stat, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x160, "get_critter_base_stat", sf_get_critter_base_stat, 2, true, 0, {ARG_OBJECT, ARG_INT}},
{0x161, "get_critter_extra_stat", sf_get_critter_extra_stat, 2, true, 0, {ARG_OBJECT, ARG_INT}},
{0x163, "get_year", sf_get_year, 0, true},
{0x16c, "key_pressed", sf_key_pressed, 1, true, 0, {ARG_INT}},
{0x171, "force_encounter", sf_force_encounter, 1, false, 0, {ARG_INT}},
{0x175, "set_dm_model", sf_set_dm_model, 1, false, 0, {ARG_STRING}},
{0x176, "set_df_model", sf_set_df_model, 1, false, 0, {ARG_STRING}},
{0x177, "set_movie_path", sf_set_movie_path, 2, false, 0, {ARG_STRING, ARG_INT}},
{0x190, "get_perk_available", sf_get_perk_available, 1, true, 0, {ARG_INT}},
{0x195, "set_weapon_knockback", sf_set_object_knockback, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_NUMBER}},
{0x196, "set_target_knockback", sf_set_object_knockback, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_NUMBER}},
{0x197, "set_attacker_knockback", sf_set_object_knockback, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_NUMBER}},
{0x198, "remove_weapon_knockback", sf_remove_object_knockback, 1, false, 0, {ARG_OBJECT}},
{0x199, "remove_target_knockback", sf_remove_object_knockback, 1, false, 0, {ARG_OBJECT}},
{0x19a, "remove_attacker_knockback", sf_remove_object_knockback, 1, false, 0, {ARG_OBJECT}},
{0x19d, "set_sfall_global", sf_set_sfall_global, 2, false, 0, {ARG_INTSTR, ARG_NUMBER}},
{0x19e, "get_sfall_global_int", sf_get_sfall_global_int, 1, true, 0, {ARG_INTSTR}},
{0x19f, "get_sfall_global_float", sf_get_sfall_global_float, 1, true, 0, {ARG_INTSTR}},
{0x1a5, "inc_npc_level", sf_inc_npc_level, 1, false, 0, {ARG_INTSTR}},
{0x1aa, "set_xp_mod", sf_set_xp_mod, 1, false, 0, {ARG_INT}},
{0x1ac, "get_ini_setting", sf_get_ini_setting, 1, true, -1, {ARG_STRING}},
{0x189, "set_perk_name", sf_set_perk_name, 2, false, 0, {ARG_INT, ARG_STRING}},
{0x18a, "set_perk_desc", sf_set_perk_desc, 2, false, 0, {ARG_INT, ARG_STRING}},
{0x1bb, "set_fake_perk", sf_set_fake_perk, 4, false, 0, {ARG_STRING, ARG_INT, ARG_INT, ARG_STRING}},
{0x1bc, "set_fake_trait", sf_set_fake_trait, 4, false, 0, {ARG_STRING, ARG_INT, ARG_INT, ARG_STRING}},
{0x1bd, "set_selectable_perk", sf_set_selectable_perk, 4, false, 0, {ARG_STRING, ARG_INT, ARG_INT, ARG_STRING}},
{0x1c1, "has_fake_perk", sf_has_fake_perk, 1, true, 0, {ARG_INTSTR}},
{0x1c2, "has_fake_trait", sf_has_fake_trait, 1, true, 0, {ARG_STRING}},
{0x190, "get_perk_available", sf_get_perk_available, 1, true, 0, {ARG_INT}},
{0x192, "set_critter_current_ap", sf_set_critter_current_ap, 2, false, 0, {ARG_OBJECT, ARG_INT}},
{0x195, "set_weapon_knockback", sf_set_object_knockback, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_NUMBER}},
{0x196, "set_target_knockback", sf_set_object_knockback, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_NUMBER}},
{0x197, "set_attacker_knockback", sf_set_object_knockback, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_NUMBER}},
{0x198, "remove_weapon_knockback", sf_remove_object_knockback, 1, false, 0, {ARG_OBJECT}},
{0x199, "remove_target_knockback", sf_remove_object_knockback, 1, false, 0, {ARG_OBJECT}},
{0x19a, "remove_attacker_knockback", sf_remove_object_knockback, 1, false, 0, {ARG_OBJECT}},
{0x19d, "set_sfall_global", sf_set_sfall_global, 2, false, 0, {ARG_INTSTR, ARG_NUMBER}},
{0x19e, "get_sfall_global_int", sf_get_sfall_global_int, 1, true, 0, {ARG_INTSTR}},
{0x19f, "get_sfall_global_float", sf_get_sfall_global_float, 1, true, 0, {ARG_INTSTR}},
{0x1a5, "inc_npc_level", sf_inc_npc_level, 1, false, 0, {ARG_INTSTR}},
{0x1aa, "set_xp_mod", sf_set_xp_mod, 1, false, 0, {ARG_INT}},
{0x1ac, "get_ini_setting", sf_get_ini_setting, 1, true, -1, {ARG_STRING}},
{0x1dc, "show_iface_tag", sf_show_iface_tag, 1, false, 0, {ARG_INT}},
{0x1dd, "hide_iface_tag", sf_hide_iface_tag, 1, false, 0, {ARG_INT}},
{0x1de, "is_iface_tag_active", sf_is_iface_tag_active, 1, true, 0, {ARG_INT}},
{0x1e1, "set_critical_table", sf_set_critical_table, 5, false, 0, {ARG_INT, ARG_INT, ARG_INT, ARG_INT, ARG_INT}},
{0x1e2, "get_critical_table", sf_get_critical_table, 4, true, 0, {ARG_INT, ARG_INT, ARG_INT, ARG_INT}},
{0x1e3, "reset_critical_table", sf_reset_critical_table, 4, false, 0, {ARG_INT, ARG_INT, ARG_INT, ARG_INT}},
{0x1eb, "get_ini_string", sf_get_ini_string, 1, true, -1, {ARG_STRING}},
{0x1ec, "sqrt", sf_sqrt, 1, true, 0, {ARG_NUMBER}},
{0x1ed, "abs", sf_abs, 1, true, 0, {ARG_NUMBER}},
{0x1ee, "sin", sf_sin, 1, true, 0, {ARG_NUMBER}},
{0x1ef, "cos", sf_cos, 1, true, 0, {ARG_NUMBER}},
{0x1f0, "tan", sf_tan, 1, true, 0, {ARG_NUMBER}},
{0x1f1, "arctan", sf_arctan, 2, true, 0, {ARG_NUMBER, ARG_NUMBER}},
{0x1f2, "set_palette", sf_set_palette, 1, false, 0, {ARG_STRING}},
{0x1f3, "remove_script", sf_remove_script, 1, false, 0, {ARG_OBJECT}},
{0x1f4, "set_script", sf_set_script, 2, false, 0, {ARG_OBJECT, ARG_INT}},
{0x1f5, "get_script", sf_get_script, 1, true, -1, {ARG_OBJECT}},
{0x1bb, "set_fake_perk", sf_set_fake_perk, 4, false, 0, {ARG_STRING, ARG_INT, ARG_INT, ARG_STRING}},
{0x1bc, "set_fake_trait", sf_set_fake_trait, 4, false, 0, {ARG_STRING, ARG_INT, ARG_INT, ARG_STRING}},
{0x1bd, "set_selectable_perk", sf_set_selectable_perk, 4, false, 0, {ARG_STRING, ARG_INT, ARG_INT, ARG_STRING}},
{0x1c1, "has_fake_perk", sf_has_fake_perk, 1, true, 0, {ARG_INTSTR}},
{0x1c2, "has_fake_trait", sf_has_fake_trait, 1, true, 0, {ARG_STRING}},
{0x1c5, "set_critter_hit_chance_mod", sf_set_critter_hit_chance_mod,3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x1c7, "set_critter_skill_mod", sf_set_critter_skill_mod, 2, false, 0, {ARG_OBJECT, ARG_INT}},
{0x1c9, "set_critter_pickpocket_mod", sf_set_critter_pickpocket_mod,3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x1f7, "fs_create", sf_fs_create, 2, true, -1, {ARG_STRING, ARG_INT}},
{0x1f8, "fs_copy", sf_fs_copy, 2, true, -1, {ARG_STRING, ARG_STRING}},
{0x1f9, "fs_find", sf_fs_find, 1, true, -1, {ARG_STRING}},
{0x1fa, "fs_write_byte", sf_fs_write_byte, 2, false, 0, {ARG_INT, ARG_INT}},
{0x1fb, "fs_write_short", sf_fs_write_short, 2, false, 0, {ARG_INT, ARG_INT}},
{0x1fc, "fs_write_int", sf_fs_write_int, 2, false, 0, {ARG_INT, ARG_INT}},
{0x1fd, "fs_write_int", sf_fs_write_int, 2, false, 0, {ARG_INT, ARG_INT}},
{0x1fe, "fs_write_string", sf_fs_write_string, 2, false, 0, {ARG_INT, ARG_STRING}},
{0x1ff, "fs_delete", sf_fs_delete, 1, false, 0, {ARG_INT}},
{0x200, "fs_size", sf_fs_size, 1, true, 0, {ARG_INT}},
{0x201, "fs_pos", sf_fs_pos, 1, true, -1, {ARG_INT}},
{0x202, "fs_seek", sf_fs_seek, 2, false, 0, {ARG_INT, ARG_INT}},
{0x203, "fs_resize", sf_fs_resize, 2, false, 0, {ARG_INT, ARG_INT}},
{0x204, "get_proto_data", sf_get_proto_data, 2, true, -1, {ARG_INT, ARG_INT}},
{0x205, "set_proto_data", sf_set_proto_data, 3, false, 0, {ARG_INT, ARG_INT, ARG_INT}},
{0x207, "register_hook", sf_register_hook, 1, false, 0, {ARG_INT}},
{0x208, "fs_write_bstring", sf_fs_write_bstring, 2, false, 0, {ARG_INT, ARG_STRING}},
{0x209, "fs_read_byte", sf_fs_read_byte, 1, true, 0, {ARG_INT}},
{0x20a, "fs_read_short", sf_fs_read_short, 1, true, 0, {ARG_INT}},
{0x20b, "fs_read_int", sf_fs_read_int, 1, true, 0, {ARG_INT}},
{0x20c, "fs_read_float", sf_fs_read_float, 1, true, 0, {ARG_INT}},
{0x20d, "list_begin", sf_list_begin, 1, true, 0, {ARG_INT}},
{0x20e, "list_next", sf_list_next, 1, true, 0, {ARG_INT}},
{0x20f, "list_end", sf_list_end, 1, false, 0, {ARG_INT}},
{0x210, "sfall_ver_major", sf_sfall_ver_major, 0, true},
{0x211, "sfall_ver_minor", sf_sfall_ver_minor, 0, true},
{0x212, "sfall_ver_build", sf_sfall_ver_build, 0, true},
{0x216, "set_critter_burst_disable", sf_set_critter_burst_disable, 2, false, 0, {ARG_OBJECT, ARG_INT}},
{0x217, "get_weapon_ammo_pid", sf_get_weapon_ammo_pid, 1, true, -1, {ARG_OBJECT}},
{0x218, "set_weapon_ammo_pid", sf_set_weapon_ammo_pid, 2, false, 0, {ARG_OBJECT, ARG_INT}},
{0x219, "get_weapon_ammo_count", sf_get_weapon_ammo_count, 1, true, 0, {ARG_OBJECT}},
{0x21a, "set_weapon_ammo_count", sf_set_weapon_ammo_count, 2, false, 0, {ARG_OBJECT, ARG_INT}},
{0x21e, "get_mouse_buttons", sf_get_mouse_buttons, 0, true},
{0x1dc, "show_iface_tag", sf_show_iface_tag, 1, false, 0, {ARG_INT}},
{0x1dd, "hide_iface_tag", sf_hide_iface_tag, 1, false, 0, {ARG_INT}},
{0x1de, "is_iface_tag_active", sf_is_iface_tag_active, 1, true, 0, {ARG_INT}},
{0x1e1, "set_critical_table", sf_set_critical_table, 5, false, 0, {ARG_INT, ARG_INT, ARG_INT, ARG_INT, ARG_INT}},
{0x1e2, "get_critical_table", sf_get_critical_table, 4, true, 0, {ARG_INT, ARG_INT, ARG_INT, ARG_INT}},
{0x1e3, "reset_critical_table", sf_reset_critical_table, 4, false, 0, {ARG_INT, ARG_INT, ARG_INT, ARG_INT}},
{0x1eb, "get_ini_string", sf_get_ini_string, 1, true, -1, {ARG_STRING}},
{0x1ec, "sqrt", sf_sqrt, 1, true, 0, {ARG_NUMBER}},
{0x1ed, "abs", sf_abs, 1, true, 0, {ARG_NUMBER}},
{0x1ee, "sin", sf_sin, 1, true, 0, {ARG_NUMBER}},
{0x1ef, "cos", sf_cos, 1, true, 0, {ARG_NUMBER}},
{0x1f0, "tan", sf_tan, 1, true, 0, {ARG_NUMBER}},
{0x1f1, "arctan", sf_arctan, 2, true, 0, {ARG_NUMBER, ARG_NUMBER}},
{0x1f2, "set_palette", sf_set_palette, 1, false, 0, {ARG_STRING}},
{0x1f3, "remove_script", sf_remove_script, 1, false, 0, {ARG_OBJECT}},
{0x1f4, "set_script", sf_set_script, 2, false, 0, {ARG_OBJECT, ARG_INT}},
{0x1f5, "get_script", sf_get_script, 1, true, -1, {ARG_OBJECT}},
{0x224, "create_message_window", sf_create_message_window, 1, false, 0, {ARG_STRING}},
{0x228, "get_attack_type", sf_get_attack_type, 0, true},
{0x229, "force_encounter_with_flags", sf_force_encounter, 2, false, 0, {ARG_INT, ARG_INT}},
{0x22b, "play_sfall_sound", sf_play_sfall_sound, 2, true, 0, {ARG_STRING, ARG_INT}},
{0x22d, "create_array", sf_create_array, 2, true, -1, {ARG_INT, ARG_INT}},
{0x22e, "set_array", sf_set_array, 3, false, 0, {ARG_OBJECT, ARG_ANY, ARG_ANY}},
{0x22f, "get_array", sf_get_array, 2, true}, // can also be used on strings
{0x230, "free_array", sf_free_array, 1, false, 0, {ARG_OBJECT}},
{0x231, "len_array", sf_len_array, 1, true, 0, {ARG_INT}},
{0x232, "resize_array", sf_resize_array, 2, false, 0, {ARG_OBJECT, ARG_INT}},
{0x233, "temp_array", sf_temp_array, 2, true, -1, {ARG_INT, ARG_INT}},
{0x234, "fix_array", sf_fix_array, 1, false, 0, {ARG_OBJECT}},
{0x235, "string_split", sf_string_split, 2, true, -1, {ARG_STRING, ARG_STRING}},
{0x236, "list_as_array", sf_list_as_array, 1, true, -1, {ARG_INT}},
{0x237, "atoi", sf_atoi, 1, true, 0, {ARG_STRING}},
{0x238, "atof", sf_atof, 1, true, 0, {ARG_STRING}},
{0x239, "scan_array", sf_scan_array, 2, true, -1, {ARG_OBJECT, ARG_ANY}},
{0x23c, "get_sfall_args", sf_get_sfall_args, 0, true},
{0x23d, "set_sfall_arg", sf_set_sfall_arg, 2, false, 0, {ARG_INT, ARG_INT}},
{0x241, "get_npc_level", sf_get_npc_level, 1, true, -1, {ARG_INTSTR}},
{0x1f7, "fs_create", sf_fs_create, 2, true, -1, {ARG_STRING, ARG_INT}},
{0x1f8, "fs_copy", sf_fs_copy, 2, true, -1, {ARG_STRING, ARG_STRING}},
{0x1f9, "fs_find", sf_fs_find, 1, true, -1, {ARG_STRING}},
{0x1fa, "fs_write_byte", sf_fs_write_byte, 2, false, 0, {ARG_INT, ARG_INT}},
{0x1fb, "fs_write_short", sf_fs_write_short, 2, false, 0, {ARG_INT, ARG_INT}},
{0x1fc, "fs_write_int", sf_fs_write_int, 2, false, 0, {ARG_INT, ARG_INT}},
{0x1fd, "fs_write_int", sf_fs_write_int, 2, false, 0, {ARG_INT, ARG_INT}},
{0x1fe, "fs_write_string", sf_fs_write_string, 2, false, 0, {ARG_INT, ARG_STRING}},
{0x1ff, "fs_delete", sf_fs_delete, 1, false, 0, {ARG_INT}},
{0x200, "fs_size", sf_fs_size, 1, true, 0, {ARG_INT}},
{0x201, "fs_pos", sf_fs_pos, 1, true, -1, {ARG_INT}},
{0x202, "fs_seek", sf_fs_seek, 2, false, 0, {ARG_INT, ARG_INT}},
{0x203, "fs_resize", sf_fs_resize, 2, false, 0, {ARG_INT, ARG_INT}},
{0x204, "get_proto_data", sf_get_proto_data, 2, true, -1, {ARG_INT, ARG_INT}},
{0x205, "set_proto_data", sf_set_proto_data, 3, false, 0, {ARG_INT, ARG_INT, ARG_INT}},
{0x207, "register_hook", sf_register_hook, 1, false, 0, {ARG_INT}},
{0x208, "fs_write_bstring", sf_fs_write_bstring, 2, false, 0, {ARG_INT, ARG_STRING}},
{0x209, "fs_read_byte", sf_fs_read_byte, 1, true, 0, {ARG_INT}},
{0x20a, "fs_read_short", sf_fs_read_short, 1, true, 0, {ARG_INT}},
{0x20b, "fs_read_int", sf_fs_read_int, 1, true, 0, {ARG_INT}},
{0x20c, "fs_read_float", sf_fs_read_float, 1, true, 0, {ARG_INT}},
{0x20d, "list_begin", sf_list_begin, 1, true, 0, {ARG_INT}},
{0x20e, "list_next", sf_list_next, 1, true, 0, {ARG_INT}},
{0x20f, "list_end", sf_list_end, 1, false, 0, {ARG_INT}},
{0x210, "sfall_ver_major", sf_sfall_ver_major, 0, true},
{0x211, "sfall_ver_minor", sf_sfall_ver_minor, 0, true},
{0x212, "sfall_ver_build", sf_sfall_ver_build, 0, true},
{0x216, "set_critter_burst_disable", sf_set_critter_burst_disable, 2, false, 0, {ARG_OBJECT, ARG_INT}},
{0x217, "get_weapon_ammo_pid", sf_get_weapon_ammo_pid, 1, true, -1, {ARG_OBJECT}},
{0x218, "set_weapon_ammo_pid", sf_set_weapon_ammo_pid, 2, false, 0, {ARG_OBJECT, ARG_INT}},
{0x219, "get_weapon_ammo_count", sf_get_weapon_ammo_count, 1, true, 0, {ARG_OBJECT}},
{0x21a, "set_weapon_ammo_count", sf_set_weapon_ammo_count, 2, false, 0, {ARG_OBJECT, ARG_INT}},
{0x21e, "get_mouse_buttons", sf_get_mouse_buttons, 0, true},
{0x24e, "substr", sf_substr, 3, true, -1, {ARG_STRING, ARG_INT, ARG_INT}},
{0x24f, "strlen", sf_strlen, 1, true, 0, {ARG_STRING}},
{0x250, "sprintf", sf_sprintf, 2, true, 0, {ARG_STRING, ARG_ANY}},
{0x251, "charcode", sf_ord, 1, true, 0, {ARG_STRING}},
{0x224, "create_message_window", sf_create_message_window, 1, false, 0, {ARG_STRING}},
{0x228, "get_attack_type", sf_get_attack_type, 0, true},
{0x229, "force_encounter_with_flags", sf_force_encounter, 2, false, 0, {ARG_INT, ARG_INT}},
{0x22a, "set_map_time_multi", sf_set_map_time_multi, 1, false, 0, {ARG_NUMBER}},
{0x22b, "play_sfall_sound", sf_play_sfall_sound, 2, true, 0, {ARG_STRING, ARG_INT}},
{0x22d, "create_array", sf_create_array, 2, true, -1, {ARG_INT, ARG_INT}},
{0x22e, "set_array", sf_set_array, 3, false, 0, {ARG_OBJECT, ARG_ANY, ARG_ANY}},
{0x22f, "get_array", sf_get_array, 2, true}, // can also be used on strings
{0x230, "free_array", sf_free_array, 1, false, 0, {ARG_OBJECT}},
{0x231, "len_array", sf_len_array, 1, true, 0, {ARG_INT}},
{0x232, "resize_array", sf_resize_array, 2, false, 0, {ARG_OBJECT, ARG_INT}},
{0x233, "temp_array", sf_temp_array, 2, true, -1, {ARG_INT, ARG_INT}},
{0x234, "fix_array", sf_fix_array, 1, false, 0, {ARG_OBJECT}},
{0x235, "string_split", sf_string_split, 2, true, -1, {ARG_STRING, ARG_STRING}},
{0x236, "list_as_array", sf_list_as_array, 1, true, -1, {ARG_INT}},
{0x237, "atoi", sf_atoi, 1, true, 0, {ARG_STRING}},
{0x238, "atof", sf_atof, 1, true, 0, {ARG_STRING}},
{0x239, "scan_array", sf_scan_array, 2, true, -1, {ARG_OBJECT, ARG_ANY}},
{0x23c, "get_sfall_args", sf_get_sfall_args, 0, true},
{0x23d, "set_sfall_arg", sf_set_sfall_arg, 2, false, 0, {ARG_INT, ARG_INT}},
{0x241, "get_npc_level", sf_get_npc_level, 1, true, -1, {ARG_INTSTR}},
{0x242, "set_critter_skill_points", sf_set_critter_skill_points, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x243, "get_critter_skill_points", sf_get_critter_skill_points, 2, true, 0, {ARG_OBJECT, ARG_INT}},
{0x24e, "substr", sf_substr, 3, true, -1, {ARG_STRING, ARG_INT, ARG_INT}},
{0x24f, "strlen", sf_strlen, 1, true, 0, {ARG_STRING}},
{0x250, "sprintf", sf_sprintf, 2, true, 0, {ARG_STRING, ARG_ANY}},
{0x251, "charcode", sf_ord, 1, true, 0, {ARG_STRING}},
// 0x252 // RESERVED
{0x253, "typeof", sf_typeof, 1, true},
{0x254, "save_array", sf_save_array, 2, false, 0, {ARG_ANY, ARG_OBJECT}},
{0x255, "load_array", sf_load_array, 1, true, -1, {ARG_INTSTR}},
{0x256, "array_key", sf_get_array_key, 2, true, 0, {ARG_INT, ARG_INT}},
{0x257, "arrayexpr", sf_stack_array, 2, true},
{0x253, "typeof", sf_typeof, 1, true},
{0x254, "save_array", sf_save_array, 2, false, 0, {ARG_ANY, ARG_OBJECT}},
{0x255, "load_array", sf_load_array, 1, true, -1, {ARG_INTSTR}},
{0x256, "array_key", sf_get_array_key, 2, true, 0, {ARG_INT, ARG_INT}},
{0x257, "arrayexpr", sf_stack_array, 2, true},
// 0x258 // RESERVED for arrays
// 0x259 // RESERVED for arrays
{0x25a, "reg_anim_destroy", sf_reg_anim_destroy, 1, false, 0, {ARG_OBJECT}},
{0x25b, "reg_anim_animate_and_hide", sf_reg_anim_animate_and_hide, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x25c, "reg_anim_combat_check", sf_reg_anim_combat_check, 1, false, 0, {ARG_INT}},
{0x25d, "reg_anim_light", sf_reg_anim_light, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x25e, "reg_anim_change_fid", sf_reg_anim_change_fid, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x25f, "reg_anim_take_out", sf_reg_anim_take_out, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x260, "reg_anim_turn_towards", sf_reg_anim_turn_towards, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x261, "metarule2_explosions", sf_explosions_metarule, 3, true, -1, {ARG_INT, ARG_INT, ARG_INT}},
{0x262, "register_hook_proc", sf_register_hook, 2, false, 0, {ARG_INT, ARG_INT}},
{0x263, "power", sf_power, 2, true, 0, {ARG_NUMBER, ARG_NUMBER}}, // '^' operator
{0x264, "log", sf_log, 1, true, 0, {ARG_NUMBER}},
{0x265, "exponent", sf_exponent, 1, true, 0, {ARG_NUMBER}},
{0x266, "ceil", sf_ceil, 1, true, 0, {ARG_NUMBER}},
{0x267, "round", sf_round, 1, true, 0, {ARG_NUMBER}},
{0x25a, "reg_anim_destroy", sf_reg_anim_destroy, 1, false, 0, {ARG_OBJECT}},
{0x25b, "reg_anim_animate_and_hide", sf_reg_anim_animate_and_hide, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x25c, "reg_anim_combat_check", sf_reg_anim_combat_check, 1, false, 0, {ARG_INT}},
{0x25d, "reg_anim_light", sf_reg_anim_light, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x25e, "reg_anim_change_fid", sf_reg_anim_change_fid, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x25f, "reg_anim_take_out", sf_reg_anim_take_out, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x260, "reg_anim_turn_towards", sf_reg_anim_turn_towards, 3, false, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x261, "metarule2_explosions", sf_explosions_metarule, 3, true, -1, {ARG_INT, ARG_INT, ARG_INT}},
{0x262, "register_hook_proc", sf_register_hook, 2, false, 0, {ARG_INT, ARG_INT}},
{0x263, "power", sf_power, 2, true, 0, {ARG_NUMBER, ARG_NUMBER}}, // '^' operator
{0x264, "log", sf_log, 1, true, 0, {ARG_NUMBER}},
{0x265, "exponent", sf_exponent, 1, true, 0, {ARG_NUMBER}},
{0x266, "ceil", sf_ceil, 1, true, 0, {ARG_NUMBER}},
{0x267, "round", sf_round, 1, true, 0, {ARG_NUMBER}},
// 0x268 RESERVED
// 0x269 RESERVED
{0x26b, "message_str_game", sf_message_str_game, 2, true, 0, {ARG_INT, ARG_INT}},
{0x26c, "sneak_success", sf_sneak_success, 0, true},
{0x26d, "tile_light", sf_tile_light, 2, true, -1, {ARG_INT, ARG_INT}},
{0x26e, "obj_blocking_line", sf_make_straight_path, 3, true, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x26f, "obj_blocking_tile", sf_obj_blocking_at, 3, true, 0, {ARG_INT, ARG_INT, ARG_INT}},
{0x270, "tile_get_objs", sf_tile_get_objects, 2, true, -1, {ARG_INT, ARG_INT}},
{0x271, "party_member_list", sf_get_party_members, 1, true, -1, {ARG_INT}},
{0x272, "path_find_to", sf_make_path, 3, true, -1, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x273, "create_spatial", sf_create_spatial, 4, true, 0, {ARG_INT, ARG_INT, ARG_INT, ARG_INT}},
{0x274, "art_exists", sf_art_exists, 1, true, 0, {ARG_INT}},
{0x275, "obj_is_carrying_obj", sf_obj_is_carrying_obj, 2, true, 0, {ARG_OBJECT, ARG_OBJECT}},
{0x26b, "message_str_game", sf_message_str_game, 2, true, 0, {ARG_INT, ARG_INT}},
{0x26c, "sneak_success", sf_sneak_success, 0, true},
{0x26d, "tile_light", sf_tile_light, 2, true, -1, {ARG_INT, ARG_INT}},
{0x26e, "obj_blocking_line", sf_make_straight_path, 3, true, 0, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x26f, "obj_blocking_tile", sf_obj_blocking_at, 3, true, 0, {ARG_INT, ARG_INT, ARG_INT}},
{0x270, "tile_get_objs", sf_tile_get_objects, 2, true, -1, {ARG_INT, ARG_INT}},
{0x271, "party_member_list", sf_get_party_members, 1, true, -1, {ARG_INT}},
{0x272, "path_find_to", sf_make_path, 3, true, -1, {ARG_OBJECT, ARG_INT, ARG_INT}},
{0x273, "create_spatial", sf_create_spatial, 4, true, 0, {ARG_INT, ARG_INT, ARG_INT, ARG_INT}},
{0x274, "art_exists", sf_art_exists, 1, true, 0, {ARG_INT}},
{0x275, "obj_is_carrying_obj", sf_obj_is_carrying_obj, 2, true, 0, {ARG_OBJECT, ARG_OBJECT}},
// universal opcodes:
{0x276, "sfall_func0", HandleMetarule, 1, true},
@@ -220,9 +230,9 @@ static SfallOpcodeInfo opcodeInfoArray[] = {
{0x27b, "sfall_func5", HandleMetarule, 6, true},
{0x27c, "sfall_func6", HandleMetarule, 7, true}, // if you need more arguments - use arrays
{0x27d, "register_hook_proc_spec", sf_register_hook, 2, false, 0, {ARG_INT, ARG_INT}},
{0x27e, "reg_anim_callback", sf_reg_anim_callback, 1, false, 0, {ARG_INT}},
{0x27f, "div", sf_div, 2, true, 0, {ARG_NUMBER, ARG_NUMBER}}, // div operator
{0x27d, "register_hook_proc_spec", sf_register_hook, 2, false, 0, {ARG_INT, ARG_INT}},
{0x27e, "reg_anim_callback", sf_reg_anim_callback, 1, false, 0, {ARG_INT}},
{0x27f, "div", sf_div, 2, true, 0, {ARG_NUMBER, ARG_NUMBER}}, // div operator
};
// An array for opcode info, indexed by opcode.
@@ -313,15 +323,12 @@ void InitNewOpcodes() {
for (int i = 0x178; i < 0x189; i++) {
opcodes[i] = op_set_perk_value;
}
opcodes[0x189] = op_set_perk_name;
opcodes[0x18a] = op_set_perk_desc;
opcodes[0x18b] = op_set_pipboy_available;
opcodes[0x18c] = op_get_kill_counter;
opcodes[0x18d] = op_mod_kill_counter;
opcodes[0x18e] = op_get_perk_owed;
opcodes[0x18f] = op_set_perk_owed;
opcodes[0x191] = op_get_critter_current_ap;
opcodes[0x192] = op_set_critter_current_ap;
opcodes[0x193] = op_active_hand;
opcodes[0x194] = op_toggle_active_hand;
opcodes[0x19b] = op_set_global_script_type;
@@ -355,11 +362,10 @@ void InitNewOpcodes() {
opcodes[0x1c0] = op_show_real_perks;
opcodes[0x1c3] = op_perk_add_mode;
opcodes[0x1c4] = op_clear_selectable_perks;
opcodes[0x1c5] = op_set_critter_hit_chance_mod;
opcodes[0x1c6] = op_set_base_hit_chance_mod;
opcodes[0x1c7] = op_set_critter_skill_mod;
opcodes[0x1c8] = op_set_base_skill_mod;
opcodes[0x1c9] = op_set_critter_pickpocket_mod;
opcodes[0x1ca] = op_set_base_pickpocket_mod;
opcodes[0x1cb] = op_set_pyromaniac_mod;
opcodes[0x1cc] = op_apply_heaveho_fix;
@@ -392,7 +398,6 @@ void InitNewOpcodes() {
opcodes[0x225] = op_remove_trait;
opcodes[0x226] = op_get_light_level;
opcodes[0x227] = op_refresh_pc_art;
opcodes[0x22a] = op_set_map_time_multi;
opcodes[0x22c] = op_stop_sfall_sound;
opcodes[0x23a] = op_get_tile_fid;
@@ -400,8 +405,6 @@ void InitNewOpcodes() {
opcodes[0x23e] = op_force_aimed_shots;
opcodes[0x23f] = op_disable_aimed_shots;
opcodes[0x240] = op_mark_movie_played;
opcodes[0x242] = op_set_critter_skill_points;
opcodes[0x243] = op_get_critter_skill_points;
opcodes[0x244] = op_set_available_skill_points;
opcodes[0x245] = op_get_available_skill_points;
opcodes[0x246] = op_mod_skill_points_per_level;

Some files were not shown because too many files have changed in this diff Show More