2478: Use (u)int64 from system.h instead of (u)int64_t from cstdint r=heinrich5991 a=def-

src/game/client/prediction/gameworld.h:62:90: error: ‘int64_t’ has not been declared
   62 |  void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask);
      |                                                                                          ^~~~~~~

2480: Send zoom status for dummy too r=heinrich5991 a=def-



Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
bors[bot] 2020-07-09 18:31:32 +00:00 committed by GitHub
commit c4d5c8dfa2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 63 additions and 62 deletions

View file

@ -2,6 +2,7 @@
#define BASE_HASH_CTXT_H
#include "hash.h"
#include "system.h"
#include <stdint.h>
#if defined(CONF_OPENSSL)
@ -20,7 +21,7 @@ extern "C" {
#else
typedef struct
{
uint64_t length;
uint64 length;
uint32_t state[8];
uint32_t curlen;
unsigned char buf[64];

View file

@ -30,7 +30,7 @@ static const u32 K[64] =
0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
};
static u32 min(u32 x, u32 y)
static u32 minimum(u32 x, u32 y)
{
return x < y ? x : y;
}
@ -133,7 +133,7 @@ static void sha_process(sha256_state* md, const void* src, u32 inlen)
}
else
{
u32 n = min(inlen, (block_size - md->curlen));
u32 n = minimum(inlen, (block_size - md->curlen));
memcpy(md->buf + md->curlen, in, n);
md->curlen += n;
in += n;

View file

@ -930,9 +930,9 @@ int64 time_get_impl(void)
#if defined(CONF_PLATFORM_MACOSX)
static int got_timebase = 0;
mach_timebase_info_data_t timebase;
uint64_t time;
uint64_t q;
uint64_t r;
uint64 time;
uint64 q;
uint64 r;
if(!got_timebase)
{
mach_timebase_info(&timebase);

View file

@ -828,11 +828,11 @@ void CSound::SetVoiceTimeOffset(CVoiceHandle Voice, float offset)
{
int Tick = 0;
bool IsLooping = m_aVoices[VoiceID].m_Flags&ISound::FLAG_LOOP;
uint64_t TickOffset = m_aVoices[VoiceID].m_pSample->m_Rate * offset;
uint64 TickOffset = m_aVoices[VoiceID].m_pSample->m_Rate * offset;
if(m_aVoices[VoiceID].m_pSample->m_NumFrames > 0 && IsLooping)
Tick = TickOffset % m_aVoices[VoiceID].m_pSample->m_NumFrames;
else
Tick = clamp(TickOffset, (uint64_t)0, (uint64_t)m_aVoices[VoiceID].m_pSample->m_NumFrames);
Tick = clamp(TickOffset, (uint64)0, (uint64)m_aVoices[VoiceID].m_pSample->m_NumFrames);
// at least 200msec off, else depend on buffer size
float Threshold = maximum(0.2f * m_aVoices[VoiceID].m_pSample->m_Rate, (float)m_MaxFrames);

View file

@ -220,7 +220,7 @@ void CVideo::NextVideoFrameThread()
if(m_Vseq >= 2)
{
m_ProcessingVideoFrame = true;
m_VideoStream.pFrame->pts = (int64_t)m_VideoStream.pEnc->frame_number;
m_VideoStream.pFrame->pts = (int64)m_VideoStream.pEnc->frame_number;
dbg_msg("video_recorder", "vframe: %d", m_VideoStream.pEnc->frame_number);
ReadRGBFromGL();
@ -407,7 +407,7 @@ AVFrame* CVideo::AllocPicture(enum AVPixelFormat PixFmt, int Width, int Height)
}
AVFrame* CVideo::AllocAudioFrame(enum AVSampleFormat SampleFmt, uint64_t ChannelLayout, int SampleRate, int NbSamples)
AVFrame* CVideo::AllocAudioFrame(enum AVSampleFormat SampleFmt, uint64 ChannelLayout, int SampleRate, int NbSamples)
{
AVFrame *Frame = av_frame_alloc();
int Ret;

View file

@ -41,7 +41,7 @@ typedef struct OutputStream {
AVCodecContext *pEnc;
/* pts of the next frame that will be generated */
int64_t NextPts;
int64 NextPts;
int SamplesCount;
AVFrame *pFrame;
@ -83,7 +83,7 @@ private:
void OpenVideo();
void OpenAudio();
AVFrame *AllocPicture(enum AVPixelFormat PixFmt, int Width, int Height);
AVFrame* AllocAudioFrame(enum AVSampleFormat SampleFmt, uint64_t ChannelLayout, int SampleRate, int NbSamples);
AVFrame* AllocAudioFrame(enum AVSampleFormat SampleFmt, uint64 ChannelLayout, int SampleRate, int NbSamples);
void WriteFrame(OutputStream* pStream);
void FinishFrames(OutputStream* pStream);

View file

@ -1552,21 +1552,28 @@ void CGameClient::OnNewSnapshot()
static float LastZoom = .0;
static float LastScreenAspect = .0;
static bool LastDummyConnected = false;
float ZoomToSend = m_pCamera->m_ZoomSmoothingTarget == .0 ? m_pCamera->m_Zoom // Initial
: m_pCamera->m_ZoomSmoothingTarget > m_pCamera->m_Zoom ? m_pCamera->m_ZoomSmoothingTarget // Zooming out
: m_pCamera->m_ZoomSmoothingTarget < m_pCamera->m_Zoom ? LastZoom // Zooming in
: m_pCamera->m_Zoom; // Not zooming
if(ZoomToSend != LastZoom || Graphics()->ScreenAspect() != LastScreenAspect)
if(ZoomToSend != LastZoom || Graphics()->ScreenAspect() != LastScreenAspect || (Client()->DummyConnected() && !LastDummyConnected))
{
LastZoom = ZoomToSend;
LastScreenAspect = Graphics()->ScreenAspect();
CNetMsg_Cl_ShowDistance Msg;
float x, y;
RenderTools()->CalcScreenParams(Graphics()->ScreenAspect(), ZoomToSend, &x, &y);
Msg.m_X = x;
Msg.m_Y = y;
Client()->SendPackMsg(&Msg, MSGFLAG_VITAL);
CMsgPacker Packer(Msg.MsgID(), false);
Msg.Pack(&Packer);
if(ZoomToSend != LastZoom)
Client()->SendMsgY(&Packer, MSGFLAG_VITAL, 0);
if(Client()->DummyConnected())
Client()->SendMsgY(&Packer, MSGFLAG_VITAL, 1);
LastZoom = ZoomToSend;
LastScreenAspect = Graphics()->ScreenAspect();
}
LastDummyConnected = Client()->DummyConnected();
m_pGhost->OnNewSnapshot();
m_pRaceDemo->OnNewSnapshot();

View file

@ -88,7 +88,7 @@ void CProjectile::Tick()
if(m_LifeSpan > -1)
m_LifeSpan--;
int64_t TeamMask = -1LL;
int64 TeamMask = -1LL;
bool isWeaponCollide = false;
if
(
@ -140,7 +140,7 @@ void CProjectile::Tick()
if(m_Owner >= 0)
pOwnerChar = GameWorld()->GetCharacterByID(m_Owner);
int64_t TeamMask = -1LL;
int64 TeamMask = -1LL;
GameWorld()->CreateExplosion(ColPos, m_Owner, m_Type, m_Owner == -1, (!pOwnerChar ? -1 : pOwnerChar->Team()),
(m_Owner != -1)? TeamMask : -1LL);

View file

@ -294,7 +294,7 @@ CEntity *CGameWorld::GetEntity(int ID, int EntType)
return 0;
}
void CGameWorld::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask)
void CGameWorld::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64 Mask)
{
if(Owner < 0 && m_WorldConfig.m_IsSolo && !(Weapon == WEAPON_SHOTGUN && m_WorldConfig.m_IsDDRace))
return;

View file

@ -59,7 +59,7 @@ public:
class CCharacter *GetCharacterByID(int ID) { return (ID >= 0 && ID < MAX_CLIENTS) ? m_apCharacters[ID] : 0; }
// from gamecontext
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask);
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64 Mask);
// for client side prediction
struct

View file

@ -1005,7 +1005,7 @@ bool CCharacter::TakeDamage(vec2 Force, int Dmg, int From, int Weapon)
// do damage Hit sound
if(From >= 0 && From != m_pPlayer->GetCID() && GameServer()->m_apPlayers[From])
{
int64_t Mask = CmaskOne(From);
int64 Mask = CmaskOne(From);
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() == TEAM_SPECTATORS && GameServer()->m_apPlayers[i]->m_SpectatorID == From)

View file

@ -266,7 +266,7 @@ void CLaser::Snap(int SnappingClient)
return;
CCharacter *pOwnerChar = 0;
int64_t TeamMask = -1LL;
int64 TeamMask = -1LL;
if(m_Owner >= 0)
pOwnerChar = GameServer()->GetPlayerChar(m_Owner);

View file

@ -125,7 +125,7 @@ void CProjectile::Tick()
if(m_LifeSpan > -1)
m_LifeSpan--;
int64_t TeamMask = -1LL;
int64 TeamMask = -1LL;
bool IsWeaponCollide = false;
if
(
@ -254,7 +254,7 @@ void CProjectile::Tick()
if(m_Owner >= 0)
pOwnerChar = GameServer()->GetPlayerChar(m_Owner);
int64_t TeamMask = -1LL;
int64 TeamMask = -1LL;
if (pOwnerChar && pOwnerChar->IsAlive())
{
TeamMask = pOwnerChar->Teams()->TeamMask(pOwnerChar->Team(), -1, m_Owner);
@ -312,7 +312,7 @@ void CProjectile::Snap(int SnappingClient)
return;
CCharacter *pOwnerChar = 0;
int64_t TeamMask = -1LL;
int64 TeamMask = -1LL;
if(m_Owner >= 0)
pOwnerChar = GameServer()->GetPlayerChar(m_Owner);

View file

@ -17,7 +17,7 @@ void CEventHandler::SetGameServer(CGameContext *pGameServer)
m_pGameServer = pGameServer;
}
void *CEventHandler::Create(int Type, int Size, int64_t Mask)
void *CEventHandler::Create(int Type, int Size, int64 Mask)
{
if(m_NumEvents == MAX_EVENTS)
return 0;

View file

@ -3,14 +3,7 @@
#ifndef GAME_SERVER_EVENTHANDLER_H
#define GAME_SERVER_EVENTHANDLER_H
#if !defined(_MSC_VER) || _MSC_VER >= 1600
#include <stdint.h>
#else
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#endif
#include <base/system.h>
//
class CEventHandler
{
@ -20,7 +13,7 @@ class CEventHandler
int m_aTypes[MAX_EVENTS]; // TODO: remove some of these arrays
int m_aOffsets[MAX_EVENTS];
int m_aSizes[MAX_EVENTS];
int64_t m_aClientMasks[MAX_EVENTS];
int64 m_aClientMasks[MAX_EVENTS];
char m_aData[MAX_DATASIZE];
class CGameContext *m_pGameServer;
@ -32,7 +25,7 @@ public:
void SetGameServer(CGameContext *pGameServer);
CEventHandler();
void *Create(int Type, int Size, int64_t Mask = -1LL);
void *Create(int Type, int Size, int64 Mask = -1LL);
void Clear();
void Snap(int SnappingClient);

View file

@ -176,7 +176,7 @@ void CGameContext::FillAntibot(CAntibotRoundData *pData)
}
}
void CGameContext::CreateDamageInd(vec2 Pos, float Angle, int Amount, int64_t Mask)
void CGameContext::CreateDamageInd(vec2 Pos, float Angle, int Amount, int64 Mask)
{
float a = 3 * 3.14159f / 2 + Angle;
//float a = get_angle(dir);
@ -195,7 +195,7 @@ void CGameContext::CreateDamageInd(vec2 Pos, float Angle, int Amount, int64_t Ma
}
}
void CGameContext::CreateHammerHit(vec2 Pos, int64_t Mask)
void CGameContext::CreateHammerHit(vec2 Pos, int64 Mask)
{
// create the event
CNetEvent_HammerHit *pEvent = (CNetEvent_HammerHit *)m_Events.Create(NETEVENTTYPE_HAMMERHIT, sizeof(CNetEvent_HammerHit), Mask);
@ -206,7 +206,7 @@ void CGameContext::CreateHammerHit(vec2 Pos, int64_t Mask)
}
}
void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask)
void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64 Mask)
{
// create the event
CNetEvent_Explosion *pEvent = (CNetEvent_Explosion *)m_Events.Create(NETEVENTTYPE_EXPLOSION, sizeof(CNetEvent_Explosion), Mask);
@ -221,7 +221,7 @@ void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamag
float Radius = 135.0f;
float InnerRadius = 48.0f;
int Num = m_World.FindEntities(Pos, Radius, (CEntity**)apEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER);
int64_t TeamMask = -1;
int64 TeamMask = -1;
for(int i = 0; i < Num; i++)
{
vec2 Diff = apEnts[i]->m_Pos - Pos;
@ -257,7 +257,7 @@ void CGameContext::CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamag
}
}
void CGameContext::CreatePlayerSpawn(vec2 Pos, int64_t Mask)
void CGameContext::CreatePlayerSpawn(vec2 Pos, int64 Mask)
{
// create the event
CNetEvent_Spawn *ev = (CNetEvent_Spawn *)m_Events.Create(NETEVENTTYPE_SPAWN, sizeof(CNetEvent_Spawn), Mask);
@ -268,7 +268,7 @@ void CGameContext::CreatePlayerSpawn(vec2 Pos, int64_t Mask)
}
}
void CGameContext::CreateDeath(vec2 Pos, int ClientID, int64_t Mask)
void CGameContext::CreateDeath(vec2 Pos, int ClientID, int64 Mask)
{
// create the event
CNetEvent_Death *pEvent = (CNetEvent_Death *)m_Events.Create(NETEVENTTYPE_DEATH, sizeof(CNetEvent_Death), Mask);
@ -280,7 +280,7 @@ void CGameContext::CreateDeath(vec2 Pos, int ClientID, int64_t Mask)
}
}
void CGameContext::CreateSound(vec2 Pos, int Sound, int64_t Mask)
void CGameContext::CreateSound(vec2 Pos, int Sound, int64 Mask)
{
if (Sound < 0)
return;

View file

@ -22,8 +22,8 @@
#ifdef _MSC_VER
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
typedef __int64 int64;
typedef unsigned __int64 uint64;
#else
#include <stdint.h>
#endif
@ -178,12 +178,12 @@ public:
CVoteOptionServer *m_pVoteOptionLast;
// helper functions
void CreateDamageInd(vec2 Pos, float AngleMod, int Amount, int64_t Mask=-1);
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64_t Mask);
void CreateHammerHit(vec2 Pos, int64_t Mask=-1);
void CreatePlayerSpawn(vec2 Pos, int64_t Mask=-1);
void CreateDeath(vec2 Pos, int Who, int64_t Mask=-1);
void CreateSound(vec2 Pos, int Sound, int64_t Mask=-1);
void CreateDamageInd(vec2 Pos, float AngleMod, int Amount, int64 Mask=-1);
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage, int ActivatedTeam, int64 Mask);
void CreateHammerHit(vec2 Pos, int64 Mask=-1);
void CreatePlayerSpawn(vec2 Pos, int64 Mask=-1);
void CreateDeath(vec2 Pos, int Who, int64 Mask=-1);
void CreateSound(vec2 Pos, int Sound, int64 Mask=-1);
void CreateSoundGlobal(int Sound, int Target=-1);
@ -433,9 +433,9 @@ public:
int m_ChatPrintCBIndex;
};
inline int64_t CmaskAll() { return -1LL; }
inline int64_t CmaskOne(int ClientID) { return 1LL<<ClientID; }
inline int64_t CmaskUnset(int64_t Mask, int ClientID) { return Mask^CmaskOne(ClientID); }
inline int64_t CmaskAllExceptOne(int ClientID) { return CmaskUnset(CmaskAll(), ClientID); }
inline bool CmaskIsSet(int64_t Mask, int ClientID) { return (Mask&CmaskOne(ClientID)) != 0; }
inline int64 CmaskAll() { return -1LL; }
inline int64 CmaskOne(int ClientID) { return 1LL<<ClientID; }
inline int64 CmaskUnset(int64 Mask, int ClientID) { return Mask^CmaskOne(ClientID); }
inline int64 CmaskAllExceptOne(int ClientID) { return CmaskUnset(CmaskAll(), ClientID); }
inline bool CmaskIsSet(int64 Mask, int ClientID) { return (Mask&CmaskOne(ClientID)) != 0; }
#endif

