Initial implementation of set_outline function (need to find better solution) #54

This commit is contained in:
phobos2077
2017-03-11 21:48:59 +07:00
parent 7b5e730f72
commit 2d4ce73664
6 changed files with 30 additions and 1 deletions
+11
View File
@@ -158,6 +158,15 @@
#define GAME_MSG_PRO_TILE (0x1004) #define GAME_MSG_PRO_TILE (0x1004)
#define GAME_MSG_PRO_MISC (0x1005) #define GAME_MSG_PRO_MISC (0x1005)
#define OUTLINE_NONE (0)
#define OUTLINE_RED_GLOW (0x01)
#define OUTLINE_RED (0x02)
#define OUTLINE_PURPLE (0x03)
#define OUTLINE_GREY (0x04)
#define OUTLINE_GREEN_GLOW (0x08)
#define OUTLINE_YELLOW (0x10)
#define OUTLINE_DARK_YELLOW (0x20)
#define mstr_combat(x) (message_str_game(GAME_MSG_COMBAT, x)) #define mstr_combat(x) (message_str_game(GAME_MSG_COMBAT, x))
#define mstr_ai(x) (message_str_game(GAME_MSG_AI, x)) #define mstr_ai(x) (message_str_game(GAME_MSG_AI, x))
#define mstr_scrname(x) (message_str_game(GAME_MSG_SCRNAME, x)) #define mstr_scrname(x) (message_str_game(GAME_MSG_SCRNAME, x))
@@ -196,3 +205,5 @@
#define intface_show sfall_func0("intface_show") #define intface_show sfall_func0("intface_show")
#define intface_is_hidden sfall_func0("intface_is_hidden") #define intface_is_hidden sfall_func0("intface_is_hidden")
#define exec_map_update_scripts sfall_func0("exec_map_update_scripts") #define exec_map_update_scripts sfall_func0("exec_map_update_scripts")
#define set_outline(obj, color) sfall_func2("set_outline", obj, color)
#define get_outline(obj) sfall_func1("get_outline", obj)
+1
View File
@@ -63,6 +63,7 @@ WRAP_WATCOM_FUNC1(long, register_object_must_erase, GameObject*, object)
// WRAP_WATCOM_FUNC3(long, register_object_run_to_tile_, GameObject*, object; // WRAP_WATCOM_FUNC3(long, register_object_run_to_tile_, GameObject*, object;
WRAP_WATCOM_FUNC3(long, register_object_take_out, GameObject*, object, long, holdFrameId, long, nothing) WRAP_WATCOM_FUNC3(long, register_object_take_out, GameObject*, object, long, holdFrameId, long, nothing)
WRAP_WATCOM_FUNC3(long, register_object_turn_towards, GameObject*, object, long, tileNum, long, nothing) WRAP_WATCOM_FUNC3(long, register_object_turn_towards, GameObject*, object, long, tileNum, long, nothing)
WRAP_WATCOM_FUNC0(void, tile_refresh_display)
WRAP_WATCOM_FUNC1(long, text_font, long, fontNum) WRAP_WATCOM_FUNC1(long, text_font, long, fontNum)
WRAP_WATCOM_FUNC6(DWORD, win_add, long, x, long, y, long, width, long, height, long, bgColorIndex, long, flags) WRAP_WATCOM_FUNC6(DWORD, win_add, long, x, long, y, long, width, long, height, long, bgColorIndex, long, flags)
WRAP_WATCOM_FUNC1(void, win_show, DWORD, winRef) WRAP_WATCOM_FUNC1(void, win_show, DWORD, winRef)
+1 -1
View File
@@ -693,7 +693,7 @@ static void RunGlobalScripts1() {
} }
} else if (highlightingToggled) { } else if (highlightingToggled) {
if (highlightingToggled == 1) { if (highlightingToggled == 1) {
obj_outline_all_items_off(); obj_outline_all_items_off();
} }
highlightingToggled = 0; highlightingToggled = 0;
} }
@@ -124,6 +124,8 @@ static const SfallMetarule metaruleArray[] = {
{"intface_hide", sf_intface_hide, 0, 0}, {"intface_hide", sf_intface_hide, 0, 0},
{"intface_is_hidden", sf_intface_is_hidden, 0, 0}, {"intface_is_hidden", sf_intface_is_hidden, 0, 0},
{"exec_map_update_scripts", sf_exec_map_update_scripts, 0, 0}, {"exec_map_update_scripts", sf_exec_map_update_scripts, 0, 0},
{"set_outline", sf_set_outline, 2, 2, {ARG_OBJECT, ARG_INT}},
{"get_outline", sf_get_outline, 1, 1, {ARG_OBJECT}}
}; };
void InitMetaruleTable() { void InitMetaruleTable() {
@@ -397,5 +397,16 @@ void sf_critter_inven_obj2(OpcodeContext& ctx) {
} }
} }
void sf_set_outline(OpcodeContext& ctx) {
auto obj = ctx.arg(0).asObject();
*(long*)&obj->outline = ctx.arg(1).asInt();
fo::func::tile_refresh_display();
}
void sf_get_outline(OpcodeContext& ctx) {
auto obj = ctx.arg(0).asObject();
ctx.setReturn(*(long*)&obj->outline);
}
} }
} }
@@ -67,5 +67,9 @@ void sf_obj_is_carrying_obj(OpcodeContext&);
void sf_critter_inven_obj2(OpcodeContext&); void sf_critter_inven_obj2(OpcodeContext&);
void sf_set_outline(OpcodeContext&);
void sf_get_outline(OpcodeContext&);
} }
} }