Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
d1ba9e0a
Commit
d1ba9e0a
authored
Jan 15, 2023
by
LJ Sonic
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup
parent
425fce69
No related branches found
No related tags found
1 merge request
!1920
Delete netcode
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/netcode/gamestate.c
+1
-2
1 addition, 2 deletions
src/netcode/gamestate.c
src/netcode/tic_command.c
+23
-20
23 additions, 20 deletions
src/netcode/tic_command.c
src/netcode/tic_command.h
+1
-1
1 addition, 1 deletion
src/netcode/tic_command.h
with
25 additions
and
23 deletions
src/netcode/gamestate.c
+
1
−
2
View file @
d1ba9e0a
...
...
@@ -242,8 +242,7 @@ void CL_ReloadReceivedSavegame(void)
CL_LoadReceivedSavegame
(
true
);
if
(
neededtic
<
gametic
)
neededtic
=
gametic
;
neededtic
=
max
(
neededtic
,
gametic
);
maketic
=
neededtic
;
ticcmd_oldangleturn
[
0
]
=
players
[
consoleplayer
].
oldrelangleturn
;
...
...
This diff is collapsed.
Click to expand it.
src/netcode/tic_command.c
+
23
−
20
View file @
d1ba9e0a
...
...
@@ -148,8 +148,9 @@ static void CheckConsistancy(SINT8 nodenum, tic_t tic)
}
}
void
PT_ClientCmd
(
SINT8
node
,
INT32
netconsole
)
void
PT_ClientCmd
(
SINT8
node
num
,
INT32
netconsole
)
{
netnode_t
*
node
=
&
netnodes
[
nodenum
];
tic_t
realend
,
realstart
;
if
(
client
)
...
...
@@ -157,24 +158,24 @@ void PT_ClientCmd(SINT8 node, INT32 netconsole)
// To save bytes, only the low byte of tic numbers are sent
// Use ExpandTics to figure out what the rest of the bytes are
realstart
=
ExpandTics
(
netbuffer
->
u
.
clientpak
.
client_tic
,
node
);
realend
=
ExpandTics
(
netbuffer
->
u
.
clientpak
.
resendfrom
,
node
);
realstart
=
ExpandTics
(
netbuffer
->
u
.
clientpak
.
client_tic
,
node
num
);
realend
=
ExpandTics
(
netbuffer
->
u
.
clientpak
.
resendfrom
,
node
num
);
if
(
netbuffer
->
packettype
==
PT_CLIENTMIS
||
netbuffer
->
packettype
==
PT_CLIENT2MIS
||
netbuffer
->
packettype
==
PT_NODEKEEPALIVEMIS
||
n
etnodes
[
node
].
supposedtic
<
realend
)
||
n
ode
->
supposedtic
<
realend
)
{
n
etnodes
[
node
].
supposedtic
=
realend
;
n
ode
->
supposedtic
=
realend
;
}
// Discard out of order packet
if
(
n
etnodes
[
node
].
tic
>
realend
)
if
(
n
ode
->
tic
>
realend
)
{
DEBFILE
(
va
(
"out of order ticcmd discarded nettics = %u
\n
"
,
n
etnodes
[
node
].
tic
));
DEBFILE
(
va
(
"out of order ticcmd discarded nettics = %u
\n
"
,
n
ode
->
tic
));
return
;
}
// Update the nettics
n
etnodes
[
node
].
tic
=
realend
;
n
ode
->
tic
=
realend
;
// Don't do anything for packets of type NODEKEEPALIVE?
if
(
netconsole
==
-
1
||
netbuffer
->
packettype
==
PT_NODEKEEPALIVE
...
...
@@ -183,19 +184,19 @@ void PT_ClientCmd(SINT8 node, INT32 netconsole)
// As long as clients send valid ticcmds, the server can keep running, so reset the timeout
/// \todo Use a separate cvar for that kind of timeout?
n
etnodes
[
node
].
freezetimeout
=
I_GetTime
()
+
connectiontimeout
;
n
ode
->
freezetimeout
=
I_GetTime
()
+
connectiontimeout
;
// Copy ticcmd
G_MoveTiccmd
(
&
netcmds
[
maketic
%
BACKUPTICS
][
netconsole
],
&
netbuffer
->
u
.
clientpak
.
cmd
,
1
);
// Splitscreen cmd
if
((
netbuffer
->
packettype
==
PT_CLIENT2CMD
||
netbuffer
->
packettype
==
PT_CLIENT2MIS
)
&&
n
etnodes
[
node
].
player2
>=
0
)
G_MoveTiccmd
(
&
netcmds
[
maketic
%
BACKUPTICS
][(
UINT8
)
n
etnodes
[
node
].
player2
],
&&
n
ode
->
player2
>=
0
)
G_MoveTiccmd
(
&
netcmds
[
maketic
%
BACKUPTICS
][(
UINT8
)
n
ode
->
player2
],
&
netbuffer
->
u
.
client2pak
.
cmd2
,
1
);
CheckTiccmdHacks
(
netconsole
);
CheckConsistancy
(
node
,
realstart
);
CheckConsistancy
(
node
num
,
realstart
);
}
void
PT_ServerTics
(
SINT8
node
,
INT32
netconsole
)
...
...
@@ -346,9 +347,11 @@ void SV_SendTics(void)
for
(
INT32
n
=
1
;
n
<
MAXNETNODES
;
n
++
)
if
(
netnodes
[
n
].
ingame
)
{
// assert netnodes[n].supposedtic>=netnodes[n].tic
realfirsttic
=
netnodes
[
n
].
supposedtic
;
lasttictosend
=
min
(
maketic
,
netnodes
[
n
].
tic
+
CLIENTBACKUPTICS
);
netnode_t
*
node
=
netnodes
[
n
];
// assert node->supposedtic>=node->tic
realfirsttic
=
node
->
supposedtic
;
lasttictosend
=
min
(
maketic
,
node
->
tic
+
CLIENTBACKUPTICS
);
if
(
realfirsttic
>=
lasttictosend
)
{
...
...
@@ -357,9 +360,9 @@ void SV_SendTics(void)
// packet detection work when we have received packet with firsttic > neededtic
// (getpacket servertics case)
DEBFILE
(
va
(
"Nothing to send node %u mak=%u sup=%u net=%u
\n
"
,
n
,
maketic
,
n
etnodes
[
n
].
supposedtic
,
n
etnodes
[
n
].
tic
));
n
,
maketic
,
n
ode
->
supposedtic
,
n
ode
->
tic
));
realfirsttic
=
n
etnodes
[
n
].
tic
;
realfirsttic
=
n
ode
->
tic
;
if
(
realfirsttic
>=
lasttictosend
||
(
I_GetTime
()
+
n
)
&
3
)
// all tic are ok
...
...
@@ -388,10 +391,10 @@ void SV_SendTics(void)
// when tic are too large, only one tic is sent so don't go backward!
if
(
lasttictosend
-
doomcom
->
extratics
>
realfirsttic
)
n
etnodes
[
n
].
supposedtic
=
lasttictosend
-
doomcom
->
extratics
;
n
ode
->
supposedtic
=
lasttictosend
-
doomcom
->
extratics
;
else
n
etnodes
[
n
].
supposedtic
=
lasttictosend
;
n
etnodes
[
n
].
supposedtic
=
max
(
n
etnodes
[
n
].
supposedtic
,
n
etnodes
[
n
].
tic
);
n
ode
->
supposedtic
=
lasttictosend
;
n
ode
->
supposedtic
=
max
(
n
ode
->
supposedtic
,
n
ode
->
tic
);
}
// node 0 is me!
...
...
This diff is collapsed.
Click to expand it.
src/netcode/tic_command.h
+
1
−
1
View file @
d1ba9e0a
...
...
@@ -31,7 +31,7 @@ tic_t ExpandTics(INT32 low, INT32 node);
void
D_Clearticcmd
(
tic_t
tic
);
void
D_ResetTiccmds
(
void
);
void
PT_ClientCmd
(
SINT8
node
,
INT32
netconsole
);
void
PT_ClientCmd
(
SINT8
node
num
,
INT32
netconsole
);
void
PT_ServerTics
(
SINT8
node
,
INT32
netconsole
);
// send the client packet to the server
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment