This commit is contained in:
Alug committed 2025-05-28 18:10:41 +02:00
1 parent 6c30b72ff5
commit bc0392babc
9 files changed
+69 -56

No files matched your search

+2
View File
@@ -318,11 +318,13 @@ static void AM_initVariables(void)
break;
plr = &players[pnum];
if (plr != NULL && plr->mo != NULL)
{
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
}
AM_changeWindowLoc();
// for saving & restoring
+7 -7
View File
@@ -1693,7 +1693,7 @@ static void SV_SendPlayerInfo(INT32 node)
continue;
}
if (playeringame[i] == UINT8_MAX || !playeringame[i])
if (playernode[i] == UINT8_MAX || !playeringame[i])
{
netbuffer->u.playerinfo[i].node = 255; // This slot is empty.
continue;
@@ -5324,18 +5324,18 @@ static void HandlePacketFromPlayer(SINT8 node)
/// \todo Use a separate cvar for that kind of timeout?
freezetimeout[node] = I_GetTime() + connectiontimeout;
// If we've alredy received a ticcmd for this tic, just submit it for the next one.
tic_t faketic = maketic;
if ((!!(netcmds[maketic % TICQUEUE][netconsole].angleturn & TICCMD_RECEIVED))
&& (maketic - firstticstosend < TICQUEUE - 1))
faketic++;
// Don't do anything for packets of type NODEKEEPALIVE?
// Sryder 2018/07/01: Update the freezetimeout still!
if (netbuffer->packettype == PT_NODEKEEPALIVE
|| netbuffer->packettype == PT_NODEKEEPALIVEMIS)
break;
// If we've alredy received a ticcmd for this tic, just submit it for the next one.
tic_t faketic = maketic;
if ((!!(netcmds[maketic % TICQUEUE][netconsole].angleturn & TICCMD_RECEIVED))
&& (maketic - firstticstosend < TICQUEUE - 1))
faketic++;
// Copy ticcmd
G_MoveTiccmd(&netcmds[faketic%TICQUEUE][netconsole], &netbuffer->u.clientpak.cmd, 1);
+6 -2
View File
@@ -2114,14 +2114,18 @@ static INT32 LookupPlayer(const char *s)
static INT32 FindPlayerByPlace(INT32 place)
{
INT32 playernum;
for (playernum = 0; playernum < MAXPLAYERS; ++playernum)
if (playeringame[playernum])
{
if (!playeringame[playernum])
continue;
if (players[playernum].kartstuff[k_position] == place)
{
return playernum;
}
}
return -1;
}
@@ -5673,7 +5677,7 @@ static void Command_Archivetest_f(void)
// assign mobjnum
i = 1;
for (th = thinkercap.next; th != &thinkercap; th = th->next)
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
if (th->function == (actionf_p1)P_MobjThinker)
((mobj_t *)th)->mobjnum = i++;
// allocate buffer
+29 -28
View File
@@ -6130,38 +6130,39 @@ void G_BeginRecording(void)
CV_SaveNetVars(&demobuf.p, true);
// Now store some info for each in-game player
for (p = 0; p < MAXPLAYERS; p++) {
if (playeringame[p]) {
player = &players[p];
for (p = 0; p < MAXPLAYERS; p++)
{
if (!playeringame[p])
continue;
WRITEUINT8(demobuf.p, p | (player->spectator ? DEMO_SPECTATOR : 0));
player = &players[p];
// Name
memset(name, 0, 16);
memcpy(name, player_names[p], 15);
M_Memcpy(demobuf.p,name,16);
demobuf.p += 16;
WRITEUINT8(demobuf.p, p | (player->spectator ? DEMO_SPECTATOR : 0));
// Skin
memset(name, 0, 16);
strncpy(name, skins[player->skin].name, 16);
M_Memcpy(demobuf.p,name,16);
demobuf.p += 16;
// Name
memset(name, 0, 16);
memcpy(name, player_names[p], 15);
M_Memcpy(demobuf.p,name,16);
demobuf.p += 16;
// Color
memset(name, 0, 16);
strncpy(name, KartColor_Names[player->skincolor], 16);
M_Memcpy(demobuf.p,name,16);
demobuf.p += 16;
// Skin
memset(name, 0, 16);
strncpy(name, skins[player->skin].name, 16);
M_Memcpy(demobuf.p,name,16);
demobuf.p += 16;
// Score, since Kart uses this to determine where you start on the map
WRITEUINT32(demobuf.p, player->score);
// Color
memset(name, 0, 16);
strncpy(name, KartColor_Names[player->skincolor], 16);
M_Memcpy(demobuf.p,name,16);
demobuf.p += 16;
// Kart speed and weight
WRITEUINT8(demobuf.p, skins[player->skin].kartspeed);
WRITEUINT8(demobuf.p, skins[player->skin].kartweight);
// Score, since Kart uses this to determine where you start on the map
WRITEUINT32(demobuf.p, player->score);
}
// Kart speed and weight
WRITEUINT8(demobuf.p, skins[player->skin].kartspeed);
WRITEUINT8(demobuf.p, skins[player->skin].kartweight);
}
WRITEUINT8(demobuf.p, 0xFF); // Denote the end of the player listing
@@ -7274,9 +7275,9 @@ void G_DoPlayDemo(char *defdemoname)
//LUA_HookInt(gamemap, HOOK(MapChange));
consoleplayer = 0;
memset(playeringame,0,sizeof(playeringame));
memset(displayplayers,0,sizeof(displayplayers));
memset(camera,0,sizeof(camera)); // reset freecam
memset(playeringame, 0, sizeof(playeringame));
memset(displayplayers, 0, sizeof(displayplayers));
memset(camera, 0, sizeof(camera)); // reset freecam
// Load players that were in-game when the map started
p = READUINT8(demobuf.p);
+7 -10
View File
@@ -887,10 +887,7 @@ void A_PointyThink(void *thing)
if (!playeringame[i] || players[i].spectator)
continue;
if (!players[i].mo)
continue;
if (!players[i].mo->health)
if (!players[i].mo || !players[i].mo->health)
continue;
if (!P_CheckSight(actor, players[i].mo))
@@ -2236,7 +2233,7 @@ void A_1upThinker(void *thing)
for (i = 0; i < MAXPLAYERS; i++)
{
if (!players[i].ingame || players[i].bot || players[i].spectator)
if (!playeringame[i] || players[i].bot || players[i].spectator)
continue;
if (!players[i].mo)
@@ -2435,7 +2432,7 @@ void A_BossDeath(void *thing)
// if all bosses are dead
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
if (th->function != (actionf_p1)P_MobjThinker)
continue;
mo2 = (mobj_t *)th;
@@ -3569,7 +3566,7 @@ void A_ThrownRing(void *thing)
if (actor->lastlook == stop)
return;
if (!players[actor->lastlook].ingame)
if (!playeringame[actor->lastlook])
continue;
if (c++ == 2)
@@ -6623,7 +6620,7 @@ void A_EggShield(void *thing)
// Search for players to push
for (i = 0; i < MAXPLAYERS; i++)
{
if (!players[i].ingame || players[i].spectator)
if (!playeringame[i] || players[i].spectator)
continue;
player = &players[i];
@@ -8738,7 +8735,7 @@ void A_ReaperThinker(void *thing)
for (i = 0; i<MAXPLAYERS; i++)
{
if (!players[i].ingame)
if (!playeringame[i])
continue;
player = &players[i];
@@ -10421,7 +10418,7 @@ void A_VileTarget(void *thing)
// Our "Archvile" here is actually Oprah. "YOU GET A TARGET! YOU GET A TARGET! YOU ALL GET A TARGET!"
for (i = 0; i < MAXPLAYERS; i++)
{
if (!players[i].ingame || players[i].spectator)
if (!playeringame[i] || players[i].spectator)
continue;
if (!players[i].mo || !players[i].mo->health)
+2 -2
View File
@@ -4044,7 +4044,7 @@ static void P_Boss3Thinker(mobj_t *mobj)
// this can happen if the boss was hurt earlier than expected
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
if (th->function != (actionf_p1)P_MobjThinker)
continue;
mo2 = (mobj_t *)th;
@@ -9718,7 +9718,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
for (i = 0; i < MAXPLAYERS; i++)
{
if (!players[i].ingame)
if (!playeringame[i])
continue;
pnum[pcount] = i;
+3 -2
View File
@@ -1343,7 +1343,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
{
for (i = 0; i < MAXPLAYERS; i++)
{
if (!players[i].ingame || players[i].spectator)
if (!playeringame[i] || players[i].spectator)
continue;
if (!players[i].mo || players[i].mo->health < 1)
@@ -3887,8 +3887,9 @@ DoneSection2:
for (i = 0; i < MAXPLAYERS; i++)
{
if (!players[i].ingame || players[i].spectator)
if (!playeringame[i] || players[i].spectator)
continue;
nump++;
}
+6 -2
View File
@@ -733,8 +733,10 @@ void P_Ticker(boolean run)
PS_START_TIMING(ps_playerthink_time);
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
{
if (playeringame[i] && !P_MobjWasRemoved(players[i].mo))
P_PlayerThink(&players[i]);
}
PS_STOP_TIMING(ps_playerthink_time);
}
@@ -753,8 +755,10 @@ void P_Ticker(boolean run)
// Run any "after all the other thinkers" stuff
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
{
if (playeringame[i] && !P_MobjWasRemoved(players[i].mo))
P_PlayerAfterThink(&players[i]);
}
// Apply rumble to local players
if (!demo.playback)
+7 -3
View File
@@ -552,9 +552,13 @@ static UINT8 getPlayerPos(player_t *player)
{
UINT8 pos = 1;
for (int i = 0; i < MAXPLAYERS; ++i) {
if (!playeringame[i] || players[i].spectator) continue;
if (players[i].marescore > player->marescore) ++pos;
for (UINT8 i = 0; i < MAXPLAYERS; ++i)
{
if (!playeringame[i] || players[i].spectator)
continue;
if (players[i].marescore > player->marescore)
++pos;
}
return pos;