Skip to content

Commit

Permalink
Tweaked the position of the ammo bar
Browse files Browse the repository at this point in the history
Tweaked the alternative ammo bar to exactly match Mash's.
  • Loading branch information
NovaRain committed Oct 30, 2023
1 parent 47d9bb1 commit 1cca798
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sfall/HRP/InterfaceBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ static void GetAmmoMetreColors(long yPercent, BYTE &outClr1, BYTE &outClr2) {
static void __fastcall DrawAlternateAmmoMetre(long x, long y) {
fo::Window* win = fo::func::GNW_find(fo::var::interfaceWindow);

x += xOffset - 2;
x += xOffset + 1;
long startOffset = x + (25 * win->width);
BYTE* surface = win->surface + startOffset;

Expand Down Expand Up @@ -452,7 +452,7 @@ static void __fastcall DrawAlternateAmmoMetre(long x, long y) {
fo::BoundRect rect;
rect.x = x;
rect.y = 26;
rect.offx = x + 3;
rect.offx = x + 4;
rect.offy = 26 + 70;

fo::func::win_draw_rect(fo::var::interfaceWindow, (RECT*)&rect);
Expand Down
2 changes: 1 addition & 1 deletion sfall/Modules/BugFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3313,7 +3313,7 @@ void BugFixes::init() {
SafeWrite8(0x424527, CodeType::JumpShort); // in detemine_to_hit_func_()
//}

// Fixes for clickability issue in Pip-Boy and exploit that allows to rest in places where you shouldn't be able to rest
// Fixes for clickability issue in Pip-Boy and exploit that allows resting in places where you shouldn't be able to
dlogr("Applying fix for Pip-Boy clickability issues and rest exploit.", DL_FIX);
MakeCall(0x4971C7, pipboy_hack);
MakeCall(0x499530, PipAlarm_hack);
Expand Down
11 changes: 10 additions & 1 deletion sfall/Modules/Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -992,12 +992,14 @@ static void __declspec(naked) gmouse_bk_process_hook() {
}
}

static long ammoBarXPos = 461; // move ammo bar away from rivets (was 463)

static void __declspec(naked) intface_update_ammo_lights_hack() {
__asm {
mov eax, 70; // 70 - full ammo bar
cmp edx, eax;
cmovg edx, eax;
mov eax, 463; // overwritten engine code
mov eax, ammoBarXPos; // overwritten engine code
retn;
}
}
Expand Down Expand Up @@ -1100,6 +1102,13 @@ void Interface::init() {

// Fix crash when the player equips a weapon overloaded with ammo (ammo bar overflow)
MakeCall(0x45F94F, intface_update_ammo_lights_hack);
// Tweak for ammo bar position with HRP by Mash
if (HRP::Setting::ExternalEnabled()) {
ammoBarXPos = 465;
if (IniReader::GetInt("IFACE", "ALTERNATE_AMMO_METRE", 0, ".\\f2_res.ini")) {
ammoBarXPos -= 2;
}
}
}

void Interface::exit() {
Expand Down

0 comments on commit 1cca798

Please sign in to comment.