share/hedgewars/Data/Maps/ClimbHome/map.lua
changeset 15507 ad9fe7dc2ff7
parent 15506 5a30396f8fb2
equal deleted inserted replaced
15506:5a30396f8fb2 15507:ad9fe7dc2ff7
     9 local startTime = 0
     9 local startTime = 0
    10 local MaxHeight = 32640
    10 local MaxHeight = 32640
    11 local RecordHeight = 33000
    11 local RecordHeight = 33000
    12 local RecordHeightHogName = nil
    12 local RecordHeightHogName = nil
    13 local Fire = {}
    13 local Fire = {}
    14 --local BoomFire = nil
       
    15 local HH = {}
    14 local HH = {}
    16 local totalHedgehogs = 0
    15 local totalHedgehogs = 0
    17 local deadHedgehogs = 0
    16 local deadHedgehogs = 0
    18 local currTeam = ''
    17 local currTeam = ''
    19 local teams = {}
    18 local teams = {}
    89     CaseFreq = 0
    88     CaseFreq = 0
    90     Explosives = 0
    89     Explosives = 0
    91     MineDudPercent = 0
    90     MineDudPercent = 0
    92     EnableGameFlags(gfOneClanMode)
    91     EnableGameFlags(gfOneClanMode)
    93     DisableGameFlags(gfBottomBorder+gfBorder)
    92     DisableGameFlags(gfBottomBorder+gfBorder)
    94     --This reduced startup time by only about 15% and looked ugly
    93     -- gfDisableLandObjects is not used. This reduced startup time by only about 15% and looked ugly
    95     --EnableGameFlags(gfDisableLandObjects) 
    94     -- Force seed so the land objects are the same. Some themes will still be easier, but at least you won't luck out on the same theme
    96     -- force seed instead.  Some themes will still be easier, but at least you won't luck out on the same theme
       
    97     Seed = ""
    95     Seed = ""
    98     -- Disable Sudden Death
    96     -- Disable Sudden Death
    99     WaterRise = 0
    97     WaterRise = 0
   100     HealthDecrease = 0
    98     HealthDecrease = 0
   101 end
    99 end
   123         HH[gear] = nil
   121         HH[gear] = nil
   124     end
   122     end
   125 end
   123 end
   126 
   124 
   127 function onGameStart()
   125 function onGameStart()
   128     --SetClanColor(ClansCount-1, 0x0000ffff) appears to be broken
       
   129     SendHealthStatsOff()
   126     SendHealthStatsOff()
   130     local recordInfo = ""
   127     local recordInfo = ""
   131     if isSinglePlayer then
   128     if isSinglePlayer then
   132         recordInfo = getReadableChallengeRecord("Highscore")
   129         recordInfo = getReadableChallengeRecord("Highscore")
   133     end
   130     end
   137                 .. "|" .. recordInfo,
   134                 .. "|" .. recordInfo,
   138                 -amRope, 0)
   135                 -amRope, 0)
   139     local x = 1818
   136     local x = 1818
   140     for h,i in pairs(HH) do
   137     for h,i in pairs(HH) do
   141         if h ~= nil then
   138         if h ~= nil then
   142             -- SetGearPosition(h,x,32549)
       
   143             SetGearPosition(h,x,108)
   139             SetGearPosition(h,x,108)
   144             SetHealth(h,1)
   140             SetHealth(h,1)
   145             if x < 1978 then x = x+32 else x = 1818 end
   141             if x < 1978 then x = x+32 else x = 1818 end
   146             if GetEffect(h,heInvulnerable) == 0 then
   142             if GetEffect(h,heInvulnerable) == 0 then
   147                 SetEffect(h,heInvulnerable,1)
   143                 SetEffect(h,heInvulnerable,1)
   149                 HogsAreInvulnerable = true
   145                 HogsAreInvulnerable = true
   150             end
   146             end
   151             SetState(h,bor(GetState(h),gstInvisible))
   147             SetState(h,bor(GetState(h),gstInvisible))
   152         end
   148         end
   153     end
   149     end
   154 -- 1925,263 - Mr. Mine position
   150     -- 1925,263 - Mr. Mine position
   155     MrMine = AddGear(1925,263,gtMine,0,0,0,0)
   151     MrMine = AddGear(1925,263,gtMine,0,0,0,0)
   156     for i=0, TeamsCount-1 do
   152     for i=0, TeamsCount-1 do
   157         SetTeamLabel(GetTeamName(i), "0")
   153         SetTeamLabel(GetTeamName(i), "0")
   158     end
   154     end
   159 end
   155 end
   223     end
   219     end
   224     if Cake ~= nil then DeleteGear(Cake) end
   220     if Cake ~= nil then DeleteGear(Cake) end
   225     CakeTries = 0
   221     CakeTries = 0
   226 end
   222 end
   227 
   223 
   228 --function onGearDelete(gear)
       
   229 --    if gear == WaterRise and MaxHeight > 500 and CurrentHedgehog ~= nil and band(GetState(CurrentHedgehog),gstHHDriven) ~= 0 then
       
   230 --        WaterRise = AddGear(0,0,gtWaterUp, 0, 0, 0, 0)
       
   231 --    end
       
   232 --end
       
   233 
       
   234 function FireBoom(x,y,d) -- going to add for rockets too
   224 function FireBoom(x,y,d) -- going to add for rockets too
   235     PlaySound(sndExplosion)
   225     PlaySound(sndExplosion)
   236     AddVisualGear(x,y,vgtExplosion,0,false)
   226     AddVisualGear(x,y,vgtExplosion,0,false)
   237     -- should approximate circle by removing corners
   227     -- should approximate circle by removing corners
   238     --if BoomFire == nil then BoomFire = {} end
       
   239     for i = 0,50 do
   228     for i = 0,50 do
   240 	fx = GetRandom(d)-div(d,2)
   229 	fx = GetRandom(d)-div(d,2)
   241 	fy = GetRandom(d)-div(d,2)
   230 	fy = GetRandom(d)-div(d,2)
   242 	if fx<0 then
   231 	if fx<0 then
   243 	   fdx = -5000-GetRandom(3000)
   232 	   fdx = -5000-GetRandom(3000)
   251 	end
   240 	end
   252         flame = AddGear(x+fx, y+fy, gtFlame, gsttmpFlag,  fdx, fdy, 0)
   241         flame = AddGear(x+fx, y+fy, gtFlame, gsttmpFlag,  fdx, fdy, 0)
   253         SetTag(flame, 999999+i)
   242         SetTag(flame, 999999+i)
   254         SetFlightTime(flame, 0)
   243         SetFlightTime(flame, 0)
   255         Fire[flame]=1
   244         Fire[flame]=1
   256 --        BoomFire[flame]=1
       
   257     end
   245     end
   258 end
   246 end
   259 
   247 
   260 
   248 
   261 function onGameTick20()
   249 function onGameTick20()
   264     if math.random(20) == 1 then AddVisualGear(2012,56,vgtSmoke,0,false) end
   252     if math.random(20) == 1 then AddVisualGear(2012,56,vgtSmoke,0,false) end
   265     if CurrentHedgehog == dummyHog and dummySkip ~= 0 and dummySkip < GameTime then
   253     if CurrentHedgehog == dummyHog and dummySkip ~= 0 and dummySkip < GameTime then
   266         SkipTurn()
   254         SkipTurn()
   267         dummySkip = 0
   255         dummySkip = 0
   268     end
   256     end
   269 
       
   270     --if BoomFire ~= nil then
       
   271     --    for f,i in pairs(BoomFire) do
       
   272     --        if band(GetState(f),gstCollision~=0) then DeleteGear(f) end
       
   273     --    end
       
   274     --    BoomFire = nil
       
   275     --end
       
   276 
   257 
   277     for s,i in pairs(Stars) do
   258     for s,i in pairs(Stars) do
   278         local _, Y = GetVisualGearValues(s)
   259         local _, Y = GetVisualGearValues(s)
   279         if Y ~= nil and Y > WaterLine + 500 then
   260         if Y ~= nil and Y > WaterLine + 500 then
   280             DeleteVisualGear(s)
   261             DeleteVisualGear(s)
   331                 if gearIsInCircle(CurrentHedgehog,cx,cy,450) then
   312                 if gearIsInCircle(CurrentHedgehog,cx,cy,450) then
   332                     if not CakeFireWarning then
   313                     if not CakeFireWarning then
   333                         AddCaption(loc("Don't touch the flames!"))
   314                         AddCaption(loc("Don't touch the flames!"))
   334                         CakeFireWarning = true
   315                         CakeFireWarning = true
   335                     end
   316                     end
   336                     FireBoom(cx,cy,200) -- todo animate
   317                     FireBoom(cx,cy,200) -- TODO: animate
   337                     DeleteGear(Cake)
   318                     DeleteGear(Cake)
   338                 end
   319                 end
   339             end
   320             end
   340         end
   321         end
   341         if band(GetState(CurrentHedgehog),gstHHDriven) == 0 then
   322         if band(GetState(CurrentHedgehog),gstHHDriven) == 0 then
   370                     math.random(360),
   351                     math.random(360),
   371                     0,
   352                     0,
   372                     999999999, -- frameticks
   353                     999999999, -- frameticks
   373                     sprStar, -- star
   354                     sprStar, -- star
   374                     0, c)
   355                     0, c)
   375                     --,  0xFFCC00FF) -- could be fun to make colour shift as you rise...
       
   376                 Stars[s] = 1
   356                 Stars[s] = 1
   377             end
   357             end
   378         end
   358         end
   379 
   359 
   380         local vx, vy = GetGearVelocity(CurrentHedgehog)
   360         local vx, vy = GetGearVelocity(CurrentHedgehog)
   691     local actualHeight = getActualHeight(MaxHeight)
   671     local actualHeight = getActualHeight(MaxHeight)
   692     if teamBests[teamName] == nil then teamBests[teamName] = actualHeight end
   672     if teamBests[teamName] == nil then teamBests[teamName] = actualHeight end
   693     if teamBests[teamName] < actualHeight then teamBests[teamName] = actualHeight end
   673     if teamBests[teamName] < actualHeight then teamBests[teamName] = actualHeight end
   694     if teamScoreStats[teamName] == nil then teamScoreStats[teamName] = {} end
   674     if teamScoreStats[teamName] == nil then teamScoreStats[teamName] = {} end
   695     table.insert(teamScoreStats[teamName], actualHeight)
   675     table.insert(teamScoreStats[teamName], actualHeight)
   696     --SendStat(siClanHealth, tostring(teamBests[teamName]), teamName)
       
   697 end
   676 end
   698 
   677 
   699 function makeMultiPlayerWinnerStat(gear)
   678 function makeMultiPlayerWinnerStat(gear)
   700     return makeMultiPlayerLoserStat(gear)
   679     return makeMultiPlayerLoserStat(gear)
   701 end
   680 end