Skip to content

Commit

Permalink
Add minimap.
Browse files Browse the repository at this point in the history
Tweak texture.
Fix generation bug to do with edges.
  • Loading branch information
GoogleFrog committed Oct 12, 2021
1 parent 0a8a824 commit 2e7d793
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
21 changes: 15 additions & 6 deletions luarules/gadgets/map_terrain_generator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ local DISABLE_TERRAIN_GENERATOR = false
local RELOAD_REGEN = false

local DRAW_EDGES = false
local PRINT_TIERS = false
local PRINT_MEX_ALLOC = false
local PRINT_TIERS = false
local PRINT_CURVES = false
local SHOW_WAVEMAP = false
local TIME_MAP_GEN = false

Expand Down Expand Up @@ -751,17 +752,21 @@ end

local HIT_EDGE_CURVE = {}
for i = pi, pi*3/2 + pi/(4*POINT_COUNT), pi/(2*POINT_COUNT) do
local prop = math.min(1, (i - pi)/(pi/2 + pi/(4*POINT_COUNT)))
local prop = math.min(1, (i - pi)/(pi/2))
HIT_EDGE_CURVE[#HIT_EDGE_CURVE + 1] = {0.5 + (1 - prop)*cos(i) + prop*0.5, 1 + sin(i)}
end

local HIT_EDGE_STRAIGHT = {}
for i = pi, pi*3/2 + pi/(4*POINT_COUNT), pi/(2*POINT_COUNT) do
local prop = math.min(1, (i - pi)/(pi/2 + pi/(4*POINT_COUNT)))
local prop = math.min(1, (i - pi)/(pi/2))
HIT_EDGE_STRAIGHT[#HIT_EDGE_STRAIGHT + 1] = {0.05 + (1 - prop)*cos(i) + prop*0.95, 1 + sin(i)}
end

local STRAIGHT_EDGE_POINTS = 18
if PRINT_CURVES then
Spring.Utilities.TableEcho(CIRCLE_POINTS, "CIRCLE_POINTS")
Spring.Utilities.TableEcho(HIT_EDGE_CURVE, "HIT_EDGE_CURVE")
Spring.Utilities.TableEcho(HIT_EDGE_STRAIGHT, "HIT_EDGE_STRAIGHT")
end

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Expand Down Expand Up @@ -1794,6 +1799,10 @@ local function GetCurveHeightModifiers(tierFlood, cellTier, otherTier, heightMod
tierFlood, cellTier, otherTier, heightMod, false, curve[i], curve[i + 1],
MakeEdgeSlope, heightParams, startWidth, endWidth, startDist, endDist, otherClockwise, false, END_FLATTENING)
end
if PRINT_CURVES then
PointEcho(curve[1], "START")
PointEcho(curve[#curve], "END")
end
end

local function MakeMapBorderEdgeHit(tierFlood, cellTier, otherTier, heightMod, intPoint, edgeOut, otherOut, startWidth, endWidth, wantCurve, otherClockwise)
Expand Down Expand Up @@ -3349,7 +3358,7 @@ local function GetSpaceIncreaseParams()
spaceParams.mexLoneSize = 320
spaceParams.mexPairSize = 90
spaceParams.mexPairSizePostSize = 640
spaceParams.startMexSize = 450
spaceParams.startMexSize = 530

spaceParams.steepCliffChance = 0.82
spaceParams.bigDiffSteepCliffChance = 0.95
Expand All @@ -3364,7 +3373,7 @@ end
local function MakeMap()
local params = GetSpaceIncreaseParams()
local randomSeed = GetSeed()
--randomSeed = 4163813
--randomSeed = 4673854
math.randomseed(randomSeed)

Spring.SetGameRulesParam("typemap", "temperate2")
Expand Down
1 change: 1 addition & 0 deletions luarules/gadgets/map_texture_generator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ local function SetMapTexture(texturePool, mapTexX, mapTexZ, topTexX, topTexZ, to
Spring.SetMapShadingTexture("$minimap", texOut)
usedminimap = texOut
Spring.Echo("Applied grass and minimap textures")

gl.DeleteTextureFBO(fulltex)

if texOut and texOut ~= usedgrass and texOut ~= usedminimap then
Expand Down
1 change: 1 addition & 0 deletions mapinfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ local mapinfo = {
minheight = -105,
maxheight = 280,
smtFileName0 = "RandomBaseMap10.smt",
minimapTex = "minimap.png",
},

sound = {
Expand Down
Binary file added maps/minimap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion shaders/map_diffuse_generator.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const float vehCliff = 0.4546;
const float botCliff = 0.8065;

const float softCliffMax = hardCliffMin;
const float bandingMin = 0.14;
const float bandingMin = 0.12;
const float vehCliffMinus = 0.24;
const float vehCliffEpsilon = 0.492;
const float vehCliffPlus = 0.62;
Expand Down

0 comments on commit 2e7d793

Please sign in to comment.