private static SearchResult SearchMapLocation(int aX, int aY) { aX -= 8; aY -= 8; int num = GlobalVars.nwrGame.LayersCount; for (int idx = 0; idx < num; idx++) { NWLayer layer = GlobalVars.nwrGame.GetLayer(idx); LayerEntry layerEntry = layer.Entry; ExtRect rt = ExtRect.Create(layerEntry.MSX, layerEntry.MSY, layerEntry.MSX + (layerEntry.W << 5), layerEntry.MSY + layerEntry.H * 30); if (rt.Contains(aX, aY)) { int xx = (aX - layerEntry.MSX) / 32; int yy = (aY - layerEntry.MSY) / 30; NWField fld = layer.GetField(xx, yy); if (fld != null) { SearchResult result = new SearchResult(); result.LID = layerEntry.GUID; result.FieldX = xx; result.FieldY = yy; return(result); } } } return(null); }
protected override void DoPaintEvent(BaseScreen screen) { base.DoPaintEvent(screen); int ax = 8; int ay = 8; screen.DrawImage(ax, ay, 0, 0, (int)fImage.Width, (int)fImage.Height, fImage, 255); screen.Font = CtlCommon.BgFont; screen.DrawText(ax + 40, ay + 25, BaseLocale.GetStr(RS.rs_WorldsTree), 0); screen.Font = CtlCommon.SmFont; int num = GlobalVars.nwrGame.LayersCount; for (int i = 0; i < num; i++) { NWLayer layer = GlobalVars.nwrGame.GetLayer(i); LayerEntry lre = layer.Entry; for (int y = 0; y < layer.H; y++) { for (int x = 0; x < layer.W; x++) { if (layer.GetField(x, y).Visited) { GlobalVars.nwrWin.Resources.DrawImage(screen, ax + lre.MSX + (x << 5), ay + lre.MSY + y * 30, lre.IconsIndex + (y * lre.W + x), 255); } } } } Player player = GlobalVars.nwrGame.Player; LayerEntry layerEntry = ((LayerEntry)GlobalVars.nwrDB.GetEntry(player.LayerID)); if (fMapCursor) { NWField fld = (NWField)player.CurrentMap; ExtPoint f = fld.Coords; GlobalVars.nwrWin.Resources.DrawImage(screen, ax + layerEntry.MSX + (f.X << 5), ay + layerEntry.MSY + f.Y * 30, StaticData.dbItfElements[(int)ItfElement.id_Cursor].ImageIndex, 255); } if (fMapHint.CompareTo("") != 0) { int tw = CtlCommon.SmFont.GetTextWidth(fMapHint); CtlCommon.SmFont.Color = Colors.Navy; //screen.drawText(ax + 304 + ((288 - tw) / 2), ay + 410, this.fMapHint, 0); screen.DrawText(ax + 58 + ((582 - tw) / 2), ay + 445, fMapHint, 0); } }
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); } }