Skip to content

Commit ccf2af4

Browse files
committed
Explicitly set default facing direction to south
Both server[0] and client[1] code assume the default is 0 (`f` is sent only if the client's facing value is other than 0), but the liblcf default is actually 2 (down)[2]. Fixes an issue where a player facing north (0) would show up as facing south (2) after logging out or switching to private mode. [0]: https://github.com/ynoproject/ynoserver/blob/2db0c7f392665e06761ffeafa85ac7171e6160c0/server/room.go#L340 [1]: https://github.com/ynoproject/ynoengine/blob/ddec6fd42a10d3788600dcb0454f7581b2b3eb31/src/multiplayer/game_multiplayer.cpp#L561 [2]: https://github.com/EasyRPG/liblcf/blob/92c4450a1bc1acb58bd02bbb99b57e5036919cdf/src/generated/lcf/rpg/savemapeventbase.h#L37
1 parent 9c20341 commit ccf2af4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/game_playerother.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ using Game_PlayerBase = Game_CharacterDataStorage<lcf::rpg::SavePartyLocation>;
1212
*/
1313
class Game_PlayerOther : public Game_PlayerBase {
1414
public:
15+
static constexpr int DEFAULT_FACING = Down;
16+
1517
Game_PlayerOther(int id) : Game_CharacterDataStorage(PlayerOther), id(id)
1618
{
19+
SetFacing(DEFAULT_FACING);
1720
SetDirection(lcf::rpg::EventPage::Direction_down);
1821
SetMoveSpeed(4);
1922
SetAnimationType(lcf::rpg::EventPage::AnimType_non_continuous);

src/multiplayer/game_multiplayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ void Game_Multiplayer::SendBasicData() {
558558
connection.SendPacketAsync<C::SpeedPacket>(player->GetMoveSpeed());
559559
connection.SendPacketAsync<C::SpritePacket>(player->GetSpriteName(),
560560
player->GetSpriteIndex());
561-
if (player->GetFacing() > 0) {
561+
if (player->GetFacing() != Game_PlayerOther::DEFAULT_FACING) {
562562
connection.SendPacketAsync<C::FacingPacket>(player->GetFacing());
563563
}
564564
connection.SendPacketAsync<C::HiddenPacket>(player->IsSpriteHidden());

0 commit comments

Comments
 (0)