some reformatting lel

This commit is contained in:
Alug committed 2025-04-29 21:38:28 +02:00
1 parent ebcdb23d34
commit 53b3a994fc
12 files changed
+89 -31

No files matched your search

+3
View File
@@ -4391,6 +4391,9 @@ void D_QuitNetGame(void)
HSendPacket(servernode, true, 0, 0);
}
#ifdef SEENAMES
seenplayer = NULL;
#endif
D_CloseConnection();
ClearAdminPlayers();
+47 -4
View File
@@ -109,20 +109,24 @@ boolean Net_GetNetStat(void)
{
const tic_t t = I_GetTime();
static INT64 oldsendbyte = 0;
if (statstarttic+STATLENGTH <= t)
{
const tic_t df = t-statstarttic;
const INT64 newsendbyte = sendbytes - oldsendbyte;
sendbps = (INT32)(newsendbyte*TICRATE)/df;
getbps = (getbytes*TICRATE)/df;
if (sendackpacket)
lostpercent = 100.0f*(float)retransmit/(float)sendackpacket;
else
lostpercent = 0.0f;
if (getackpacket)
duppercent = 100.0f*(float)duppacket/(float)getackpacket;
else
duppercent = 0.0f;
if (ticruned)
gamelostpercent = 100.0f*(float)ticmiss/(float)ticruned;
else
@@ -232,6 +236,7 @@ static boolean GetFreeAcknum(UINT8 *freeack)
}
for (i = 0; i < MAXACKPACKETS; i++)
{
if (!ackpak[i].acknum)
{
// For low priority packets, make sure to let freeslots so urgent packets can be sent
@@ -259,12 +264,14 @@ static boolean GetFreeAcknum(UINT8 *freeack)
return true;
}
}
#ifdef PARANOIA
CONS_Debug(DBG_NETPLAY, "No more free ackpacket\n");
#endif
if (netbuffer->packettype < PT_CANFAIL)
I_Error("Connection lost\n");
return false;
}
@@ -280,6 +287,7 @@ static void RemoveAck(INT32 i)
INT32 node = ackpak[i].destinationnode;
DEBFILE(va("Remove ack %d\n",ackpak[i].acknum));
ackpak[i].acknum = 0;
if (nodes[node].flags & NF_CLOSE)
Net_CloseConnection(node);
}
@@ -295,13 +303,16 @@ static boolean Processackpak(void)
if (netbuffer->ackreturn && cmpack(node->remotefirstack, netbuffer->ackreturn) < 0)
{
node->remotefirstack = netbuffer->ackreturn;
// Search the ackbuffer and free it
for (i = 0; i < MAXACKPACKETS; i++)
{
if (ackpak[i].acknum && ackpak[i].destinationnode == node - nodes
&& cmpack(ackpak[i].acknum, netbuffer->ackreturn) <= 0)
{
RemoveAck(i);
}
}
}
// Received a packet with ack, queue it to send the ack back
@@ -309,6 +320,7 @@ static boolean Processackpak(void)
{
UINT8 ack = netbuffer->ack;
getackpacket++;
if (cmpack(ack, node->firstacktosend) <= 0)
{
DEBFILE(va("Discard(1) ack %d (duplicated)\n", ack));
@@ -319,6 +331,7 @@ static boolean Processackpak(void)
{
// Check if it is not already in the queue
for (i = node->acktosend_tail; i != node->acktosend_head; i = (i+1) % MAXACKTOSEND)
{
if (node->acktosend[i] == ack)
{
DEBFILE(va("Discard(2) ack %d (duplicated)\n", ack));
@@ -326,11 +339,14 @@ static boolean Processackpak(void)
goodpacket = false; // Discard packet (duplicate)
break;
}
}
if (goodpacket)
{
// Is a good packet so increment the acknowledge number,
// Then search for a "hole" in the queue
UINT8 nextfirstack = (UINT8)(node->firstacktosend + 1);
if (!nextfirstack)
nextfirstack = 1;
@@ -343,9 +359,11 @@ static boolean Processackpak(void)
if (!nextfirstack)
nextfirstack = 1;
hm1 = (UINT8)((node->acktosend_head-1+MAXACKTOSEND) % MAXACKTOSEND);
while (change)
{
change = false;
for (i = node->acktosend_tail; i != node->acktosend_head;
i = (i+1) % MAXACKTOSEND)
{
@@ -358,6 +376,7 @@ static boolean Processackpak(void)
nextfirstack = 1;
change = true;
}
if (i == node->acktosend_tail)
{
node->acktosend[node->acktosend_tail] = 0;
@@ -379,6 +398,7 @@ static boolean Processackpak(void)
// Will be incremented when the nextfirstack comes (code above)
UINT8 newhead = (UINT8)((node->acktosend_head+1) % MAXACKTOSEND);
DEBFILE(va("out of order packet (%d expected)\n", nextfirstack));
if (newhead != node->acktosend_tail)
{
node->acktosend[node->acktosend_head] = ack;
@@ -415,8 +435,11 @@ static void GotAcks(void)
INT32 i, j;
for (j = 0; j < MAXACKTOSEND; j++)
{
if (netbuffer->u.textcmd[j])
{
for (i = 0; i < MAXACKPACKETS; i++)
{
if (ackpak[i].acknum && ackpak[i].destinationnode == doomcom->remotenode)
{
if (ackpak[i].acknum == netbuffer->u.textcmd[j])
@@ -431,6 +454,9 @@ static void GotAcks(void)
ackpak[i].senttime--; // hurry up
}
}
}
}
}
}
#endif
@@ -465,6 +491,7 @@ void Net_AckTicker(void)
{
const INT32 nodei = ackpak[i].destinationnode;
node_t *node = &nodes[nodei];
if (ackpak[i].acknum && ackpak[i].senttime + NODETIMEOUT < I_GetTime())
{
if (ackpak[i].resentnum > 10 && (node->flags & NF_CLOSE))
@@ -517,8 +544,10 @@ void Net_UnAcknowledgePacket(INT32 node)
#else
INT32 hm1 = (nodes[node].acktosend_head-1+MAXACKTOSEND) % MAXACKTOSEND;
DEBFILE(va("UnAcknowledge node %d\n", node));
if (!node)
return;
if (nodes[node].acktosend[hm1] == netbuffer->ack)
{
nodes[node].acktosend[hm1] = 0;
@@ -542,6 +571,7 @@ void Net_UnAcknowledgePacket(INT32 node)
if (!nodes[node].firstacktosend)
nodes[node].firstacktosend = UINT8_MAX;
}
nodes[node].firstacktosend++;
if (!nodes[node].firstacktosend)
nodes[node].firstacktosend = 1;
@@ -560,8 +590,10 @@ static boolean Net_AllAcksReceived(void)
INT32 i;
for (i = 0; i < MAXACKPACKETS; i++)
{
if (ackpak[i].acknum)
return false;
}
return true;
}
@@ -581,6 +613,7 @@ void Net_WaitAllAckReceived(UINT32 timeout)
timeout = tictac + timeout*NEWTICRATE;
HGetPacket();
while (timeout > I_GetTime() && !Net_AllAcksReceived())
{
while (tictac == I_GetTime())
@@ -588,6 +621,7 @@ void Net_WaitAllAckReceived(UINT32 timeout)
I_Sleep(cv_sleep.value);
I_UpdateTime(cv_timescale.value);
}
tictac = I_GetTime();
HGetPacket();
Net_AckTicker();
@@ -628,13 +662,14 @@ void Net_AbortPacketType(UINT8 packettype)
#ifdef NONET
(void)packettype;
#else
INT32 i;
for (i = 0; i < MAXACKPACKETS; i++)
for (INT32 i = 0; i < MAXACKPACKETS; i++)
{
if (ackpak[i].acknum && (ackpak[i].pak.data.packettype == packettype
|| packettype == UINT8_MAX))
{
ackpak[i].acknum = 0;
}
}
#endif
}
@@ -679,6 +714,7 @@ void Net_CloseConnection(INT32 node)
// check if we are waiting for an ack from this node
for (i = 0; i < MAXACKPACKETS; i++)
{
if (ackpak[i].acknum && ackpak[i].destinationnode == node)
{
if (!forceclose)
@@ -686,6 +722,7 @@ void Net_CloseConnection(INT32 node)
else
ackpak[i].acknum = 0;
}
}
InitNode(&nodes[node]);
SV_AbortSendFiles(node);
@@ -702,9 +739,8 @@ static UINT32 NetbufferChecksum(void)
UINT32 c = 0x1234567;
const INT32 l = doomcom->datalength - 4;
const UINT8 *buf = (UINT8 *)netbuffer + 4;
INT32 i;
for (i = 0; i < l; i++, buf++)
for (INT32 i = 0; i < l; i++, buf++)
c += (*buf) * (i+1);
return LONG(c);
@@ -719,6 +755,7 @@ static void fprintfstring(char *s, size_t len)
size_t i;
for (i = 0; i < len; i++)
{
if (s[i] < 32)
{
if (!mode)
@@ -738,6 +775,8 @@ static void fprintfstring(char *s, size_t len)
}
fprintf(debugfile, "%c", s[i]);
}
}
if (mode)
fprintf(debugfile, "]");
}
@@ -994,6 +1033,7 @@ static boolean ShouldDropPacket(void)
boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlength)
{
doomcom->datalength = (INT16)(packetlength + BASEPACKETSIZE);
if (node == 0) // Packet is to go back to us
{
if ((rebound_head+1) % MAXREBOUND == rebound_tail)
@@ -1029,6 +1069,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
// do this before GetFreeAcknum because this function backups
// the current packet
doomcom->remotenode = (INT16)node;
if (doomcom->datalength <= 0)
{
DEBFILE("HSendPacket: nothing to send\n");
@@ -1182,6 +1223,7 @@ static void Internal_FreeNodenum(INT32 nodenum)
SINT8 I_NetMakeNode(const char *hostname)
{
SINT8 newnode = -1;
if (I_NetMakeNodewPort)
{
char *localhostname = strdup(hostname);
@@ -1355,6 +1397,7 @@ void Command_Ping_f(void)
INT32 i;
pingc = 0;
for (i = 1; i < MAXPLAYERS; ++i)
{
if (playeringame[i])
+5
View File
@@ -2244,13 +2244,16 @@ static void Command_View_f(void)
if (COM_Argc() > 1)/* switch to player */
{
playerparam = COM_Argv(1);
if (playerparam[0] == '#')/* search by placement */
{
placenum = atoi(&playerparam[1]);
playernum = FindPlayerByPlace(placenum);
if (playernum == -1 || !G_CouldView(playernum))
{
GetViewablePlayerPlaceRange(&firstplace, &lastplace);
if (playernum == -1)
{
CONS_Alert(CONS_WARNING, "There is no player in that place! ");
@@ -2262,6 +2265,7 @@ static void Command_View_f(void)
"The first player that you can view is \x82#%d\x80; ",
firstplace);
}
CONS_Printf("Last place is \x82#%d\x80.\n", lastplace);
return;
}
@@ -2616,6 +2620,7 @@ void D_PickVote(void)
{
if (!playeringame[i] || players[i].spectator)
continue;
if (votes[i] != -1)
{
temppicks[numvotes] = i;
+1 -1
View File
@@ -412,7 +412,7 @@ typedef struct player_s
INT32 kartstuff[NUMKARTSTUFF];
angle_t frameangle; // for the player add the ability to have the sprite only face other angles
angle_t old_frameangle, old_frameangle2;
// SRB2Kart CEP: Sliptide rolling
angle_t sliproll;
-1
View File
@@ -22,7 +22,6 @@
#define SCREENVERTS 10
boolean GL_Init(void);
void GL_FinishUpdate(INT32 waitvbl);
void SetupGLInfo(void);
void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value);
+12 -9
View File
@@ -768,7 +768,7 @@ static UINT8 K_GetSpeedometerStyle(void)
return SPEEDO_EXTRA;
else if (cv_newspeedometer.value == 3 && achi_speedo)
return SPEEDO_ACHII;
else if (cv_newspeedometer.value == 4 && dial_speedo)
else if (cv_newspeedometer.value == 4 && dial_speedo)
return SPEEDO_DIAL;
else if (cv_newspeedometer.value == 5 && kartz_speedo)
return SPEEDO_PMETER;
@@ -10722,6 +10722,7 @@ static void K_drawKartMinimap(void)
INT32 minimaptrans, splitflags;
SINT8 localplayers[MAXSPLITSCREENPLAYERS];
SINT8 numlocalplayers = 0;
patch_t *AutomapPic = NULL;
// Draw the HUD only when playing in a level.
// hu_stuff needs this, unlike st_stuff.
@@ -10732,7 +10733,9 @@ static void K_drawKartMinimap(void)
if (stplyrnum != 0)
return;
if (minimapinfo.minimap_pic == NULL)
AutomapPic = minimapinfo.minimap_pic;
if (AutomapPic == NULL)
{
return; // no pic, just get outta here
}
@@ -10745,16 +10748,16 @@ static void K_drawKartMinimap(void)
drawinfo_t info;
K_getMinimapDrawinfo(&info);
x = info.x - (minimapinfo.minimap_pic->width/2);
y = info.y - (minimapinfo.minimap_pic->height/2);
x = info.x - (AutomapPic->width/2);
y = info.y - (AutomapPic->height/2);
splitflags = info.flags;
splitflags |= minimaptrans;
if (encoremode)
V_DrawScaledPatch(x+minimapinfo.minimap_pic->width, y, splitflags|V_FLIP, minimapinfo.minimap_pic);
V_DrawScaledPatch(x+AutomapPic->width, y, splitflags|V_FLIP, AutomapPic);
else
V_DrawScaledPatch(x, y, splitflags, minimapinfo.minimap_pic);
V_DrawScaledPatch(x, y, splitflags, AutomapPic);
if (!(splitscreen == 2))
{
@@ -10764,10 +10767,10 @@ static void K_drawKartMinimap(void)
// let offsets transfer to the heads, too!
if (encoremode)
x += minimapinfo.minimap_pic->leftoffset;
x += AutomapPic->leftoffset;
else
x -= minimapinfo.minimap_pic->leftoffset;
y -= minimapinfo.minimap_pic->topoffset;
x -= AutomapPic->leftoffset;
y -= AutomapPic->topoffset;
// initialize
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
+1 -1
View File
@@ -8,7 +8,7 @@
#define GLIB_DATABASE_MTABLE "metatable" /* Metatable.*/
#define GLIB_DATABASE_PROXY "proxy" /* Proxy table for the library that isn't the global table. */
static inline void lua_glib_push_db(lua_State *L)
FUNCINLINE static ATTRINLINE void lua_glib_push_db(lua_State *L)
{
lua_pushliteral(L, GLIB_DATABASE_GUID);
lua_gettable(L, LUA_REGISTRYINDEX);
+1
View File
@@ -485,6 +485,7 @@ static int lib_iterateDisplayplayers(lua_State *L)
if (!players[displayplayers[i]].mo)
continue;
LUA_PushUserdata(L, &players[displayplayers[i]], META_PLAYER);
lua_pushinteger(L, i); // push this to recall what number we were on for the next function call. I suppose this also means you can retrieve the splitscreen player number with 'for p, n in displayplayers.iterate'!
return 2;
+1 -1
View File
@@ -9255,7 +9255,7 @@ void A_Custom3DRotate(mobj_t *actor)
P_RemoveMobj(actor);
return;
}
if (hspeed==0 && vspeed==0)
{
if (cv_debug)
+1 -1
View File
@@ -3159,7 +3159,7 @@ static inline void P_UnArchiveSPGame(savebuffer_t *save, INT16 mapoverride)
// gamemap changed; we assume that its map header is always valid,
// so make it so
if(!mapheaderinfo[gamemap-1])
if (!mapheaderinfo[gamemap-1])
P_AllocMapHeader(gamemap-1);
lastmapsaved = gamemap;
+1 -1
View File
@@ -188,7 +188,7 @@ void P_RunDynamicSlopes(void)
if (slope->flags & SL_NODYNAMIC)
continue;
switch(slope->refpos)
switch (slope->refpos)
{
case 1: // front floor
zdelta = slope->sourceline->backsector->floorheight - slope->sourceline->frontsector->floorheight;
+16 -12
View File
@@ -144,8 +144,8 @@ UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask;
#define DEFAULT_STARTTRANSCOLOR 160
#define NUM_PALETTE_ENTRIES 256
static UINT8** translationtablecache[TT_CACHE_SIZE] = {NULL};
static UINT8** localtranslationtablecache[MAXLOCALSKINS] = {NULL};
static UINT8 **translationtablecache[TT_CACHE_SIZE] = {NULL};
static UINT8 **localtranslationtablecache[MAXLOCALSKINS] = {NULL};
// See also the enum skincolors_t
@@ -420,9 +420,9 @@ boolean R_BlendLevelVisible(INT32 blendmode, INT32 alphalevel)
/** \brief Retrieves a translation colormap from the cache.
\param skinnum number of skin, TC_DEFAULT or TC_BOSS
\param color translation color
\param flags set GTC_CACHE to use the cache
\param skinnum skin number, or a translation mode
\param color translation color
\param flags set GTC_CACHE to use the cache
\return Colormap. If not cached, caller should Z_Free.
*/
@@ -440,14 +440,18 @@ static UINT8* RGetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 f
else
{
tt = translationtablecache;
// Adjust if we want the default colormap
if (skinnum == TC_DEFAULT) skintableindex = DEFAULT_TT_CACHE_INDEX;
else if (skinnum == TC_BOSS) skintableindex = BOSS_TT_CACHE_INDEX;
else if (skinnum == TC_METALSONIC) skintableindex = METALSONIC_TT_CACHE_INDEX;
else if (skinnum == TC_ALLWHITE) skintableindex = ALLWHITE_TT_CACHE_INDEX;
else if (skinnum == TC_RAINBOW) skintableindex = RAINBOW_TT_CACHE_INDEX;
else if (skinnum == TC_BLINK) skintableindex = BLINK_TT_CACHE_INDEX;
else skintableindex = skinnum;
switch (skinnum)
{
case TC_DEFAULT: skintableindex = DEFAULT_TT_CACHE_INDEX; break;
case TC_BOSS: skintableindex = BOSS_TT_CACHE_INDEX; break;
case TC_METALSONIC: skintableindex = METALSONIC_TT_CACHE_INDEX; break;
case TC_ALLWHITE: skintableindex = ALLWHITE_TT_CACHE_INDEX; break;
case TC_RAINBOW: skintableindex = RAINBOW_TT_CACHE_INDEX; break;
case TC_BLINK: skintableindex = BLINK_TT_CACHE_INDEX; break;
default: skintableindex = skinnum; break;
}
}
if (flags & GTC_CACHE)