Ejemplo n.º 1
0
void CASW_Use_Area::ActivateMultiTrigger( CBaseEntity *pActivator )
{
	if ( GetNextThink() > gpGlobals->curtime )
		return;         // still waiting for reset time

	if ( !RequirementsMet( pActivator ) )
	{
		if ( m_flWait > 0 )
		{
			SetThink( &CTriggerMultiple::MultiWaitOver );
			SetNextThink( gpGlobals->curtime + m_flWait );
		}

		return;
	}

	m_hActivator = pActivator;

	m_OnTrigger.FireOutput( m_hActivator, this );

	if ( m_flWait > 0 )
	{
		SetThink( &CTriggerMultiple::MultiWaitOver );
		SetNextThink( gpGlobals->curtime + m_flWait );
	}
}
Ejemplo n.º 2
0
void CASW_Button_Area::ActivateUnlockedButton(CASW_Marine* pMarine)
{
	// don't use the button if we're in the delay between using
	if ( m_fLastButtonUseTime != 0 && gpGlobals->curtime < m_fLastButtonUseTime + m_flWait )
		return;
	if ( !pMarine )
		return;

	if( !RequirementsMet( pMarine ) )
		return;

	if ( m_bIsDoorButton )
	{
		// if the door isn't sealed (or greater than a certain amount of damage?)
		//  then make it open
		CASW_Door* pDoor = GetDoor();
		if ( pDoor )
		{
			if (pDoor->GetSealAmount() > 0)
			{
				//Msg("Door mechanism not responding.  Maintenance Division has been notified of the problem.\n");
			}
			else
			{				
				//Msg("Toggling door...\n");
				variant_t emptyVariant;
				pDoor->AcceptInput("Toggle", pMarine, this, emptyVariant, 0);
			}
		}
	}

	// send our 'activated' output
	m_OnButtonActivated.FireOutput(pMarine, this);

	// Fire event
	IGameEvent * event = gameeventmanager->CreateEvent( "button_area_used" );
	if ( event )
	{
		CASW_Player *pPlayer = pMarine->GetCommander();

		event->SetInt( "userid", ( pPlayer ? pPlayer->GetUserID() : 0 ) );
		event->SetInt( "entindex", entindex() );
		gameeventmanager->FireEvent( event );
	}

	m_fLastButtonUseTime = gpGlobals->curtime;

	UpdateWaitingForInput();

	if ( m_bDisableAfterUse )
	{
		UTIL_Remove(this);
	}
}
Ejemplo n.º 3
0
int CMD_MapFilter(int argc, char *argv[])
{
    // Display settings
    if (argc<2) 
    {
        WriteChatColor("Map filtering settings:",USERCOLOR_DEFAULT);
        WriteChatColor("-----------------------",USERCOLOR_DEFAULT);
        for (DWORD i=0;MapFilterOptions[i].szName!=NULL;i++) 
            if (RequirementsMet(i))
                MapFilterSetting(i,argc,argc,argv);

        return 0;
    } 

    if (!stricmp(argv[1],"help")) 
    {
        // Display Help
        WriteChatColor("Map filtering options:",USERCOLOR_DEFAULT);
        for (DWORD i=0;MapFilterOptions[i].szName!=NULL;i++) 
        {
            WriteChatf("%s%s: %s",MapFilterOptions[i].szName,(MapFilterOptions[i].bIsToggle)?"":" #",MapFilterOptions[i].szHelpString);
        }
        WriteChatColor("'option' color [r g b]: Set display color for 'option' (Omit to reset to default)",USERCOLOR_DEFAULT);
        return 0;
    } 

    // Set option
    for (DWORD i=0;MapFilterOptions[i].szName!=NULL;i++) 
    {
        if (!stricmp(argv[1],MapFilterOptions[i].szName)) 
        {
            if (argc>=3 && !stricmp(argv[2],"color")) 
            {
                if (MapFilterOptions[i].DefaultColor == -1) 
                {
                    WriteChatf("Option '%s' does not have a color.",MapFilterOptions[i].szName);
                } 
                else 
                {
                    DWORD R,G,B;
                    R = G = B = 255;
                    if (argc<6) 
                    {
                        MapFilterOptions[i].Color = MapFilterOptions[i].DefaultColor;
                    } 
                    else 
                    {
                        R=atoi(argv[3]);
                        G=atoi(argv[4]);
                        B=atoi(argv[5]);
                        if (R>255) R=255;
                        if (G>255) G=255;
                        if (B>255) B=255;
                        MapFilterOptions[i].Color = R*0x10000 + G*0x100 + B;
                    }
                    WriteChatf("Option '%s' color set to: %d %d %d",MapFilterOptions[i].szName,R,G,B);

                    //itoa(MapFilterOptions[i].Color & 0xFFFFFF,szBuffer,10);
                    char szBuffer[128];
                    sprintf(szBuffer,"%s Color",MapFilterOptions[i].szName);
                    pISInterface->SetSettingi("ISXEQMap.XML","Map Filters",szBuffer,MapFilterOptions[i].Color & 0xFFFFFF);
                    pISInterface->SaveSettings("ISXEQMap.XML");

                    MapFilterOptions[i].Color |= 0xFF000000;
                }
            } 
            else 
            {
                MapFilterSetting(i,2,argc,argv);
            }
            if (MapFilterOptions[i].RegenerateOnChange)
            {
                MapClear();
                MapGenerate();
            }
            return 0;
        }
    }

    WriteChatf("Usage: %s <option>|help",argv[0]);
    return 0;
}
Ejemplo n.º 4
0
VOID MapFilterSetting( DWORD nMapFilter, int arg, int argc, char *argv[])
{
    CHAR szBuffer[MAX_STRING] = {0};
    CHAR Buff[MAX_STRING]={0};
    PCHAR szFilterMap[] = {
        "hide",
        "show",
        NULL
    };
    PMAPFILTER pMapFilter=&MapFilterOptions[nMapFilter];
    if (!RequirementsMet(nMapFilter))
    {
        WriteChatf("'%s' requires '%s' option.  Please enable this option first.",pMapFilter->szName,MapFilterOptions[pMapFilter->RequiresOption].szName);
        return;
    }
    if (arg>=argc) 
    {
        // NO VALUE
        char szBuffer[2048]={0};
        if (pMapFilter->bIsToggle) 
        {
            sprintf(szBuffer,"%s: %s",pMapFilter->szName,szFilterMap[pMapFilter->Enabled]);
        } 
        else if (nMapFilter == MAPFILTER_Custom) 
        {
            if (IsOptionEnabled(nMapFilter)==0)
            {
                sprintf(szBuffer,"%s: Off",pMapFilter->szName);
            } 
            else 
            {
                sprintf(szBuffer,"%s: %s",pMapFilter->szName,FormatSearchSpawn(Buff,&MapFilterCustom));
            }
        } 
        else 
        {
            sprintf(szBuffer,"%s: %d",pMapFilter->szName,pMapFilter->Enabled);
        }
        if (pMapFilter->DefaultColor != -1) 
        {
            DWORD R,G,B;
            R= (pMapFilter->Color&0xFF0000)/0x10000;
            G= (pMapFilter->Color&0xFF00)/0x100;
            B= pMapFilter->Color&0xFF;
            WriteChatf("%s (Color: %d %d %d)",szBuffer,R,G,B);
        }
        else
            WriteChatf("%s",szBuffer);
        return;
    } 


    if (pMapFilter->bIsToggle) 
    {
        if (!stricmp(szFilterMap[0],argv[arg])) 
        {
            pMapFilter->Enabled = 0;
        } 
        else if (!stricmp(szFilterMap[1],argv[arg])) 
        {
            pMapFilter->Enabled = 1;
        } 
        else 
        {
            pMapFilter->Enabled = 1 - pMapFilter->Enabled;
        }
        WriteChatf("%s is now set to: %s",pMapFilter->szName,szFilterMap[IsOptionEnabled(nMapFilter)]);
    } 
    else if (nMapFilter == MAPFILTER_Custom)
    {
        ClearSearchSpawn(&MapFilterCustom);
        {
            pMapFilter->Enabled = 1;
            ParseSearchSpawn(arg+1,argc,argv,MapFilterCustom);
            WriteChatf("%s is now set to: %s",pMapFilter->szName,FormatSearchSpawn(Buff,&MapFilterCustom));
        }
    } 
    else 
    {
        pMapFilter->Enabled = atoi(argv[arg]);
        WriteChatf("%s is now set to: %d",pMapFilter->szName,pMapFilter->Enabled);
    }

    itoa(pMapFilter->Enabled,szBuffer,10);
    pISInterface->SetSettingi("ISXEQMap.xml","Map Filters",pMapFilter->szName,pMapFilter->Enabled);
    pISInterface->SaveSettings("ISXEQMap.xml");
}
Ejemplo n.º 5
0
// ***************************************************************************
// Function:    MapFilters
// Description: Our '/mapfilter' command
//              Sets map filters
// Usage:       /mapfilter [options|help]
// ***************************************************************************
VOID MapFilterSetting(PSPAWNINFO pChar, DWORD nMapFilter, PCHAR szValue)
{
	CHAR szBuffer[MAX_STRING] = { 0 };
	CHAR Buff[MAX_STRING] = { 0 };
	DWORD dwValue = 0;
	PCHAR szFilterMap[] = {
		"hide",
		"show",
		NULL
	};
	if (!pChar) return;
	PMAPFILTER pMapFilter = &MapFilterOptions[nMapFilter];
	if (!RequirementsMet(nMapFilter))
	{
		sprintf_s(szBuffer, "'%s' requires '%s' option.  Please enable this option first.", pMapFilter->szName, MapFilterOptions[pMapFilter->RequiresOption].szName);
		WriteChatColor(szBuffer, USERCOLOR_DEFAULT);
		return;
	}
	if (!szValue) {
		if (pMapFilter->bIsToggle) {
			sprintf_s(szBuffer, "%s: %s", pMapFilter->szName, szFilterMap[pMapFilter->Enabled]);
		}
		else if (nMapFilter == MAPFILTER_Custom) {
			if (IsOptionEnabled(nMapFilter) == 0) {
				sprintf_s(szBuffer, "%s: Off", pMapFilter->szName);
			}
			else {
				sprintf_s(szBuffer, "%s: %s", pMapFilter->szName, FormatSearchSpawn(Buff, sizeof(Buff), &MapFilterCustom));
			}
		}
		else {
			sprintf_s(szBuffer, "%s: %d", pMapFilter->szName, pMapFilter->Enabled);
		}
		if (pMapFilter->DefaultColor != -1) {
			CHAR szBuffer2[MAX_STRING] = { 0 };
			DWORD R, G, B;
			R = (pMapFilter->Color & 0xFF0000) / 0x10000;
			G = (pMapFilter->Color & 0xFF00) / 0x100;
			B = pMapFilter->Color & 0xFF;
			sprintf_s(szBuffer2, "%s (Color: %d %d %d)", szBuffer, R, G, B);
			strcpy_s(szBuffer, szBuffer2);
		}
	}
	else {
		if (pMapFilter->bIsToggle) {
			if (!_stricmp(szFilterMap[0], szValue)) {
				pMapFilter->Enabled = 0;
			}
			else if (!_stricmp(szFilterMap[1], szValue)) {
				pMapFilter->Enabled = 1;
			}
			else {
				pMapFilter->Enabled = 1 - pMapFilter->Enabled;
			}
			sprintf_s(szBuffer, "%s is now set to: %s", pMapFilter->szName, szFilterMap[IsOptionEnabled(nMapFilter)]);
		}
		else if (nMapFilter == MAPFILTER_Custom) {
			ClearSearchSpawn(&MapFilterCustom);
			if (szValue[0] == 0) {
				pMapFilter->Enabled = 0;
				sprintf_s(szBuffer, "%s is now set to: Off", pMapFilter->szName);
			}
			else {
				pMapFilter->Enabled = 1;
				ParseSearchSpawn(szValue, &MapFilterCustom);
				sprintf_s(szBuffer, "%s is now set to: %s", pMapFilter->szName, FormatSearchSpawn(Buff, sizeof(Buff), &MapFilterCustom));
			}
		}
		else if (nMapFilter == MAPFILTER_Marker) {
			CHAR szBuffer2[MAX_STRING] = { 0 };
			GetArg(szBuffer2, szValue, 1);

			if (!_stricmp(szFilterMap[0], szValue)) {
				pMapFilter->Enabled = 0;
				sprintf_s(szBuffer, "%s is now set to: %s", pMapFilter->szName, szFilterMap[IsOptionEnabled(nMapFilter)]);
			}
			else if (!_stricmp(szFilterMap[1], szValue)) {
				pMapFilter->Enabled = 1;
				sprintf_s(szBuffer, "%s is now set to: %s", pMapFilter->szName, szFilterMap[IsOptionEnabled(nMapFilter)]);
			}
			else {
				pMapFilter->Enabled = 1;
				sprintf_s(szBuffer, "%s %s", pMapFilter->szName, FormatMarker(szValue, Buff, sizeof(Buff)));
			}
		}
		else {
			pMapFilter->Enabled = atoi(szValue);
			sprintf_s(szBuffer, "%s is now set to: %d", pMapFilter->szName, pMapFilter->Enabled);
		}
	}
	WriteChatColor(szBuffer, USERCOLOR_DEFAULT);
	if (szValue) {
		_itoa_s(pMapFilter->Enabled, szBuffer, 10);
		WritePrivateProfileString("Map Filters", pMapFilter->szName, szBuffer, INIFileName);
	}
}
Ejemplo n.º 6
0
VOID MapFilters(PSPAWNINFO pChar, PCHAR szLine)
{
	bRunNextCommand = TRUE;
	CHAR szArg[MAX_STRING] = { 0 };
	GetArg(szArg, szLine, 1);
	PCHAR szRest = GetNextArg(szLine);
	CHAR szBuffer[MAX_STRING] = { 0 };

	// Display settings
	if (szArg[0] == 0) {
		WriteChatColor("Map filtering settings:", USERCOLOR_DEFAULT);
		WriteChatColor("-----------------------", USERCOLOR_DEFAULT);
		for (DWORD i = 0; MapFilterOptions[i].szName != NULL; i++)
			if (RequirementsMet(i))
				MapFilterSetting(pChar, i);

		// Display Help
	}
	else if (!_strnicmp(szArg, "help", 4))
	{
		WriteChatColor("Map filtering options:", USERCOLOR_DEFAULT);
		for (DWORD i = 0; MapFilterOptions[i].szName != NULL; i++) {
			sprintf_s(szBuffer, "%s%s: %s", MapFilterOptions[i].szName, (MapFilterOptions[i].bIsToggle) ? "" : " #", MapFilterOptions[i].szHelpString);
			WriteChatColor(szBuffer, USERCOLOR_DEFAULT);
		}
		WriteChatColor("'option' color [r g b]: Set display color for 'option' (Omit to reset to default)", USERCOLOR_DEFAULT);

		// Set option
	}
	else {
		PMAPFILTER Found = 0;
		for (DWORD i = 0; MapFilterOptions[i].szName != NULL; i++) {
			if (!_stricmp(szArg, MapFilterOptions[i].szName)) {
				if (!_strnicmp(szRest, "color", 5)) {
					if (MapFilterOptions[i].DefaultColor == -1) {
						sprintf_s(szBuffer, "Option '%s' does not have a color.", MapFilterOptions[i].szName);
						WriteChatColor(szBuffer, USERCOLOR_DEFAULT);
					}
					else {
						DWORD R, G, B;
						CHAR szBuffer2[MAX_STRING] = { 0 };
						GetArg(szArg, szRest, 2);
						if (szArg[0] == 0) {
							MapFilterOptions[i].Color = MapFilterOptions[i].DefaultColor;
						}
						else {
							R = atoi(szArg);
							G = atoi(GetArg(szArg, szRest, 3));
							B = atoi(GetArg(szArg, szRest, 4));
							if (R>255) R = 255;
							if (G>255) G = 255;
							if (B>255) B = 255;
							MapFilterOptions[i].Color = R * 0x10000 + G * 0x100 + B;
						}
						sprintf_s(szBuffer, "Option '%s' color set to: %d %d %d", MapFilterOptions[i].szName, R, G, B);
						WriteChatColor(szBuffer, USERCOLOR_DEFAULT);
						_itoa_s(MapFilterOptions[i].Color & 0xFFFFFF, szBuffer, 10);
						sprintf_s(szBuffer2, "%s-Color", MapFilterOptions[i].szName);
						WritePrivateProfileString("Map Filters", szBuffer2, szBuffer, INIFileName);
						MapFilterOptions[i].Color |= 0xFF000000;
					}
				}
				else {
					MapFilterSetting(pChar, i, szRest);
				}
				Found = &MapFilterOptions[i];
			}
		}
		if (!Found)
			SyntaxError("Usage: /mapfilter [option|help]");
		else if (Found->RegenerateOnChange)
		{
			MapClear();
			MapGenerate();
		}
	}
}