本文整理汇总了C++中MSG_WriteShort函数的典型用法代码示例。如果您正苦于以下问题:C++ MSG_WriteShort函数的具体用法?C++ MSG_WriteShort怎么用?C++ MSG_WriteShort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MSG_WriteShort函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: write_level_file
static int write_level_file(void)
{
char name[MAX_OSPATH];
int i;
char *s;
size_t len;
byte portalbits[MAX_MAP_PORTAL_BYTES];
qerror_t ret;
// write magic
MSG_WriteLong(SAVE_MAGIC2);
MSG_WriteLong(SAVE_VERSION);
// write configstrings
for (i = 0; i < MAX_CONFIGSTRINGS; i++) {
s = sv.configstrings[i];
if (!s[0])
continue;
len = strlen(s);
if (len > MAX_QPATH)
len = MAX_QPATH;
MSG_WriteShort(i);
MSG_WriteData(s, len);
MSG_WriteByte(0);
}
MSG_WriteShort(MAX_CONFIGSTRINGS);
len = CM_WritePortalBits(&sv.cm, portalbits);
MSG_WriteByte(len);
MSG_WriteData(portalbits, len);
len = Q_snprintf(name, MAX_QPATH, "save/" SAVE_CURRENT "/%s.sv2", sv.name);
if (len >= MAX_QPATH)
ret = -1;
else
ret = FS_WriteFile(name, msg_write.data, msg_write.cursize);
SZ_Clear(&msg_write);
if (ret < 0)
return -1;
// write game level
len = Q_snprintf(name, MAX_OSPATH,
"%s/save/" SAVE_CURRENT "/%s.sav", fs_gamedir, sv.name);
if (len >= MAX_OSPATH)
return -1;
ge->WriteLevel(name);
return 0;
}
开发者ID:jdolan,项目名称:q2pro,代码行数:53,代码来源:save.c
示例2: GTH_SendMessageRequestItemSyncItem
void GTH_SendMessageRequestItemSyncItem()
{
MSG_BeginWriting(&netMessage);
MSG_Clear( &netMessage );
{
MSG_WriteByte(&netMessage, EXTEND_SECOND);
MSG_WriteShort(&netMessage, ITEM_EXTEND_SYSTEM);
MSG_WriteShort(&netMessage, REQUEST_ITEM_SYNC_TIME);
NET_SendMessage(&gsSocket, &netMessage);
}
MSG_EndWriting(&netMessage);
}
开发者ID:gthgame,项目名称:gth,代码行数:12,代码来源:ItemExtendSystemFunc.cpp
示例3: Netchan_TransmitNextFragment
/*
=================
Netchan_TransmitNextFragment
Send one fragment of the current message
=================
*/
void Netchan_TransmitNextFragment( netchan_t *chan )
{
msg_t send;
byte send_buf[ MAX_PACKETLEN ];
int fragmentLength;
// write the packet header
MSG_InitOOB( &send, send_buf, sizeof( send_buf ) ); // <-- only do the oob here
MSG_WriteLong( &send, chan->outgoingSequence | FRAGMENT_BIT );
// send the qport if we are a client
if ( chan->sock == NS_CLIENT )
{
MSG_WriteShort( &send, qport->integer );
}
// copy the reliable message to the packet first
fragmentLength = FRAGMENT_SIZE;
if ( chan->unsentFragmentStart + fragmentLength > chan->unsentLength )
{
fragmentLength = chan->unsentLength - chan->unsentFragmentStart;
}
MSG_WriteShort( &send, chan->unsentFragmentStart );
MSG_WriteShort( &send, fragmentLength );
MSG_WriteData( &send, chan->unsentBuffer + chan->unsentFragmentStart, fragmentLength );
// send the datagram
NET_SendPacket( chan->sock, send.cursize, send.data, chan->remoteAddress );
if ( showpackets->integer )
{
Com_Printf( "%s send %4i : s=%i fragment=%i,%i\n"
, netsrcString[ chan->sock ]
, send.cursize
, chan->outgoingSequence
, chan->unsentFragmentStart, fragmentLength );
}
chan->unsentFragmentStart += fragmentLength;
// this exit condition is a little tricky, because a packet
// that is exactly the fragment length still needs to send
// a second packet of zero length so that the other side
// can tell there aren't more to follow
if ( chan->unsentFragmentStart == chan->unsentLength && fragmentLength != FRAGMENT_SIZE )
{
chan->outgoingSequence++;
chan->unsentFragments = qfalse;
}
}
开发者ID:Sixthly,项目名称:Unvanquished,代码行数:60,代码来源:net_chan.c
示例4: MSG_BeginWriting
void CHelperManager_Encoder::SendMessage_Helper_StackOpen(playerCharacter_t* pHelper)
{
MSG_BeginWriting(&netMessage);
MSG_Clear( &netMessage );
{
MSG_WriteByte(&netMessage, EXTEND_SECOND);
MSG_WriteShort ( &netMessage, HELPER_SYSTEM );
MSG_WriteShort(&netMessage, SC_STACK_OPEN_Req_toPlayer);
NET_SendMessage(&pHelper->sock, &netMessage);
}
MSG_EndWriting(&netMessage);
}
开发者ID:gthgame,项目名称:gth,代码行数:12,代码来源:CHelperManager_Encoder.cpp
示例5: MSG_BeginWriting
void CGs_To_Cc::Send(playerCharacter_t* pPlayer,int SystemType,int mainType, int subType)
{
MSG_BeginWriting( &netMessage );
MSG_Clear( &netMessage );
{
MSG_WriteByte(&netMessage, EXTEND_SECOND);
MSG_WriteShort(&netMessage, SystemType);
MSG_WriteShort(&netMessage, mainType);
MSG_WriteShort(&netMessage, subType);
NET_SendMessage(&pPlayer->sock, &netMessage);
}
MSG_EndWriting(&netMessage);
}
开发者ID:gthgame,项目名称:gth,代码行数:13,代码来源:Gs_To_Cc.cpp
示例6: MSG_BeginWriting
void CGMCtrl::TransmitePacket_cs_request_AUTHstate(void)
{
MSG_BeginWriting(&netMessage);
MSG_Clear( &netMessage );
{
MSG_WriteByte(&netMessage, EXTEND_SECOND);
MSG_WriteShort(&netMessage, GMsystem);
MSG_WriteShort(&netMessage, tagExtendSecondPacket_GMsystem::GMsystem_NProtect);
MSG_WriteShort(&netMessage, tagExtendSecondPacket_GMsystem::tagNProtect::cs_request_AUTHstate);
NET_SendMessage(&gsSocket, &netMessage);
}
MSG_EndWriting( &netMessage );
}
开发者ID:gthgame,项目名称:gth,代码行数:13,代码来源:CGMCtrl.cpp
示例7: SV_UpdateMasterServer
//
// SV_UpdateMasterServer
//
void SV_UpdateMasterServer(masterserver &m)
{
SZ_Clear(&ml_message);
MSG_WriteLong(&ml_message, CHALLENGE);
// send out actual port, because NAT may present an incorrect port to the master
if(natport)
MSG_WriteShort(&ml_message, natport);
else
MSG_WriteShort(&ml_message, port);
NET_SendPacket(ml_message, m.masteraddr);
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:16,代码来源:sv_master.cpp
示例8: NVS_WriteShort
// 2000-05-02 NVS SVC by Maddes
void NVS_WriteShort (int dest, int c, sizebuf_t *sb)
{
int i;
switch (dest)
{
case MSG_INIT:
if (sv.nvs_msgsignon->conversion_tab[sv.nvs_msgserver->numwrites-sv.nvs_msgwrites])
{
if (sb) // special signon
{
MSG_WriteShort (sb, c);
}
else
{
MSG_WriteShort (&sv.signon, c);
}
}
break;
case MSG_ONE:
case MSG_ALL:
case MSG_BROADCAST:
for (i=0 ; i<svs.maxclients ; i++)
{
if (NVS_CheckClient(&svs.clients[i]))
{
if (dest == MSG_BROADCAST) // unreliable
{
MSG_WriteShort (&svs.clients[i].datagram, c);
}
else if (dest == MSG_ONE && sb) // special reliable MSG_ONE
{
MSG_WriteShort (sb, c);
}
else // reliable MSG_ONE, MSG_ALL
{
MSG_WriteShort (&svs.clients[i].message, c);
}
}
}
break;
default:
Host_Error ("NVS_WriteShort: bad destination");
break;
}
NVS_CheckCounter();
}
开发者ID:eukos16,项目名称:NGUNIX,代码行数:51,代码来源:nvs_server.c
示例9: MSG_BeginWriting
void CGMCtrl::TransmitePacket_NProtect_sc_response_AUTH(playerCharacter_t* pPlayer) const
{
MSG_BeginWriting(&netMessage);
MSG_Clear( &netMessage );
{
MSG_WriteByte(&netMessage, EXTEND_SECOND);
MSG_WriteShort(&netMessage, GMsystem);
MSG_WriteShort(&netMessage, tagExtendSecondPacket_GMsystem::GMsystem_NProtect);
MSG_WriteShort(&netMessage, tagExtendSecondPacket_GMsystem::tagNProtect::sc_response_AUTH);
MSG_WriteLong(&netMessage, m_cpServerStateDataCtrl->isNProtectAUTH());
NET_SendMessage( &(pPlayer->sock), &netMessage );
}
MSG_EndWriting(&netMessage);
}
开发者ID:gthgame,项目名称:gth,代码行数:14,代码来源:CGMCtrl.cpp
示例10: GTH_SendMessage_GambleSystem_Active
void GTH_SendMessage_GambleSystem_Active(BOOL bActive)
{
MSG_BeginWriting(&netMessage);
MSG_Clear( &netMessage );
{
MSG_WriteByte(&netMessage, EXTEND_SECOND);
MSG_WriteShort(&netMessage, GAMBLE_SYSTEM );
MSG_WriteShort(&netMessage, ACTIVE_SYSTEM_REQUEST );
MSG_WriteLong(&netMessage, bActive);
NET_SendMessage(&gsSocket, &netMessage);
}
MSG_EndWriting( &netMessage );
}
开发者ID:gthgame,项目名称:gth,代码行数:14,代码来源:GambleSystemFunc.cpp
示例11: SV_FullClientUpdate
void SV_FullClientUpdate (client_t *client, sizebuf_t *buf)
{
int i;
char info[MAX_INFO_STRING];
// Con_Printf("%s\n", __thisfunc__);
i = client - svs.clients;
// Sys_Printf("%s: Updated frags for client %d\n", __thisfunc__, i);
MSG_WriteByte (buf, svc_updatedminfo);
MSG_WriteByte (buf, i);
MSG_WriteShort (buf, client->old_frags);
MSG_WriteByte (buf, (client->playerclass<<5)|((int)client->edict->v.level&31));
if (dmMode.integer == DM_SIEGE)
{
MSG_WriteByte (buf, svc_updatesiegeinfo);
MSG_WriteByte (buf, (int)ceil(timelimit.value));
MSG_WriteByte (buf, (int)ceil(fraglimit.value));
MSG_WriteByte (buf, svc_updatesiegeteam);
MSG_WriteByte (buf, i);
MSG_WriteByte (buf, client->siege_team);
MSG_WriteByte (buf, svc_updatesiegelosses);
MSG_WriteByte (buf, PR_GLOBAL_STRUCT(defLosses));
MSG_WriteByte (buf, PR_GLOBAL_STRUCT(attLosses));
MSG_WriteByte (buf, svc_time);//send server time upon connection
MSG_WriteFloat (buf, sv.time);
}
MSG_WriteByte (buf, svc_updateping);
MSG_WriteByte (buf, i);
MSG_WriteShort (buf, SV_CalcPing (client));
MSG_WriteByte (buf, svc_updateentertime);
MSG_WriteByte (buf, i);
MSG_WriteFloat (buf, realtime - client->connection_started);
strcpy (info, client->userinfo);
Info_RemovePrefixedKeys (info, '_'); // server passwords, etc
MSG_WriteByte (buf, svc_updateuserinfo);
MSG_WriteByte (buf, i);
MSG_WriteLong (buf, client->userid);
MSG_WriteString (buf, info);
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:49,代码来源:sv_main.c
示例12: Server_MakeStatic
void Server_MakeStatic(ServerEntity_t *ent)
{
int i,bits=0;
if(ent->alpha == ENTALPHA_ZERO)
{
ED_Free(ent);
return;
}
if(SV_ModelIndex(ent->v.model) & 0xFF00)
bits |= B_LARGEMODEL;
if((int)(ent->v.frame) & 0xFF00)
bits |= B_LARGEFRAME;
if(ent->alpha != ENTALPHA_DEFAULT)
bits |= B_ALPHA;
if(bits)
{
MSG_WriteByte(&sv.signon, SVC_SPAWNSTATIC2);
MSG_WriteByte(&sv.signon, bits);
}
else
MSG_WriteByte(&sv.signon, svc_spawnstatic);
if(bits & B_LARGEMODEL)
MSG_WriteShort(&sv.signon, SV_ModelIndex(ent->v.model));
else
MSG_WriteByte(&sv.signon, SV_ModelIndex(ent->v.model));
if(bits & B_LARGEFRAME)
MSG_WriteShort(&sv.signon,ent->v.frame);
else
MSG_WriteByte(&sv.signon,ent->v.frame);
MSG_WriteByte(&sv.signon,ent->Model.fScale);
MSG_WriteByte(&sv.signon,ent->v.colormap);
MSG_WriteByte(&sv.signon,ent->Model.iSkin);
for (i=0 ; i<3 ; i++)
{
MSG_WriteCoord(&sv.signon, ent->v.origin[i]);
MSG_WriteAngle(&sv.signon, ent->v.angles[i]);
}
if (bits & B_ALPHA)
MSG_WriteByte (&sv.signon, ent->alpha);
ED_Free (ent);
}
开发者ID:ExperimentationBox,项目名称:Edenite,代码行数:49,代码来源:EngineGame.c
示例13: MSG_BeginWriting
void CHelperManager::MemberList_Request_Update_OtherServer ( playerCharacter_t* pHelper, int fstate )
{
MSG_BeginWriting ( &netMessage );
MSG_Clear( &netMessage );
{
MSG_WriteByte(&netMessage, EXTEND_SECOND);
MSG_WriteShort ( &netMessage, HELPER_SYSTEM );
MSG_WriteShort ( &netMessage, SS_REQUEST_UPDATE_MemberList_toServer);
MSG_WriteString ( &netMessage, pHelper->name );
MSG_WriteByte ( &netMessage, fstate );
NET_SendUnreliableMessage ( &localSocket, &netMessage );
}
MSG_EndWriting(&netMessage);
}
开发者ID:gthgame,项目名称:gth,代码行数:15,代码来源:HelperManager.cpp
示例14: MSG_BeginWriting
void CWeatherSystem::GTH_SendUserNotice(char *notice)
{
MSG_BeginWriting( &netMessage );
MSG_Clear( &netMessage );
{
MSG_WriteByte(&netMessage, EXTEND_SECOND);
MSG_WriteShort(&netMessage, WEATHER_SYSTEM );
MSG_WriteShort(&netMessage, CC_WEATHER_SYSTEM );
MSG_WriteByte(&netMessage, CC_WEATHER_SYSTEM_NOTICE);
MSG_WriteString(&netMessage, notice);
NET_SendMessage(&gsSocket, &netMessage);
}
MSG_EndWriting(&netMessage);
}
开发者ID:gthgame,项目名称:gth,代码行数:15,代码来源:WeatherSystem.cpp
示例15: SV_CreateClientGameStateMessage
void SV_CreateClientGameStateMessage( client_t *client, msg_t *msg ) {
int start;
entityState_t *base, nullstate;
// NOTE, MRE: all server->client messages now acknowledge
// let the client know which reliable clientCommands we have received
MSG_WriteLong( msg, client->lastClientCommand );
// send any server commands waiting to be sent first.
// we have to do this cause we send the client->reliableSequence
// with a gamestate and it sets the clc.serverCommandSequence at
// the client side
SV_UpdateServerCommandsToClient( client, msg );
// send the gamestate
MSG_WriteByte( msg, svc_gamestate );
MSG_WriteLong( msg, client->reliableSequence );
// write the configstrings
for ( start = 0 ; start < MAX_CONFIGSTRINGS ; start++ ) {
if (sv.configstrings[start][0]) {
MSG_WriteByte( msg, svc_configstring );
MSG_WriteShort( msg, start );
MSG_WriteBigString( msg, sv.configstrings[start] );
}
}
// write the baselines
Com_Memset( &nullstate, 0, sizeof( nullstate ) );
for ( start = 0 ; start < MAX_GENTITIES; start++ ) {
base = &sv.svEntities[start].baseline;
if ( !base->number ) {
continue;
}
MSG_WriteByte( msg, svc_baseline );
MSG_WriteDeltaEntity( msg, &nullstate, base, qtrue );
}
MSG_WriteByte( msg, svc_EOF );
MSG_WriteLong( msg, client - svs.clients);
// write the checksum feed
MSG_WriteLong( msg, sv.checksumFeed);
// For old RMG system.
MSG_WriteShort ( msg, 0 );
}
开发者ID:Avygeil,项目名称:NewJK,代码行数:48,代码来源:sv_client.cpp
示例16: SV_New_f
/*
================
SV_New_f
Sends the first message from the server to a connected client.
This will be sent on the initial connection and upon each server load.
================
*/
void SV_New_f(void)
{
char * gamedir;
int playernum;
edict_t * ent;
Com_DPrintf("New() from %s\n", sv_client->name);
if (sv_client->state != cs_connected)
{
Com_Printf("New not valid -- already spawned\n");
return;
}
// demo servers just dump the file message
if (sv.state == ss_demo)
{
SV_BeginDemoserver();
return;
}
//
// serverdata needs to go over for all types of servers
// to make sure the protocol is right, and to set the gamedir
//
gamedir = Cvar_VariableString("gamedir");
// send the serverdata
MSG_WriteByte(&sv_client->netchan.message, svc_serverdata);
MSG_WriteLong(&sv_client->netchan.message, PROTOCOL_VERSION);
MSG_WriteLong(&sv_client->netchan.message, svs.spawncount);
MSG_WriteByte(&sv_client->netchan.message, sv.attractloop);
MSG_WriteString(&sv_client->netchan.message, gamedir);
if (sv.state == ss_cinematic || sv.state == ss_pic)
playernum = -1;
else
playernum = sv_client - svs.clients;
MSG_WriteShort(&sv_client->netchan.message, playernum);
// send full levelname
MSG_WriteString(&sv_client->netchan.message, sv.configstrings[CS_NAME]);
//
// game server
//
if (sv.state == ss_game)
{
// set up the entity for the client
ent = EDICT_NUM(playernum + 1);
ent->s.number = playernum + 1;
sv_client->edict = ent;
memset(&sv_client->lastcmd, 0, sizeof(sv_client->lastcmd));
// begin fetching configstrings
MSG_WriteByte(&sv_client->netchan.message, svc_stufftext);
MSG_WriteString(&sv_client->netchan.message, va("cmd configstrings %i 0\n", svs.spawncount));
}
}
开发者ID:glampert,项目名称:quake2-for-ps2,代码行数:68,代码来源:sv_user.c
示例17: SV_NextDownload_f
/*
==================
SV_NextDownload_f
==================
*/
static void SV_NextDownload_f (void)
{
byte buffer[1024];
int r;
int percent;
int size;
if (!host_client->download)
return;
r = host_client->downloadsize - host_client->downloadcount;
if (r > 1024)
r = 1024;
r = fread (buffer, 1, r, host_client->download);
MSG_WriteByte (&host_client->netchan.message, svc_download);
MSG_WriteShort (&host_client->netchan.message, r);
host_client->downloadcount += r;
size = host_client->downloadsize;
if (!size)
size = 1;
percent = host_client->downloadcount*100/size;
MSG_WriteByte (&host_client->netchan.message, percent);
SZ_Write (&host_client->netchan.message, buffer, r);
if (host_client->downloadcount != host_client->downloadsize)
return;
fclose (host_client->download);
host_client->download = NULL;
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:36,代码来源:sv_user.c
示例18: Game_AmbientSound
void Game_AmbientSound(MathVectorf_t *vPosition,const char *cPath,int iVolume,int iAttenuation)
{
char **cCheck;
int i,iSoundNumber;
bool bLarge = false;
for(iSoundNumber = 0,cCheck = sv.sound_precache; *cCheck; cCheck++,iSoundNumber++)
if(!strcmp(*cCheck,cPath))
break;
if(!*cCheck)
Console_ErrorMessage(false,(char*)cPath,"Sound was not registered.");
if(iSoundNumber > 255)
bLarge = true;
if(bLarge)
MSG_WriteByte(&sv.signon,svc_spawnstaticsound2);
else
MSG_WriteByte(&sv.signon,svc_spawnstaticsound);
for(i = 0; i < 3; i++)
MSG_WriteCoord(&sv.signon,vPosition[i]);
if(bLarge)
MSG_WriteShort(&sv.signon,iSoundNumber);
else
MSG_WriteByte(&sv.signon,iSoundNumber);
MSG_WriteByte(&sv.signon,iVolume);
MSG_WriteByte(&sv.signon,iAttenuation*64);
}
开发者ID:ExperimentationBox,项目名称:Edenite,代码行数:32,代码来源:EngineGame.c
示例19: GTH_SendMessageRequestItemTimeSet
void GTH_SendMessageRequestItemTimeSet(const enum sItemUseTimeInfo::enumInventoryType type, int iItemIdx, int iinvenIdx)
{
MSG_BeginWriting(&netMessage);
MSG_Clear( &netMessage );
{
MSG_WriteByte(&netMessage, EXTEND_SECOND);
MSG_WriteShort(&netMessage, ITEM_EXTEND_SYSTEM);
MSG_WriteShort(&netMessage, REQUEST_ITEM_TIME_SET);
MSG_WriteLong(&netMessage, (int)type);
MSG_WriteLong(&netMessage, iItemIdx);
MSG_WriteLong(&netMessage, iinvenIdx);
NET_SendMessage(&gsSocket, &netMessage);
}
MSG_EndWriting(&netMessage);
}
开发者ID:gthgame,项目名称:gth,代码行数:16,代码来源:ItemExtendSystemFunc.cpp
示例20: SV_NextDownload_f
/*
==================
SV_NextDownload_f
==================
*/
void SV_NextDownload_f(void){
int percent, size, r;
if(!sv_client->download)
return;
r = sv_client->downloadsize - sv_client->downloadcount;
if(r > 1024)
r = 1024;
MSG_WriteByte(&sv_client->netchan.message, svc_download);
MSG_WriteShort(&sv_client->netchan.message, r);
sv_client->downloadcount += r;
size = sv_client->downloadsize;
if(!size)
size = 1;
percent = sv_client->downloadcount * 100 / size;
MSG_WriteByte(&sv_client->netchan.message, percent);
SZ_Write(&sv_client->netchan.message,
sv_client->download + sv_client->downloadcount - r, r);
if(sv_client->downloadcount != sv_client->downloadsize)
return;
FS_FreeFile(sv_client->download);
sv_client->download = NULL;
}
开发者ID:luaman,项目名称:qforge-2,代码行数:33,代码来源:sv_user.c
注:本文中的MSG_WriteShort函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论