Ejemplo n.º 1
0
int CHud::MsgFunc_Logo(const char *pszName,  int iSize, void *pbuf)
{
	BEGIN_READ( pbuf, iSize );

	// update Train data
	m_iLogo = READ_BYTE();

	return 1;
}
Ejemplo n.º 2
0
static int load_function(struct load_state *S, ktap_proto *f)
{
	f->linedefined = READ_INT(S);
 	f->lastlinedefined = READ_INT(S);
	f->numparams = READ_BYTE(S);
	f->is_vararg = READ_BYTE(S);
	f->maxstacksize = READ_BYTE(S);
	if (load_code(S, f))
		return -1;
	if (load_constants(S, f))
		return -1;
	if (load_upvalues(S, f))
		return -1;
	if (load_debuginfo(S, f))
		return -1;

	return 0;
}
Ejemplo n.º 3
0
int CHudSayText :: MsgFunc_SayText( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pbuf, iSize );

	int client_index = READ_BYTE();		// the client who spoke the message
	SayTextPrint( READ_STRING(), iSize - 1,  client_index );
	
	return 1;
}
Ejemplo n.º 4
0
//Ben
void CHud::MsgFunc_Dead(const char *pszName, int iSize, void *pbuf)
{
	BEGIN_READ( pbuf, iSize);

	short client = READ_BYTE();
	short dead_state = READ_BYTE();

	if(dead_state == 2)
	{
		g_PlayerExtraInfo[client].dead = true;
	}
	else
	{
		g_PlayerExtraInfo[client].dead = false;
	}
	gViewPort->m_pScoreBoard->Update();
//	m_CommanderMenu.Die();
}
Ejemplo n.º 5
0
static int load_upvalues(struct load_state *S, ktap_proto *f)
{
	int i,n;

	n = READ_INT(S);
	f->upvalues = NEW_VECTOR(S, n * sizeof(ktap_upvaldesc));
	f->sizeupvalues = n;

	for (i = 0; i < n; i++)
		f->upvalues[i].name = NULL;

	for (i = 0; i < n; i++) {
		f->upvalues[i].instack = READ_BYTE(S);
		f->upvalues[i].idx = READ_BYTE(S);
	}

	return 0;
}
Ejemplo n.º 6
0
int PALSARJaxaDataset::Identify( GDALOpenInfo *poOpenInfo ) {
    if ( poOpenInfo->fp == NULL || poOpenInfo->nHeaderBytes < 360 )
        return 0;

    /* First, check that this is a PALSAR image indeed */
    if ( !EQUALN((char *)(poOpenInfo->pabyHeader + 60),"AL", 2) 
         || !EQUALN(CPLGetBasename((char *)(poOpenInfo->pszFilename)) + 4, 
                    "ALPSR", 5) )
    {
        return 0;
    }

    FILE *fpL = VSIFOpenL( poOpenInfo->pszFilename, "r" );
    if( fpL == NULL )
        return FALSE;

    /* Check that this is a volume directory file */
    int nRecordSeq = 0;
    int nRecordSubtype = 0;
    int nRecordType = 0;
    int nSecondSubtype = 0;
    int nThirdSubtype = 0;
    int nLengthRecord = 0;

    VSIFSeekL(fpL, 0, SEEK_SET);

    READ_WORD(fpL, nRecordSeq);
    READ_BYTE(fpL, nRecordSubtype);
    READ_BYTE(fpL, nRecordType);
    READ_BYTE(fpL, nSecondSubtype);
    READ_BYTE(fpL, nThirdSubtype);
    READ_WORD(fpL, nLengthRecord);

    VSIFCloseL( fpL );

    /* Check that we have the right record */
    if ( nRecordSeq == 1 && nRecordSubtype == 192 && nRecordType == 192 &&
         nSecondSubtype == 18 && nThirdSubtype == 18 && nLengthRecord == 360 )
    {
        return 1;
    }

    return 0;
}
Ejemplo n.º 7
0
void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
{
	g_iTeleNum = 0;
	g_bLoadedTeles = false;
	int i;

	//Clear all the teleporters
	for ( i = 0; i < MAX_TELES; i++ )
	{
		g_vecTeleMins[ i ].x = 0.0;
		g_vecTeleMins[ i ].y = 0.0;
		g_vecTeleMins[ i ].z = 0.0;

		g_vecTeleMaxs[ i ].x = 0.0;
		g_vecTeleMaxs[ i ].y = 0.0;
		g_vecTeleMaxs[ i ].z = 0.0;
	}

	/***** FOG CLEARING JIBBA JABBA *****/
	for ( i = 0; i < 3; i++ )
		 g_iFogColor[ i ] = 0.0;

	g_iStartDist = 0.0;
	g_iEndDist = 0.0;
	/***** FOG CLEARING JIBBA JABBA *****/

	// prepare all hud data
	HUDLIST *pList = m_pHudList;

	while (pList)
	{
		if ( pList->p )
			pList->p->InitHUDData();
		pList = pList->pNext;
	}

	BEGIN_READ( pbuf, iSize );
	g_iTeleNum = READ_BYTE();

	for ( i = 0; i < g_iTeleNum; i++ )
	{
		g_vecTeleMins[ i ].x = READ_COORD();
		g_vecTeleMins[ i ].y = READ_COORD();
		g_vecTeleMins[ i ].z = READ_COORD();
		g_vecTeleMaxs[ i ].x = READ_COORD();
		g_vecTeleMaxs[ i ].y = READ_COORD();
		g_vecTeleMaxs[ i ].z = READ_COORD();
	}

	for ( i = 0; i < 3; i++ )
		 g_iFogColor[ i ] = READ_SHORT(); // Should just get a byte.

	//If they both are 0, it means no fog for this level.
	g_iStartDist = READ_SHORT(); 
	g_iEndDist = READ_SHORT(); 
}
Ejemplo n.º 8
0
// Message handler for ShowMenu message
// takes four values:
//		short: a bitfield of keys that are valid input
//		char : the duration, in seconds, the menu should stay up. -1 means is stays until something is chosen.
//		byte : a boolean, TRUE if there is more string yet to be received before displaying the menu, FALSE if it's the last string
//		string: menu string to display
// if this message is never received, then scores will simply be the combined totals of the players.
int CHudMenu::MsgFunc_ShowMenu( const char *pszName, int iSize, void *pbuf )
{
	char *temp = NULL;

	BEGIN_READ( pbuf, iSize );

	m_bitsValidSlots = READ_SHORT();
	int DisplayTime = READ_CHAR();
	int NeedMore = READ_BYTE();

	if( DisplayTime > 0 )
		m_flShutoffTime = DisplayTime + gHUD.m_flTime;
	else
		m_flShutoffTime = -1;

	if( m_bitsValidSlots )
	{
		if( !m_fWaitingForMore ) // this is the start of a new menu
		{
			strncpy( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING );
		}
		else
		{
			// append to the current menu string
			strncat( g_szPrelocalisedMenuString, READ_STRING(), MAX_MENU_STRING - strlen( g_szPrelocalisedMenuString ) - 1 );
		}
		g_szPrelocalisedMenuString[MAX_MENU_STRING - 1] = 0;  // ensure null termination (strncat/strncpy does not)

		if( !NeedMore )
		{
			// we have the whole string, so we can localise it now
			strncpy( g_szMenuString, gHUD.m_TextMessage.BufferedLocaliseTextString( g_szPrelocalisedMenuString ), MAX_MENU_STRING );
			g_szMenuString[MAX_MENU_STRING - 1] = '\0';

			// Swap in characters
			if( KB_ConvertString( g_szMenuString, &temp ) )
			{
				strncpy( g_szMenuString, temp, MAX_MENU_STRING );
				g_szMenuString[MAX_MENU_STRING - 1] = '\0';
				free( temp );
			}
		}

		m_fMenuDisplayed = 1;
		m_iFlags |= HUD_ACTIVE;
	}
	else
	{
		m_fMenuDisplayed = 0; // no valid slots means that the menu should be turned off
		m_iFlags &= ~HUD_ACTIVE;
	}

	m_fWaitingForMore = NeedMore;

	return 1;
}
Ejemplo n.º 9
0
int CHudCloak::MsgFunc_Cloak(const char *pszName,  int iSize, void *pbuf )
{
	Cloak = READ_BYTE();

	if (Cloak)
		m_iFlags |= HUD_ACTIVE;
	else
		m_iFlags &= ~HUD_ACTIVE;
return 1;
}
Ejemplo n.º 10
0
int CHudAmmo::MsgFunc_WeapPickup(const char *pszName, int iSize, void *pbuf)
{
	BEGIN_READ(pbuf, iSize);
	int iIndex = READ_BYTE();

	// Add the weapon to the history
	gHR.AddToHistory(HISTSLOT_WEAP, iIndex);

	return 1;
}
Ejemplo n.º 11
0
// parse_header: populates a kssl_header structure from a byte stream. Returns
// KSSL_ERROR_NONE if successful.
kssl_error_code parse_header(BYTE *bytes,            // Stream of bytes
                             // containing a
                             // kssl_header
                             kssl_header *header) {  // Returns the populated
    // header (must be
    // allocated by caller)
    int offset = 0;

    if (bytes == NULL || header == NULL) {
        return KSSL_ERROR_INTERNAL;
    }

    header->version_maj = READ_BYTE(bytes, offset);
    header->version_min = READ_BYTE(bytes, offset);
    header->length = READ_WORD(bytes, offset);
    header->id = READ_DWORD(bytes, offset);

    return KSSL_ERROR_NONE;
}
Ejemplo n.º 12
0
int CHudRedeemer :: MsgFunc_WarHUD( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );
	m_iHudMode = READ_BYTE();
	m_iOldHudMode = -1;	// force to update
	ClearPermanentFades ();
	END_READ();

	return 1;
}
Ejemplo n.º 13
0
bool HelpTable::SetTableData(void* pvTable, WCHAR* pwszSheetName, std::wstring* pstrDataName, BSTR bstrData)
{
    if (0 == wcscmp(pwszSheetName, L"Table_Data_KOR"))
    {
        sHELP_TBLDAT* pHelp = (sHELP_TBLDAT*)pvTable;

        if (0 == wcscmp(pstrDataName->c_str(), L"Help_Tblidx"))
        {
            pHelp->tblidx = READ_DWORD(bstrData);
        }
        else if (0 == wcscmp(pstrDataName->c_str(), L"Category"))
        {
            pHelp->byCategory = READ_BYTE(bstrData, pstrDataName->c_str());
        }
        else if (0 == wcscmp(pstrDataName->c_str(), L"Help_Title"))
        {
            pHelp->dwHelpTitle = READ_DWORD(bstrData);
        }
        else if (0 == wcscmp(pstrDataName->c_str(), L"Popo_Hint"))
        {
            pHelp->dwPopoHint = READ_DWORD(bstrData);
        }
        else if (0 == wcscmp(pstrDataName->c_str(), L"Help_HTML_Name"))
        {
            READ_STRINGW(bstrData, pHelp->wszHelpHTMLName, _countof(pHelp->wszHelpHTMLName));
        }
        else if (0 == wcscmp(pstrDataName->c_str(), L"Condition_Check"))
        {
            pHelp->byConditionCheck = READ_BYTE(bstrData, pstrDataName->c_str());
        }
        else
        {
            Table::CallErrorCallbackFunction(L"[File] : %s\n[Error] : Unknown field name found!(Field Name = %s)", m_wszXmlFileName, pstrDataName->c_str());
            return false;
        }
    }
    else
    {
        return false;
    }

    return true;
}
Ejemplo n.º 14
0
int CHud :: MsgFunc_RoomType( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	CVAR_SET_FLOAT( "room_type", (float)READ_BYTE( ));

	END_READ();

	return 1;
}
Ejemplo n.º 15
0
int CHud :: MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	m_Teamplay = READ_BYTE();

	END_READ();
	
	return 1;
}
Ejemplo n.º 16
0
int CHud :: MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pbuf, iSize );
	m_iConcussionEffect = READ_BYTE();
	if (m_iConcussionEffect)
		this->m_StatusIcons.EnableIcon("dmg_concuss",255,160,0);
	else
		this->m_StatusIcons.DisableIcon("dmg_concuss");
	return 1;
}
Ejemplo n.º 17
0
int CHudMenu::MsgFunc_VGUIMenu( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ(pbuf, iSize);

	int menuType = READ_BYTE();
	m_bitsValidSlots = READ_SHORT(); // is ignored

	ShowVGUIMenu(menuType);
	return 1;
}
Ejemplo n.º 18
0
int CHudFiremode:: MsgFunc_Firemode(const char *pszName,  int iSize, void *pbuf )
{
	m_iType = READ_BYTE();

	if (m_iType)
	m_iFlags |= HUD_ACTIVE;
	else
	m_iFlags &= ~HUD_ACTIVE;
	return 1;
}
Ejemplo n.º 19
0
// Message handler for text messages
// displays a string, looking them up from the titles.txt file, which can be localised
// parameters:
//   byte:   message direction  ( HUD_PRINTCONSOLE, HUD_PRINTNOTIFY, HUD_PRINTCENTER, HUD_PRINTTALK )
//   string: message
// optional parameters:
//   string: message parameter 1
//   string: message parameter 2
//   string: message parameter 3
//   string: message parameter 4
// any string that starts with the character '#' is a message name, and is used to look up the real message in titles.txt
// the next (optional) one to four strings are parameters for that string (which can also be message names if they begin with '#')
int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pbuf, iSize );

	int msg_dest = READ_BYTE();

