private void chkCastShadow_CheckedChanged(object sender, EventArgs e) { info.mobjinfo_t mobT = getMoType(); if (mobT == null) { return; } if (mobT.light == null) { return; } mobT.light.castShadow = chkCastShadow.Checked; mobT.light.makeColor(); Game1.instance.NeedSave = true; DoomDef.mobj_t selectedMo = Game1.instance.selectedMob.Target as DoomDef.mobj_t; if (selectedMo == null) { return; } for (DoomDef.thinker_t think = p_tick.thinkercap.next; think != p_tick.thinkercap; think = think.next) { if (think == null) { break; } if (think.function == null) { continue; } DoomDef.mobj_t mo = think.function.obj as DoomDef.mobj_t; if (mo == null) { continue; } if (mo.shadowInfo == null) { continue; } if (mo.type != selectedMo.type) { continue; } if (!mobT.light.castShadow) { mo.shadowInfo.Dispose(); mo.shadowInfo = null; } } }
private void sldRadius_Scroll(object sender, EventArgs e) { info.mobjinfo_t mobT = getMoType(); if (mobT == null) { return; } if (mobT.light == null) { return; } mobT.light.radius = (float)sldRadius.Value; mobT.light.makeColor(); Game1.instance.NeedSave = true; DoomDef.mobj_t selectedMo = Game1.instance.selectedMob.Target as DoomDef.mobj_t; if (selectedMo == null) { return; } for (DoomDef.thinker_t think = p_tick.thinkercap.next; think != p_tick.thinkercap; think = think.next) { if (think == null) { break; } if (think.function == null) { continue; } DoomDef.mobj_t mo = think.function.obj as DoomDef.mobj_t; if (mo == null) { continue; } if (mo.shadowInfo == null) { continue; } if (mo.type != selectedMo.type) { continue; } mo.shadowInfo.needUpdate = true; } }
public void invalidate(bool doNeighbors) { needUpdateAmbientMap = true; if (floorBatch != null) { floorBatch.vb.Dispose(); floorBatch = null; } if (ceilingBatch != null) { ceilingBatch.vb.Dispose(); ceilingBatch = null; } if (sectorBatches != null) { foreach (SectorBatch batch in sectorBatches) { if (batch.vb != null) { batch.vb.Dispose(); } } sectorBatches = null; } // Invalidate also neiborgh sectors if (doNeighbors) { if (segs != null) { foreach (seg_t seg in segs) { if (seg.backsector != null) { seg.backsector.invalidate(false); } } } // Check for lights that touch that sector, and invalidate their shadow for (DoomDef.thinker_t think = p_tick.thinkercap.next; think != p_tick.thinkercap; think = think.next) { if (think == null) { break; } if (think.function == null) { continue; } DoomDef.mobj_t mo = think.function.obj as DoomDef.mobj_t; if (mo == null) { continue; } if (mo.shadowInfo == null) { continue; } if (mo.sectorsInRadius.Contains(this)) { mo.shadowInfo.needUpdate = true; } } } justInvalidated = true; }