mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3acf051b49 | ||
|
|
0137504f3f | ||
|
|
ebcd505561 |
+5
-4
@@ -41,10 +41,11 @@ TGameObj* __stdcall sf_check_critters_in_lof(TGameObj* object, DWORD checkTile,
|
||||
}
|
||||
|
||||
// Returns the friendly critter that is in the line of fire
|
||||
TGameObj* __stdcall CheckFriendlyFire(TGameObj* target, TGameObj* attacker) {
|
||||
TGameObj* __stdcall AI_CheckFriendlyFire(TGameObj* target, TGameObj* attacker) {
|
||||
TGameObj* object = nullptr;
|
||||
MakeStraightPathFunc(attacker, attacker->tile, target->tile, 0, (DWORD*)&object, 32, (void*)obj_shoot_blocking_at_);
|
||||
return sf_check_critters_in_lof(object, target->tile, attacker->teamNum); // 0 if there are no friendly critters
|
||||
object = sf_check_critters_in_lof(object, target->tile, attacker->teamNum);
|
||||
return (!object || ((object->artFid >> 24) & 0x0F) == OBJ_TYPE_CRITTER) ? object : nullptr; // 0 if there are no friendly critters
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_try_attack_hook_FleeFix() {
|
||||
@@ -55,7 +56,7 @@ static void __declspec(naked) ai_try_attack_hook_FleeFix() {
|
||||
}
|
||||
|
||||
static void __declspec(naked) combat_ai_hook_FleeFix() {
|
||||
static const DWORD combat_ai_hook_flee_Ret = 0x42B22F;
|
||||
static const DWORD combat_ai_hook_flee_Ret = 0x42B206;
|
||||
__asm {
|
||||
test byte ptr [ebp], 8; // 'ReTarget' flag (critter.combat_state)
|
||||
jnz reTarget;
|
||||
@@ -345,7 +346,7 @@ fix:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static long __fastcall RollFriendlyFire(TGameObj* target, TGameObj* attacker) {
|
||||
if (CheckFriendlyFire(target, attacker)) {
|
||||
if (AI_CheckFriendlyFire(target, attacker)) {
|
||||
long dice = RollRandom(1, 10);
|
||||
return (StatLevel(attacker, STAT_iq) >= dice); // 1 - is friendly
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
void AIInit();
|
||||
|
||||
TGameObj* __stdcall sf_check_critters_in_lof(TGameObj* object, DWORD checkTile, DWORD team);
|
||||
TGameObj* __stdcall CheckFriendlyFire(TGameObj* target, TGameObj* attacker);
|
||||
TGameObj* __stdcall AI_CheckFriendlyFire(TGameObj* target, TGameObj* attacker);
|
||||
|
||||
void __stdcall AICombatStart();
|
||||
void __stdcall AICombatEnd();
|
||||
|
||||
@@ -313,6 +313,11 @@ artNotExist:
|
||||
push edx;
|
||||
push artDbgMsg;
|
||||
call debug_printf_;
|
||||
cmp isDebug, 0;
|
||||
jne display;
|
||||
add esp, 8;
|
||||
retn;
|
||||
display:
|
||||
push edx; // filename
|
||||
push artDbgMsg;
|
||||
lea eax, [esp + 0x124 - 0x124 + 20]; // buf
|
||||
@@ -370,7 +375,7 @@ static void DebugModePatch() {
|
||||
if (iniGetInt("Debugging", "HideObjIsNullMsg", 0, ddrawIniDef)) {
|
||||
MakeJump(0x453FD2, dbg_error_hack);
|
||||
}
|
||||
// prints a debug message about missing art file for critters to both debug.log and the message window
|
||||
// prints a debug message about missing art file for critters to both debug.log and the message window in sfall debugging mode
|
||||
HookCall(0x419B65, art_data_size_hook);
|
||||
|
||||
// Fix to prevent crashes when there is a '%' character in the printed message
|
||||
|
||||
@@ -54,8 +54,6 @@ struct {
|
||||
static DWORD callDepth;
|
||||
static DWORD currentRunHook = -1;
|
||||
|
||||
DWORD InitingHookScripts;
|
||||
|
||||
static DWORD args[maxArgs]; // current hook arguments
|
||||
static DWORD rets[maxRets]; // current hook return values
|
||||
|
||||
@@ -70,6 +68,8 @@ static struct HooksPositionInfo {
|
||||
bool hasHsScript;
|
||||
} hooksInfo[HOOK_COUNT];
|
||||
|
||||
DWORD initingHookScripts;
|
||||
|
||||
#define HookBegin pushadc __asm call BeginHook popadc
|
||||
#define HookEnd pushadc __asm call EndHook popadc
|
||||
|
||||
@@ -1820,15 +1820,15 @@ void HookScriptClear() {
|
||||
void HookScriptInit() {
|
||||
isGlobalScriptLoading = 1; // this should allow to register global exported variables
|
||||
HookScriptInit2();
|
||||
InitingHookScripts = 1;
|
||||
initingHookScripts = 1;
|
||||
for (int i = 0; i < numHooks; i++) {
|
||||
if (!hooks[i].empty()) {
|
||||
hooksInfo[i].hasHsScript = true;
|
||||
InitScriptProgram(hooks[i][0].prog);// zero hook is always hs_*.int script because Hook scripts are loaded BEFORE global scripts
|
||||
InitScriptProgram(hooks[i][0].prog); // zero hook is always hs_*.int script because Hook scripts are loaded BEFORE global scripts
|
||||
}
|
||||
}
|
||||
isGlobalScriptLoading = 0;
|
||||
InitingHookScripts = 0;
|
||||
initingHookScripts = 0;
|
||||
}
|
||||
|
||||
// run specific event procedure for all hook scripts
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ void __stdcall RegisterHook(DWORD script, DWORD id, DWORD procNum, bool specReg)
|
||||
void HookScriptInit();
|
||||
void HookScriptClear();
|
||||
|
||||
extern DWORD InitingHookScripts;
|
||||
extern DWORD initingHookScripts;
|
||||
int __fastcall AmmoCostHook_Script(DWORD hookType, TGameObj* weapon, DWORD &rounds);
|
||||
void __stdcall RunHookScriptsAtProc(DWORD procId);
|
||||
|
||||
|
||||
+303
-303
File diff suppressed because it is too large
Load Diff
@@ -228,6 +228,6 @@ static void __declspec(naked) op_explosions_metarule() {
|
||||
_WRAP_OPCODE(op_explosions_metarule2, 3, 1)
|
||||
}
|
||||
|
||||
static void sf_art_cache_flush() {
|
||||
static void mf_art_cache_flush() {
|
||||
__asm call art_flush_;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "ScriptExtender.h"
|
||||
|
||||
//file system functions
|
||||
static void __stdcall fs_create2() {
|
||||
static void __stdcall op_fs_create2() {
|
||||
const ScriptValue &pathArg = opHandler.arg(0),
|
||||
&sizeArg = opHandler.arg(1);
|
||||
|
||||
@@ -35,11 +35,11 @@ static void __stdcall fs_create2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_create() {
|
||||
_WRAP_OPCODE(fs_create2, 2, 1)
|
||||
static void __declspec(naked) op_fs_create() {
|
||||
_WRAP_OPCODE(op_fs_create2, 2, 1)
|
||||
}
|
||||
|
||||
static void __stdcall fs_copy2() {
|
||||
static void __stdcall op_fs_copy2() {
|
||||
const ScriptValue &pathArg = opHandler.arg(0),
|
||||
&srcArg = opHandler.arg(1);
|
||||
|
||||
@@ -51,11 +51,11 @@ static void __stdcall fs_copy2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_copy() {
|
||||
_WRAP_OPCODE(fs_copy2, 2, 1)
|
||||
static void __declspec(naked) op_fs_copy() {
|
||||
_WRAP_OPCODE(op_fs_copy2, 2, 1)
|
||||
}
|
||||
|
||||
static void __stdcall fs_find2() {
|
||||
static void __stdcall op_fs_find2() {
|
||||
const ScriptValue &pathArg = opHandler.arg(0);
|
||||
|
||||
if (pathArg.isString()) {
|
||||
@@ -66,11 +66,11 @@ static void __stdcall fs_find2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_find() {
|
||||
_WRAP_OPCODE(fs_find2, 1, 1)
|
||||
static void __declspec(naked) op_fs_find() {
|
||||
_WRAP_OPCODE(op_fs_find2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall fs_write_byte2() {
|
||||
static void __stdcall op_fs_write_byte2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0),
|
||||
&dataArg = opHandler.arg(1);
|
||||
|
||||
@@ -81,11 +81,11 @@ static void __stdcall fs_write_byte2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_write_byte() {
|
||||
_WRAP_OPCODE(fs_write_byte2, 2, 0)
|
||||
static void __declspec(naked) op_fs_write_byte() {
|
||||
_WRAP_OPCODE(op_fs_write_byte2, 2, 0)
|
||||
}
|
||||
|
||||
static void __stdcall fs_write_short2() {
|
||||
static void __stdcall op_fs_write_short2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0),
|
||||
&dataArg = opHandler.arg(1);
|
||||
|
||||
@@ -96,11 +96,11 @@ static void __stdcall fs_write_short2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_write_short() {
|
||||
_WRAP_OPCODE(fs_write_short2, 2, 0)
|
||||
static void __declspec(naked) op_fs_write_short() {
|
||||
_WRAP_OPCODE(op_fs_write_short2, 2, 0)
|
||||
}
|
||||
|
||||
static void __stdcall fs_write_int2() {
|
||||
static void __stdcall op_fs_write_int2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0),
|
||||
&dataArg = opHandler.arg(1);
|
||||
|
||||
@@ -111,11 +111,11 @@ static void __stdcall fs_write_int2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_write_int() {
|
||||
_WRAP_OPCODE(fs_write_int2, 2, 0)
|
||||
static void __declspec(naked) op_fs_write_int() {
|
||||
_WRAP_OPCODE(op_fs_write_int2, 2, 0)
|
||||
}
|
||||
|
||||
static void __stdcall fs_write_string2() {
|
||||
static void __stdcall op_fs_write_string2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0),
|
||||
&dataArg = opHandler.arg(1);
|
||||
|
||||
@@ -126,11 +126,11 @@ static void __stdcall fs_write_string2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_write_string() {
|
||||
_WRAP_OPCODE(fs_write_string2, 2, 0)
|
||||
static void __declspec(naked) op_fs_write_string() {
|
||||
_WRAP_OPCODE(op_fs_write_string2, 2, 0)
|
||||
}
|
||||
|
||||
static void __stdcall fs_write_bstring2() {
|
||||
static void __stdcall op_fs_write_bstring2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0),
|
||||
&dataArg = opHandler.arg(1);
|
||||
|
||||
@@ -141,11 +141,11 @@ static void __stdcall fs_write_bstring2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_write_bstring() {
|
||||
_WRAP_OPCODE(fs_write_bstring2, 2, 0)
|
||||
static void __declspec(naked) op_fs_write_bstring() {
|
||||
_WRAP_OPCODE(op_fs_write_bstring2, 2, 0)
|
||||
}
|
||||
|
||||
static void __stdcall fs_read_byte2() {
|
||||
static void __stdcall op_fs_read_byte2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0);
|
||||
|
||||
if (idArg.isInt()) {
|
||||
@@ -156,11 +156,11 @@ static void __stdcall fs_read_byte2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_read_byte() {
|
||||
_WRAP_OPCODE(fs_read_byte2, 1, 1)
|
||||
static void __declspec(naked) op_fs_read_byte() {
|
||||
_WRAP_OPCODE(op_fs_read_byte2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall fs_read_short2() {
|
||||
static void __stdcall op_fs_read_short2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0);
|
||||
|
||||
if (idArg.isInt()) {
|
||||
@@ -171,11 +171,11 @@ static void __stdcall fs_read_short2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_read_short() {
|
||||
_WRAP_OPCODE(fs_read_short2, 1, 1)
|
||||
static void __declspec(naked) op_fs_read_short() {
|
||||
_WRAP_OPCODE(op_fs_read_short2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall fs_read_int2() {
|
||||
static void __stdcall op_fs_read_int2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0);
|
||||
|
||||
if (idArg.isInt()) {
|
||||
@@ -186,11 +186,11 @@ static void __stdcall fs_read_int2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_read_int() {
|
||||
_WRAP_OPCODE(fs_read_int2, 1, 1)
|
||||
static void __declspec(naked) op_fs_read_int() {
|
||||
_WRAP_OPCODE(op_fs_read_int2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall fs_read_float2() {
|
||||
static void __stdcall op_fs_read_float2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0);
|
||||
|
||||
if (idArg.isInt()) {
|
||||
@@ -201,11 +201,11 @@ static void __stdcall fs_read_float2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_read_float() {
|
||||
_WRAP_OPCODE(fs_read_float2, 1, 1)
|
||||
static void __declspec(naked) op_fs_read_float() {
|
||||
_WRAP_OPCODE(op_fs_read_float2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall fs_delete2() {
|
||||
static void __stdcall op_fs_delete2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0);
|
||||
|
||||
if (idArg.isInt()) {
|
||||
@@ -215,11 +215,11 @@ static void __stdcall fs_delete2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_delete() {
|
||||
_WRAP_OPCODE(fs_delete2, 1, 0)
|
||||
static void __declspec(naked) op_fs_delete() {
|
||||
_WRAP_OPCODE(op_fs_delete2, 1, 0)
|
||||
}
|
||||
|
||||
static void __stdcall fs_size2() {
|
||||
static void __stdcall op_fs_size2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0);
|
||||
|
||||
if (idArg.isInt()) {
|
||||
@@ -230,11 +230,11 @@ static void __stdcall fs_size2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_size() {
|
||||
_WRAP_OPCODE(fs_size2, 1, 1)
|
||||
static void __declspec(naked) op_fs_size() {
|
||||
_WRAP_OPCODE(op_fs_size2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall fs_pos2() {
|
||||
static void __stdcall op_fs_pos2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0);
|
||||
|
||||
if (idArg.isInt()) {
|
||||
@@ -245,11 +245,11 @@ static void __stdcall fs_pos2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_pos() {
|
||||
_WRAP_OPCODE(fs_pos2, 1, 1)
|
||||
static void __declspec(naked) op_fs_pos() {
|
||||
_WRAP_OPCODE(op_fs_pos2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall fs_seek2() {
|
||||
static void __stdcall op_fs_seek2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0),
|
||||
&posArg = opHandler.arg(1);
|
||||
|
||||
@@ -260,11 +260,11 @@ static void __stdcall fs_seek2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_seek() {
|
||||
_WRAP_OPCODE(fs_seek2, 2, 0)
|
||||
static void __declspec(naked) op_fs_seek() {
|
||||
_WRAP_OPCODE(op_fs_seek2, 2, 0)
|
||||
}
|
||||
|
||||
static void __stdcall fs_resize2() {
|
||||
static void __stdcall op_fs_resize2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0),
|
||||
&sizeArg = opHandler.arg(1);
|
||||
|
||||
@@ -275,6 +275,6 @@ static void __stdcall fs_resize2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fs_resize() {
|
||||
_WRAP_OPCODE(fs_resize2, 2, 0)
|
||||
static void __declspec(naked) op_fs_resize() {
|
||||
_WRAP_OPCODE(op_fs_resize2, 2, 0)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "ScriptExtender.h"
|
||||
|
||||
// graphics_functions
|
||||
static void __declspec(naked) GraphicsFuncsAvailable() {
|
||||
static void __declspec(naked) op_graphics_funcs_available() {
|
||||
__asm {
|
||||
cmp GraphicsMode, 3;
|
||||
seta dl;
|
||||
@@ -34,7 +34,7 @@ static void __declspec(naked) GraphicsFuncsAvailable() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcLoadShader() {
|
||||
static void __declspec(naked) op_load_shader() {
|
||||
__asm {
|
||||
push ebx;
|
||||
push ecx;
|
||||
@@ -73,7 +73,7 @@ result:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcFreeShader() {
|
||||
static void __declspec(naked) op_free_shader() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
@@ -85,7 +85,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcActivateShader() {
|
||||
static void __declspec(naked) op_activate_shader() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
@@ -97,7 +97,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcDeactivateShader() {
|
||||
static void __declspec(naked) op_deactivate_shader() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
@@ -109,7 +109,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcGetShaderTexture() {
|
||||
static void __declspec(naked) op_get_shader_texture() {
|
||||
__asm {
|
||||
//Store registers
|
||||
push ebx;
|
||||
@@ -161,7 +161,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcSetShaderInt() {
|
||||
static void __declspec(naked) op_set_shader_int() {
|
||||
__asm {
|
||||
push ebx;
|
||||
push ecx;
|
||||
@@ -218,7 +218,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcSetShaderTexture() {
|
||||
static void __declspec(naked) op_set_shader_texture() {
|
||||
__asm {
|
||||
push ebx;
|
||||
push ecx;
|
||||
@@ -275,7 +275,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcSetShaderFloat() {
|
||||
static void __declspec(naked) op_set_shader_float() {
|
||||
__asm {
|
||||
push ebx;
|
||||
push ecx;
|
||||
@@ -337,7 +337,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcSetShaderVector() {
|
||||
static void __declspec(naked) op_set_shader_vector() {
|
||||
__asm {
|
||||
push ebx;
|
||||
push ecx;
|
||||
@@ -395,7 +395,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcGetShaderVersion() {
|
||||
static void __declspec(naked) op_get_shader_version() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
call GetShaderVersion;
|
||||
@@ -407,7 +407,7 @@ static void __declspec(naked) funcGetShaderVersion() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcSetShaderMode() {
|
||||
static void __declspec(naked) op_set_shader_mode() {
|
||||
__asm {
|
||||
push ebx;
|
||||
push ecx;
|
||||
@@ -442,7 +442,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcForceGraphicsRefresh() {
|
||||
static void __declspec(naked) op_force_graphics_refresh() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "ScriptExtender.h"
|
||||
|
||||
// input_functions
|
||||
static void __declspec(naked) InputFuncsAvailable() {
|
||||
static void __declspec(naked) op_input_funcs_available() {
|
||||
__asm {
|
||||
mov edx, 1; // They're always available from 2.9 on
|
||||
_J_RET_VAL_TYPE(VAR_TYPE_INT);
|
||||
@@ -33,7 +33,7 @@ static void __declspec(naked) InputFuncsAvailable() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) KeyPressed() {
|
||||
static void __declspec(naked) op_key_pressed() {
|
||||
__asm {
|
||||
push ecx;
|
||||
push edx;
|
||||
@@ -64,7 +64,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcTapKey() {
|
||||
static void __declspec(naked) op_tap_key() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
@@ -81,7 +81,7 @@ end:
|
||||
}
|
||||
|
||||
//// *** From helios *** ////
|
||||
static void __declspec(naked) get_mouse_x() {
|
||||
static void __declspec(naked) op_get_mouse_x() {
|
||||
__asm {
|
||||
mov edx, ds:[_mouse_x_];
|
||||
add edx, ds:[_mouse_hotx];
|
||||
@@ -91,7 +91,7 @@ static void __declspec(naked) get_mouse_x() {
|
||||
}
|
||||
|
||||
//Return mouse y position
|
||||
static void __declspec(naked) get_mouse_y() {
|
||||
static void __declspec(naked) op_get_mouse_y() {
|
||||
__asm {
|
||||
mov edx, ds:[_mouse_y_];
|
||||
add edx, ds:[_mouse_hoty];
|
||||
@@ -101,7 +101,7 @@ static void __declspec(naked) get_mouse_y() {
|
||||
}
|
||||
|
||||
//Return pressed mouse button (1=left, 2=right, 3=left+right, 4=middle)
|
||||
static void __declspec(naked) get_mouse_buttons() {
|
||||
static void __declspec(naked) op_get_mouse_buttons() {
|
||||
__asm {
|
||||
push ecx;
|
||||
push edx;
|
||||
@@ -124,7 +124,7 @@ skip:
|
||||
}
|
||||
|
||||
//Return the window number under the mous
|
||||
static void __declspec(naked) get_window_under_mouse() {
|
||||
static void __declspec(naked) op_get_window_under_mouse() {
|
||||
__asm {
|
||||
mov edx, ds:[_last_button_winID];
|
||||
_J_RET_VAL_TYPE(VAR_TYPE_INT);
|
||||
@@ -133,7 +133,7 @@ static void __declspec(naked) get_window_under_mouse() {
|
||||
}
|
||||
|
||||
//Return screen width
|
||||
static void __declspec(naked) get_screen_width() {
|
||||
static void __declspec(naked) op_get_screen_width() {
|
||||
__asm {
|
||||
mov edx, ds:[_scr_size + 8]; // _scr_size.offx
|
||||
sub edx, ds:[_scr_size]; // _scr_size.x
|
||||
@@ -144,7 +144,7 @@ static void __declspec(naked) get_screen_width() {
|
||||
}
|
||||
|
||||
//Return screen height
|
||||
static void __declspec(naked) get_screen_height() {
|
||||
static void __declspec(naked) op_get_screen_height() {
|
||||
__asm {
|
||||
mov edx, ds:[_scr_size + 12]; // _scr_size.offy
|
||||
sub edx, ds:[_scr_size + 4]; // _scr_size.y
|
||||
@@ -155,14 +155,14 @@ static void __declspec(naked) get_screen_height() {
|
||||
}
|
||||
|
||||
//Stop game, the same effect as open charsscreen or inventory
|
||||
static void __declspec(naked) stop_game() {
|
||||
static void __declspec(naked) op_stop_game() {
|
||||
__asm {
|
||||
jmp map_disable_bk_processes_;
|
||||
}
|
||||
}
|
||||
|
||||
//Resume the game when it is stopped
|
||||
static void __declspec(naked) resume_game() {
|
||||
static void __declspec(naked) op_resume_game() {
|
||||
__asm {
|
||||
jmp map_enable_bk_processes_;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ static void __stdcall SplitToBuffer(const char* str, const char** str_ptr, long
|
||||
gTextBuffer[i] = '\0';
|
||||
}
|
||||
|
||||
static void __stdcall create_message_window2() {
|
||||
static void __stdcall op_create_message_window2() {
|
||||
const ScriptValue &strArg = opHandler.arg(0);
|
||||
if (strArg.isString()) {
|
||||
static bool dialogShow = false;
|
||||
@@ -203,11 +203,11 @@ static void __stdcall create_message_window2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) create_message_window() {
|
||||
_WRAP_OPCODE(create_message_window2, 1, 0)
|
||||
static void __declspec(naked) op_create_message_window() {
|
||||
_WRAP_OPCODE(op_create_message_window2, 1, 0)
|
||||
}
|
||||
|
||||
static void sf_message_box() {
|
||||
static void mf_message_box() {
|
||||
static int dialogShowCount = 0;
|
||||
|
||||
long lines = 0;
|
||||
@@ -232,7 +232,7 @@ static void sf_message_box() {
|
||||
opHandler.setReturn(result);
|
||||
}
|
||||
|
||||
static void __declspec(naked) GetViewportX() {
|
||||
static void __declspec(naked) op_get_viewport_x() {
|
||||
__asm {
|
||||
mov edx, ds:[_wmWorldOffsetX];
|
||||
_J_RET_VAL_TYPE(VAR_TYPE_INT);
|
||||
@@ -240,7 +240,7 @@ static void __declspec(naked) GetViewportX() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) GetViewportY() {
|
||||
static void __declspec(naked) op_get_viewport_y() {
|
||||
__asm {
|
||||
mov edx, ds:[_wmWorldOffsetY];
|
||||
_J_RET_VAL_TYPE(VAR_TYPE_INT);
|
||||
@@ -248,7 +248,7 @@ static void __declspec(naked) GetViewportY() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetViewportX() {
|
||||
static void __declspec(naked) op_set_viewport_x() {
|
||||
__asm {
|
||||
_GET_ARG_INT(end);
|
||||
mov ds:[_wmWorldOffsetX], eax;
|
||||
@@ -257,7 +257,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetViewportY() {
|
||||
static void __declspec(naked) op_set_viewport_y() {
|
||||
__asm {
|
||||
_GET_ARG_INT(end);
|
||||
mov ds:[_wmWorldOffsetY], eax;
|
||||
@@ -266,13 +266,13 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_add_iface_tag() {
|
||||
static void mf_add_iface_tag() {
|
||||
int result = AddExtraBox();
|
||||
if (result == -1) opHandler.printOpcodeError("add_iface_tag() - cannot add new tag as the maximum limit of 126 tags has been reached.");
|
||||
opHandler.setReturn(result);
|
||||
}
|
||||
|
||||
static void __stdcall ShowIfaceTag2() {
|
||||
static void __stdcall op_show_iface_tag2() {
|
||||
const ScriptValue &tagArg = opHandler.arg(0);
|
||||
if (tagArg.isInt()) {
|
||||
int tag = tagArg.rawValue();
|
||||
@@ -287,11 +287,11 @@ static void __stdcall ShowIfaceTag2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ShowIfaceTag() {
|
||||
_WRAP_OPCODE(ShowIfaceTag2, 1, 0)
|
||||
static void __declspec(naked) op_show_iface_tag() {
|
||||
_WRAP_OPCODE(op_show_iface_tag2, 1, 0)
|
||||
}
|
||||
|
||||
static void __stdcall HideIfaceTag2() {
|
||||
static void __stdcall op_hide_iface_tag2() {
|
||||
const ScriptValue &tagArg = opHandler.arg(0);
|
||||
if (tagArg.isInt()) {
|
||||
int tag = tagArg.rawValue();
|
||||
@@ -306,11 +306,11 @@ static void __stdcall HideIfaceTag2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) HideIfaceTag() {
|
||||
_WRAP_OPCODE(HideIfaceTag2, 1, 0)
|
||||
static void __declspec(naked) op_hide_iface_tag() {
|
||||
_WRAP_OPCODE(op_hide_iface_tag2, 1, 0)
|
||||
}
|
||||
|
||||
static void __stdcall IsIfaceTagActive2() {
|
||||
static void __stdcall op_is_iface_tag_active2() {
|
||||
const ScriptValue &tagArg = opHandler.arg(0);
|
||||
if (tagArg.isInt()) {
|
||||
bool result = false;
|
||||
@@ -342,46 +342,46 @@ static void __stdcall IsIfaceTagActive2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) IsIfaceTagActive() {
|
||||
_WRAP_OPCODE(IsIfaceTagActive2, 1, 1)
|
||||
static void __declspec(naked) op_is_iface_tag_active() {
|
||||
_WRAP_OPCODE(op_is_iface_tag_active2, 1, 1)
|
||||
}
|
||||
|
||||
static void sf_intface_redraw() {
|
||||
static void mf_intface_redraw() {
|
||||
IntfaceRedraw();
|
||||
}
|
||||
|
||||
static void sf_intface_show() {
|
||||
static void mf_intface_show() {
|
||||
__asm call intface_show_;
|
||||
}
|
||||
|
||||
static void sf_intface_hide() {
|
||||
static void mf_intface_hide() {
|
||||
__asm call intface_hide_;
|
||||
}
|
||||
|
||||
static void sf_intface_is_hidden() {
|
||||
static void mf_intface_is_hidden() {
|
||||
opHandler.setReturn(IntfaceIsHidden());
|
||||
}
|
||||
|
||||
static void sf_tile_refresh_display() {
|
||||
static void mf_tile_refresh_display() {
|
||||
__asm call tile_refresh_display_;
|
||||
}
|
||||
|
||||
static void sf_get_cursor_mode() {
|
||||
static void mf_get_cursor_mode() {
|
||||
opHandler.setReturn(Gmouse3dGetMode());
|
||||
}
|
||||
|
||||
static void sf_set_cursor_mode() {
|
||||
static void mf_set_cursor_mode() {
|
||||
Gmouse3dSetMode(opHandler.arg(0).rawValue());
|
||||
}
|
||||
|
||||
static void sf_display_stats() {
|
||||
static void mf_display_stats() {
|
||||
// calling the function outside of inventory screen will crash the game
|
||||
if (GetLoopFlags() & INVENTORY) {
|
||||
__asm call display_stats_;
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_set_iface_tag_text() {
|
||||
static void mf_set_iface_tag_text() {
|
||||
int boxTag = opHandler.arg(0).rawValue();
|
||||
int maxBox = BarBoxes_MaxBox();
|
||||
|
||||
@@ -393,7 +393,7 @@ static void sf_set_iface_tag_text() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_inventory_redraw() {
|
||||
static void mf_inventory_redraw() {
|
||||
int mode;
|
||||
DWORD loopFlag = GetLoopFlags() & (INVENTORY | INTFACEUSE | INTFACELOOT | BARTER);
|
||||
switch (loopFlag) {
|
||||
@@ -424,7 +424,7 @@ static void sf_inventory_redraw() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_create_win() {
|
||||
static void mf_create_win() {
|
||||
int flags = (opHandler.numArgs() > 5)
|
||||
? opHandler.arg(5).rawValue()
|
||||
: WIN_MoveOnTop;
|
||||
@@ -439,7 +439,7 @@ static void sf_create_win() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_show_window() {
|
||||
static void mf_show_window() {
|
||||
if (opHandler.numArgs() > 0) {
|
||||
const char* name = opHandler.arg(0).strValue();
|
||||
sWindow sWin;
|
||||
@@ -456,7 +456,7 @@ static void sf_show_window() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_hide_window() {
|
||||
static void mf_hide_window() {
|
||||
if (opHandler.numArgs() > 0) {
|
||||
const char* name = opHandler.arg(0).strValue();
|
||||
sWindow sWin;
|
||||
@@ -473,7 +473,7 @@ static void sf_hide_window() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_set_window_flag() {
|
||||
static void mf_set_window_flag() {
|
||||
long bitFlag = opHandler.arg(1).rawValue();
|
||||
switch (bitFlag) {
|
||||
case WIN_MoveOnTop:
|
||||
@@ -515,7 +515,7 @@ static void sf_set_window_flag() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_draw_image() {
|
||||
static void mf_draw_image() {
|
||||
if (*(DWORD*)_currentWindow == -1) {
|
||||
opHandler.printOpcodeError("draw_image() - no created/selected window for the image.");
|
||||
opHandler.setReturn(0);
|
||||
@@ -582,7 +582,7 @@ static void sf_draw_image() {
|
||||
opHandler.setReturn(1);
|
||||
}
|
||||
|
||||
static void sf_draw_image_scaled() {
|
||||
static void mf_draw_image_scaled() {
|
||||
if (*(DWORD*)_currentWindow == -1) {
|
||||
opHandler.printOpcodeError("draw_image_scaled() - no created/selected window for the image.");
|
||||
opHandler.setReturn(0);
|
||||
@@ -675,7 +675,7 @@ static void sf_draw_image_scaled() {
|
||||
opHandler.setReturn(1);
|
||||
}
|
||||
|
||||
static void sf_unwield_slot() {
|
||||
static void mf_unwield_slot() {
|
||||
InvenType slot = static_cast<InvenType>(opHandler.arg(1).rawValue());
|
||||
if (slot < INVEN_TYPE_WORN || slot > INVEN_TYPE_LEFT_HAND) {
|
||||
opHandler.printOpcodeError("unwield_slot() - incorrect slot number.");
|
||||
@@ -737,7 +737,7 @@ static void sf_unwield_slot() {
|
||||
if (update) IntfaceUpdateItems(0, -1, -1);
|
||||
}
|
||||
|
||||
static void sf_get_window_attribute() {
|
||||
static void mf_get_window_attribute() {
|
||||
long attr = 0;
|
||||
if (opHandler.numArgs() > 1) attr = opHandler.arg(1).rawValue();
|
||||
|
||||
|
||||
+37
-37
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "ScriptExtender.h"
|
||||
|
||||
static void __stdcall funcDiv2() {
|
||||
static void __stdcall op_div2() {
|
||||
const ScriptValue ÷nd = opHandler.arg(0),
|
||||
&divisor = opHandler.arg(1);
|
||||
|
||||
@@ -45,11 +45,11 @@ static void __stdcall funcDiv2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcDiv() {
|
||||
_WRAP_OPCODE(funcDiv2, 2, 1)
|
||||
static void __declspec(naked) op_div() {
|
||||
_WRAP_OPCODE(op_div2, 2, 1)
|
||||
}
|
||||
|
||||
static void __stdcall funcSqrt2() {
|
||||
static void __stdcall op_sqrt2() {
|
||||
const ScriptValue &floatArg = opHandler.arg(0);
|
||||
|
||||
if (!floatArg.isString()) {
|
||||
@@ -60,11 +60,11 @@ static void __stdcall funcSqrt2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcSqrt() {
|
||||
_WRAP_OPCODE(funcSqrt2, 1, 1)
|
||||
static void __declspec(naked) op_sqrt() {
|
||||
_WRAP_OPCODE(op_sqrt2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall funcAbs2() {
|
||||
static void __stdcall op_abs2() {
|
||||
const ScriptValue &value = opHandler.arg(0);
|
||||
|
||||
if (!value.isString()) {
|
||||
@@ -79,11 +79,11 @@ static void __stdcall funcAbs2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcAbs() {
|
||||
_WRAP_OPCODE(funcAbs2, 1, 1)
|
||||
static void __declspec(naked) op_abs() {
|
||||
_WRAP_OPCODE(op_abs2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall funcSin2() {
|
||||
static void __stdcall op_sin2() {
|
||||
const ScriptValue &floatArg = opHandler.arg(0);
|
||||
|
||||
if (!floatArg.isString()) {
|
||||
@@ -94,11 +94,11 @@ static void __stdcall funcSin2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcSin() {
|
||||
_WRAP_OPCODE(funcSin2, 1, 1)
|
||||
static void __declspec(naked) op_sin() {
|
||||
_WRAP_OPCODE(op_sin2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall funcCos2() {
|
||||
static void __stdcall op_cos2() {
|
||||
const ScriptValue &floatArg = opHandler.arg(0);
|
||||
|
||||
if (!floatArg.isString()) {
|
||||
@@ -109,11 +109,11 @@ static void __stdcall funcCos2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcCos() {
|
||||
_WRAP_OPCODE(funcCos2, 1, 1)
|
||||
static void __declspec(naked) op_cos() {
|
||||
_WRAP_OPCODE(op_cos2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall funcTan2() {
|
||||
static void __stdcall op_tan2() {
|
||||
const ScriptValue &floatArg = opHandler.arg(0);
|
||||
|
||||
if (!floatArg.isString()) {
|
||||
@@ -124,11 +124,11 @@ static void __stdcall funcTan2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcTan() {
|
||||
_WRAP_OPCODE(funcTan2, 1, 1)
|
||||
static void __declspec(naked) op_tan() {
|
||||
_WRAP_OPCODE(op_tan2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall funcATan2() {
|
||||
static void __stdcall op_arctan2() {
|
||||
const ScriptValue &xFltArg = opHandler.arg(0),
|
||||
&yFltArg = opHandler.arg(1);
|
||||
|
||||
@@ -140,11 +140,11 @@ static void __stdcall funcATan2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcATan() {
|
||||
_WRAP_OPCODE(funcATan2, 2, 1)
|
||||
static void __declspec(naked) op_arctan() {
|
||||
_WRAP_OPCODE(op_arctan2, 2, 1)
|
||||
}
|
||||
|
||||
static void __stdcall funcPow2() {
|
||||
static void __stdcall op_power2() {
|
||||
const ScriptValue &base = opHandler.arg(0),
|
||||
&power = opHandler.arg(1);
|
||||
|
||||
@@ -166,11 +166,11 @@ static void __stdcall funcPow2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcPow() {
|
||||
_WRAP_OPCODE(funcPow2, 2, 1)
|
||||
static void __declspec(naked) op_power() {
|
||||
_WRAP_OPCODE(op_power2, 2, 1)
|
||||
}
|
||||
|
||||
static void __stdcall funcLog2() {
|
||||
static void __stdcall op_log2() {
|
||||
const ScriptValue &floatArg = opHandler.arg(0);
|
||||
|
||||
if (!floatArg.isString()) {
|
||||
@@ -181,11 +181,11 @@ static void __stdcall funcLog2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcLog() {
|
||||
_WRAP_OPCODE(funcLog2, 1, 1)
|
||||
static void __declspec(naked) op_log() {
|
||||
_WRAP_OPCODE(op_log2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall funcExp2() {
|
||||
static void __stdcall op_exponent2() {
|
||||
const ScriptValue &floatArg = opHandler.arg(0);
|
||||
|
||||
if (!floatArg.isString()) {
|
||||
@@ -196,11 +196,11 @@ static void __stdcall funcExp2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcExp() {
|
||||
_WRAP_OPCODE(funcExp2, 1, 1)
|
||||
static void __declspec(naked) op_exponent() {
|
||||
_WRAP_OPCODE(op_exponent2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall funcCeil2() {
|
||||
static void __stdcall op_ceil2() {
|
||||
const ScriptValue &floatArg = opHandler.arg(0);
|
||||
|
||||
if (!floatArg.isString()) {
|
||||
@@ -211,11 +211,11 @@ static void __stdcall funcCeil2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcCeil() {
|
||||
_WRAP_OPCODE(funcCeil2, 1, 1)
|
||||
static void __declspec(naked) op_ceil() {
|
||||
_WRAP_OPCODE(op_ceil2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall funcRound2() {
|
||||
static void __stdcall op_round2() {
|
||||
const ScriptValue &floatArg = opHandler.arg(0);
|
||||
|
||||
if (!floatArg.isString()) {
|
||||
@@ -231,11 +231,11 @@ static void __stdcall funcRound2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcRound() {
|
||||
_WRAP_OPCODE(funcRound2, 1, 1)
|
||||
static void __declspec(naked) op_round() {
|
||||
_WRAP_OPCODE(op_round2, 1, 1)
|
||||
}
|
||||
|
||||
static void sf_floor2() {
|
||||
static void mf_floor2() {
|
||||
const ScriptValue &valArg = opHandler.arg(0);
|
||||
|
||||
if (!valArg.isString()) {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
bool checkValidMemAddr = true;
|
||||
|
||||
// memory_reading_funcs
|
||||
static void __declspec(naked) ReadByte() {
|
||||
static void __declspec(naked) op_read_byte() {
|
||||
__asm {
|
||||
_GET_ARG_INT(error);
|
||||
test eax, eax;
|
||||
@@ -42,7 +42,7 @@ error:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ReadShort() {
|
||||
static void __declspec(naked) op_read_short() {
|
||||
__asm {
|
||||
_GET_ARG_INT(error);
|
||||
test eax, eax;
|
||||
@@ -58,7 +58,7 @@ error:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ReadInt() {
|
||||
static void __declspec(naked) op_read_int() {
|
||||
__asm {
|
||||
_GET_ARG_INT(error);
|
||||
test eax, eax;
|
||||
@@ -74,7 +74,7 @@ error:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ReadString() {
|
||||
static void __declspec(naked) op_read_string() {
|
||||
__asm {
|
||||
_GET_ARG_INT(error);
|
||||
test eax, eax;
|
||||
@@ -90,7 +90,7 @@ error:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) WriteByte() {
|
||||
static void __declspec(naked) op_write_byte() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG(esi, ecx); // write value
|
||||
@@ -116,7 +116,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) WriteShort() {
|
||||
static void __declspec(naked) op_write_short() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG(esi, ecx); // write value
|
||||
@@ -142,7 +142,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) WriteInt() {
|
||||
static void __declspec(naked) op_write_int() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG(esi, ecx); // write value
|
||||
@@ -176,7 +176,7 @@ static void __fastcall WriteStringInternal(char* addr, long type, long strID, TP
|
||||
*addr = 0;
|
||||
}
|
||||
|
||||
static void __declspec(naked) WriteString() {
|
||||
static void __declspec(naked) op_write_string() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG(esi, ecx); // str value
|
||||
@@ -240,7 +240,7 @@ static void __fastcall CallOffsetInternal(TProgram* script, DWORD func) {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) CallOffset() {
|
||||
static void __declspec(naked) op_call_offset() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
mov ecx, eax;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "ScriptExtender.h"
|
||||
|
||||
// Metarule is a universal opcode(s) for all kinds of new sfall scripting functions.
|
||||
// Prefix all function handlers with sf_ and add them to sfall_metarule_table.
|
||||
// Prefix all function handlers with mf_ and add them to sfall_metarule_table.
|
||||
// DO NOT add arguments and/or return values to function handlers!
|
||||
// Use opHandler.arg(i), inside handler function to access arguments.
|
||||
// Use opHandler.setReturn(x) to set return value.
|
||||
@@ -52,8 +52,8 @@ static const SfallMetarule* currentMetarule;
|
||||
|
||||
// Example handler. Feel free to add handlers in other files.
|
||||
#ifndef NDEBUG
|
||||
static std::string sf_test_stringBuf;
|
||||
static void sf_test() {
|
||||
static std::string mf_test_stringBuf;
|
||||
static void mf_test() {
|
||||
std::ostringstream sstream;
|
||||
sstream << "sfall_funcX(\"test\"";
|
||||
for (int i = 0; i < opHandler.numArgs(); i++) {
|
||||
@@ -76,13 +76,13 @@ static void sf_test() {
|
||||
}
|
||||
sstream << ")";
|
||||
|
||||
sf_test_stringBuf = sstream.str();
|
||||
opHandler.setReturn(sf_test_stringBuf.c_str());
|
||||
mf_test_stringBuf = sstream.str();
|
||||
opHandler.setReturn(mf_test_stringBuf.c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
// returns current contents of metarule table
|
||||
static void sf_get_metarule_table() {
|
||||
static void mf_get_metarule_table() {
|
||||
DWORD arrId = TempArray(metaruleTable.size(), 0);
|
||||
int i = 0;
|
||||
for (MetaruleTableType::iterator it = metaruleTable.begin(); it != metaruleTable.end(); ++it) {
|
||||
@@ -92,7 +92,7 @@ static void sf_get_metarule_table() {
|
||||
opHandler.setReturn(arrId, DATATYPE_INT);
|
||||
}
|
||||
|
||||
static void sf_metarule_exist() {
|
||||
static void mf_metarule_exist() {
|
||||
bool result = false;
|
||||
const char* funcXName = opHandler.arg(0).asString();
|
||||
if (funcXName[0] != '\0') {
|
||||
@@ -114,70 +114,70 @@ static void sf_metarule_exist() {
|
||||
- minArgs/maxArgs - minimum and maximum number of arguments allowed for this function (max 6)
|
||||
*/
|
||||
static const SfallMetarule metaruleArray[] = {
|
||||
{"add_iface_tag", sf_add_iface_tag, 0, 0},
|
||||
{"add_g_timer_event", sf_add_g_timer_event, 2, 2},
|
||||
{"add_trait", sf_add_trait, 1, 1},
|
||||
{"art_cache_clear", sf_art_cache_flush, 0, 0},
|
||||
{"attack_is_aimed", sf_attack_is_aimed, 0, 0},
|
||||
{"create_win", sf_create_win, 5, 6},
|
||||
{"critter_inven_obj2", sf_critter_inven_obj2, 2, 2},
|
||||
{"dialog_obj", sf_get_dialog_object, 0, 0},
|
||||
{"display_stats", sf_display_stats, 0, 0}, // refresh
|
||||
{"draw_image", sf_draw_image, 1, 5},
|
||||
{"draw_image_scaled", sf_draw_image_scaled, 1, 6},
|
||||
{"exec_map_update_scripts", sf_exec_map_update_scripts, 0, 0},
|
||||
{"floor2", sf_floor2, 1, 1},
|
||||
{"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},
|
||||
{"get_outline", sf_get_outline, 1, 1},
|
||||
{"get_sfall_arg_at", sf_get_sfall_arg_at, 1, 1},
|
||||
{"get_text_width", sf_get_text_width, 1, 1},
|
||||
{"get_window_attribute", sf_get_window_attribute, 1, 2},
|
||||
{"hide_window", sf_hide_window, 0, 1},
|
||||
{"intface_hide", sf_intface_hide, 0, 0},
|
||||
{"intface_is_hidden", sf_intface_is_hidden, 0, 0},
|
||||
{"intface_redraw", sf_intface_redraw, 0, 0},
|
||||
{"intface_show", sf_intface_show, 0, 0},
|
||||
{"inventory_redraw", sf_inventory_redraw, 0, 1},
|
||||
{"item_weight", sf_item_weight, 1, 1},
|
||||
{"lock_is_jammed", sf_lock_is_jammed, 1, 1},
|
||||
{"loot_obj", sf_get_loot_object, 0, 0},
|
||||
{"message_box", sf_message_box, 1, 4},
|
||||
{"metarule_exist", sf_metarule_exist, 1, 1},
|
||||
{"npc_engine_level_up", sf_npc_engine_level_up, 1, 1},
|
||||
{"obj_under_cursor", sf_obj_under_cursor, 2, 2},
|
||||
{"objects_in_radius", sf_objects_in_radius, 3, 4},
|
||||
{"outlined_object", sf_outlined_object, 0, 0},
|
||||
{"real_dude_obj", sf_real_dude_obj, 0, 0},
|
||||
{"remove_timer_event", sf_remove_timer_event, 0, 1},
|
||||
{"set_cursor_mode", sf_set_cursor_mode, 1, 1},
|
||||
{"set_flags", sf_set_flags, 2, 2},
|
||||
{"set_iface_tag_text", sf_set_iface_tag_text, 3, 3},
|
||||
{"set_ini_setting", sf_set_ini_setting, 2, 2},
|
||||
{"set_map_enter_position", sf_set_map_enter_position, 3, 3},
|
||||
{"set_object_data", sf_set_object_data, 3, 3},
|
||||
{"set_outline", sf_set_outline, 2, 2},
|
||||
{"set_terrain_name", sf_set_terrain_name, 3, 3},
|
||||
{"set_town_title", sf_set_town_title, 2, 2},
|
||||
{"set_unique_id", sf_set_unique_id, 1, 2},
|
||||
{"set_unjam_locks_time", sf_set_unjam_locks_time, 1, 1},
|
||||
{"set_window_flag", sf_set_window_flag, 3, 3},
|
||||
{"show_window", sf_show_window, 0, 1},
|
||||
{"spatial_radius", sf_spatial_radius, 1, 1},
|
||||
{"string_compare", sf_string_compare, 2, 3},
|
||||
{"string_format", sf_string_format, 2, 5},
|
||||
{"string_to_case", sf_string_to_case, 2, 2},
|
||||
{"tile_by_position", sf_tile_by_position, 2, 2},
|
||||
{"tile_refresh_display", sf_tile_refresh_display, 0, 0},
|
||||
{"unjam_lock", sf_unjam_lock, 1, 1},
|
||||
{"unwield_slot", sf_unwield_slot, 2, 2},
|
||||
{"add_iface_tag", mf_add_iface_tag, 0, 0},
|
||||
{"add_g_timer_event", mf_add_g_timer_event, 2, 2},
|
||||
{"add_trait", mf_add_trait, 1, 1},
|
||||
{"art_cache_clear", mf_art_cache_flush, 0, 0},
|
||||
{"attack_is_aimed", mf_attack_is_aimed, 0, 0},
|
||||
{"create_win", mf_create_win, 5, 6},
|
||||
{"critter_inven_obj2", mf_critter_inven_obj2, 2, 2},
|
||||
{"dialog_obj", mf_get_dialog_object, 0, 0},
|
||||
{"display_stats", mf_display_stats, 0, 0}, // refresh
|
||||
{"draw_image", mf_draw_image, 1, 5},
|
||||
{"draw_image_scaled", mf_draw_image_scaled, 1, 6},
|
||||
{"exec_map_update_scripts", mf_exec_map_update_scripts, 0, 0},
|
||||
{"floor2", mf_floor2, 1, 1},
|
||||
{"get_current_inven_size", mf_get_current_inven_size, 1, 1},
|
||||
{"get_cursor_mode", mf_get_cursor_mode, 0, 0},
|
||||
{"get_flags", mf_get_flags, 1, 1},
|
||||
{"get_inven_ap_cost", mf_get_inven_ap_cost, 0, 0},
|
||||
{"get_map_enter_position", mf_get_map_enter_position, 0, 0},
|
||||
{"get_metarule_table", mf_get_metarule_table, 0, 0},
|
||||
{"get_object_data", mf_get_object_data, 2, 2},
|
||||
{"get_outline", mf_get_outline, 1, 1},
|
||||
{"get_sfall_arg_at", mf_get_sfall_arg_at, 1, 1},
|
||||
{"get_text_width", mf_get_text_width, 1, 1},
|
||||
{"get_window_attribute", mf_get_window_attribute, 1, 2},
|
||||
{"hide_window", mf_hide_window, 0, 1},
|
||||
{"intface_hide", mf_intface_hide, 0, 0},
|
||||
{"intface_is_hidden", mf_intface_is_hidden, 0, 0},
|
||||
{"intface_redraw", mf_intface_redraw, 0, 0},
|
||||
{"intface_show", mf_intface_show, 0, 0},
|
||||
{"inventory_redraw", mf_inventory_redraw, 0, 1},
|
||||
{"item_weight", mf_item_weight, 1, 1},
|
||||
{"lock_is_jammed", mf_lock_is_jammed, 1, 1},
|
||||
{"loot_obj", mf_get_loot_object, 0, 0},
|
||||
{"message_box", mf_message_box, 1, 4},
|
||||
{"metarule_exist", mf_metarule_exist, 1, 1},
|
||||
{"npc_engine_level_up", mf_npc_engine_level_up, 1, 1},
|
||||
{"obj_under_cursor", mf_obj_under_cursor, 2, 2},
|
||||
{"objects_in_radius", mf_objects_in_radius, 3, 4},
|
||||
{"outlined_object", mf_outlined_object, 0, 0},
|
||||
{"real_dude_obj", mf_real_dude_obj, 0, 0},
|
||||
{"remove_timer_event", mf_remove_timer_event, 0, 1},
|
||||
{"set_cursor_mode", mf_set_cursor_mode, 1, 1},
|
||||
{"set_flags", mf_set_flags, 2, 2},
|
||||
{"set_iface_tag_text", mf_set_iface_tag_text, 3, 3},
|
||||
{"set_ini_setting", mf_set_ini_setting, 2, 2},
|
||||
{"set_map_enter_position", mf_set_map_enter_position, 3, 3},
|
||||
{"set_object_data", mf_set_object_data, 3, 3},
|
||||
{"set_outline", mf_set_outline, 2, 2},
|
||||
{"set_terrain_name", mf_set_terrain_name, 3, 3},
|
||||
{"set_town_title", mf_set_town_title, 2, 2},
|
||||
{"set_unique_id", mf_set_unique_id, 1, 2},
|
||||
{"set_unjam_locks_time", mf_set_unjam_locks_time, 1, 1},
|
||||
{"set_window_flag", mf_set_window_flag, 3, 3},
|
||||
{"show_window", mf_show_window, 0, 1},
|
||||
{"spatial_radius", mf_spatial_radius, 1, 1},
|
||||
{"string_compare", mf_string_compare, 2, 3},
|
||||
{"string_format", mf_string_format, 2, 5},
|
||||
{"string_to_case", mf_string_to_case, 2, 2},
|
||||
{"tile_by_position", mf_tile_by_position, 2, 2},
|
||||
{"tile_refresh_display", mf_tile_refresh_display, 0, 0},
|
||||
{"unjam_lock", mf_unjam_lock, 1, 1},
|
||||
{"unwield_slot", mf_unwield_slot, 2, 2},
|
||||
#ifndef NDEBUG
|
||||
{"validate_test", sf_test, 2, 5},
|
||||
{"validate_test", mf_test, 2, 5},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
+83
-82
File diff suppressed because it is too large
Load Diff
@@ -31,7 +31,7 @@
|
||||
__asm call exec_script_proc_ \
|
||||
}
|
||||
|
||||
static void __stdcall RemoveScript2() {
|
||||
static void __stdcall op_remove_script2() {
|
||||
TGameObj* object = opHandler.arg(0).asObject();
|
||||
if (object) {
|
||||
if (object->scriptID != 0xFFFFFFFF) {
|
||||
@@ -43,11 +43,11 @@ static void __stdcall RemoveScript2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) RemoveScript() {
|
||||
_WRAP_OPCODE(RemoveScript2, 1, 0)
|
||||
static void __declspec(naked) op_remove_script() {
|
||||
_WRAP_OPCODE(op_remove_script2, 1, 0)
|
||||
}
|
||||
|
||||
static void __stdcall SetScript2() {
|
||||
static void __stdcall op_set_script2() {
|
||||
TGameObj* object = opHandler.arg(0).asObject();
|
||||
const ScriptValue &scriptIdxArg = opHandler.arg(1);
|
||||
|
||||
@@ -81,8 +81,8 @@ static void __stdcall SetScript2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetScript() {
|
||||
_WRAP_OPCODE(SetScript2, 2, 0)
|
||||
static void __declspec(naked) op_set_script() {
|
||||
_WRAP_OPCODE(op_set_script2, 2, 0)
|
||||
}
|
||||
|
||||
static void __stdcall op_create_spatial2() {
|
||||
@@ -120,7 +120,7 @@ static void __declspec(naked) op_create_spatial() {
|
||||
_WRAP_OPCODE(op_create_spatial2, 4, 1)
|
||||
}
|
||||
|
||||
static void sf_spatial_radius() {
|
||||
static void mf_spatial_radius() {
|
||||
TGameObj* spatialObj = opHandler.arg(0).asObject();
|
||||
if (spatialObj) {
|
||||
TScript* script;
|
||||
@@ -133,7 +133,7 @@ static void sf_spatial_radius() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __stdcall GetScript2() {
|
||||
static void __stdcall op_get_script2() {
|
||||
TGameObj* object = opHandler.arg(0).asObject();
|
||||
if (object) {
|
||||
long scriptIndex = object->script_index;
|
||||
@@ -144,11 +144,11 @@ static void __stdcall GetScript2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) GetScript() {
|
||||
_WRAP_OPCODE(GetScript2, 1, 1)
|
||||
static void __declspec(naked) op_get_script() {
|
||||
_WRAP_OPCODE(op_get_script2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall set_critter_burst_disable2() {
|
||||
static void __stdcall op_set_critter_burst_disable2() {
|
||||
TGameObj* critter = opHandler.arg(0).asObject();
|
||||
const ScriptValue &disableArg = opHandler.arg(1);
|
||||
|
||||
@@ -159,11 +159,11 @@ static void __stdcall set_critter_burst_disable2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) set_critter_burst_disable() {
|
||||
_WRAP_OPCODE(set_critter_burst_disable2, 2, 0)
|
||||
static void __declspec(naked) op_set_critter_burst_disable() {
|
||||
_WRAP_OPCODE(op_set_critter_burst_disable2, 2, 0)
|
||||
}
|
||||
|
||||
static void __stdcall get_weapon_ammo_pid2() {
|
||||
static void __stdcall op_get_weapon_ammo_pid2() {
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
if (obj) {
|
||||
opHandler.setReturn(obj->critterAP_itemAmmoPid);
|
||||
@@ -173,11 +173,11 @@ static void __stdcall get_weapon_ammo_pid2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) get_weapon_ammo_pid() {
|
||||
_WRAP_OPCODE(get_weapon_ammo_pid2, 1, 1)
|
||||
static void __declspec(naked) op_get_weapon_ammo_pid() {
|
||||
_WRAP_OPCODE(op_get_weapon_ammo_pid2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall set_weapon_ammo_pid2() {
|
||||
static void __stdcall op_set_weapon_ammo_pid2() {
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
const ScriptValue &pidArg = opHandler.arg(1);
|
||||
|
||||
@@ -188,11 +188,11 @@ static void __stdcall set_weapon_ammo_pid2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) set_weapon_ammo_pid() {
|
||||
_WRAP_OPCODE(set_weapon_ammo_pid2, 2, 0)
|
||||
static void __declspec(naked) op_set_weapon_ammo_pid() {
|
||||
_WRAP_OPCODE(op_set_weapon_ammo_pid2, 2, 0)
|
||||
}
|
||||
|
||||
static void __stdcall get_weapon_ammo_count2() {
|
||||
static void __stdcall op_get_weapon_ammo_count2() {
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
if (obj) {
|
||||
opHandler.setReturn(obj->itemCharges);
|
||||
@@ -202,11 +202,11 @@ static void __stdcall get_weapon_ammo_count2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) get_weapon_ammo_count() {
|
||||
_WRAP_OPCODE(get_weapon_ammo_count2, 1, 1)
|
||||
static void __declspec(naked) op_get_weapon_ammo_count() {
|
||||
_WRAP_OPCODE(op_get_weapon_ammo_count2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall set_weapon_ammo_count2() {
|
||||
static void __stdcall op_set_weapon_ammo_count2() {
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
const ScriptValue &countArg = opHandler.arg(1);
|
||||
|
||||
@@ -217,8 +217,8 @@ static void __stdcall set_weapon_ammo_count2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) set_weapon_ammo_count() {
|
||||
_WRAP_OPCODE(set_weapon_ammo_count2, 2, 0)
|
||||
static void __declspec(naked) op_set_weapon_ammo_count() {
|
||||
_WRAP_OPCODE(op_set_weapon_ammo_count2, 2, 0)
|
||||
}
|
||||
|
||||
enum {
|
||||
@@ -433,7 +433,7 @@ static void __declspec(naked) op_obj_is_carrying_obj() {
|
||||
_WRAP_OPCODE(op_obj_is_carrying_obj2, 2, 1)
|
||||
}
|
||||
|
||||
static void sf_critter_inven_obj2() {
|
||||
static void mf_critter_inven_obj2() {
|
||||
TGameObj* critter = opHandler.arg(0).asObject();
|
||||
const ScriptValue &slotArg = opHandler.arg(1);
|
||||
|
||||
@@ -461,13 +461,13 @@ static void sf_critter_inven_obj2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_set_outline() {
|
||||
static void mf_set_outline() {
|
||||
TGameObj* obj = opHandler.arg(0).object();
|
||||
int color = opHandler.arg(1).rawValue();
|
||||
obj->outline = color;
|
||||
}
|
||||
|
||||
static void sf_get_outline() {
|
||||
static void mf_get_outline() {
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
if (obj) {
|
||||
opHandler.setReturn(obj->outline);
|
||||
@@ -477,13 +477,13 @@ static void sf_get_outline() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_set_flags() {
|
||||
static void mf_set_flags() {
|
||||
TGameObj* obj = opHandler.arg(0).object();
|
||||
int flags = opHandler.arg(1).rawValue();
|
||||
obj->flags = flags;
|
||||
}
|
||||
|
||||
static void sf_get_flags() {
|
||||
static void mf_get_flags() {
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
if (obj) {
|
||||
opHandler.setReturn(obj->flags);
|
||||
@@ -493,11 +493,11 @@ static void sf_get_flags() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_outlined_object() {
|
||||
static void mf_outlined_object() {
|
||||
opHandler.setReturn(*ptr_outlined_object);
|
||||
}
|
||||
|
||||
static void sf_item_weight() {
|
||||
static void mf_item_weight() {
|
||||
TGameObj* item = opHandler.arg(0).asObject();
|
||||
int weight = 0;
|
||||
if (item) {
|
||||
@@ -508,11 +508,11 @@ static void sf_item_weight() {
|
||||
opHandler.setReturn(weight);
|
||||
}
|
||||
|
||||
static void sf_real_dude_obj() {
|
||||
static void mf_real_dude_obj() {
|
||||
opHandler.setReturn(RealDudeObject());
|
||||
}
|
||||
|
||||
static void sf_lock_is_jammed() {
|
||||
static void mf_lock_is_jammed() {
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
if (obj) {
|
||||
opHandler.setReturn(ObjLockIsJammed(obj));
|
||||
@@ -522,11 +522,11 @@ static void sf_lock_is_jammed() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_unjam_lock() {
|
||||
static void mf_unjam_lock() {
|
||||
ObjUnjamLock(opHandler.arg(0).object());
|
||||
}
|
||||
|
||||
static void sf_set_unjam_locks_time() {
|
||||
static void mf_set_unjam_locks_time() {
|
||||
int time = opHandler.arg(0).rawValue();
|
||||
if (time < 0 || time > 127) {
|
||||
opHandler.printOpcodeError("set_unjam_locks_time() - time argument must be in the range of 0 to 127.");
|
||||
@@ -536,7 +536,7 @@ static void sf_set_unjam_locks_time() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_get_current_inven_size() {
|
||||
static void mf_get_current_inven_size() {
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
if (obj) {
|
||||
opHandler.setReturn(sf_item_total_size(obj));
|
||||
@@ -546,11 +546,11 @@ static void sf_get_current_inven_size() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_get_dialog_object() {
|
||||
static void mf_get_dialog_object() {
|
||||
opHandler.setReturn(InDialog() ? *ptr_dialog_target : 0);
|
||||
}
|
||||
|
||||
static void sf_obj_under_cursor() {
|
||||
static void mf_obj_under_cursor() {
|
||||
const ScriptValue &crSwitchArg = opHandler.arg(0),
|
||||
&inclDudeArg = opHandler.arg(1);
|
||||
|
||||
@@ -562,14 +562,14 @@ static void sf_obj_under_cursor() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_get_loot_object() {
|
||||
static void mf_get_loot_object() {
|
||||
opHandler.setReturn((GetLoopFlags() & INTFACELOOT) ? ptr_target_stack[*ptr_target_curr_stack] : 0);
|
||||
}
|
||||
|
||||
static const char* failedLoad = "%s() - failed to load a prototype ID: %d";
|
||||
static bool protoMaxLimitPatch = false;
|
||||
|
||||
static void __stdcall get_proto_data2() {
|
||||
static void __stdcall op_get_proto_data2() {
|
||||
const ScriptValue &pidArg = opHandler.arg(0),
|
||||
&offsetArg = opHandler.arg(1);
|
||||
|
||||
@@ -595,11 +595,11 @@ static void __stdcall get_proto_data2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) get_proto_data() {
|
||||
_WRAP_OPCODE(get_proto_data2, 2, 1)
|
||||
static void __declspec(naked) op_get_proto_data() {
|
||||
_WRAP_OPCODE(op_get_proto_data2, 2, 1)
|
||||
}
|
||||
|
||||
static void __stdcall set_proto_data2() {
|
||||
static void __stdcall op_set_proto_data2() {
|
||||
const ScriptValue &pidArg = opHandler.arg(0),
|
||||
&offsetArg = opHandler.arg(1),
|
||||
&valueArg = opHandler.arg(2);
|
||||
@@ -628,11 +628,11 @@ static void __stdcall set_proto_data2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) set_proto_data() {
|
||||
_WRAP_OPCODE(set_proto_data2, 3, 0)
|
||||
static void __declspec(naked) op_set_proto_data() {
|
||||
_WRAP_OPCODE(op_set_proto_data2, 3, 0)
|
||||
}
|
||||
|
||||
static void sf_get_object_data() {
|
||||
static void mf_get_object_data() {
|
||||
DWORD result = 0;
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
const ScriptValue &offsetArg = opHandler.arg(1);
|
||||
@@ -650,7 +650,7 @@ static void sf_get_object_data() {
|
||||
opHandler.setReturn(result);
|
||||
}
|
||||
|
||||
static void sf_set_object_data() {
|
||||
static void mf_set_object_data() {
|
||||
DWORD* object_ptr = (DWORD*)opHandler.arg(0).rawValue();
|
||||
if (*(object_ptr - 1) != 0xFEEDFACE) {
|
||||
opHandler.printOpcodeError("set_object_data() - invalid object pointer.");
|
||||
@@ -660,7 +660,7 @@ static void sf_set_object_data() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_set_unique_id() {
|
||||
static void mf_set_unique_id() {
|
||||
TGameObj* obj = opHandler.arg(0).object();
|
||||
long id;
|
||||
if (opHandler.numArgs() > 1 && opHandler.arg(1).rawValue() == -1) {
|
||||
@@ -672,7 +672,7 @@ static void sf_set_unique_id() {
|
||||
opHandler.setReturn(id);
|
||||
}
|
||||
|
||||
static void sf_objects_in_radius() {
|
||||
static void mf_objects_in_radius() {
|
||||
const ScriptValue &tileArg = opHandler.arg(0),
|
||||
&radiusArg = opHandler.arg(1),
|
||||
&elevArg = opHandler.arg(2);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "Perks.h"
|
||||
#include "ScriptExtender.h"
|
||||
|
||||
static void __declspec(naked) GetPerkOwed() {
|
||||
static void __declspec(naked) op_get_perk_owed() {
|
||||
__asm {
|
||||
movzx edx, byte ptr ds:[_free_perk];
|
||||
_J_RET_VAL_TYPE(VAR_TYPE_INT);
|
||||
@@ -30,7 +30,7 @@ static void __declspec(naked) GetPerkOwed() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetPerkOwed() {
|
||||
static void __declspec(naked) op_set_perk_owed() {
|
||||
__asm {
|
||||
_GET_ARG_INT(end);
|
||||
and eax, 0xFF;
|
||||
@@ -42,7 +42,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) set_perk_freq() {
|
||||
static void __declspec(naked) op_set_perk_freq() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
@@ -54,7 +54,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __stdcall GetPerkAvailable2() {
|
||||
static void __stdcall op_get_perk_available2() {
|
||||
const ScriptValue &perkIdArg = opHandler.arg(0);
|
||||
|
||||
int result = 0;
|
||||
@@ -69,11 +69,11 @@ static void __stdcall GetPerkAvailable2() {
|
||||
opHandler.setReturn(result);
|
||||
}
|
||||
|
||||
static void __declspec(naked) GetPerkAvailable() {
|
||||
_WRAP_OPCODE(GetPerkAvailable2, 1, 1)
|
||||
static void __declspec(naked) op_get_perk_available() {
|
||||
_WRAP_OPCODE(op_get_perk_available2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall funcSetPerkName2() {
|
||||
static void __stdcall op_set_perk_name2() {
|
||||
const ScriptValue &perkIdArg = opHandler.arg(0),
|
||||
&stringArg = opHandler.arg(1);
|
||||
|
||||
@@ -84,11 +84,11 @@ static void __stdcall funcSetPerkName2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcSetPerkName() {
|
||||
_WRAP_OPCODE(funcSetPerkName2, 2, 0)
|
||||
static void __declspec(naked) op_set_perk_name() {
|
||||
_WRAP_OPCODE(op_set_perk_name2, 2, 0)
|
||||
}
|
||||
|
||||
static void __stdcall funcSetPerkDesc2() {
|
||||
static void __stdcall op_set_perk_desc2() {
|
||||
const ScriptValue &perkIdArg = opHandler.arg(0),
|
||||
&stringArg = opHandler.arg(1);
|
||||
|
||||
@@ -99,11 +99,11 @@ static void __stdcall funcSetPerkDesc2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcSetPerkDesc() {
|
||||
_WRAP_OPCODE(funcSetPerkDesc2, 2, 0)
|
||||
static void __declspec(naked) op_set_perk_desc() {
|
||||
_WRAP_OPCODE(op_set_perk_desc2, 2, 0)
|
||||
}
|
||||
|
||||
static void __declspec(naked) funcSetPerkValue() {
|
||||
static void __declspec(naked) op_set_perk_value() {
|
||||
__asm { // edx - opcode
|
||||
push edi;
|
||||
push ecx;
|
||||
@@ -125,7 +125,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __stdcall fSetSelectablePerk2() {
|
||||
static void __stdcall op_set_selectable_perk2() {
|
||||
const ScriptValue &nameArg = opHandler.arg(0),
|
||||
&activeArg = opHandler.arg(1),
|
||||
&imageArg = opHandler.arg(2),
|
||||
@@ -138,11 +138,11 @@ static void __stdcall fSetSelectablePerk2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fSetSelectablePerk() {
|
||||
_WRAP_OPCODE(fSetSelectablePerk2, 4, 0)
|
||||
static void __declspec(naked) op_set_selectable_perk() {
|
||||
_WRAP_OPCODE(op_set_selectable_perk2, 4, 0)
|
||||
}
|
||||
|
||||
static void __stdcall fSetFakePerk2() {
|
||||
static void __stdcall op_set_fake_perk2() {
|
||||
const ScriptValue &nameArg = opHandler.arg(0),
|
||||
&levelArg = opHandler.arg(1),
|
||||
&imageArg = opHandler.arg(2),
|
||||
@@ -155,11 +155,11 @@ static void __stdcall fSetFakePerk2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fSetFakePerk() {
|
||||
_WRAP_OPCODE(fSetFakePerk2, 4, 0)
|
||||
static void __declspec(naked) op_set_fake_perk() {
|
||||
_WRAP_OPCODE(op_set_fake_perk2, 4, 0)
|
||||
}
|
||||
|
||||
static void __stdcall fSetFakeTrait2() {
|
||||
static void __stdcall op_set_fake_trait2() {
|
||||
const ScriptValue &nameArg = opHandler.arg(0),
|
||||
&activeArg = opHandler.arg(1),
|
||||
&imageArg = opHandler.arg(2),
|
||||
@@ -172,11 +172,11 @@ static void __stdcall fSetFakeTrait2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fSetFakeTrait() {
|
||||
_WRAP_OPCODE(fSetFakeTrait2, 4, 0)
|
||||
static void __declspec(naked) op_set_fake_trait() {
|
||||
_WRAP_OPCODE(op_set_fake_trait2, 4, 0)
|
||||
}
|
||||
|
||||
static void __declspec(naked) fSetPerkboxTitle() {
|
||||
static void __declspec(naked) op_set_perkbox_title() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
push ebx;
|
||||
@@ -198,7 +198,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fIgnoreDefaultPerks() {
|
||||
static void __declspec(naked) op_hide_real_perks() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
call IgnoreDefaultPerks;
|
||||
@@ -207,7 +207,7 @@ static void __declspec(naked) fIgnoreDefaultPerks() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fRestoreDefaultPerks() {
|
||||
static void __declspec(naked) op_show_real_perks() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
call RestoreDefaultPerks;
|
||||
@@ -216,7 +216,7 @@ static void __declspec(naked) fRestoreDefaultPerks() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fClearSelectablePerks() {
|
||||
static void __declspec(naked) op_clear_selectable_perks() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
call ClearSelectablePerks;
|
||||
@@ -225,7 +225,7 @@ static void __declspec(naked) fClearSelectablePerks() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fHasFakePerk() {
|
||||
static void __declspec(naked) op_has_fake_perk() {
|
||||
__asm {
|
||||
push ebx;
|
||||
push ecx;
|
||||
@@ -261,7 +261,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fHasFakeTrait() {
|
||||
static void __declspec(naked) op_has_fake_trait() {
|
||||
__asm {
|
||||
push ebx;
|
||||
push ecx;
|
||||
@@ -297,7 +297,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fAddPerkMode() {
|
||||
static void __declspec(naked) op_perk_add_mode() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
@@ -309,7 +309,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) remove_trait() {
|
||||
static void __declspec(naked) op_remove_trait() {
|
||||
__asm {
|
||||
_GET_ARG_INT(end);
|
||||
test eax, eax;
|
||||
@@ -330,7 +330,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetPyromaniacMod() {
|
||||
static void __declspec(naked) op_set_pyromaniac_mod() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
@@ -343,7 +343,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fApplyHeaveHoFix() {
|
||||
static void __declspec(naked) op_apply_heaveho_fix() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
call ApplyHeaveHoFix;
|
||||
@@ -352,7 +352,7 @@ static void __declspec(naked) fApplyHeaveHoFix() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetSwiftLearnerMod() {
|
||||
static void __declspec(naked) op_set_swiftlearner_mod() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
@@ -377,7 +377,7 @@ jneg:
|
||||
}
|
||||
}
|
||||
|
||||
static void __fastcall SetPerkLevelMod2(long mod) {
|
||||
static void __fastcall SetPerkLevelMod(long mod) {
|
||||
static bool perkLevelModPatch = false;
|
||||
if (mod < -25 || mod > 25) return;
|
||||
PerkLevelMod = mod;
|
||||
@@ -387,19 +387,19 @@ static void __fastcall SetPerkLevelMod2(long mod) {
|
||||
HookCall(0x49687F, perk_can_add_hook);
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetPerkLevelMod() {
|
||||
static void __declspec(naked) op_set_perk_level_mod() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
mov ecx, eax;
|
||||
call SetPerkLevelMod2;
|
||||
call SetPerkLevelMod;
|
||||
end:
|
||||
mov ecx, esi;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_add_trait() {
|
||||
static void mf_add_trait() {
|
||||
if (*(DWORD*)(*(DWORD*)_obj_dude + 0x64) != PID_Player) {
|
||||
opHandler.printOpcodeError("add_trait() - traits can be added only to the player.");
|
||||
opHandler.setReturn(-1);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
static void __declspec(naked) create_array() {
|
||||
static void __declspec(naked) op_create_array() {
|
||||
__asm {
|
||||
pushaop;
|
||||
mov edi, eax;
|
||||
@@ -55,7 +55,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) set_array() {
|
||||
static void __declspec(naked) op_set_array() {
|
||||
__asm {
|
||||
pushaop;
|
||||
mov ebp, eax;
|
||||
@@ -130,7 +130,7 @@ static char* __stdcall GetArraySubstr(const char* str, size_t index) {
|
||||
return gTextBuffer; // returns char of string
|
||||
}
|
||||
|
||||
static void __declspec(naked) get_array() {
|
||||
static void __declspec(naked) op_get_array() {
|
||||
__asm {
|
||||
pushaop;
|
||||
mov ebp, eax;
|
||||
@@ -212,7 +212,7 @@ notstring:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) free_array() {
|
||||
static void __declspec(naked) op_free_array() {
|
||||
__asm {
|
||||
pushaop;
|
||||
mov edi, eax;
|
||||
@@ -230,7 +230,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) len_array() {
|
||||
static void __declspec(naked) op_len_array() {
|
||||
__asm {
|
||||
pushaop;
|
||||
mov edi, eax;
|
||||
@@ -257,7 +257,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) resize_array() {
|
||||
static void __declspec(naked) op_resize_array() {
|
||||
__asm {
|
||||
pushaop;
|
||||
mov ebp, eax;
|
||||
@@ -288,7 +288,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) temp_array() {
|
||||
static void __declspec(naked) op_temp_array() {
|
||||
__asm {
|
||||
pushaop;
|
||||
mov edi, eax;
|
||||
@@ -325,7 +325,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fix_array() {
|
||||
static void __declspec(naked) op_fix_array() {
|
||||
__asm {
|
||||
pushaop;
|
||||
mov edi, eax;
|
||||
@@ -343,7 +343,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) scan_array() {
|
||||
static void __declspec(naked) op_scan_array() {
|
||||
__asm {
|
||||
pushaop;
|
||||
mov ebp, eax;
|
||||
@@ -513,7 +513,7 @@ struct ListId {
|
||||
};
|
||||
static std::vector<ListId> mList;
|
||||
|
||||
static void FillListVector(DWORD type, std::vector<TGameObj*>& vec) {
|
||||
static void __stdcall FillListVector(DWORD type, std::vector<TGameObj*>& vec) {
|
||||
vec.reserve(100);
|
||||
if (type == 6) {
|
||||
TScript* scriptPtr;
|
||||
@@ -573,7 +573,7 @@ static DWORD __stdcall ListAsArray(DWORD type) {
|
||||
return id;
|
||||
}
|
||||
|
||||
static void __stdcall list_as_array2() {
|
||||
static void __stdcall op_list_as_array2() {
|
||||
const ScriptValue &typeArg = opHandler.arg(0);
|
||||
|
||||
if (typeArg.isInt()) {
|
||||
@@ -585,8 +585,8 @@ static void __stdcall list_as_array2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) list_as_array() {
|
||||
_WRAP_OPCODE(list_as_array2, 1, 1)
|
||||
static void __declspec(naked) op_list_as_array() {
|
||||
_WRAP_OPCODE(op_list_as_array2, 1, 1)
|
||||
}
|
||||
|
||||
static DWORD __stdcall ListBegin(DWORD type) {
|
||||
@@ -597,7 +597,7 @@ static DWORD __stdcall ListBegin(DWORD type) {
|
||||
return listID;
|
||||
}
|
||||
|
||||
static void __stdcall list_begin2() {
|
||||
static void __stdcall op_list_begin2() {
|
||||
const ScriptValue &typeArg = opHandler.arg(0);
|
||||
|
||||
if (typeArg.isInt()) {
|
||||
@@ -608,15 +608,15 @@ static void __stdcall list_begin2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) list_begin() {
|
||||
_WRAP_OPCODE(list_begin2, 1, 1)
|
||||
static void __declspec(naked) op_list_begin() {
|
||||
_WRAP_OPCODE(op_list_begin2, 1, 1)
|
||||
}
|
||||
|
||||
static TGameObj* __stdcall ListNext(sList* list) {
|
||||
return (!list || list->pos == list->len) ? 0 : list->obj[list->pos++];
|
||||
}
|
||||
|
||||
static void __stdcall list_next2() {
|
||||
static void __stdcall op_list_next2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0);
|
||||
|
||||
if (idArg.isInt()) {
|
||||
@@ -639,8 +639,8 @@ static void __stdcall list_next2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) list_next() {
|
||||
_WRAP_OPCODE(list_next2, 1, 1)
|
||||
static void __declspec(naked) op_list_next() {
|
||||
_WRAP_OPCODE(op_list_next2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall ListEnd(DWORD id) {
|
||||
@@ -655,7 +655,7 @@ static void __stdcall ListEnd(DWORD id) {
|
||||
}
|
||||
}
|
||||
|
||||
static void __stdcall list_end2() {
|
||||
static void __stdcall op_list_end2() {
|
||||
const ScriptValue &idArg = opHandler.arg(0);
|
||||
|
||||
if (idArg.isInt()) {
|
||||
@@ -665,6 +665,6 @@ static void __stdcall list_end2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) list_end() {
|
||||
_WRAP_OPCODE(list_end2, 1, 0)
|
||||
static void __declspec(naked) op_list_end() {
|
||||
_WRAP_OPCODE(op_list_end2, 1, 0)
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ static void __declspec(naked) op_strlen() {
|
||||
_WRAP_OPCODE(op_strlen2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall str_to_int2() {
|
||||
static void __stdcall op_atoi2() {
|
||||
const ScriptValue &strArg = opHandler.arg(0);
|
||||
|
||||
if (strArg.isString()) {
|
||||
@@ -120,11 +120,11 @@ static void __stdcall str_to_int2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) str_to_int() {
|
||||
_WRAP_OPCODE(str_to_int2, 1, 1)
|
||||
static void __declspec(naked) op_atoi() {
|
||||
_WRAP_OPCODE(op_atoi2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall str_to_flt2() {
|
||||
static void __stdcall op_atof2() {
|
||||
const ScriptValue &strArg = opHandler.arg(0);
|
||||
|
||||
if (strArg.isString()) {
|
||||
@@ -138,8 +138,8 @@ static void __stdcall str_to_flt2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) str_to_flt() {
|
||||
_WRAP_OPCODE(str_to_flt2, 1, 1)
|
||||
static void __declspec(naked) op_atof() {
|
||||
_WRAP_OPCODE(op_atof2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall op_ord2() {
|
||||
@@ -198,7 +198,7 @@ static int __stdcall StringSplit(const char* str, const char* split) {
|
||||
return id;
|
||||
}
|
||||
|
||||
static void __stdcall string_split2() {
|
||||
static void __stdcall op_string_split2() {
|
||||
const ScriptValue &strArg = opHandler.arg(0),
|
||||
&splitArg = opHandler.arg(1);
|
||||
|
||||
@@ -210,8 +210,8 @@ static void __stdcall string_split2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) string_split() {
|
||||
_WRAP_OPCODE(string_split2, 2, 1)
|
||||
static void __declspec(naked) op_string_split() {
|
||||
_WRAP_OPCODE(op_string_split2, 2, 1)
|
||||
}
|
||||
|
||||
static char* __stdcall SubString(const char* str, int startPos, int length) {
|
||||
@@ -259,7 +259,7 @@ static void __declspec(naked) op_substr() {
|
||||
_WRAP_OPCODE(op_substr2, 3, 1)
|
||||
}
|
||||
|
||||
static void sf_string_compare() {
|
||||
static void mf_string_compare() {
|
||||
const ScriptValue &str1Arg = opHandler.arg(0),
|
||||
&str2Arg = opHandler.arg(1);
|
||||
|
||||
@@ -281,7 +281,7 @@ invalidArgs:
|
||||
}
|
||||
|
||||
// A safer version of sprintf for using in user scripts.
|
||||
static char* __stdcall mysprintf(const char* format, DWORD value, DWORD valueType) {
|
||||
static char* __stdcall sprintf_lite(const char* format, DWORD value, DWORD valueType) {
|
||||
valueType = valueType & 0xFFFF; // use lower 2 bytes
|
||||
int fmtlen = strlen(format);
|
||||
int buflen = fmtlen + 1;
|
||||
@@ -397,7 +397,7 @@ notstring:
|
||||
call interpretGetString_; // format string ptr
|
||||
push esi; // arg 2 - value
|
||||
push eax; // arg 1 - format str
|
||||
call mysprintf;
|
||||
call sprintf_lite;
|
||||
mov edx, eax;
|
||||
mov eax, edi;
|
||||
call interpretAddString_;
|
||||
@@ -413,7 +413,7 @@ fail:
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_string_format() {
|
||||
static void mf_string_format() {
|
||||
const ScriptValue &fmtArg = opHandler.arg(0);
|
||||
|
||||
if (!fmtArg.isString()) {
|
||||
@@ -515,7 +515,7 @@ static void __declspec(naked) op_message_str_game() {
|
||||
_WRAP_OPCODE(op_message_str_game2, 2, 1)
|
||||
}
|
||||
|
||||
static void sf_get_text_width() {
|
||||
static void mf_get_text_width() {
|
||||
const ScriptValue &textArg = opHandler.arg(0);
|
||||
|
||||
if (textArg.isString()) {
|
||||
@@ -528,7 +528,7 @@ static void sf_get_text_width() {
|
||||
|
||||
static std::string strToCase;
|
||||
|
||||
static void sf_string_to_case() {
|
||||
static void mf_string_to_case() {
|
||||
strToCase = opHandler.arg(0).strValue();
|
||||
std::transform(strToCase.begin(), strToCase.end(), strToCase.begin(), opHandler.arg(1).rawValue() ? ::toupper : ::tolower);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ const char* invalidStat = "%s() - stat number out of range.";
|
||||
const char* objNotCritter = "%s() - the object is not a critter.";
|
||||
|
||||
// stat_funcs
|
||||
static void __stdcall SetPCBaseStat2() {
|
||||
static void __stdcall op_set_pc_base_stat2() {
|
||||
const ScriptValue &statArg = opHandler.arg(0),
|
||||
&valArg = opHandler.arg(1);
|
||||
|
||||
@@ -46,11 +46,11 @@ static void __stdcall SetPCBaseStat2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetPCBaseStat() {
|
||||
_WRAP_OPCODE(SetPCBaseStat2, 2, 0)
|
||||
static void __declspec(naked) op_set_pc_base_stat() {
|
||||
_WRAP_OPCODE(op_set_pc_base_stat2, 2, 0)
|
||||
}
|
||||
|
||||
static void __stdcall SetPCExtraStat2() {
|
||||
static void __stdcall op_set_pc_extra_stat2() {
|
||||
const ScriptValue &statArg = opHandler.arg(0),
|
||||
&valArg = opHandler.arg(1);
|
||||
|
||||
@@ -66,11 +66,11 @@ static void __stdcall SetPCExtraStat2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetPCExtraStat() {
|
||||
_WRAP_OPCODE(SetPCExtraStat2, 2, 0)
|
||||
static void __declspec(naked) op_set_pc_extra_stat() {
|
||||
_WRAP_OPCODE(op_set_pc_extra_stat2, 2, 0)
|
||||
}
|
||||
|
||||
static void __stdcall GetPCBaseStat2() {
|
||||
static void __stdcall op_get_pc_base_stat2() {
|
||||
int value = 0;
|
||||
const ScriptValue &statArg = opHandler.arg(0);
|
||||
|
||||
@@ -88,11 +88,11 @@ static void __stdcall GetPCBaseStat2() {
|
||||
|
||||
}
|
||||
|
||||
static void __declspec(naked) GetPCBaseStat() {
|
||||
_WRAP_OPCODE(GetPCBaseStat2, 1, 1)
|
||||
static void __declspec(naked) op_get_pc_base_stat() {
|
||||
_WRAP_OPCODE(op_get_pc_base_stat2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall GetPCExtraStat2() {
|
||||
static void __stdcall op_get_pc_extra_stat2() {
|
||||
int value = 0;
|
||||
const ScriptValue &statArg = opHandler.arg(0);
|
||||
|
||||
@@ -109,11 +109,11 @@ static void __stdcall GetPCExtraStat2() {
|
||||
opHandler.setReturn(value, DATATYPE_INT);
|
||||
}
|
||||
|
||||
static void __declspec(naked) GetPCExtraStat() {
|
||||
_WRAP_OPCODE(GetPCExtraStat2, 1, 1)
|
||||
static void __declspec(naked) op_get_pc_extra_stat() {
|
||||
_WRAP_OPCODE(op_get_pc_extra_stat2, 1, 1)
|
||||
}
|
||||
|
||||
static void __stdcall SetCritterBaseStat2() {
|
||||
static void __stdcall op_set_critter_base_stat2() {
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
const ScriptValue &statArg = opHandler.arg(1),
|
||||
&valArg = opHandler.arg(2);
|
||||
@@ -135,11 +135,11 @@ static void __stdcall SetCritterBaseStat2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetCritterBaseStat() {
|
||||
_WRAP_OPCODE(SetCritterBaseStat2, 3, 0)
|
||||
static void __declspec(naked) op_set_critter_base_stat() {
|
||||
_WRAP_OPCODE(op_set_critter_base_stat2, 3, 0)
|
||||
}
|
||||
|
||||
static void __stdcall SetCritterExtraStat2() {
|
||||
static void __stdcall op_set_critter_extra_stat2() {
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
const ScriptValue &statArg = opHandler.arg(1),
|
||||
&valArg = opHandler.arg(2);
|
||||
@@ -161,11 +161,11 @@ static void __stdcall SetCritterExtraStat2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetCritterExtraStat() {
|
||||
_WRAP_OPCODE(SetCritterExtraStat2, 3, 0)
|
||||
static void __declspec(naked) op_set_critter_extra_stat() {
|
||||
_WRAP_OPCODE(op_set_critter_extra_stat2, 3, 0)
|
||||
}
|
||||
|
||||
static void __stdcall GetCritterBaseStat2() {
|
||||
static void __stdcall op_get_critter_base_stat2() {
|
||||
int result = 0;
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
const ScriptValue &statArg = opHandler.arg(1);
|
||||
@@ -188,11 +188,11 @@ static void __stdcall GetCritterBaseStat2() {
|
||||
opHandler.setReturn(result, DATATYPE_INT);
|
||||
}
|
||||
|
||||
static void __declspec(naked) GetCritterBaseStat() {
|
||||
_WRAP_OPCODE(GetCritterBaseStat2, 2, 1)
|
||||
static void __declspec(naked) op_get_critter_base_stat() {
|
||||
_WRAP_OPCODE(op_get_critter_base_stat2, 2, 1)
|
||||
}
|
||||
|
||||
static void __stdcall GetCritterExtraStat2() {
|
||||
static void __stdcall op_get_critter_extra_stat2() {
|
||||
int result = 0;
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
const ScriptValue &statArg = opHandler.arg(1);
|
||||
@@ -215,11 +215,11 @@ static void __stdcall GetCritterExtraStat2() {
|
||||
opHandler.setReturn(result, DATATYPE_INT);
|
||||
}
|
||||
|
||||
static void __declspec(naked) GetCritterExtraStat() {
|
||||
_WRAP_OPCODE(GetCritterExtraStat2, 2, 1)
|
||||
static void __declspec(naked) op_get_critter_extra_stat() {
|
||||
_WRAP_OPCODE(op_get_critter_extra_stat2, 2, 1)
|
||||
}
|
||||
|
||||
static void __declspec(naked) set_critter_skill_points() {
|
||||
static void __declspec(naked) op_set_critter_skill_points() {
|
||||
__asm {
|
||||
pushaop;
|
||||
//Get function args
|
||||
@@ -269,7 +269,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) get_critter_skill_points() {
|
||||
static void __declspec(naked) op_get_critter_skill_points() {
|
||||
__asm {
|
||||
pushaop;
|
||||
//Get function args
|
||||
@@ -318,7 +318,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) set_available_skill_points() {
|
||||
static void __declspec(naked) op_set_available_skill_points() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
@@ -331,14 +331,14 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) get_available_skill_points() {
|
||||
static void __declspec(naked) op_get_available_skill_points() {
|
||||
__asm {
|
||||
mov edx, dword ptr ds:[_curr_pc_stat];
|
||||
_J_RET_VAL_TYPE(VAR_TYPE_INT);
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) mod_skill_points_per_level() {
|
||||
static void __declspec(naked) op_mod_skill_points_per_level() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
@@ -358,7 +358,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) GetCritterAP() {
|
||||
static void __declspec(naked) op_get_critter_current_ap() {
|
||||
__asm {
|
||||
_GET_ARG_INT(fail); // Get function arg and check if valid
|
||||
test eax, eax;
|
||||
@@ -377,7 +377,7 @@ fail:
|
||||
}
|
||||
}
|
||||
|
||||
static void __stdcall SetCritterAP2() {
|
||||
static void __stdcall op_set_critter_current_ap2() {
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
const ScriptValue &apArg = opHandler.arg(1);
|
||||
|
||||
@@ -396,11 +396,11 @@ static void __stdcall SetCritterAP2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetCritterAP() {
|
||||
_WRAP_OPCODE(SetCritterAP2, 2, 0)
|
||||
static void __declspec(naked) op_set_critter_current_ap() {
|
||||
_WRAP_OPCODE(op_set_critter_current_ap2, 2, 0)
|
||||
}
|
||||
|
||||
static void __declspec(naked) fSetPickpocketMax() {
|
||||
static void __declspec(naked) op_set_pickpocket_max() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
@@ -417,7 +417,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fSetHitChanceMax() {
|
||||
static void __declspec(naked) op_set_hit_chance_max() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
@@ -434,7 +434,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __stdcall SetCritterHitChance2() {
|
||||
static void __stdcall op_set_critter_hit_chance_mod2() {
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
const ScriptValue &maxArg = opHandler.arg(1),
|
||||
&modArg = opHandler.arg(2);
|
||||
@@ -450,11 +450,11 @@ static void __stdcall SetCritterHitChance2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetCritterHitChance() {
|
||||
_WRAP_OPCODE(SetCritterHitChance2, 3, 0)
|
||||
static void __declspec(naked) op_set_critter_hit_chance_mod() {
|
||||
_WRAP_OPCODE(op_set_critter_hit_chance_mod2, 3, 0)
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetBaseHitChance() {
|
||||
static void __declspec(naked) op_set_base_hit_chance_mod() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG(ecx, esi);
|
||||
@@ -472,7 +472,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __stdcall SetCritterPickpocket2() {
|
||||
static void __stdcall op_set_critter_pickpocket_mod2() {
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
const ScriptValue &maxArg = opHandler.arg(1),
|
||||
&modArg = opHandler.arg(2);
|
||||
@@ -488,11 +488,11 @@ static void __stdcall SetCritterPickpocket2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetCritterPickpocket() {
|
||||
_WRAP_OPCODE(SetCritterPickpocket2, 3, 0)
|
||||
static void __declspec(naked) op_set_critter_pickpocket_mod() {
|
||||
_WRAP_OPCODE(op_set_critter_pickpocket_mod2, 3, 0)
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetBasePickpocket() {
|
||||
static void __declspec(naked) op_set_base_pickpocket_mod() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG(ecx, esi);
|
||||
@@ -510,7 +510,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __stdcall SetCritterSkillMod2() {
|
||||
static void __stdcall op_set_critter_skill_mod2() {
|
||||
TGameObj* obj = opHandler.arg(0).asObject();
|
||||
const ScriptValue &maxArg = opHandler.arg(1);
|
||||
|
||||
@@ -525,11 +525,11 @@ static void __stdcall SetCritterSkillMod2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetCritterSkillMod() {
|
||||
_WRAP_OPCODE(SetCritterSkillMod2, 2, 0)
|
||||
static void __declspec(naked) op_set_critter_skill_mod() {
|
||||
_WRAP_OPCODE(op_set_critter_skill_mod2, 2, 0)
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetBaseSkillMod() { // same as set_skill_max
|
||||
static void __declspec(naked) op_set_base_skill_mod() { // same as set_skill_max
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
@@ -542,7 +542,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fSetSkillMax() {
|
||||
static void __declspec(naked) op_set_skill_max() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
_GET_ARG_INT(end);
|
||||
@@ -558,7 +558,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetStatMax() {
|
||||
static void __declspec(naked) op_set_stat_max() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG(ecx, esi);
|
||||
@@ -578,7 +578,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetStatMin() {
|
||||
static void __declspec(naked) op_set_stat_min() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG(ecx, esi);
|
||||
@@ -598,7 +598,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fSetPCStatMax() {
|
||||
static void __declspec(naked) op_set_pc_stat_max() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG(ecx, esi);
|
||||
@@ -615,7 +615,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fSetPCStatMin() {
|
||||
static void __declspec(naked) op_set_pc_stat_min() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG(ecx, esi);
|
||||
@@ -632,7 +632,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fSetNPCStatMax() {
|
||||
static void __declspec(naked) op_set_npc_stat_max() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG(ecx, esi);
|
||||
@@ -649,7 +649,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) fSetNPCStatMin() {
|
||||
static void __declspec(naked) op_set_npc_stat_min() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG(ecx, esi);
|
||||
@@ -681,7 +681,7 @@ static void __declspec(naked) statPCAddExperienceCheckPMs_hack() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __stdcall SetXpMod2() {
|
||||
static void __stdcall op_set_xp_mod2() {
|
||||
const ScriptValue &pctArg = opHandler.arg(0);
|
||||
|
||||
if (pctArg.isInt()) {
|
||||
@@ -697,6 +697,6 @@ static void __stdcall SetXpMod2() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetXpMod() {
|
||||
_WRAP_OPCODE(SetXpMod2, 1, 0)
|
||||
static void __declspec(naked) op_set_xp_mod() {
|
||||
_WRAP_OPCODE(op_set_xp_mod2, 1, 0)
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ noCar:
|
||||
}
|
||||
}
|
||||
|
||||
static void __stdcall ForceEncounter2() {
|
||||
static void __stdcall op_force_encounter2() {
|
||||
if (ForceEncounterFlags & (1 << 31)) return; // wait prev. encounter
|
||||
|
||||
const ScriptValue &mapIDArg = opHandler.arg(0);
|
||||
@@ -107,16 +107,16 @@ invalidArgs:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ForceEncounter() {
|
||||
_WRAP_OPCODE(ForceEncounter2, 1, 0)
|
||||
static void __declspec(naked) op_force_encounter() {
|
||||
_WRAP_OPCODE(op_force_encounter2, 1, 0)
|
||||
}
|
||||
|
||||
static void __declspec(naked) ForceEncounterWithFlags() {
|
||||
_WRAP_OPCODE(ForceEncounter2, 2, 0)
|
||||
static void __declspec(naked) op_force_encounter_with_flags() {
|
||||
_WRAP_OPCODE(op_force_encounter2, 2, 0)
|
||||
}
|
||||
|
||||
// world_map_functions
|
||||
static void __declspec(naked) funcInWorldMap() {
|
||||
static void __declspec(naked) op_in_world_map() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
call InWorldMap;
|
||||
@@ -128,7 +128,7 @@ static void __declspec(naked) funcInWorldMap() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) GetGameMode() {
|
||||
static void __declspec(naked) op_get_game_mode() {
|
||||
__asm {
|
||||
mov esi, ecx;
|
||||
call GetLoopFlags;
|
||||
@@ -140,7 +140,7 @@ static void __declspec(naked) GetGameMode() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) GetWorldMapXPos() {
|
||||
static void __declspec(naked) op_get_world_map_x_pos() {
|
||||
__asm {
|
||||
mov edx, ds:[_world_xpos];
|
||||
_J_RET_VAL_TYPE(VAR_TYPE_INT);
|
||||
@@ -148,7 +148,7 @@ static void __declspec(naked) GetWorldMapXPos() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) GetWorldMapYPos() {
|
||||
static void __declspec(naked) op_get_world_map_y_pos() {
|
||||
__asm {
|
||||
mov edx, ds:[_world_ypos];
|
||||
_J_RET_VAL_TYPE(VAR_TYPE_INT);
|
||||
@@ -156,7 +156,7 @@ static void __declspec(naked) GetWorldMapYPos() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) SetWorldMapPos() {
|
||||
static void __declspec(naked) op_set_world_map_pos() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG(ecx, esi); // get y value
|
||||
@@ -172,7 +172,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) set_map_time_multi() {
|
||||
static void __declspec(naked) op_set_map_time_multi() {
|
||||
__asm {
|
||||
push ebx;
|
||||
push ecx;
|
||||
@@ -202,7 +202,7 @@ fail:
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_set_map_enter_position() {
|
||||
static void mf_set_map_enter_position() {
|
||||
int tile = opHandler.arg(0).rawValue();
|
||||
int elev = opHandler.arg(1).rawValue();
|
||||
int rot = opHandler.arg(2).rawValue();
|
||||
@@ -218,7 +218,7 @@ static void sf_set_map_enter_position() {
|
||||
}
|
||||
}
|
||||
|
||||
static void sf_get_map_enter_position() {
|
||||
static void mf_get_map_enter_position() {
|
||||
DWORD id = TempArray(3, 0);
|
||||
arrays[id].val[0].set((long)*ptr_tile);
|
||||
arrays[id].val[1].set((long)*ptr_elevation);
|
||||
@@ -226,14 +226,14 @@ static void sf_get_map_enter_position() {
|
||||
opHandler.setReturn(id);
|
||||
}
|
||||
|
||||
static void sf_tile_by_position() {
|
||||
static void mf_tile_by_position() {
|
||||
opHandler.setReturn(TileNum(opHandler.arg(0).rawValue(), opHandler.arg(1).rawValue()));
|
||||
}
|
||||
|
||||
static void sf_set_terrain_name() {
|
||||
static void mf_set_terrain_name() {
|
||||
Wmap_SetTerrainTypeName(opHandler.arg(0).rawValue(), opHandler.arg(1).rawValue(), opHandler.arg(2).strValue());
|
||||
}
|
||||
|
||||
static void sf_set_town_title() {
|
||||
static void mf_set_town_title() {
|
||||
Wmap_SetCustomAreaTitle(opHandler.arg(0).rawValue(), opHandler.arg(1).strValue());
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user