From 6d5919b4f782adc453106312c394cf1b7dd9e58f Mon Sep 17 00:00:00 2001 From: mekolat Date: Fri, 13 May 2016 14:34:56 -0400 Subject: implement SMSG_MAP_SET_TILES_TYPE, add builtin sendcollision --- src/map/clif.cpp | 18 ++++++++++++++++++ src/map/clif.hpp | 1 + src/map/script-fun.cpp | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.cpp b/src/map/clif.cpp index bd7f4ef..0ae8fbe 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -3921,6 +3921,24 @@ void clif_remote_command(dumb_ptr sd, XString cmd) clif_send(buf, sd, SendWho::SELF, wrap(6)); } +void clif_update_collision(dumb_ptr sd, short x1, short y1, + short x2, short y2, MapName map_name, int mask) +{ + nullpo_retv(sd); + + Packet_Fixed<0x0231> fixed_231; + fixed_231.x1 = x1; + fixed_231.y1 = y1; + fixed_231.x2 = x2; + fixed_231.y2 = y2; + fixed_231.mask = mask; + fixed_231.unused_layer = 0; + fixed_231.map = map_name; + Buffer buf = create_fpacket<0x0231, 34>(fixed_231); + + clif_send(buf, sd, SendWho::SELF, wrap(7)); +} + void clif_change_music(dumb_ptr sd, XString music) { nullpo_retv(sd); diff --git a/src/map/clif.hpp b/src/map/clif.hpp index 4783290..1d6365d 100644 --- a/src/map/clif.hpp +++ b/src/map/clif.hpp @@ -107,6 +107,7 @@ void clif_setnpcdirection_towards(dumb_ptr sd, dumb_ptr, uint8_t, XString msg); void clif_remote_command(dumb_ptr, XString); +void clif_update_collision(dumb_ptr, short, short, short, short, MapName, int); void clif_change_music(dumb_ptr sd, XString music); void clif_npc_action(dumb_ptr, BlockId, short, int, short, short); void clif_send_mask(dumb_ptr, int); diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 98c07ed..74045f2 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -4186,6 +4186,38 @@ void builtin_remotecmd(ScriptState *st) clif_remote_command(sd, msg); } +static +void builtin_sendcollision(ScriptState *st) +{ + dumb_ptr sd = script_rid2sd(st); + MapName map_name = stringish(ZString(conv_str(st, &AARG(0)))); + int mask = conv_num(st, &AARG(1)); + short x1, y1, x2, y2; + x1 = x2 = conv_num(st, &AARG(2)); + y1 = y2 = conv_num(st, &AARG(3)); + + if (HARG(5)) + { + x2 = conv_num(st, &AARG(4)); + y2 = conv_num(st, &AARG(5)); + if (HARG(6)) + { + CharName player = stringish(ZString(conv_str(st, &AARG(6)))); + sd = map_nick2sd(player); + } + } + + else if (HARG(4)) + { + CharName player = stringish(ZString(conv_str(st, &AARG(4)))); + sd = map_nick2sd(player); + } + + if (sd == nullptr) + return; + clif_update_collision(sd, x1, y1, x2, y2, map_name, mask); +} + static void builtin_music(ScriptState *st) { @@ -4818,6 +4850,7 @@ BuiltinFunction builtin_functions[] = BUILTIN(title, "s"_s, '\0'), BUILTIN(smsg, "e??"_s, '\0'), BUILTIN(remotecmd, "s?"_s, '\0'), + BUILTIN(sendcollision, "Mixy???"_s, '\0'), BUILTIN(music, "s"_s, '\0'), BUILTIN(mapmask, "i?"_s, '\0'), BUILTIN(getmask, ""_s, 'i'), -- cgit v1.2.3-60-g2f50