Skip to content

Commit

Permalink
Renamed all script opcode handlers with op_ prefix
Browse files Browse the repository at this point in the history
Renamed all metarule functions with mf_ prefix.
  • Loading branch information
NovaRain committed May 20, 2020
1 parent 6bb56b0 commit b263b69
Show file tree
Hide file tree
Showing 27 changed files with 690 additions and 690 deletions.
20 changes: 10 additions & 10 deletions sfall/Modules/Scripting/Handlers/Anims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ bool checkCombatMode() {
return (regAnimCombatCheck & fo::var::combat_state) != 0;
}

void sf_reg_anim_combat_check(OpcodeContext& ctx) {
void op_reg_anim_combat_check(OpcodeContext& ctx) {
RegAnimCombatCheck(ctx.arg(0).rawValue());
}

void sf_reg_anim_destroy(OpcodeContext& ctx) {
void op_reg_anim_destroy(OpcodeContext& ctx) {
if (!checkCombatMode()) {
auto obj = ctx.arg(0).object();
fo::func::register_object_must_erase(obj);
}
}

void sf_reg_anim_animate_and_hide(OpcodeContext& ctx) {
void op_reg_anim_animate_and_hide(OpcodeContext& ctx) {
if (!checkCombatMode()) {
auto obj = ctx.arg(0).object();
int animId = ctx.arg(1).rawValue(),
Expand All @@ -72,7 +72,7 @@ void sf_reg_anim_animate_and_hide(OpcodeContext& ctx) {
}
}

void sf_reg_anim_light(OpcodeContext& ctx) {
void op_reg_anim_light(OpcodeContext& ctx) {
if (!checkCombatMode()) {
auto obj = ctx.arg(0).object();
int radius = ctx.arg(1).rawValue(),
Expand All @@ -87,7 +87,7 @@ void sf_reg_anim_light(OpcodeContext& ctx) {
}
}

void sf_reg_anim_change_fid(OpcodeContext& ctx) {
void op_reg_anim_change_fid(OpcodeContext& ctx) {
if (!checkCombatMode()) {
auto obj = ctx.arg(0).object();
int fid = ctx.arg(1).rawValue(),
Expand All @@ -97,7 +97,7 @@ void sf_reg_anim_change_fid(OpcodeContext& ctx) {
}
}

void sf_reg_anim_take_out(OpcodeContext& ctx) {
void op_reg_anim_take_out(OpcodeContext& ctx) {
if (!checkCombatMode()) {
auto obj = ctx.arg(0).object();
int holdFrame = ctx.arg(1).rawValue(),
Expand All @@ -107,7 +107,7 @@ void sf_reg_anim_take_out(OpcodeContext& ctx) {
}
}

void sf_reg_anim_turn_towards(OpcodeContext& ctx) {
void op_reg_anim_turn_towards(OpcodeContext& ctx) {
if (!checkCombatMode()) {
auto obj = ctx.arg(0).object();
int tile = ctx.arg(1).rawValue(),
Expand All @@ -124,7 +124,7 @@ static void __declspec(naked) ExecuteCallback() {
}
}

void sf_reg_anim_callback(OpcodeContext& ctx) {
void op_reg_anim_callback(OpcodeContext& ctx) {
fo::func::register_object_call(
reinterpret_cast<long*>(ctx.program()),
reinterpret_cast<long*>(ctx.arg(0).rawValue()), // callback procedure
Expand All @@ -133,7 +133,7 @@ void sf_reg_anim_callback(OpcodeContext& ctx) {
);
}

void sf_explosions_metarule(OpcodeContext& ctx) {
void op_explosions_metarule(OpcodeContext& ctx) {
int mode = ctx.arg(0).rawValue(),
result = ExplosionsMetaruleFunc(mode, ctx.arg(1).rawValue(), ctx.arg(2).rawValue());

Expand All @@ -143,7 +143,7 @@ void sf_explosions_metarule(OpcodeContext& ctx) {
ctx.setReturn(result);
}

void sf_art_cache_flush(OpcodeContext& ctx) {
void mf_art_cache_flush(OpcodeContext& ctx) {
__asm call fo::funcoffs::art_flush_;
}

Expand Down
24 changes: 12 additions & 12 deletions sfall/Modules/Scripting/Handlers/Anims.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ void RegAnimCombatCheck(DWORD newValue);

class OpcodeContext;

void sf_reg_anim_combat_check(OpcodeContext&);
void sf_reg_anim_destroy(OpcodeContext&);
void sf_reg_anim_animate_and_hide(OpcodeContext&);
void sf_reg_anim_light(OpcodeContext&);
void sf_reg_anim_change_fid(OpcodeContext&);
void sf_reg_anim_take_out(OpcodeContext&);
void sf_reg_anim_turn_towards(OpcodeContext&);
void sf_reg_anim_callback(OpcodeContext&);

void sf_explosions_metarule(OpcodeContext&);

void sf_art_cache_flush(OpcodeContext&);
void op_reg_anim_combat_check(OpcodeContext&);
void op_reg_anim_destroy(OpcodeContext&);
void op_reg_anim_animate_and_hide(OpcodeContext&);
void op_reg_anim_light(OpcodeContext&);
void op_reg_anim_change_fid(OpcodeContext&);
void op_reg_anim_take_out(OpcodeContext&);
void op_reg_anim_turn_towards(OpcodeContext&);
void op_reg_anim_callback(OpcodeContext&);

void op_explosions_metarule(OpcodeContext&);

void mf_art_cache_flush(OpcodeContext&);

}
}
34 changes: 17 additions & 17 deletions sfall/Modules/Scripting/Handlers/Arrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ namespace sfall
namespace script
{

void sf_create_array(OpcodeContext& ctx) {
void op_create_array(OpcodeContext& ctx) {
auto arrayId = CreateArray(ctx.arg(0).rawValue(), ctx.arg(1).rawValue());
ctx.setReturn(arrayId);
}

void sf_set_array(OpcodeContext& ctx) {
void op_set_array(OpcodeContext& ctx) {
SetArray(
ctx.arg(0).rawValue(),
ctx.arg(1),
Expand All @@ -47,7 +47,7 @@ void sf_set_array(OpcodeContext& ctx) {
so it works as get_array if first argument is int and as substr(x, y, 1) if first argument is string
example: vartext[5]
*/
void sf_get_array(OpcodeContext& ctx) {
void op_get_array(OpcodeContext& ctx) {
if (ctx.arg(0).isInt()) {
ctx.setReturn(
GetArray(ctx.arg(0).rawValue(), ctx.arg(1))
Expand All @@ -70,54 +70,54 @@ void sf_get_array(OpcodeContext& ctx) {
}
}

void sf_free_array(OpcodeContext& ctx) {
void op_free_array(OpcodeContext& ctx) {
FreeArray(ctx.arg(0).rawValue());
}

void sf_len_array(OpcodeContext& ctx) {
void op_len_array(OpcodeContext& ctx) {
ctx.setReturn(
LenArray(ctx.arg(0).rawValue())
);
}

void sf_resize_array(OpcodeContext& ctx) {
void op_resize_array(OpcodeContext& ctx) {
if (ResizeArray(ctx.arg(0).rawValue(), ctx.arg(1).rawValue())) {
ctx.printOpcodeError("%s() - array sorting error.", ctx.getOpcodeName());
}
}

void sf_temp_array(OpcodeContext& ctx) {
void op_temp_array(OpcodeContext& ctx) {
auto arrayId = TempArray(ctx.arg(0).rawValue(), ctx.arg(1).rawValue());
ctx.setReturn(arrayId);
}

void sf_fix_array(OpcodeContext& ctx) {
void op_fix_array(OpcodeContext& ctx) {
FixArray(ctx.arg(0).rawValue());
}

void sf_scan_array(OpcodeContext& ctx) {
void op_scan_array(OpcodeContext& ctx) {
ctx.setReturn(
ScanArray(ctx.arg(0).rawValue(), ctx.arg(1))
);
}

void sf_save_array(OpcodeContext& ctx) {
void op_save_array(OpcodeContext& ctx) {
SaveArray(ctx.arg(0), ctx.arg(1).rawValue());
}

void sf_load_array(OpcodeContext& ctx) {
void op_load_array(OpcodeContext& ctx) {
ctx.setReturn(
LoadArray(ctx.arg(0))
);
}

void sf_get_array_key(OpcodeContext& ctx) {
void op_get_array_key(OpcodeContext& ctx) {
ctx.setReturn(
GetArrayKey(ctx.arg(0).rawValue(), ctx.arg(1).rawValue())
);
}

void sf_stack_array(OpcodeContext& ctx) {
void op_stack_array(OpcodeContext& ctx) {
ctx.setReturn(
StackArray(ctx.arg(0), ctx.arg(1))
);
Expand Down Expand Up @@ -203,7 +203,7 @@ static DWORD ListAsArray(DWORD type) {
return id;
}

void sf_list_as_array(OpcodeContext& ctx) {
void op_list_as_array(OpcodeContext& ctx) {
auto arrayId = ListAsArray(ctx.arg(0).rawValue());
ctx.setReturn(arrayId);
}
Expand All @@ -216,15 +216,15 @@ static DWORD ListBegin(DWORD type) {
return listID;
}

void sf_list_begin(OpcodeContext& ctx) {
void op_list_begin(OpcodeContext& ctx) {
ctx.setReturn(ListBegin(ctx.arg(0).rawValue()));
}

static fo::GameObject* ListNext(sList* list) {
return (!list || list->pos == list->len) ? 0 : list->obj[list->pos++];
}

void sf_list_next(OpcodeContext& ctx) {
void op_list_next(OpcodeContext& ctx) {
fo::GameObject* obj = nullptr;
auto id = ctx.arg(0).rawValue();
if (id != 0) {
Expand Down Expand Up @@ -252,7 +252,7 @@ static void ListEnd(DWORD id) {
}
}

void sf_list_end(OpcodeContext& ctx) {
void op_list_end(OpcodeContext& ctx) {
ListEnd(ctx.arg(0).rawValue());
}

Expand Down
34 changes: 17 additions & 17 deletions sfall/Modules/Scripting/Handlers/Arrays.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,43 @@ namespace sfall
namespace script
{

void sf_create_array(OpcodeContext&);
void op_create_array(OpcodeContext&);

void sf_set_array(OpcodeContext&);
void op_set_array(OpcodeContext&);

/*
used in place of [] operator when compiling in sslc
so it works as get_array if first argument is int and as substr(x, y, 1) if first argument is string
*/
void sf_get_array(OpcodeContext&);
void op_get_array(OpcodeContext&);

void sf_free_array(OpcodeContext&);
void op_free_array(OpcodeContext&);

void sf_len_array(OpcodeContext&);
void op_len_array(OpcodeContext&);

void sf_resize_array(OpcodeContext&);
void op_resize_array(OpcodeContext&);

void sf_temp_array(OpcodeContext&);
void op_temp_array(OpcodeContext&);

void sf_fix_array(OpcodeContext&);
void op_fix_array(OpcodeContext&);

void sf_scan_array(OpcodeContext&);
void op_scan_array(OpcodeContext&);

void sf_save_array(OpcodeContext&);
void op_save_array(OpcodeContext&);

void sf_load_array(OpcodeContext&);
void op_load_array(OpcodeContext&);

void sf_get_array_key(OpcodeContext&);
void op_get_array_key(OpcodeContext&);

void sf_stack_array(OpcodeContext&);
void op_stack_array(OpcodeContext&);

void sf_list_begin(OpcodeContext&);
void op_list_begin(OpcodeContext&);

void sf_list_as_array(OpcodeContext&);
void op_list_as_array(OpcodeContext&);

void sf_list_next(OpcodeContext&);
void op_list_next(OpcodeContext&);

void sf_list_end(OpcodeContext&);
void op_list_end(OpcodeContext&);

}
}
Loading

0 comments on commit b263b69

Please sign in to comment.