mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed get_tile_fid function to work on elevation 1 and 2
* it now follows dude elevation.
This commit is contained in:
@@ -57,6 +57,7 @@ WRAP_WATCOM_FUNC4(long, queue_add, long, time, fo::GameObject*, object, void*, d
|
||||
WRAP_WATCOM_FUNC4(void, register_object_call, long*, target, long*, source, void*, func, long, delay)
|
||||
WRAP_WATCOM_FUNC3(long, scr_get_local_var, long, sid, long, varId, long*, value)
|
||||
WRAP_WATCOM_FUNC3(long, scr_set_local_var, long, sid, long, varId, long, value)
|
||||
WRAP_WATCOM_FUNC3(long, square_num, long, squareX, long, squaryY, long, elevation) // elevation is not used
|
||||
WRAP_WATCOM_FUNC6(long, text_object_create, fo::GameObject*, object, const char*, text, long, font, long, colorText, long, colorOutline, fo::BoundRect*, rect)
|
||||
WRAP_WATCOM_FUNC3(long, tile_coord, long, tile, long*, outX, long*, outY) // the fourth argument of the function is not used
|
||||
WRAP_WATCOM_FUNC3(long, tile_num_in_direction, long, tile, long, rotation, long, distance)
|
||||
@@ -215,13 +216,13 @@ WRAP_WATCOM_FUNC1(long, scr_remove, long, scriptID)
|
||||
WRAP_WATCOM_FUNC1(void, set_focus_func, void*, func)
|
||||
WRAP_WATCOM_FUNC1(long, skill_is_tagged, long, skill)
|
||||
WRAP_WATCOM_FUNC2(long, skill_level, fo::GameObject*, critter, long, statID)
|
||||
WRAP_WATCOM_FUNC2(void, skill_get_tags, long*, tags, long, num)
|
||||
WRAP_WATCOM_FUNC2(void, skill_set_tags, long*, tags, long, num)
|
||||
WRAP_WATCOM_FUNC2(long, stat_get_base, fo::GameObject*, critter, long, statID)
|
||||
WRAP_WATCOM_FUNC2(long, stat_get_base_direct, fo::GameObject*, critter, long, statID)
|
||||
WRAP_WATCOM_FUNC2(long, stat_get_bonus, fo::GameObject*, critter, long, statID)
|
||||
WRAP_WATCOM_FUNC1(void, stat_recalc_derived, fo::GameObject*, critter)
|
||||
WRAP_WATCOM_FUNC3(long, stat_set_bonus, fo::GameObject*, critter, long, statID, long, amount)
|
||||
WRAP_WATCOM_FUNC2(void, skill_get_tags, long*, tags, long, num)
|
||||
WRAP_WATCOM_FUNC2(void, skill_set_tags, long*, tags, long, num)
|
||||
WRAP_WATCOM_FUNC2(long, stat_level, fo::GameObject*, critter, long, statId)
|
||||
WRAP_WATCOM_FUNC1(void, stat_pc_add_experience, long, amount) // Adds experience points to PC
|
||||
WRAP_WATCOM_FUNC1(long, text_font, long, fontNum)
|
||||
|
||||
@@ -200,7 +200,7 @@ PTR_(sneak_working, DWORD) // DWORD var
|
||||
PTR_(sound_music_path1, char*)
|
||||
PTR_(sound_music_path2, char*)
|
||||
PTR_(speech_volume, DWORD)
|
||||
PTR_(square, DWORD)
|
||||
PTR_(square, DWORD*) // array of 3 pointers, one per elevation
|
||||
PTR_(squares, DWORD*)
|
||||
PTR_(stack, DWORD) // array of 10 DWORD
|
||||
PTR_(stack_offset, DWORD) // array of 10 DWORD
|
||||
|
||||
@@ -317,31 +317,14 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: It seems that this function does not work...
|
||||
void __declspec(naked) op_get_tile_fid() {
|
||||
__asm {
|
||||
push ecx;
|
||||
_GET_ARG_INT(fail); // get tile value
|
||||
mov esi, ebx; // keep script
|
||||
sub esp, 8; // x/y buf
|
||||
lea edx, [esp];
|
||||
lea ebx, [esp + 4];
|
||||
call fo::funcoffs::tile_coord_;
|
||||
pop eax; // x
|
||||
pop edx; // y
|
||||
call fo::funcoffs::square_num_;
|
||||
mov edx, ds:[FO_VAR_square];
|
||||
movzx edx, word ptr ds:[edx + eax * 4];
|
||||
mov ebx, esi; // script
|
||||
end:
|
||||
mov eax, ebx;
|
||||
_RET_VAL_INT;
|
||||
pop ecx;
|
||||
retn;
|
||||
fail:
|
||||
xor edx, edx; // return 0
|
||||
jmp end;
|
||||
}
|
||||
void op_get_tile_fid(OpcodeContext& ctx) {
|
||||
long tileX, tileY, squareNum,
|
||||
elevation = (*fo::ptr::obj_dude)->elevation,
|
||||
tileNum = ctx.arg(0).rawValue();
|
||||
|
||||
fo::func::tile_coord(tileNum, &tileX, &tileY);
|
||||
squareNum = fo::func::square_num(tileX, tileY, elevation);
|
||||
ctx.setReturn(fo::ptr::square[elevation][squareNum]);
|
||||
}
|
||||
|
||||
void __declspec(naked) op_modified_ini() {
|
||||
|
||||
@@ -82,7 +82,7 @@ void op_play_sfall_sound(OpcodeContext&);
|
||||
|
||||
void __declspec() op_stop_sfall_sound();
|
||||
|
||||
void __declspec() op_get_tile_fid();
|
||||
void op_get_tile_fid(OpcodeContext&);
|
||||
|
||||
void __declspec() op_modified_ini();
|
||||
|
||||
|
||||
@@ -174,6 +174,7 @@ static SfallOpcodeInfo opcodeInfoArray[] = {
|
||||
{0x237, "atoi", op_atoi, 1, true, 0, {ARG_STRING}},
|
||||
{0x238, "atof", op_atof, 1, true, 0, {ARG_STRING}},
|
||||
{0x239, "scan_array", op_scan_array, 2, true, -1, {ARG_OBJECT, ARG_ANY}},
|
||||
{0x23a, "get_tile_fid", op_get_tile_fid, 1, true, 0, {ARG_INT}},
|
||||
{0x23c, "get_sfall_args", op_get_sfall_args, 0, true},
|
||||
{0x23d, "set_sfall_arg", op_set_sfall_arg, 2, false, 0, {ARG_INT, ARG_INT}},
|
||||
{0x241, "get_npc_level", op_get_npc_level, 1, true, -1, {ARG_INTSTR}},
|
||||
@@ -402,7 +403,6 @@ void Opcodes::InitNew() {
|
||||
opcodes[0x227] = op_refresh_pc_art;
|
||||
opcodes[0x22c] = op_stop_sfall_sound;
|
||||
|
||||
opcodes[0x23a] = op_get_tile_fid;
|
||||
opcodes[0x23b] = op_modified_ini;
|
||||
opcodes[0x23e] = op_force_aimed_shots;
|
||||
opcodes[0x23f] = op_disable_aimed_shots;
|
||||
|
||||
Reference in New Issue
Block a user