summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 52c1edc)
raw | patch | inline | side by side (parent: 52c1edc)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Tue, 17 Mar 2020 20:08:15 +0000 (23:08 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Tue, 17 Mar 2020 20:08:29 +0000 (23:08 +0300) |
src/game/g_netmsg.pas | patch | blob | history | |
src/game/g_player.pas | patch | blob | history |
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index 5e95a6a57dd97b42a4d31178c153e94589092816..17942e24e65b63be12b38c02f369ee7a0d9f0e6d 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
if IsKeyPressed(KEY_UP) then kByte := kByte or NET_KEY_UP;
if IsKeyPressed(KEY_DOWN) then kByte := kByte or NET_KEY_DOWN;
if IsKeyPressed(KEY_JUMP) then kByte := kByte or NET_KEY_JUMP;
- if JustTeleported then kByte := kByte or NET_KEY_FORCEDIR;
end;
+ if JustTeleported then kByte := kByte or NET_KEY_FORCEDIR;
+
NetOut.Write(kByte);
if Direction = TDirection.D_LEFT then NetOut.Write(Byte(0)) else NetOut.Write(Byte(1));
NetOut.Write(GameX);
ReleaseKeys;
- if (kByte = NET_KEY_CHAT) then
+ if LongBool(kByte and NET_KEY_CHAT) then
PressKey(KEY_CHAT, 10000)
else
begin
if LongBool(kByte and NET_KEY_JUMP) then PressKey(KEY_JUMP, 10000);
end;
- if ((Pl <> gPlayer1) and (Pl <> gPlayer2)) or LongBool(kByte and NET_KEY_FORCEDIR) then
+ JustTeleported := LongBool(kByte and NET_KEY_FORCEDIR);
+
+ if ((Pl <> gPlayer1) and (Pl <> gPlayer2)) or JustTeleported then
SetDirection(TDirection(Dir));
GameVelX := M.ReadLongInt();
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index a66b064efcdc0abbaaf7bd0f8b8be727d16bc40b..0b72fc96c52ba322d5cfeacd165ab34da82e7895 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
begin
FXTo := XTo;
FYTo := YTo;
- if NetInterpLevel < 1 then
+ if FJustTeleported or (NetInterpLevel < 1) then
begin
FObj.X := XTo;
FObj.Y := YTo;
+ if FJustTeleported then
+ begin
+ FObj.oldX := FObj.X;
+ FObj.oldY := FObj.Y;
+ end;
end
else
begin