Added function car_gas_amount #90

- Sorted some defines
- Minor code formatting fixes
This commit is contained in:
phobos2077
2017-04-08 13:48:14 +07:00
parent ae3634779c
commit d484be45c8
8 changed files with 38 additions and 28 deletions
+14 -13
View File
@@ -204,20 +204,21 @@
#define party_member_list_all party_member_list(1)
#define spatial_radius(obj) sfall_func1("spatial_radius", obj)
#define car_gas_amount sfall_func0("car_gas_amount")
#define critter_inven_obj2(obj, type) sfall_func2("critter_inven_obj2", obj, type)
#define intface_redraw sfall_func0("intface_redraw")
#define intface_hide sfall_func0("intface_hide")
#define intface_show sfall_func0("intface_show")
#define intface_is_hidden sfall_func0("intface_is_hidden")
#define exec_map_update_scripts sfall_func0("exec_map_update_scripts")
#define set_outline(obj, color) sfall_func2("set_outline", obj, color)
#define get_outline(obj) sfall_func1("get_outline", obj)
#define set_flags(obj, flags) sfall_func2("set_flags", obj, flags)
#define get_flags(obj) sfall_func1("get_flags", obj)
#define tile_refresh_display sfall_func0("tile_refresh_display")
#define outlined_object sfall_func0("outlined_object")
#define get_ini_sections(file) sfall_func1("get_ini_sections", file)
#define get_flags(obj) sfall_func1("get_flags", obj)
#define get_ini_section(file, sect) sfall_func2("get_ini_section", file, sect)
#define set_dude_obj(critter) sfall_func1("set_dude_obj", critter)
#define get_ini_sections(file) sfall_func1("get_ini_sections", file)
#define get_outline(obj) sfall_func1("get_outline", obj)
#define intface_hide sfall_func0("intface_hide")
#define intface_is_hidden sfall_func0("intface_is_hidden")
#define intface_redraw sfall_func0("intface_redraw")
#define intface_show sfall_func0("intface_show")
#define outlined_object sfall_func0("outlined_object")
#define real_dude_obj sfall_func0("real_dude_obj")
#define set_dude_obj(critter) sfall_func1("set_dude_obj", critter)
#define set_flags(obj, flags) sfall_func2("set_flags", obj, flags)
#define set_outline(obj, color) sfall_func2("set_outline", obj, color)
#define spatial_radius(obj) sfall_func1("spatial_radius", obj)
#define tile_refresh_display sfall_func0("tile_refresh_display")
+2 -1
View File
@@ -17,7 +17,8 @@
#define FO_VAR_bottom_line 0x664524
#define FO_VAR_btable 0x59E944
#define FO_VAR_btncnt 0x43EA1C
#define FO_VAR_CarCurrArea 0x672E68
#define FO_VAR_carCurrentArea 0x672E68
#define FO_VAR_carGasAmount 0x672E6C
#define FO_VAR_character_points 0x518538
#define FO_VAR_cmap 0x51DF34
#define FO_VAR_colorTable 0x6A38D0
+2 -1
View File
@@ -15,7 +15,8 @@ VAR_(black_palette, DWORD)
VAR_(bottom_line, DWORD)
VAR_(btable, DWORD)
VAR_(btncnt, DWORD)
VAR_(CarCurrArea, DWORD)
VAR_(carCurrentArea, DWORD)
VAR_(carGasAmount, DWORD) // from 0 to 80000
VAR_(cmap, DWORD)
VAR_(colorTable, DWORD)
VAR_(combat_free_move, DWORD)
+12 -12
View File
@@ -88,8 +88,8 @@ static void __declspec(naked) BarterPriceHook() {
xchg eax, edx;
call fo::funcoffs::item_caps_total_;
mov args[16], eax;
mov eax, ds:[FO_VAR_btable]
call fo::funcoffs::item_total_cost_;
mov eax, ds:[FO_VAR_btable];
call fo::funcoffs::item_total_cost_;
mov args[20], eax;
mov eax, ds:[FO_VAR_ptable];
mov args[24], eax;
@@ -133,10 +133,10 @@ static void __declspec(naked) UseSkillHook() {
cmp rets[0], -1;
je defaulthandler;
mov eax, rets[0];
jmp end
defaulthandler :
call fo::funcoffs::skill_use_
end :
jmp end;
defaulthandler:
call fo::funcoffs::skill_use_;
end:
hookend;
retn;
}
@@ -158,10 +158,10 @@ static void __declspec(naked) StealCheckHook() {
cmp rets[0], -1;
je defaulthandler;
mov eax, rets[0];
jmp end
defaulthandler :
call fo::funcoffs::skill_check_stealing_
end :
jmp end;
defaulthandler:
call fo::funcoffs::skill_check_stealing_;
end:
hookend;
retn;
}
@@ -172,8 +172,8 @@ static void __declspec(naked) PerceptionRangeHook() {
hookbegin(3);
mov args[0], eax; // watcher
mov args[4], edx; // target
call fo::funcoffs::is_within_perception_
mov args[8], eax; // check result
call fo::funcoffs::is_within_perception_;
mov args[8], eax; // check result
pushad;
push HOOK_WITHINPERCEPTION;
call RunHookScript;
@@ -75,6 +75,7 @@ static const SfallMetarule* currentMetarule;
- arg1, arg2, ... - argument types for automatic validation
*/
static const SfallMetarule metarules[] = {
{"car_gas_amount", sf_car_gas_amount, 0, 0},
{"critter_inven_obj2", sf_critter_inven_obj2, 2, 2, {ARG_OBJECT, ARG_INT}},
{"exec_map_update_scripts", sf_exec_map_update_scripts, 0, 0},
{"get_flags", sf_get_flags, 1, 1, {ARG_OBJECT}},
+1 -1
View File
@@ -877,7 +877,7 @@ void __declspec(naked) op_set_car_current_town() {
call fo::funcoffs::interpretPopLong_;
cmp dx, 0xC001;
jnz end;
mov ds:[FO_VAR_CarCurrArea], eax;
mov ds:[FO_VAR_carCurrentArea], eax;
end:
pop edi;
pop edx;
@@ -405,5 +405,9 @@ void sf_real_dude_obj(OpcodeContext& ctx) {
ctx.setReturn(PartyControl::RealDudeObject());
}
void sf_car_gas_amount(OpcodeContext& ctx) {
ctx.setReturn(fo::var::carGasAmount);
}
}
}
@@ -83,5 +83,7 @@ void sf_set_dude_obj(OpcodeContext&);
void sf_real_dude_obj(OpcodeContext&);
void sf_car_gas_amount(OpcodeContext&);
}
}