Tweaked the position of the ammo bar

Tweaked the alternative ammo bar to exactly match Mash's.
This commit is contained in:
NovaRain
2023-10-30 21:31:21 +08:00
parent 47d9bb1627
commit 1cca798b80
3 changed files with 13 additions and 4 deletions
+2 -2
View File
@@ -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;
@@ -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);
+1 -1
View File
@@ -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);
+10 -1
View File
@@ -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;
}
}
@@ -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() {