internal void _drawEntityOnScreen(GEntity t) { int sx = t.iX, sy = t.iY; t.X = 0; t.Y = 0; GBitmap g = new GBitmap(GTile.WIDTH, GTile.HEIGHT); t.Render(g); t.X = sx; t.Y = sy; g.ScreenWidth = (int)(DisplayWidth - sx + _tileOffsetX * GTile.HEIGHT); g.ScreenHeight = (int)(DisplayHeight - sy + _tileOffsetY * GTile.WIDTH); if (g.ScreenWidth > GTile.WIDTH) { g.ScreenWidth = GTile.WIDTH; } if (g.ScreenHeight > GTile.HEIGHT) { g.ScreenHeight = GTile.HEIGHT; } int x = sx + OffsetX - _tileOffsetX * GTile.WIDTH; int y = sy + OffsetY - _tileOffsetY * GTile.HEIGHT; if (g.ScreenHeight < 0 || g.ScreenWidth < 0 || x < OffsetX || y < OffsetY) { return; } Screen.Blit(g.GetClippedImage(), x, y); }
internal void _setTopTile(int x, int y, GEntity tile) { Entities[y * LevelWidth + x] = null; Tiles[y * LevelWidth + x] = tile; tile.Render(_background); _drawEntityOnScreen(tile); _miniMap.Set(tile); }
internal void _setTile(int x, int y, GEntity tile) { Tiles[y * LevelWidth + x] = tile; if (Entities[y * LevelWidth + x] == null) { tile.Render(_background); _miniMap.Set(tile); } }
internal void _setTopEntity(int x, int y, GEntity entity) { if (entity == null) { Entities[y * LevelWidth + x] = null; _getTile(x, y).Render(_background); _miniMap.Set(_getTile(x, y)); return; } if (entity.GetType() == typeof(Flag) || entity.GetType() == typeof(Spawner)) { GEntity t = Tiles[y * LevelWidth + x]; t.Render(_background); t.X += OffsetX - _tileOffsetX * GTile.WIDTH; t.Y += OffsetY - _tileOffsetY * GTile.HEIGHT; t.Render(Screen); t.X -= OffsetX - _tileOffsetX * GTile.WIDTH; t.Y -= OffsetY - _tileOffsetY * GTile.HEIGHT; } Entities[y * LevelWidth + x] = entity; entity.Render(_background); _miniMap.Set(entity); }