Merge branch '3.8-maintenance'

This commit is contained in:
NovaRain
2016-11-10 09:14:49 +08:00
45 changed files with 1944 additions and 714 deletions
+9 -3
View File
@@ -1,5 +1,5 @@
;sfall configuration settings ;sfall configuration settings
;v3.7.4 ;v3.8
[Main] [Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file. ;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -345,7 +345,7 @@ CorpseLineOfFireFix=0
;Set a number of milliseconds to idle each input loop ;Set a number of milliseconds to idle each input loop
;Set to -1 to disable ;Set to -1 to disable
;Set to 0 to idle only if other processes are waiting for processor time ;Set to 0 to idle only if other processes are waiting for processor time
;Set to 1 (or some higher number if needed) to prevent 100% cpu use ;Set to 1 (or some higher number if needed, the maximum is 127) to prevent 100% cpu use
ProcessorIdle=-1 ProcessorIdle=-1
;Set to 1 if using the hero appearance mod ;Set to 1 if using the hero appearance mod
@@ -472,6 +472,12 @@ EncounterTableSize=0
;Set to 1 to disable the pipboy alarm button ;Set to 1 to disable the pipboy alarm button
DisablePipboyAlarm=0 DisablePipboyAlarm=0
;Uncomment the next four lines to move the main menu buttons and credit text (the 'Copyright(c)' line on the main menu)
;MainMenuOffsetX=0
;MainMenuOffsetY=0
;MainMenuCreditsOffsetX=0
;MainMenuCreditsOffsetY=0
;Prevents you from using super stims on a critter who is at full health. ;Prevents you from using super stims on a critter who is at full health.
SuperStimExploitFix=0 SuperStimExploitFix=0
@@ -483,7 +489,7 @@ QuickPocketsApCostReduction=2
ObjCanSeeObj_ShootThru_Fix=0 ObjCanSeeObj_ShootThru_Fix=0
;Set to 1 to enable the balanced bullet distribution formula for burst attacks ;Set to 1 to enable the balanced bullet distribution formula for burst attacks
ComputeSprayMod=1 ComputeSprayMod=0
;These options modify the bullet distribution of burst attacks if ComputeSprayMod is 1 ;These options modify the bullet distribution of burst attacks if ComputeSprayMod is 1
;All the bullets are divided into three groups: central, left and right ;All the bullets are divided into three groups: central, left and right
+1 -1
View File
@@ -6,7 +6,7 @@ This folder contains documentation about sfall scripting extensions.
dik.h - DX scancodes constants for use with key_pressed function and HOOK_KEYPRESS dik.h - DX scancodes constants for use with key_pressed function and HOOK_KEYPRESS
sfall function notes.txt - incomplete reference for new opcodes sfall function notes.txt - incomplete reference for new opcodes
sfall function list.txt - list of all sfall opcodes (w/o descriptions) sfall opcode list.txt - list of all sfall opcodes (w/o descriptions)
hookscripts.txt - detailed manual for using hook scripts to modify engine behavior hookscripts.txt - detailed manual for using hook scripts to modify engine behavior
arrays.txt - manual for sfall arrays arrays.txt - manual for sfall arrays
+9
View File
@@ -187,3 +187,12 @@
#define party_member_list_critters party_member_list(0) #define party_member_list_critters party_member_list(0)
#define party_member_list_all party_member_list(1) #define party_member_list_all party_member_list(1)
#define spatial_radius(obj) sfall_func1("spatial_radius", obj)
#define critter_inven_obj2(obj, type) sfall_func2("critter_inven_obj2", obj, type)
#define intface_redraw sfall_func0("intface_redraw")
#define intface_hide sfall_func0("intface_hide")
#define intface_show sfall_func0("intface_show")
#define intface_is_hidden sfall_func0("intface_is_hidden")
#define exec_map_update_scripts sfall_func0("exec_map_update_scripts")
+66 -14
View File
@@ -77,6 +77,22 @@ force_aimed_shots and disable_aimed_shots allow overriding the normal rules rega
get/set_critter_skill_points will get/set the number of additional points a critter has in a skill, on top of whatever they have from their stats and other bonuses. Note that skill points are part of the proto, so calling set_skill_points on a critter will affect all critters that share the same proto. get/set_critter_skill_points will get/set the number of additional points a critter has in a skill, on top of whatever they have from their stats and other bonuses. Note that skill points are part of the proto, so calling set_skill_points on a critter will affect all critters that share the same proto.
------------------------------
------ TYPES REFERENCE -------
------------------------------
> Data types mentioned in this document:
void - means opcode does not return any value
any - any type
int - integer number
float - floating point number
string - string (text) value
object - pointer to game object (actually an integer)
array - array ID to be used with array-related functions (actually an integer)
---------------------------------------------- ----------------------------------------------
------ FUNCTION REFERENCE (incomplete) ------- ------ FUNCTION REFERENCE (incomplete) -------
---------------------------------------------- ----------------------------------------------
@@ -129,15 +145,15 @@ get/set_critter_skill_points will get/set the number of additional points a crit
- adjusts how fast time passes while you're on the world map. It takes a single float as an argument, where 1 is the normal speed. - adjusts how fast time passes while you're on the world map. It takes a single float as an argument, where 1 is the normal speed.
- This function works in addition to the WorldMapTimeMod setting in ddraw.ini and the pathfinder perk, rather than overriding it, so calling set_map_time_multi(0.5) when the player has 2 levels of pathfinder would result in time passing at 25% the normal speed on the world map. - This function works in addition to the WorldMapTimeMod setting in ddraw.ini and the pathfinder perk, rather than overriding it, so calling set_map_time_multi(0.5) when the player has 2 levels of pathfinder would result in time passing at 25% the normal speed on the world map.
> void remove_script(objptr) > void remove_script(object)
- accepts a pointer to an object and will remove the script from that object. - accepts a pointer to an object and will remove the script from that object.
> void set_script(objptr, int scriptid) > void set_script(object, int scriptid)
- accepts a pointer to an object and scriptID, and applies the given script to an object (scriptID accept the same values as create_object_sid from sfall 3.6) - accepts a pointer to an object and scriptID, and applies the given script to an object (scriptID accept the same values as create_object_sid from sfall 3.6)
- If used on an object that is already scripted, it will remove the existing script first; you cannot have multiple scripts attached to a single object. Calling set_script on self_obj will have all sorts of wacky side effects, and should be avoided. - If used on an object that is already scripted, it will remove the existing script first; you cannot have multiple scripts attached to a single object. Calling set_script on self_obj will have all sorts of wacky side effects, and should be avoided.
- if you add 0x80000000 to the sid when calling set_script, map_enter_p_proc will be SKIPPED. The start proc will always be run. - if you add 0x80000000 to the sid when calling set_script, map_enter_p_proc will be SKIPPED. The start proc will always be run.
> int get_script(objptr) > int get_script(object)
- accepts a pointer to an object and returns it's scriptID (line number in scripts.lst), or -1 if the object is unscripted. - accepts a pointer to an object and returns it's scriptID (line number in scripts.lst), or -1 if the object is unscripted.
> void set_self(int obj) > void set_self(int obj)
@@ -159,9 +175,9 @@ get/set_critter_skill_points will get/set the number of additional points a crit
- It is not saved into the save game, so needs to be called once per reload. - It is not saved into the save game, so needs to be called once per reload.
- Be careful not to let the player obtain a perk when no perks are available to pick, or the game may crash. - Be careful not to let the player obtain a perk when no perks are available to pick, or the game may crash.
> ObjectPtr get_last_target(objptr) > object get_last_target(object)
- will return the last critter to be deliberately attacked - will return the last critter to be deliberately attacked
> ObjectPtr get_last_attacker(objptr) > object get_last_attacker(object)
- will return the last critter to deliberately launch an attack against the argument critter. - will return the last critter to deliberately launch an attack against the argument critter.
- If a critter has not launched/recieved an attack, it will return 0. This is only stored for the duration of combat, and outside of combat both functions will always return 0. - If a critter has not launched/recieved an attack, it will return 0. This is only stored for the duration of combat, and outside of combat both functions will always return 0.
@@ -170,7 +186,7 @@ get/set_critter_skill_points will get/set the number of additional points a crit
- "max" will replace 95% success chance cap (so you can set 100% maximum chance, for instance) - "max" will replace 95% success chance cap (so you can set 100% maximum chance, for instance)
- "mod" will add this much percent to each success chance. for example if your chance is 50% and "mod" is 20, you will get 70% actual success rate - "mod" will add this much percent to each success chance. for example if your chance is 50% and "mod" is 20, you will get 70% actual success rate
> void set_critter_pickpocket_mod(CritterPtr, int max, int mod) > void set_critter_pickpocket_mod(object, int max, int mod)
- the same as above, but applies only to specific critter - the same as above, but applies only to specific critter
> void reg_anim_combat_check > void reg_anim_combat_check
@@ -222,17 +238,17 @@ Some utility/math functions are available:
> string substr(string, start, length) > string substr(string, start, length)
- cuts a substring from a string starting at "start" up to "length" characters. If start is negative - it indicates starting position from the end of the string (for example substr("test", -2, 2) will return last 2 charactes: "st"). If length is negative - it means so many characters will be omitted from the end of string (example: substr("test", 0, -2) will return string without last 2 characters: "te") - cuts a substring from a string starting at "start" up to "length" characters. If start is negative - it indicates starting position from the end of the string (for example substr("test", -2, 2) will return last 2 charactes: "st"). If length is negative - it means so many characters will be omitted from the end of string (example: substr("test", 0, -2) will return string without last 2 characters: "te")
> int strlen(char* string) > int strlen(string string)
- returns string length - returns string length
> string sprintf(char* format, any value) > string sprintf(string format, any value)
- formats given value using standart syntax of C printf function (google "printf" for format details). However it is limited to formatting only 1 value. - formats given value using standart syntax of C printf function (google "printf" for format details). However it is limited to formatting only 1 value.
- can be used to get character by ASCII code ("%c") - can be used to get character by ASCII code ("%c")
> int typeof(any value) > int typeof(any value)
- returns type of the given value: VALTYPE_INT, VALTYPE_FLOAT or VALTYPE_STR. - returns type of the given value: VALTYPE_INT, VALTYPE_FLOAT or VALTYPE_STR.
> int charcode(char* string) > int charcode(string string)
- returns ASCII code for the first character in given string - returns ASCII code for the first character in given string
> ^ operator (exponentiation) > ^ operator (exponentiation)
@@ -286,12 +302,12 @@ Some utility/math functions are available:
> int tile_light(int elevation, int tileNum) > int tile_light(int elevation, int tileNum)
- returns light intensity at the given tile in range from 0 to 65535 - returns light intensity at the given tile in range from 0 to 65535
> ObjectPtr obj_blocking_line(ObjectPtr objFrom, int tileTo, int blockingType) > object obj_blocking_line(object objFrom, int tileTo, int blockingType)
- returns first object which blocks direct linear path from objFrom to tileTo using selected blocking function (see BLOCKING_TYPE_* constants in sfall.h) - returns first object which blocks direct linear path from objFrom to tileTo using selected blocking function (see BLOCKING_TYPE_* constants in sfall.h)
- if path is clear (no blocker was encountered by selected function) - returns 0 - if path is clear (no blocker was encountered by selected function) - returns 0
- objFrom is always excluded from calculations, but is required to be a valid object - objFrom is always excluded from calculations, but is required to be a valid object
> ObjectPtr obj_blocking_tile(int tileNum, int elevation, int blockingType) > object obj_blocking_tile(int tileNum, int elevation, int blockingType)
- returns first object blocking given tile using given blocking function or 0 if tile is clear - returns first object blocking given tile using given blocking function or 0 if tile is clear
> array tile_get_objs(int tileNum, int elevation) > array tile_get_objs(int tileNum, int elevation)
@@ -301,22 +317,58 @@ Some utility/math functions are available:
> array party_member_list(int includeHidden) > array party_member_list(int includeHidden)
- returns array of all current party members (0 - only critter-type, alive and visible will be returned, 1 - all object, including Trunk, etc.) - returns array of all current party members (0 - only critter-type, alive and visible will be returned, 1 - all object, including Trunk, etc.)
> array path_find_to(ObjectPtr objFrom, int tileTo, int blockingType) > array path_find_to(object objFrom, int tileTo, int blockingType)
- returns the shortest path to a given tile using given blocking function as an array of tile directions (0..5) to move on each step - returns the shortest path to a given tile using given blocking function as an array of tile directions (0..5) to move on each step
- array length equals to a number of steps - array length equals to a number of steps
- empty array means that specified target cannot be reached - empty array means that specified target cannot be reached
> ObjectPtr create_spatial(int scriptID, int tile, int elevation, int radius) > object create_spatial(int scriptID, int tile, int elevation, int radius)
- creates new spatial script with given SID, at given tile, and radius - creates new spatial script with given SID, at given tile, and radius
> int art_exists(int artFID) > int art_exists(int artFID)
- checks if given artFID exists in the game - checks if given artFID exists in the game
- useful when you want to check if critter can use specific weapon: art_exists((artFid bwand 0xffff0fff) bwor (weaponAnim * 0x1000)) - useful when you want to check if critter can use specific weapon: art_exists((artFid bwand 0xffff0fff) bwor (weaponAnim * 0x1000))
> int obj_is_carrying_obj(ObjectPtr invenObj, ObjectPtr itemObj) > int obj_is_carrying_obj(object invenObj, object itemObj)
- returns number of itemObj inside invenObj's inventory, note that both arguments are object pointers - returns number of itemObj inside invenObj's inventory, note that both arguments are object pointers
- useful when dealing with different stacks of same item (obj_is_carrying_obj_pid just returns total for all stacks of the same PID) - useful when dealing with different stacks of same item (obj_is_carrying_obj_pid just returns total for all stacks of the same PID)
> any sfall_funcX(string funcName, ...)
- these opcodes allows to use additional scripting functions, that do not require new opcode
- first argument is always function name (string)
- there are 7 versions of this opcode for different number of additional arguments (for convenience)
- opcodes have return value, but it is not neccessary to use it
------------------------------------
------ sfall_funcX functions -------
------------------------------------
> array sfall_func0("get_metarule_table")
- returns names of all currently available scripting functions (via sfall_funcX)
> int sfall_func1("spatial_radius", object object)
- return radius of spatial script, associated with given dummy-object (returned by create_spatial)
> object sfall_func2("critter_inven_obj2", object invenObj, int type)
- works just like vanilla critter_inven_obj, but correctly reports item in player's inactive hand slot
> void sfall_func0("intface_redraw")
- redraws main game interface
- useful after direct changes to current player weapons or stats to reflect changes
> void sfall_func0("intface_hide")
- hides main interface
> void sfall_func0("intface_show")
- shows main interface
> int sfall_func0("intface_is_hidden")
- returns 1 if interface is currently hidden, 0 otherwise
> void sfall_func0("exec_map_update_scripts")
- executes map_update_p_proc for all objects on map and global/hook scripts as well
------------------------ ------------------------
------ MORE INFO ------- ------ MORE INFO -------
------------------------ ------------------------
@@ -2,12 +2,12 @@
*0x8156 - int read_byte(int address) *0x8156 - int read_byte(int address)
*0x8157 - int read_short(int address) *0x8157 - int read_short(int address)
*0x8158 - int read_int(int address) *0x8158 - int read_int(int address)
*0x8159 - char* read_string(int address) *0x8159 - string read_string(int address)
*0x81cf - void write_byte(int address, int value) *0x81cf - void write_byte(int address, int value)
*0x81d0 - void write_short(int address, int value) *0x81d0 - void write_short(int address, int value)
*0x81d1 - void write_int(int address, int value) *0x81d1 - void write_int(int address, int value)
*0x821b - void write_string(int address, char* value) *0x821b - void write_string(int address, string value)
*0x81d2 - void call_offset_v0(int address) *0x81d2 - void call_offset_v0(int address)
*0x81d3 - void call_offset_v1(int address, int arg1) *0x81d3 - void call_offset_v1(int address, int arg1)
@@ -25,10 +25,10 @@
0x815c - int get_pc_base_stat(int StatID) 0x815c - int get_pc_base_stat(int StatID)
0x815d - int get_pc_extra_stat(int StatID) 0x815d - int get_pc_extra_stat(int StatID)
0x815e - void set_critter_base_stat(CritterPtr, int StatID, int value) 0x815e - void set_critter_base_stat(object, int StatID, int value)
0x815f - void set_critter_extra_stat(CritterPtr, int StatID, int value) 0x815f - void set_critter_extra_stat(object, int StatID, int value)
0x8160 - int get_critter_base_stat(CritterPtr, int StatID) 0x8160 - int get_critter_base_stat(object, int StatID)
0x8161 - int get_critter_extra_stat(CritterPtr, int StatID) 0x8161 - int get_critter_extra_stat(object, int StatID)
0x8242 - void set_critter_skill_points(int critter, int skill, int value) 0x8242 - void set_critter_skill_points(int critter, int skill, int value)
0x8243 - int get_critter_skill_points(int critter, int skill) 0x8243 - int get_critter_skill_points(int critter, int skill)
0x8244 - void set_available_skill_points(int value) 0x8244 - void set_available_skill_points(int value)
@@ -55,18 +55,18 @@
0x8164 - bool game_loaded() 0x8164 - bool game_loaded()
0x8165 - bool graphics_funcs_available() 0x8165 - bool graphics_funcs_available()
0x8166 - int load_shader(char* path) 0x8166 - int load_shader(string path)
0x8167 - void free_shader(int ID) 0x8167 - void free_shader(int ID)
0x8168 - void activate_shader(int ID) 0x8168 - void activate_shader(int ID)
0x8169 - void deactivate_shader(int ID) 0x8169 - void deactivate_shader(int ID)
0x816d - void set_shader_int(int ID, char* param, int value) 0x816d - void set_shader_int(int ID, string param, int value)
0x816e - void set_shader_float(int ID, char* param, float value) 0x816e - void set_shader_float(int ID, string param, float value)
0x816f - void set_shader_vector(int ID, char* param, float f1, float f2, float f3, float f4) 0x816f - void set_shader_vector(int ID, string param, float f1, float f2, float f3, float f4)
0x81ad - int get_shader_version() 0x81ad - int get_shader_version()
0x81ae - void set_shader_mode(int mode) 0x81ae - void set_shader_mode(int mode)
0x81b0 - void force_graphics_refresh(bool enabled) 0x81b0 - void force_graphics_refresh(bool enabled)
0x81b1 - int get_shader_texture(int ID, int texture) 0x81b1 - int get_shader_texture(int ID, int texture)
0x81b2 - void set_shader_texture(int ID, char* param, int texID) 0x81b2 - void set_shader_texture(int ID, string param, int texID)
0x816a - void set_global_script_repeat(int frames) 0x816a - void set_global_script_repeat(int frames)
0x819b - void set_global_script_type(int type) 0x819b - void set_global_script_type(int type)
@@ -82,9 +82,9 @@
0x8173 - int get_world_map_x_pos() 0x8173 - int get_world_map_x_pos()
0x8174 - int get_world_map_y_pos() 0x8174 - int get_world_map_y_pos()
0x8175 - void set_dm_model(char* name) 0x8175 - void set_dm_model(string name)
0x8176 - void set_df_model(char* name) 0x8176 - void set_df_model(string name)
0x8177 - void set_movie_path(char* filename, int movieid) 0x8177 - void set_movie_path(string filename, int movieid)
0x8178 - void set_perk_image(int perkID, int value) 0x8178 - void set_perk_image(int perkID, int value)
0x8179 - void set_perk_ranks(int perkID, int value) 0x8179 - void set_perk_ranks(int perkID, int value)
@@ -103,8 +103,8 @@
0x8196 - void set_perk_int(int perkID, int value) 0x8196 - void set_perk_int(int perkID, int value)
0x8187 - void set_perk_agl(int perkID, int value) 0x8187 - void set_perk_agl(int perkID, int value)
0x8188 - void set_perk_lck(int perkID, int value) 0x8188 - void set_perk_lck(int perkID, int value)
0x8189 - void set_perk_name(int perkID, char* value) 0x8189 - void set_perk_name(int perkID, string value)
0x818a - void set_perk_desc(int perkID, char* value) 0x818a - void set_perk_desc(int perkID, string value)
0x8247 - void set_perk_freq(int value) 0x8247 - void set_perk_freq(int value)
0x818b - void set_pipboy_available(int available) 0x818b - void set_pipboy_available(int available)
@@ -116,18 +116,18 @@
0x818f - void set_perk_owed(int value) 0x818f - void set_perk_owed(int value)
0x8190 - int get_perk_available(int perk) 0x8190 - int get_perk_available(int perk)
0x8191 - int get_critter_current_ap(CritterPtr) 0x8191 - int get_critter_current_ap(object critter)
0x8192 - void set_critter_current_ap(CritterPtr, int ap) 0x8192 - void set_critter_current_ap(object critter, int ap)
0x8193 - int active_hand() 0x8193 - int active_hand()
0x8194 - void toggle_active_hand() 0x8194 - void toggle_active_hand()
0x8195 - void set_weapon_knockback(WeaponPtr, int type, float value) 0x8195 - void set_weapon_knockback(object weapon, int type, float value)
0x8196 - void set_target_knockback(CritterPtr, int type, float value) 0x8196 - void set_target_knockback(object critter, int type, float value)
0x8197 - void set_attacker_knockback(CritterPtr, int type, float value) 0x8197 - void set_attacker_knockback(object critter, int type, float value)
0x8198 - void remove_weapon_knockback(WeaponPtr) 0x8198 - void remove_weapon_knockback(object weapon)
0x8199 - void remove_target_knockback(CritterPtr) 0x8199 - void remove_target_knockback(object critter)
0x819a - void remove_attacker_knockback(CritterPtr) 0x819a - void remove_attacker_knockback(object critter)
0x819d - void set_sfall_global(string/int varname, int/float value) 0x819d - void set_sfall_global(string/int varname, int/float value)
0x819e - int get_sfall_global_int(string/int varname) 0x819e - int get_sfall_global_int(string/int varname)
@@ -152,26 +152,26 @@
0x81aa - void set_xp_mod(int percentage) 0x81aa - void set_xp_mod(int percentage)
0x81ab - void set_perk_level_mod(int levels) 0x81ab - void set_perk_level_mod(int levels)
0x81c5 - void set_critter_hit_chance_mod(CritterPtr, int max, int mod) 0x81c5 - void set_critter_hit_chance_mod(object, int max, int mod)
0x81c6 - void set_base_hit_chance_mod(int max, int mod) 0x81c6 - void set_base_hit_chance_mod(int max, int mod)
0x81c7 - void set_critter_skill_mod(CritterPtr, int max) 0x81c7 - void set_critter_skill_mod(object, int max)
0x81c8 - void set_base_skill_mod(int max) 0x81c8 - void set_base_skill_mod(int max)
0x81c9 - void set_critter_pickpocket_mod(CritterPtr, int max, int mod) 0x81c9 - void set_critter_pickpocket_mod(object, int max, int mod)
0x81ca - void set_base_pickpocket_mod(int max, int mod) 0x81ca - void set_base_pickpocket_mod(int max, int mod)
0x81a3 - int eax_available() 0x81a3 - int eax_available()
0x81a4 - void set_eax_environment(int environment) 0x81a4 - void set_eax_environment(int environment)
0x81a5 - void inc_npc_level(char* npc) 0x81a5 - void inc_npc_level(string npc)
0x8241 - int get_npc_level(char* npc) 0x8241 - int get_npc_level(string npc)
0x81a6 - int get_viewport_x() 0x81a6 - int get_viewport_x()
0x81a7 - int get_viewport_y() 0x81a7 - int get_viewport_y()
0x81a8 - void set_viewport_x(int view_x) 0x81a8 - void set_viewport_x(int view_x)
0x81a9 - void set_viewport_y(int view_y) 0x81a9 - void set_viewport_y(int view_y)
0x81ac - int get_ini_setting(char* setting) 0x81ac - int get_ini_setting(string setting)
0x81eb - char* get_ini_string(char* setting) 0x81eb - string get_ini_string(string setting)
0x81af - int get_game_mode() 0x81af - int get_game_mode()
@@ -179,14 +179,14 @@
0x81b6 - void set_car_current_town(int town) 0x81b6 - void set_car_current_town(int town)
0x81bb - void set_fake_perk(char* name, int level, int image, char* desc) 0x81bb - void set_fake_perk(string name, int level, int image, string desc)
0x81bc - void set_fake_trait(char* name, int active, int image, char* desc) 0x81bc - void set_fake_trait(string name, int active, int image, string desc)
0x81bd - void set_selectable_perk(char* name, int active, int image, char* desc) 0x81bd - void set_selectable_perk(string name, int active, int image, string desc)
0x81be - void set_perkbox_title(char* title) 0x81be - void set_perkbox_title(string title)
0x81bf - void hide_real_perks() 0x81bf - void hide_real_perks()
0x81c0 - void show_real_perks() 0x81c0 - void show_real_perks()
0x81c1 - int has_fake_perk(char* name) 0x81c1 - int has_fake_perk(string name)
0x81c2 - int has_fake_trait(char* name) 0x81c2 - int has_fake_trait(string name)
0x81c3 - void perk_add_mode(int type) 0x81c3 - void perk_add_mode(int type)
0x81c4 - void clear_selectable_perks() 0x81c4 - void clear_selectable_perks()
0x8225 - void remove_trait(int traitID) 0x8225 - void remove_trait(int traitID)
@@ -231,11 +231,11 @@
0x8266 - int ceil(float) 0x8266 - int ceil(float)
0x8267 - int round(float) 0x8267 - int round(float)
0x81f2 - void set_palette(char* path) 0x81f2 - void set_palette(string path)
0x81f3 - void remove_script(objptr) 0x81f3 - void remove_script(object)
0x81f4 - void set_script(objptr, int scriptid) 0x81f4 - void set_script(object, int scriptid)
0x81f5 - int get_script(objptr) 0x81f5 - int get_script(object)
0x81f6 - int nb_create_char() 0x81f6 - int nb_create_char()
@@ -258,10 +258,10 @@
0x8202 - void fs_seek(int id, int pos) 0x8202 - void fs_seek(int id, int pos)
0x8203 - void fs_resize(int id, int size) 0x8203 - void fs_resize(int id, int size)
0x8204 - int get_proto_data(objptr, int offset) 0x8204 - int get_proto_data(object, int offset)
0x8205 - void set_proto_data(objptr, int offset, int value) 0x8205 - void set_proto_data(object, int offset, int value)
0x8206 - void set_self(objptr) 0x8206 - void set_self(object)
0x8207 - void register_hook(int hook) 0x8207 - void register_hook(int hook)
0x820d - int list_begin(int type) 0x820d - int list_begin(int type)
@@ -277,19 +277,19 @@
0x8214 - void set_hero_race(int style) 0x8214 - void set_hero_race(int style)
0x8215 - void set_hero_style(int style) 0x8215 - void set_hero_style(int style)
0x8216 - void set_critter_burst_disable(objptr critter, int disable) 0x8216 - void set_critter_burst_disable(object critter, int disable)
0x8217 - int get_weapon_ammo_pid(objptr weapon) 0x8217 - int get_weapon_ammo_pid(object weapon)
0x8218 - void set_weapon_ammo_pid(objptr weapon, int pid) 0x8218 - void set_weapon_ammo_pid(object weapon, int pid)
0x8219 - int get_weapon_ammo_count(objptr weapon) 0x8219 - int get_weapon_ammo_count(object weapon)
0x821a - void set_weapon_ammo_count(objptr weapon, int count) 0x821a - void set_weapon_ammo_count(object weapon, int count)
0x8220 - int get_screen_width() 0x8220 - int get_screen_width()
0x8221 - int get_screen_height() 0x8221 - int get_screen_height()
0x8222 - void stop_game() 0x8222 - void stop_game()
0x8223 - void resume_game() 0x8223 - void resume_game()
0x8224 - void create_message_window(char* message) 0x8224 - void create_message_window(string message)
0x8226 - int get_light_level() 0x8226 - int get_light_level()
@@ -297,16 +297,16 @@
0x8228 - int get_attack_type 0x8228 - int get_attack_type
0x822b - int play_sfall_sound(char* file, int loop) 0x822b - int play_sfall_sound(string file, int loop)
0x822c - void stop_sfall_sound(int ptr) 0x822c - void stop_sfall_sound(int ptr)
0x8235 - array string_split(char* string, char* split) 0x8235 - array string_split(string string, string split)
0x8237 - int atoi(char* string) 0x8237 - int atoi(string string)
0x8238 - float atof(char* string) 0x8238 - float atof(string string)
0x824e - char* substr(char* string, int start, int length) 0x824e - string substr(string string, int start, int length)
0x824f - int strlen(char* string) 0x824f - int strlen(string string)
0x8250 - char* sprintf(char* format, any value) 0x8250 - string sprintf(string format, any value)
0x8251 - int charcode(char* string) 0x8251 - int charcode(string string)
0x8253 - int typeof(any value) 0x8253 - int typeof(any value)
0x823a - int get_tile_fid(int tile) 0x823a - int get_tile_fid(int tile)
@@ -318,35 +318,45 @@
0x8240 - void mark_movie_played(int id) 0x8240 - void mark_movie_played(int id)
0x8248 - objptr get_last_target(objptr critter) 0x8248 - object get_last_target(object critter)
0x8249 - objptr get_last_attacker(objptr critter) 0x8249 - object get_last_attacker(object critter)
0x824b - int tile_under_cursor 0x824b - int tile_under_cursor
0x824c - int gdialog_get_barter_mod 0x824c - int gdialog_get_barter_mod
0x824d - void set_inven_ap_cost 0x824d - void set_inven_ap_cost
0x825c - void reg_anim_combat_check(int enable) 0x825c - void reg_anim_combat_check(int enable)
0x825a - void reg_anim_destroy(objptr object) 0x825a - void reg_anim_destroy(object object)
0x825b - void reg_anim_animate_and_hide(objptr object, int animID, int delay) 0x825b - void reg_anim_animate_and_hide(object object, int animID, int delay)
0x825d - void reg_anim_light(objptr object, int radius, int delay) 0x825d - void reg_anim_light(object object, int radius, int delay)
0x825e - void reg_anim_change_fid(objptr object, int FID, int delay) 0x825e - void reg_anim_change_fid(object object, int FID, int delay)
0x825f - void reg_anim_take_out(objptr object, int holdFrameID, int delay) 0x825f - void reg_anim_take_out(object object, int holdFrameID, int delay)
0x8260 - void reg_anim_turn_towards(objptr object, int tile/targetObj, int delay) 0x8260 - void reg_anim_turn_towards(object object, int tile/targetObj, int delay)
0x8261 - int metarule2_explosions(objptr object) 0x8261 - int metarule2_explosions(object object)
0x8262 - void register_hook_proc(int hook, procedure proc) 0x8262 - void register_hook_proc(int hook, procedure proc)
0x8266 - char* message_str_game(int fileId, int messageId) 0x826b - string message_str_game(int fileId, int messageId)
0x8267 - int sneak_success 0x826c - int sneak_success
0x8268 - int tile_light(int elevation, int tileNum) 0x826d - int tile_light(int elevation, int tileNum)
0x8269 - ObjectPtr obj_blocking_line(ObjectPtr objFrom, int tileTo, int blockingType) 0x826e - object obj_blocking_line(object objFrom, int tileTo, int blockingType)
0x826a - ObjectPtr obj_blocking_tile(int tileNum, int elevation, int blockingType) 0x826f - object obj_blocking_tile(int tileNum, int elevation, int blockingType)
0x826b - array tile_get_objs(int tileNum, int elevation) 0x8270 - array tile_get_objs(int tileNum, int elevation)
0x826c - array party_member_list(int includeHidden) 0x8271 - array party_member_list(int includeHidden)
0x826d - array path_find_to(ObjectPtr objFrom, int tileTo, int blockingType) 0x8272 - array path_find_to(object objFrom, int tileTo, int blockingType)
0x826e - ObjectPtr create_spatial(int scriptID, int tile, int elevation, int radius) 0x8273 - object create_spatial(int scriptID, int tile, int elevation, int radius)
0x826f - int art_exists(int artFID) 0x8274 - int art_exists(int artFID)
0x8270 - int obj_is_carrying_obj(ObjectPtr invenObj, ObjectPtr itemObj) 0x8275 - int obj_is_carrying_obj(object invenObj, object itemObj)
0x8276 - any sfall_func0(string funcName)
0x8277 - any sfall_func1(string funcName, arg1)
0x8278 - any sfall_func2(string funcName, arg1, arg2)
0x8279 - any sfall_func3(string funcName, arg1, arg2, arg3)
0x827a - any sfall_func4(string funcName, arg1, arg2, arg3, arg4)
0x827b - any sfall_func5(string funcName, arg1, arg2, arg3, arg4, arg5)
0x827c - any sfall_func6(string funcName, arg1, arg2, arg3, arg4, arg5, arg6)
* These functions require AllowUnsafeScripting to be enabled in ddraw.ini * These functions require AllowUnsafeScripting to be enabled in ddraw.ini
+17
View File
@@ -311,7 +311,24 @@ void DESetArray(int id, const DWORD* types, const void* data) {
/* /*
Array manipulation functions for script operators Array manipulation functions for script operators
TODO: move somewhere else
*/ */
const char* _stdcall GetSfallTypeName(DWORD dataType) {
switch (dataType) {
case DATATYPE_NONE:
return "(none)";
case DATATYPE_STR:
return "string";
case DATATYPE_FLOAT:
return "float";
case DATATYPE_INT:
return "integer";
default:
return "(unknown)";
}
}
DWORD _stdcall getSfallTypeByScriptType(DWORD varType) { DWORD _stdcall getSfallTypeByScriptType(DWORD varType) {
varType &= 0xffff; varType &= 0xffff;
switch (varType) { switch (varType) {
+5 -1
View File
@@ -4,7 +4,7 @@
#include <unordered_map> #include <unordered_map>
#include <set> #include <set>
#define ARRAY_MAX_STRING (1024) // maximum length of string to be stored as array key or value #define ARRAY_MAX_STRING (255) // maximum length of string to be stored as array key or value
#define ARRAY_MAX_SIZE (100000) // maximum number of array elements, #define ARRAY_MAX_SIZE (100000) // maximum number of array elements,
// so total maximum memory/disk footprint of one array is: 16 + (ARRAY_MAX_STRING + 8) * ARRAY_MAX_SIZE // so total maximum memory/disk footprint of one array is: 16 + (ARRAY_MAX_STRING + 8) * ARRAY_MAX_SIZE
@@ -16,6 +16,7 @@
extern char get_all_arrays_special_key[]; extern char get_all_arrays_special_key[];
// TODO: rewrite
class sArrayElement class sArrayElement
{ {
public: public:
@@ -79,6 +80,8 @@ typedef std::tr1::unordered_map<sArrayElement, DWORD, sArrayElement_HashFunc, sA
/** /**
This class represents sfall array This class represents sfall array
It can be both list (normal array) and map (associative) It can be both list (normal array) and map (associative)
TODO: rewrite for better interface (especially associate arrays)
*/ */
class sArrayVar class sArrayVar
{ {
@@ -139,6 +142,7 @@ void GetArrays(int* arrays);
void DEGetArray(int id, DWORD* types, void* data); void DEGetArray(int id, DWORD* types, void* data);
void DESetArray(int id, const DWORD* types, const void* data); void DESetArray(int id, const DWORD* types, const void* data);
const char* _stdcall GetSfallTypeName(DWORD dataType);
DWORD _stdcall getSfallTypeByScriptType(DWORD varType); DWORD _stdcall getSfallTypeByScriptType(DWORD varType);
DWORD _stdcall getScriptTypeBySfallType(DWORD dataType); DWORD _stdcall getScriptTypeBySfallType(DWORD dataType);
// creates new normal (persistent) array. len == -1 specifies associative array (map) // creates new normal (persistent) array. len == -1 specifies associative array (map)
+56
View File
@@ -789,6 +789,56 @@ end:
} }
} }
static void __declspec(naked) db_get_file_list_hack() {
__asm {
push edi
push edx
xchg edi, eax // edi = *filename
mov eax, [eax+4] // file_lists.filenames
lea esi, [eax+edx]
cld
push es
push ds
pop es
xor ecx, ecx
dec ecx
mov edx, ecx
mov ebx, ecx
xor eax, eax // searching for end of line
repne scasb
not ecx
dec ecx
xchg ebx, ecx // ebx = filename length
lea edi, [esp+0x200+4*6]
repne scasb
not ecx
xchg edx, ecx // edx = extension length +1 for "end of line"
mov edi, [esi]
repne scasb
not ecx // ecx = buffer line length +1 for "end of line"
pop es
lea eax, [ebx+edx] // eax = new line length
cmp eax, ecx // new line length <= buffer line length?
jbe end // Yes
mov edx, [esi]
xchg edx, eax
call nrealloc_ // eax = mem, edx = size
test eax, eax
jnz skip
push 0x50B2F0 // "Error: Ran out of memory!"
call debug_printf_
add esp, 4
jmp end
skip:
mov [esi], eax
end:
xchg esi, eax
pop edx
pop edi
retn
}
}
void BugsInit() void BugsInit()
{ {
@@ -1019,4 +1069,10 @@ void BugsInit()
MakeCall(0x4C5A41, &wmTeleportToArea_hack, true); MakeCall(0x4C5A41, &wmTeleportToArea_hack, true);
dlogr(" Done", DL_INIT); dlogr(" Done", DL_INIT);
//} //}
//if (GetPrivateProfileIntA("Misc", "PrintToFileFix", 0, ini)) {
dlog("Applying print to file fix.", DL_INIT);
MakeCall(0x4C67D4, &db_get_file_list_hack, false);
dlogr(" Done", DL_INIT);
//}
} }
+1 -1
View File
@@ -69,7 +69,7 @@ divEnd2:
void ComputeSprayModInit() { void ComputeSprayModInit() {
if (GetPrivateProfileIntA("Misc", "ComputeSprayMod", 1, ini)) { if (GetPrivateProfileIntA("Misc", "ComputeSprayMod", 0, ini)) {
dlog("Applying ComputeSpray changes.", DL_INIT); dlog("Applying ComputeSpray changes.", DL_INIT);
compute_spray_center_mult = GetPrivateProfileIntA("Misc", "ComputeSpray_CenterMult", 1, ini); compute_spray_center_mult = GetPrivateProfileIntA("Misc", "ComputeSpray_CenterMult", 1, ini);
compute_spray_center_div = GetPrivateProfileIntA("Misc", "ComputeSpray_CenterDiv", 3, ini); compute_spray_center_div = GetPrivateProfileIntA("Misc", "ComputeSpray_CenterDiv", 3, ini);
+44
View File
@@ -0,0 +1,44 @@
/*
* sfall
* Copyright (C) 2008-2016 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
#include <cstddef>
// https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/nullptr
const // It is a const object...
class nullptr_t {
public:
template<class T>
inline operator T*() const // convertible to any type of null non-member pointer...
{ return 0; }
template<class C, class T>
inline operator T C::*() const // or any type of null member pointer...
{ return 0; }
private:
void operator&() const; // Can't take address of nullptr
} nullptr = {};
// http://stackoverflow.com/questions/33026118/c-stdbeginc-for-vs-2008
template<typename T, std::size_t N>
T* std_begin(T (&a)[N]) { return a; }
template<typename T, std::size_t N>
T* std_end(T (&a)[N]) { return a + N; }
-1
View File
@@ -141,7 +141,6 @@ static void __declspec(naked) CreditsNextLineHook_Bottom() {
test eax, eax; // if any extra lines left, return 1 (from function), 0 otherwise test eax, eax; // if any extra lines left, return 1 (from function), 0 otherwise
popad; popad;
jnz morelines; jnz morelines;
theend:
mov eax, 0x0; mov eax, 0x0;
retn; retn;
morelines: morelines:
+2 -1
View File
@@ -16,9 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <vector>
#include "main.h" #include "main.h"
#include <vector>
#include "Arrays.h" #include "Arrays.h"
#include "DebugEditor.h" #include "DebugEditor.h"
#include "FalloutEngine.h" #include "FalloutEngine.h"
+346 -25
View File
@@ -18,16 +18,189 @@
#include "main.h" #include "main.h"
#include "Logging.h" #include "Define.h"
#include "FalloutEngine.h" #include "FalloutEngine.h"
#include "Logging.h"
// global variables // global variables
TGameObj** obj_dude_ptr = (TGameObj**)(0x6610B8); long* ptr_pc_traits = reinterpret_cast<long*>(_pc_trait); // 2 of them
TGameObj** inven_dude_ptr = (TGameObj**)(0x519058);
DWORD* activeUIHand_ptr = (DWORD*)(0x518F78); // 0 - left, 1 - right DWORD* ptr_aiInfoList = reinterpret_cast<DWORD*>(_aiInfoList);
DWORD* dude_traits = (DWORD*)(0x66BE40); // 2 of them DWORD* ptr_ambient_light = reinterpret_cast<DWORD*>(_ambient_light);
DWORD* itemCurrentItem = (DWORD*)(0x518F78); DWORD* ptr_art = reinterpret_cast<DWORD*>(_art);
DWORD* itemButtonItems = (DWORD*)(0x5970F8); DWORD* ptr_art_name = reinterpret_cast<DWORD*>(_art_name);
DWORD* ptr_art_vault_guy_num = reinterpret_cast<DWORD*>(_art_vault_guy_num);
DWORD* ptr_art_vault_person_nums = reinterpret_cast<DWORD*>(_art_vault_person_nums);
DWORD* ptr_bckgnd = reinterpret_cast<DWORD*>(_bckgnd);
DWORD* ptr_black_palette = reinterpret_cast<DWORD*>(_black_palette);
DWORD* ptr_bottom_line = reinterpret_cast<DWORD*>(_bottom_line);
DWORD* ptr_btable = reinterpret_cast<DWORD*>(_btable);
DWORD* ptr_btncnt = reinterpret_cast<DWORD*>(_btncnt);
DWORD* ptr_CarCurrArea = reinterpret_cast<DWORD*>(_CarCurrArea);
DWORD* ptr_cmap = reinterpret_cast<DWORD*>(_cmap);
DWORD* ptr_colorTable = reinterpret_cast<DWORD*>(_colorTable);
DWORD* ptr_combat_free_move = reinterpret_cast<DWORD*>(_combat_free_move);
DWORD* ptr_combat_list = reinterpret_cast<DWORD*>(_combat_list);
DWORD* ptr_combat_state = reinterpret_cast<DWORD*>(_combat_state);
DWORD* ptr_combat_turn_running = reinterpret_cast<DWORD*>(_combat_turn_running);
DWORD* ptr_combatNumTurns = reinterpret_cast<DWORD*>(_combatNumTurns);
DWORD* ptr_crit_succ_eff = reinterpret_cast<DWORD*>(_crit_succ_eff);
DWORD* ptr_critter_db_handle = reinterpret_cast<DWORD*>(_critter_db_handle);
DWORD* ptr_critterClearObj = reinterpret_cast<DWORD*>(_critterClearObj);
DWORD* ptr_crnt_func = reinterpret_cast<DWORD*>(_crnt_func);
DWORD* ptr_curr_font_num = reinterpret_cast<DWORD*>(_curr_font_num);
DWORD* ptr_curr_pc_stat = reinterpret_cast<DWORD*>(_curr_pc_stat);
DWORD* ptr_curr_stack = reinterpret_cast<DWORD*>(_curr_stack);
DWORD* ptr_cursor_line = reinterpret_cast<DWORD*>(_cursor_line);
DWORD* ptr_dialog_target = reinterpret_cast<DWORD*>(_dialog_target);
DWORD* ptr_dialog_target_is_party = reinterpret_cast<DWORD*>(_dialog_target_is_party);
DWORD* ptr_drugInfoList = reinterpret_cast<DWORD*>(_drugInfoList);
DWORD* ptr_edit_win = reinterpret_cast<DWORD*>(_edit_win);
DWORD* ptr_Educated = reinterpret_cast<DWORD*>(_Educated);
DWORD* ptr_Experience_ = reinterpret_cast<DWORD*>(_Experience_);
DWORD* ptr_fallout_game_time = reinterpret_cast<DWORD*>(_fallout_game_time);
DWORD* ptr_flptr = reinterpret_cast<DWORD*>(_flptr);
DWORD* ptr_folder_card_desc = reinterpret_cast<DWORD*>(_folder_card_desc);
DWORD* ptr_folder_card_fid = reinterpret_cast<DWORD*>(_folder_card_fid);
DWORD* ptr_folder_card_title = reinterpret_cast<DWORD*>(_folder_card_title);
DWORD* ptr_folder_card_title2 = reinterpret_cast<DWORD*>(_folder_card_title2);
DWORD* ptr_frame_time = reinterpret_cast<DWORD*>(_frame_time);
char* ptr_free_perk = reinterpret_cast<char*>(_free_perk);
DWORD* ptr_game_global_vars = reinterpret_cast<DWORD*>(_game_global_vars);
DWORD* ptr_game_user_wants_to_quit = reinterpret_cast<DWORD*>(_game_user_wants_to_quit);
DWORD* ptr_gcsd = reinterpret_cast<DWORD*>(_gcsd);
DWORD* ptr_gdBarterMod = reinterpret_cast<DWORD*>(_gdBarterMod);
DWORD* ptr_gdNumOptions = reinterpret_cast<DWORD*>(_gdNumOptions);
DWORD* ptr_gIsSteal = reinterpret_cast<DWORD*>(_gIsSteal);
DWORD* ptr_glblmode = reinterpret_cast<DWORD*>(_glblmode);
DWORD* ptr_gmouse_current_cursor = reinterpret_cast<DWORD*>(_gmouse_current_cursor);
DWORD* ptr_gmovie_played_list = reinterpret_cast<DWORD*>(_gmovie_played_list);
DWORD* ptr_GreenColor = reinterpret_cast<DWORD*>(_GreenColor);
DWORD* ptr_gsound_initialized = reinterpret_cast<DWORD*>(_gsound_initialized);
DWORD* ptr_hit_location_penalty = reinterpret_cast<DWORD*>(_hit_location_penalty);
DWORD* ptr_holo_flag = reinterpret_cast<DWORD*>(_holo_flag);
DWORD* ptr_holopages = reinterpret_cast<DWORD*>(_holopages);
DWORD* ptr_hot_line_count = reinterpret_cast<DWORD*>(_hot_line_count);
DWORD* ptr_i_fid = reinterpret_cast<DWORD*>(_i_fid);
DWORD* ptr_i_lhand = reinterpret_cast<DWORD*>(_i_lhand);
DWORD* ptr_i_rhand = reinterpret_cast<DWORD*>(_i_rhand);
DWORD* ptr_i_wid = reinterpret_cast<DWORD*>(_i_wid);
DWORD* ptr_i_worn = reinterpret_cast<DWORD*>(_i_worn);
DWORD* ptr_In_WorldMap = reinterpret_cast<DWORD*>(_In_WorldMap);
DWORD* ptr_info_line = reinterpret_cast<DWORD*>(_info_line);
DWORD* ptr_interfaceWindow = reinterpret_cast<DWORD*>(_interfaceWindow);
DWORD* ptr_intfaceEnabled = reinterpret_cast<DWORD*>(_intfaceEnabled);
DWORD* ptr_intotal = reinterpret_cast<DWORD*>(_intotal);
TGameObj** ptr_inven_dude = reinterpret_cast<TGameObj**>(_inven_dude);
DWORD* ptr_inven_pid = reinterpret_cast<DWORD*>(_inven_pid);
DWORD* ptr_inven_scroll_dn_bid = reinterpret_cast<DWORD*>(_inven_scroll_dn_bid);
DWORD* ptr_inven_scroll_up_bid = reinterpret_cast<DWORD*>(_inven_scroll_up_bid);
DWORD* ptr_inventry_message_file = reinterpret_cast<DWORD*>(_inventry_message_file);
DWORD* ptr_itemButtonItems = reinterpret_cast<DWORD*>(_itemButtonItems);
DWORD* ptr_itemCurrentItem = reinterpret_cast<DWORD*>(_itemCurrentItem); // 0 - left, 1 - right
DWORD* ptr_kb_lock_flags = reinterpret_cast<DWORD*>(_kb_lock_flags);
DWORD* ptr_last_buttons = reinterpret_cast<DWORD*>(_last_buttons);
DWORD* ptr_last_button_winID = reinterpret_cast<DWORD*>(_last_button_winID);
DWORD* ptr_last_level = reinterpret_cast<DWORD*>(_last_level);
DWORD* ptr_Level_ = reinterpret_cast<DWORD*>(_Level_);
DWORD* ptr_Lifegiver = reinterpret_cast<DWORD*>(_Lifegiver);
DWORD* ptr_list_com = reinterpret_cast<DWORD*>(_list_com);
DWORD* ptr_list_total = reinterpret_cast<DWORD*>(_list_total);
DWORD* ptr_loadingGame = reinterpret_cast<DWORD*>(_loadingGame);
DWORD* ptr_LSData = reinterpret_cast<DWORD*>(_LSData);
DWORD* ptr_lsgwin = reinterpret_cast<DWORD*>(_lsgwin);
DWORD* ptr_main_ctd = reinterpret_cast<DWORD*>(_main_ctd);
DWORD* ptr_main_window = reinterpret_cast<DWORD*>(_main_window);
DWORD* ptr_map_elevation = reinterpret_cast<DWORD*>(_map_elevation);
DWORD* ptr_map_global_vars = reinterpret_cast<DWORD*>(_map_global_vars);
DWORD* ptr_master_db_handle = reinterpret_cast<DWORD*>(_master_db_handle);
DWORD* ptr_max = reinterpret_cast<DWORD*>(_max);
DWORD* ptr_maxScriptNum = reinterpret_cast<DWORD*>(_maxScriptNum);
DWORD* ptr_Meet_Frank_Horrigan = reinterpret_cast<DWORD*>(_Meet_Frank_Horrigan);
DWORD* ptr_mouse_hotx = reinterpret_cast<DWORD*>(_mouse_hotx);
DWORD* ptr_mouse_hoty = reinterpret_cast<DWORD*>(_mouse_hoty);
DWORD* ptr_mouse_is_hidden = reinterpret_cast<DWORD*>(_mouse_is_hidden);
DWORD* ptr_mouse_x_ = reinterpret_cast<DWORD*>(_mouse_x_);
DWORD* ptr_mouse_y = reinterpret_cast<DWORD*>(_mouse_y);
DWORD* ptr_mouse_y_ = reinterpret_cast<DWORD*>(_mouse_y_);
DWORD* ptr_Mutate_ = reinterpret_cast<DWORD*>(_Mutate_);
DWORD* ptr_name_color = reinterpret_cast<DWORD*>(_name_color);
DWORD* ptr_name_font = reinterpret_cast<DWORD*>(_name_font);
DWORD* ptr_name_sort_list = reinterpret_cast<DWORD*>(_name_sort_list);
DWORD* ptr_num_game_global_vars = reinterpret_cast<DWORD*>(_num_game_global_vars);
DWORD* ptr_num_map_global_vars = reinterpret_cast<DWORD*>(_num_map_global_vars);
TGameObj** ptr_obj_dude = reinterpret_cast<TGameObj**>(_obj_dude);
DWORD* ptr_objectTable = reinterpret_cast<DWORD*>(_objectTable);
DWORD* ptr_objItemOutlineState = reinterpret_cast<DWORD*>(_objItemOutlineState);
DWORD* ptr_optionRect = reinterpret_cast<DWORD*>(_optionRect);
DWORD* ptr_outlined_object = reinterpret_cast<DWORD*>(_outlined_object);
DWORD* ptr_partyMemberAIOptions = reinterpret_cast<DWORD*>(_partyMemberAIOptions);
DWORD* ptr_partyMemberCount = reinterpret_cast<DWORD*>(_partyMemberCount);
DWORD* ptr_partyMemberLevelUpInfoList = reinterpret_cast<DWORD*>(_partyMemberLevelUpInfoList);
DWORD* ptr_partyMemberList = reinterpret_cast<DWORD*>(_partyMemberList); // each struct - 4 integers, first integer - objPtr
DWORD* ptr_partyMemberMaxCount = reinterpret_cast<DWORD*>(_partyMemberMaxCount);
DWORD* ptr_partyMemberPidList = reinterpret_cast<DWORD*>(_partyMemberPidList);
DWORD* ptr_patches = reinterpret_cast<DWORD*>(_patches);
DWORD* ptr_paths = reinterpret_cast<DWORD*>(_paths);
DWORD* ptr_pc_crit_succ_eff = reinterpret_cast<DWORD*>(_pc_crit_succ_eff);
DWORD* ptr_pc_kill_counts = reinterpret_cast<DWORD*>(_pc_kill_counts);
char* ptr_pc_name = reinterpret_cast<char*>(_pc_name);
DWORD* ptr_pc_proto = reinterpret_cast<DWORD*>(_pc_proto);
DWORD* ptr_perk_data = reinterpret_cast<DWORD*>(_perk_data);
int** ptr_perkLevelDataList = reinterpret_cast<int**>(_perkLevelDataList);
DWORD* ptr_pip_win = reinterpret_cast<DWORD*>(_pip_win);
DWORD* ptr_pipboy_message_file = reinterpret_cast<DWORD*>(_pipboy_message_file);
DWORD* ptr_pipmesg = reinterpret_cast<DWORD*>(_pipmesg);
DWORD* ptr_preload_list_index = reinterpret_cast<DWORD*>(_preload_list_index);
DWORD* ptr_procTableStrs = reinterpret_cast<DWORD*>(_procTableStrs); // table of procId (from define.h) => procName map
DWORD* ptr_proto_main_msg_file = reinterpret_cast<DWORD*>(_proto_main_msg_file);
DWORD* ptr_ptable = reinterpret_cast<DWORD*>(_ptable);
DWORD* ptr_pud = reinterpret_cast<DWORD*>(_pud);
DWORD* ptr_queue = reinterpret_cast<DWORD*>(_queue);
DWORD* ptr_quick_done = reinterpret_cast<DWORD*>(_quick_done);
DWORD* ptr_read_callback = reinterpret_cast<DWORD*>(_read_callback);
DWORD* ptr_RedColor = reinterpret_cast<DWORD*>(_RedColor);
DWORD* ptr_retvals = reinterpret_cast<DWORD*>(_retvals);
DWORD* ptr_scr_size = reinterpret_cast<DWORD*>(_scr_size);
DWORD* ptr_scriptListInfo = reinterpret_cast<DWORD*>(_scriptListInfo);
DWORD* ptr_skill_data = reinterpret_cast<DWORD*>(_skill_data);
DWORD* ptr_slot_cursor = reinterpret_cast<DWORD*>(_slot_cursor);
DWORD* ptr_sneak_working = reinterpret_cast<DWORD*>(_sneak_working); // DWORD var
DWORD* ptr_square = reinterpret_cast<DWORD*>(_square);
DWORD* ptr_squares = reinterpret_cast<DWORD*>(_squares);
DWORD* ptr_stack = reinterpret_cast<DWORD*>(_stack);
DWORD* ptr_stack_offset = reinterpret_cast<DWORD*>(_stack_offset);
DWORD* ptr_stat_data = reinterpret_cast<DWORD*>(_stat_data);
DWORD* ptr_stat_flag = reinterpret_cast<DWORD*>(_stat_flag);
DWORD* ptr_Tag_ = reinterpret_cast<DWORD*>(_Tag_);
DWORD* ptr_tag_skill = reinterpret_cast<DWORD*>(_tag_skill);
DWORD* ptr_target_curr_stack = reinterpret_cast<DWORD*>(_target_curr_stack);
DWORD* ptr_target_pud = reinterpret_cast<DWORD*>(_target_pud);
DWORD* ptr_target_stack = reinterpret_cast<DWORD*>(_target_stack);
DWORD* ptr_target_stack_offset = reinterpret_cast<DWORD*>(_target_stack_offset);
DWORD* ptr_target_str = reinterpret_cast<DWORD*>(_target_str);
DWORD* ptr_target_xpos = reinterpret_cast<DWORD*>(_target_xpos);
DWORD* ptr_target_ypos = reinterpret_cast<DWORD*>(_target_ypos);
DWORD* ptr_text_char_width = reinterpret_cast<DWORD*>(_text_char_width);
DWORD* ptr_text_height = reinterpret_cast<DWORD*>(_text_height);
DWORD* ptr_text_max = reinterpret_cast<DWORD*>(_text_max);
DWORD* ptr_text_mono_width = reinterpret_cast<DWORD*>(_text_mono_width);
DWORD* ptr_text_spacing = reinterpret_cast<DWORD*>(_text_spacing);
DWORD* ptr_text_to_buf = reinterpret_cast<DWORD*>(_text_to_buf);
DWORD* ptr_text_width = reinterpret_cast<DWORD*>(_text_width);
DWORD* ptr_title_color = reinterpret_cast<DWORD*>(_title_color);
DWORD* ptr_title_font = reinterpret_cast<DWORD*>(_title_font);
DWORD* ptr_trait_data = reinterpret_cast<DWORD*>(_trait_data);
DWORD* ptr_view_page = reinterpret_cast<DWORD*>(_view_page);
DWORD* ptr_wd_obj = reinterpret_cast<DWORD*>(_wd_obj);
DWORD* ptr_wmAreaInfoList = reinterpret_cast<DWORD*>(_wmAreaInfoList);
DWORD* ptr_wmLastRndTime = reinterpret_cast<DWORD*>(_wmLastRndTime);
DWORD* ptr_wmWorldOffsetX = reinterpret_cast<DWORD*>(_wmWorldOffsetX);
DWORD* ptr_wmWorldOffsetY = reinterpret_cast<DWORD*>(_wmWorldOffsetY);
DWORD* ptr_world_xpos = reinterpret_cast<DWORD*>(_world_xpos);
DWORD* ptr_world_ypos = reinterpret_cast<DWORD*>(_world_ypos);
DWORD* ptr_WorldMapCurrArea = reinterpret_cast<DWORD*>(_WorldMapCurrArea);
DWORD* ptr_YellowColor = reinterpret_cast<DWORD*>(_YellowColor);
/** /**
ENGINE FUNCTIONS OFFSETS ENGINE FUNCTIONS OFFSETS
@@ -120,6 +293,7 @@ const DWORD db_get_file_list_ = 0x4C6628;
const DWORD db_read_to_buf_ = 0x4C5DD4; const DWORD db_read_to_buf_ = 0x4C5DD4;
const DWORD dbase_close_ = 0x4E5270; const DWORD dbase_close_ = 0x4E5270;
const DWORD dbase_open_ = 0x4E4F58; const DWORD dbase_open_ = 0x4E4F58;
const DWORD debug_printf_ = 0x4C6F48;
const DWORD debug_register_env_ = 0x4C6D90; const DWORD debug_register_env_ = 0x4C6D90;
const DWORD determine_to_hit_func_ = 0x4243A8; const DWORD determine_to_hit_func_ = 0x4243A8;
const DWORD dialog_out_ = 0x41CF20; const DWORD dialog_out_ = 0x41CF20;
@@ -145,6 +319,7 @@ const DWORD elevator_start_ = 0x43F324;
const DWORD endgame_slideshow_ = 0x43F788; const DWORD endgame_slideshow_ = 0x43F788;
const DWORD exec_script_proc_ = 0x4A4810; const DWORD exec_script_proc_ = 0x4A4810;
const DWORD executeProcedure_ = 0x46DD2C; const DWORD executeProcedure_ = 0x46DD2C;
const DWORD findCurrentProc_ = 0x467160;
const DWORD fadeSystemPalette_ = 0x4C7320; const DWORD fadeSystemPalette_ = 0x4C7320;
const DWORD findVar_ = 0x4410AC; const DWORD findVar_ = 0x4410AC;
const DWORD folder_print_line_ = 0x43E3D8; const DWORD folder_print_line_ = 0x43E3D8;
@@ -177,6 +352,7 @@ const DWORD interpretPopLong_ = 0x467500;
const DWORD interpretPopShort_ = 0x4674F0; const DWORD interpretPopShort_ = 0x4674F0;
const DWORD interpretPushLong_ = 0x4674DC; const DWORD interpretPushLong_ = 0x4674DC;
const DWORD interpretPushShort_ = 0x46748C; const DWORD interpretPushShort_ = 0x46748C;
const DWORD interpretError_ = 0x4671F0;
const DWORD intface_redraw_ = 0x45EB98; const DWORD intface_redraw_ = 0x45EB98;
const DWORD intface_toggle_item_state_ = 0x45F4E0; const DWORD intface_toggle_item_state_ = 0x45F4E0;
const DWORD intface_toggle_items_ = 0x45F404; const DWORD intface_toggle_items_ = 0x45F404;
@@ -185,6 +361,9 @@ const DWORD intface_update_hit_points_ = 0x45EBD8;
const DWORD intface_update_items_ = 0x45EFEC; const DWORD intface_update_items_ = 0x45EFEC;
const DWORD intface_update_move_points_ = 0x45EE0C; const DWORD intface_update_move_points_ = 0x45EE0C;
const DWORD intface_use_item_ = 0x45F5EC; const DWORD intface_use_item_ = 0x45F5EC;
const DWORD intface_show_ = 0x45EA10;
const DWORD intface_hide_ = 0x45E9E0;
const DWORD intface_is_hidden_ = 0x45EA5C;
const DWORD invenUnwieldFunc_ = 0x472A64; const DWORD invenUnwieldFunc_ = 0x472A64;
const DWORD invenWieldFunc_ = 0x472768; const DWORD invenWieldFunc_ = 0x472768;
const DWORD inven_display_msg_ = 0x472D24; const DWORD inven_display_msg_ = 0x472D24;
@@ -264,6 +443,7 @@ const DWORD mouse_in_ = 0x4CA8C8;
const DWORD mouse_show_ = 0x4CA34C; const DWORD mouse_show_ = 0x4CA34C;
const DWORD move_inventory_ = 0x474708; const DWORD move_inventory_ = 0x474708;
const DWORD NixHotLines_ = 0x4999C0; const DWORD NixHotLines_ = 0x4999C0;
const DWORD nrealloc_ = 0x4F1669;
const DWORD obj_ai_blocking_at_ = 0x48BA20; const DWORD obj_ai_blocking_at_ = 0x48BA20;
const DWORD obj_blocking_at_ = 0x48B848; // (EAX *obj, EDX hexNum, EBX level) const DWORD obj_blocking_at_ = 0x48B848; // (EAX *obj, EDX hexNum, EBX level)
const DWORD obj_bound_ = 0x48B66C; const DWORD obj_bound_ = 0x48B66C;
@@ -435,29 +615,36 @@ const DWORD xvfprintf_ = 0x4DF1AC;
int __stdcall ItemGetType(TGameObj* item) { int __stdcall ItemGetType(TGameObj* item) {
__asm { __asm {
mov eax, item; mov eax, item
call item_get_type_; call item_get_type_
} }
} }
int _stdcall IsPartyMember(TGameObj* obj) { int _stdcall IsPartyMember(TGameObj* obj) {
__asm { __asm {
mov eax, obj; mov eax, obj
call isPartyMember_; call isPartyMember_
} }
} }
TGameObj* GetInvenWeaponLeft(TGameObj* obj) { int _stdcall PartyMemberGetCurrentLevel(TGameObj* obj) {
__asm { __asm {
mov eax, obj; mov eax, obj
call inven_left_hand_; call partyMemberGetCurLevel_
} }
} }
TGameObj* GetInvenWeaponRight(TGameObj* obj) { TGameObj* __stdcall GetInvenWeaponLeft(TGameObj* obj) {
__asm { __asm {
mov eax, obj; mov eax, obj
call inven_right_hand_; call inven_left_hand_
}
}
TGameObj* __stdcall GetInvenWeaponRight(TGameObj* obj) {
__asm {
mov eax, obj
call inven_right_hand_
} }
} }
@@ -465,9 +652,9 @@ TGameObj* GetInvenWeaponRight(TGameObj* obj) {
char* GetProtoPtr(DWORD pid) { char* GetProtoPtr(DWORD pid) {
char* proto; char* proto;
__asm { __asm {
mov eax, pid; mov eax, pid
lea edx, proto; lea edx, proto
call proto_ptr_; call proto_ptr_
} }
return proto; return proto;
} }
@@ -482,17 +669,15 @@ char AnimCodeByWeapon(TGameObj* weapon) {
return 0; return 0;
} }
void DisplayConsoleMessage(const char* msg) { void DisplayConsoleMessage(const char* msg) {
__asm { __asm {
mov eax, msg; mov eax, msg
call display_print_; call display_print_
} }
} }
static DWORD mesg_buf[4] = {0, 0, 0, 0}; static DWORD mesg_buf[4] = {0, 0, 0, 0};
const char* _stdcall GetMessageStr(DWORD fileAddr, DWORD messageId) const char* _stdcall GetMessageStr(DWORD fileAddr, DWORD messageId) {
{
DWORD buf = (DWORD)mesg_buf; DWORD buf = (DWORD)mesg_buf;
const char* result; const char* result;
__asm { __asm {
@@ -504,3 +689,139 @@ const char* _stdcall GetMessageStr(DWORD fileAddr, DWORD messageId)
} }
return result; return result;
} }
// Change the name of playable character
void CritterPcSetName(const char* newName) {
__asm {
mov eax, newName
call critter_pc_set_name_
}
}
// Returns the name of the critter
const char* __stdcall CritterName(TGameObj* critter) {
__asm {
mov eax, critter
call critter_name_
}
}
void SkillGetTags(int* result, DWORD num) {
if (num > 4) {
num = 4;
}
__asm {
mov eax, result
mov edx, num
call skill_get_tags_
}
}
void SkillSetTags(int* tags, DWORD num) {
if (num > 4) {
num = 4;
}
__asm {
mov eax, tags
mov edx, num
call skill_set_tags_
}
}
int __stdcall ScrPtr(int scriptId, TScript** scriptPtr) {
__asm {
mov eax, scriptId;
mov edx, scriptPtr;
call scr_ptr_;
}
}
// redraws the main game interface windows (useful after changing some data like active hand, etc.)
void InterfaceRedraw() {
__asm call intface_redraw_
}
// pops value type from Data stack (must be followed by InterpretPopLong)
DWORD __stdcall InterpretPopShort(TProgram* scriptPtr) {
__asm {
mov eax, scriptPtr
call interpretPopShort_
}
}
// pops value from Data stack (must be preceded by InterpretPopShort)
DWORD __stdcall InterpretPopLong(TProgram* scriptPtr) {
__asm {
mov eax, scriptPtr
call interpretPopLong_
}
}
// pushes value to Data stack (must be followed by InterpretPushShort)
void __stdcall InterpretPushLong(TProgram* scriptPtr, DWORD val) {
__asm {
mov edx, val
mov eax, scriptPtr
call interpretPushLong_
}
}
// pushes value type to Data stack (must be preceded by InterpretPushLong)
void __stdcall InterpretPushShort(TProgram* scriptPtr, DWORD valType) {
__asm {
mov edx, valType
mov eax, scriptPtr
call interpretPushShort_
}
}
DWORD __stdcall InterpretAddString(TProgram* scriptPtr, const char* strval) {
__asm {
mov edx, strval
mov eax, scriptPtr
call interpretAddString_
}
}
const char* __stdcall InterpretGetString(TProgram* scriptPtr, DWORD strId, DWORD dataType) {
__asm {
mov edx, dataType
mov ebx, strId
mov eax, scriptPtr
call interpretGetString_
}
}
void __declspec(naked) InterpretError(const char* fmt, ...) {
__asm {
jmp interpretError_
}
}
void __declspec(naked) DebugPrintf(const char* fmt, ...) {
__asm {
jmp debug_printf_
}
}
const char* __stdcall FindCurrentProc(TProgram* program) {
__asm {
mov eax, program
call findCurrentProc_
}
}
TGameObj* __stdcall InvenWorn(TGameObj* critter) {
__asm mov eax, critter
__asm call inven_worn_
}
TGameObj* __stdcall InvenLeftHand(TGameObj* critter) {
__asm mov eax, critter
__asm call inven_left_hand_
}
TGameObj* __stdcall InvenRightHand(TGameObj* critter) {
__asm mov eax, critter
__asm call inven_right_hand_
}
+250 -12
View File
@@ -26,6 +26,9 @@
#include "FalloutStructs.h" #include "FalloutStructs.h"
// Global variable offsets
// TODO: probably need to hide these by moving inside implementation file
#define _aiInfoList 0x510948 #define _aiInfoList 0x510948
#define _ambient_light 0x51923C #define _ambient_light 0x51923C
#define _art 0x510738 #define _art 0x510738
@@ -87,6 +90,7 @@
#define _i_rhand 0x59E968 #define _i_rhand 0x59E968
#define _i_wid 0x59E964 #define _i_wid 0x59E964
#define _i_worn 0x59E954 #define _i_worn 0x59E954
#define _idle_func 0x51E234
#define _In_WorldMap 0x672E1C #define _In_WorldMap 0x672E1C
#define _info_line 0x5707D0 #define _info_line 0x5707D0
#define _interfaceWindow 0x519024 #define _interfaceWindow 0x519024
@@ -206,15 +210,189 @@
#define _YellowColor 0x6AB8BB #define _YellowColor 0x6AB8BB
// variables // variables
extern TGameObj** obj_dude_ptr; // TODO: move to separate namespace
extern TGameObj** inven_dude_ptr;
extern DWORD* activeUIHand_ptr; // 0 - left, 1 - right
extern DWORD* dude_traits; // 2 of them
extern DWORD* itemCurrentItem;
extern DWORD* itemButtonItems;
extern long* ptr_pc_traits; // 2 of them
// misc. offsets from engine extern DWORD* ptr_aiInfoList;
extern DWORD* ptr_ambient_light;
extern DWORD* ptr_art;
extern DWORD* ptr_art_name;
extern DWORD* ptr_art_vault_guy_num;
extern DWORD* ptr_art_vault_person_nums;
extern DWORD* ptr_bckgnd;
extern DWORD* ptr_black_palette;
extern DWORD* ptr_bottom_line;
extern DWORD* ptr_btable;
extern DWORD* ptr_btncnt;
extern DWORD* ptr_CarCurrArea;
extern DWORD* ptr_cmap;
extern DWORD* ptr_colorTable;
extern DWORD* ptr_combat_free_move;
extern DWORD* ptr_combat_list;
extern DWORD* ptr_combat_state;
extern DWORD* ptr_combat_turn_running;
extern DWORD* ptr_combatNumTurns;
extern DWORD* ptr_crit_succ_eff;
extern DWORD* ptr_critter_db_handle;
extern DWORD* ptr_critterClearObj;
extern DWORD* ptr_crnt_func;
extern DWORD* ptr_curr_font_num;
extern DWORD* ptr_curr_pc_stat;
extern DWORD* ptr_curr_stack;
extern DWORD* ptr_cursor_line;
extern DWORD* ptr_dialog_target;
extern DWORD* ptr_dialog_target_is_party;
extern DWORD* ptr_drugInfoList;
extern DWORD* ptr_edit_win;
extern DWORD* ptr_Educated;
extern DWORD* ptr_Experience_;
extern DWORD* ptr_fallout_game_time;
extern DWORD* ptr_flptr;
extern DWORD* ptr_folder_card_desc;
extern DWORD* ptr_folder_card_fid;
extern DWORD* ptr_folder_card_title;
extern DWORD* ptr_folder_card_title2;
extern DWORD* ptr_frame_time;
extern char* ptr_free_perk;
extern DWORD* ptr_game_global_vars;
extern DWORD* ptr_game_user_wants_to_quit;
extern DWORD* ptr_gcsd;
extern DWORD* ptr_gdBarterMod;
extern DWORD* ptr_gdNumOptions;
extern DWORD* ptr_gIsSteal;
extern DWORD* ptr_glblmode;
extern DWORD* ptr_gmouse_current_cursor;
extern DWORD* ptr_gmovie_played_list;
extern DWORD* ptr_GreenColor;
extern DWORD* ptr_gsound_initialized;
extern DWORD* ptr_hit_location_penalty;
extern DWORD* ptr_holo_flag;
extern DWORD* ptr_holopages;
extern DWORD* ptr_hot_line_count;
extern DWORD* ptr_i_fid;
extern DWORD* ptr_i_lhand;
extern DWORD* ptr_i_rhand;
extern DWORD* ptr_i_wid;
extern DWORD* ptr_i_worn;
extern DWORD* ptr_In_WorldMap;
extern DWORD* ptr_info_line;
extern DWORD* ptr_interfaceWindow;
extern DWORD* ptr_intfaceEnabled;
extern DWORD* ptr_intotal;
extern TGameObj** ptr_inven_dude;
extern DWORD* ptr_inven_pid;
extern DWORD* ptr_inven_scroll_dn_bid;
extern DWORD* ptr_inven_scroll_up_bid;
extern DWORD* ptr_inventry_message_file;
extern DWORD* ptr_itemButtonItems;
extern DWORD* ptr_itemCurrentItem; // 0 - left, 1 - right
extern DWORD* ptr_kb_lock_flags;
extern DWORD* ptr_last_buttons;
extern DWORD* ptr_last_button_winID;
extern DWORD* ptr_last_level;
extern DWORD* ptr_Level_;
extern DWORD* ptr_Lifegiver;
extern DWORD* ptr_list_com;
extern DWORD* ptr_list_total;
extern DWORD* ptr_loadingGame;
extern DWORD* ptr_LSData;
extern DWORD* ptr_lsgwin;
extern DWORD* ptr_main_ctd;
extern DWORD* ptr_main_window;
extern DWORD* ptr_map_elevation;
extern DWORD* ptr_map_global_vars;
extern DWORD* ptr_master_db_handle;
extern DWORD* ptr_max;
extern DWORD* ptr_maxScriptNum;
extern DWORD* ptr_Meet_Frank_Horrigan;
extern DWORD* ptr_mouse_hotx;
extern DWORD* ptr_mouse_hoty;
extern DWORD* ptr_mouse_is_hidden;
extern DWORD* ptr_mouse_x_;
extern DWORD* ptr_mouse_y;
extern DWORD* ptr_mouse_y_;
extern DWORD* ptr_Mutate_;
extern DWORD* ptr_name_color;
extern DWORD* ptr_name_font;
extern DWORD* ptr_name_sort_list;
extern DWORD* ptr_num_game_global_vars;
extern DWORD* ptr_num_map_global_vars;
extern TGameObj** ptr_obj_dude;
extern DWORD* ptr_objectTable;
extern DWORD* ptr_objItemOutlineState;
extern DWORD* ptr_optionRect;
extern DWORD* ptr_outlined_object;
extern DWORD* ptr_partyMemberAIOptions;
extern DWORD* ptr_partyMemberCount;
extern DWORD* ptr_partyMemberLevelUpInfoList;
extern DWORD* ptr_partyMemberList; // each struct - 4 integers, first integer - objPtr
extern DWORD* ptr_partyMemberMaxCount;
extern DWORD* ptr_partyMemberPidList;
extern DWORD* ptr_patches;
extern DWORD* ptr_paths;
extern DWORD* ptr_pc_crit_succ_eff;
extern DWORD* ptr_pc_kill_counts;
extern char* ptr_pc_name;
extern DWORD* ptr_pc_proto;
extern DWORD* ptr_perk_data;
extern int** ptr_perkLevelDataList; // limited to PERK_Count
extern DWORD* ptr_pip_win;
extern DWORD* ptr_pipboy_message_file;
extern DWORD* ptr_pipmesg;
extern DWORD* ptr_preload_list_index;
extern DWORD* ptr_procTableStrs; // table of procId (from define.h) => procName map
extern DWORD* ptr_proto_main_msg_file;
extern DWORD* ptr_ptable;
extern DWORD* ptr_pud;
extern DWORD* ptr_queue;
extern DWORD* ptr_quick_done;
extern DWORD* ptr_read_callback;
extern DWORD* ptr_RedColor;
extern DWORD* ptr_retvals;
extern DWORD* ptr_scr_size;
extern DWORD* ptr_scriptListInfo;
extern DWORD* ptr_skill_data;
extern DWORD* ptr_slot_cursor;
extern DWORD* ptr_sneak_working; // DWORD var
extern DWORD* ptr_square;
extern DWORD* ptr_squares;
extern DWORD* ptr_stack;
extern DWORD* ptr_stack_offset;
extern DWORD* ptr_stat_data;
extern DWORD* ptr_stat_flag;
extern DWORD* ptr_Tag_;
extern DWORD* ptr_tag_skill;
extern DWORD* ptr_target_curr_stack;
extern DWORD* ptr_target_pud;
extern DWORD* ptr_target_stack;
extern DWORD* ptr_target_stack_offset;
extern DWORD* ptr_target_str;
extern DWORD* ptr_target_xpos;
extern DWORD* ptr_target_ypos;
extern DWORD* ptr_text_char_width;
extern DWORD* ptr_text_height;
extern DWORD* ptr_text_max;
extern DWORD* ptr_text_mono_width;
extern DWORD* ptr_text_spacing;
extern DWORD* ptr_text_to_buf;
extern DWORD* ptr_text_width;
extern DWORD* ptr_title_color;
extern DWORD* ptr_title_font;
extern DWORD* ptr_trait_data;
extern DWORD* ptr_view_page;
extern DWORD* ptr_wd_obj;
extern DWORD* ptr_wmAreaInfoList;
extern DWORD* ptr_wmLastRndTime;
extern DWORD* ptr_wmWorldOffsetX;
extern DWORD* ptr_wmWorldOffsetY;
extern DWORD* ptr_world_xpos;
extern DWORD* ptr_world_ypos;
extern DWORD* ptr_WorldMapCurrArea;
extern DWORD* ptr_YellowColor;
// engine function offsets
// TODO: move to separate namespace
extern const DWORD action_get_an_object_; extern const DWORD action_get_an_object_;
extern const DWORD action_loot_container_; extern const DWORD action_loot_container_;
extern const DWORD action_use_an_item_on_object_; extern const DWORD action_use_an_item_on_object_;
@@ -285,6 +463,7 @@ extern const DWORD db_get_file_list_;
extern const DWORD db_read_to_buf_; extern const DWORD db_read_to_buf_;
extern const DWORD dbase_close_; extern const DWORD dbase_close_;
extern const DWORD dbase_open_; extern const DWORD dbase_open_;
extern const DWORD debug_printf_;
extern const DWORD debug_register_env_; extern const DWORD debug_register_env_;
extern const DWORD determine_to_hit_func_; extern const DWORD determine_to_hit_func_;
extern const DWORD dialog_out_; extern const DWORD dialog_out_;
@@ -342,6 +521,7 @@ extern const DWORD interpretPopLong_;
extern const DWORD interpretPopShort_; extern const DWORD interpretPopShort_;
extern const DWORD interpretPushLong_; extern const DWORD interpretPushLong_;
extern const DWORD interpretPushShort_; extern const DWORD interpretPushShort_;
extern const DWORD interpretError_;
extern const DWORD intface_redraw_; // no args extern const DWORD intface_redraw_; // no args
extern const DWORD intface_toggle_item_state_; extern const DWORD intface_toggle_item_state_;
extern const DWORD intface_toggle_items_; extern const DWORD intface_toggle_items_;
@@ -350,6 +530,9 @@ extern const DWORD intface_update_hit_points_;
extern const DWORD intface_update_items_; extern const DWORD intface_update_items_;
extern const DWORD intface_update_move_points_; extern const DWORD intface_update_move_points_;
extern const DWORD intface_use_item_; extern const DWORD intface_use_item_;
extern const DWORD intface_show_;
extern const DWORD intface_hide_;
extern const DWORD intface_is_hidden_;
extern const DWORD invenUnwieldFunc_; // (int critter@<eax>, int slot@<edx>, int a3@<ebx>) - int result (-1 on error, 0 on success) extern const DWORD invenUnwieldFunc_; // (int critter@<eax>, int slot@<edx>, int a3@<ebx>) - int result (-1 on error, 0 on success)
extern const DWORD invenWieldFunc_; // (int who@<eax>, int item@<edx>, int a3@<ecx>, int slot@<ebx>) - int result (-1 on error, 0 on success) extern const DWORD invenWieldFunc_; // (int who@<eax>, int item@<edx>, int a3@<ecx>, int slot@<ebx>) - int result (-1 on error, 0 on success)
extern const DWORD inven_display_msg_; extern const DWORD inven_display_msg_;
@@ -432,6 +615,7 @@ extern const DWORD mouse_in_;
extern const DWORD mouse_show_; extern const DWORD mouse_show_;
extern const DWORD move_inventory_; extern const DWORD move_inventory_;
extern const DWORD NixHotLines_; extern const DWORD NixHotLines_;
extern const DWORD nrealloc_;
extern const DWORD obj_ai_blocking_at_; extern const DWORD obj_ai_blocking_at_;
extern const DWORD obj_blocking_at_; // <eax>(int aExcludeObject<eax> /* can be 0 */, signed int aTile<edx>, int aElevation<ebx>) extern const DWORD obj_blocking_at_; // <eax>(int aExcludeObject<eax> /* can be 0 */, signed int aTile<edx>, int aElevation<ebx>)
extern const DWORD obj_bound_; extern const DWORD obj_bound_;
@@ -530,11 +714,11 @@ extern const DWORD set_game_time_;
extern const DWORD SexWindow_; extern const DWORD SexWindow_;
extern const DWORD skill_check_stealing_; extern const DWORD skill_check_stealing_;
extern const DWORD skill_dec_point_; extern const DWORD skill_dec_point_;
extern const DWORD skill_get_tags_; extern const DWORD skill_get_tags_; // eax - pointer to array DWORD, edx - number of elements to read
extern const DWORD skill_inc_point_; extern const DWORD skill_inc_point_;
extern const DWORD skill_level_; extern const DWORD skill_level_;
extern const DWORD skill_points_; extern const DWORD skill_points_;
extern const DWORD skill_set_tags_; extern const DWORD skill_set_tags_; // eax - pointer to array DWORD, edx - number of elements to write
extern const DWORD skill_use_; extern const DWORD skill_use_;
extern const DWORD skilldex_select_; extern const DWORD skilldex_select_;
extern const DWORD sprintf_; extern const DWORD sprintf_;
@@ -542,7 +726,7 @@ extern const DWORD square_num_;
extern const DWORD stat_get_base_direct_; extern const DWORD stat_get_base_direct_;
extern const DWORD stat_get_bonus_; extern const DWORD stat_get_bonus_;
extern const DWORD stat_level_; extern const DWORD stat_level_;
extern const DWORD stat_pc_add_experience_; extern const DWORD stat_pc_add_experience_; // eax - amount to add
extern const DWORD stat_pc_get_; extern const DWORD stat_pc_get_;
extern const DWORD stat_pc_set_; extern const DWORD stat_pc_set_;
extern const DWORD stat_set_bonus_; extern const DWORD stat_set_bonus_;
@@ -656,11 +840,65 @@ extern const DWORD getmsg_; // eax - msg file addr, ebx - message ID, edx - int[
#define MSG_FILE_WORLDMAP (0x672FB0) #define MSG_FILE_WORLDMAP (0x672FB0)
// WRAPPERS: // WRAPPERS:
// TODO: move these to different namespace
int _stdcall IsPartyMember(TGameObj* obj); int _stdcall IsPartyMember(TGameObj* obj);
TGameObj* GetInvenWeaponLeft(TGameObj* obj); int _stdcall PartyMemberGetCurrentLevel(TGameObj* obj);
TGameObj* GetInvenWeaponRight(TGameObj* obj); TGameObj* __stdcall GetInvenWeaponLeft(TGameObj* obj);
TGameObj* __stdcall GetInvenWeaponRight(TGameObj* obj);
char* GetProtoPtr(DWORD pid); char* GetProtoPtr(DWORD pid);
char AnimCodeByWeapon(TGameObj* weapon); char AnimCodeByWeapon(TGameObj* weapon);
// Displays message in main UI console window
void DisplayConsoleMessage(const char* msg); void DisplayConsoleMessage(const char* msg);
const char* _stdcall GetMessageStr(DWORD fileAddr, DWORD messageId); const char* _stdcall GetMessageStr(DWORD fileAddr, DWORD messageId);
int __stdcall ItemGetType(TGameObj* item); int __stdcall ItemGetType(TGameObj* item);
// Change the name of playable character
void CritterPcSetName(const char* newName);
// Returns the name of the critter
const char* __stdcall CritterName(TGameObj* critter);
// Saves pointer to script object into scriptPtr using scriptID.
// Returns 0 on success, -1 on failure.
int __stdcall ScrPtr(int scriptId, TScript** scriptPtr);
void SkillGetTags(int* result, DWORD num);
void SkillSetTags(int* tags, DWORD num);
// redraws the main game interface windows (useful after changing some data like active hand, etc.)
void InterfaceRedraw();
// critter worn item (armor)
TGameObj* __stdcall InvenWorn(TGameObj* critter);
// item in critter's left hand slot
TGameObj* __stdcall InvenLeftHand(TGameObj* critter);
// item in critter's right hand slot
TGameObj* __stdcall InvenRightHand(TGameObj* critter);
// pops value type from Data stack (must be followed by InterpretPopLong)
DWORD __stdcall InterpretPopShort(TProgram* scriptPtr);
// pops value from Data stack (must be preceded by InterpretPopShort)
DWORD __stdcall InterpretPopLong(TProgram* scriptPtr);
// pushes value to Data stack (must be followed by InterpretPushShort)
void __stdcall InterpretPushLong(TProgram* scriptPtr, DWORD val);
// pushes value type to Data stack (must be preceded by InterpretPushLong)
void __stdcall InterpretPushShort(TProgram* scriptPtr, DWORD valType);
const char* __stdcall InterpretGetString(TProgram* scriptPtr, DWORD strId, DWORD dataType);
DWORD __stdcall InterpretAddString(TProgram* scriptPtr, const char* str);
// prints scripting error in debug.log and stops current script execution by performing longjmp
// USE WITH CAUTION
void __declspec() InterpretError(const char* fmt, ...);
// prints message to debug.log file
void __declspec() DebugPrintf(const char* fmt, ...);
// returns the name of current procedure by program pointer
const char* __stdcall FindCurrentProc(TProgram* program);
+3 -3
View File
@@ -34,7 +34,7 @@ struct TInvenRec
}; };
#pragma pack(pop) #pragma pack(pop)
/* 8 */ /* 15 */
#pragma pack(push, 1) #pragma pack(push, 1)
struct TGameObj struct TGameObj
{ {
@@ -52,7 +52,7 @@ struct TGameObj
TInvenRec *invenTablePtr; TInvenRec *invenTablePtr;
char gap_38[4]; char gap_38[4];
int itemCharges; int itemCharges;
int movePoints; int critterAP_weaponAmmoPid;
char gap_44[16]; char gap_44[16];
int lastTarget; int lastTarget;
char gap_58[12]; char gap_58[12];
@@ -139,7 +139,7 @@ enum ObjectTypes
#pragma pack(push, 1) #pragma pack(push, 1)
struct TProgram struct TProgram
{ {
char gap_0[4]; const char* fileName;
int *codeStackPtr; int *codeStackPtr;
char gap_8[8]; char gap_8[8];
int *codePtr; int *codePtr;
+4 -3
View File
@@ -16,11 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <vector>
#include "main.h" #include "main.h"
#include "FalloutEngine.h" #include "FalloutEngine.h"
#include "FileSystem.h" #include "FileSystem.h"
#include "vector9x.cpp"
extern void GetSavePath(char* buf, char* ftype); extern void GetSavePath(char* buf, char* ftype);
@@ -31,7 +32,7 @@ struct fsFile {
DWORD wpos; DWORD wpos;
}; };
vector<fsFile> files; std::vector<fsFile> files;
static DWORD loadedtiles=0; static DWORD loadedtiles=0;
static DWORD retval; static DWORD retval;
@@ -417,7 +418,7 @@ void FileSystemReset() {
} }
if(!loadedtiles) files.clear(); if(!loadedtiles) files.clear();
else { else {
for(DWORD i=files.size()-1;i>=loadedtiles;i--) files.remove_at(i); for(DWORD i=files.size()-1;i>=loadedtiles;i--) files.erase(files.begin() + i);
} }
} }
void FileSystemSave(HANDLE h) { void FileSystemSave(HANDLE h) {
+11 -10
View File
@@ -1088,7 +1088,7 @@ void _stdcall RegisterHook( DWORD script, DWORD id, DWORD procNum )
} }
sScriptProgram *prog = GetGlobalScriptProgram(script); sScriptProgram *prog = GetGlobalScriptProgram(script);
if (prog) { if (prog) {
dlog_f( "Global script %8x registered as hook id %d ", DL_HOOK, script, id); dlog_f("Global script %08x registered as hook id %d\r\n", DL_HOOK, script, id);
sHookScript hook; sHookScript hook;
hook.prog = *prog; hook.prog = *prog;
hook.callback = procNum; hook.callback = procNum;
@@ -1102,39 +1102,40 @@ static void LoadHookScript(const char* name, int id) {
char filename[MAX_PATH]; char filename[MAX_PATH];
sprintf(filename, "scripts\\%s.int", name); sprintf(filename, "scripts\\%s.int", name);
bool result; bool fileExist;
__asm { __asm {
lea eax, filename lea eax, filename
call db_access_ call db_access_
mov result, al mov fileExist, al
} }
if (result && !isGameScript(name)) { if (fileExist && !isGameScript(name)) {
sScriptProgram prog; sScriptProgram prog;
dlog("Loading hook script: ", DL_HOOK); dlog(">", DL_HOOK);
dlog(filename, DL_HOOK); dlog(name, DL_HOOK);
LoadScriptProgram(prog, name); LoadScriptProgram(prog, name);
if (prog.ptr) { if (prog.ptr) {
dlogr(" Done", DL_HOOK);
sHookScript hook; sHookScript hook;
hook.prog = prog; hook.prog = prog;
hook.callback = -1; hook.callback = -1;
hook.isGlobalScript = false; hook.isGlobalScript = false;
hooks[id].push_back(hook); hooks[id].push_back(hook);
AddProgramToMap(prog); AddProgramToMap(prog);
dlogr(" Done", DL_HOOK);
} else dlogr(" Error!", DL_HOOK); } else dlogr(" Error!", DL_HOOK);
} }
} }
static void HookScriptInit2() { static void HookScriptInit2() {
dlogr("Initing hook scripts", DL_HOOK|DL_INIT); dlogr("Loading hook scripts", DL_HOOK|DL_INIT);
char* mask = "scripts\\hs_*.int"; char* mask = "scripts\\hs_*.int";
DWORD *filenames; DWORD *filenames;
__asm { __asm {
xor ecx, ecx
xor ebx, ebx xor ebx, ebx
mov eax, mask
lea edx, filenames lea edx, filenames
mov eax, mask
call db_get_file_list_ call db_get_file_list_
} }
@@ -1289,7 +1290,7 @@ static void HookScriptInit2() {
call db_free_file_list_ call db_free_file_list_
} }
dlogr("Completed hook script init", DL_HOOK|DL_INIT); dlogr("Finished loading hook scripts", DL_HOOK|DL_INIT);
} }
void HookScriptClear() { void HookScriptClear() {
+2 -2
View File
@@ -49,11 +49,11 @@ static const char* MsgSearch(int msgno, DWORD file) {
} }
DWORD& GetActiveItemMode() { DWORD& GetActiveItemMode() {
return itemButtonItems[(*itemCurrentItem * 6) + 4]; return ptr_itemButtonItems[(*ptr_itemCurrentItem * 6) + 4];
} }
TGameObj* GetActiveItem() { TGameObj* GetActiveItem() {
return (TGameObj*)itemButtonItems[*itemCurrentItem * 6]; return (TGameObj*)ptr_itemButtonItems[*ptr_itemCurrentItem * 6];
} }
void InventoryKeyPressedHook(DWORD dxKey, bool pressed, DWORD vKey) { void InventoryKeyPressedHook(DWORD dxKey, bool pressed, DWORD vKey) {
+18 -17
View File
@@ -16,14 +16,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <math.h>
#include <vector>
#include "main.h" #include "main.h"
#include <math.h>
#include "FalloutEngine.h" #include "FalloutEngine.h"
#include "Knockback.h" #include "Knockback.h"
#include "vector9x.cpp"
static vector<DWORD> NoBursts; static std::vector<DWORD> NoBursts;
struct KnockbackModifier { struct KnockbackModifier {
DWORD id; DWORD id;
@@ -31,9 +32,9 @@ struct KnockbackModifier {
double value; double value;
}; };
static vector<KnockbackModifier> mTargets; static std::vector<KnockbackModifier> mTargets;
static vector<KnockbackModifier> mAttackers; static std::vector<KnockbackModifier> mAttackers;
static vector<KnockbackModifier> mWeapons; static std::vector<KnockbackModifier> mWeapons;
struct ChanceModifier { struct ChanceModifier {
DWORD id; DWORD id;
@@ -41,8 +42,8 @@ struct ChanceModifier {
int mod; int mod;
}; };
static vector<ChanceModifier> HitChanceMods; static std::vector<ChanceModifier> HitChanceMods;
static vector<ChanceModifier> PickpocketMods; static std::vector<ChanceModifier> PickpocketMods;
static ChanceModifier BaseHitChance; static ChanceModifier BaseHitChance;
static ChanceModifier BasePickpocket; static ChanceModifier BasePickpocket;
@@ -50,10 +51,10 @@ static ChanceModifier BasePickpocket;
static bool hookedAimedShot; static bool hookedAimedShot;
static const DWORD aimedShotRet1=0x478EE4; static const DWORD aimedShotRet1=0x478EE4;
static const DWORD aimedShotRet2=0x478EEA; static const DWORD aimedShotRet2=0x478EEA;
static vector<DWORD> disabledAS; static std::vector<DWORD> disabledAS;
static vector<DWORD> forcedAS; static std::vector<DWORD> forcedAS;
static double ApplyModifiers(vector<KnockbackModifier>* mods, DWORD id, double val) { static double ApplyModifiers(std::vector<KnockbackModifier>* mods, DWORD id, double val) {
for(DWORD i=0;i<mods->size();i++) { for(DWORD i=0;i<mods->size();i++) {
if((*mods)[i].id==id) { if((*mods)[i].id==id) {
KnockbackModifier* mod=&(*mods)[i]; KnockbackModifier* mod=&(*mods)[i];
@@ -207,7 +208,7 @@ void Knockback_OnGameLoad() {
} }
void _stdcall KnockbackSetMod(DWORD id, DWORD type, float val, DWORD on) { void _stdcall KnockbackSetMod(DWORD id, DWORD type, float val, DWORD on) {
vector<KnockbackModifier>* mods; std::vector<KnockbackModifier>* mods;
switch(on) { switch(on) {
case 0: mods=&mWeapons; break; case 0: mods=&mWeapons; break;
case 1: mods=&mTargets; break; case 1: mods=&mTargets; break;
@@ -225,7 +226,7 @@ void _stdcall KnockbackSetMod(DWORD id, DWORD type, float val, DWORD on) {
} }
void _stdcall KnockbackRemoveMod(DWORD id, DWORD on) { void _stdcall KnockbackRemoveMod(DWORD id, DWORD on) {
vector<KnockbackModifier>* mods; std::vector<KnockbackModifier>* mods;
switch(on) { switch(on) {
case 0: mods=&mWeapons; break; case 0: mods=&mWeapons; break;
case 1: mods=&mTargets; break; case 1: mods=&mTargets; break;
@@ -234,7 +235,7 @@ void _stdcall KnockbackRemoveMod(DWORD id, DWORD on) {
} }
for(DWORD i=0;i<mods->size();i++) { for(DWORD i=0;i<mods->size();i++) {
if((*mods)[i].id==id) { if((*mods)[i].id==id) {
mods->remove_at(i); mods->erase(mods->begin() + i);
return; return;
} }
} }
@@ -287,7 +288,7 @@ void _stdcall SetNoBurstMode(DWORD critter, DWORD on) {
} else { } else {
for(DWORD i=0;i<NoBursts.size();i++) { for(DWORD i=0;i<NoBursts.size();i++) {
if(NoBursts[i]==critter) { if(NoBursts[i]==critter) {
NoBursts.remove_at(i); NoBursts.erase(NoBursts.begin() + i);
return; return;
} }
} }
@@ -329,13 +330,13 @@ static void HookAimedShots() {
} }
void _stdcall DisableAimedShots(DWORD pid) { void _stdcall DisableAimedShots(DWORD pid) {
if(!hookedAimedShot) HookAimedShots(); if(!hookedAimedShot) HookAimedShots();
for(DWORD i=0;i<forcedAS.size();i++) if(forcedAS[i]==pid) forcedAS.remove_at(i--); for(DWORD i=0;i<forcedAS.size();i++) if(forcedAS[i]==pid) forcedAS.erase(forcedAS.begin() + (i--));
for(DWORD i=0;i<disabledAS.size();i++) if(disabledAS[i]==pid) return; for(DWORD i=0;i<disabledAS.size();i++) if(disabledAS[i]==pid) return;
disabledAS.push_back(pid); disabledAS.push_back(pid);
} }
void _stdcall ForceAimedShots(DWORD pid) { void _stdcall ForceAimedShots(DWORD pid) {
if(!hookedAimedShot) HookAimedShots(); if(!hookedAimedShot) HookAimedShots();
for(DWORD i=0;i<disabledAS.size();i++) if(disabledAS[i]==pid) disabledAS.remove_at(i--); for(DWORD i=0;i<disabledAS.size();i++) if(disabledAS[i]==pid) disabledAS.erase(disabledAS.begin() + (i--));
for(DWORD i=0;i<forcedAS.size();i++) if(forcedAS[i]==pid) return; for(DWORD i=0;i<forcedAS.size();i++) if(forcedAS[i]==pid) return;
forcedAS.push_back(pid); forcedAS.push_back(pid);
} }
+3 -4
View File
@@ -104,9 +104,9 @@ static void _stdcall SaveGame2() {
static char SaveFailMsg[128]; static char SaveFailMsg[128];
static DWORD _stdcall combatSaveTest() { static DWORD _stdcall combatSaveTest() {
if(!SaveInCombatFix) return 1; if (!SaveInCombatFix && !IsNpcControlled()) return 1;
if (InLoop & COMBAT) { if (InLoop & COMBAT) {
if(SaveInCombatFix==2 || !(InLoop&PCOMBAT)) { if (SaveInCombatFix == 2 || IsNpcControlled() || !(InLoop & PCOMBAT)) {
DisplayConsoleMessage(SaveFailMsg); DisplayConsoleMessage(SaveFailMsg);
return 0; return 0;
} }
@@ -129,6 +129,7 @@ static DWORD _stdcall combatSaveTest() {
} }
return 1; return 1;
} }
static void __declspec(naked) SaveGame() { static void __declspec(naked) SaveGame() {
__asm { __asm {
push ebx; push ebx;
@@ -411,9 +412,7 @@ static void __declspec(naked) AutomapHook() {
void LoadGameHookInit() { void LoadGameHookInit() {
SaveInCombatFix = GetPrivateProfileInt("Misc", "SaveInCombatFix", 1, ini); SaveInCombatFix = GetPrivateProfileInt("Misc", "SaveInCombatFix", 1, ini);
if (SaveInCombatFix > 2) SaveInCombatFix = 0; if (SaveInCombatFix > 2) SaveInCombatFix = 0;
if (SaveInCombatFix) {
GetPrivateProfileString("sfall", "SaveInCombat", "Cannot save at this time", SaveFailMsg, 128, translationIni); GetPrivateProfileString("sfall", "SaveInCombat", "Cannot save at this time", SaveFailMsg, 128, translationIni);
}
GetPrivateProfileString("sfall", "SaveSfallDataFail", "ERROR saving extended savegame information! Check if other programs interfere with savegame files/folders and try again!", SaveSfallDataFailMsg, 128, translationIni); GetPrivateProfileString("sfall", "SaveSfallDataFail", "ERROR saving extended savegame information! Check if other programs interfere with savegame files/folders and try again!", SaveSfallDataFailMsg, 128, translationIni);
switch (GetPrivateProfileInt("Misc", "PipBoyAvailableAtGameStart", 0, ini)) { switch (GetPrivateProfileInt("Misc", "PipBoyAvailableAtGameStart", 0, ini)) {

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