mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added "get_inven_ap_cost" script function
This commit is contained in:
@@ -238,6 +238,7 @@
|
|||||||
#define get_current_inven_size(obj) sfall_func1("get_current_inven_size", obj)
|
#define get_current_inven_size(obj) sfall_func1("get_current_inven_size", obj)
|
||||||
#define get_cursor_mode sfall_func0("get_cursor_mode")
|
#define get_cursor_mode sfall_func0("get_cursor_mode")
|
||||||
#define get_flags(obj) sfall_func1("get_flags", obj)
|
#define get_flags(obj) sfall_func1("get_flags", obj)
|
||||||
|
#define get_inven_ap_cost sfall_func0("get_inven_ap_cost")
|
||||||
#define get_map_enter_position sfall_func0("get_map_enter_position")
|
#define get_map_enter_position sfall_func0("get_map_enter_position")
|
||||||
#define get_metarule_table sfall_func0("get_metarule_table")
|
#define get_metarule_table sfall_func0("get_metarule_table")
|
||||||
#define get_object_data(obj, offset) sfall_func2("get_object_data", obj, offset)
|
#define get_object_data(obj, offset) sfall_func2("get_object_data", obj, offset)
|
||||||
|
|||||||
@@ -525,6 +525,9 @@ Some utility/math functions are available:
|
|||||||
> void sfall_func1("add_trait", int traitId)
|
> void sfall_func1("add_trait", int traitId)
|
||||||
- adds the specified trait to the player
|
- adds the specified trait to the player
|
||||||
|
|
||||||
|
> int sfall_func0("get_inven_ap_cost")
|
||||||
|
- returns the current AP cost to access the inventory in combat
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
------ MORE INFO -------
|
------ MORE INFO -------
|
||||||
------------------------
|
------------------------
|
||||||
|
|||||||
+2
-2
@@ -32,11 +32,11 @@ static void __declspec(naked) intface_redraw_items_hack0() {
|
|||||||
newArt:
|
newArt:
|
||||||
mov costAP, edx;
|
mov costAP, edx;
|
||||||
cmp edx, 10;
|
cmp edx, 10;
|
||||||
jae skip;
|
je noShift;
|
||||||
|
ja skip;
|
||||||
mov edx, 10; // width
|
mov edx, 10; // width
|
||||||
retn;
|
retn;
|
||||||
skip:
|
skip:
|
||||||
je noShift; // ap == 10
|
|
||||||
sub edx, 10;
|
sub edx, 10;
|
||||||
imul edx, 5; // shift
|
imul edx, 5; // shift
|
||||||
add ebx, edx; // add width shift to 'from'
|
add ebx, edx; // add width shift to 'from'
|
||||||
|
|||||||
+5
-6
@@ -653,16 +653,15 @@ inline static void ApplyInvenApCostPatch() {
|
|||||||
onlyOnceAP = true;
|
onlyOnceAP = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _stdcall SetInvenApCost(int cost) {
|
void __fastcall SetInvenApCost(int cost) {
|
||||||
invenApCost = cost;
|
invenApCost = cost;
|
||||||
if (!onlyOnceAP) ApplyInvenApCostPatch();
|
if (!onlyOnceAP) ApplyInvenApCostPatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Make GetInvenApCost() function
|
long __stdcall GetInvenApCost() {
|
||||||
/*long GetInvenApCost() {
|
long perkLevel = PerkLevel(*ptr_obj_dude, PERK_quick_pockets);
|
||||||
long plevel = PerkLevel(*ptr_obj_dude, PERK_quick_pockets);
|
return invenApCost - (invenApQPReduction * perkLevel);
|
||||||
return invenApCost - (invenApQPReduction * plevel);
|
}
|
||||||
}*/
|
|
||||||
|
|
||||||
void InventoryReset() {
|
void InventoryReset() {
|
||||||
invenApCost = invenApCostDef;
|
invenApCost = invenApCostDef;
|
||||||
|
|||||||
+3
-1
@@ -18,8 +18,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
void _stdcall SetInvenApCost(int cost);
|
long __stdcall GetInvenApCost() ;
|
||||||
|
void __fastcall SetInvenApCost(int cost);
|
||||||
DWORD __stdcall sf_item_total_size(TGameObj* critter);
|
DWORD __stdcall sf_item_total_size(TGameObj* critter);
|
||||||
|
|
||||||
void InventoryInit();
|
void InventoryInit();
|
||||||
void InventoryReset();
|
void InventoryReset();
|
||||||
void InventoryKeyPressedHook(DWORD dxKey, bool pressed, DWORD vKey);
|
void InventoryKeyPressedHook(DWORD dxKey, bool pressed, DWORD vKey);
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ static const SfallMetarule metaruleArray[] = {
|
|||||||
{"get_current_inven_size", sf_get_current_inven_size, 1, 1},
|
{"get_current_inven_size", sf_get_current_inven_size, 1, 1},
|
||||||
{"get_cursor_mode", sf_get_cursor_mode, 0, 0},
|
{"get_cursor_mode", sf_get_cursor_mode, 0, 0},
|
||||||
{"get_flags", sf_get_flags, 1, 1},
|
{"get_flags", sf_get_flags, 1, 1},
|
||||||
|
{"get_inven_ap_cost", sf_get_inven_ap_cost, 0, 0},
|
||||||
{"get_map_enter_position", sf_get_map_enter_position, 0, 0},
|
{"get_map_enter_position", sf_get_map_enter_position, 0, 0},
|
||||||
{"get_metarule_table", sf_get_metarule_table, 0, 0},
|
{"get_metarule_table", sf_get_metarule_table, 0, 0},
|
||||||
{"get_object_data", sf_get_object_data, 2, 2},
|
{"get_object_data", sf_get_object_data, 2, 2},
|
||||||
|
|||||||
@@ -1294,7 +1294,7 @@ static void __declspec(naked) set_inven_ap_cost() {
|
|||||||
__asm {
|
__asm {
|
||||||
push ecx;
|
push ecx;
|
||||||
_GET_ARG_INT(end);
|
_GET_ARG_INT(end);
|
||||||
push eax;
|
mov ecx, eax;
|
||||||
call SetInvenApCost;
|
call SetInvenApCost;
|
||||||
end:
|
end:
|
||||||
pop ecx;
|
pop ecx;
|
||||||
@@ -1302,6 +1302,10 @@ end:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sf_get_inven_ap_cost() {
|
||||||
|
opHandler.setReturn(GetInvenApCost());
|
||||||
|
}
|
||||||
|
|
||||||
static void __declspec(naked) op_sneak_success() {
|
static void __declspec(naked) op_sneak_success() {
|
||||||
_OP_BEGIN(ebp)
|
_OP_BEGIN(ebp)
|
||||||
__asm {
|
__asm {
|
||||||
|
|||||||
Reference in New Issue
Block a user