#define MSG_BUF_SIZE 128
	static char szBuf[6][MSG_BUF_SIZE];
	char *msg_text = LookupString( READ_STRING(), &msg_dest );
	msg_text = safe_strcpy( szBuf[0], msg_text , MSG_BUF_SIZE);

	// keep reading strings and using C format strings for subsituting the strings into the localised text string
	char *sstr1 = LookupString( READ_STRING() );
	sstr1 = safe_strcpy( szBuf[1], sstr1 , MSG_BUF_SIZE);
	StripEndNewlineFromString( sstr1 );  // these strings are meant for subsitution into the main strings, so cull the automatic end newlines
	char *sstr2 = LookupString( READ_STRING() );
	sstr2 = safe_strcpy( szBuf[2], sstr2 , MSG_BUF_SIZE);
	StripEndNewlineFromString( sstr2 );
	char *sstr3 = LookupString( READ_STRING() );
	sstr3 = safe_strcpy( szBuf[3], sstr3 , MSG_BUF_SIZE);
	StripEndNewlineFromString( sstr3 );
	char *sstr4 = LookupString( READ_STRING() );
	sstr4 = safe_strcpy( szBuf[4], sstr4 , MSG_BUF_SIZE);
	StripEndNewlineFromString( sstr4 );
	char *psz = szBuf[5];

	if ( gViewPort && gViewPort->AllowedToPrintText() == FALSE )
		return 1;

	switch ( msg_dest )
	{
	case HUD_PRINTCENTER:
		safe_sprintf( psz, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 );
		CenterPrint( ConvertCRtoNL( psz ) );
		break;

	case HUD_PRINTNOTIFY:
		psz[0] = 1;  // mark this message to go into the notify buffer
		safe_sprintf( psz+1, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 );
		ConsolePrint( ConvertCRtoNL( psz ) );
		break;

	case HUD_PRINTTALK:
		safe_sprintf( psz, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 );
		gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128 );
		break;

	case HUD_PRINTCONSOLE:
		safe_sprintf( psz, MSG_BUF_SIZE, msg_text, sstr1, sstr2, sstr3, sstr4 );
		ConsolePrint( ConvertCRtoNL( psz ) );
		break;
	}

	return 1;
}
Ejemplo n.º 20
0
int CHudRadio::MsgFunc_SendAudio(const char *pszName, int iSize, void *pbuf)
{
	BEGIN_READ( pbuf, iSize );

	m_bFirst = READ_BYTE( );
	strcpy( m_sentence, READ_STRING( ));
	m_sThird = READ_SHORT( );
	m_enableRadio = true;

	return 1;
}
Ejemplo n.º 21
0
int CHud :: MsgFunc_SetSkin( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	edict_t *viewmodel = GetViewModel();
	viewmodel->v.skin = READ_BYTE();

	END_READ();
	
	return 1;
}
//LRC
void CHud :: MsgFunc_AddShine( const char *pszName, int iSize, void *pbuf )
{
//	CONPRINT("MSG:AddShine");
	BEGIN_READ( pbuf, iSize );

	float fScale = READ_BYTE();
	float fAlpha = READ_BYTE()/255.0;
	float fMinX = READ_COORD();
	float fMaxX = READ_COORD();
	float fMinY = READ_COORD();
	float fMaxY = READ_COORD();
	float fZ = READ_COORD();
	char *szSprite = READ_STRING();

//	gEngfuncs.Con_Printf("minx %f, maxx %f, miny %f, maxy %f\n", fMinX, fMaxX, fMinY, fMaxY);

	CShinySurface *pSurface = new CShinySurface(fScale, fAlpha, fMinX, fMaxX, fMinY, fMaxY, fZ, szSprite);
	pSurface->m_pNext = m_pShinySurface;
	m_pShinySurface = pSurface;
}
Ejemplo n.º 23
0
static bool8 NPClientGetPlayerListFromServer (void)
{
	if (!npclient.online)
		return (false);

	NPNotification("Client: Receiving player list from server...", -1);

	if (NPClientGetMesFromServer() != kNPServerPlayerWillSend)
	{
		NPError("Client: Failed to receive messsage from server.", 5701);
		return (false);
	}

	if (NPClientSendMesToServer(kNPClientPlayerWaiting) == false)
	{
		NPError("Client: Failed to send messsage to server.", 5702);
		return (false);
	}

	for (int i = 0; i < NP_MAX_PLAYERS; i++)
	{
		uint8	mes[10];
		uint32	l;

		if (socket_read(npclient.socket, mes, 10) != 10)
		{
			NPError("Client: Failed to receive messsage from server.", 5703);
			return (false);
		}

		npcinfo[i].ready  = READ_BYTE(mes + 1);
		npcinfo[i].player = READ_LONG(mes + 2);

		l = READ_LONG(mes + 6);

		if (l && (socket_read(npclient.socket, (uint8 *) npcinfo[i].name, l) != (int) l))
		{
			NPError("Client: Failed to receive messsage from server.", 5704);
			return (false);
		}

		npcinfo[i].name[l] = 0;
	}

	npclient.numplayers = 0;
	for (int i = 0; i < NP_MAX_PLAYERS; i++)
		if (npcinfo[i].ready)
			npclient.numplayers++;

	NPNotification("Client: Received player list from server.", -1);
	NPNotification("Client: Number of players: %d", npclient.numplayers);

	return (true);
}
Ejemplo n.º 24
0
int CHudMessage::MsgFunc_HudText2( const char *pszName,  int iSize, void *pbuf )
{
    BEGIN_READ( pbuf, iSize );

    char *pString = READ_STRING();
    bool theIsAutoHelp = READ_BYTE();

    gHUD.AddTooltip(pString, theIsAutoHelp);

    return 2;
}
Ejemplo n.º 25
0
int CHudFlashlight:: MsgFunc_FlashBat(const char *pszName,  int iSize, void *pbuf )
{

	
	BEGIN_READ( pbuf, iSize );
	int x = READ_BYTE();
	m_iBat = x;
	m_flBat = ((float)x)/100.0;

	return 1;
}
Ejemplo n.º 26
0
void CHud :: MsgFunc_SetSky( const char *pszName, int iSize, void *pbuf )
{
//	CONPRINT("MSG:SetSky");
	BEGIN_READ( pbuf, iSize );

	m_iSkyMode = READ_BYTE();
	m_vecSkyPos.x = READ_COORD();
	m_vecSkyPos.y = READ_COORD();
	m_vecSkyPos.z = READ_COORD();
//	m_iSkyScale = READ_BYTE();
}
Ejemplo n.º 27
0
// fo0z
void CHud :: MsgFunc_FPlaySound( const char *pszName, int iSize, void *pbuf )
{
	vec3_t origin;

	BEGIN_READ( pbuf, iSize );

	origin[0] = READ_COORD();
	origin[1] = READ_COORD();
	origin[2] = READ_COORD();
	int entindex = READ_BYTE();
	char *szSoundname = READ_STRING();
	int vol = READ_BYTE();
	int pitch = READ_BYTE();

	if( entindex > 0 )
		SoundEntPlay( entindex, szSoundname, vol, pitch );	// for dynamique ent sound
	else
		SoundPlay( origin, szSoundname, vol, pitch );	// for static sound

}
Ejemplo n.º 28
0
int CHudHealth::MsgFunc_Damage(const char *pszName, int iSize, void *pbuf)
{
	BEGIN_READ(pbuf, iSize);

	int  armor       = READ_BYTE(); // armor
	int  damageTaken = READ_BYTE(); // health
	long bitsDamage  = READ_LONG(); // damage bits

	vec3_t vecFrom;

	for(int i      = 0; i < 3; i++)
		vecFrom[i] = READ_COORD();

	UpdateTiles(gHUD.m_flTime, bitsDamage);

	// Actually took damage?
	if(damageTaken > 0 || armor > 0)
		CalcDamageDirection(vecFrom);

	return 1;
}
Ejemplo n.º 29
0
int CHudGeiger::MsgFunc_Geiger(const char *pszName, int iSize, void *pbuf)
{
	BEGIN_READ(pbuf, iSize);

	// update geiger data
	m_iGeigerRange = READ_BYTE();
	m_iGeigerRange = m_iGeigerRange << 2;

	m_iFlags |= HUD_ACTIVE;

	return 1;
}
Ejemplo n.º 30
0
// Message handler for StatusIcon message
// accepts five values:
//		byte   : TRUE = ENABLE icon, FALSE = DISABLE icon
//		string : the sprite name to display
//		byte   : red
//		byte   : green
//		byte   : blue
int CHudStatusIcons::MsgFunc_StatusIcon( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pbuf, iSize );

	int ShouldEnable = READ_BYTE();
	char *pszIconName = READ_STRING();
	if ( ShouldEnable )
	{
		int r = READ_BYTE();
		int g = READ_BYTE();
		int b = READ_BYTE();
		EnableIcon( pszIconName, r, g, b );
		m_iFlags |= HUD_ACTIVE;
	}
	else
	{
		DisableIcon( pszIconName );
	}

	return 1;
}