Skip to content

Commit

Permalink
Sync some components with UPU
Browse files Browse the repository at this point in the history
* Add ammo damage formula options to the installer.
* Update gl_k_walking_speed.
  • Loading branch information
NovaRain committed Aug 30, 2023
1 parent 0a01a7b commit e2edc19
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 18 deletions.
2 changes: 1 addition & 1 deletion extra/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export release_dir="$(realpath release)"
export mods_dir="$release_dir/mods"
export mpack_version=${mpack_version:-4.4}
export mpack_7z="mpack.7z"
export sfall_version=${sfall_version:-4.4}
export sfall_version=${sfall_version:-4.4.0.1}
export WINEARCH=win32
export WINEDEBUG=-all
export mod_name=rpu
Expand Down
5 changes: 5 additions & 0 deletions extra/inno/components_ammo.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Name: "ammo"; Description: "Ammo damage formula"; Types: "custom";
Name: "ammo\default"; Description: "Default"; Flags: exclusive disablenouninstallwarning;
Name: "ammo\glovz"; Description: "Glovz's"; Flags: exclusive disablenouninstallwarning;
Name: "ammo\glovz_mult"; Description: "Glovz's with damage multiplier tweak"; Flags: exclusive disablenouninstallwarning;
Name: "ammo\yaam"; Description: "YAAM"; Flags: exclusive disablenouninstallwarning;
4 changes: 4 additions & 0 deletions extra/inno/ini_ammo.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FileName: "{app}\ddraw.ini"; Section: "Misc"; Key: "DamageFormula"; String: "0"; Components: ammo\default;
FileName: "{app}\ddraw.ini"; Section: "Misc"; Key: "DamageFormula"; String: "1"; Components: ammo\glovz;
FileName: "{app}\ddraw.ini"; Section: "Misc"; Key: "DamageFormula"; String: "2"; Components: ammo\glovz_mult;
FileName: "{app}\ddraw.ini"; Section: "Misc"; Key: "DamageFormula"; String: "5"; Components: ammo\yaam;
3 changes: 3 additions & 0 deletions extra/inno/inno.iss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Source: "optional\goris_fast_derobing_low_fps.dat"; DestDir: "{#mods_dir}"; Comp
#include "ini_debug.iss"
#include "ini_sound.iss"
FileName: "{app}\mods\upu.ini"; Section: "Main"; Key: "goris_derobing_speed"; String: "0"; Components: goris\skip;
#include "ini_ammo.iss"

[Dirs]
Name: "{app}\{#backup_dir}"
Expand All @@ -58,6 +59,8 @@ Name: "goris\high_fps"; Description: "High FPS"; Flags: exclusive disablenounins
Name: "goris\low_fps"; Description: "Low FPS"; Flags: exclusive disablenouninstallwarning;
Name: "goris\skip"; Description: "Skip"; Flags: exclusive disablenouninstallwarning;

#include "components_ammo.iss"

Name: "translation"; Description: "Language"; Types: "custom"; Flags: fixed;
#include "components_translations.iss"

Expand Down
1 change: 1 addition & 0 deletions release/mods/upu.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
goris_derobing_speed=50

; Some critters (robots, various guards, etc) walk much slower than others. This speeds them up a bit. Just cosmetic.
; This setting has no effect if alternative low FPS walk speed fix is installed.
critters_walk_faster=1

; Wipe merchant inventories before restock.
Expand Down
42 changes: 25 additions & 17 deletions scripts_src/global/gl_k_walking_speed.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define set_walking_speed "critters_walk_faster"
#define fps_offset 0x4
#define frames_per_dir_count_offset 0x8
#define frame_count_offset 0x8

procedure start;
variable enabled;
Expand Down Expand Up @@ -72,24 +72,32 @@ end

procedure start begin
if game_loaded then begin
enabled := upu_msetting(set_walking_speed);
if enabled then begin
variable fs_override := check_filesystem_override;
if fs_override then begin
variable frm, frms, file, path, cur_frames_per_dir;
frms = get_slow_frms;
ndebug("initializing");
foreach frm in frms begin
path := "art\\critters\\" + frm + "b.frm";
file := fs_copy(path, path);
fs_seek(file, frames_per_dir_count_offset);
cur_frames_per_dir = fs_read_short(file);
enabled = upu_msetting(set_walking_speed);
if enabled != 0 then begin
variable fs_override = check_filesystem_override;
if not fs_override then begin
ndebug("fs override disabled, aborting");
return false;
end

variable frm, frms, file, path, cur_frame_count;
frms = get_slow_frms;
ndebug("initializing");
foreach frm in frms begin
path = "art\\critters\\" + frm + "b.frm";
file = fs_copy(path, path);
fs_seek(file, frame_count_offset);
cur_frame_count = fs_read_short(file);
if cur_frame_count > 8 then begin
fs_seek(file, fps_offset);
fs_write_short(file, cur_frames_per_dir); // 1 step per second
ndebug("set fps to " + cur_frames_per_dir + " in " + path);
fs_write_short(file, cur_frame_count); // 1 step per second
ndebug("set fps to " + cur_frame_count + " in " + path);
end else begin
ndebug("low frame count detected in " + path + ", not boosting fps");
end
ndebug("initialized");
end ndebug("fs override disabled, aborting");
end
ndebug("initialized");

end
end
end

0 comments on commit e2edc19

Please sign in to comment.