public override void ModifyFarFades(float[] fades, float transitionSpeed) { StarSailorMod sm = (StarSailorMod)mod; sm.targetStarNum = numStars; sm.currentDistribution = Distribution.Atan; sm.forbiddenStarRegions = new (Vector2, int)[1];
public override bool PreDrawCloseBackground(SpriteBatch spriteBatch) { StarSailorMod sm = (StarSailorMod)mod; //return true; DrawData d = new DrawData(sm.lavaSky, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White); //GameShaders.Misc["StarShader"].Apply(d); d.Draw(spriteBatch); if (++ticker > 12) { ticker = 0; } Texture2D[] texs = { sm.lavaMid, sm.lavaBack, sm.lavaMid2 }; float[] darkens = { 0.8f, 0.6f, 0.6f }; int[] offs = { 100, 0, 270 }; float[] scales = { 1f, 0.8f, 1f }; int[] frameCounts = { 2, 1, 2 }; int[] frames = { ticker >= 6?1:0, 0, ticker >= 6 ? 1 : 0 }; spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); sm.DrawStars(spriteBatch); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.TransformationMatrix); BgHooks.DrawAnimatedBGs(spriteBatch, texs, offs, darkens, scales, frameCounts, frames); return(false); }
public override void AI(Projectile projectile) { if (projectile.hostile) { reflectionTimer = Math.Max(reflectionTimer - 1, 0); StarSailorMod sm = (StarSailorMod)mod; for (int i = 2; i < sm.barriers.Count; i++) { if (sm.barriers[i].GetHitbox().Intersects(projectile.Hitbox)) { if (sm.barriers[i].projectile.type == ModContent.ProjectileType <ShieldChargerV1V2V3Barrier>()) { projectile.timeLeft = 0; } else if (sm.barriers[i].projectile.type == ModContent.ProjectileType <ShieldChargerVMaxBarrier>() && reflectionTimer == 0 && Math.Sign(Vector2.Dot(projectile.velocity, sm.barriers[i].projectile.velocity)) == -1) { projectile.velocity = -projectile.velocity; reflectionTimer = 5; projectile.hostile = false; projectile.friendly = true; } } } } base.AI(projectile); }
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { if (Main.tile[i - 1, j].type != Type) { Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); Vector2 pixelPos = 16f * new Vector2(i, j) + zero; Vector2 screenPos = pixelPos - Main.screenPosition; StarSailorMod t = ModContent.GetInstance <StarSailorMod>(); Texture2D tex = mod.GetTexture("Tiles/EntryTeleporterField"); Texture2D baseTex = mod.GetTexture("Tiles/ExitTeleporter"); int w = (int)(0.5f * (baseTex.Width - 18)) - 18; Color c = Color.Cyan; for (int p = 0; p < 256; p++) { for (int f = 0; f < w + 1; f++) { int offset = -6; float alpha = ((float)(w - f) / w) * (3f * (256 - p) / 1024f); spriteBatch.Draw(tex, screenPos + (0.5f * new Vector2(baseTex.Width, 0)) + new Vector2(-f + offset, -p), c * alpha); spriteBatch.Draw(tex, screenPos + (0.5f * new Vector2(baseTex.Width, 0)) + new Vector2(1 + f + offset, -p), c * alpha); } } } return(base.PreDraw(i, j, spriteBatch)); }
public override bool PreDrawCloseBackground(SpriteBatch spriteBatch) { StarSailorMod sm = (StarSailorMod)mod; //return true; DrawData d = new DrawData(sm.overworldSky, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * 0.8f); //GameShaders.Misc["StarShader"].Apply(d); d.Draw(spriteBatch); Texture2D[] texs = { sm.desertTownFront, sm.desertTownMid, sm.desertTownFar }; float[] darkens = { 0.8f, 0.8f, 0.8f }; int[] offs = { 75, -175, 1000 }; float[] scales = { 1f, 1f, 1f }; spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); //GameShaders.Misc["StarShader"].Apply(); spriteBatch.Draw(sm.sun0a, new Rectangle(Main.screenWidth * 5 / 16, 165, 160, 160), Color.White); sm.DrawStars(spriteBatch); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.TransformationMatrix); BgHooks.DrawBGs(spriteBatch, texs, offs, darkens, scales); return(false); }
public void Execute() { Enabled = true; StarSailorMod mod = ModContent.GetInstance <StarSailorMod>(); queue.Execute(); }
public static void DrawBox(SpriteBatch sb, Rectangle rect, Color col, float alpha) { StarSailorMod sm = ModContent.GetInstance <StarSailorMod>(); Texture2D corner = sm.corner; int xPos = rect.X; int yPos = rect.Y; int width = rect.Width; int height = rect.Height; sb.Draw(corner, new Rectangle(xPos, yPos, corner.Width, corner.Height), col * alpha); sb.Draw(corner, new Rectangle(xPos + width, yPos, corner.Width, corner.Height), null, col * alpha, (float)Math.PI / 2f, new Vector2(0, 0), SpriteEffects.None, 0); sb.Draw(corner, new Rectangle(xPos + width, yPos + height, corner.Width, corner.Height), null, col * alpha, (float)Math.PI, new Vector2(0, 0), SpriteEffects.None, 0); sb.Draw(corner, new Rectangle(xPos, yPos + height, corner.Width, corner.Height), null, col * alpha, 3 * (float)Math.PI / 2f, new Vector2(0, 0), SpriteEffects.None, 0); sb.Draw(corner, new Rectangle(xPos + corner.Width, yPos + corner.Height, width - (2 * corner.Width), height - (2 * corner.Height)), new Rectangle(corner.Width - 1, corner.Height - 1, 1, 1), col * alpha); for (int i = 0; i < width - (2 * corner.Width); i++) { sb.Draw(corner, new Rectangle(xPos + corner.Width + i, yPos, 1, corner.Height), new Rectangle(corner.Width - 1, 0, 1, corner.Height), col * alpha); sb.Draw(corner, new Rectangle(1 + xPos + corner.Width + i, yPos + height, 1, corner.Height), new Rectangle(corner.Width - 1, 0, 1, corner.Height), col * alpha, (float)Math.PI, new Vector2(0, 0), SpriteEffects.None, 0); } for (int i = 0; i < height - (2 * corner.Height); i++) { sb.Draw(corner, new Rectangle(xPos, yPos + corner.Height + i, corner.Width, 1), new Rectangle(0, corner.Height - 1, corner.Width, 1), col * alpha); sb.Draw(corner, new Rectangle(xPos + width, 1 + yPos + corner.Height + i, corner.Width, 1), new Rectangle(0, corner.Height - 1, corner.Width, 1), col * alpha, (float)Math.PI, new Vector2(0, 0), SpriteEffects.None, 0); } }
public bool WithinDistance() { StarSailorMod sm = (StarSailorMod)mod; Vector2 disp = npc.Center - Main.LocalPlayer.Center; return(Math.Abs(disp.X) < 320 && Math.Abs(disp.Y) < 80); }
public override void ModifyFarFades(float[] fades, float transitionSpeed) { StarSailorMod sm = (StarSailorMod)mod; sm.targetStarNum = numStars; sm.currentDistribution = Distribution.Atan; for (int i = 0; i < fades.Length; i++) { if (i == Slot) { fades[i] += transitionSpeed; if (fades[i] > 1f) { fades[i] = 1f; } } else { fades[i] -= transitionSpeed; if (fades[i] < 0f) { fades[i] = 0f; } } } }
public void Update(Vector2 position) { StarSailorMod sm = ModContent.GetInstance <StarSailorMod>(); float height = 0f; float maxWidth = 0; for (int i = 0; i < lines.Length; i++) { Vector2 mea = font.MeasureString(lines[i]) * hoverScale; maxWidth = Math.Max(mea.X, maxWidth); height += mea.Y; } Rectangle mouseRect = new Rectangle(Mouse.GetState().X, Mouse.GetState().Y, 1, 1); Rectangle boundingBox = new Rectangle((int)position.X, (int)position.Y, (int)maxWidth, (int)height); if (mouseRect.Intersects(boundingBox)) { HoverUpdate(true); if (sm.newMouseState.LeftButton == ButtonState.Pressed && sm.oldMouseState.LeftButton == ButtonState.Released) { sm.speechBubbles.Clear(); result.Execute(); } } else { HoverUpdate(false); } }
public void Update() { //Don't update here bcos it will be updated by the mod StarSailorMod mod = ModContent.GetInstance <StarSailorMod>(); if (!mod.sequence.GetActive()) { Enabled = false; } }
public bool CanRightClick() { StarSailorMod sm = (StarSailorMod)mod; Rectangle mouseRect = new Rectangle((int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, 1, 1); Rectangle npcRect = npc.getRect(); Rectangle clicktangle = new Rectangle(npcRect.X - 6, npcRect.Y - 6, npcRect.Width + 12, npcRect.Height + 12); //Main.NewText("checkingrc " + mouseRect.Intersects(clicktangle) +" " + WithinDistance() +" "+ !Main.ingameOptionsWindow + " " + !sm.sequence.GetActive()); return(mouseRect.Intersects(clicktangle) && WithinDistance() && !Main.ingameOptionsWindow && !sm.sequence.GetActive()); }
public override void ModifyFarFades(float[] fades, float transitionSpeed) { StarSailorMod sm = (StarSailorMod)mod; sm.targetStarNum = numStars; sm.currentDistribution = Distribution.Flat; //spriteBatch.Draw(sm.sun1, new Rectangle(Main.screenWidth * 3 / 16, Main.screenHeight * 2 / 19, 400, 400), Color.White); //spriteBatch.Draw(sm.asteroidBeltPlanet, new Rectangle(Main.screenWidth * 10 / 16, Main.screenHeight * 7 / 19, sm.asteroidBeltPlanet.Width, sm.asteroidBeltPlanet.Height), Color.White); //spriteBatch.Draw(sm.asteroidBeltMoon, new Rectangle(Main.screenWidth * 9 / 16, Main.screenHeight * 5 / 19, sm.asteroidBeltMoon.Width, sm.asteroidBeltMoon.Height), Color.White); sm.forbiddenStarRegions = new (Vector2, int)[3];
public override bool PreDrawCloseBackground(SpriteBatch spriteBatch) { StarSailorMod sm = (StarSailorMod)mod; sm.stars.Clear(); Texture2D[] texs = { sm.desTreeCaveMid3, sm.desTreeCaveMid2, sm.desTreeCaveFront, sm.desTreeCaveMid, sm.desTreeCaveBack }; float[] darkens = { 1, 1, 0.8f, 0.5f, 0.3f }; int[] offs = { -300, -250, -150, -250, 0 }; float[] scales = { 1.5f, 1.5f, 1.3f, 1.5f, 1.3f }; BgHooks.DrawBGs(spriteBatch, texs, offs, darkens, scales); return(false); }
public void Update() { PlayerFixer pf = Main.LocalPlayer.GetModPlayer <PlayerFixer>(); bool canPurchase = pf.CanPurchase(item.cost); StarSailorMod sm = ModContent.GetInstance <StarSailorMod>(); if (intersect && Main.hasFocus && sm.newMouseState.LeftButton == ButtonState.Pressed && sm.oldMouseState.LeftButton == ButtonState.Released && canPurchase) { Item.NewItem(Main.LocalPlayer.position, item.itemID); pf.ChargeCoins(item.cost); } }
public void Update() { PlayerFixer pf = Main.LocalPlayer.GetModPlayer <PlayerFixer>(); StarSailorMod sm = ModContent.GetInstance <StarSailorMod>(); bool canPurchase = pf.CanPurchase(quantity * item.cost); if (intersect && Main.hasFocus && sm.newMouseState.LeftButton == ButtonState.Pressed && sm.oldMouseState.LeftButton == ButtonState.Released && canPurchase) { //int[] ammoIDS = { ModContent.ItemType<NinemmRound>(), ModContent.ItemType<FiveFivemmRound>(), ModContent.ItemType<RocketItem>(), ModContent.ItemType<MeteorBombItem>(), ModContent.ItemType<ShotgunShell>() }; Item.NewItem(Main.LocalPlayer.position, item.itemID, quantity); pf.ChargeCoins(quantity * item.cost); } }
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { if (Main.tile[i - 1, j].type != Type) { Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); Vector2 pixelPos = 16f * new Vector2(i, j) + zero; Vector2 screenPos = pixelPos - Main.screenPosition; StarSailorMod t = ModContent.GetInstance <StarSailorMod>(); Texture2D tex = mod.GetTexture("Tiles/EntryTeleporterField"); Texture2D baseTex = mod.GetTexture("Tiles/EntryTeleporter"); int w = 18; Color c; switch (ModContent.GetInstance <ArenaManager>().currentState) { case ArenaState.SelLevel1: c = Color.LawnGreen; DrawIndicator(1, spriteBatch, baseTex, screenPos); break; case ArenaState.SelLevel2: c = Color.Turquoise; DrawIndicator(2, spriteBatch, baseTex, screenPos); break; case ArenaState.SelLevel3: c = Color.CadetBlue; DrawIndicator(3, spriteBatch, baseTex, screenPos); break; case ArenaState.NoneSelected: c = Color.IndianRed; break; default: c = Color.SlateGray; break; } for (int p = 0; p < 64; p++) { for (int f = 0; f < w + 1; f++) { int offset = -4; float alpha = ((float)(w - f) / w) * (3f * (64 - p) / 256f); spriteBatch.Draw(tex, screenPos + (0.5f * new Vector2(baseTex.Width, 0)) + new Vector2(-f + offset, -p), c * alpha); spriteBatch.Draw(tex, screenPos + (0.5f * new Vector2(baseTex.Width, 0)) + new Vector2(1 + f + offset, -p), c * alpha); } } } return(base.PreDraw(i, j, spriteBatch)); }
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { if (Framing.GetTileSafely(i, j - 1).type != Type && Main.player[Main.myPlayer].mount.Type != ModContent.GetInstance <Boat>().Type) { Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); Vector2 pixelPos = 16f * new Vector2(i, j) + zero; Vector2 screenPos = pixelPos - Main.screenPosition; Vector2 boatPos = new Vector2((int)screenPos.X - 140, (int)screenPos.Y + 46 + disp); StarSailorMod t = ModContent.GetInstance <StarSailorMod>(); GuiHelpers.DrawLine(spriteBatch, screenPos + new Vector2(10, 10), boatPos + new Vector2(t.boatTex.Width - 10, 20), t.ropeTex.Height, Color.White, t.ropeTex); spriteBatch.Draw(t.boatTex, new Rectangle((int)boatPos.X, (int)boatPos.Y, t.boatTex.Width, t.boatTex.Height), Color.White); } return(base.PreDraw(i, j, spriteBatch)); }
public void UpdateForbiddenRegions() { StarSailorMod sm = (StarSailorMod)mod; List <(Vector2, int)> frs = new List <(Vector2, int)>(); switch (origin) { case Dimensions.Dimensions.Overworld: frs.Add((originLoc + new Vector2(sm.mainAbove.Width / 2, sm.mainAbove.Height / 2), 243)); break; case Dimensions.Dimensions.Ice: frs.Add((originLoc + new Vector2(sm.iceAbove.Width / 2, sm.iceAbove.Height / 2), 318)); break; case Dimensions.Dimensions.Asteroid: frs.Add((originLoc + new Vector2(228, 196), 124)); frs.Add((originLoc + new Vector2(70, 100), 40)); break; case Dimensions.Dimensions.Jungle: frs.Add((originLoc + new Vector2(sm.jungAbove.Width / 2, sm.jungAbove.Height / 2), 286)); break; } switch (destination) { case Dimensions.Dimensions.Overworld: frs.Add((destinationLoc + new Vector2(sm.mainAbove.Width / 2, sm.mainAbove.Height / 2), 243)); break; case Dimensions.Dimensions.Ice: frs.Add((destinationLoc + new Vector2(sm.iceAbove.Width / 2, sm.iceAbove.Height / 2), 318)); break; case Dimensions.Dimensions.Asteroid: frs.Add((destinationLoc + new Vector2(228, 196), 124)); frs.Add((destinationLoc + new Vector2(70, 100), 40)); break; case Dimensions.Dimensions.Jungle: frs.Add((destinationLoc + new Vector2(sm.jungAbove.Width / 2, sm.jungAbove.Height / 2), 286)); break; } sm.forbiddenStarRegions = frs.ToArray(); }
public override bool PreDrawCloseBackground(SpriteBatch spriteBatch) { StarSailorMod sm = (StarSailorMod)mod; //return true; DrawData d = new DrawData(sm.pixel, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black); d.Draw(spriteBatch); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); //spriteBatch.Draw(sm.sun0, new Rectangle(Main.screenWidth * 11 / 16, 165, 160, 160), Color.White); sm.DrawStars(spriteBatch, (int)velocity, ((StarSailorMod)mod).forbiddenStarRegions); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.TransformationMatrix); return(false); }
public override bool PreDrawCloseBackground(SpriteBatch spriteBatch) { StarSailorMod sm = (StarSailorMod)mod; //return true; //DrawData d = new DrawData(sm.overworldSky, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * 0.8f); //GameShaders.Misc["StarShader"].Apply(d); //d.Draw(spriteBatch); Texture2D[] texs = { sm.jungleNear, sm.jungleNear, sm.jungleMid, sm.jungleMid, sm.jungleFar }; float[] darkens = { 1f, 1f, 1f, 1f, 1f }; int[] offs = { 100, 75, 0, -25, 50 }; float[] scales = { 1f, 1f, 1f, 1f, 1f }; //spriteBatch.Draw(texs[0], new Rectangle(0, 0, 1024, 1024), Color.White); BgHooks.DrawBGs(spriteBatch, texs, offs, darkens, scales); return(false); }