Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2-Tests
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maru
SRB2-Tests
Commits
aa18d5c3
Commit
aa18d5c3
authored
2 years ago
by
LJ Sonic
Browse files
Options
Downloads
Patches
Plain Diff
Move net command sending to a new function
parent
4081dd8e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/netcode/net_command.c
+22
-0
22 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
+1
-21
1 addition, 21 deletions
src/netcode/tic_command.c
with
24 additions
and
21 deletions
src/netcode/net_command.c
+
22
−
0
View file @
aa18d5c3
...
...
@@ -324,6 +324,28 @@ void SV_CopyNetCommandsToServerPacket(tic_t tic)
}
void
CL_SendNetCommands
(
void
)
{
// Send extra data if needed
if
(
localtextcmd
[
0
])
{
netbuffer
->
packettype
=
PT_TEXTCMD
;
M_Memcpy
(
netbuffer
->
u
.
textcmd
,
localtextcmd
,
localtextcmd
[
0
]
+
1
);
// All extra data have been sent
if
(
HSendPacket
(
servernode
,
true
,
0
,
localtextcmd
[
0
]
+
1
))
// Send can fail...
localtextcmd
[
0
]
=
0
;
}
// Send extra data if needed for player 2 (splitscreen)
if
(
localtextcmd2
[
0
])
{
netbuffer
->
packettype
=
PT_TEXTCMD2
;
M_Memcpy
(
netbuffer
->
u
.
textcmd
,
localtextcmd2
,
localtextcmd2
[
0
]
+
1
);
// All extra data have been sent
if
(
HSendPacket
(
servernode
,
true
,
0
,
localtextcmd2
[
0
]
+
1
))
// Send can fail...
localtextcmd2
[
0
]
=
0
;
}
}
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 @
aa18d5c3
...
...
@@ -58,6 +58,7 @@ size_t TotalTextCmdPerTic(tic_t tic);
void
PT_TextCmd
(
SINT8
node
,
INT32
netconsole
);
void
SV_CopyNetCommandsToServerPacket
(
tic_t
tic
);
void
CL_SendNetCommands
(
void
);
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
+
1
−
21
View file @
aa18d5c3
...
...
@@ -295,27 +295,7 @@ void CL_SendClientCmd(void)
}
if
(
cl_mode
==
CL_CONNECTED
||
dedicated
)
{
// Send extra data if needed
if
(
localtextcmd
[
0
])
{
netbuffer
->
packettype
=
PT_TEXTCMD
;
M_Memcpy
(
netbuffer
->
u
.
textcmd
,
localtextcmd
,
localtextcmd
[
0
]
+
1
);
// All extra data have been sent
if
(
HSendPacket
(
servernode
,
true
,
0
,
localtextcmd
[
0
]
+
1
))
// Send can fail...
localtextcmd
[
0
]
=
0
;
}
// Send extra data if needed for player 2 (splitscreen)
if
(
localtextcmd2
[
0
])
{
netbuffer
->
packettype
=
PT_TEXTCMD2
;
M_Memcpy
(
netbuffer
->
u
.
textcmd
,
localtextcmd2
,
localtextcmd2
[
0
]
+
1
);
// All extra data have been sent
if
(
HSendPacket
(
servernode
,
true
,
0
,
localtextcmd2
[
0
]
+
1
))
// Send can fail...
localtextcmd2
[
0
]
=
0
;
}
}
CL_SendNetCommands
();
}
// send the server packet
...
...
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