diff options
author | mekolat <mekolat@gmail.com> | 2015-03-28 16:06:29 -0400 |
---|---|---|
committer | mekolat <mekolat@gmail.com> | 2015-03-28 16:07:54 -0400 |
commit | e5471b1890bae50c36ccf8a8c7e1fee868c156b1 (patch) | |
tree | 06ade877b9ac67e562545eddcb08841a8203f01d | |
parent | 6f4699ff0c6400a2adc5e4008b2e289737f4a303 (diff) | |
download | tmwa-e5471b1890bae50c36ccf8a8c7e1fee868c156b1.tar.gz tmwa-e5471b1890bae50c36ccf8a8c7e1fee868c156b1.tar.bz2 tmwa-e5471b1890bae50c36ccf8a8c7e1fee868c156b1.tar.xz tmwa-e5471b1890bae50c36ccf8a8c7e1fee868c156b1.zip |
add getnpcx and getnpcy
-rw-r--r-- | src/map/script-fun.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 8c25266..eea8797 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -2984,6 +2984,30 @@ void builtin_getmap(ScriptState *st) push_str<ScriptDataStr>(st->stack, sd->bl_m->name_); } +/*============================ + * Gets the NPC's x pos + *---------------------------- + */ +static +void builtin_getnpcx(ScriptState *st) +{ + dumb_ptr<npc_data> nd = map_id_is_npc(st->oid); + + push_int<ScriptDataInt>(st->stack, nd->bl_x); +} + +/*============================ + * Gets the NPC's y pos + *---------------------------- + */ +static +void builtin_getnpcy(ScriptState *st) +{ + dumb_ptr<npc_data> nd = map_id_is_npc(st->oid); + + push_int<ScriptDataInt>(st->stack, nd->bl_y); +} + static void builtin_mapexit(ScriptState *) { @@ -3112,6 +3136,8 @@ BuiltinFunction builtin_functions[] = BUILTIN(fakenpcname, "ssi"_s, '\0'), BUILTIN(getx, ""_s, 'i'), BUILTIN(gety, ""_s, 'i'), + BUILTIN(getnpcx, ""_s, 'i'), + BUILTIN(getnpcy, ""_s, 'i'), BUILTIN(getmap, ""_s, 's'), BUILTIN(mapexit, ""_s, '\0'), BUILTIN(freeloop, "i"_s, '\0'), |