Fixed inconsistent behavior of motion sensor flag 2; now motion sensor truly does not require any charges to work.

This commit is contained in:
NovaRain
2017-03-14 22:56:19 +08:00
parent eb4998ced6
commit 158234438b
2 changed files with 14 additions and 7 deletions
+7 -6
View File
@@ -1745,19 +1745,20 @@ static void RunGlobalScripts1() {
//0x48C294 to toggle
if (KeyDown(toggleHighlightsKey)) {
if (!highlightingToggled) {
if (MotionSensorMode&4) {
if (MotionSensorMode & 4) {
DWORD scanner;
__asm {
mov eax, ds:[_obj_dude];
mov edx, PID_MOTION_SENSOR
call inven_pid_is_carried_ptr_
mov edx, PID_MOTION_SENSOR;
call inven_pid_is_carried_ptr_;
mov scanner, eax;
}
if (scanner) {
if (MotionSensorMode&2) {
if (!(MotionSensorMode & 2)) {
__asm {
mov eax, scanner;
call item_m_dec_charges_ //Returns -1 if the item has no charges
call item_m_dec_charges_; //Returns -1 if the item has no charges
call intface_redraw_;
inc eax;
mov highlightingToggled, eax;
}
@@ -1770,7 +1771,7 @@ static void RunGlobalScripts1() {
if (highlightingToggled) obj_outline_all_items_on();
else highlightingToggled = 2;
}
} else if(highlightingToggled) {
} else if (highlightingToggled) {
if (highlightingToggled == 1) obj_outline_all_items_off();
highlightingToggled = 0;
}
+7 -1
View File
@@ -1447,7 +1447,13 @@ static void DllMain2() {
if (tmp = GetPrivateProfileIntA("Misc", "MotionScannerFlags", 1, ini)) {
dlog("Applying MotionScannerFlags patch.", DL_INIT);
if (tmp & 1) MakeCall(0x41BBE9, &ScannerAutomapHook, true);
if (tmp & 2) BlockCall(0x41BC3C);
if (tmp & 2) {
// automap_
SafeWrite16(0x41BC24, 0x9090);
BlockCall(0x41BC3C);
// item_m_use_charged_item_
SafeWrite8(0x4794B3, 0x5E); // jbe short 0x479512
}
dlogr(" Done", DL_INIT);
}