share/hedgewars/Data/Maps/ClimbHome/map.lua
changeset 13686 3651c63f3c84
parent 13664 85506d95977d
child 13750 110d6c1e817f
equal deleted inserted replaced
13685:09ea1faf97ca 13686:3651c63f3c84
   270     --    end
   270     --    end
   271     --    BoomFire = nil
   271     --    BoomFire = nil
   272     --end
   272     --end
   273 
   273 
   274     for s,i in pairs(Stars) do
   274     for s,i in pairs(Stars) do
   275         g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(s)
   275         local _, Y = GetVisualGearValues(s)
   276         if g1 > WaterLine + 500 then
   276         if Y ~= nil and Y > WaterLine + 500 then
   277             DeleteVisualGear(s)
   277             DeleteVisualGear(s)
   278             Stars[s] = nil
   278             Stars[s] = nil
   279         end
   279         elseif Y == nil then
   280         --else  wasn't really visible, pointless.
   280             Stars[s] = nil
   281         --    g5 = g5+1
   281         end
   282         --    if g5 > 360 then g5 = 0 end
       
   283         --    SetVisualGearValues(s, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10)
       
   284         --end
       
   285     end
   282     end
   286 
   283 
   287     -- This will be executed if a player reached home in multiplayer
   284     -- This will be executed if a player reached home in multiplayer
   288     if multiplayerVictoryDelay > 0 then
   285     if multiplayerVictoryDelay > 0 then
   289         multiplayerVictoryDelay = multiplayerVictoryDelay - 20
   286         multiplayerVictoryDelay = multiplayerVictoryDelay - 20
   358             else
   355             else
   359                 SetWaterLine(WaterLine-baseWaterSpeed)
   356                 SetWaterLine(WaterLine-baseWaterSpeed)
   360             end
   357             end
   361         end
   358         end
   362         if y > 0 and y < 30000 and MaxHeight > 286 and math.random(y) < 500 then
   359         if y > 0 and y < 30000 and MaxHeight > 286 and math.random(y) < 500 then
   363             local s = AddVisualGear(0, 0, vgtStraightShot, 0, true)
   360             local s = AddVisualGear(0, 0, vgtStraightShot, 0, false)
   364             local c = div(250000,y)
   361             if s then
   365             if c > 255 then c = 255 end
   362                 local c = div(250000,y)
   366             c = c * 0x10000 + 0xFF0000FF
   363                 if c > 255 then c = 255 end
   367             SetVisualGearValues(s,
   364                 c = c * 0x10000 + 0xFF0000FF
   368                 math.random(2048), -5000, 0, -1-(1/y*1000), 
   365                 SetVisualGearValues(s,
   369                 math.random(360),
   366                     math.random(2048), -5000, 0, -1-(1/y*1000),
   370                 0,
   367                     math.random(360),
   371                 999999999, -- frameticks
   368                     0,
   372                 sprStar, -- star
   369                     999999999, -- frameticks
   373                 0, c)
   370                     sprStar, -- star
   374                 --,  0xFFCC00FF) -- could be fun to make colour shift as you rise...
   371                     0, c)
   375             Stars[s] = 1
   372                     --,  0xFFCC00FF) -- could be fun to make colour shift as you rise...
       
   373                 Stars[s] = 1
       
   374             end
   376         end
   375         end
   377 
   376 
   378         local vx, vy = GetGearVelocity(CurrentHedgehog)
   377         local vx, vy = GetGearVelocity(CurrentHedgehog)
   379         local distanceFromWater = WaterLine - y
   378         local distanceFromWater = WaterLine - y
   380 	
   379 	
   535                 -- New maximum height of this turn?
   534                 -- New maximum height of this turn?
   536                 if MaxHeight < hTagHeight then
   535                 if MaxHeight < hTagHeight then
   537                     hTagHeight = MaxHeight
   536                     hTagHeight = MaxHeight
   538                     if hTag ~= nil then DeleteVisualGear(hTag) end
   537                     if hTag ~= nil then DeleteVisualGear(hTag) end
   539                     hTag = AddVisualGear(0, 0, vgtHealthTag, 0, true)
   538                     hTag = AddVisualGear(0, 0, vgtHealthTag, 0, true)
   540                     local g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(hTag)
       
   541                     local score = 32640-hTagHeight
   539                     local score = 32640-hTagHeight
   542                     -- snagged from space invasion
   540                     -- snagged from space invasion
   543                     SetVisualGearValues (
   541                     SetVisualGearValues (
   544                             hTag,        --id
   542                             hTag,        --id
   545                             -(ScreenWidth/2) + 40, --xoffset
   543                             -(ScreenWidth/2) + 40, --xoffset
   546                             ScreenHeight - 60, --yoffset
   544                             ScreenHeight - 60, --yoffset
   547                             0,          --dx
   545                             0,          --dx
   548                             0,          --dy
   546                             0,          --dy
   549                             1.1,        --zoom
   547                             1.1,        --zoom
   550                             1,          --~= 0 means align to screen
   548                             1,          --~= 0 means align to screen
   551                             g7,         --frameticks
   549                             nil,        --frameticks
   552             -- 116px off bottom for lowest rock, 286 or so off top for position of chair
   550             -- 116px off bottom for lowest rock, 286 or so off top for position of chair
   553             -- 32650 is "0"
   551             -- 32650 is "0"
   554                             score,    --value
   552                             score,    --value
   555                             99999999999,--timer
   553                             99999999999,--timer
   556                             GetClanColor(GetHogClan(CurrentHedgehog))
   554                             GetClanColor(GetHogClan(CurrentHedgehog))
   570                         AddCaption(string.format(loc("%s has passed the best height of %s!"), RecordHeightHogName, oldName))
   568                         AddCaption(string.format(loc("%s has passed the best height of %s!"), RecordHeightHogName, oldName))
   571                     end
   569                     end
   572                     if not isSinglePlayer then
   570                     if not isSinglePlayer then
   573                         if rTag ~= nil then DeleteVisualGear(rTag) end
   571                         if rTag ~= nil then DeleteVisualGear(rTag) end
   574                         rTag = AddVisualGear(0, 0, vgtHealthTag, 0, true)
   572                         rTag = AddVisualGear(0, 0, vgtHealthTag, 0, true)
   575                         local g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(hTag)
       
   576                         -- snagged from space invasion
   573                         -- snagged from space invasion
   577                         SetVisualGearValues (
   574                         SetVisualGearValues (
   578                             rTag,        --id
   575                             rTag,        --id
   579                             -(ScreenWidth/2) + 100, --xoffset
   576                             -(ScreenWidth/2) + 100, --xoffset
   580                             ScreenHeight - 60, --yoffset
   577                             ScreenHeight - 60, --yoffset
   581                             0,          --dx
   578                             0,          --dx
   582                             0,          --dy
   579                             0,          --dy
   583                             1.1,        --zoom
   580                             1.1,        --zoom
   584                             1,          --~= 0 means align to screen
   581                             1,          --~= 0 means align to screen
   585                             g7,         --frameticks
   582                             nil,        --frameticks
   586             -- 116px off bottom for lowest rock, 286 or so off top for position of chair
   583             -- 116px off bottom for lowest rock, 286 or so off top for position of chair
   587             -- 32650 is "0"
   584             -- 32650 is "0"
   588                             getActualHeight(RecordHeight),    --value
   585                             getActualHeight(RecordHeight),    --value
   589                             99999999999,--timer
   586                             99999999999,--timer
   590                             GetClanColor(GetHogClan(CurrentHedgehog))
   587                             GetClanColor(GetHogClan(CurrentHedgehog))
   593                 end
   590                 end
   594             end
   591             end
   595             if MaxHeight > 286 then
   592             if MaxHeight > 286 then
   596                 if tTag ~= nil then DeleteVisualGear(tTag) end
   593                 if tTag ~= nil then DeleteVisualGear(tTag) end
   597                 tTag = AddVisualGear(0, 0, vgtHealthTag, 0, true)
   594                 tTag = AddVisualGear(0, 0, vgtHealthTag, 0, true)
   598                 local g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tTag)
       
   599                 -- snagged from space invasion
   595                 -- snagged from space invasion
   600                 SetVisualGearValues (
   596                 SetVisualGearValues (
   601                     tTag,        --id
   597                     tTag,        --id
   602                     -(ScreenWidth/2) + 40, --xoffset
   598                     -(ScreenWidth/2) + 40, --xoffset
   603                     ScreenHeight - 100, --yoffset
   599                     ScreenHeight - 100, --yoffset
   604                     0,          --dx
   600                     0,          --dx
   605                     0,          --dy
   601                     0,          --dy
   606                     1.1,        --zoom
   602                     1.1,        --zoom
   607                     1,          --~= 0 means align to screen
   603                     1,          --~= 0 means align to screen
   608                     g7,         --frameticks
   604                     nil,        --frameticks
   609                     (GameTime-startTime)/1000,    --value
   605                     (GameTime-startTime)/1000,    --value
   610                     99999999999,--timer
   606                     99999999999,--timer
   611                     0xffffffff
   607                     0xffffffff
   612                     )
   608                     )
   613             end
   609             end