Example #1
0
bool LoadGList(char* filename, GList** loadlist)
{
	FILE* eFile = fopen(filename, "r");
	if(eFile)
	{
		char buffer[256];
		int cnt = 0;
		while(!feof(eFile))
		{
			memset(buffer, 0, 256);
			fscanf(eFile, "%s\n", buffer);

			if(strlen(buffer) > 0)
			{
				char* buffer2 = new char[strlen(buffer) + 1];
				strcpy(buffer2, buffer);
				*loadlist = g_list_append(*loadlist, buffer2);
			}
			else
				cnt++;
		}

		fclose(eFile);

		return TRUE;
	}

	Sys_ERROR("Failed To Load GList: %s\n", filename);
	return FALSE;
}
Example #2
0
bool LoadExclusionList(char* filename, list<Str>* exclusionList)
{
	FILE* eFile = fopen(filename, "r");
	if(eFile)
	{
		char buffer[256];
		int cnt = 0;
		while(!feof(eFile))
		{
			memset(buffer, 0, 256);
			fscanf(eFile, "%s\n", buffer);

			if(strlen(buffer) > 0)
				exclusionList->push_back(buffer);
			else
				cnt++;
		}

		fclose(eFile);

		return TRUE;
	}

	Sys_ERROR("Failed To Load Exclusion List: %s\n", filename);
	return FALSE;
}
Example #3
0
extern "C" void WINAPI QERPlug_Dispatch( LPCSTR p, vec3_t vMin, vec3_t vMax, bool bSingleBrush ){
	LoadLists();

	if ( !g_bBSPInitDone ) {
		g_BSPTable.m_nSize = sizeof( _QERAppBSPFrontendTable );
		if ( g_FuncTable.m_pfnRequestInterface( QERAppBSPFrontendTable_GUID, static_cast<LPVOID>( &g_BSPTable ) ) ) {
			g_bBSPInitDone = TRUE;
		}
		else
		{
			Sys_ERROR( "_QERAppBSPFrontendTable interface request failed\n" );
			return;
		}
	}

	if ( !strcmp( p, "About..." ) ) {
		DoMessageBox( PLUGIN_ABOUT, "About", IDOK );
	}
	else if ( !strcmp( p, "Colour Changer..." ) ) {
		DoCTFColourChanger();
	}
	else if ( !strcmp( p, "Swap Light Colours" ) ) {
		DoSwapLights();
	}
	else if ( !strcmp( p, "Change Angles 180" ) ) {
		DoChangeAngles();
	}
	else if ( !strcmp( p, "Swap Spawn Points" ) ) {
		DoSwapSpawns();
	}
}
Example #4
0
void DBrush::BuildFromWinding(DWinding *w)
{
    if(w->numpoints < 3)
    {
        Sys_ERROR("Winding has invalid number of points");
        return;
    }

    DPlane* wPlane = w->WindingPlane();

    DWinding* w2;
    w2 = w->CopyWinding();
    int i;
    for(i = 0; i < w2->numpoints; i++)
        VectorAdd(w2->p[i], wPlane->normal, w2->p[i]);

    AddFace(w2->p[0], w2->p[1], w2->p[2], NULL);
    AddFace(w->p[2], w->p[1], w->p[0], NULL);

    for(i = 0; i < w->numpoints-1; i++)
        AddFace(w2->p[i], w->p[i], w->p[i+1], NULL);
    AddFace(w2->p[w->numpoints-1], w->p[w->numpoints-1], w->p[0], NULL);

    delete wPlane;
    delete w2;
}
Example #5
0
void AddFaceWithTextureScaled(scene::Node* brush, vec3_t va, vec3_t vb, vec3_t vc,
                              const char* texture, bool bVertScale, bool bHorScale,
                              float minX, float minY, float maxX, float maxY)
{
    qtexture_t* pqtTexInfo;

    // TTimo: there used to be a call to pfnHasShader here
    //   this was not necessary. In Radiant everything is shader.
    //   If a texture doesn't have a shader script, a default shader object is used.
    // The IShader object was leaking also
    // collect texture info: sizes, etc
    IShader* i = QERApp_Shader_ForName(texture);
    pqtTexInfo = i->getTexture();	// shader width/height doesn't come out properly

    if(pqtTexInfo)
    {
        float scale[2] = {0.5f, 0.5f};
        float shift[2] = {0, 0};

        if(bHorScale)
        {
            int texWidth = pqtTexInfo->width;
            float width = maxX - minX;

            scale[0] = width/texWidth;
            shift[0] = -(float)((int)maxX%(int)width)/scale[0];
        }

        if(bVertScale)
        {
            int texHeight = pqtTexInfo->height;
            float height = maxY - minY;

            scale[1] = height/texHeight;
            shift[1] = (float)((int)minY%(int)height)/scale[1];
        }

        _QERFaceData addFace;
        FillDefaultTexture(&addFace, va, vb, vc, texture);
        addFace.m_texdef.scale[0] = scale[0];
        addFace.m_texdef.scale[1] = scale[1];
        addFace.m_texdef.shift[0] = shift[0];
        addFace.m_texdef.shift[1] = shift[1];

#if 0
        brush->m_brush->addPlane(addFace.m_p0, addFace.m_p1, addFace.m_p2, addFace.m_texdef);
#endif
    }
    else
    {
        // shouldn't even get here, as default missing texture should be returned if
        // texture doesn't exist, but just in case
        AddFaceWithTexture(brush, va, vb, vc, texture, FALSE);
        Sys_ERROR("BobToolz::Invalid Texture Name-> %s", texture);
    }
    // the IShader is not kept referenced, DecRef it
    i->DecRef();
}