void GameOverLogic() { if (World == null || !World.GameOver || World.MapEditor) { return; } float dist = (World.DragonLordDeathPos - World.GameOverPos).Length(); float PanTime = CoreMath.LerpRestrict(0, .5f, 1.35f, 2, dist); if (T - World.GameOverTime < PanTime) { DeltaT *= .03f; World.Markers.Hide = true; } else if (T - World.GameOverTime < PanTime + 1.25) { DeltaT *= .35f; if (!World.End_PlayedDeathGroan && T - World.GameOverTime > PanTime + 0.0) { Sounds.DyingDragonLord.MaybePlay(); World.End_PlayedDeathGroan = true; } } else { World.Markers.Hide = false; if (!World.End_PlayedDeathExplosion) { Sounds.EndOfGameDyingDragonLord.MaybePlay(); World.End_PlayedDeathExplosion = true; } } GameInputEnabled = false; float s = (float)Math.Min(1, (T - World.GameOverTime) / PanTime); World.CameraPos = s * World.DragonLordDeathPos + (1 - s) * World.GameOverPos; World.CameraZoom = CoreMath.LogLerpRestrict((float)World.GameOverTime, World.GameOverZoom, (float)World.GameOverTime + 1.25f, 100, (float)T); }
void DrawDragonLordMarker(int player, bool After = false) { if (!TrackDragonLord) { return; } vec2 cur = CurDragonLordPos[player]; vec2 prev = PrevDragonLordPos[player]; if (cur.x < 1 && cur.y < 1) { return; } var q = new RectangleQuad(); var p = cur * PercentSimStepComplete + prev * (1 - PercentSimStepComplete); p = GridToWorldCood(p); var s = vec(.01f, .01f) + .0001f * vec2.Ones * (float)Math.Cos(GameClass.Game.DrawCount * .08f); float alpha = 1; bool selected = DataGroup.UnitSummary[Int(UnitType.DragonLord) - 1]; if (!After) { alpha = selected ? .11f : .05f; color clr = selected ? new color(1f, 1f, 1f, alpha) : new color(.8f, .8f, .8f, alpha); q.SetupVertices(p - s * 3, p + s * 3, vec(0, 0), vec(1, 1)); q.SetColor(clr); DrawTexture.Using(camvec, CameraAspect, Assets.DragonLord_Marker); q.Draw(GameClass.Game.GraphicsDevice); q.SetupVertices(p - s * .5f, p + s * .5f, vec(0, 0), vec(1, 1)); q.SetColor(clr); DrawTexture.Using(camvec, CameraAspect, Assets.DragonLord_Marker); q.Draw(GameClass.Game.GraphicsDevice); } if (After) { float z = 14; if (CameraZoom <= z / 4f) { s *= 7; alpha = CoreMath.LerpRestrict(z / 4, 0, z / 8, 1, CameraZoom); } else { return; } q.SetupVertices(p - s, p + s, vec(0, 0), vec(1, 1)); q.SetColor(new color(.8f, .8f, .8f, 1f * alpha)); var texture = Assets.AoE_DragonLord[player]; if (player == MyPlayerNumber && selected) { texture = Assets.AoE_DragonLord_Selected; } DrawTexture.Using(camvec, CameraAspect, texture); q.Draw(GameClass.Game.GraphicsDevice); } }
void DrawGrids() { // Draw texture to screen //GameClass.Graphics.SetRenderTarget(null); GameClass.Graphics.Clear(Color.Black); if (MapEditorActive) { PercentSimStepComplete = .9f; } else { PercentSimStepComplete = (float)(SecondsSinceLastUpdate / DelayBetweenUpdates); } float z = 14; // Draw parts of the world outside the playable map float tiles_solid_blend = CoreMath.LogLerpRestrict(1f, 0, 5f, 1, CameraZoom); bool tiles_solid_blend_flag = tiles_solid_blend < 1; if (x_edge > 1 || y_edge > 1) { DrawOutsideTiles.Using(camvec, CameraAspect, DataGroup.Tiles, TileSprite, tiles_solid_blend_flag, tiles_solid_blend); OutsideTiles.SetupVertices(vec(-2.5f, -2f), vec(2.5f, 2), vec(0, 0), vec(-5 / 2, 2 / 1)); OutsideTiles.Draw(GameClass.Graphics); } // The the map tiles DrawTiles.Using(camvec, CameraAspect, DataGroup.Tiles, TileSprite, MapEditorActive && DrawGridLines, tiles_solid_blend_flag, tiles_solid_blend); GridHelper.DrawGrid(); //DrawGeoInfo.Using(camvec, CameraAspect, DataGroup.Geo, Assets.DebugTexture_Arrows); GridHelper.DrawGrid(); //DrawGeoInfo.Using(camvec, CameraAspect, DataGroup.AntiGeo, Assets.DebugTexture_Arrows); GridHelper.DrawGrid(); //DrawDirwardInfo.Using(camvec, CameraAspect, DataGroup.Dirward[Dir.Right], Assets.DebugTexture_Arrows); GridHelper.DrawGrid(); //DrawPolarInfo.Using(camvec, CameraAspect, DataGroup.Geo, DataGroup.GeoInfo, Assets.DebugTexture_Num); GridHelper.DrawGrid(); // Territory and corpses if ((CurUserMode == UserMode.PlaceBuilding || CurUserMode == UserMode.CastSpell && CurSpell.Info.TerritoryRange < float.MaxValue) && !MapEditorActive) { float cutoff = _0; if (CurUserMode == UserMode.PlaceBuilding) { cutoff = DrawTerritoryPlayer.TerritoryCutoff; } else if (CurUserMode == UserMode.CastSpell) { cutoff = CurSpell.Info.TerritoryRange; } DrawTerritoryPlayer.Using(camvec, CameraAspect, DataGroup.DistanceToPlayers, MyPlayerValue, cutoff); GridHelper.DrawGrid(); } else { if (CameraZoom <= z / 4) { float territory_blend = CoreMath.LerpRestrict(z / 4, 0, z / 8, 1, CameraZoom); DrawTerritoryColors.Using(camvec, CameraAspect, DataGroup.DistanceToPlayers, territory_blend); GridHelper.DrawGrid(); } if (CameraZoom >= z / 8) { float corpse_blend = .35f * CoreMath.LerpRestrict(z / 2, 1, z / 16, 0, CameraZoom); DrawCorpses.Using(camvec, CameraAspect, DataGroup.Corpses, UnitsSprite, corpse_blend); GridHelper.DrawGrid(); } } // Dragon Lord marker, before DrawDragonLordMarker(After: false); // Units if (CameraZoom > z / 8) { float second = (DrawCount % 60) / 60f; float selection_blend = CoreMath.LogLerpRestrict(60.0f, 1, 1.25f, 0, CameraZoom); float selection_size = CoreMath.LogLerpRestrict(6.0f, .6f, z / 4, 0, CameraZoom); float solid_blend = CoreMath.LogLerpRestrict(z / 7, 0, z / 2, 1, CameraZoom); bool solid_blend_flag = solid_blend < 1; DrawUnits.Using(camvec, CameraAspect, DataGroup.CurrentData, DataGroup.PreviousData, DataGroup.CurrentUnits, DataGroup.PreviousUnits, UnitsSprite, Assets.ShadowTexture, MyPlayerValue, PercentSimStepComplete, second, selection_blend, selection_size, solid_blend_flag, solid_blend); } else { DrawUnitsZoomedOutBlur.Using(camvec, CameraAspect, DataGroup.CurrentData, DataGroup.CurrentUnits, MyPlayerValue); } GridHelper.DrawGrid(); // Buildings DrawBuildings.Using(camvec, CameraAspect, DataGroup.CurrentData, DataGroup.CurrentUnits, BuildingsSprite, ExsplosionSprite, MyPlayerValue, PercentSimStepComplete); GridHelper.DrawGrid(); // Markers Markers.Update(); Markers.Draw(DrawOrder.AfterTiles); // Antimagic if (CurUserMode == UserMode.CastSpell) { DrawAntiMagic.Using(camvec, CameraAspect, DataGroup.AntiMagic, MyTeamValue); GridHelper.DrawGrid(); } // Markers Markers.Draw(DrawOrder.AfterUnits); // Building icons if (CameraZoom <= z / 4) { float blend = CoreMath.LogLerpRestrict(z / 4, 0, z / 8, 1, CameraZoom); float radius = 5.5f / CameraZoom; DrawBuildingsIcons.Using(camvec, CameraAspect, DataGroup.DistanceToBuildings, DataGroup.CurrentData, DataGroup.CurrentUnits, blend, radius, MyPlayerValue); GridHelper.DrawGrid(); } // Dragon Lord marker, after DrawDragonLordMarker(After: true); }