From b89dd1428b2d357c8bbe016573fb0ab25ade2782 Mon Sep 17 00:00:00 2001 From: KirieZ Date: Mon, 11 Jul 2016 00:55:47 -0300 Subject: Fixes warp facing direction. Fixes #1240 Closes #1353 as merged --- src/map/battle.c | 1 + src/map/battle.h | 3 +++ src/map/clif.c | 3 ++- src/map/pc.c | 5 +++++ 4 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src/map') diff --git a/src/map/battle.c b/src/map/battle.c index 879776871..6182d1ff5 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -7247,6 +7247,7 @@ static const struct battle_data { { "min_body_style", &battle_config.min_body_style, 0, 0, SHRT_MAX, }, { "max_body_style", &battle_config.max_body_style, 4, 0, SHRT_MAX, }, { "save_body_style", &battle_config.save_body_style, 0, 0, 1, }, + { "player_warp_keep_direction", &battle_config.player_warp_keep_direction, 0, 0, 1, }, }; #ifndef STATS_OPT_OUT /** diff --git a/src/map/battle.h b/src/map/battle.h index cb15e3b90..1a23870e7 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -539,6 +539,9 @@ struct Battle_Config { // BodyStyle int min_body_style, max_body_style; int save_body_style; + + // Warp Face Direction + int player_warp_keep_direction; }; /* criteria for battle_config.idletime_critera */ diff --git a/src/map/clif.c b/src/map/clif.c index 897249836..2317801bc 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9548,7 +9548,8 @@ void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) { clif->clearunit_area(&sd->bl, CLR_DEAD); else { skill->usave_trigger(sd); - sd->ud.dir = 0;/* enforce north-facing (not visually, virtually) */ + if (battle_config.player_warp_keep_direction == 1) + clif->changed_dir(&sd->bl, SELF); // Visually updates player facing direction } // Trigger skill effects if you appear standing on them diff --git a/src/map/pc.c b/src/map/pc.c index 2206dbb80..93470493a 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5580,6 +5580,8 @@ int pc_setpos(struct map_session_data* sd, unsigned short map_index, int x, int npc->script_event(sd, NPCE_LOGOUT); //remove from map, THEN change x/y coordinates unit->remove_map_pc(sd,clrtype); + if (battle_config.player_warp_keep_direction == 0) + sd->ud.dir = 0; // makes character face north sd->mapindex = map_index; sd->bl.x=x; sd->bl.y=y; @@ -5610,6 +5612,9 @@ int pc_setpos(struct map_session_data* sd, unsigned short map_index, int x, int vending->close(sd); } + if (battle_config.player_warp_keep_direction == 0) + sd->ud.dir = 0; // makes character face north + if(sd->bl.prev != NULL){ unit->remove_map_pc(sd,clrtype); clif->changemap(sd,m,x,y); // [MouseJstr] -- cgit v1.2.3-70-g09d2