mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-23 16:32:36 +00:00
Tracy extensions
This commit is contained in:
parent
3f15fca32e
commit
439115927b
6 changed files with 284 additions and 22 deletions
|
|
@ -130,8 +130,8 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
|
||||||
k_pathfind.c
|
k_pathfind.c
|
||||||
k_bheap.c
|
k_bheap.c
|
||||||
k_bot.cpp
|
k_bot.cpp
|
||||||
k_botitem.c
|
k_botitem.cpp
|
||||||
k_botsearch.c
|
k_botsearch.cpp
|
||||||
k_grandprix.c
|
k_grandprix.c
|
||||||
k_boss.c
|
k_boss.c
|
||||||
k_hud.cpp
|
k_hud.cpp
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <tracy/tracy/Tracy.hpp>
|
||||||
|
|
||||||
#include "cxxutil.hpp"
|
#include "cxxutil.hpp"
|
||||||
|
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
|
|
@ -808,6 +810,8 @@ static fixed_t K_ScaleWPDistWithSlope(fixed_t disttonext, angle_t angletonext, c
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static botprediction_t *K_CreateBotPrediction(const player_t *player)
|
static botprediction_t *K_CreateBotPrediction(const player_t *player)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const precise_t time = I_GetPreciseTime();
|
const precise_t time = I_GetPreciseTime();
|
||||||
|
|
||||||
// Stair janking makes it harder to steer, so attempt to steer harder.
|
// Stair janking makes it harder to steer, so attempt to steer harder.
|
||||||
|
|
@ -940,6 +944,8 @@ static botprediction_t *K_CreateBotPrediction(const player_t *player)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static UINT8 K_TrySpindash(const player_t *player, ticcmd_t *cmd)
|
static UINT8 K_TrySpindash(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const tic_t difficultyModifier = (TICRATE/6);
|
const tic_t difficultyModifier = (TICRATE/6);
|
||||||
|
|
||||||
const fixed_t oldSpeed = R_PointToDist2(0, 0, player->rmomx, player->rmomy);
|
const fixed_t oldSpeed = R_PointToDist2(0, 0, player->rmomx, player->rmomy);
|
||||||
|
|
@ -1072,6 +1078,8 @@ static UINT8 K_TrySpindash(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static boolean K_TryRingShooter(const player_t *player)
|
static boolean K_TryRingShooter(const player_t *player)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
if (player->respawn.state != RESPAWNST_NONE)
|
if (player->respawn.state != RESPAWNST_NONE)
|
||||||
{
|
{
|
||||||
// We're already respawning!
|
// We're already respawning!
|
||||||
|
|
@ -1213,6 +1221,8 @@ static void K_BotTrick(const player_t *player, ticcmd_t *cmd, const botcontrolle
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static angle_t K_BotSmoothLanding(const player_t *player, angle_t destangle)
|
static angle_t K_BotSmoothLanding(const player_t *player, angle_t destangle)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
angle_t newAngle = destangle;
|
angle_t newAngle = destangle;
|
||||||
boolean air = !P_IsObjectOnGround(player->mo);
|
boolean air = !P_IsObjectOnGround(player->mo);
|
||||||
angle_t steepVal = air ? STUMBLE_STEEP_VAL_AIR : STUMBLE_STEEP_VAL;
|
angle_t steepVal = air ? STUMBLE_STEEP_VAL_AIR : STUMBLE_STEEP_VAL;
|
||||||
|
|
@ -1262,6 +1272,8 @@ static angle_t K_BotSmoothLanding(const player_t *player, angle_t destangle)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static INT32 K_HandleBotTrack(const player_t *player, ticcmd_t *cmd, botprediction_t *predict, angle_t destangle)
|
static INT32 K_HandleBotTrack(const player_t *player, ticcmd_t *cmd, botprediction_t *predict, angle_t destangle)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
// Handle steering towards waypoints!
|
// Handle steering towards waypoints!
|
||||||
INT32 turnamt = 0;
|
INT32 turnamt = 0;
|
||||||
SINT8 turnsign = 0;
|
SINT8 turnsign = 0;
|
||||||
|
|
@ -1362,6 +1374,8 @@ static INT32 K_HandleBotTrack(const player_t *player, ticcmd_t *cmd, botpredicti
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static INT32 K_HandleBotReverse(const player_t *player, ticcmd_t *cmd, botprediction_t *predict, angle_t destangle)
|
static INT32 K_HandleBotReverse(const player_t *player, ticcmd_t *cmd, botprediction_t *predict, angle_t destangle)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
// Handle steering towards waypoints!
|
// Handle steering towards waypoints!
|
||||||
INT32 turnamt = 0;
|
INT32 turnamt = 0;
|
||||||
SINT8 turnsign = 0;
|
SINT8 turnsign = 0;
|
||||||
|
|
@ -1847,6 +1861,8 @@ void K_BuildBotTiccmd(
|
||||||
player_t *player, // annoyingly NOT const because of LUA_HookTiccmd... grumble grumble
|
player_t *player, // annoyingly NOT const because of LUA_HookTiccmd... grumble grumble
|
||||||
ticcmd_t *cmd)
|
ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
// Remove any existing controls
|
// Remove any existing controls
|
||||||
memset(cmd, 0, sizeof(ticcmd_t));
|
memset(cmd, 0, sizeof(ticcmd_t));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@
|
||||||
/// \file k_botitem.c
|
/// \file k_botitem.c
|
||||||
/// \brief Bot item usage logic
|
/// \brief Bot item usage logic
|
||||||
|
|
||||||
|
#include <tracy/tracy/Tracy.hpp>
|
||||||
|
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "d_player.h"
|
#include "d_player.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
|
|
@ -61,6 +63,8 @@ static inline boolean K_ItemButtonWasDown(const player_t *player)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static boolean K_BotUseItemNearPlayer(const player_t *player, ticcmd_t *cmd, fixed_t radius)
|
static boolean K_BotUseItemNearPlayer(const player_t *player, ticcmd_t *cmd, fixed_t radius)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|
||||||
if (K_ItemButtonWasDown(player) == true)
|
if (K_ItemButtonWasDown(player) == true)
|
||||||
|
|
@ -119,6 +123,8 @@ static boolean K_BotUseItemNearPlayer(const player_t *player, ticcmd_t *cmd, fix
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static player_t *K_PlayerNearSpot(const player_t *player, fixed_t x, fixed_t y, fixed_t radius)
|
static player_t *K_PlayerNearSpot(const player_t *player, fixed_t x, fixed_t y, fixed_t radius)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
|
|
@ -168,11 +174,14 @@ static player_t *K_PlayerNearSpot(const player_t *player, fixed_t x, fixed_t y,
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static player_t *K_PlayerPredictThrow(const player_t *player, UINT8 extra)
|
static player_t *K_PlayerPredictThrow(const player_t *player, UINT8 extra)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const fixed_t dist = (30 + (extra * 10)) * player->mo->scale;
|
const fixed_t dist = (30 + (extra * 10)) * player->mo->scale;
|
||||||
const UINT32 airtime = FixedDiv(dist + player->mo->momz, gravity);
|
const UINT32 airtime = FixedDiv(dist + player->mo->momz, gravity);
|
||||||
const fixed_t throwspeed = FixedMul(82 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
const fixed_t throwspeed = FixedMul(82 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
||||||
const fixed_t estx = player->mo->x + P_ReturnThrustX(NULL, player->mo->angle, (throwspeed + player->speed) * airtime);
|
const fixed_t estx = player->mo->x + P_ReturnThrustX(NULL, player->mo->angle, (throwspeed + player->speed) * airtime);
|
||||||
const fixed_t esty = player->mo->y + P_ReturnThrustY(NULL, player->mo->angle, (throwspeed + player->speed) * airtime);
|
const fixed_t esty = player->mo->y + P_ReturnThrustY(NULL, player->mo->angle, (throwspeed + player->speed) * airtime);
|
||||||
|
|
||||||
return K_PlayerNearSpot(player, estx, esty, player->mo->radius * 2);
|
return K_PlayerNearSpot(player, estx, esty, player->mo->radius * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -192,6 +201,8 @@ static player_t *K_PlayerPredictThrow(const player_t *player, UINT8 extra)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static player_t *K_PlayerInCone(const player_t *player, fixed_t radius, UINT16 cone, boolean flip)
|
static player_t *K_PlayerInCone(const player_t *player, fixed_t radius, UINT16 cone, boolean flip)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
|
|
@ -346,6 +357,8 @@ static void K_ItemConfirmForTarget(const player_t *bot, ticcmd_t *cmd, const pla
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static boolean K_BotGenericPressItem(const player_t *player, ticcmd_t *cmd, SINT8 dir)
|
static boolean K_BotGenericPressItem(const player_t *player, ticcmd_t *cmd, SINT8 dir)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
if (K_ItemButtonWasDown(player) == true)
|
if (K_ItemButtonWasDown(player) == true)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -371,6 +384,8 @@ static boolean K_BotGenericPressItem(const player_t *player, ticcmd_t *cmd, SINT
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemGenericTap(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemGenericTap(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
if (K_ItemButtonWasDown(player) == false)
|
if (K_ItemButtonWasDown(player) == false)
|
||||||
{
|
{
|
||||||
cmd->buttons |= BT_ATTACK;
|
cmd->buttons |= BT_ATTACK;
|
||||||
|
|
@ -393,6 +408,8 @@ static void K_BotItemGenericTap(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static boolean K_BotRevealsGenericTrap(const player_t *player, INT16 turnamt, boolean mine)
|
static boolean K_BotRevealsGenericTrap(const player_t *player, INT16 turnamt, boolean mine)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
||||||
|
|
||||||
if (abs(turnamt) >= KART_FULLTURN/2)
|
if (abs(turnamt) >= KART_FULLTURN/2)
|
||||||
|
|
@ -441,6 +458,8 @@ static boolean K_BotRevealsGenericTrap(const player_t *player, INT16 turnamt, bo
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemGenericTrapShield(const player_t *player, ticcmd_t *cmd, INT16 turnamt, boolean mine)
|
static void K_BotItemGenericTrapShield(const player_t *player, ticcmd_t *cmd, INT16 turnamt, boolean mine)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
if (player->itemflags & IF_ITEMOUT)
|
if (player->itemflags & IF_ITEMOUT)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -468,6 +487,8 @@ static void K_BotItemGenericTrapShield(const player_t *player, ticcmd_t *cmd, IN
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemGenericOrbitShield(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemGenericOrbitShield(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
if (player->itemflags & IF_ITEMOUT)
|
if (player->itemflags & IF_ITEMOUT)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -490,6 +511,8 @@ static void K_BotItemGenericOrbitShield(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemSneaker(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemSneaker(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
if (P_IsObjectOnGround(player->mo) == false)
|
if (P_IsObjectOnGround(player->mo) == false)
|
||||||
{
|
{
|
||||||
// Don't use while mid-air.
|
// Don't use while mid-air.
|
||||||
|
|
@ -528,6 +551,8 @@ static void K_BotItemSneaker(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemRocketSneaker(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemRocketSneaker(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
if (P_IsObjectOnGround(player->mo) == false)
|
if (P_IsObjectOnGround(player->mo) == false)
|
||||||
{
|
{
|
||||||
// Don't use while mid-air.
|
// Don't use while mid-air.
|
||||||
|
|
@ -563,6 +588,8 @@ static void K_BotItemRocketSneaker(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemBanana(const player_t *player, ticcmd_t *cmd, INT16 turnamt)
|
static void K_BotItemBanana(const player_t *player, ticcmd_t *cmd, INT16 turnamt)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
||||||
SINT8 throwdir = -1;
|
SINT8 throwdir = -1;
|
||||||
boolean tryLookback = false;
|
boolean tryLookback = false;
|
||||||
|
|
@ -620,6 +647,8 @@ static void K_BotItemBanana(const player_t *player, ticcmd_t *cmd, INT16 turnamt
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemMine(const player_t *player, ticcmd_t *cmd, INT16 turnamt)
|
static void K_BotItemMine(const player_t *player, ticcmd_t *cmd, INT16 turnamt)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
||||||
SINT8 throwdir = 0;
|
SINT8 throwdir = 0;
|
||||||
boolean tryLookback = false;
|
boolean tryLookback = false;
|
||||||
|
|
@ -683,6 +712,8 @@ static void K_BotItemMine(const player_t *player, ticcmd_t *cmd, INT16 turnamt)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemLandmine(const player_t *player, ticcmd_t *cmd, INT16 turnamt)
|
static void K_BotItemLandmine(const player_t *player, ticcmd_t *cmd, INT16 turnamt)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
||||||
player_t *target = NULL;
|
player_t *target = NULL;
|
||||||
|
|
||||||
|
|
@ -720,6 +751,8 @@ static void K_BotItemLandmine(const player_t *player, ticcmd_t *cmd, INT16 turna
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemEggman(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemEggman(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
||||||
const UINT8 stealth = K_EggboxStealth(player->mo->x, player->mo->y);
|
const UINT8 stealth = K_EggboxStealth(player->mo->x, player->mo->y);
|
||||||
SINT8 throwdir = -1;
|
SINT8 throwdir = -1;
|
||||||
|
|
@ -773,6 +806,8 @@ static void K_BotItemEggman(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static boolean K_BotRevealsEggbox(const player_t *player)
|
static boolean K_BotRevealsEggbox(const player_t *player)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
const fixed_t coneDist = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
||||||
const UINT8 stealth = K_EggboxStealth(player->mo->x, player->mo->y);
|
const UINT8 stealth = K_EggboxStealth(player->mo->x, player->mo->y);
|
||||||
player_t *target = NULL;
|
player_t *target = NULL;
|
||||||
|
|
@ -814,6 +849,8 @@ static boolean K_BotRevealsEggbox(const player_t *player)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemEggmanShield(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemEggmanShield(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
if (player->itemflags & IF_EGGMANOUT)
|
if (player->itemflags & IF_EGGMANOUT)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -841,6 +878,8 @@ static void K_BotItemEggmanShield(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemEggmanExplosion(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemEggmanExplosion(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
if (player->position == 1)
|
if (player->position == 1)
|
||||||
{
|
{
|
||||||
// Hey, we aren't gonna find anyone up here...
|
// Hey, we aren't gonna find anyone up here...
|
||||||
|
|
@ -865,6 +904,8 @@ static void K_BotItemEggmanExplosion(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemOrbinaut(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemOrbinaut(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const fixed_t topspeed = K_GetKartSpeed(player, false, true);
|
const fixed_t topspeed = K_GetKartSpeed(player, false, true);
|
||||||
fixed_t radius = FixedMul(2560 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
fixed_t radius = FixedMul(2560 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
||||||
SINT8 throwdir = -1;
|
SINT8 throwdir = -1;
|
||||||
|
|
@ -923,6 +964,8 @@ static void K_BotItemOrbinaut(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemBallhog(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemBallhog(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const fixed_t topspeed = K_GetKartSpeed(player, false, true);
|
const fixed_t topspeed = K_GetKartSpeed(player, false, true);
|
||||||
fixed_t radius = FixedMul(2560 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
fixed_t radius = FixedMul(2560 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
||||||
SINT8 throwdir = -1;
|
SINT8 throwdir = -1;
|
||||||
|
|
@ -998,6 +1041,8 @@ static void K_BotItemBallhog(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemDropTarget(const player_t *player, ticcmd_t *cmd, INT16 turnamt)
|
static void K_BotItemDropTarget(const player_t *player, ticcmd_t *cmd, INT16 turnamt)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const fixed_t topspeed = K_GetKartSpeed(player, false, true);
|
const fixed_t topspeed = K_GetKartSpeed(player, false, true);
|
||||||
fixed_t radius = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
fixed_t radius = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
||||||
SINT8 throwdir = -1;
|
SINT8 throwdir = -1;
|
||||||
|
|
@ -1062,6 +1107,8 @@ static void K_BotItemDropTarget(const player_t *player, ticcmd_t *cmd, INT16 tur
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemJawz(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemJawz(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const fixed_t topspeed = K_GetKartSpeed(player, false, true);
|
const fixed_t topspeed = K_GetKartSpeed(player, false, true);
|
||||||
fixed_t radius = FixedMul(2560 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
fixed_t radius = FixedMul(2560 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
||||||
SINT8 throwdir = 1;
|
SINT8 throwdir = 1;
|
||||||
|
|
@ -1142,6 +1189,8 @@ static void K_BotItemJawz(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemLightning(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemLightning(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
if (K_BotUseItemNearPlayer(player, cmd, 192*player->mo->scale) == false)
|
if (K_BotUseItemNearPlayer(player, cmd, 192*player->mo->scale) == false)
|
||||||
{
|
{
|
||||||
if (player->botvars.itemconfirm > 10*TICRATE)
|
if (player->botvars.itemconfirm > 10*TICRATE)
|
||||||
|
|
@ -1169,6 +1218,8 @@ static void K_BotItemLightning(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemBubble(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemBubble(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
boolean hold = false;
|
boolean hold = false;
|
||||||
|
|
||||||
if (player->bubbleblowup <= 0)
|
if (player->bubbleblowup <= 0)
|
||||||
|
|
@ -1246,6 +1297,8 @@ static void K_BotItemBubble(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemFlame(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemFlame(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
if (player->botvars.itemconfirm > 0)
|
if (player->botvars.itemconfirm > 0)
|
||||||
{
|
{
|
||||||
cmd->bot.itemconfirm--;
|
cmd->bot.itemconfirm--;
|
||||||
|
|
@ -1279,6 +1332,8 @@ static void K_BotItemFlame(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemGardenTopDeploy(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemGardenTopDeploy(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
cmd->bot.itemconfirm++;
|
cmd->bot.itemconfirm++;
|
||||||
|
|
||||||
//if (player->curshield != KSHIELD_TOP)
|
//if (player->curshield != KSHIELD_TOP)
|
||||||
|
|
@ -1303,6 +1358,8 @@ static void K_BotItemGardenTopDeploy(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemGardenTop(const player_t *player, ticcmd_t *cmd, INT16 turnamt)
|
static void K_BotItemGardenTop(const player_t *player, ticcmd_t *cmd, INT16 turnamt)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const fixed_t topspeed = K_GetKartSpeed(player, false, true);
|
const fixed_t topspeed = K_GetKartSpeed(player, false, true);
|
||||||
fixed_t radius = FixedMul(2560 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
fixed_t radius = FixedMul(2560 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
||||||
SINT8 throwdir = -1;
|
SINT8 throwdir = -1;
|
||||||
|
|
@ -1367,6 +1424,8 @@ static void K_BotItemGardenTop(const player_t *player, ticcmd_t *cmd, INT16 turn
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemRings(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemRings(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
INT32 saferingsval = 16 - K_GetKartRingPower(player, false);
|
INT32 saferingsval = 16 - K_GetKartRingPower(player, false);
|
||||||
|
|
||||||
if (leveltime < starttime)
|
if (leveltime < starttime)
|
||||||
|
|
@ -1413,6 +1472,8 @@ static void K_BotItemRings(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemInstashield(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemInstashield(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const fixed_t radius = FixedMul(mobjinfo[MT_INSTAWHIP].radius, player->mo->scale);
|
const fixed_t radius = FixedMul(mobjinfo[MT_INSTAWHIP].radius, player->mo->scale);
|
||||||
size_t i = SIZE_MAX;
|
size_t i = SIZE_MAX;
|
||||||
|
|
||||||
|
|
@ -1500,6 +1561,8 @@ static tic_t K_BotItemRouletteMashConfirm(const player_t *player)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static void K_BotItemRouletteMash(const player_t *player, ticcmd_t *cmd)
|
static void K_BotItemRouletteMash(const player_t *player, ticcmd_t *cmd)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const tic_t confirmTime = K_BotItemRouletteMashConfirm(player);
|
const tic_t confirmTime = K_BotItemRouletteMashConfirm(player);
|
||||||
|
|
||||||
if (K_ItemButtonWasDown(player) == true)
|
if (K_ItemButtonWasDown(player) == true)
|
||||||
|
|
@ -1521,6 +1584,8 @@ static void K_BotItemRouletteMash(const player_t *player, ticcmd_t *cmd)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
void K_BotItemUsage(const player_t *player, ticcmd_t *cmd, INT16 turnamt)
|
void K_BotItemUsage(const player_t *player, ticcmd_t *cmd, INT16 turnamt)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
if (player->itemflags & IF_USERINGS)
|
if (player->itemflags & IF_USERINGS)
|
||||||
{
|
{
|
||||||
if (player->rings > 0)
|
if (player->rings > 0)
|
||||||
|
|
@ -1703,7 +1768,7 @@ static void K_UpdateBotGameplayVarsItemUsageMash(player_t *player)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
botItemPriority_e currentPriority = K_GetBotItemPriority(
|
botItemPriority_e currentPriority = K_GetBotItemPriority(
|
||||||
player->itemRoulette.itemList[ player->itemRoulette.index ]
|
static_cast<kartitems_t>( player->itemRoulette.itemList[ player->itemRoulette.index ] )
|
||||||
);
|
);
|
||||||
|
|
||||||
if (player->botvars.roulettePriority == currentPriority)
|
if (player->botvars.roulettePriority == currentPriority)
|
||||||
|
|
@ -1762,6 +1827,8 @@ void K_UpdateBotGameplayVarsItemUsage(player_t *player)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
void K_BotPickItemPriority(player_t *player)
|
void K_BotPickItemPriority(player_t *player)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const fixed_t closeDistance = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
const fixed_t closeDistance = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
|
@ -1777,7 +1844,7 @@ void K_BotPickItemPriority(player_t *player)
|
||||||
// Check for items that are extremely high priority.
|
// Check for items that are extremely high priority.
|
||||||
for (i = 0; i < player->itemRoulette.itemListLen; i++)
|
for (i = 0; i < player->itemRoulette.itemListLen; i++)
|
||||||
{
|
{
|
||||||
botItemPriority_e priority = K_GetBotItemPriority( player->itemRoulette.itemList[i] );
|
botItemPriority_e priority = K_GetBotItemPriority( static_cast<kartitems_t>( player->itemRoulette.itemList[i] ) );
|
||||||
|
|
||||||
if (priority < BOT_ITEM_PR__OVERRIDES)
|
if (priority < BOT_ITEM_PR__OVERRIDES)
|
||||||
{
|
{
|
||||||
|
|
@ -1794,7 +1861,7 @@ void K_BotPickItemPriority(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player->botvars.roulettePriority = max( player->botvars.roulettePriority, priority );
|
player->botvars.roulettePriority = std::max( static_cast<botItemPriority_e>( player->botvars.roulettePriority ), priority );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->botvars.roulettePriority >= BOT_ITEM_PR__OVERRIDES)
|
if (player->botvars.roulettePriority >= BOT_ITEM_PR__OVERRIDES)
|
||||||
|
|
@ -10,6 +10,8 @@
|
||||||
/// \file k_botsearch.c
|
/// \file k_botsearch.c
|
||||||
/// \brief Bot blockmap search functions
|
/// \brief Bot blockmap search functions
|
||||||
|
|
||||||
|
#include <tracy/tracy/Tracy.hpp>
|
||||||
|
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "d_player.h"
|
#include "d_player.h"
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
|
|
@ -90,6 +92,8 @@ static BlockItReturn_t K_FindEggboxes(mobj_t *thing)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
UINT8 K_EggboxStealth(fixed_t x, fixed_t y)
|
UINT8 K_EggboxStealth(fixed_t x, fixed_t y)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
INT32 xl, xh, yl, yh, bx, by;
|
INT32 xl, xh, yl, yh, bx, by;
|
||||||
|
|
||||||
g_eggboxSearch.eggboxx = x;
|
g_eggboxSearch.eggboxx = x;
|
||||||
|
|
@ -392,8 +396,9 @@ static boolean K_PlayerAttackSteer(mobj_t *thing, UINT8 side, UINT8 weight, bool
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
static BlockItReturn_t K_FindObjectsForNudging(mobj_t *thing)
|
static BlockItReturn_t K_FindObjectsForNudging(mobj_t *thing)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
INT16 angledelta, anglediff;
|
INT16 angledelta, anglediff;
|
||||||
fixed_t fulldist;
|
|
||||||
angle_t destangle, angle;
|
angle_t destangle, angle;
|
||||||
UINT8 side = 0;
|
UINT8 side = 0;
|
||||||
|
|
||||||
|
|
@ -412,17 +417,22 @@ static BlockItReturn_t K_FindObjectsForNudging(mobj_t *thing)
|
||||||
return BMIT_CONTINUE;
|
return BMIT_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fulldist = R_PointToDist2(g_nudgeSearch.botmo->x, g_nudgeSearch.botmo->y, thing->x, thing->y) - thing->radius;
|
const fixed_t xDelta = abs(g_nudgeSearch.botmo->x - thing->x);
|
||||||
|
const fixed_t yDelta = abs(g_nudgeSearch.botmo->y - thing->y);
|
||||||
|
const fixed_t fullDist = (FixedMul(xDelta, xDelta) + FixedMul(yDelta, yDelta)) - FixedMul(thing->radius, thing->radius);
|
||||||
|
|
||||||
if (fulldist > g_nudgeSearch.distancetocheck)
|
if (fullDist > g_nudgeSearch.distancetocheck)
|
||||||
{
|
{
|
||||||
return BMIT_CONTINUE;
|
return BMIT_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// this is very expensive to do, and probably not worth it.
|
||||||
if (P_CheckSight(g_nudgeSearch.botmo, thing) == false)
|
if (P_CheckSight(g_nudgeSearch.botmo, thing) == false)
|
||||||
{
|
{
|
||||||
return BMIT_CONTINUE;
|
return BMIT_CONTINUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
destangle = R_PointToAngle2(g_nudgeSearch.botmo->x, g_nudgeSearch.botmo->y, thing->x, thing->y);
|
destangle = R_PointToAngle2(g_nudgeSearch.botmo->x, g_nudgeSearch.botmo->y, thing->x, thing->y);
|
||||||
angle = (g_nudgeSearch.angle - destangle);
|
angle = (g_nudgeSearch.angle - destangle);
|
||||||
|
|
@ -670,6 +680,8 @@ static BlockItReturn_t K_FindObjectsForNudging(mobj_t *thing)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
void K_NudgePredictionTowardsObjects(botprediction_t *predict, const player_t *player)
|
void K_NudgePredictionTowardsObjects(botprediction_t *predict, const player_t *player)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
const precise_t time = I_GetPreciseTime();
|
const precise_t time = I_GetPreciseTime();
|
||||||
|
|
||||||
INT32 xl, xh, yl, yh, bx, by;
|
INT32 xl, xh, yl, yh, bx, by;
|
||||||
|
|
@ -696,10 +708,10 @@ void K_NudgePredictionTowardsObjects(botprediction_t *predict, const player_t *p
|
||||||
}
|
}
|
||||||
|
|
||||||
distToPredict = R_PointToDist2(player->mo->x, player->mo->y, predict->x, predict->y);
|
distToPredict = R_PointToDist2(player->mo->x, player->mo->y, predict->x, predict->y);
|
||||||
radToPredict = distToPredict >> 1;
|
|
||||||
angleToPredict = R_PointToAngle2(player->mo->x, player->mo->y, predict->x, predict->y);
|
angleToPredict = R_PointToAngle2(player->mo->x, player->mo->y, predict->x, predict->y);
|
||||||
|
|
||||||
g_nudgeSearch.distancetocheck = distToPredict;
|
radToPredict = distToPredict >> 1;
|
||||||
|
g_nudgeSearch.distancetocheck = FixedMul(radToPredict, radToPredict);
|
||||||
|
|
||||||
baseNudge = predict->baseRadius >> 3;
|
baseNudge = predict->baseRadius >> 3;
|
||||||
maxNudge = predict->baseRadius - baseNudge;
|
maxNudge = predict->baseRadius - baseNudge;
|
||||||
|
|
@ -720,10 +732,10 @@ void K_NudgePredictionTowardsObjects(botprediction_t *predict, const player_t *p
|
||||||
g_nudgeSearch.avoidObjs[i] = 0;
|
g_nudgeSearch.avoidObjs[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
xl = (unsigned)(avgX - (distToPredict + MAXRADIUS) - bmaporgx)>>MAPBLOCKSHIFT;
|
xl = (unsigned)(avgX - (radToPredict + MAXRADIUS) - bmaporgx)>>MAPBLOCKSHIFT;
|
||||||
xh = (unsigned)(avgX + (distToPredict + MAXRADIUS) - bmaporgx)>>MAPBLOCKSHIFT;
|
xh = (unsigned)(avgX + (radToPredict + MAXRADIUS) - bmaporgx)>>MAPBLOCKSHIFT;
|
||||||
yl = (unsigned)(avgY - (distToPredict + MAXRADIUS) - bmaporgy)>>MAPBLOCKSHIFT;
|
yl = (unsigned)(avgY - (radToPredict + MAXRADIUS) - bmaporgy)>>MAPBLOCKSHIFT;
|
||||||
yh = (unsigned)(avgY + (distToPredict + MAXRADIUS) - bmaporgy)>>MAPBLOCKSHIFT;
|
yh = (unsigned)(avgY + (radToPredict + MAXRADIUS) - bmaporgy)>>MAPBLOCKSHIFT;
|
||||||
|
|
||||||
BMBOUNDFIX(xl, xh, yl, yh);
|
BMBOUNDFIX(xl, xh, yl, yh);
|
||||||
|
|
||||||
|
|
@ -770,7 +782,7 @@ void K_NudgePredictionTowardsObjects(botprediction_t *predict, const player_t *p
|
||||||
|
|
||||||
predict->x += FixedMul(nudgeDist, FINECOSINE(nudgeDir >> ANGLETOFINESHIFT));
|
predict->x += FixedMul(nudgeDist, FINECOSINE(nudgeDir >> ANGLETOFINESHIFT));
|
||||||
predict->y += FixedMul(nudgeDist, FINESINE(nudgeDir >> ANGLETOFINESHIFT));
|
predict->y += FixedMul(nudgeDist, FINESINE(nudgeDir >> ANGLETOFINESHIFT));
|
||||||
predict->radius = max(predict->radius - nudgeDist, baseNudge);
|
predict->radius = std::max(predict->radius - nudgeDist, baseNudge);
|
||||||
|
|
||||||
distToPredict = R_PointToDist2(player->mo->x, player->mo->y, predict->x, predict->y);
|
distToPredict = R_PointToDist2(player->mo->x, player->mo->y, predict->x, predict->y);
|
||||||
|
|
||||||
|
|
@ -841,7 +853,7 @@ void K_NudgePredictionTowardsObjects(botprediction_t *predict, const player_t *p
|
||||||
|
|
||||||
predict->x += FixedMul(nudgeDist, FINECOSINE(nudgeDir >> ANGLETOFINESHIFT));
|
predict->x += FixedMul(nudgeDist, FINECOSINE(nudgeDir >> ANGLETOFINESHIFT));
|
||||||
predict->y += FixedMul(nudgeDist, FINESINE(nudgeDir >> ANGLETOFINESHIFT));
|
predict->y += FixedMul(nudgeDist, FINESINE(nudgeDir >> ANGLETOFINESHIFT));
|
||||||
predict->radius = max(predict->radius - nudgeDist, baseNudge);
|
predict->radius = std::max(predict->radius - nudgeDist, baseNudge);
|
||||||
|
|
||||||
//distToPredict = R_PointToDist2(player->mo->x, player->mo->y, predict->x, predict->y);
|
//distToPredict = R_PointToDist2(player->mo->x, player->mo->y, predict->x, predict->y);
|
||||||
}
|
}
|
||||||
|
|
@ -954,6 +966,8 @@ static BlockItReturn_t K_FindPlayersToBully(mobj_t *thing)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
INT32 K_PositionBully(const player_t *player)
|
INT32 K_PositionBully(const player_t *player)
|
||||||
{
|
{
|
||||||
|
ZoneScoped;
|
||||||
|
|
||||||
INT32 xl, xh, yl, yh, bx, by;
|
INT32 xl, xh, yl, yh, bx, by;
|
||||||
|
|
||||||
angle_t ourangle, destangle, angle;
|
angle_t ourangle, destangle, angle;
|
||||||
144
src/p_saveg.c
144
src/p_saveg.c
|
|
@ -48,6 +48,8 @@
|
||||||
#include "k_vote.h"
|
#include "k_vote.h"
|
||||||
#include "k_zvote.h"
|
#include "k_zvote.h"
|
||||||
|
|
||||||
|
#include <tracy/tracy/TracyC.h>
|
||||||
|
|
||||||
savedata_t savedata;
|
savedata_t savedata;
|
||||||
savedata_cup_t cupsavedata;
|
savedata_cup_t cupsavedata;
|
||||||
|
|
||||||
|
|
@ -195,6 +197,8 @@ static boolean P_UnArchivePlayer(savebuffer_t *save)
|
||||||
|
|
||||||
static void P_NetArchivePlayers(savebuffer_t *save)
|
static void P_NetArchivePlayers(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
INT32 i, j;
|
INT32 i, j;
|
||||||
UINT16 flags;
|
UINT16 flags;
|
||||||
size_t q;
|
size_t q;
|
||||||
|
|
@ -782,10 +786,14 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
||||||
WRITEUINT32(save->p, players[i].icecube.frozenat);
|
WRITEUINT32(save->p, players[i].icecube.frozenat);
|
||||||
WRITEUINT8(save->p, players[i].icecube.shaketimer);
|
WRITEUINT8(save->p, players[i].icecube.shaketimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetUnArchivePlayers(savebuffer_t *save)
|
static void P_NetUnArchivePlayers(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
INT32 i, j;
|
INT32 i, j;
|
||||||
UINT16 flags;
|
UINT16 flags;
|
||||||
size_t q;
|
size_t q;
|
||||||
|
|
@ -1348,10 +1356,14 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
||||||
|
|
||||||
//players[i].viewheight = P_GetPlayerViewHeight(players[i]); // scale cannot be factored in at this point
|
//players[i].viewheight = P_GetPlayerViewHeight(players[i]); // scale cannot be factored in at this point
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetArchiveParties(savebuffer_t *save)
|
static void P_NetArchiveParties(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
INT32 i, k;
|
INT32 i, k;
|
||||||
UINT8 partySize;
|
UINT8 partySize;
|
||||||
|
|
||||||
|
|
@ -1371,10 +1383,14 @@ static void P_NetArchiveParties(savebuffer_t *save)
|
||||||
WRITEUINT8(save->p, G_PartyMember(i, k));
|
WRITEUINT8(save->p, G_PartyMember(i, k));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetUnArchiveParties(savebuffer_t *save)
|
static void P_NetUnArchiveParties(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
INT32 i, k;
|
INT32 i, k;
|
||||||
UINT8 partySize;
|
UINT8 partySize;
|
||||||
|
|
||||||
|
|
@ -1402,10 +1418,14 @@ static void P_NetUnArchiveParties(savebuffer_t *save)
|
||||||
G_JoinParty(i, READUINT8(save->p));
|
G_JoinParty(i, READUINT8(save->p));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetArchiveRoundQueue(savebuffer_t *save)
|
static void P_NetArchiveRoundQueue(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
WRITEUINT32(save->p, ARCHIVEBLOCK_ROUNDQUEUE);
|
WRITEUINT32(save->p, ARCHIVEBLOCK_ROUNDQUEUE);
|
||||||
|
|
||||||
|
|
@ -1424,10 +1444,14 @@ static void P_NetArchiveRoundQueue(savebuffer_t *save)
|
||||||
WRITEUINT8(save->p, (UINT8)roundqueue.entries[i].rankrestricted);
|
WRITEUINT8(save->p, (UINT8)roundqueue.entries[i].rankrestricted);
|
||||||
WRITEUINT8(save->p, (UINT8)roundqueue.entries[i].overridden);
|
WRITEUINT8(save->p, (UINT8)roundqueue.entries[i].overridden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetUnArchiveRoundQueue(savebuffer_t *save)
|
static void P_NetUnArchiveRoundQueue(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
if (READUINT32(save->p) != ARCHIVEBLOCK_ROUNDQUEUE)
|
if (READUINT32(save->p) != ARCHIVEBLOCK_ROUNDQUEUE)
|
||||||
I_Error("Bad $$$.sav at archive block Round-queue");
|
I_Error("Bad $$$.sav at archive block Round-queue");
|
||||||
|
|
@ -1449,10 +1473,14 @@ static void P_NetUnArchiveRoundQueue(savebuffer_t *save)
|
||||||
roundqueue.entries[i].rankrestricted = (boolean)READUINT8(save->p);
|
roundqueue.entries[i].rankrestricted = (boolean)READUINT8(save->p);
|
||||||
roundqueue.entries[i].overridden = (boolean)READUINT8(save->p);
|
roundqueue.entries[i].overridden = (boolean)READUINT8(save->p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetArchiveZVote(savebuffer_t *save)
|
static void P_NetArchiveZVote(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
WRITEUINT32(save->p, ARCHIVEBLOCK_ZVOTE);
|
WRITEUINT32(save->p, ARCHIVEBLOCK_ZVOTE);
|
||||||
|
|
@ -1486,10 +1514,14 @@ static void P_NetArchiveZVote(savebuffer_t *save)
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITEUINT32(save->p, g_midVote.delay);
|
WRITEUINT32(save->p, g_midVote.delay);
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetUnArchiveZVote(savebuffer_t *save)
|
static void P_NetUnArchiveZVote(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
if (READUINT32(save->p) != ARCHIVEBLOCK_ZVOTE)
|
if (READUINT32(save->p) != ARCHIVEBLOCK_ZVOTE)
|
||||||
|
|
@ -1530,6 +1562,8 @@ static void P_NetUnArchiveZVote(savebuffer_t *save)
|
||||||
}
|
}
|
||||||
|
|
||||||
g_midVote.delay = (tic_t)READUINT32(save->p);
|
g_midVote.delay = (tic_t)READUINT32(save->p);
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
@ -1631,6 +1665,8 @@ static void ClearNetColormaps(void)
|
||||||
|
|
||||||
static void P_NetArchiveColormaps(savebuffer_t *save)
|
static void P_NetArchiveColormaps(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
// We save and then we clean up our colormap mess
|
// We save and then we clean up our colormap mess
|
||||||
extracolormap_t *exc, *exc_next;
|
extracolormap_t *exc, *exc_next;
|
||||||
UINT32 i = 0;
|
UINT32 i = 0;
|
||||||
|
|
@ -1661,10 +1697,14 @@ static void P_NetArchiveColormaps(savebuffer_t *save)
|
||||||
num_net_colormaps = 0;
|
num_net_colormaps = 0;
|
||||||
num_ffloors = 0;
|
num_ffloors = 0;
|
||||||
net_colormaps = NULL;
|
net_colormaps = NULL;
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetUnArchiveColormaps(savebuffer_t *save)
|
static void P_NetUnArchiveColormaps(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
// When we reach this point, we already populated our list with
|
// When we reach this point, we already populated our list with
|
||||||
// dummy colormaps. Now that we are loading the color data,
|
// dummy colormaps. Now that we are loading the color data,
|
||||||
// set up the dummies.
|
// set up the dummies.
|
||||||
|
|
@ -1763,6 +1803,8 @@ static void P_NetUnArchiveColormaps(savebuffer_t *save)
|
||||||
num_net_colormaps = 0;
|
num_net_colormaps = 0;
|
||||||
num_ffloors = 0;
|
num_ffloors = 0;
|
||||||
net_colormaps = NULL;
|
net_colormaps = NULL;
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
|
@ -2567,6 +2609,8 @@ static void UnArchiveLines(savebuffer_t *save)
|
||||||
|
|
||||||
static void P_NetArchiveWorld(savebuffer_t *save)
|
static void P_NetArchiveWorld(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
// initialize colormap vars because paranoia
|
// initialize colormap vars because paranoia
|
||||||
ClearNetColormaps();
|
ClearNetColormaps();
|
||||||
|
|
||||||
|
|
@ -2575,10 +2619,14 @@ static void P_NetArchiveWorld(savebuffer_t *save)
|
||||||
ArchiveSectors(save);
|
ArchiveSectors(save);
|
||||||
ArchiveLines(save);
|
ArchiveLines(save);
|
||||||
R_ClearTextureNumCache(false);
|
R_ClearTextureNumCache(false);
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetUnArchiveWorld(savebuffer_t *save)
|
static void P_NetUnArchiveWorld(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
UINT16 i;
|
UINT16 i;
|
||||||
|
|
||||||
if (READUINT32(save->p) != ARCHIVEBLOCK_WORLD)
|
if (READUINT32(save->p) != ARCHIVEBLOCK_WORLD)
|
||||||
|
|
@ -2597,6 +2645,8 @@ static void P_NetUnArchiveWorld(savebuffer_t *save)
|
||||||
|
|
||||||
UnArchiveSectors(save);
|
UnArchiveSectors(save);
|
||||||
UnArchiveLines(save);
|
UnArchiveLines(save);
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -3849,6 +3899,8 @@ static void WriteMobjPointer(mobj_t *mobj)
|
||||||
|
|
||||||
static void P_NetArchiveThinkers(savebuffer_t *save)
|
static void P_NetArchiveThinkers(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
const thinker_t *th;
|
const thinker_t *th;
|
||||||
UINT32 i;
|
UINT32 i;
|
||||||
|
|
||||||
|
|
@ -4084,10 +4136,14 @@ static void P_NetArchiveThinkers(savebuffer_t *save)
|
||||||
|
|
||||||
WRITEUINT8(save->p, tc_end);
|
WRITEUINT8(save->p, tc_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetArchiveWaypoints(savebuffer_t *save)
|
static void P_NetArchiveWaypoints(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
waypoint_t *waypoint;
|
waypoint_t *waypoint;
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t numWaypoints = K_GetNumWaypoints();
|
size_t numWaypoints = K_GetNumWaypoints();
|
||||||
|
|
@ -4102,10 +4158,14 @@ static void P_NetArchiveWaypoints(savebuffer_t *save)
|
||||||
// Waypoints should NEVER be completely created or destroyed mid-race as a result of this
|
// Waypoints should NEVER be completely created or destroyed mid-race as a result of this
|
||||||
WRITEUINT32(save->p, waypoint->mobj->mobjnum);
|
WRITEUINT32(save->p, waypoint->mobj->mobjnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetUnArchiveWaypoints(savebuffer_t *save)
|
static void P_NetUnArchiveWaypoints(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
if (READUINT32(save->p) != ARCHIVEBLOCK_WAYPOINTS)
|
if (READUINT32(save->p) != ARCHIVEBLOCK_WAYPOINTS)
|
||||||
I_Error("Bad $$$.sav at archive block Waypoints!");
|
I_Error("Bad $$$.sav at archive block Waypoints!");
|
||||||
else {
|
else {
|
||||||
|
|
@ -4128,10 +4188,14 @@ static void P_NetUnArchiveWaypoints(savebuffer_t *save)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetArchiveTubeWaypoints(savebuffer_t *save)
|
static void P_NetArchiveTubeWaypoints(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
INT32 i, j;
|
INT32 i, j;
|
||||||
|
|
||||||
for (i = 0; i < NUMTUBEWAYPOINTSEQUENCES; i++)
|
for (i = 0; i < NUMTUBEWAYPOINTSEQUENCES; i++)
|
||||||
|
|
@ -4142,10 +4206,14 @@ static void P_NetArchiveTubeWaypoints(savebuffer_t *save)
|
||||||
WRITEUINT32(save->p, SaveMobjnum(tubewaypoints[i][j]));
|
WRITEUINT32(save->p, SaveMobjnum(tubewaypoints[i][j]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetUnArchiveTubeWaypoints(savebuffer_t *save)
|
static void P_NetUnArchiveTubeWaypoints(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
INT32 i, j;
|
INT32 i, j;
|
||||||
UINT32 mobjnum;
|
UINT32 mobjnum;
|
||||||
|
|
||||||
|
|
@ -4160,6 +4228,8 @@ static void P_NetUnArchiveTubeWaypoints(savebuffer_t *save)
|
||||||
P_SetTarget(&tubewaypoints[i][j], P_FindNewPosition(mobjnum));
|
P_SetTarget(&tubewaypoints[i][j], P_FindNewPosition(mobjnum));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now save the pointers, tracer and target, but at load time we must
|
// Now save the pointers, tracer and target, but at load time we must
|
||||||
|
|
@ -5255,6 +5325,8 @@ static void ReadMobjPointer(mobj_t **mobj_p)
|
||||||
|
|
||||||
static void P_NetUnArchiveThinkers(savebuffer_t *save)
|
static void P_NetUnArchiveThinkers(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
thinker_t *currentthinker;
|
thinker_t *currentthinker;
|
||||||
thinker_t *next;
|
thinker_t *next;
|
||||||
UINT8 tclass;
|
UINT8 tclass;
|
||||||
|
|
@ -5498,6 +5570,8 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
|
||||||
delay->caller = P_FindNewPosition(mobjnum);
|
delay->caller = P_FindNewPosition(mobjnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -5509,6 +5583,8 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
|
||||||
|
|
||||||
static inline void P_ArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
static inline void P_ArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
UINT8 diff = 0;
|
UINT8 diff = 0;
|
||||||
WRITEINT32(save->p, po->id);
|
WRITEINT32(save->p, po->id);
|
||||||
WRITEANGLE(save->p, po->angle);
|
WRITEANGLE(save->p, po->angle);
|
||||||
|
|
@ -5527,10 +5603,14 @@ static inline void P_ArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
||||||
WRITEINT32(save->p, po->flags);
|
WRITEINT32(save->p, po->flags);
|
||||||
if (diff & PD_TRANS)
|
if (diff & PD_TRANS)
|
||||||
WRITEINT32(save->p, po->translucency);
|
WRITEINT32(save->p, po->translucency);
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void P_UnArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
static inline void P_UnArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
INT32 id;
|
INT32 id;
|
||||||
UINT32 angle;
|
UINT32 angle;
|
||||||
fixed_t x, y;
|
fixed_t x, y;
|
||||||
|
|
@ -5562,10 +5642,14 @@ static inline void P_UnArchivePolyObj(savebuffer_t *save, polyobj_t *po)
|
||||||
|
|
||||||
// rotate and translate polyobject
|
// rotate and translate polyobject
|
||||||
Polyobj_MoveOnLoad(po, angle, x, y);
|
Polyobj_MoveOnLoad(po, angle, x, y);
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void P_ArchivePolyObjects(savebuffer_t *save)
|
static inline void P_ArchivePolyObjects(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
WRITEUINT32(save->p, ARCHIVEBLOCK_POBJS);
|
WRITEUINT32(save->p, ARCHIVEBLOCK_POBJS);
|
||||||
|
|
@ -5575,10 +5659,14 @@ static inline void P_ArchivePolyObjects(savebuffer_t *save)
|
||||||
|
|
||||||
for (i = 0; i < numPolyObjects; ++i)
|
for (i = 0; i < numPolyObjects; ++i)
|
||||||
P_ArchivePolyObj(save, &PolyObjects[i]);
|
P_ArchivePolyObj(save, &PolyObjects[i]);
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void P_UnArchivePolyObjects(savebuffer_t *save)
|
static inline void P_UnArchivePolyObjects(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
INT32 i, numSavedPolys;
|
INT32 i, numSavedPolys;
|
||||||
|
|
||||||
if (READUINT32(save->p) != ARCHIVEBLOCK_POBJS)
|
if (READUINT32(save->p) != ARCHIVEBLOCK_POBJS)
|
||||||
|
|
@ -5591,6 +5679,8 @@ static inline void P_UnArchivePolyObjects(savebuffer_t *save)
|
||||||
|
|
||||||
for (i = 0; i < numSavedPolys; ++i)
|
for (i = 0; i < numSavedPolys; ++i)
|
||||||
P_UnArchivePolyObj(save, &PolyObjects[i]);
|
P_UnArchivePolyObj(save, &PolyObjects[i]);
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mobj_t *RelinkMobj(mobj_t **ptr)
|
static mobj_t *RelinkMobj(mobj_t **ptr)
|
||||||
|
|
@ -5788,6 +5878,8 @@ static void P_RelinkPointers(void)
|
||||||
|
|
||||||
static inline void P_NetArchiveSpecials(savebuffer_t *save)
|
static inline void P_NetArchiveSpecials(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
size_t i, z;
|
size_t i, z;
|
||||||
|
|
||||||
WRITEUINT32(save->p, ARCHIVEBLOCK_SPECIALS);
|
WRITEUINT32(save->p, ARCHIVEBLOCK_SPECIALS);
|
||||||
|
|
@ -5824,10 +5916,14 @@ static inline void P_NetArchiveSpecials(savebuffer_t *save)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
WRITEUINT8(save->p, 0x00);
|
WRITEUINT8(save->p, 0x00);
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetUnArchiveSpecials(savebuffer_t *save)
|
static void P_NetUnArchiveSpecials(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
char skytex[9];
|
char skytex[9];
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
|
@ -5863,6 +5959,8 @@ static void P_NetUnArchiveSpecials(savebuffer_t *save)
|
||||||
|
|
||||||
if (READUINT8(save->p) == 0x01) // metal sonic
|
if (READUINT8(save->p) == 0x01) // metal sonic
|
||||||
G_LoadMetal(&save->p);
|
G_LoadMetal(&save->p);
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
|
|
@ -6233,6 +6331,8 @@ static boolean P_UnArchiveSPGame(savebuffer_t *save)
|
||||||
|
|
||||||
static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
|
static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
|
|
||||||
WRITEUINT32(save->p, ARCHIVEBLOCK_MISC);
|
WRITEUINT32(save->p, ARCHIVEBLOCK_MISC);
|
||||||
|
|
@ -6397,10 +6497,14 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITEUINT32(save->p, cht_debug);
|
WRITEUINT32(save->p, cht_debug);
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean P_NetUnArchiveMisc(savebuffer_t *save, boolean reloading)
|
static boolean P_NetUnArchiveMisc(savebuffer_t *save, boolean reloading)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
size_t numTasks;
|
size_t numTasks;
|
||||||
|
|
||||||
|
|
@ -6583,11 +6687,14 @@ static boolean P_NetUnArchiveMisc(savebuffer_t *save, boolean reloading)
|
||||||
|
|
||||||
cht_debug = READUINT32(save->p);
|
cht_debug = READUINT32(save->p);
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void P_ArchiveLuabanksAndConsistency(savebuffer_t *save)
|
static inline void P_ArchiveLuabanksAndConsistency(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
UINT8 i, banksinuse = NUM_LUABANKS;
|
UINT8 i, banksinuse = NUM_LUABANKS;
|
||||||
|
|
||||||
while (banksinuse && !luabanks[banksinuse-1])
|
while (banksinuse && !luabanks[banksinuse-1])
|
||||||
|
|
@ -6602,10 +6709,15 @@ static inline void P_ArchiveLuabanksAndConsistency(savebuffer_t *save)
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITEUINT8(save->p, 0x1d); // consistency marker
|
WRITEUINT8(save->p, 0x1d); // consistency marker
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline boolean P_UnArchiveLuabanksAndConsistency(savebuffer_t *save)
|
static inline boolean P_UnArchiveLuabanksAndConsistency(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
|
boolean ret = true;
|
||||||
switch (READUINT8(save->p))
|
switch (READUINT8(save->p))
|
||||||
{
|
{
|
||||||
case 0xb7: // luabanks marker
|
case 0xb7: // luabanks marker
|
||||||
|
|
@ -6614,28 +6726,34 @@ static inline boolean P_UnArchiveLuabanksAndConsistency(savebuffer_t *save)
|
||||||
if (banksinuse > NUM_LUABANKS)
|
if (banksinuse > NUM_LUABANKS)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, M_GetText("Corrupt Luabanks! (Too many banks in use)\n"));
|
CONS_Alert(CONS_ERROR, M_GetText("Corrupt Luabanks! (Too many banks in use)\n"));
|
||||||
return false;
|
ret = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
for (i = 0; i < banksinuse; i++)
|
for (i = 0; i < banksinuse; i++)
|
||||||
luabanks[i] = READINT32(save->p);
|
luabanks[i] = READINT32(save->p);
|
||||||
if (READUINT8(save->p) != 0x1d) // consistency marker
|
if (READUINT8(save->p) != 0x1d) // consistency marker
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, M_GetText("Corrupt Luabanks! (Failed consistency check)\n"));
|
CONS_Alert(CONS_ERROR, M_GetText("Corrupt Luabanks! (Failed consistency check)\n"));
|
||||||
return false;
|
ret = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case 0x1d: // consistency marker
|
case 0x1d: // consistency marker
|
||||||
break;
|
break;
|
||||||
default: // anything else is nonsense
|
default: // anything else is nonsense
|
||||||
CONS_Alert(CONS_ERROR, M_GetText("Failed consistency check (???)\n"));
|
CONS_Alert(CONS_ERROR, M_GetText("Failed consistency check (???)\n"));
|
||||||
return false;
|
ret = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
TracyCZoneEnd(__zone);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_NetArchiveRNG(savebuffer_t *save)
|
static void P_NetArchiveRNG(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
WRITEUINT32(save->p, ARCHIVEBLOCK_RNG);
|
WRITEUINT32(save->p, ARCHIVEBLOCK_RNG);
|
||||||
|
|
@ -6645,10 +6763,14 @@ static void P_NetArchiveRNG(savebuffer_t *save)
|
||||||
WRITEUINT32(save->p, P_GetInitSeed(i));
|
WRITEUINT32(save->p, P_GetInitSeed(i));
|
||||||
WRITEUINT32(save->p, P_GetRandSeed(i));
|
WRITEUINT32(save->p, P_GetRandSeed(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void P_NetUnArchiveRNG(savebuffer_t *save)
|
static inline void P_NetUnArchiveRNG(savebuffer_t *save)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (READUINT32(save->p) != ARCHIVEBLOCK_RNG)
|
if (READUINT32(save->p) != ARCHIVEBLOCK_RNG)
|
||||||
|
|
@ -6661,6 +6783,8 @@ static inline void P_NetUnArchiveRNG(savebuffer_t *save)
|
||||||
|
|
||||||
P_SetRandSeedNet(i, init, seed);
|
P_SetRandSeedNet(i, init, seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
void P_SaveGame(savebuffer_t *save)
|
void P_SaveGame(savebuffer_t *save)
|
||||||
|
|
@ -6672,6 +6796,8 @@ void P_SaveGame(savebuffer_t *save)
|
||||||
|
|
||||||
void P_SaveNetGame(savebuffer_t *save, boolean resending)
|
void P_SaveNetGame(savebuffer_t *save, boolean resending)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
current_savebuffer = save;
|
current_savebuffer = save;
|
||||||
|
|
||||||
thinker_t *th;
|
thinker_t *th;
|
||||||
|
|
@ -6718,6 +6844,8 @@ void P_SaveNetGame(savebuffer_t *save, boolean resending)
|
||||||
P_NetArchiveRNG(save);
|
P_NetArchiveRNG(save);
|
||||||
|
|
||||||
P_ArchiveLuabanksAndConsistency(save);
|
P_ArchiveLuabanksAndConsistency(save);
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean P_LoadGame(savebuffer_t *save)
|
boolean P_LoadGame(savebuffer_t *save)
|
||||||
|
|
@ -6750,7 +6878,9 @@ badloadgame:
|
||||||
|
|
||||||
boolean P_LoadNetGame(savebuffer_t *save, boolean reloading)
|
boolean P_LoadNetGame(savebuffer_t *save, boolean reloading)
|
||||||
{
|
{
|
||||||
current_savebuffer = save;
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
|
current_savebuffer = save;
|
||||||
|
|
||||||
CV_LoadNetVars(&save->p);
|
CV_LoadNetVars(&save->p);
|
||||||
|
|
||||||
|
|
@ -6784,8 +6914,10 @@ boolean P_LoadNetGame(savebuffer_t *save, boolean reloading)
|
||||||
// so the thinkers would be deleted later. Therefore, P_SetupLevel will *not* spawn
|
// so the thinkers would be deleted later. Therefore, P_SetupLevel will *not* spawn
|
||||||
// precipitation when loading a netgame save. Instead, precip has to be spawned here.
|
// precipitation when loading a netgame save. Instead, precip has to be spawned here.
|
||||||
// This is done in P_NetUnArchiveSpecials now.
|
// This is done in P_NetUnArchiveSpecials now.
|
||||||
|
boolean ret = P_UnArchiveLuabanksAndConsistency(save);
|
||||||
|
|
||||||
return P_UnArchiveLuabanksAndConsistency(save);
|
TracyCZoneEnd(__zone);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean P_SaveBufferZAlloc(savebuffer_t *save, size_t alloc_size, INT32 tag, void *user)
|
boolean P_SaveBufferZAlloc(savebuffer_t *save, size_t alloc_size, INT32 tag, void *user)
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,8 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <tracy/tracy/TracyC.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// Map MD5, calculated on level load.
|
// Map MD5, calculated on level load.
|
||||||
// Sent to clients in PT_SERVERINFO.
|
// Sent to clients in PT_SERVERINFO.
|
||||||
|
|
@ -1379,6 +1381,8 @@ UINT32 sectorsPos[UINT16_MAX];
|
||||||
// Determine total amount of map data in TEXTMAP.
|
// Determine total amount of map data in TEXTMAP.
|
||||||
static boolean TextmapCount(size_t size)
|
static boolean TextmapCount(size_t size)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
const char *tkn = M_TokenizerRead(0);
|
const char *tkn = M_TokenizerRead(0);
|
||||||
UINT8 brackets = 0;
|
UINT8 brackets = 0;
|
||||||
|
|
||||||
|
|
@ -1392,6 +1396,7 @@ static boolean TextmapCount(size_t size)
|
||||||
if (!fastcmp(tkn, "namespace"))
|
if (!fastcmp(tkn, "namespace"))
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, "No namespace at beginning of lump!\n");
|
CONS_Alert(CONS_ERROR, "No namespace at beginning of lump!\n");
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1435,9 +1440,11 @@ static boolean TextmapCount(size_t size)
|
||||||
if (brackets)
|
if (brackets)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, "Unclosed brackets detected in textmap lump.\n");
|
CONS_Alert(CONS_ERROR, "Unclosed brackets detected in textmap lump.\n");
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3071,6 +3078,8 @@ static void P_WriteTextmapWaypoints(void)
|
||||||
*/
|
*/
|
||||||
static void P_LoadTextmap(void)
|
static void P_LoadTextmap(void)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
UINT32 i;
|
UINT32 i;
|
||||||
|
|
||||||
vertex_t *vt;
|
vertex_t *vt;
|
||||||
|
|
@ -3255,6 +3264,8 @@ static void P_LoadTextmap(void)
|
||||||
|
|
||||||
TextmapParse(mapthingsPos[i], i, ParseTextmapThingParameter);
|
TextmapParse(mapthingsPos[i], i, ParseTextmapThingParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
static fixed_t
|
static fixed_t
|
||||||
|
|
@ -3409,6 +3420,8 @@ static void P_ProcessLinedefsAfterSidedefs(void)
|
||||||
|
|
||||||
static boolean P_LoadMapData(const virtres_t *virt)
|
static boolean P_LoadMapData(const virtres_t *virt)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
virtlump_t *virtvertexes = NULL, *virtsectors = NULL, *virtsidedefs = NULL, *virtlinedefs = NULL, *virtthings = NULL;
|
virtlump_t *virtvertexes = NULL, *virtsectors = NULL, *virtsidedefs = NULL, *virtlinedefs = NULL, *virtthings = NULL;
|
||||||
|
|
||||||
// Count map data.
|
// Count map data.
|
||||||
|
|
@ -3419,6 +3432,7 @@ static boolean P_LoadMapData(const virtres_t *virt)
|
||||||
if (!TextmapCount(textmap->size))
|
if (!TextmapCount(textmap->size))
|
||||||
{
|
{
|
||||||
M_TokenizerClose();
|
M_TokenizerClose();
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3505,6 +3519,7 @@ static boolean P_LoadMapData(const virtres_t *virt)
|
||||||
// search for animated flats and set up
|
// search for animated flats and set up
|
||||||
P_SetupLevelFlatAnims();
|
P_SetupLevelFlatAnims();
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7458,6 +7473,8 @@ static void P_MakeMapMD5(virtres_t *virt, void *dest)
|
||||||
|
|
||||||
static boolean P_LoadMapFromFile(void)
|
static boolean P_LoadMapFromFile(void)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
virtlump_t *textmap = vres_Find(curmapvirt, "TEXTMAP");
|
virtlump_t *textmap = vres_Find(curmapvirt, "TEXTMAP");
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
|
@ -7465,7 +7482,11 @@ static boolean P_LoadMapFromFile(void)
|
||||||
udmf_version = 0;
|
udmf_version = 0;
|
||||||
|
|
||||||
if (!P_LoadMapData(curmapvirt))
|
if (!P_LoadMapData(curmapvirt))
|
||||||
|
{
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
P_LoadMapBSP(curmapvirt);
|
P_LoadMapBSP(curmapvirt);
|
||||||
P_LoadMapLUT(curmapvirt);
|
P_LoadMapLUT(curmapvirt);
|
||||||
|
|
||||||
|
|
@ -7496,6 +7517,8 @@ static boolean P_LoadMapFromFile(void)
|
||||||
spawnsectors[i].tags.tags = memcpy(Z_Malloc(sectors[i].tags.count*sizeof(mtag_t), PU_LEVEL, NULL), sectors[i].tags.tags, sectors[i].tags.count*sizeof(mtag_t));
|
spawnsectors[i].tags.tags = memcpy(Z_Malloc(sectors[i].tags.count*sizeof(mtag_t), PU_LEVEL, NULL), sectors[i].tags.tags, sectors[i].tags.count*sizeof(mtag_t));
|
||||||
|
|
||||||
P_MakeMapMD5(curmapvirt, &mapmd5);
|
P_MakeMapMD5(curmapvirt, &mapmd5);
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8152,6 +8175,8 @@ void P_LoadLevelMusic(void)
|
||||||
*/
|
*/
|
||||||
boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
// use gamemap to get map number.
|
// use gamemap to get map number.
|
||||||
// 99% of the things already did, so.
|
// 99% of the things already did, so.
|
||||||
// Map header should always be in place at this point
|
// Map header should always be in place at this point
|
||||||
|
|
@ -8474,7 +8499,10 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||||
P_InitSlopes(); //Initialize slopes before the map loads.
|
P_InitSlopes(); //Initialize slopes before the map loads.
|
||||||
|
|
||||||
if (!P_LoadMapFromFile())
|
if (!P_LoadMapFromFile())
|
||||||
|
{
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// set up world state
|
// set up world state
|
||||||
// jart: needs to be done here so anchored slopes know the attached list
|
// jart: needs to be done here so anchored slopes know the attached list
|
||||||
|
|
@ -8624,11 +8652,14 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void P_PostLoadLevel(void)
|
void P_PostLoadLevel(void)
|
||||||
{
|
{
|
||||||
|
TracyCZone(__zone, true);
|
||||||
|
|
||||||
P_MapStart();
|
P_MapStart();
|
||||||
|
|
||||||
if (G_GametypeHasSpectators())
|
if (G_GametypeHasSpectators())
|
||||||
|
|
@ -8692,6 +8723,8 @@ void P_PostLoadLevel(void)
|
||||||
|
|
||||||
// We're now done loading the level.
|
// We're now done loading the level.
|
||||||
levelloading = false;
|
levelloading = false;
|
||||||
|
|
||||||
|
TracyCZoneEnd(__zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue