Skip to content

Commit

Permalink
Car rebalance: make configurable and add toggle to installer
Browse files Browse the repository at this point in the history
  • Loading branch information
phobos2077 committed May 20, 2024
1 parent 6df31cf commit 64c6bdf
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 7 deletions.
2 changes: 1 addition & 1 deletion extra/compile_all.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ exit /b
:RunCompile
cd /d "%~dp1"
rem "%compile%" -l -O2 -p -s -q -n "%%~nxi" -o "%output%/%%~ni.int"
call compile_gcc "%~nx1" -o "%output%/%~n1.int"
call compile_wcc "%~nx1" -o "%output%/%~n1.int"
set compileErr=%errorlevel%
if %compileErr% geq 1 (
set /a ne+=1 >nul
Expand Down
4 changes: 4 additions & 0 deletions extra/installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ en.CRemoveBonusRoF=Remove Bonus Rate of Fire perk
en.CThrowingMeleeDmg=Apply Melee Damage stat to Throwing weapons
en.CStimpakRadiation=Stimpaks slightly irradiate on use
en.CStimpakSkillScaling=Stimpaks & Healing Powders heal amount scales with First Aid skill
en.CCarTravelTweaks=Car Travel changes (25% slower)

en.WFalloutNotFound=Fallout not detected in selected directory (fallout2.exe), mod won't work. Install anyway?
en.WRPNotFound=Restoration Project not detected in selected directory! This mod is only compatible with RPU 2.6 or above. Are you sure you want to continue?
Expand All @@ -90,6 +91,7 @@ ru.CRemoveBonusRoF=Удалить перк "Бонус скорострельн
ru.CThrowingMeleeDmg=Применять урон ближнего боя к метательному оружию
ru.CStimpakRadiation=Стимпаки слегка облучают при применении
ru.CStimpakSkillScaling=Эффективность стимпаков и лечебных порошков зависит от навыка первой помощи
ru.CCarTravelTweaks=Изменения параметров автомобиля (25% медленнее)
ru.WFalloutNotFound=По указанному пути не найдена установленная игра (fallout2.exe), мод не будет работать! Все равно установить?
ru.WRPNotFound=Restoration Project не обнаружен в указанной папке! Данный мод совместим только с RPU 2.6. Все равно продолжить?
Expand All @@ -111,6 +113,7 @@ Name: "remove_bonus_rof"; Description: "{cm:CRemoveBonusRoF}"; Types: full
Name: "throwing_melee_dmg"; Description: "{cm:CThrowingMeleeDmg}"; Types: full
Name: "stimpak_skill_scaling"; Description: "{cm:CStimpakSkillScaling}"; Types: full
Name: "stimpak_radiation"; Description: "{cm:CStimpakRadiation}"; Types: full
Name: "car_travel_tweaks"; Description: "{cm:CCarTravelTweaks}"; Types: full
[InstallDelete]
Type: files; Name: "{app}\data\worldmap.dat"
Expand Down Expand Up @@ -156,6 +159,7 @@ Filename: "{app}\mods\ecco\combat.ini"; Section: "APCOST"; Key: "carry_unspent_a
Filename: "{app}\mods\ecco\combat.ini"; Section: "THROWING"; Key: "apply_melee_dmg"; String: "0"; Components: not throwing_melee_dmg
Filename: "{app}\mods\ecco\misc.ini"; Section: "ITEM_TWEAKS"; Key: "stimpak_radiation_disable"; String: "1"; Components: not stimpak_radiation
Filename: "{app}\mods\ecco\misc.ini"; Section: "FIRST_AID"; Key: "ini_healing_skill_max"; String: "0"; Components: not stimpak_skill_scaling
Filename: "{app}\mods\ecco\misc.ini"; Section: "CAR_TRAVEL"; Key: "enable_tweaks"; String: "0"; Components: not car_travel_tweaks
Filename: "{app}\sfall\perks.ini"; Section: "5"; Key: "Level"; String: "15"; Components: not remove_bonus_rof
Expand Down
13 changes: 13 additions & 0 deletions root/mods/ecco/misc.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ healing_mult_max=2.0
healing_skill_max=150


[CAR_TRAVEL]
; 1 to enable or 0 to disable all car tweaks
enable_tweaks=1
; Car speed multiplier, applied after all vanilla speed upgrades (actual speed is determined by number of steps skipped each "turn" on worldmap)
; Set to 1.0 for vanilla speed. Range [0.25; 3]
speed_mult=0.75
; Base fuel consumption, vanilla is 100. Range [0; 1000]
fuel_consumption_base=75
; Fuel Cell regulator fuel consumption reduction percentage. 100 means no comsumption, 50 - vanilla value, 0 - no effect on consumption. Range [0; 100]
fuel_cell_regulator_percent=30



[TOWN_REP]
0=47 ; ARROYO
2=48 ; KLAMATH
Expand Down
1 change: 1 addition & 0 deletions scripts_src/_pbs_headers/ecco_ini.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef ECCO_INI_H
#define ECCO_INI_H

#include "../sfall/lib.math.h"
#include "../sfall/lib.strings.h"

#define INI_SFALL "ddraw.ini"
Expand Down
31 changes: 25 additions & 6 deletions scripts_src/_pbs_main/gl_pbs_car_rebalance.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@
#include "../sfall/sfall.h"
#include "../headers/global.h"

#include "../_pbs_headers/ecco_ini.h"

#define GAS_TANK_CAPACITY (80000)

variable step_remainder;
#define INI_FILE INI_MISC
#define INI_SECTION "CAR_TRAVEL"

variable
ini_enable_tweaks,
ini_speed_mult,
ini_fuel_consumption_base,
ini_fuel_cell_regulator_percent,
step_remainder;

/*
Runs continuously during worldmap travel on car.
Expand Down Expand Up @@ -40,15 +50,15 @@ procedure cartravel_hook begin
if (global_var(GVAR_CAR_UPGRADE_FUEL_CELL_REGULATOR)) then fuel /= 2;
*/

steps := (origSteps + 1) * 0.75 - 1; // +1 accounts for 1 unskippable step
steps := (origSteps + 1) * ini_speed_mult - 1; // +1 accounts for 1 unskippable step
step_remainder += steps - floor(steps);
steps := floor(steps) + floor(step_remainder);
step_remainder -= floor(step_remainder);

fuel := 75;
fuel := ini_fuel_consumption_base;
if (global_var(GVAR_NEW_RENO_SUPER_CAR)) then fuel -= fuel * 80 / 100;
//if (global_var(GVAR_NEW_RENO_CAR_UPGRADE)) then fuel -= fuel * 10 / 100;
if (global_var(GVAR_CAR_UPGRADE_FUEL_CELL_REGULATOR)) then fuel -= fuel * 30 / 100;
if (global_var(GVAR_CAR_UPGRADE_FUEL_CELL_REGULATOR)) then fuel -= fuel * ini_fuel_cell_regulator_percent / 100;

//debug_msg(string_format("car orig: %d, %d, calc: %d, %d", origSteps, origFuel, steps, fuel));
set_sfall_return(steps);
Expand All @@ -62,6 +72,15 @@ procedure enc_hook begin
end*/

procedure start begin
register_hook_proc(HOOK_CARTRAVEL, cartravel_hook);
//register_hook_proc(HOOK_ENCOUNTER, cartravel_hook);
if (game_loaded) then begin
int_from_ini_file(enable_tweaks, INI_FILE, INI_SECTION);
if (not ini_enable_tweaks) then return;

float_from_ini_file_clamped(speed_mult, INI_FILE, INI_SECTION, 0.25, 3);
int_from_ini_file_clamped(fuel_consumption_base, INI_FILE, INI_SECTION, 0, 1000);
int_from_ini_file_clamped(fuel_cell_regulator_percent, INI_FILE, INI_SECTION, 0, 100);

register_hook_proc(HOOK_CARTRAVEL, cartravel_hook);
//register_hook_proc(HOOK_ENCOUNTER, cartravel_hook);
end
end

0 comments on commit 64c6bdf

Please sign in to comment.