public NWLayer(NWGameSpace space, int layerID) : base(0, 0) { fSpace = space; fEntry = (LayerEntry)GlobalVars.nwrDB.GetEntry(layerID); fW = fEntry.W; fH = fEntry.H; Resize(fW * StaticData.FieldWidth, fH * StaticData.FieldHeight); EntryID = layerID; fFields = new NWField[fH, fW]; for (int y = 0; y < fH; y++) { for (int x = 0; x < fW; x++) { fFields[y, x] = new NWField(space, this, new ExtPoint(x, y)); } } fEffects = new EffectsList(this, true); }
public NWField(NWGameSpace space, NWLayer layer, ExtPoint coords) : base(StaticData.FieldWidth, StaticData.FieldHeight) { fSpace = space; fLayer = layer; fCoords = coords; fCreatures = new CreaturesList(this, true); fItems = new ItemsList(this, true); fEffects = new EffectsList(this, true); fEmitters = new EmitterList(); ValidCreatures = new List <int>(); if (Layer != null) { LayerEntry layerEntry = (LayerEntry)GlobalVars.nwrDB.GetEntry(Layer.EntryID); fEntry = layerEntry.GetFieldEntry(fCoords.X, fCoords.Y); EntryID = fEntry.GUID; fLandEntry = (LandEntry)GlobalVars.nwrDB.FindEntryBySign(fEntry.LandSign); LandID = fLandEntry.GUID; PrepareCreatures(); } else { fEntry = null; EntryID = -1; fLandEntry = null; LandID = -1; } }
public MainQuest(NWGameSpace space, int artefactID, int deityID) : base(space) { ArtefactID = artefactID; DeityID = deityID; Stage = QuestItemState.qisNone; }
public IvyCreeper(NWGameSpace space, object owner, int creatureID, bool total, bool setName) : base(space, owner, creatureID, total, setName) { IvyBranchRec rec = dbIvyBranches[0]; IvySegment seg = (IvySegment)Add(); seg.X = -1; seg.Y = -1; seg.Id = 0; seg.EntryDir = Directions.DtNone; seg.AvailableEntries = new Directions(rec.Entries); seg.ImageIndex = 0; }
public Player(NWGameSpace space, object owner) : base(space, owner) { CLSID = GlobalVars.cid_Viking; Name = BaseLocale.GetStr(RS.rs_Unknown); Sex = CreatureSex.csMale; fMemory = new Memory(null); HalMap = new NWField(null, null, ExtPoint.Empty); fFaith = new Faith(this); fCraft = new Craft(this); InitBrain(); }
private void UpdateList() { Player player = new Player(null, null); try { for (int i = 0; i < MaxList; i++) { string fn = NWGameSpace.GetSaveFile(NWGameSpace.SAVEFILE_PLAYER, i); fFiles[i] = new GameFile(); fFiles[i].Exist = File.Exists(fn); if (fFiles[i].Exist) { fFiles[i].SaveTime = File.GetLastWriteTime(fn); try { NWGameSpace.LoadPlayer(i, player); fFiles[i].PlayerName = player.Name; int fx = player.Field.X; int fy = player.Field.Y; LayerEntry layer = (LayerEntry)GlobalVars.nwrDB.GetEntry(player.LayerID); string landSign = layer.GetFieldEntry(fx, fy).LandSign; LandEntry land = (LandEntry)GlobalVars.nwrDB.FindEntryBySign(landSign); fFiles[i].LandName = land.Name; } catch (Exception ex) { Logger.Write("FilesWindow.refreshList.PlayerLoad(" + fn + "): " + ex.Message); fFiles[i].PlayerName = "<error>"; fFiles[i].LandName = "<error>"; } } else { fFiles[i].PlayerName = BaseLocale.GetStr(RS.rs_PlayerUnknown); fFiles[i].LandName = "-"; fFiles[i].SaveTime = new DateTime(); } } } finally { player.Dispose(); } }
protected override void DoShowEvent() { base.DoShowEvent(); NWGameSpace space = (NWGameSpace)GameSpace.Instance; Journal journal = space.Journal; StringList lines = fText.Lines; lines.Clear(); lines.BeginUpdate(); int type = -1; for (int i = 0; i < journal.Count; i++) { JournalItem item = journal.GetItem(i); if (type != item.Type) { lines.Add(""); type = item.Type; } lines.AddObject(item.Text, item); } lines.Add(""); lines.AddObject(" " + "Квесты:", new JournalItem(JournalItem.SIT_QUESTS)); int num = space.QuestsCount; for (int i = 0; i < num; i++) { Quest quest = space.GetQuest(i); int stt = (quest.IsComplete ? JournalItem.SIT_QUEST_Y : JournalItem.SIT_QUEST_N); lines.AddObject(" --> " + quest.Description, new JournalItem(stt)); } journal.GenerateStats(lines); lines.EndUpdate(); ActiveControl = fText; }
public void NextSprite(int aX, int aY) { switch (AnimKind) { case AnimationKind.Direction: ImageIndex = ImagesOrigin + (Dir - 1); break; case AnimationKind.Rotation: { int fnum; if (ImageIndex == 0) { fnum = 1; } else { fnum = ImageIndex - ImagesOrigin + 1; } if (fnum == FramesCount) { fnum = 1; } else { fnum++; } ImageIndex = ImagesOrigin + (fnum - 1); } break; } SetPos(aX, aY); NWGameSpace space = (NWGameSpace)fSpace; if (space.Player.IsSeen(aX, aY, false)) { space.RepaintView(25); } }
public static void DrawSymTile(NWGameSpace space, NWField field, int px, int py, BaseScreen screen, ExtRect mapRect, ExtRect viewRect, ImageList symImages) { NWTile place = (NWTile)field.GetTile(px, py); int sx = viewRect.Left + 8 * (px + 1); int sy = viewRect.Top + 10 * (py + 1); if (place != null && !place.EmptyStates) { ushort bg = place.Background; ushort fg = place.Foreground; fg = PtTransDoor(place); short op = space.GetTileBrightness(field, place, true); symImages.DrawImage(screen, sx, sy, GetSymImageIndex(bg), op); int fog = place.FogID; if (fog != PlaceID.pid_Undefined) { symImages.DrawImage(screen, sx, sy, GetSymImageIndex((ushort)PlaceID.pid_Fog), op); } else { if (fg != PlaceID.pid_Undefined) { bool trap = field.IsTrap(px, py); if (!trap || (trap && (place.Trap_Discovered || GlobalVars.Debug_Divinity))) { symImages.DrawImage(screen, sx, sy, GetSymImageIndex(fg), op); } } } if (!field.IsBarrier(px, py) && mapRect.IsBorder(px, py)) { symImages.DrawImage(screen, sx, sy, StaticData.dbSymbols[(int)GetBorderSymbol(px, py)].ImageIndex, op); } } }
public Snake(NWGameSpace space, object owner, int creatureID, bool total, bool setName) : base(space, owner, creatureID, total, setName) { fLength = 5; fSegments.Clear(); Segment seg = Add(); seg.X = -1; seg.Y = -1; seg.ImageIndex = -1; if (fLength - 1 >= 1) { for (int i = 1; i < fLength; i++) { seg = Add(); seg.X = -1; seg.Y = -1; seg.ImageIndex = -1; } } }
private void LineProc(int x, int y, ref bool refContinue) { Steps++; NWGameSpace space = Creature.Space; if (!Map.IsValid(x, y)) { bool gpChanged = false; int fx = Map.Coords.X; int fy = Map.Coords.Y; int px = x; int py = y; GlobalPosition gpi = new GlobalPosition(fx, fy, px, py, gpChanged); gpi.CheckPos(); fx = gpi.Fx; fy = gpi.Fy; px = gpi.Px; py = gpi.Py; gpChanged = gpi.GlobalChanged; NWLayer layer = Map.Layer; if (fx >= 0 && fx != layer.W && fy >= 0 && fy != layer.H && gpChanged) { Map.Items.Extract(ProjectileItem); Map = space.GetField(Creature.LayerID, fx, fy); Map.Items.Add(ProjectileItem, false); ProjectileItem.SetPos(px, py); } refContinue = false; } else { if (Map.IsBarrier(x, y)) { Hit = HIT_BARRIER; refContinue = false; } else if (Steps > Range) { Hit = HIT_NONE; refContinue = false; } else { NWCreature target = (NWCreature)Map.FindCreature(x, y); if (target != null && !target.Equals(Creature)) { Creature.AttackTo(Kind, target, Weapon, ProjectileItem); ProjectileItem.SetPos(x, y); Hit = HIT_BODY; ProjectileItem.ApplyEffects(target, InvokeMode.im_Use, null); refContinue = false; } if (refContinue) { ProjectileItem.SetPos(x, y); } } } if (space.Player.IsSeen(x, y, false)) { space.RepaintView(25); } }
public ItemQuest(NWGameSpace space, int itemID) : base(space) { ItemID = itemID; }
public Quest(NWGameSpace space) { fSpace = space; }
protected ArticulateCreature(NWGameSpace space, object owner, int creatureID, bool total, bool setName) : base(space, owner, creatureID, total, setName) { fSegments = new ExtList <ArticulateSegment>(true); }
public EnemyQuest(NWGameSpace space, int enemyID, int count) : base(space) { EnemyID = enemyID; Remains = count; }
public static void DrawLocTile(NWGameSpace space, NWField field, int px, int py, BaseScreen screen, Player player, ExtRect mapRect, ExtRect viewRect, ImageList resImages) { NWTile place = (NWTile)field.GetTile(px, py); int xx = viewRect.Left + 32 * (px - mapRect.Left); int yy = viewRect.Top + 30 * (py - mapRect.Top); if (place != null && !place.EmptyStates) { int bg = (int)place.Background; int fg = (int)place.Foreground; int bgExt = (int)place.BackgroundExt; int fgExt = (int)place.ForegroundExt; int fog = place.FogID; int fogExt = place.FogExtID; fg = PtTransDoor(place); short op = space.GetTileBrightness(field, place, false); resImages.DrawImage(screen, xx, yy, GetTileImageIndex((ushort)bg), op); if (bgExt != PlaceID.pid_Undefined) { resImages.DrawImage(screen, xx, yy, GetTileImageIndex((ushort)bgExt), op); } if (fog != PlaceID.pid_Undefined) { resImages.DrawImage(screen, xx, yy, GetTileImageIndex((ushort)fogExt), op); } else { if (fg != PlaceID.pid_Undefined) { bool trap = field.IsTrap(px, py); if (!trap || (trap && (place.Trap_Discovered || GlobalVars.Debug_Divinity))) { resImages.DrawImage(screen, xx, yy, GetTileImageIndex((ushort)fg), op); if (fgExt != PlaceID.pid_Undefined) { resImages.DrawImage(screen, xx, yy, GetTileImageIndex((ushort)fgExt), op); } } } if (fogExt != PlaceID.pid_Undefined) { resImages.DrawImage(screen, xx, yy, GetTileImageIndex((ushort)fogExt), op); } } SymbolID sid = GetBorderSymbol(px, py); if (sid != SymbolID.sid_None && player.CanMove(field, px, py)) { switch (sid) { case SymbolID.sid_Left: resImages.DrawImage(screen, xx, yy, StaticData.dbItfElements[(int)ItfElement.id_Left].ImageIndex, op); break; case SymbolID.sid_Up: resImages.DrawImage(screen, xx, yy, StaticData.dbItfElements[(int)ItfElement.id_Up].ImageIndex, op); break; case SymbolID.sid_Right: resImages.DrawImage(screen, xx, yy, StaticData.dbItfElements[(int)ItfElement.id_Right].ImageIndex, op); break; case SymbolID.sid_Down: resImages.DrawImage(screen, xx, yy, StaticData.dbItfElements[(int)ItfElement.id_Down].ImageIndex, op); break; } } } }
public Ghost(NWGameSpace space, object owner) : base(space, owner) { }