View file

@ -12,8 +12,8 @@ class CDoor;
#else
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
typedef __int64 int64;
typedef unsigned __int64 uint64;
#endif
/*

View file

@ -372,9 +372,9 @@ bool CGameTeams::TeamFinished(int Team)
return true;
}
int64_t CGameTeams::TeamMask(int Team, int ExceptID, int Asker)
int64 CGameTeams::TeamMask(int Team, int ExceptID, int Asker)
{
int64_t Mask = 0;
int64 Mask = 0;
for (int i = 0; i < MAX_CLIENTS; ++i)
{

View file

@ -11,7 +11,7 @@ class CGameTeams
int m_TeamState[MAX_CLIENTS];
bool m_TeeFinished[MAX_CLIENTS];
bool m_TeamLocked[MAX_CLIENTS];
uint64_t m_Invited[MAX_CLIENTS];
uint64 m_Invited[MAX_CLIENTS];
bool m_Practice[MAX_CLIENTS];
std::shared_ptr<CScoreSaveResult> m_pSaveTeamResult[MAX_CLIENTS];
@ -61,7 +61,7 @@ public:
void ChangeTeamState(int Team, int State);
void onChangeTeamState(int Team, int State, int OldState);
int64_t TeamMask(int Team, int ExceptID = -1, int Asker = -1);
int64 TeamMask(int Team, int ExceptID = -1, int Asker = -1);
int Count(int Team) const;