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
Added grey outline to controlled critters at the beginning of the turn.
This commit is contained in:
Binary file not shown.
@@ -36,9 +36,9 @@ procedure combatturn_handler begin
|
||||
variable
|
||||
status := get_sfall_arg,
|
||||
critter := get_sfall_arg,
|
||||
pid, perkID, level, i;
|
||||
pid, perkID, level;
|
||||
|
||||
//display_msg("Combat Turn: " + status + ", by " + obj_name(critter) + ", arg3: " + get_sfall_arg);
|
||||
//display_msg("Combat Turn: " + status + ", by " + obj_name(critter) + "/" + critter + ", arg3: " + get_sfall_arg);
|
||||
if npcControl then begin
|
||||
if lightInt then lightInt := round((lightInt / 65536.0) * 100); // calc percent of intensity
|
||||
obj_set_light_level(npcControl, lightInt, lightDist); // restore light for prev. controlled NPC
|
||||
@@ -55,9 +55,7 @@ procedure combatturn_handler begin
|
||||
foreach (perkID in perksList) begin
|
||||
level := has_trait(TRAIT_PERK, real_dude_obj, perkID);
|
||||
if (level) then begin
|
||||
for (i := 0; i < level; i++) begin
|
||||
critter_add_trait(critter, TRAIT_PERK, perkID, 1);
|
||||
end
|
||||
critter_add_trait(critter, TRAIT_PERK, perkID, level);
|
||||
end
|
||||
end
|
||||
intface_redraw;
|
||||
@@ -70,6 +68,8 @@ procedure combatturn_handler begin
|
||||
npcControl := 0; // dude control
|
||||
end
|
||||
if inControl then begin
|
||||
// check preference setting _combat_highlight
|
||||
if (read_byte(0x56D38C)) then set_outline(critter, OUTLINE_GREY);
|
||||
// center the screen on the controlled critter/dude and remove roof tiles
|
||||
move_to(dude_obj, dude_tile, dude_elevation);
|
||||
if (displayName and critter != real_dude_obj) then begin
|
||||
|
||||
@@ -270,6 +270,7 @@
|
||||
#define get_flags(obj) sfall_func1("get_flags", obj)
|
||||
#define get_ini_section(file, sect) sfall_func2("get_ini_section", file, sect)
|
||||
#define get_ini_sections(file) sfall_func1("get_ini_sections", file)
|
||||
#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_ai_data(obj, aiParam) sfall_func2("get_object_ai_data", obj, aiParam)
|
||||
|
||||
@@ -630,6 +630,9 @@ optional argument:
|
||||
> 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 -------
|
||||
------------------------
|
||||
|
||||
@@ -146,6 +146,7 @@ static void ReconstructBarBoxes(int count) {
|
||||
}
|
||||
}
|
||||
|
||||
//static BYTE restoreData[] = {0x31, 0xD2, 0x89, 0x94, 0x24}; // xor edx, edx; mov...
|
||||
static void ResetBoxes() {
|
||||
for (int i = 0; i < actualBoxCount; i++) {
|
||||
boxText[i].isActive = false;
|
||||
@@ -158,8 +159,7 @@ static void ResetBoxes() {
|
||||
setBoxIndex = 5; // set start
|
||||
//SafeWrite32(0x461343, 0x00023D05); // call getmsg_
|
||||
ReconstructBarBoxes(totalBoxCount);
|
||||
//SafeWrite8(0x461243, 0x31);
|
||||
//SafeWrite32(0x461244, 0x249489D2);
|
||||
//SafeWriteBytes(0x461243, restoreData, 5);
|
||||
}
|
||||
|
||||
void BarBoxes::SetText(int box, const char* text, DWORD color) {
|
||||
@@ -258,7 +258,6 @@ static void __declspec(naked) refresh_box_bar_win_hack() {
|
||||
}
|
||||
|
||||
void BarBoxes::init() {
|
||||
|
||||
initCount += GetConfigInt("Misc", "BoxBarCount", 5);
|
||||
if (initCount < 5) initCount = 5; // exclude the influence of negative values from the config
|
||||
if (initCount > 100) initCount = 100;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "Module.h"
|
||||
|
||||
namespace sfall
|
||||
|
||||
@@ -115,11 +115,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'
|
||||
|
||||
@@ -686,16 +686,15 @@ inline static void ApplyInvenApCostPatch() {
|
||||
onlyOnceAP = true;
|
||||
}
|
||||
|
||||
void _stdcall SetInvenApCost(int cost) {
|
||||
void __fastcall Inventory::SetInvenApCost(int cost) {
|
||||
invenApCost = cost;
|
||||
if (!onlyOnceAP) ApplyInvenApCostPatch();
|
||||
}
|
||||
|
||||
// TODO: Make GetInvenApCost() function
|
||||
/*long GetInvenApCost() {
|
||||
long plevel = fo::func::perk_level(fo::var::obj_dude, fo::PERK_quick_pockets);
|
||||
return invenApCost - (invenApQPReduction * plevel);
|
||||
}*/
|
||||
long Inventory::GetInvenApCost() {
|
||||
long perkLevel = fo::func::perk_level(fo::var::obj_dude, fo::PERK_quick_pockets);
|
||||
return invenApCost - (invenApQPReduction * perkLevel);
|
||||
}
|
||||
|
||||
void InventoryReset() {
|
||||
invenApCost = invenApCostDef;
|
||||
|
||||
@@ -33,9 +33,11 @@ public:
|
||||
static Delegate<DWORD>& OnAdjustFid();
|
||||
|
||||
static DWORD __stdcall adjust_fid_replacement();
|
||||
|
||||
static long GetInvenApCost();
|
||||
static void __fastcall SetInvenApCost(int cost);
|
||||
};
|
||||
|
||||
void _stdcall SetInvenApCost(int cost);
|
||||
DWORD __stdcall sf_item_total_size(fo::GameObject* critter);
|
||||
|
||||
}
|
||||
|
||||
@@ -200,8 +200,8 @@ void sf_add_iface_tag(OpcodeContext &ctx) {
|
||||
void sf_show_iface_tag(OpcodeContext &ctx) {
|
||||
int tag = ctx.arg(0).asInt();
|
||||
if (tag == 3 || tag == 4) {
|
||||
_asm mov eax, tag;
|
||||
_asm call fo::funcoffs::pc_flag_on_;
|
||||
__asm mov eax, tag;
|
||||
__asm call fo::funcoffs::pc_flag_on_;
|
||||
} else {
|
||||
BarBoxes::AddBox(tag);
|
||||
}
|
||||
@@ -210,8 +210,8 @@ void sf_show_iface_tag(OpcodeContext &ctx) {
|
||||
void sf_hide_iface_tag(OpcodeContext &ctx) {
|
||||
int tag = ctx.arg(0).asInt();
|
||||
if (tag == 3 || tag == 4) {
|
||||
_asm mov eax, tag;
|
||||
_asm call fo::funcoffs::pc_flag_off_;
|
||||
__asm mov eax, tag;
|
||||
__asm call fo::funcoffs::pc_flag_off_;
|
||||
} else {
|
||||
BarBoxes::RemoveBox(tag);
|
||||
}
|
||||
@@ -272,7 +272,7 @@ void sf_get_cursor_mode(OpcodeContext& ctx) {
|
||||
int cursorMode;
|
||||
__asm {
|
||||
call fo::funcoffs::gmouse_3d_get_mode_;
|
||||
mov cursorMode, eax;
|
||||
mov cursorMode, eax;
|
||||
}
|
||||
ctx.setReturn(cursorMode);
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ static const SfallMetarule metarules[] = {
|
||||
{"get_flags", sf_get_flags, 1, 1, {ARG_OBJECT}},
|
||||
{"get_ini_section", sf_get_ini_section, 2, 2, {ARG_STRING, ARG_STRING}},
|
||||
{"get_ini_sections", sf_get_ini_sections, 1, 1, {ARG_STRING}},
|
||||
{"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_ai_data", sf_get_object_ai_data, 2, 2, {ARG_OBJECT, ARG_INT}},
|
||||
|
||||
@@ -1113,14 +1113,18 @@ void __declspec(naked) op_set_inven_ap_cost() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG_INT(end);
|
||||
push eax;
|
||||
call SetInvenApCost;
|
||||
mov ecx, eax;
|
||||
call Inventory::SetInvenApCost;
|
||||
end:
|
||||
pop ecx;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
void sf_get_inven_ap_cost(OpcodeContext& ctx) {
|
||||
ctx.setReturn(Inventory::GetInvenApCost());
|
||||
}
|
||||
|
||||
void sf_attack_is_aimed(OpcodeContext& ctx) {
|
||||
DWORD isAimed, unused;
|
||||
ctx.setReturn(!fo::func::intface_get_attack(&unused, &isAimed) ? isAimed : 0);
|
||||
|
||||
@@ -137,6 +137,8 @@ void __declspec() op_gdialog_get_barter_mod();
|
||||
|
||||
void __declspec() op_set_inven_ap_cost();
|
||||
|
||||
void sf_get_inven_ap_cost(OpcodeContext&);
|
||||
|
||||
void sf_attack_is_aimed(OpcodeContext&);
|
||||
|
||||
void sf_sneak_success(OpcodeContext&);
|
||||
|
||||
Reference in New Issue
Block a user