mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11dfb3e94a | ||
|
|
3668a1c94f | ||
|
|
5cb3ca2a59 | ||
|
|
4ef88959e3 | ||
|
|
4cc9cb0b83 | ||
|
|
363d7a1cc5 | ||
|
|
d9d86e3fe4 | ||
|
|
ce1fd719cf | ||
|
|
1595d75f7c | ||
|
|
6287eefd7c | ||
|
|
3bc84a0040 | ||
|
|
18b34767b6 | ||
|
|
af4bad36d4 | ||
|
|
1a40c40cd3 | ||
|
|
9367139957 | ||
|
|
87f45d26db | ||
|
|
bd2f83d6a8 | ||
|
|
d29b51d5ea | ||
|
|
d276da3d68 | ||
|
|
502897cb6f | ||
|
|
e3739ba7aa | ||
|
|
02beff2b04 | ||
|
|
cf82440753 | ||
|
|
e78e76e35d | ||
|
|
47783c802e | ||
|
|
ce72ef51f8 | ||
|
|
dbc0ebd36f | ||
|
|
db89f5760c | ||
|
|
e864f1f961 | ||
|
|
fafc4a317f | ||
|
|
5d689c0641 | ||
|
|
4a65a6753f | ||
|
|
5dec063c1c | ||
|
|
dbdf414cd9 | ||
|
|
3e2a22fad8 | ||
|
|
13ee06dee2 | ||
|
|
2d3031e583 | ||
|
|
de5c12484d | ||
|
|
c880ae93a9 | ||
|
|
295a5d1437 | ||
|
|
e726ee54ba | ||
|
|
712eafc241 | ||
|
|
d1bf22ec8d | ||
|
|
21d496f392 | ||
|
|
07948206fb | ||
|
|
6a71bf086d | ||
|
|
ec585529c8 | ||
|
|
e6aad27e44 | ||
|
|
f0528740a4 | ||
|
|
bfd8b38547 | ||
|
|
e6086f984e | ||
|
|
2e766cd3c9 | ||
|
|
48f53388fd | ||
|
|
6199f95c38 | ||
|
|
a6d84bd470 | ||
|
|
a11228a5ec | ||
|
|
7784e199af | ||
|
|
53895a4af2 | ||
|
|
354b938d60 | ||
|
|
643d8d3886 | ||
|
|
924c35d011 | ||
|
|
86163bf94c | ||
|
|
21b2d34432 | ||
|
|
98508a9c76 | ||
|
|
f8b232cc09 | ||
|
|
394b4b9967 | ||
|
|
1bea84eb3c | ||
|
|
26159138e0 | ||
|
|
1883009930 | ||
|
|
f1289c1e7d | ||
|
|
c3e4894243 | ||
|
|
2330dd97bb | ||
|
|
90b718122d | ||
|
|
5ca7ed0dc5 | ||
|
|
9bd03bfb76 | ||
|
|
07b7e270b8 | ||
|
|
f9dbbcdca2 | ||
|
|
b8968c5334 | ||
|
|
4f6b68ca93 |
+52
-25
@@ -1,5 +1,5 @@
|
||||
;sfall configuration settings
|
||||
;v3.7b
|
||||
;v3.8
|
||||
|
||||
[Main]
|
||||
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
|
||||
@@ -201,9 +201,14 @@ WorldMapSlots=0
|
||||
;To use a patch file other than patch000.dat, uncomment the next line and add your new file name
|
||||
;If you want to check for multiple patch files, you can include a %d in the file name (sprintf syntax)
|
||||
;By default, only the first patch file found will be used.
|
||||
;If you want to load multiple patch files at once, uncomment the NumberPatchLoop line and set it to the number of files to check for
|
||||
;If you want to load multiple patch files (up to 1000) at once, uncomment the MultiPatches line and set it to 1
|
||||
;PatchFile=patch%03d.dat
|
||||
;NumberPatchLoop=100
|
||||
;MultiPatches=0
|
||||
|
||||
;Set to 1 to enable the modified data load order for the engine to find game data
|
||||
;Original: patchXXX.dat > critter_patches > critter_dat > f2_res_patches > f2_res_dat > master_patches > master_dat
|
||||
;Modified: master_patches > critter_patches > patchXXX.dat > critter_dat > f2_res_patches > f2_res_dat > master_dat
|
||||
DataLoadOrderPatch=0
|
||||
|
||||
;To change the default and starting player models, uncomment the next four lines.
|
||||
;The default models can also be changed ingame via script
|
||||
@@ -247,6 +252,7 @@ Movie17=credits.mve
|
||||
;PerksFile=Perks.ini
|
||||
|
||||
;Set to 1 if you want the pipboy to be available at the start of the game
|
||||
;Set to 2 to make the pipboy available by only skipping the vault suit movie check
|
||||
PipBoyAvailableAtGameStart=0
|
||||
|
||||
;Set to 1 to double the number of available kill types
|
||||
@@ -290,9 +296,6 @@ SingleCore=1
|
||||
;Set to 1 to override the art_chache_size setting in fallout2.cfg
|
||||
OverrideArtCacheSize=0
|
||||
|
||||
;Set to 1 to fix issues with the GainXXX perks not giving all the bonuses that they should
|
||||
GainStatPerkFix=1
|
||||
|
||||
;Prevents you from saving in combat except at the start of your turn to avoid a few bugs
|
||||
;Note that even with this option enabled, it is still not advisable to save in combat at all.
|
||||
;Set to 2 to block all saving in combat
|
||||
@@ -301,7 +304,7 @@ SaveInCombatFix=1
|
||||
;Point at an ini file containing elevator data
|
||||
;ElevatorsFile=Elevators.ini
|
||||
|
||||
;Uncomment and set to a comma delimited list of numbers to use a custom xp table.
|
||||
;Uncomment and set a comma delimited list of numbers to use a custom xp table.
|
||||
;Players level is capped once the highest specified level is reached
|
||||
;XPTable=50,100,200
|
||||
|
||||
@@ -311,15 +314,14 @@ SaveInCombatFix=1
|
||||
AdditionalWeaponAnims=1
|
||||
|
||||
;Uncomment these lines to modify the default modifiers for aimed shots at specific bodyparts
|
||||
;BodypartHitMod0=-40
|
||||
;BodypartHitMod1=-30
|
||||
;BodypartHitMod2=-30
|
||||
;BodypartHitMod3=0
|
||||
;BodypartHitMod4=-20
|
||||
;BodypartHitMod5=-20
|
||||
;BodypartHitMod6=-60
|
||||
;BodypartHitMod7=-30
|
||||
;BodypartHitMod8=0
|
||||
;BodyHit_Head=-40
|
||||
;BodyHit_Left_Arm=-30
|
||||
;BodyHit_Right_Arm=-30
|
||||
;BodyHit_Torso=0
|
||||
;BodyHit_Right_Leg=-20
|
||||
;BodyHit_Left_Leg=-20
|
||||
;BodyHit_Eyes=-60
|
||||
;BodyHit_Groin=-30
|
||||
|
||||
;Set to 1 to use a CriticalOverrides.ini file to override the default critical table
|
||||
;Set to 2 to use the default critical with bug fixes (doesn't require an ini)
|
||||
@@ -343,7 +345,7 @@ CorpseLineOfFireFix=0
|
||||
;Set a number of milliseconds to idle each input loop
|
||||
;Set to -1 to disable
|
||||
;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
|
||||
|
||||
;Set to 1 if using the hero appearance mod
|
||||
@@ -395,7 +397,7 @@ UseScrollingQuestsList=1
|
||||
ExtraSaveSlots=0
|
||||
|
||||
;Set to 1 to speed up the hp/ac counter animations
|
||||
;Set to 2 to update the hp/ac counter instantly when the number is not negative
|
||||
;Set to 2 to update the hp/ac counters instantly
|
||||
SpeedInterfaceCounterAnims=0
|
||||
|
||||
;These lines allow you to control the karma frm's displayed on the character screen
|
||||
@@ -420,7 +422,7 @@ BonusHtHDamageFix=1
|
||||
;Set to 1 to display additional points of damage from Bonus HtH/Ranged Damage perks in the inventory
|
||||
DisplayBonusDamage=0
|
||||
|
||||
;Modify the maximum number of animations allowed to run on a map. (Default is 32)
|
||||
;Modify the maximum number of animations allowed to run on a map. (Default is 32, and the maximum is 127)
|
||||
AnimationsAtOnceLimit=120
|
||||
|
||||
;Set to 1 to remove the limits that stop the player rolling critical successes/misses in the first few days of game time
|
||||
@@ -470,6 +472,12 @@ EncounterTableSize=0
|
||||
;Set to 1 to disable the pipboy alarm button
|
||||
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.
|
||||
SuperStimExploitFix=0
|
||||
|
||||
@@ -480,8 +488,8 @@ QuickPocketsApCostReduction=2
|
||||
;Set to 1 to allow objects seeing through other objects with their ShootThru flag set
|
||||
ObjCanSeeObj_ShootThru_Fix=0
|
||||
|
||||
;Set to 1 to use the balanced bullet distribution formula for burst attacks
|
||||
ComputeSprayMod=1
|
||||
;Set to 1 to enable the balanced bullet distribution formula for burst attacks
|
||||
ComputeSprayMod=0
|
||||
|
||||
;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
|
||||
@@ -531,7 +539,7 @@ PipboyTimeAnimDelay=50
|
||||
;Set to 0 to disable
|
||||
;Set to 1 to control all critters in combat
|
||||
;Set to 2 to control all party members
|
||||
;If you want to control only specific critters, uncomment the ControlCombatPIDList line and set it to a comma delimited list of PIDs
|
||||
;If you want to control only specific critters, uncomment the ControlCombatPIDList line and set a comma delimited list of PIDs
|
||||
ControlCombat=0
|
||||
;ControlCombatPIDList=62,89,97,107,160,161
|
||||
|
||||
@@ -560,8 +568,15 @@ CarChargingFix=1
|
||||
;Set to 1 to skip weapon equip/unequip animations when performing various actions
|
||||
InstantWeaponEquip=0
|
||||
|
||||
;To change the carry weight limit, uncomment the next line (Default is 999)
|
||||
;CarryWeightLimit=999
|
||||
;To add additional game msg files, uncomment the next line and set a comma delimited list of filenames without .msg extension
|
||||
;You need to use the message_str_game script function to get messages from the files
|
||||
;ExtraGameMsgFileList=
|
||||
|
||||
;Set to 1 to display numbered dialogue options
|
||||
NumbersInDialogue=0
|
||||
|
||||
;Set to 1 to display sfall built-in credits at the bottom of credits.txt contents instead of at the top
|
||||
CreditsAtBottom=0
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
[Debugging]
|
||||
@@ -571,8 +586,20 @@ InstantWeaponEquip=0
|
||||
;Set to 1 to enable sfall debugging mode
|
||||
Enable=0
|
||||
|
||||
;Fallout 2 Debug Patch
|
||||
;Set to 1 to enable debugging output to screen or 2 to create a debug.log file
|
||||
;While you don't need to create an environment variable, you do still need to set the appropriate lines in fallout2.cfg
|
||||
;-------
|
||||
;[debug]
|
||||
;mode=environment
|
||||
;output_map_data_info=1
|
||||
;show_load_info=1
|
||||
;show_script_messages=1
|
||||
;show_tile_num=1
|
||||
;[sound]
|
||||
;debug=1
|
||||
;debug_sfxc=1
|
||||
;-------
|
||||
DebugMode=0
|
||||
|
||||
;Change to 1 to skip the compatibility mode check
|
||||
@@ -592,7 +619,7 @@ DontDeleteProtos=0
|
||||
;Set to 1 to give scripts direct access to Fallout's address space, and to make arbitrary calls into Fallout's code
|
||||
AllowUnsafeScripting=0
|
||||
|
||||
;These options control what output is saved in the debug log
|
||||
;These options control what output is saved in the debug log (sfall-log.txt)
|
||||
|
||||
;Prints messages duing sfall initialization
|
||||
Init=0
|
||||
|
||||
@@ -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
|
||||
|
||||
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
|
||||
arrays.txt - manual for sfall arrays
|
||||
|
||||
|
||||
@@ -2,16 +2,6 @@
|
||||
#ifndef DEFINE_EXTRA_H
|
||||
#define DEFINE_EXTRA_H
|
||||
|
||||
#define ATTACK_MODE_NONE 0
|
||||
#define ATTACK_MODE_PUNCH 1
|
||||
#define ATTACK_MODE_KICK 2
|
||||
#define ATTACK_MODE_SWING 3
|
||||
#define ATTACK_MODE_THRUST 4
|
||||
#define ATTACK_MODE_THROW 5
|
||||
#define ATTACK_MODE_SINGLE 6
|
||||
#define ATTACK_MODE_BURST 7
|
||||
#define ATTACK_MODE_FLAME 8
|
||||
|
||||
#define OBJ_TYPE_ITEM (0)
|
||||
#define OBJ_TYPE_CRITTER (1)
|
||||
#define OBJ_TYPE_SCENERY (2)
|
||||
@@ -20,18 +10,47 @@
|
||||
#define OBJ_TYPE_MISC (5)
|
||||
#define OBJ_TYPE_SPATIAL (6)
|
||||
|
||||
/* Item Common Flags */
|
||||
#define HIDDEN_ITEM 134217728 // 0x08000000 - Hidden Item
|
||||
|
||||
#define ITEM_ACTION_USE 2048 // 0x00000800 - Use (can be used)
|
||||
#define ITEM_ACTION_USEON 4096 // 0x00001000 - Use On Smth (can be used on anything)
|
||||
#define ITEM_ACTION_PICKUP 32768 // 0x00008000 - PickUp
|
||||
|
||||
#define WEAPON_BIGGUN 256 // 0x00000100 - Big Gun
|
||||
#define WEAPON_2HAND 512 // 0x00000200 - 2Hnd (weapon is two-handed)
|
||||
|
||||
#define ATKMODE_PRI_NONE 0
|
||||
#define ATKMODE_PRI_PUNCH 1
|
||||
#define ATKMODE_PRI_KICK 2
|
||||
#define ATKMODE_PRI_SWING 3
|
||||
#define ATKMODE_PRI_THRUST 4
|
||||
#define ATKMODE_PRI_THROW 5
|
||||
#define ATKMODE_PRI_SINGLE 6
|
||||
#define ATKMODE_PRI_BURST 7
|
||||
#define ATKMODE_PRI_FLAME 8
|
||||
#define ATKMODE_SEC_NONE 0
|
||||
#define ATKMODE_SEC_PUNCH 16 // 0x00000010
|
||||
#define ATKMODE_SEC_KICK 32 // 0x00000020
|
||||
#define ATKMODE_SEC_SWING 48 // 0x00000030
|
||||
#define ATKMODE_SEC_THRUST 64 // 0x00000040
|
||||
#define ATKMODE_SEC_THROW 80 // 0x00000050
|
||||
#define ATKMODE_SEC_SINGLE 96 // 0x00000060
|
||||
#define ATKMODE_SEC_BURST 112 // 0x00000070
|
||||
#define ATKMODE_SEC_FLAME 128 // 0x00000080
|
||||
|
||||
/* Critter Flags */
|
||||
#define CFLG_BARTER 2 //0x00000002 - Barter (can trade with)
|
||||
#define CFLG_NOSTEAL 32 //0x00000020 - Steal (cannot steal from)
|
||||
#define CFLG_NODROP 64 //0x00000040 - Drop (doesn't drop items)
|
||||
#define CFLG_NOLIMBS 128 //0x00000080 - Limbs (cannot lose limbs)
|
||||
#define CFLG_NOAGES 256 //0x00000100 - Ages (dead body does not disappear)
|
||||
#define CFLG_NOHEAL 512 //0x00000200 - Heal (damage is not cured with time)
|
||||
#define CFLG_INVULN 1024 //0x00000400 - Invulnerable (cannot be hurt)
|
||||
#define CFLG_FLATTN 2048 //0x00000800 - Flatten (leaves no dead body)
|
||||
#define CFLG_SPECIAL 4096 //0x00001000 - Special (there is a special type of death)
|
||||
#define CFLG_RANGED 8192 //0x00002000 - Range (melee attack is possible at a distance)
|
||||
#define CFLG_NOKNOCKDOWN 16384 //0x00004000 - Knock (cannot be knocked down)
|
||||
#define CFLG_BARTER 2 // 0x00000002 - Barter (can trade with)
|
||||
#define CFLG_NOSTEAL 32 // 0x00000020 - Steal (cannot steal from)
|
||||
#define CFLG_NODROP 64 // 0x00000040 - Drop (doesn't drop items)
|
||||
#define CFLG_NOLIMBS 128 // 0x00000080 - Limbs (cannot lose limbs)
|
||||
#define CFLG_NOAGES 256 // 0x00000100 - Ages (dead body does not disappear)
|
||||
#define CFLG_NOHEAL 512 // 0x00000200 - Heal (damage is not cured with time)
|
||||
#define CFLG_INVULN 1024 // 0x00000400 - Invulnerable (cannot be hurt)
|
||||
#define CFLG_FLATTN 2048 // 0x00000800 - Flatten (leaves no dead body)
|
||||
#define CFLG_SPECIAL 4096 // 0x00001000 - Special (there is a special type of death)
|
||||
#define CFLG_RANGED 8192 // 0x00002000 - Range (melee attack is possible at a distance)
|
||||
#define CFLG_NOKNOCKDOWN 16384 // 0x00004000 - Knock (cannot be knocked down)
|
||||
|
||||
//remove inven obj defines
|
||||
#define RMOBJ_CONSUME_DRUG 4666772
|
||||
|
||||
@@ -187,3 +187,12 @@
|
||||
|
||||
#define party_member_list_critters party_member_list(0)
|
||||
#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")
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
|
||||
------------------------------
|
||||
------ 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) -------
|
||||
----------------------------------------------
|
||||
@@ -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.
|
||||
- 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.
|
||||
|
||||
> 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)
|
||||
- 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.
|
||||
|
||||
> 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.
|
||||
|
||||
> 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.
|
||||
- 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
|
||||
> ObjectPtr get_last_attacker(objptr)
|
||||
> object get_last_attacker(object)
|
||||
- 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.
|
||||
|
||||
@@ -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)
|
||||
- "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
|
||||
|
||||
> void reg_anim_combat_check
|
||||
@@ -222,17 +238,17 @@ Some utility/math functions are available:
|
||||
> 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")
|
||||
|
||||
> int strlen(char* string)
|
||||
> int strlen(string string)
|
||||
- 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.
|
||||
- can be used to get character by ASCII code ("%c")
|
||||
|
||||
> int typeof(any value)
|
||||
- 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
|
||||
|
||||
> ^ operator (exponentiation)
|
||||
@@ -277,6 +293,7 @@ Some utility/math functions are available:
|
||||
> string message_str_game(int fileId, int messageId)
|
||||
- works exactly the same as message_str, except you get messages from files in "text/english/game" folder
|
||||
- use GAME_MSG_* defines or mstr_* macros from sfall.h to use specific msg file
|
||||
- Additional game msg files added by ExtraGameMsgFileList setting will have consecutive fileIds assigned beginning from 0x2000. (e.g. if you set ExtraGameMsgFileList=foo,bar in ddraw.ini, foo.msg will be associated with 0x2000 and bar.msg with 0x2001.)
|
||||
|
||||
> int sneak_success
|
||||
- returns 1 if last sneak attempt (roll against skill) was successful, 0 otherwise
|
||||
@@ -285,12 +302,12 @@ Some utility/math functions are available:
|
||||
> int tile_light(int elevation, int tileNum)
|
||||
- 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)
|
||||
- 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
|
||||
|
||||
> 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
|
||||
|
||||
> array tile_get_objs(int tileNum, int elevation)
|
||||
@@ -300,22 +317,58 @@ Some utility/math functions are available:
|
||||
> 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.)
|
||||
|
||||
> 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
|
||||
- array length equals to a number of steps
|
||||
- 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
|
||||
|
||||
> int art_exists(int artFID)
|
||||
- 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))
|
||||
|
||||
> 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
|
||||
- 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 -------
|
||||
------------------------
|
||||
|
||||
+88
-78
@@ -2,12 +2,12 @@
|
||||
*0x8156 - int read_byte(int address)
|
||||
*0x8157 - int read_short(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)
|
||||
*0x81d0 - void write_short(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)
|
||||
*0x81d3 - void call_offset_v1(int address, int arg1)
|
||||
@@ -25,10 +25,10 @@
|
||||
0x815c - int get_pc_base_stat(int StatID)
|
||||
0x815d - int get_pc_extra_stat(int StatID)
|
||||
|
||||
0x815e - void set_critter_base_stat(CritterPtr, int StatID, int value)
|
||||
0x815f - void set_critter_extra_stat(CritterPtr, int StatID, int value)
|
||||
0x8160 - int get_critter_base_stat(CritterPtr, int StatID)
|
||||
0x8161 - int get_critter_extra_stat(CritterPtr, int StatID)
|
||||
0x815e - void set_critter_base_stat(object, int StatID, int value)
|
||||
0x815f - void set_critter_extra_stat(object, int StatID, int value)
|
||||
0x8160 - int get_critter_base_stat(object, int StatID)
|
||||
0x8161 - int get_critter_extra_stat(object, int StatID)
|
||||
0x8242 - void set_critter_skill_points(int critter, int skill, int value)
|
||||
0x8243 - int get_critter_skill_points(int critter, int skill)
|
||||
0x8244 - void set_available_skill_points(int value)
|
||||
@@ -55,18 +55,18 @@
|
||||
0x8164 - bool game_loaded()
|
||||
|
||||
0x8165 - bool graphics_funcs_available()
|
||||
0x8166 - int load_shader(char* path)
|
||||
0x8166 - int load_shader(string path)
|
||||
0x8167 - void free_shader(int ID)
|
||||
0x8168 - void activate_shader(int ID)
|
||||
0x8169 - void deactivate_shader(int ID)
|
||||
0x816d - void set_shader_int(int ID, char* param, int value)
|
||||
0x816e - void set_shader_float(int ID, char* param, float value)
|
||||
0x816f - void set_shader_vector(int ID, char* param, float f1, float f2, float f3, float f4)
|
||||
0x816d - void set_shader_int(int ID, string param, int value)
|
||||
0x816e - void set_shader_float(int ID, string param, float value)
|
||||
0x816f - void set_shader_vector(int ID, string param, float f1, float f2, float f3, float f4)
|
||||
0x81ad - int get_shader_version()
|
||||
0x81ae - void set_shader_mode(int mode)
|
||||
0x81b0 - void force_graphics_refresh(bool enabled)
|
||||
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)
|
||||
0x819b - void set_global_script_type(int type)
|
||||
@@ -82,9 +82,9 @@
|
||||
0x8173 - int get_world_map_x_pos()
|
||||
0x8174 - int get_world_map_y_pos()
|
||||
|
||||
0x8175 - void set_dm_model(char* name)
|
||||
0x8176 - void set_df_model(char* name)
|
||||
0x8177 - void set_movie_path(char* filename, int movieid)
|
||||
0x8175 - void set_dm_model(string name)
|
||||
0x8176 - void set_df_model(string name)
|
||||
0x8177 - void set_movie_path(string filename, int movieid)
|
||||
|
||||
0x8178 - void set_perk_image(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)
|
||||
0x8187 - void set_perk_agl(int perkID, int value)
|
||||
0x8188 - void set_perk_lck(int perkID, int value)
|
||||
0x8189 - void set_perk_name(int perkID, char* value)
|
||||
0x818a - void set_perk_desc(int perkID, char* value)
|
||||
0x8189 - void set_perk_name(int perkID, string value)
|
||||
0x818a - void set_perk_desc(int perkID, string value)
|
||||
0x8247 - void set_perk_freq(int value)
|
||||
|
||||
0x818b - void set_pipboy_available(int available)
|
||||
@@ -116,18 +116,18 @@
|
||||
0x818f - void set_perk_owed(int value)
|
||||
0x8190 - int get_perk_available(int perk)
|
||||
|
||||
0x8191 - int get_critter_current_ap(CritterPtr)
|
||||
0x8192 - void set_critter_current_ap(CritterPtr, int ap)
|
||||
0x8191 - int get_critter_current_ap(object critter)
|
||||
0x8192 - void set_critter_current_ap(object critter, int ap)
|
||||
|
||||
0x8193 - int active_hand()
|
||||
0x8194 - void toggle_active_hand()
|
||||
|
||||
0x8195 - void set_weapon_knockback(WeaponPtr, int type, float value)
|
||||
0x8196 - void set_target_knockback(CritterPtr, int type, float value)
|
||||
0x8197 - void set_attacker_knockback(CritterPtr, int type, float value)
|
||||
0x8198 - void remove_weapon_knockback(WeaponPtr)
|
||||
0x8199 - void remove_target_knockback(CritterPtr)
|
||||
0x819a - void remove_attacker_knockback(CritterPtr)
|
||||
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)
|
||||
0x8198 - void remove_weapon_knockback(object weapon)
|
||||
0x8199 - void remove_target_knockback(object critter)
|
||||
0x819a - void remove_attacker_knockback(object critter)
|
||||
|
||||
0x819d - void set_sfall_global(string/int varname, int/float value)
|
||||
0x819e - int get_sfall_global_int(string/int varname)
|
||||
@@ -152,26 +152,26 @@
|
||||
0x81aa - void set_xp_mod(int percentage)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
|
||||
0x81a3 - int eax_available()
|
||||
0x81a4 - void set_eax_environment(int environment)
|
||||
|
||||
0x81a5 - void inc_npc_level(char* npc)
|
||||
0x8241 - int get_npc_level(char* npc)
|
||||
0x81a5 - void inc_npc_level(string npc)
|
||||
0x8241 - int get_npc_level(string npc)
|
||||
|
||||
0x81a6 - int get_viewport_x()
|
||||
0x81a7 - int get_viewport_y()
|
||||
0x81a8 - void set_viewport_x(int view_x)
|
||||
0x81a9 - void set_viewport_y(int view_y)
|
||||
|
||||
0x81ac - int get_ini_setting(char* setting)
|
||||
0x81eb - char* get_ini_string(char* setting)
|
||||
0x81ac - int get_ini_setting(string setting)
|
||||
0x81eb - string get_ini_string(string setting)
|
||||
|
||||
0x81af - int get_game_mode()
|
||||
|
||||
@@ -179,14 +179,14 @@
|
||||
|
||||
0x81b6 - void set_car_current_town(int town)
|
||||
|
||||
0x81bb - void set_fake_perk(char* name, int level, int image, char* desc)
|
||||
0x81bc - void set_fake_trait(char* name, int active, int image, char* desc)
|
||||
0x81bd - void set_selectable_perk(char* name, int active, int image, char* desc)
|
||||
0x81be - void set_perkbox_title(char* title)
|
||||
0x81bb - void set_fake_perk(string name, int level, int image, string desc)
|
||||
0x81bc - void set_fake_trait(string name, int active, int image, string desc)
|
||||
0x81bd - void set_selectable_perk(string name, int active, int image, string desc)
|
||||
0x81be - void set_perkbox_title(string title)
|
||||
0x81bf - void hide_real_perks()
|
||||
0x81c0 - void show_real_perks()
|
||||
0x81c1 - int has_fake_perk(char* name)
|
||||
0x81c2 - int has_fake_trait(char* name)
|
||||
0x81c1 - int has_fake_perk(string name)
|
||||
0x81c2 - int has_fake_trait(string name)
|
||||
0x81c3 - void perk_add_mode(int type)
|
||||
0x81c4 - void clear_selectable_perks()
|
||||
0x8225 - void remove_trait(int traitID)
|
||||
@@ -231,11 +231,11 @@
|
||||
0x8266 - int ceil(float)
|
||||
0x8267 - int round(float)
|
||||
|
||||
0x81f2 - void set_palette(char* path)
|
||||
0x81f2 - void set_palette(string path)
|
||||
|
||||
0x81f3 - void remove_script(objptr)
|
||||
0x81f4 - void set_script(objptr, int scriptid)
|
||||
0x81f5 - int get_script(objptr)
|
||||
0x81f3 - void remove_script(object)
|
||||
0x81f4 - void set_script(object, int scriptid)
|
||||
0x81f5 - int get_script(object)
|
||||
|
||||
0x81f6 - int nb_create_char()
|
||||
|
||||
@@ -258,10 +258,10 @@
|
||||
0x8202 - void fs_seek(int id, int pos)
|
||||
0x8203 - void fs_resize(int id, int size)
|
||||
|
||||
0x8204 - int get_proto_data(objptr, int offset)
|
||||
0x8205 - void set_proto_data(objptr, int offset, int value)
|
||||
0x8204 - int get_proto_data(object, int offset)
|
||||
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)
|
||||
|
||||
0x820d - int list_begin(int type)
|
||||
@@ -277,19 +277,19 @@
|
||||
0x8214 - void set_hero_race(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)
|
||||
0x8218 - void set_weapon_ammo_pid(objptr weapon, int pid)
|
||||
0x8219 - int get_weapon_ammo_count(objptr weapon)
|
||||
0x821a - void set_weapon_ammo_count(objptr weapon, int count)
|
||||
0x8217 - int get_weapon_ammo_pid(object weapon)
|
||||
0x8218 - void set_weapon_ammo_pid(object weapon, int pid)
|
||||
0x8219 - int get_weapon_ammo_count(object weapon)
|
||||
0x821a - void set_weapon_ammo_count(object weapon, int count)
|
||||
|
||||
0x8220 - int get_screen_width()
|
||||
0x8221 - int get_screen_height()
|
||||
|
||||
0x8222 - void stop_game()
|
||||
0x8223 - void resume_game()
|
||||
0x8224 - void create_message_window(char* message)
|
||||
0x8224 - void create_message_window(string message)
|
||||
|
||||
0x8226 - int get_light_level()
|
||||
|
||||
@@ -297,16 +297,16 @@
|
||||
|
||||
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)
|
||||
|
||||
0x8235 - array string_split(char* string, char* split)
|
||||
0x8237 - int atoi(char* string)
|
||||
0x8238 - float atof(char* string)
|
||||
0x824e - char* substr(char* string, int start, int length)
|
||||
0x824f - int strlen(char* string)
|
||||
0x8250 - char* sprintf(char* format, any value)
|
||||
0x8251 - int charcode(char* string)
|
||||
0x8235 - array string_split(string string, string split)
|
||||
0x8237 - int atoi(string string)
|
||||
0x8238 - float atof(string string)
|
||||
0x824e - string substr(string string, int start, int length)
|
||||
0x824f - int strlen(string string)
|
||||
0x8250 - string sprintf(string format, any value)
|
||||
0x8251 - int charcode(string string)
|
||||
0x8253 - int typeof(any value)
|
||||
|
||||
0x823a - int get_tile_fid(int tile)
|
||||
@@ -318,35 +318,45 @@
|
||||
|
||||
0x8240 - void mark_movie_played(int id)
|
||||
|
||||
0x8248 - objptr get_last_target(objptr critter)
|
||||
0x8249 - objptr get_last_attacker(objptr critter)
|
||||
0x8248 - object get_last_target(object critter)
|
||||
0x8249 - object get_last_attacker(object critter)
|
||||
|
||||
0x824b - int tile_under_cursor
|
||||
0x824c - int gdialog_get_barter_mod
|
||||
0x824d - void set_inven_ap_cost
|
||||
|
||||
0x825c - void reg_anim_combat_check(int enable)
|
||||
0x825a - void reg_anim_destroy(objptr object)
|
||||
0x825b - void reg_anim_animate_and_hide(objptr object, int animID, int delay)
|
||||
0x825d - void reg_anim_light(objptr object, int radius, int delay)
|
||||
0x825e - void reg_anim_change_fid(objptr object, int FID, int delay)
|
||||
0x825f - void reg_anim_take_out(objptr object, int holdFrameID, int delay)
|
||||
0x8260 - void reg_anim_turn_towards(objptr object, int tile/targetObj, int delay)
|
||||
0x825a - void reg_anim_destroy(object object)
|
||||
0x825b - void reg_anim_animate_and_hide(object object, int animID, int delay)
|
||||
0x825d - void reg_anim_light(object object, int radius, int delay)
|
||||
0x825e - void reg_anim_change_fid(object object, int FID, int delay)
|
||||
0x825f - void reg_anim_take_out(object object, int holdFrameID, 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)
|
||||
|
||||
0x8266 - char* message_str_game(int fileId, int messageId)
|
||||
0x8267 - int sneak_success
|
||||
0x8268 - int tile_light(int elevation, int tileNum)
|
||||
0x8269 - ObjectPtr obj_blocking_line(ObjectPtr objFrom, int tileTo, int blockingType)
|
||||
0x826a - ObjectPtr obj_blocking_tile(int tileNum, int elevation, int blockingType)
|
||||
0x826b - array tile_get_objs(int tileNum, int elevation)
|
||||
0x826c - array party_member_list(int includeHidden)
|
||||
0x826d - array path_find_to(ObjectPtr objFrom, int tileTo, int blockingType)
|
||||
0x826e - ObjectPtr create_spatial(int scriptID, int tile, int elevation, int radius)
|
||||
0x826f - int art_exists(int artFID)
|
||||
0x8270 - int obj_is_carrying_obj(ObjectPtr invenObj, ObjectPtr itemObj)
|
||||
0x826b - string message_str_game(int fileId, int messageId)
|
||||
0x826c - int sneak_success
|
||||
0x826d - int tile_light(int elevation, int tileNum)
|
||||
0x826e - object obj_blocking_line(object objFrom, int tileTo, int blockingType)
|
||||
0x826f - object obj_blocking_tile(int tileNum, int elevation, int blockingType)
|
||||
0x8270 - array tile_get_objs(int tileNum, int elevation)
|
||||
0x8271 - array party_member_list(int includeHidden)
|
||||
0x8272 - array path_find_to(object objFrom, int tileTo, int blockingType)
|
||||
0x8273 - object create_spatial(int scriptID, int tile, int elevation, int radius)
|
||||
0x8274 - int art_exists(int artFID)
|
||||
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
|
||||
|
||||
+2
-2
@@ -658,8 +658,8 @@ static void __declspec(naked) DisplayBonusHtHDmg2() {
|
||||
push eax
|
||||
call sprintf_
|
||||
add esp, 4*5
|
||||
mov eax, 0x472569
|
||||
jmp eax
|
||||
push 0x472569
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+18
-1
@@ -311,9 +311,26 @@ void DESetArray(int id, const DWORD* types, const void* data) {
|
||||
|
||||
/*
|
||||
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) {
|
||||
varType&=0xffff;
|
||||
varType &= 0xffff;
|
||||
switch (varType) {
|
||||
case VAR_TYPE_STR:
|
||||
case VAR_TYPE_STR2:
|
||||
|
||||
+5
-1
@@ -4,7 +4,7 @@
|
||||
#include <unordered_map>
|
||||
#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,
|
||||
// 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[];
|
||||
|
||||
// TODO: rewrite
|
||||
class sArrayElement
|
||||
{
|
||||
public:
|
||||
@@ -79,6 +80,8 @@ typedef std::tr1::unordered_map<sArrayElement, DWORD, sArrayElement_HashFunc, sA
|
||||
/**
|
||||
This class represents sfall array
|
||||
It can be both list (normal array) and map (associative)
|
||||
|
||||
TODO: rewrite for better interface (especially associate arrays)
|
||||
*/
|
||||
class sArrayVar
|
||||
{
|
||||
@@ -139,6 +142,7 @@ void GetArrays(int* arrays);
|
||||
void DEGetArray(int id, DWORD* types, 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 getScriptTypeBySfallType(DWORD dataType);
|
||||
// creates new normal (persistent) array. len == -1 specifies associative array (map)
|
||||
|
||||
+266
-76
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -69,7 +69,7 @@ divEnd2:
|
||||
|
||||
|
||||
void ComputeSprayModInit() {
|
||||
if (GetPrivateProfileIntA("Misc", "ComputeSprayMod", 1, ini)) {
|
||||
if (GetPrivateProfileIntA("Misc", "ComputeSprayMod", 0, ini)) {
|
||||
dlog("Applying ComputeSpray changes.", DL_INIT);
|
||||
compute_spray_center_mult = GetPrivateProfileIntA("Misc", "ComputeSpray_CenterMult", 1, ini);
|
||||
compute_spray_center_div = GetPrivateProfileIntA("Misc", "ComputeSpray_CenterDiv", 3, ini);
|
||||
|
||||
@@ -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; }
|
||||
+51
-23
@@ -22,10 +22,10 @@
|
||||
#include "FalloutEngine.h"
|
||||
#include "version.h"
|
||||
|
||||
static DWORD InCredits=0;
|
||||
static DWORD CreditsLine=0;
|
||||
static DWORD InCredits = 0;
|
||||
static DWORD CreditsLine = 0;
|
||||
|
||||
static const char* ExtraLines[]={
|
||||
static const char* ExtraLines[] = {
|
||||
"#SFALL " VERSION_STRING,
|
||||
"",
|
||||
"sfall is free software, licensed under the GPL",
|
||||
@@ -71,42 +71,43 @@ static const char* ExtraLines[]={
|
||||
"#FALLOUT 2",
|
||||
""
|
||||
};
|
||||
static DWORD ExtraLineCount=sizeof(ExtraLines)/4;
|
||||
static DWORD ExtraLineCount = sizeof(ExtraLines)/4;
|
||||
|
||||
static const char* creditsFile="credits.txt";
|
||||
static const char* creditsFile = "credits.txt";
|
||||
|
||||
static void _stdcall ShowCreditsHook() {
|
||||
InCredits=1;
|
||||
CreditsLine=0;
|
||||
InCredits = 1;
|
||||
CreditsLine = 0;
|
||||
__asm {
|
||||
mov eax, creditsFile;
|
||||
mov eax, creditsFile;
|
||||
call credits_;
|
||||
}
|
||||
InCredits=0;
|
||||
InCredits = 0;
|
||||
}
|
||||
|
||||
static DWORD _stdcall CreditsNextLine(char* buf, DWORD* font, DWORD* colour) {
|
||||
if(!InCredits||CreditsLine>=ExtraLineCount) return 0;
|
||||
const char* line=ExtraLines[CreditsLine++];
|
||||
if(strlen(line)) {
|
||||
if(line[0]=='#') {
|
||||
if (!InCredits || CreditsLine >= ExtraLineCount) return 0;
|
||||
const char* line = ExtraLines[CreditsLine++];
|
||||
if (strlen(line)) {
|
||||
if (line[0] == '#') {
|
||||
line++;
|
||||
*font=*(DWORD*)_name_font;
|
||||
*colour=*(BYTE*)0x6A7F01;
|
||||
} else if(line[0]=='@') {
|
||||
*font = *(DWORD*)_name_font;
|
||||
*colour = *(BYTE*)0x6A7F01;
|
||||
} else if (line[0] == '@') {
|
||||
line++;
|
||||
*font=*(DWORD*)_title_font;
|
||||
*colour=*(DWORD*)_title_color;
|
||||
*font = *(DWORD*)_title_font;
|
||||
*colour = *(DWORD*)_title_color;
|
||||
} else {
|
||||
*font=*(DWORD*)_name_font;
|
||||
*colour=*(DWORD*)_name_color;
|
||||
*font = *(DWORD*)_name_font;
|
||||
*colour = *(DWORD*)_name_color;
|
||||
}
|
||||
}
|
||||
strcpy_s(buf, 256, line);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void __declspec(naked) CreditsNextLineHook() {
|
||||
// Additional lines will be at the top of CREDITS.TXT contents
|
||||
static void __declspec(naked) CreditsNextLineHook_Top() {
|
||||
__asm {
|
||||
pushad;
|
||||
push ebx;
|
||||
@@ -115,7 +116,7 @@ static void __declspec(naked) CreditsNextLineHook() {
|
||||
call CreditsNextLine;
|
||||
test eax, eax;
|
||||
popad;
|
||||
jz fail;
|
||||
jz fail;
|
||||
xor eax, eax;
|
||||
inc eax;
|
||||
retn;
|
||||
@@ -124,8 +125,35 @@ fail:
|
||||
}
|
||||
}
|
||||
|
||||
// Additional lines will be at the bottom of CREDITS.TXT contents
|
||||
static void __declspec(naked) CreditsNextLineHook_Bottom() {
|
||||
__asm {
|
||||
pushad;
|
||||
call credits_get_next_line_; // call default function
|
||||
test eax, eax;
|
||||
popad;
|
||||
jnz morelines; // if not the end yet, skip custom code
|
||||
pushad;
|
||||
push ebx;
|
||||
push edx;
|
||||
push eax;
|
||||
call CreditsNextLine; // otherwise call out function
|
||||
test eax, eax; // if any extra lines left, return 1 (from function), 0 otherwise
|
||||
popad;
|
||||
jnz morelines;
|
||||
mov eax, 0x0;
|
||||
retn;
|
||||
morelines:
|
||||
mov eax, 0x1;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
void CreditsInit() {
|
||||
HookCall(0x480C49, &ShowCreditsHook);
|
||||
HookCall(0x43F881, &ShowCreditsHook);
|
||||
HookCall(0x42CB49, &CreditsNextLineHook);
|
||||
if (GetPrivateProfileIntA("Misc", "CreditsAtBottom", 0, ini))
|
||||
HookCall(0x42CB49, &CreditsNextLineHook_Bottom);
|
||||
else
|
||||
HookCall(0x42CB49, &CreditsNextLineHook_Top);
|
||||
}
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#include <vector>
|
||||
#include "Arrays.h"
|
||||
#include "DebugEditor.h"
|
||||
#include "FalloutEngine.h"
|
||||
|
||||
+15
-15
@@ -84,29 +84,29 @@ static void __declspec(naked) UnknownHook2() {
|
||||
|
||||
static void __declspec(naked) GetNumButtonsHook1() {
|
||||
__asm {
|
||||
lea esi, Menus;
|
||||
mov eax, [esi+edi*4];
|
||||
mov eax, [_btncnt+eax*4];
|
||||
mov esi, 0x43F064;
|
||||
jmp esi;
|
||||
lea esi, Menus;
|
||||
mov eax, [esi+edi*4];
|
||||
mov eax, [_btncnt+eax*4];
|
||||
push 0x43F064;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
static void __declspec(naked) GetNumButtonsHook2() {
|
||||
__asm {
|
||||
lea edx, Menus;
|
||||
mov eax, [edx+edi*4];
|
||||
mov eax, [_btncnt+eax*4];
|
||||
mov edx, 0x43F18B;
|
||||
jmp edx;
|
||||
lea edx, Menus;
|
||||
mov eax, [edx+edi*4];
|
||||
mov eax, [_btncnt+eax*4];
|
||||
push 0x43F18B;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
static void __declspec(naked) GetNumButtonsHook3() {
|
||||
__asm {
|
||||
lea eax, Menus;
|
||||
mov eax, [eax+edi*4];
|
||||
mov eax, [_btncnt+eax*4];
|
||||
mov ebx, 0x43F1EB;
|
||||
jmp ebx;
|
||||
lea eax, Menus;
|
||||
mov eax, [eax+edi*4];
|
||||
mov eax, [_btncnt+eax*4];
|
||||
push 0x43F1EB;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+351
-25
@@ -18,16 +18,189 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#include "Logging.h"
|
||||
#include "Define.h"
|
||||
#include "FalloutEngine.h"
|
||||
#include "Logging.h"
|
||||
|
||||
// global variables
|
||||
TGameObj** obj_dude_ptr = (TGameObj**)(0x6610B8);
|
||||
TGameObj** inven_dude_ptr = (TGameObj**)(0x519058);
|
||||
DWORD* activeUIHand_ptr = (DWORD*)(0x518F78); // 0 - left, 1 - right
|
||||
DWORD* dude_traits = (DWORD*)(0x66BE40); // 2 of them
|
||||
DWORD* itemCurrentItem = (DWORD*)(0x518F78);
|
||||
DWORD* itemButtonItems = (DWORD*)(0x5970F8);
|
||||
long* ptr_pc_traits = reinterpret_cast<long*>(_pc_trait); // 2 of them
|
||||
|
||||
DWORD* ptr_aiInfoList = reinterpret_cast<DWORD*>(_aiInfoList);
|
||||
DWORD* ptr_ambient_light = reinterpret_cast<DWORD*>(_ambient_light);
|
||||
DWORD* ptr_art = reinterpret_cast<DWORD*>(_art);
|
||||
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
|
||||
@@ -98,6 +271,7 @@ const DWORD critter_name_ = 0x42D0A8;
|
||||
const DWORD critter_pc_set_name_ = 0x42D138;
|
||||
const DWORD critterClearObjDrugs_ = 0x42DA54;
|
||||
const DWORD critterIsOverloaded_ = 0x42E66C;
|
||||
const DWORD db_access_ = 0x4390B4;
|
||||
const DWORD db_dir_entry_ = 0x4C5D68;
|
||||
const DWORD db_fclose_ = 0x4C5EB4;
|
||||
const DWORD db_fgetc_ = 0x4C5F24;
|
||||
@@ -110,13 +284,16 @@ const DWORD db_freadInt_ = 0x4C614C;
|
||||
const DWORD db_freadIntCount_ = 0x4C63BC;
|
||||
const DWORD db_freadShort_ = 0x4C60F4;
|
||||
const DWORD db_freadShortCount_ = 0x4C6330;
|
||||
const DWORD db_free_file_list_ = 0x4C6868;
|
||||
const DWORD db_fseek_ = 0x4C60C0;
|
||||
const DWORD db_fwriteByte_ = 0x4C61AC;
|
||||
const DWORD db_fwriteByteCount_ = 0x4C6464;
|
||||
const DWORD db_fwriteInt_ = 0x4C6214;
|
||||
const DWORD db_get_file_list_ = 0x4C6628;
|
||||
const DWORD db_read_to_buf_ = 0x4C5DD4;
|
||||
const DWORD dbase_close_ = 0x4E5270;
|
||||
const DWORD dbase_open_ = 0x4E4F58;
|
||||
const DWORD debug_printf_ = 0x4C6F48;
|
||||
const DWORD debug_register_env_ = 0x4C6D90;
|
||||
const DWORD determine_to_hit_func_ = 0x4243A8;
|
||||
const DWORD dialog_out_ = 0x41CF20;
|
||||
@@ -142,6 +319,7 @@ const DWORD elevator_start_ = 0x43F324;
|
||||
const DWORD endgame_slideshow_ = 0x43F788;
|
||||
const DWORD exec_script_proc_ = 0x4A4810;
|
||||
const DWORD executeProcedure_ = 0x46DD2C;
|
||||
const DWORD findCurrentProc_ = 0x467160;
|
||||
const DWORD fadeSystemPalette_ = 0x4C7320;
|
||||
const DWORD findVar_ = 0x4410AC;
|
||||
const DWORD folder_print_line_ = 0x43E3D8;
|
||||
@@ -174,6 +352,7 @@ const DWORD interpretPopLong_ = 0x467500;
|
||||
const DWORD interpretPopShort_ = 0x4674F0;
|
||||
const DWORD interpretPushLong_ = 0x4674DC;
|
||||
const DWORD interpretPushShort_ = 0x46748C;
|
||||
const DWORD interpretError_ = 0x4671F0;
|
||||
const DWORD intface_redraw_ = 0x45EB98;
|
||||
const DWORD intface_toggle_item_state_ = 0x45F4E0;
|
||||
const DWORD intface_toggle_items_ = 0x45F404;
|
||||
@@ -182,6 +361,9 @@ const DWORD intface_update_hit_points_ = 0x45EBD8;
|
||||
const DWORD intface_update_items_ = 0x45EFEC;
|
||||
const DWORD intface_update_move_points_ = 0x45EE0C;
|
||||
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 invenWieldFunc_ = 0x472768;
|
||||
const DWORD inven_display_msg_ = 0x472D24;
|
||||
@@ -261,6 +443,7 @@ const DWORD mouse_in_ = 0x4CA8C8;
|
||||
const DWORD mouse_show_ = 0x4CA34C;
|
||||
const DWORD move_inventory_ = 0x474708;
|
||||
const DWORD NixHotLines_ = 0x4999C0;
|
||||
const DWORD nrealloc_ = 0x4F1669;
|
||||
const DWORD obj_ai_blocking_at_ = 0x48BA20;
|
||||
const DWORD obj_blocking_at_ = 0x48B848; // (EAX *obj, EDX hexNum, EBX level)
|
||||
const DWORD obj_bound_ = 0x48B66C;
|
||||
@@ -375,6 +558,7 @@ const DWORD stat_pc_add_experience_ = 0x4AFAA8;
|
||||
const DWORD stat_pc_get_ = 0x4AF8FC;
|
||||
const DWORD stat_pc_set_ = 0x4AF910;
|
||||
const DWORD stat_set_bonus_ = 0x4AF63C;
|
||||
const DWORD stricmp_ = 0x4DECE6;
|
||||
const DWORD strncpy_ = 0x4F014F;
|
||||
const DWORD switch_hand_ = 0x4714E0;
|
||||
const DWORD talk_to_translucent_trans_buf_to_buf_ = 0x44AC68;
|
||||
@@ -419,6 +603,7 @@ const DWORD xfread_ = 0x4DF44C;
|
||||
const DWORD xfseek_ = 0x4DF5D8;
|
||||
const DWORD xftell_ = 0x4DF690;
|
||||
const DWORD xfwrite_ = 0x4DF4E8;
|
||||
const DWORD xremovepath_ = 0x4DFAB4;
|
||||
const DWORD xrewind_ = 0x4DF6E4;
|
||||
const DWORD xungetc_ = 0x4DF3F4;
|
||||
const DWORD xvfprintf_ = 0x4DF1AC;
|
||||
@@ -430,29 +615,36 @@ const DWORD xvfprintf_ = 0x4DF1AC;
|
||||
|
||||
int __stdcall ItemGetType(TGameObj* item) {
|
||||
__asm {
|
||||
mov eax, item;
|
||||
call item_get_type_;
|
||||
mov eax, item
|
||||
call item_get_type_
|
||||
}
|
||||
}
|
||||
|
||||
int _stdcall IsPartyMember(TGameObj* obj) {
|
||||
__asm {
|
||||
mov eax, obj;
|
||||
call isPartyMember_;
|
||||
mov eax, obj
|
||||
call isPartyMember_
|
||||
}
|
||||
}
|
||||
|
||||
TGameObj* GetInvenWeaponLeft(TGameObj* obj) {
|
||||
int _stdcall PartyMemberGetCurrentLevel(TGameObj* obj) {
|
||||
__asm {
|
||||
mov eax, obj;
|
||||
call inven_left_hand_;
|
||||
mov eax, obj
|
||||
call partyMemberGetCurLevel_
|
||||
}
|
||||
}
|
||||
|
||||
TGameObj* GetInvenWeaponRight(TGameObj* obj) {
|
||||
TGameObj* __stdcall GetInvenWeaponLeft(TGameObj* obj) {
|
||||
__asm {
|
||||
mov eax, obj;
|
||||
call inven_right_hand_;
|
||||
mov eax, obj
|
||||
call inven_left_hand_
|
||||
}
|
||||
}
|
||||
|
||||
TGameObj* __stdcall GetInvenWeaponRight(TGameObj* obj) {
|
||||
__asm {
|
||||
mov eax, obj
|
||||
call inven_right_hand_
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,9 +652,9 @@ TGameObj* GetInvenWeaponRight(TGameObj* obj) {
|
||||
char* GetProtoPtr(DWORD pid) {
|
||||
char* proto;
|
||||
__asm {
|
||||
mov eax, pid;
|
||||
lea edx, proto;
|
||||
call proto_ptr_;
|
||||
mov eax, pid
|
||||
lea edx, proto
|
||||
call proto_ptr_
|
||||
}
|
||||
return proto;
|
||||
}
|
||||
@@ -477,17 +669,15 @@ char AnimCodeByWeapon(TGameObj* weapon) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void DisplayConsoleMessage(const char* msg) {
|
||||
__asm {
|
||||
mov eax, msg;
|
||||
call display_print_;
|
||||
mov eax, msg
|
||||
call display_print_
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
const char* result;
|
||||
__asm {
|
||||
@@ -499,3 +689,139 @@ const char* _stdcall GetMessageStr(DWORD fileAddr, DWORD messageId)
|
||||
}
|
||||
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_
|
||||
}
|
||||
|
||||
+270
-13
@@ -26,6 +26,10 @@
|
||||
|
||||
#include "FalloutStructs.h"
|
||||
|
||||
// Global variable offsets
|
||||
// TODO: probably need to hide these by moving inside implementation file
|
||||
|
||||
#define _aiInfoList 0x510948
|
||||
#define _ambient_light 0x51923C
|
||||
#define _art 0x510738
|
||||
#define _art_name 0x56C9E4
|
||||
@@ -45,6 +49,7 @@
|
||||
#define _combat_turn_running 0x51093C
|
||||
#define _combatNumTurns 0x510940
|
||||
#define _crit_succ_eff 0x510978
|
||||
#define _critter_db_handle 0x58E94C
|
||||
#define _critterClearObj 0x518438
|
||||
#define _crnt_func 0x664508
|
||||
#define _curr_font_num 0x51E3B0
|
||||
@@ -67,7 +72,9 @@
|
||||
#define _free_perk 0x570A29
|
||||
#define _game_global_vars 0x5186C0
|
||||
#define _game_user_wants_to_quit 0x5186CC
|
||||
#define _gcsd 0x51094C
|
||||
#define _gdBarterMod 0x51873C
|
||||
#define _gdNumOptions 0x5186D8
|
||||
#define _gIsSteal 0x51D430
|
||||
#define _glblmode 0x5709D0
|
||||
#define _gmouse_current_cursor 0x518C0C
|
||||
@@ -83,6 +90,8 @@
|
||||
#define _i_rhand 0x59E968
|
||||
#define _i_wid 0x59E964
|
||||
#define _i_worn 0x59E954
|
||||
#define _idle_func 0x51E234
|
||||
#define _In_WorldMap 0x672E1C
|
||||
#define _info_line 0x5707D0
|
||||
#define _interfaceWindow 0x519024
|
||||
#define _intfaceEnabled 0x518F10
|
||||
@@ -109,7 +118,10 @@
|
||||
#define _main_window 0x5194F0
|
||||
#define _map_elevation 0x519578
|
||||
#define _map_global_vars 0x51956C
|
||||
#define _master_db_handle 0x58E948
|
||||
#define _max 0x56FB50
|
||||
#define _maxScriptNum 0x51C7CC
|
||||
#define _Meet_Frank_Horrigan 0x672E04
|
||||
#define _mouse_hotx 0x6AC7D0
|
||||
#define _mouse_hoty 0x6AC7CC
|
||||
#define _mouse_is_hidden 0x6AC790
|
||||
@@ -156,6 +168,8 @@
|
||||
#define _read_callback 0x51DEEC
|
||||
#define _RedColor 0x6AB4D0
|
||||
#define _retvals 0x43EA7C
|
||||
#define _scr_size 0x6AC9F0
|
||||
#define _scriptListInfo 0x51C7C8
|
||||
#define _skill_data 0x51D118
|
||||
#define _slot_cursor 0x5193B8
|
||||
#define _sneak_working 0x56D77C // DWORD var
|
||||
@@ -172,6 +186,8 @@
|
||||
#define _target_stack 0x59E81C
|
||||
#define _target_stack_offset 0x59E7EC
|
||||
#define _target_str 0x56D518
|
||||
#define _target_xpos 0x672E20
|
||||
#define _target_ypos 0x672E24
|
||||
#define _text_char_width 0x51E3C4
|
||||
#define _text_height 0x51E3BC
|
||||
#define _text_max 0x51E3D4
|
||||
@@ -184,23 +200,199 @@
|
||||
#define _trait_data 0x51DB84
|
||||
#define _view_page 0x664520
|
||||
#define _wd_obj 0x59E98C
|
||||
#define _wmAreaInfoList 0x51DDF8
|
||||
#define _wmLastRndTime 0x51DEA0
|
||||
#define _wmWorldOffsetX 0x51DE2C
|
||||
#define _wmWorldOffsetY 0x51DE30
|
||||
#define _world_xpos 0x672E0C
|
||||
#define _world_ypos 0x672E10
|
||||
#define _WorldMapCurrArea 0x672E08
|
||||
#define _YellowColor 0x6AB8BB
|
||||
|
||||
// variables
|
||||
extern TGameObj** obj_dude_ptr;
|
||||
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;
|
||||
// TODO: move to separate namespace
|
||||
|
||||
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_loot_container_;
|
||||
extern const DWORD action_use_an_item_on_object_;
|
||||
@@ -249,6 +441,7 @@ extern const DWORD critter_name_;
|
||||
extern const DWORD critter_pc_set_name_;
|
||||
extern const DWORD critterClearObjDrugs_;
|
||||
extern const DWORD critterIsOverloaded_;
|
||||
extern const DWORD db_access_;
|
||||
extern const DWORD db_dir_entry_;
|
||||
extern const DWORD db_fclose_;
|
||||
extern const DWORD db_fgetc_;
|
||||
@@ -261,13 +454,16 @@ extern const DWORD db_freadInt_;
|
||||
extern const DWORD db_freadIntCount_;
|
||||
extern const DWORD db_freadShort_;
|
||||
extern const DWORD db_freadShortCount_;
|
||||
extern const DWORD db_free_file_list_;
|
||||
extern const DWORD db_fseek_;
|
||||
extern const DWORD db_fwriteByte_;
|
||||
extern const DWORD db_fwriteByteCount_;
|
||||
extern const DWORD db_fwriteInt_;
|
||||
extern const DWORD db_get_file_list_;
|
||||
extern const DWORD db_read_to_buf_;
|
||||
extern const DWORD dbase_close_;
|
||||
extern const DWORD dbase_open_;
|
||||
extern const DWORD debug_printf_;
|
||||
extern const DWORD debug_register_env_;
|
||||
extern const DWORD determine_to_hit_func_;
|
||||
extern const DWORD dialog_out_;
|
||||
@@ -325,6 +521,7 @@ extern const DWORD interpretPopLong_;
|
||||
extern const DWORD interpretPopShort_;
|
||||
extern const DWORD interpretPushLong_;
|
||||
extern const DWORD interpretPushShort_;
|
||||
extern const DWORD interpretError_;
|
||||
extern const DWORD intface_redraw_; // no args
|
||||
extern const DWORD intface_toggle_item_state_;
|
||||
extern const DWORD intface_toggle_items_;
|
||||
@@ -333,6 +530,9 @@ extern const DWORD intface_update_hit_points_;
|
||||
extern const DWORD intface_update_items_;
|
||||
extern const DWORD intface_update_move_points_;
|
||||
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 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_;
|
||||
@@ -415,6 +615,7 @@ extern const DWORD mouse_in_;
|
||||
extern const DWORD mouse_show_;
|
||||
extern const DWORD move_inventory_;
|
||||
extern const DWORD NixHotLines_;
|
||||
extern const DWORD nrealloc_;
|
||||
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_bound_;
|
||||
@@ -513,11 +714,11 @@ extern const DWORD set_game_time_;
|
||||
extern const DWORD SexWindow_;
|
||||
extern const DWORD skill_check_stealing_;
|
||||
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_level_;
|
||||
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 skilldex_select_;
|
||||
extern const DWORD sprintf_;
|
||||
@@ -525,10 +726,11 @@ extern const DWORD square_num_;
|
||||
extern const DWORD stat_get_base_direct_;
|
||||
extern const DWORD stat_get_bonus_;
|
||||
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_set_;
|
||||
extern const DWORD stat_set_bonus_;
|
||||
extern const DWORD stricmp_;
|
||||
extern const DWORD strncpy_;
|
||||
extern const DWORD switch_hand_;
|
||||
extern const DWORD talk_to_translucent_trans_buf_to_buf_;
|
||||
@@ -573,6 +775,7 @@ extern const DWORD xfread_;
|
||||
extern const DWORD xfseek_;
|
||||
extern const DWORD xftell_;
|
||||
extern const DWORD xfwrite_;
|
||||
extern const DWORD xremovepath_;
|
||||
extern const DWORD xrewind_;
|
||||
extern const DWORD xungetc_;
|
||||
extern const DWORD xvfprintf_;
|
||||
@@ -637,11 +840,65 @@ extern const DWORD getmsg_; // eax - msg file addr, ebx - message ID, edx - int[
|
||||
#define MSG_FILE_WORLDMAP (0x672FB0)
|
||||
|
||||
// WRAPPERS:
|
||||
// TODO: move these to different namespace
|
||||
int _stdcall IsPartyMember(TGameObj* obj);
|
||||
TGameObj* GetInvenWeaponLeft(TGameObj* obj);
|
||||
TGameObj* GetInvenWeaponRight(TGameObj* obj);
|
||||
int _stdcall PartyMemberGetCurrentLevel(TGameObj* obj);
|
||||
TGameObj* __stdcall GetInvenWeaponLeft(TGameObj* obj);
|
||||
TGameObj* __stdcall GetInvenWeaponRight(TGameObj* obj);
|
||||
char* GetProtoPtr(DWORD pid);
|
||||
char AnimCodeByWeapon(TGameObj* weapon);
|
||||
// Displays message in main UI console window
|
||||
void DisplayConsoleMessage(const char* msg);
|
||||
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);
|
||||
|
||||
@@ -34,7 +34,7 @@ struct TInvenRec
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
/* 8 */
|
||||
/* 15 */
|
||||
#pragma pack(push, 1)
|
||||
struct TGameObj
|
||||
{
|
||||
@@ -52,7 +52,7 @@ struct TGameObj
|
||||
TInvenRec *invenTablePtr;
|
||||
char gap_38[4];
|
||||
int itemCharges;
|
||||
int movePoints;
|
||||
int critterAP_weaponAmmoPid;
|
||||
char gap_44[16];
|
||||
int lastTarget;
|
||||
char gap_58[12];
|
||||
@@ -139,7 +139,7 @@ enum ObjectTypes
|
||||
#pragma pack(push, 1)
|
||||
struct TProgram
|
||||
{
|
||||
char gap_0[4];
|
||||
const char* fileName;
|
||||
int *codeStackPtr;
|
||||
char gap_8[8];
|
||||
int *codePtr;
|
||||
|
||||
@@ -16,13 +16,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#include "FalloutEngine.h"
|
||||
#include "FileSystem.h"
|
||||
#include "vector9x.cpp"
|
||||
|
||||
extern void GetSavePath(char* buf, int type);
|
||||
extern void GetSavePath(char* buf, char* ftype);
|
||||
|
||||
struct fsFile {
|
||||
char* data;
|
||||
@@ -31,7 +32,7 @@ struct fsFile {
|
||||
DWORD wpos;
|
||||
};
|
||||
|
||||
vector<fsFile> files;
|
||||
std::vector<fsFile> files;
|
||||
|
||||
static DWORD loadedtiles=0;
|
||||
static DWORD retval;
|
||||
@@ -417,7 +418,7 @@ void FileSystemReset() {
|
||||
}
|
||||
if(!loadedtiles) files.clear();
|
||||
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) {
|
||||
@@ -440,7 +441,7 @@ void FileSystemSave(HANDLE h) {
|
||||
static void FileSystemLoad() {
|
||||
FileSystemReset();
|
||||
char buf[MAX_PATH];
|
||||
GetSavePath(buf, 1);
|
||||
GetSavePath(buf, "fs");
|
||||
|
||||
HANDLE h=CreateFileA(buf, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
|
||||
if(h!=INVALID_HANDLE_VALUE) {
|
||||
@@ -454,8 +455,8 @@ static void FileSystemLoad() {
|
||||
ReadFile(h, file.data, file.length, &read, 0);
|
||||
if(UsingFileSystem) files.push_back(file);
|
||||
}
|
||||
CloseHandle(h);
|
||||
}
|
||||
CloseHandle(h);
|
||||
}
|
||||
}
|
||||
static const DWORD LoadHookRetAddr=0x47CCEE;
|
||||
|
||||
+65
-45
@@ -86,7 +86,7 @@ static void _stdcall RunSpecificHookScript(sHookScript *hook) {
|
||||
if (hook->callback != -1)
|
||||
RunScriptProcByNum(hook->prog.ptr, hook->callback);
|
||||
else
|
||||
RunScriptProc(&hook->prog, start_proc);
|
||||
RunScriptProc(&hook->prog, start);
|
||||
}
|
||||
static void _stdcall RunHookScript(DWORD hook) {
|
||||
if (hooks[hook].size()) {
|
||||
@@ -1088,7 +1088,7 @@ void _stdcall RegisterHook( DWORD script, DWORD id, DWORD procNum )
|
||||
}
|
||||
sScriptProgram *prog = GetGlobalScriptProgram(script);
|
||||
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;
|
||||
hook.prog = *prog;
|
||||
hook.callback = procNum;
|
||||
@@ -1096,35 +1096,50 @@ void _stdcall RegisterHook( DWORD script, DWORD id, DWORD procNum )
|
||||
hooks[id].push_back(hook);
|
||||
}
|
||||
}
|
||||
#define LoadHookScript(a,b) _LoadHookScript("data\\scripts\\hs_" a ".int", b)
|
||||
static void _LoadHookScript(const char* path, int id) {
|
||||
if(id>=numHooks) return;
|
||||
WIN32_FIND_DATA file;
|
||||
HANDLE h;
|
||||
|
||||
h = FindFirstFileA(path, &file);
|
||||
if(h != INVALID_HANDLE_VALUE) {
|
||||
static void LoadHookScript(const char* name, int id) {
|
||||
if (id >= numHooks) return;
|
||||
|
||||
char filename[MAX_PATH];
|
||||
sprintf(filename, "scripts\\%s.int", name);
|
||||
bool fileExist;
|
||||
__asm {
|
||||
lea eax, filename
|
||||
call db_access_
|
||||
mov fileExist, al
|
||||
}
|
||||
|
||||
if (fileExist && !isGameScript(name)) {
|
||||
sScriptProgram prog;
|
||||
dlog("Loading hook script: ", DL_HOOK);
|
||||
dlogr(path, DL_HOOK);
|
||||
char* fName = file.cFileName;
|
||||
fName[strlen(fName) - 4] = 0;
|
||||
LoadScriptProgram(prog, fName);
|
||||
FindClose(h);
|
||||
dlog(">", DL_HOOK);
|
||||
dlog(name, DL_HOOK);
|
||||
LoadScriptProgram(prog, name);
|
||||
if (prog.ptr) {
|
||||
dlogr(" Done", DL_HOOK);
|
||||
sHookScript hook;
|
||||
hook.prog = prog;
|
||||
hook.callback = -1;
|
||||
hook.isGlobalScript = false;
|
||||
hooks[id].push_back(hook);
|
||||
AddProgramToMap(prog);
|
||||
}
|
||||
} else dlogr(" Error!", DL_HOOK);
|
||||
}
|
||||
}
|
||||
static void HookScriptInit2() {
|
||||
dlogr("Initing hook scripts", DL_HOOK|DL_INIT);
|
||||
|
||||
LoadHookScript("tohit", HOOK_TOHIT);
|
||||
static void HookScriptInit2() {
|
||||
dlogr("Loading hook scripts", DL_HOOK|DL_INIT);
|
||||
|
||||
char* mask = "scripts\\hs_*.int";
|
||||
DWORD *filenames;
|
||||
__asm {
|
||||
xor ecx, ecx
|
||||
xor ebx, ebx
|
||||
lea edx, filenames
|
||||
mov eax, mask
|
||||
call db_get_file_list_
|
||||
}
|
||||
|
||||
LoadHookScript("hs_tohit", HOOK_TOHIT);
|
||||
HookCall(0x421686, &ToHitHook);
|
||||
HookCall(0x4231D9, &ToHitHook);
|
||||
HookCall(0x42331F, &ToHitHook);
|
||||
@@ -1134,10 +1149,10 @@ static void HookScriptInit2() {
|
||||
HookCall(0x42439C, &ToHitHook);
|
||||
HookCall(0x42679A, &ToHitHook);
|
||||
|
||||
LoadHookScript("afterhitroll", HOOK_AFTERHITROLL);
|
||||
LoadHookScript("hs_afterhitroll", HOOK_AFTERHITROLL);
|
||||
MakeCall(0x423893, &AfterHitRollHook, true);
|
||||
|
||||
LoadHookScript("calcapcost", HOOK_CALCAPCOST);
|
||||
LoadHookScript("hs_calcapcost", HOOK_CALCAPCOST);
|
||||
HookCall(0x42307A, &CalcApCostHook);
|
||||
HookCall(0x42669F, &CalcApCostHook);
|
||||
HookCall(0x42687B, &CalcApCostHook);
|
||||
@@ -1150,14 +1165,14 @@ static void HookScriptInit2() {
|
||||
HookCall(0x47807B, &CalcApCostHook);
|
||||
MakeCall(0x478083, &CalcApCostHook2, false);
|
||||
|
||||
LoadHookScript("deathanim1", HOOK_DEATHANIM1);
|
||||
LoadHookScript("deathanim2", HOOK_DEATHANIM2);
|
||||
LoadHookScript("hs_deathanim1", HOOK_DEATHANIM1);
|
||||
LoadHookScript("hs_deathanim2", HOOK_DEATHANIM2);
|
||||
HookCall(0x4109DE, &CalcDeathAnimHook);
|
||||
HookCall(0x410981, &CalcDeathAnimHook2);
|
||||
HookCall(0x4109A1, &CalcDeathAnimHook2);
|
||||
HookCall(0x4109BF, &CalcDeathAnimHook2);
|
||||
|
||||
LoadHookScript("combatdamage", HOOK_COMBATDAMAGE);
|
||||
LoadHookScript("hs_combatdamage", HOOK_COMBATDAMAGE);
|
||||
HookCall(0x42326C, &CombatDamageHook); // check_ranged_miss()
|
||||
HookCall(0x4233E3, &CombatDamageHook); // shoot_along_path() - for extra burst targets
|
||||
HookCall(0x423AB7, &CombatDamageHook); // compute_attack()
|
||||
@@ -1167,7 +1182,7 @@ static void HookScriptInit2() {
|
||||
HookCall(0x424220, &CombatDamageHook); // attack_crit_failure()
|
||||
HookCall(0x4242FB, &CombatDamageHook); // attack_crit_failure()
|
||||
|
||||
LoadHookScript("ondeath", HOOK_ONDEATH);
|
||||
LoadHookScript("hs_ondeath", HOOK_ONDEATH);
|
||||
HookCall(0x4130CC, &OnDeathHook);
|
||||
HookCall(0x4130EF, &OnDeathHook);
|
||||
HookCall(0x413603, &OnDeathHook);
|
||||
@@ -1180,10 +1195,10 @@ static void HookScriptInit2() {
|
||||
HookCall(0x4C14F9, &OnDeathHook);
|
||||
HookCall(0x425161, &OnDeathHook2);
|
||||
|
||||
LoadHookScript("findtarget", HOOK_FINDTARGET);
|
||||
LoadHookScript("hs_findtarget", HOOK_FINDTARGET);
|
||||
HookCall(0x429143, &FindTargetHook);
|
||||
|
||||
LoadHookScript("useobjon", HOOK_USEOBJON);
|
||||
LoadHookScript("hs_useobjon", HOOK_USEOBJON);
|
||||
HookCall(0x49C606, &UseObjOnHook);
|
||||
HookCall(0x473619, &UseObjOnHook);
|
||||
// the following hooks allows to catch drug use of AI and from action cursor
|
||||
@@ -1192,22 +1207,22 @@ static void HookScriptInit2() {
|
||||
HookCall(0x4287F8, &UseObjOnHook_item_d_take_drug); // ai_check_drugs
|
||||
HookCall(0x473573, &UseObjOnHook_item_d_take_drug); // inven_action_cursor
|
||||
|
||||
LoadHookScript("removeinvenobj", HOOK_REMOVEINVENOBJ);
|
||||
LoadHookScript("hs_removeinvenobj", HOOK_REMOVEINVENOBJ);
|
||||
MakeCall(0x477490, &RemoveObjHook, true);
|
||||
|
||||
LoadHookScript("barterprice", HOOK_BARTERPRICE);
|
||||
LoadHookScript("hs_barterprice", HOOK_BARTERPRICE);
|
||||
HookCall(0x474D4C, &BarterPriceHook);
|
||||
HookCall(0x475735, &BarterPriceHook);
|
||||
HookCall(0x475762, &BarterPriceHook);
|
||||
|
||||
LoadHookScript("movecost", HOOK_MOVECOST);
|
||||
LoadHookScript("hs_movecost", HOOK_MOVECOST);
|
||||
HookCall(0x417665, &MoveCostHook);
|
||||
HookCall(0x44B88A, &MoveCostHook);
|
||||
|
||||
LoadHookScript("hexmoveblocking", HOOK_HEXMOVEBLOCKING);
|
||||
LoadHookScript("hexaiblocking", HOOK_HEXAIBLOCKING);
|
||||
LoadHookScript("hexshootblocking", HOOK_HEXSHOOTBLOCKING);
|
||||
LoadHookScript("hexsightblocking", HOOK_HEXSIGHTBLOCKING);
|
||||
LoadHookScript("hs_hexmoveblocking", HOOK_HEXMOVEBLOCKING);
|
||||
LoadHookScript("hs_hexaiblocking", HOOK_HEXAIBLOCKING);
|
||||
LoadHookScript("hs_hexshootblocking", HOOK_HEXSHOOTBLOCKING);
|
||||
LoadHookScript("hs_hexsightblocking", HOOK_HEXSIGHTBLOCKING);
|
||||
SafeWrite32(0x413979, (DWORD)&HexSightBlockingHook);
|
||||
SafeWrite32(0x4C1A88, (DWORD)&HexShootBlockingHook);
|
||||
SafeWrite32(0x423178, (DWORD)&HexShootBlockingHook);
|
||||
@@ -1218,29 +1233,29 @@ static void HookScriptInit2() {
|
||||
SafeWrite32(0x42A0A4, (DWORD)&HexABlockingHook);
|
||||
MakeCall(0x48B848, &HexMBlockingHook, true);
|
||||
|
||||
LoadHookScript("itemdamage", HOOK_ITEMDAMAGE);
|
||||
LoadHookScript("hs_itemdamage", HOOK_ITEMDAMAGE);
|
||||
HookCall(0x478560, &ItemDamageHook);
|
||||
|
||||
LoadHookScript("ammocost", HOOK_AMMOCOST);
|
||||
LoadHookScript("hs_ammocost", HOOK_AMMOCOST);
|
||||
HookCall(0x423A7C, &AmmoCostHook);
|
||||
|
||||
LoadHookScript("useobj", HOOK_USEOBJ);
|
||||
LoadHookScript("hs_useobj", HOOK_USEOBJ);
|
||||
HookCall(0x42AEBF, &UseObjHook);
|
||||
HookCall(0x473607, &UseObjHook);
|
||||
HookCall(0x49C12E, &UseObjHook);
|
||||
|
||||
LoadHookScript("keypress", HOOK_KEYPRESS);
|
||||
LoadHookScript("mouseclick", HOOK_MOUSECLICK);
|
||||
LoadHookScript("hs_keypress", HOOK_KEYPRESS);
|
||||
LoadHookScript("hs_mouseclick", HOOK_MOUSECLICK);
|
||||
|
||||
LoadHookScript("useskill", HOOK_USESKILL);
|
||||
LoadHookScript("hs_useskill", HOOK_USESKILL);
|
||||
HookCall(0x49C48F, &UseSkillHook);
|
||||
HookCall(0x49D12E, &UseSkillHook);
|
||||
|
||||
LoadHookScript("steal", HOOK_STEAL);
|
||||
LoadHookScript("hs_steal", HOOK_STEAL);
|
||||
HookCall(0x4749A2, &StealCheckHook);
|
||||
HookCall(0x474A69, &StealCheckHook);
|
||||
|
||||
LoadHookScript("withinperception", HOOK_WITHINPERCEPTION);
|
||||
LoadHookScript("hs_withinperception", HOOK_WITHINPERCEPTION);
|
||||
HookCall(0x429157, &PerceptionRangeHook);
|
||||
HookCall(0x42B4ED, &PerceptionRangeHook);
|
||||
HookCall(0x42BC87, &PerceptionRangeHook);
|
||||
@@ -1249,7 +1264,7 @@ static void HookScriptInit2() {
|
||||
MakeCall(0x456BA2, &PerceptionRangeBonusHack, true);
|
||||
HookCall(0x458403, &PerceptionRangeHook);
|
||||
|
||||
LoadHookScript("inventorymove", HOOK_INVENTORYMOVE);
|
||||
LoadHookScript("hs_inventorymove", HOOK_INVENTORYMOVE);
|
||||
HookCall(0x4712E3, &SwitchHandHook); // left slot
|
||||
HookCall(0x47136D, &SwitchHandHook); // right slot
|
||||
MakeCall(0x4713A3, &UseArmorHack, true);
|
||||
@@ -1260,7 +1275,7 @@ static void HookScriptInit2() {
|
||||
//HookCall(0x471351, &DropAmmoIntoWeaponHook);
|
||||
MakeCall(0x476588, &DropAmmoIntoWeaponHack, true);
|
||||
|
||||
LoadHookScript("invenwield", HOOK_INVENWIELD);
|
||||
LoadHookScript("hs_invenwield", HOOK_INVENWIELD);
|
||||
HookCall(0x47275E, &invenWieldFunc_Hook);
|
||||
HookCall(0x495FDF, &invenWieldFunc_Hook);
|
||||
HookCall(0x45967D, &invenUnwieldFunc_Hook);
|
||||
@@ -1269,8 +1284,13 @@ static void HookScriptInit2() {
|
||||
HookCall(0x45680C, &correctFidForRemovedItem_Hook);
|
||||
HookCall(0x45C4EA, &correctFidForRemovedItem_Hook);
|
||||
|
||||
dlogr("Completed hook script init", DL_HOOK|DL_INIT);
|
||||
__asm {
|
||||
xor edx, edx
|
||||
lea eax, filenames
|
||||
call db_free_file_list_
|
||||
}
|
||||
|
||||
dlogr("Finished loading hook scripts", DL_HOOK|DL_INIT);
|
||||
}
|
||||
|
||||
void HookScriptClear() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user