Exemple #1
0
    void SetupWad(IwadInfo info, string path)
    {
        if (info.mapInfo != null)
        {
            mapinfo = MapInfoLump.Load(engineWad.GetLumpAsText(info.mapInfo), engineWad);
        }
        Debug.Log("Merging: " + path);
        engineWad.Merge(new WadFile(path));

        wad = engineWad;

        if (info.mapnameFormat == "MAP")
        {
            mapFormat = MapFormat.MAP;
        }
        if (info.mapnameFormat == "EM")
        {
            mapFormat = MapFormat.EM;
        }
        iwadSelector = false;

        for (int i = 0; i < args.pwads.Count; i++)
        {
            wad.Merge(args.pwads[i]);
        }

        if (info.multigen != null)
        {
            multigen = new MultigenParser(engineWad.GetLumpAsText(info.multigen));
        }
        Locale.Load(wad.GetLumpAsText("LOCAL_EN"));
        ItemData.Load(wad.GetLumpAsText("DOOMITEM"));
        StartGame(info);
    }
Exemple #2
0
    public void BuildLevelEntities(MultigenParser multigen)
    {
        for (int i = 0; i < map.things.Length; i++)
        {
            if (!map.things[i].multiplayer)
            {
                MultigenObject mobj = multigen.GetObjectByDoomedNum(map.things[i].type);
                if (mobj != null && thingSectors.ContainsKey(i))
                {
                    GameObject newObj = new GameObject(mobj.name);
                    newObj.transform.localPosition = new Vector3(map.things[i].x * SCALE, thingSectors[i].floorHeight * SCALE * 1.2f, map.things[i].y * SCALE);
                    newObj.transform.localScale    = new Vector3(1.6f, 1.76f, 1.6f);
                    newObj.transform.parent        = thingsObject.transform;

                    LevelEntity ent = newObj.AddComponent <LevelEntity>();

                    ent.LoadMultigen(multigen, mobj, wad);
                    ent.direction = (float)map.things[i].angle;
                }
            }
        }
    }
Exemple #3
0
    public void LoadMultigen(MultigenParser multigen, MultigenObject mobj, WadFile wad)
    {
        this.mobj     = mobj;
        this.multigen = multigen;
        this.wad      = wad;

        if (sprites == null)
        {
            sprites = new Dictionary <string, Sprite[]>();
        }

        if (itemPickupSound == null)
        {
            itemPickupSound = new DoomSound(wad.GetLump("DSITEMUP"), "DSITEMUP").ToAudioClip();
        }

        if (weaponPickupSound == null)
        {
            weaponPickupSound = new DoomSound(wad.GetLump("DSWPNUP"), "DSWPNUP").ToAudioClip();
        }

        boxCollider           = GetComponent <BoxCollider>();
        boxCollider.isTrigger = !mobj.data["flags"].Contains("MF_SOLID");

        radius = ReadFracValue(mobj.data["radius"]);
        height = ReadFracValue(mobj.data["height"]);
        speed  = float.Parse(mobj.data["speed"]) / 128f;
        move   = new Vector3();

        boxCollider.size = new Vector3(radius, height, radius);

        reactionTime = float.Parse(mobj.data["reactiontime"]) * tick;

        spriteMaterial = new Material(Shader.Find("Doom/Texture"));
        Texture2D paletteLookup  = new Palette(wad.GetLump("PLAYPAL")).GetLookupTexture();
        Texture2D colormapLookup = new Colormap(wad.GetLump("COLORMAP")).GetLookupTexture();

        spriteMaterial.SetTexture("_Palette", paletteLookup);
        spriteMaterial.SetTexture("_Colormap", colormapLookup);

        spriteRenderer          = GetComponent <SpriteRenderer>();
        spriteRenderer.material = spriteMaterial;

        string seeSoundName = ParseSoundName(mobj.data["seesound"]);

        if (wad.Contains(seeSoundName))
        {
            seeSound = new DoomSound(wad.GetLump(seeSoundName), seeSoundName).ToAudioClip();
        }

        string activeSoundName = ParseSoundName(mobj.data["activesound"]);

        if (wad.Contains(activeSoundName))
        {
            activeSound = new DoomSound(wad.GetLump(activeSoundName), activeSoundName).ToAudioClip();
        }

        string attackSoundName = ParseSoundName(mobj.data["attacksound"]);

        if (wad.Contains(attackSoundName))
        {
            attackSound = new DoomSound(wad.GetLump(attackSoundName), attackSoundName).ToAudioClip();
        }

        UpdateVerticalPosition();
        SetState(mobj.data["spawnstate"]);
    }