From aca6fdf9307c552aba9a732822459d6478a42023 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Sat, 21 Sep 2019 23:22:27 +0800 Subject: [PATCH] Added support for new "register_hook_proc_spec" function Updated document & version number. --- Opcode.h | 24 +++++++++++++----------- OpcodeAttributes.cpp | 19 +++++++++++-------- main.cpp | 4 ++-- sfall opcode list.txt | 30 ++++++++++++++++-------------- 4 files changed, 42 insertions(+), 35 deletions(-) diff --git a/Opcode.h b/Opcode.h index de09b73..30200a4 100644 --- a/Opcode.h +++ b/Opcode.h @@ -690,10 +690,10 @@ public: O_TS_GET_NPC_LEVEL, - O_TS_SET_CRITTER_SKILL_POINTS, - O_TS_GET_CRITTER_SKILL_POINTS, - O_TS_SET_AVAILABLE_SKILL_POINTS, - O_TS_GET_AVAILABLE_SKILL_POINTS, + O_TS_SET_CRITTER_SKILL_POINTS, + O_TS_GET_CRITTER_SKILL_POINTS, + O_TS_SET_AVAILABLE_SKILL_POINTS, + O_TS_GET_AVAILABLE_SKILL_POINTS, O_TS_MOD_SKILL_POINTS_PER_LEVEL, O_TS_SET_PERK_FREQ, @@ -754,15 +754,17 @@ public: O_TS_ART_EXISTS, O_TS_OBJ_IS_CARRYING_OBJ, - O_TS_SFALL_METARULE0, - O_TS_SFALL_METARULE1, - O_TS_SFALL_METARULE2, - O_TS_SFALL_METARULE3, - O_TS_SFALL_METARULE4, - O_TS_SFALL_METARULE5, - O_TS_SFALL_METARULE6, + O_TS_SFALL_METARULE0, + O_TS_SFALL_METARULE1, + O_TS_SFALL_METARULE2, + O_TS_SFALL_METARULE3, + O_TS_SFALL_METARULE4, + O_TS_SFALL_METARULE5, + O_TS_SFALL_METARULE6, + O_TS_REGISTER_HOOK_PROC2, //sfall end + O_END_OP }; diff --git a/OpcodeAttributes.cpp b/OpcodeAttributes.cpp index 280bb51..c836897 100644 --- a/OpcodeAttributes.cpp +++ b/OpcodeAttributes.cpp @@ -789,14 +789,17 @@ COpcode::CF2OpcodeAttributesMap::CF2OpcodeAttributesMap() SetAt(O_TS_ART_EXISTS, COpcodeAttributes("O_TS_ART_EXISTS", "art_exists", 1, expression)); SetAt(O_TS_OBJ_IS_CARRYING_OBJ, COpcodeAttributes("O_TS_OBJ_IS_CARRYING_OBJ", "obj_is_carrying_obj", 2, expression)); - // sfall 3.8 - SetAt(O_TS_SFALL_METARULE0, COpcodeAttributes("O_TS_SFALL_METARULE0", "sfall_func0", 1, expression)); - SetAt(O_TS_SFALL_METARULE1, COpcodeAttributes("O_TS_SFALL_METARULE1", "sfall_func1", 2, expression)); - SetAt(O_TS_SFALL_METARULE2, COpcodeAttributes("O_TS_SFALL_METARULE2", "sfall_func2", 3, expression)); - SetAt(O_TS_SFALL_METARULE3, COpcodeAttributes("O_TS_SFALL_METARULE3", "sfall_func3", 4, expression)); - SetAt(O_TS_SFALL_METARULE4, COpcodeAttributes("O_TS_SFALL_METARULE4", "sfall_func4", 5, expression)); - SetAt(O_TS_SFALL_METARULE5, COpcodeAttributes("O_TS_SFALL_METARULE5", "sfall_func5", 6, expression)); - SetAt(O_TS_SFALL_METARULE6, COpcodeAttributes("O_TS_SFALL_METARULE6", "sfall_func6", 7, expression)); + // sfall 3.8 + SetAt(O_TS_SFALL_METARULE0, COpcodeAttributes("O_TS_SFALL_METARULE0", "sfall_func0", 1, expression)); + SetAt(O_TS_SFALL_METARULE1, COpcodeAttributes("O_TS_SFALL_METARULE1", "sfall_func1", 2, expression)); + SetAt(O_TS_SFALL_METARULE2, COpcodeAttributes("O_TS_SFALL_METARULE2", "sfall_func2", 3, expression)); + SetAt(O_TS_SFALL_METARULE3, COpcodeAttributes("O_TS_SFALL_METARULE3", "sfall_func3", 4, expression)); + SetAt(O_TS_SFALL_METARULE4, COpcodeAttributes("O_TS_SFALL_METARULE4", "sfall_func4", 5, expression)); + SetAt(O_TS_SFALL_METARULE5, COpcodeAttributes("O_TS_SFALL_METARULE5", "sfall_func5", 6, expression)); + SetAt(O_TS_SFALL_METARULE6, COpcodeAttributes("O_TS_SFALL_METARULE6", "sfall_func6", 7, expression)); + + // sfall 4.2/3.8.20 + SetAt(O_TS_REGISTER_HOOK_PROC2, COpcodeAttributes("O_TS_REGISTER_HOOK_PROC2", "register_hook_proc_spec", 2, COpcodeAttributes::TYPE_STATEMENT, COpcodeAttributes::CATEGORY_PREFIX, procArgs_register_hook_proc, 1)); // sfall end SetAt(O_STRINGOP, COpcodeAttributes("O_STRINGOP", "", 0, expression)); diff --git a/main.cpp b/main.cpp index f62fa98..b5abe9b 100644 --- a/main.cpp +++ b/main.cpp @@ -40,10 +40,10 @@ bool ProcessCommandLine(int argc, char* argv[]); int main(int argc, char* argv[]) { - std::cout << "Fallout script decompiler, version 8.4.3 (sfall edition)" << std::endl + std::cout << "Fallout script decompiler, version 8.4.4 (sfall edition)" << std::endl << "Copyright (C) Anchorite (TeamX), 2005-2009" << std::endl << "anchorite2001@yandex.ru" << std::endl - << "Continued by Nirran, phobos2077 (2014-2018)" << std::endl + << "Continued by Nirran, phobos2077 (2014-2019)" << std::endl << "Crossplatformed by alexeevdv (2015)" << std::endl; if (argc < 2 || !ProcessCommandLine(argc, argv)) diff --git a/sfall opcode list.txt b/sfall opcode list.txt index d13bb8e..79f0026 100644 --- a/sfall opcode list.txt +++ b/sfall opcode list.txt @@ -1,8 +1,8 @@ -*0x8156 - int read_byte(int address) -*0x8157 - int read_short(int address) -*0x8158 - int read_int(int address) -*0x8159 - string read_string(int address) +0x8156 - int read_byte(int address) +0x8157 - int read_short(int address) +0x8158 - int read_int(int address) +0x8159 - string read_string(int address) *0x81cf - void write_byte(int address, int value) *0x81d0 - void write_short(int address, int value) @@ -122,9 +122,9 @@ 0x8193 - int active_hand() 0x8194 - void toggle_active_hand() -0x8195 - void set_weapon_knockback(object weapon, int type, float value) -0x8196 - void set_target_knockback(object critter, int type, float value) -0x8197 - void set_attacker_knockback(object critter, int type, float value) +0x8195 - void set_weapon_knockback(object weapon, int type, int/float value) +0x8196 - void set_target_knockback(object critter, int type, int/float value) +0x8197 - void set_attacker_knockback(object critter, int type, int/float value) 0x8198 - void remove_weapon_knockback(object weapon) 0x8199 - void remove_target_knockback(object critter) 0x819a - void remove_attacker_knockback(object critter) @@ -132,13 +132,13 @@ 0x819d - void set_sfall_global(string/int varname, int/float value) 0x819e - int get_sfall_global_int(string/int varname) 0x819f - float get_sfall_global_float(string/int varname) -0x822d - int create_array(int elementcount, int elementsize) +0x822d - int create_array(int element_count, int flags) 0x822e - void set_array(int array, any element, any value) 0x822f - any get_array(int array, any element) 0x8230 - void free_array(int array) 0x8231 - int len_array(int array) -0x8232 - void resize_array(int array, int newelementcount) -0x8233 - int temp_array(int elementcount, int elementsize) +0x8232 - void resize_array(int array, int new_element_count) +0x8233 - int temp_array(int element_count, int flags) 0x8234 - void fix_array(int array) 0x8239 - int scan_array(int array, int/float var) 0x8256 - int array_key(int array, int index) @@ -162,8 +162,8 @@ 0x81a3 - int eax_available() 0x81a4 - void set_eax_environment(int environment) -0x81a5 - void inc_npc_level(string npc) -0x8241 - int get_npc_level(string npc) +0x81a5 - void inc_npc_level(int pid/string name) +0x8241 - int get_npc_level(int pid/string name) 0x81a6 - int get_viewport_x() 0x81a7 - int get_viewport_y() @@ -185,7 +185,7 @@ 0x81be - void set_perkbox_title(string title) 0x81bf - void hide_real_perks() 0x81c0 - void show_real_perks() -0x81c1 - int has_fake_perk(string name) +0x81c1 - int has_fake_perk(string name/int extraPerkID) 0x81c2 - int has_fake_trait(string name) 0x81c3 - void perk_add_mode(int type) 0x81c4 - void clear_selectable_perks() @@ -219,7 +219,7 @@ 0x81e9 - int get_unspent_ap_perk_bonus() 0x81ec - float sqrt(float) -0x81ed - float abs(float) +0x81ed - int/float abs(int/float) 0x81ee - float sin(float) 0x81ef - float cos(float) 0x81f0 - float tan(float) @@ -357,6 +357,8 @@ 0x827b - any sfall_func5(string funcName, arg1, arg2, arg3, arg4, arg5) 0x827c - any sfall_func6(string funcName, arg1, arg2, arg3, arg4, arg5, arg6) +0x827d - void register_hook_proc_spec(int hook, procedure proc) + * These functions require AllowUnsafeScripting to be enabled in ddraw.ini