share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
changeset 12836 8610462e3d33
parent 12682 b7fd7ab8ddf9
child 12940 39b7b3ed619e
equal deleted inserted replaced
12835:71cdc02ccca6 12836:8610462e3d33
   194 wWidth = {}
   194 wWidth = {}
   195 wHeight = {}
   195 wHeight = {}
   196 wCol = {}
   196 wCol = {}
   197 margin = 20
   197 margin = 20
   198 
   198 
   199 vTag = {}
   199 clanPowerTag = nil
   200 lastWep = nil
   200 lastWep = nil
   201 
   201 
   202 checkForSpecialWeaponsIn = -1
   202 checkForSpecialWeaponsIn = -1
   203 
   203 
   204 -- Config variables (script parameter)
   204 -- Config variables (script parameter)
   205 conf_initialEnergy = 550
   205 conf_initialEnergy = 550
   206 conf_energyPerRound = 50
   206 conf_energyPerRound = 50
   207 conf_maxEnergy = 1000
   207 conf_maxEnergy = 1000
   208 conf_cratesPerRound = 5
   208 conf_cratesPerRound = 5
   209 
   209 
   210 function HideTags()
   210 function DrawClanPowerTag()
   211 
       
   212 	for i = 0, 2 do
       
   213 		SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00)
       
   214 	end
       
   215 
       
   216 end
       
   217 
       
   218 function DrawTag(i)
       
   219 
   211 
   220 	zoomL = 1.3
   212 	zoomL = 1.3
   221 
   213 
   222 	xOffset = 40
   214 	xOffset = 40
   223 
   215 
   224 	if i == 0 then
   216 	zoomL = 1.1
   225 		yOffset = 40
   217 	xOffset = 45
   226 		tCol = 0xffba00ff
   218 	yOffset = 70
   227 		tValue = 30
   219 	tCol = 0x00ff00ff
   228 	elseif i == 1 then
   220 	tValue = clanPower[GetHogClan(CurrentHedgehog)]
   229 		zoomL = 1.1
   221 
   230 		xOffset = 45
   222 	DeleteVisualGear(clanPowerTag)
   231 		yOffset = 70
   223 	clanPowerTag = AddVisualGear(0, 0, vgtHealthTag, 0, false)
   232 		tCol = 0x00ff00ff
   224 	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(clanPowerTag)
   233 		tValue = clanPower[GetHogClan(CurrentHedgehog)]
       
   234 	elseif i == 2 then
       
   235 		zoomL = 1.1
       
   236 		xOffset = 60 + 35
       
   237 		yOffset = 70
       
   238 		tCol = 0xa800ffff
       
   239 		tValue = 10
       
   240 	end
       
   241 
       
   242 	DeleteVisualGear(vTag[i])
       
   243 	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
       
   244 	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i])
       
   245 	SetVisualGearValues	(
   225 	SetVisualGearValues	(
   246 				vTag[i], 		--id
   226 				clanPowerTag, 		--id
   247 				-div(ScreenWidth,2) + xOffset,	--xoffset
   227 				-div(ScreenWidth,2) + xOffset,	--xoffset
   248 				ScreenHeight - yOffset, --yoffset
   228 				ScreenHeight - yOffset, --yoffset
   249 				0, 			--dx
   229 				0, 			--dx
   250 				0, 			--dy
   230 				0, 			--dy
   251 				zoomL, 			--zoom
   231 				zoomL, 			--zoom
   260 
   240 
   261 function onScreenResize()
   241 function onScreenResize()
   262 
   242 
   263 	-- redraw Tags so that their screen locations are updated
   243 	-- redraw Tags so that their screen locations are updated
   264 	if (CurrentHedgehog ~= nil) then
   244 	if (CurrentHedgehog ~= nil) then
   265 			DrawTag(0)
   245 		DrawClanPowerTag()
   266 			DrawTag(1)
       
   267 			DrawTag(2)
       
   268 	end
   246 	end
   269 
   247 
   270 end
   248 end
   271 
   249 
   272 function XYisInRect(px, py, psx, psy, pex, pey)
   250 function XYisInRect(px, py, psx, psy, pex, pey)
  1274 			end
  1252 			end
  1275 		end
  1253 		end
  1276 
  1254 
  1277 		if GameTime % 100 == 0 then
  1255 		if GameTime % 100 == 0 then
  1278 
  1256 
  1279 			DrawTag(1)
  1257 			DrawClanPowerTag()
  1280 
  1258 
  1281 			curWep = GetCurAmmoType()
  1259 			curWep = GetCurAmmoType()
  1282 
  1260 
  1283 			-- change to girder mode on weapon swap
  1261 			-- change to girder mode on weapon swap
  1284 			if (cIndex ~= 1) and (curWep == amGirder) then
  1262 			if (cIndex ~= 1) and (curWep == amGirder) then