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
4081dd8e
Commit
4081dd8e
authored
Jan 14, 2023
by
LJ Sonic
Browse files
Options
Downloads
Patches
Plain Diff
Move net command copying to a new function
parent
a7a3f97c
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/net_command.c
+20
-0
20 additions, 0 deletions
src/netcode/net_command.c
src/netcode/net_command.h
+1
-0
1 addition, 0 deletions
src/netcode/net_command.h
src/netcode/tic_command.c
+3
-18
3 additions, 18 deletions
src/netcode/tic_command.c
with
24 additions
and
18 deletions
src/netcode/net_command.c
+
20
−
0
View file @
4081dd8e
...
...
@@ -304,6 +304,26 @@ void PT_TextCmd(SINT8 node, INT32 netconsole)
}
}
void
SV_CopyNetCommandsToServerPacket
(
tic_t
tic
)
{
servertics_pak
*
packet
=
&
netbuffer
->
u
.
serverpak
;
UINT8
*
cmds
=
(
UINT8
*
)
&
packet
->
cmds
[
packet
->
numslots
*
packet
->
numtics
];
UINT8
numcmds
;
numcmds
=
*
cmds
++
;
for
(
UINT32
i
=
0
;
i
<
numcmds
;
i
++
)
{
INT32
playernum
=
*
cmds
++
;
// playernum
size_t
size
=
cmds
[
0
]
+
1
;
if
(
tic
>=
gametic
)
// Don't copy old net commands
M_Memcpy
(
D_GetTextcmd
(
tic
,
playernum
),
cmds
,
size
);
cmds
+=
size
;
}
}
void
CL_SendNetCommands
(
void
)
void
SendKick
(
UINT8
playernum
,
UINT8
msg
)
{
UINT8
buf
[
2
];
...
...
This diff is collapsed.
Click to expand it.
src/netcode/net_command.h
+
1
−
0
View file @
4081dd8e
...
...
@@ -57,6 +57,7 @@ void ExtraDataTicker(void);
size_t
TotalTextCmdPerTic
(
tic_t
tic
);
void
PT_TextCmd
(
SINT8
node
,
INT32
netconsole
);
void
SV_CopyNetCommandsToServerPacket
(
tic_t
tic
);
void
SendKick
(
UINT8
playernum
,
UINT8
msg
);
void
SendKicksForNode
(
SINT8
node
,
UINT8
msg
);
...
...
This diff is collapsed.
Click to expand it.
src/netcode/tic_command.c
+
3
−
18
View file @
4081dd8e
...
...
@@ -204,7 +204,6 @@ void PT_ClientCmd(SINT8 node, INT32 netconsole)
void
PT_ServerTics
(
SINT8
node
,
INT32
netconsole
)
{
UINT8
*
pak
,
*
txtpak
,
numtxtpak
;
tic_t
realend
,
realstart
;
if
(
!
netnodes
[
node
].
ingame
)
...
...
@@ -230,19 +229,15 @@ void PT_ServerTics(SINT8 node, INT32 netconsole)
realstart
=
netbuffer
->
u
.
serverpak
.
starttic
;
realend
=
realstart
+
netbuffer
->
u
.
serverpak
.
numtics
;
txtpak
=
(
UINT8
*
)
&
netbuffer
->
u
.
serverpak
.
cmds
[
netbuffer
->
u
.
serverpak
.
numslots
*
netbuffer
->
u
.
serverpak
.
numtics
];
if
(
realend
>
gametic
+
CLIENTBACKUPTICS
)
realend
=
gametic
+
CLIENTBACKUPTICS
;
cl_packetmissed
=
realstart
>
neededtic
;
if
(
realstart
<=
neededtic
&&
realend
>
neededtic
)
{
tic_t
i
,
j
;
pak
=
(
UINT8
*
)
&
netbuffer
->
u
.
serverpak
.
cmds
;
UINT8
*
pak
=
(
UINT8
*
)
&
netbuffer
->
u
.
serverpak
.
cmds
;
for
(
i
=
realstart
;
i
<
realend
;
i
++
)
for
(
tic_t
i
=
realstart
;
i
<
realend
;
i
++
)
{
// clear first
D_Clearticcmd
(
i
);
...
...
@@ -251,17 +246,7 @@ void PT_ServerTics(SINT8 node, INT32 netconsole)
pak
=
G_ScpyTiccmd
(
netcmds
[
i
%
BACKUPTICS
],
pak
,
netbuffer
->
u
.
serverpak
.
numslots
*
sizeof
(
ticcmd_t
));
// copy the textcmds
numtxtpak
=
*
txtpak
++
;
for
(
j
=
0
;
j
<
numtxtpak
;
j
++
)
{
INT32
k
=
*
txtpak
++
;
// playernum
const
size_t
txtsize
=
txtpak
[
0
]
+
1
;
if
(
i
>=
gametic
)
// Don't copy old net commands
M_Memcpy
(
D_GetTextcmd
(
i
,
k
),
txtpak
,
txtsize
);
txtpak
+=
txtsize
;
}
SV_CopyNetCommandsToServerPacket
(
i
);
}
neededtic
=
realend
;
...
...
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