Skip to content

Commit fcd559c

Browse files
heinrich5991def-
authored andcommitted
Add "groundjump-only" tile
Works by setting the airjump tiles' jumps to 255.
1 parent 526a64e commit fcd559c

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

datasrc/network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@
238238
NetObjectEx("DDNetCharacter", "character@netobj.ddnet.tw", [
239239
NetIntAny("m_Flags"),
240240
NetTick("m_FreezeEnd"),
241-
NetIntRange("m_Jumps", 0, 255),
241+
NetIntRange("m_Jumps", -1, 255),
242242
NetIntAny("m_TeleCheckpoint"),
243243
NetIntRange("m_StrongWeakID", 0, 'MAX_CLIENTS-1'),
244244
]),

src/game/client/prediction/entities/character.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,11 @@ void CCharacter::HandleTiles(int Index)
752752
else if(Collision()->GetSwitchType(MapIndex) == TILE_JUMP)
753753
{
754754
int NewJumps = Collision()->GetSwitchDelay(MapIndex);
755+
if(NewJumps == 255)
756+
{
757+
NewJumps = -1;
758+
}
759+
755760
if(NewJumps != m_Core.m_Jumps)
756761
m_Core.m_Jumps = NewJumps;
757762
}
@@ -945,7 +950,9 @@ void CCharacter::DDRacePostCoreTick()
945950
if(m_DeepFreeze && !m_Super)
946951
Freeze();
947952

948-
if(m_Core.m_Jumps == 0 && !m_Super)
953+
if(m_Core.m_Jumps == -1 && !m_Super)
954+
m_Core.m_Jumped |= 2;
955+
else if(m_Core.m_Jumps == 0 && !m_Super)
949956
m_Core.m_Jumped = 3;
950957
else if(m_Core.m_Jumps == 1 && m_Core.m_Jumped > 0)
951958
m_Core.m_Jumped = 3;

src/game/server/entities/character.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,11 +1782,17 @@ void CCharacter::HandleTiles(int Index)
17821782
else if(GameServer()->Collision()->GetSwitchType(MapIndex) == TILE_JUMP)
17831783
{
17841784
int NewJumps = GameServer()->Collision()->GetSwitchDelay(MapIndex);
1785+
if(NewJumps == 255)
1786+
{
1787+
NewJumps = -1;
1788+
}
17851789

17861790
if(NewJumps != m_Core.m_Jumps)
17871791
{
17881792
char aBuf[256];
1789-
if(NewJumps == 1)
1793+
if(NewJumps == -1)
1794+
str_format(aBuf, sizeof(aBuf), "You only have your ground jump now");
1795+
else if(NewJumps == 1)
17901796
str_format(aBuf, sizeof(aBuf), "You can jump %d time", NewJumps);
17911797
else
17921798
str_format(aBuf, sizeof(aBuf), "You can jump %d times", NewJumps);
@@ -2120,7 +2126,9 @@ void CCharacter::DDRacePostCoreTick()
21202126
if(m_DeepFreeze && !m_Super)
21212127
Freeze();
21222128

2123-
if(m_Core.m_Jumps == 0 && !m_Super)
2129+
if(m_Core.m_Jumps == -1 && !m_Super)
2130+
m_Core.m_Jumped |= 2;
2131+
else if(m_Core.m_Jumps == 0 && !m_Super)
21242132
m_Core.m_Jumped = 3;
21252133
else if(m_Core.m_Jumps == 1 && m_Core.m_Jumped > 0)
21262134
m_Core.m_Jumped = 3;

0 commit comments

Comments
 (0)