Updated script mods.

This commit is contained in:
NovaRain
2019-11-03 10:05:55 +08:00
parent d0c4bc3b78
commit f3abea3462
9 changed files with 30 additions and 28 deletions
Binary file not shown.
@@ -45,6 +45,7 @@ procedure start begin
tap_key(DIK_A);
tap_key(DIK_CAPITAL);
end else if (mode bwand BARTER) then begin
play_sfx("IB2P1XX1");
tap_key(DIK_M);
end
end
Binary file not shown.
Binary file not shown.
Binary file not shown.
+4 -2
View File
@@ -2,10 +2,12 @@
#include "..\scripting\headers\sfall.h"
#include "..\scripting\headers\define_lite.h"
#include "..\scripting\headers\define_extra.h"
#include "..\scripting\headers\dik.h"
/*
#include "..\scripting\headers\lib.arrays.h"
#include "..\scripting\headers\lib.strings.h"
// #include "..\scripting\headers\lib.inven.h"
#include "..\scripting\headers\lib.inven.h"
*/
variable ini := "sfall-mods.ini";
variable translationIni;
+1 -1
View File
@@ -60,7 +60,7 @@ static void ModifyAllStats(const itProtoMem&);
struct StatModify {
long objID;
long objPID; // used for additional verification
long stat;
long stat; // range from base_stat_srength to bonus_dr_poison
long amount; // current value of the stat
long defVal; // value of the stat before the change
long* s_proto; // shared pointer for quick access to the prototype in memory (should not be saved to file)
+23 -24
View File
@@ -86,7 +86,7 @@ next:
test al, al;
jz skiplight;
mov eax, [esp + 40]; // projectile ptr - 1st arg
mov edx, 0xFFFF0008; // maximum radius + intensity (see anim_set_check__light_fix)
mov edx, 0xFFFF0008; // maximum radius + intensity (see anim_set_check_light_fix)
xor ebx, ebx;
call fo::funcoffs::register_object_light_;
skiplight:
@@ -105,7 +105,7 @@ static void __declspec(naked) explosion_lighting_fix2() {
call fo::funcoffs::register_object_funset_;
mov eax, [esp + 24]; // explosion obj ptr
mov edx, 0xFFFF0008; // maximum radius + intensity (see anim_set_check__light_fix)
mov edx, 0xFFFF0008; // maximum radius + intensity (see anim_set_check_light_fix)
xor ebx, ebx;
call fo::funcoffs::register_object_light_;
@@ -117,13 +117,13 @@ static void __declspec(naked) explosion_lighting_fix2() {
}
}
DWORD _stdcall LogThis(DWORD value1, DWORD value2, DWORD value3) {
dlog_f("anim_set_check__light_fix: object 0x%X, something 0x%X, radius 0x%X", DL_MAIN, value1, value2, value3);
return value1;
}
//DWORD _stdcall LogThis(DWORD value1, DWORD value2, DWORD value3) {
// dlog_f("anim_set_check_light_fix: object 0x%X, something 0x%X, radius 0x%X", DL_MAIN, value1, value2, value3);
// return value1;
//}
static const DWORD anim_set_check__light_back = 0x415A4C;
static void __declspec(naked) anim_set_check__light_fix() {
static const DWORD anim_set_check_light_back = 0x415A4C;
static void __declspec(naked) anim_set_check_light_fix() {
__asm {
mov eax, [esi + 4]; // object
lea ecx, [esp + 16]; // unknown.. something related to next "tile_refresh_rect" call?
@@ -139,7 +139,7 @@ static void __declspec(naked) anim_set_check__light_fix() {
nothingspecial:
mov ebx, [eax + 112]; // object current light intensity (original behavior)
end:
jmp anim_set_check__light_back; // jump back right to the "obj_set_light" call
jmp anim_set_check_light_back; // jump back right to the "obj_set_light" call
}
}
@@ -150,7 +150,7 @@ static void __declspec(naked) fire_dance_lighting_fix1() {
push edx;
push ebx;
mov eax, esi; // projectile ptr - 1st arg
mov edx, 0xFFFF0002; // maximum radius + intensity (see anim_set_check__light_fix)
mov edx, 0xFFFF0002; // maximum radius + intensity (see anim_set_check_light_fix)
xor ebx, ebx;
call fo::funcoffs::register_object_light_;
mov eax, esi;
@@ -158,7 +158,7 @@ static void __declspec(naked) fire_dance_lighting_fix1() {
pop edx;
call fo::funcoffs::register_object_animate_; // overwritten call
mov eax, esi; // projectile ptr - 1st arg
mov edx, 0x00010000; // maximum radius + intensity (see anim_set_check__light_fix)
mov edx, 0x00010000; // maximum radius + intensity (see anim_set_check_light_fix)
mov ebx, -1;
call fo::funcoffs::register_object_light_;
jmp fire_dance_lighting_back; // jump back
@@ -343,15 +343,15 @@ static const size_t numArtChecks = sizeof(explosion_art_adr) / sizeof(explosion_
static const size_t numDmgChecks = sizeof(explosion_dmg_check_adr) / sizeof(explosion_dmg_check_adr[0]);
enum MetaruleExplosionsMode {
EXPL_FORCE_EXPLOSION_PATTERN = 1,
EXPL_FORCE_EXPLOSION_ART = 2,
EXPL_FORCE_EXPLOSION_RADIUS = 3,
EXPL_FORCE_EXPLOSION_DMGTYPE = 4,
EXPL_STATIC_EXPLOSION_RADIUS = 5,
EXPL_GET_EXPLOSION_DAMAGE = 6,
EXPL_FORCE_EXPLOSION_PATTERN = 1,
EXPL_FORCE_EXPLOSION_ART = 2,
EXPL_FORCE_EXPLOSION_RADIUS = 3,
EXPL_FORCE_EXPLOSION_DMGTYPE = 4,
EXPL_STATIC_EXPLOSION_RADIUS = 5,
EXPL_GET_EXPLOSION_DAMAGE = 6,
EXPL_SET_DYNAMITE_EXPLOSION_DAMAGE = 7,
EXPL_SET_PLASTIC_EXPLOSION_DAMAGE = 8,
EXPL_SET_EXPLOSION_MAX_TARGET = 9,
EXPL_SET_PLASTIC_EXPLOSION_DAMAGE = 8,
EXPL_SET_EXPLOSION_MAX_TARGET = 9,
};
static void SetExplosionRadius(int arg1, int arg2) {
@@ -471,18 +471,17 @@ void ResetExplosionSettings() {
}
void ResetExplosionRadius() {
if (set_expl_radius_grenade != 2 || set_expl_radius_rocket != 3)
SetExplosionRadius(2, 3);
if (set_expl_radius_grenade != 2 || set_expl_radius_rocket != 3) SetExplosionRadius(2, 3);
}
static void ResetExplosionDamage() {
if (!explosives.empty()) explosives.clear();
if (!explosionsDamageReset) return;
SafeWrite32(dynamite_max_dmg_addr, dynamite_maxDmg);
SafeWrite32(dynamite_min_dmg_addr, dynamite_minDmg);
SafeWrite32(plastic_max_dmg_addr, plastic_maxDmg);
SafeWrite32(dynamite_max_dmg_addr, dynamite_maxDmg);
SafeWrite32(plastic_min_dmg_addr, plastic_minDmg);
SafeWrite32(plastic_max_dmg_addr, plastic_maxDmg);
explosionsDamageReset = false;
}
@@ -494,7 +493,7 @@ void Explosions::init() {
dlog("Applying Explosion changes.", DL_INIT);
MakeJump(0x4118E1, ranged_attack_lighting_fix);
MakeJump(0x410A4A, fire_dance_lighting_fix1);
MakeJump(0x415A3F, anim_set_check__light_fix); // this allows to change light intensity
MakeJump(0x415A3F, anim_set_check_light_fix); // this allows to change light intensity
dlogr(" Done", DL_INIT);
}
+1 -1
View File
@@ -185,7 +185,7 @@ void RegisterHook(fo::Program* script, int id, int procNum, bool specReg) {
ScriptProgram *prog = GetGlobalScriptProgram(script);
if (prog) {
dlog_f("Global script %08x registered as hook ID %d\n", DL_HOOK, script, id);
dlog_f("Global script: %08x registered as hook ID %d\n", DL_HOOK, script, id);
HookScript hook;
hook.prog = *prog;
hook.callback = procNum;