mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added "display_stats" script function #113
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
#include "..\..\..\FalloutEngine\Fallout2.h"
|
#include "..\..\..\FalloutEngine\Fallout2.h"
|
||||||
#include "..\..\..\InputFuncs.h"
|
#include "..\..\..\InputFuncs.h"
|
||||||
#include "..\..\BarBoxes.h"
|
#include "..\..\BarBoxes.h"
|
||||||
|
#include "..\..\LoadGameHook.h"
|
||||||
#include "..\..\ScriptExtender.h"
|
#include "..\..\ScriptExtender.h"
|
||||||
#include "..\OpcodeContext.h"
|
#include "..\OpcodeContext.h"
|
||||||
|
|
||||||
@@ -90,7 +91,7 @@ void __declspec(naked) op_get_mouse_x() {
|
|||||||
mov eax, ecx;
|
mov eax, ecx;
|
||||||
mov edx, 0xc001;
|
mov edx, 0xc001;
|
||||||
call fo::funcoffs::interpretPushShort_
|
call fo::funcoffs::interpretPushShort_
|
||||||
pop edx;
|
pop edx;
|
||||||
pop ecx;
|
pop ecx;
|
||||||
retn;
|
retn;
|
||||||
}
|
}
|
||||||
@@ -107,7 +108,7 @@ void __declspec(naked) op_get_mouse_y() {
|
|||||||
mov eax, ecx;
|
mov eax, ecx;
|
||||||
mov edx, 0xc001;
|
mov edx, 0xc001;
|
||||||
call fo::funcoffs::interpretPushShort_
|
call fo::funcoffs::interpretPushShort_
|
||||||
pop edx;
|
pop edx;
|
||||||
pop ecx;
|
pop ecx;
|
||||||
retn;
|
retn;
|
||||||
}
|
}
|
||||||
@@ -123,7 +124,7 @@ void __declspec(naked) op_get_mouse_buttons() {
|
|||||||
mov eax, ecx;
|
mov eax, ecx;
|
||||||
mov edx, 0xc001;
|
mov edx, 0xc001;
|
||||||
call fo::funcoffs::interpretPushShort_
|
call fo::funcoffs::interpretPushShort_
|
||||||
pop edx;
|
pop edx;
|
||||||
pop ecx;
|
pop ecx;
|
||||||
retn;
|
retn;
|
||||||
}
|
}
|
||||||
@@ -139,7 +140,7 @@ void __declspec(naked) op_get_window_under_mouse() {
|
|||||||
mov eax, ecx;
|
mov eax, ecx;
|
||||||
mov edx, 0xc001;
|
mov edx, 0xc001;
|
||||||
call fo::funcoffs::interpretPushShort_
|
call fo::funcoffs::interpretPushShort_
|
||||||
pop edx;
|
pop edx;
|
||||||
pop ecx;
|
pop ecx;
|
||||||
retn;
|
retn;
|
||||||
}
|
}
|
||||||
@@ -150,7 +151,7 @@ void __declspec(naked) op_get_screen_width() {
|
|||||||
push edx
|
push edx
|
||||||
push eax
|
push eax
|
||||||
mov edx, ds:[FO_VAR_scr_size + 8] // _scr_size.offx
|
mov edx, ds:[FO_VAR_scr_size + 8] // _scr_size.offx
|
||||||
sub edx, ds : [FO_VAR_scr_size] // _scr_size.x
|
sub edx, ds:[FO_VAR_scr_size] // _scr_size.x
|
||||||
inc edx
|
inc edx
|
||||||
call fo::funcoffs::interpretPushLong_
|
call fo::funcoffs::interpretPushLong_
|
||||||
pop eax
|
pop eax
|
||||||
@@ -166,7 +167,7 @@ void __declspec(naked) op_get_screen_height() {
|
|||||||
push edx
|
push edx
|
||||||
push eax
|
push eax
|
||||||
mov edx, ds:[FO_VAR_scr_size + 12] // _scr_size.offy
|
mov edx, ds:[FO_VAR_scr_size + 12] // _scr_size.offy
|
||||||
sub edx, ds : [FO_VAR_scr_size + 4] // _scr_size.y
|
sub edx, ds:[FO_VAR_scr_size + 4] // _scr_size.y
|
||||||
inc edx
|
inc edx
|
||||||
call fo::funcoffs::interpretPushLong_
|
call fo::funcoffs::interpretPushLong_
|
||||||
pop eax
|
pop eax
|
||||||
@@ -194,7 +195,7 @@ void __declspec(naked) op_resume_game() {
|
|||||||
void __declspec(naked) op_create_message_window() {
|
void __declspec(naked) op_create_message_window() {
|
||||||
__asm {
|
__asm {
|
||||||
pushad
|
pushad
|
||||||
mov ebx, dword ptr ds : [FO_VAR_curr_font_num];
|
mov ebx, dword ptr ds:[FO_VAR_curr_font_num];
|
||||||
cmp ebx, 0x65;
|
cmp ebx, 0x65;
|
||||||
je end;
|
je end;
|
||||||
|
|
||||||
@@ -281,8 +282,8 @@ void __declspec(naked) op_set_viewport_x() {
|
|||||||
call fo::funcoffs::interpretPopLong_;
|
call fo::funcoffs::interpretPopLong_;
|
||||||
cmp dx, 0xC001;
|
cmp dx, 0xC001;
|
||||||
jnz end;
|
jnz end;
|
||||||
mov ds : [FO_VAR_wmWorldOffsetX], eax
|
mov ds:[FO_VAR_wmWorldOffsetX], eax
|
||||||
end :
|
end:
|
||||||
pop edx;
|
pop edx;
|
||||||
pop ecx;
|
pop ecx;
|
||||||
pop ebx;
|
pop ebx;
|
||||||
@@ -302,8 +303,8 @@ void __declspec(naked) op_set_viewport_y() {
|
|||||||
call fo::funcoffs::interpretPopLong_;
|
call fo::funcoffs::interpretPopLong_;
|
||||||
cmp dx, 0xC001;
|
cmp dx, 0xC001;
|
||||||
jnz end;
|
jnz end;
|
||||||
mov ds : [FO_VAR_wmWorldOffsetY], eax
|
mov ds:[FO_VAR_wmWorldOffsetY], eax
|
||||||
end :
|
end:
|
||||||
pop edx;
|
pop edx;
|
||||||
pop ecx;
|
pop ecx;
|
||||||
pop ebx;
|
pop ebx;
|
||||||
@@ -384,7 +385,7 @@ void __declspec(naked) op_is_iface_tag_active() {
|
|||||||
jmp end;
|
jmp end;
|
||||||
falloutfunc:
|
falloutfunc:
|
||||||
mov ecx, eax;
|
mov ecx, eax;
|
||||||
mov eax, dword ptr ds : [FO_VAR_obj_dude];
|
mov eax, dword ptr ds:[FO_VAR_obj_dude];
|
||||||
mov edx, esp;
|
mov edx, esp;
|
||||||
mov eax, [eax + 0x64];
|
mov eax, [eax + 0x64];
|
||||||
call fo::funcoffs::proto_ptr_;
|
call fo::funcoffs::proto_ptr_;
|
||||||
@@ -449,5 +450,12 @@ void sf_set_cursor_mode(OpcodeContext& ctx) {
|
|||||||
fo::func::gmouse_3d_set_mode(ctx.arg(0).asInt());
|
fo::func::gmouse_3d_set_mode(ctx.arg(0).asInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sf_display_stats(OpcodeContext& ctx) {
|
||||||
|
// calling the function outside of inventory screen will crash the game
|
||||||
|
if (GetLoopFlags() & INVENTORY) {
|
||||||
|
__asm call fo::funcoffs::display_stats_
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,5 +87,7 @@ void sf_get_cursor_mode(OpcodeContext&);
|
|||||||
|
|
||||||
void sf_set_cursor_mode(OpcodeContext&);
|
void sf_set_cursor_mode(OpcodeContext&);
|
||||||
|
|
||||||
|
void sf_display_stats(OpcodeContext&);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ static const SfallMetarule* currentMetarule;
|
|||||||
static const SfallMetarule metarules[] = {
|
static const SfallMetarule metarules[] = {
|
||||||
{"car_gas_amount", sf_car_gas_amount, 0, 0},
|
{"car_gas_amount", sf_car_gas_amount, 0, 0},
|
||||||
{"critter_inven_obj2", sf_critter_inven_obj2, 2, 2, {ARG_OBJECT, ARG_INT}},
|
{"critter_inven_obj2", sf_critter_inven_obj2, 2, 2, {ARG_OBJECT, ARG_INT}},
|
||||||
|
{"display_stats", sf_display_stats, 0, 0},
|
||||||
{"exec_map_update_scripts", sf_exec_map_update_scripts, 0, 0},
|
{"exec_map_update_scripts", sf_exec_map_update_scripts, 0, 0},
|
||||||
{"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, {ARG_OBJECT}},
|
{"get_flags", sf_get_flags, 1, 1, {ARG_OBJECT}},
|
||||||
|
|||||||
Reference in New Issue
Block a user