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_cursor_mode sfall_func0("get_cursor_mode")
|
||||
#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_metarule_table sfall_func0("get_metarule_table")
|
||||
#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)
|
||||
- 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 -------
|
||||
------------------------
|
||||
|
||||
+2
-2
@@ -32,11 +32,11 @@ static void __declspec(naked) intface_redraw_items_hack0() {
|
||||
newArt:
|
||||
mov costAP, edx;
|
||||
cmp edx, 10;
|
||||
jae skip;
|
||||
je noShift;
|
||||
ja skip;
|
||||
mov edx, 10; // width
|
||||
retn;
|
||||
skip:
|
||||
je noShift; // ap == 10
|
||||
sub edx, 10;
|
||||
imul edx, 5; // shift
|
||||
add ebx, edx; // add width shift to 'from'
|
||||
|
||||
+5
-6
@@ -653,16 +653,15 @@ inline static void ApplyInvenApCostPatch() {
|
||||
onlyOnceAP = true;
|
||||
}
|
||||
|
||||
void _stdcall SetInvenApCost(int cost) {
|
||||
void __fastcall SetInvenApCost(int cost) {
|
||||
invenApCost = cost;
|
||||
if (!onlyOnceAP) ApplyInvenApCostPatch();
|
||||
}
|
||||
|
||||
// TODO: Make GetInvenApCost() function
|
||||
/*long GetInvenApCost() {
|
||||
long plevel = PerkLevel(*ptr_obj_dude, PERK_quick_pockets);
|
||||
return invenApCost - (invenApQPReduction * plevel);
|
||||
}*/
|
||||
long __stdcall GetInvenApCost() {
|
||||
long perkLevel = PerkLevel(*ptr_obj_dude, PERK_quick_pockets);
|
||||
return invenApCost - (invenApQPReduction * perkLevel);
|
||||
}
|
||||
|
||||
void InventoryReset() {
|
||||
invenApCost = invenApCostDef;
|
||||
|
||||
+3
-1
@@ -18,8 +18,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
void _stdcall SetInvenApCost(int cost);
|
||||
long __stdcall GetInvenApCost() ;
|
||||
void __fastcall SetInvenApCost(int cost);
|
||||
DWORD __stdcall sf_item_total_size(TGameObj* critter);
|
||||
|
||||
void InventoryInit();
|
||||
void InventoryReset();
|
||||
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_cursor_mode", sf_get_cursor_mode, 0, 0},
|
||||
{"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_metarule_table", sf_get_metarule_table, 0, 0},
|
||||
{"get_object_data", sf_get_object_data, 2, 2},
|
||||
|
||||
@@ -1294,7 +1294,7 @@ static void __declspec(naked) set_inven_ap_cost() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG_INT(end);
|
||||
push eax;
|
||||
mov ecx, eax;
|
||||
call SetInvenApCost;
|
||||
end:
|
||||
pop ecx;
|
||||
@@ -1302,6 +1302,10 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_get_inven_ap_cost() {
|
||||
opHandler.setReturn(GetInvenApCost());
|
||||
}
|
||||
|
||||
static void __declspec(naked) op_sneak_success() {
|
||||
_OP_BEGIN(ebp)
|
||||
__asm {
|
||||
|
||||
Reference in New Issue
Block a user