コード例 #1
0
ファイル: p_terrain.cpp プロジェクト: doomtech/zdoom-old
void ParseSplash ()
{
    int splashnum;
    FSplashDef *splashdef;
    bool isnew = false;

    SC_MustGetString ();
    splashnum = (int)FindSplash (sc_String);
    if (splashnum < 0)
    {
        FSplashDef def;
        def.Name = copystring (sc_String);
        splashnum = (int)Splashes.Push (def);
        isnew = true;
    }
    splashdef = &Splashes[splashnum];

    SC_MustGetString ();
    if (!SC_Compare ("modify") || (SC_MustGetString(), isnew))
    {   // Set defaults
        splashdef->SmallSplashSound =
            splashdef->NormalSplashSound = 0;
        splashdef->SmallSplash =
            splashdef->SplashBase =
                splashdef->SplashChunk = NULL;
        splashdef->ChunkXVelShift =
            splashdef->ChunkYVelShift =
                splashdef->ChunkZVelShift = 8;
        splashdef->ChunkBaseZVel = FRACUNIT;
        splashdef->SmallSplashClip = 12*FRACUNIT;
        splashdef->NoAlert = false;
    }
    if (!SC_Compare ("{"))
    {
        SC_ScriptError ("Expected {");
    }
    else
    {
        GenericParse (SplashParser, SplashKeywords, splashdef, "splash",
                      splashdef->Name);
    }
}
コード例 #2
0
ファイル: p_terrain.cpp プロジェクト: ChillyDoom/zdoom
void ParseSplash (FScanner &sc)
{
	int splashnum;
	FSplashDef *splashdef;
	bool isnew = false;
	FName name;

	sc.MustGetString ();
	name = sc.String;
	splashnum = (int)FindSplash (name);
	if (splashnum < 0)
	{
		FSplashDef def;
		SetSplashDefaults (&def);
		def.Name = name;
		splashnum = (int)Splashes.Push (def);
		isnew = true;
	}
	splashdef = &Splashes[splashnum];

	sc.MustGetString ();
	if (!sc.Compare ("modify"))
	{ // Set defaults
		if (!isnew)
		{ // New ones already have their defaults set before they're pushed.
			SetSplashDefaults (splashdef);
		}
	}
	else
	{
		sc.MustGetString();
	}
	if (!sc.Compare ("{"))
	{
		sc.ScriptError ("Expected {");
	}
	else
	{
		GenericParse (sc, SplashParser, SplashKeywords, splashdef, "splash",
			splashdef->Name);
	}
}
コード例 #3
0
ファイル: p_terrain.cpp プロジェクト: ChillyDoom/zdoom
void ParseTerrain (FScanner &sc)
{
	int terrainnum;
	FName name;

	sc.MustGetString ();
	name = sc.String;
	terrainnum = (int)P_FindTerrain (name);
	if (terrainnum < 0)
	{
		FTerrainDef def;
		memset (&def, 0, sizeof(def));
		def.Splash = -1;
		def.Name = name;
		terrainnum = (int)Terrains.Push (def);
	}

	// Set defaults
	sc.MustGetString ();
	if (!sc.Compare ("modify"))
	{
		name = Terrains[terrainnum].Name;
		memset (&Terrains[terrainnum], 0, sizeof(FTerrainDef));
		Terrains[terrainnum].Splash = -1;
		Terrains[terrainnum].Name = name;
	}
	else
	{
		sc.MustGetString ();
	}

	if (sc.Compare ("{"))
	{
		GenericParse (sc, TerrainParser, TerrainKeywords, &Terrains[terrainnum],
			"terrain", Terrains[terrainnum].Name);
	}
	else
	{
		sc.ScriptError ("Expected {");
	}
}
コード例 #4
0
ファイル: p_terrain.cpp プロジェクト: doomtech/zdoom-old
void ParseTerrain ()
{
    int terrainnum;
    const char *name;

    SC_MustGetString ();
    terrainnum = (int)FindTerrain (sc_String);
    if (terrainnum < 0)
    {
        FTerrainDef def;
        memset (&def, 0, sizeof(def));
        def.Splash = -1;
        def.Name = copystring (sc_String);
        terrainnum = (int)Terrains.Push (def);
    }

    // Set defaults
    SC_MustGetString ();
    if (!SC_Compare ("modify"))
    {
        name = Terrains[terrainnum].Name;
        memset (&Terrains[terrainnum], 0, sizeof(FTerrainDef));
        Terrains[terrainnum].Splash = -1;
        Terrains[terrainnum].Name = name;
    }
    else
    {
        SC_MustGetString ();
    }

    if (SC_Compare ("{"))
    {
        GenericParse (TerrainParser, TerrainKeywords, &Terrains[terrainnum],
                      "terrain", Terrains[terrainnum].Name);
    }
    else
    {
        SC_ScriptError ("Expected {");
    }
}