share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
changeset 12010 e020e1ce4739
parent 12009 c69b36964374
child 12011 6540fcfad01c
equal deleted inserted replaced
12009:c69b36964374 12010:e020e1ce4739
   584  local reducedSpriteIDArray = {
   584  local reducedSpriteIDArray = {
   585   sprAmRubber, sprAmGirder, sprAMSlot, sprAMAmmos, sprAMAmmosBW, sprAMCorners, sprHHTelepMask, sprTurnsLeft,
   585   sprAmRubber, sprAmGirder, sprAMSlot, sprAMAmmos, sprAMAmmosBW, sprAMCorners, sprHHTelepMask, sprTurnsLeft,
   586   sprSpeechCorner, sprSpeechEdge, sprSpeechTail, sprThoughtCorner, sprThoughtEdge, sprThoughtTail, sprShoutCorner,
   586   sprSpeechCorner, sprSpeechEdge, sprSpeechTail, sprThoughtCorner, sprThoughtEdge, sprThoughtTail, sprShoutCorner,
   587   sprShoutEdge, sprShoutTail, sprBotlevels, sprIceTexture, sprCustom1, sprCustom2, }
   587   sprShoutEdge, sprShoutTail, sprBotlevels, sprIceTexture, sprCustom1, sprCustom2, }
   588 
   588 
       
   589  local reducedSpriteIDArrayFrames = {
       
   590   4, 8, 3, 57, 57, 4, 1, 8,
       
   591   1, 1, 1, 1, 1, 1, 1,
       
   592   1, 1, 1, 1, 1, 1, 1,
       
   593  }
       
   594 
   589  local reducedSpriteTextArray = {
   595  local reducedSpriteTextArray = {
   590   "sprAmRubber", "sprAmGirder", "sprAMSlot", "sprAMAmmos", "sprAMAmmosBW", "sprAMCorners", "sprHHTelepMask", "sprTurnsLeft",
   596   "sprAmRubber", "sprAmGirder", "sprAMSlot", "sprAMAmmos", "sprAMAmmosBW", "sprAMCorners", "sprHHTelepMask", "sprTurnsLeft",
   591   "sprSpeechCorner", "sprSpeechEdge", "sprSpeechTail", "sprThoughtCorner", "sprThoughtEdge", "sprThoughtTail", "sprShoutCorner",
   597   "sprSpeechCorner", "sprSpeechEdge", "sprSpeechTail", "sprThoughtCorner", "sprThoughtEdge", "sprThoughtTail", "sprShoutCorner",
   592   "sprShoutEdge", "sprShoutTail", "sprBotlevels", "sprIceTexture", "sprCustom1", "sprCustom2", }
   598   "sprShoutEdge", "sprShoutTail", "sprBotlevels", "sprIceTexture", "sprCustom1", "sprCustom2", }
   593 
   599 
   639 				}
   645 				}
   640 
   646 
   641 
   647 
   642 local pMode = {}	-- pMode contains custom subsets of the main categories
   648 local pMode = {}	-- pMode contains custom subsets of the main categories
   643 local pIndex = 1
   649 local pIndex = 1
       
   650 local sFrame = 0	-- frame in sprite placement mode
   644 
   651 
   645 local genTimer = 0
   652 local genTimer = 0
   646 
   653 
   647 local CGR = 1 -- current girder rotation, we actually need this as HW remembers what rotation you last used
   654 local CGR = 1 -- current girder rotation, we actually need this as HW remembers what rotation you last used
   648 
   655 
  1301 
  1308 
  1302 
  1309 
  1303 	elseif cat[cIndex] == loc("Sprite Placement Mode") then
  1310 	elseif cat[cIndex] == loc("Sprite Placement Mode") then
  1304 
  1311 
  1305 		if superDelete == false then
  1312 		if superDelete == false then
  1306 			placedFrame[placedCount] = 1
  1313 			placedFrame[placedCount] = sFrame
  1307 			placedSprite[placedCount] = reducedSpriteIDArray[pIndex]
  1314 			placedSprite[placedCount] = reducedSpriteIDArray[pIndex]
  1308 			placementSucceeded = CallPlaceSprite(placedCount)
  1315 			placementSucceeded = CallPlaceSprite(placedCount)
  1309 		else
  1316 		else
  1310 			placedType[placedCount] = "bogus"
  1317 			placedType[placedCount] = "bogus"
  1311 			SelectClosestSprite()
  1318 			SelectClosestSprite()
  2714 
  2721 
  2715 		ShowMission	(
  2722 		ShowMission	(
  2716 				loc("SPRITE PLACEMENT MODE"),
  2723 				loc("SPRITE PLACEMENT MODE"),
  2717 				loc("Use this mode to place custom sprites."),
  2724 				loc("Use this mode to place custom sprites."),
  2718 				loc("Change sprite: [Left], [Right]") .. "|" ..
  2725 				loc("Change sprite: [Left], [Right]") .. "|" ..
       
  2726 				loc("Change sprite frame: [Precise]+[Left], [Precise]+[Right]") .. "|" ..
  2719 				loc("Set LandFlag: [1], [2], [3], [4]") .. "|" ..
  2727 				loc("Set LandFlag: [1], [2], [3], [4]") .. "|" ..
  2720 				" " .. "|" ..
  2728 				" " .. "|" ..
  2721 				loc("1 - Normal Land") .. "|" ..
  2729 				loc("1 - Normal Land") .. "|" ..
  2722 				loc("2 - Indestructible Land") .. "|" ..
  2730 				loc("2 - Indestructible Land") .. "|" ..
  2723 				loc("3 - Icy Land") .. "|" ..
  2731 				loc("3 - Icy Land") .. "|" ..
  2847 			elseif (cat[cIndex] == loc("Cleaver Placement Mode")) then
  2855 			elseif (cat[cIndex] == loc("Cleaver Placement Mode")) then
  2848 				dAngle = 270
  2856 				dAngle = 270
  2849 				dSprite = sprKnife
  2857 				dSprite = sprKnife
  2850 			elseif (cat[cIndex] == loc("Sprite Placement Mode")) then
  2858 			elseif (cat[cIndex] == loc("Sprite Placement Mode")) then
  2851 				dSprite = reducedSpriteIDArray[pIndex]
  2859 				dSprite = reducedSpriteIDArray[pIndex]
  2852 				dFrame = 1
  2860 				dFrame = sFrame
  2853 			else
  2861 			else
  2854 				dCol = 0xFFFFFF00
  2862 				dCol = 0xFFFFFF00
  2855 				dSprite = sprArrow
  2863 				dSprite = sprArrow
  2856 			end
  2864 			end
  2857 
  2865 
  3073 function onLeft()
  3081 function onLeft()
  3074 
  3082 
  3075 	leftHeld = true
  3083 	leftHeld = true
  3076 	rightHeld = false
  3084 	rightHeld = false
  3077 
  3085 
  3078 	pIndex = pIndex - 1
  3086 	if preciseOn then
  3079 	if pIndex == 0 then
  3087 		if cat[cIndex] == loc("Sprite Placement Mode") then
  3080 		pIndex = #pMode
  3088 			sFrame = sFrame - 1
  3081 	end
  3089 			if sFrame < 0 then
  3082 
  3090 				sFrame = reducedSpriteIDArrayFrames[pIndex] - 1
  3083 	if (curWep == amGirder) or (curWep == amRubber) or (curWep == amAirAttack) then
  3091 			end
  3084 		AddCaption(pMode[pIndex],0xffba00ff,capgrpMessage2)
  3092 		end
       
  3093 	else
       
  3094 		pIndex = pIndex - 1
       
  3095 		if pIndex == 0 then
       
  3096 			pIndex = #pMode
       
  3097 		end
       
  3098 		sFrame = math.min(sFrame, reducedSpriteIDArrayFrames[pIndex] - 1)
       
  3099 
       
  3100 		if (curWep == amGirder) or (curWep == amRubber) or (curWep == amAirAttack) then
       
  3101 			AddCaption(pMode[pIndex],0xffba00ff,capgrpMessage2)
       
  3102 		end
  3085 	end
  3103 	end
  3086 
  3104 
  3087 end
  3105 end
  3088 
  3106 
  3089 function onRight()
  3107 function onRight()
  3090 
  3108 
  3091 	leftHeld = false
  3109 	leftHeld = false
  3092 	rightHeld = true
  3110 	rightHeld = true
  3093 
  3111 
  3094 	pIndex = pIndex + 1
  3112 	if preciseOn then
  3095 	if pIndex > #pMode then
  3113 		if cat[cIndex] == loc("Sprite Placement Mode") then
  3096 		pIndex = 1
  3114 			sFrame = sFrame + 1
  3097 	end
  3115 			if sFrame >= reducedSpriteIDArrayFrames[pIndex] then
  3098 
  3116 				sFrame = 0
  3099 	if (curWep == amGirder) or (curWep == amRubber) or (curWep == amAirAttack) then
  3117 			end
  3100 		AddCaption(pMode[pIndex],0xffba00ff,capgrpMessage2)
  3118 		end
       
  3119 	else
       
  3120 		pIndex = pIndex + 1
       
  3121 		if pIndex > #pMode then
       
  3122 			pIndex = 1
       
  3123 		end
       
  3124 		sFrame = math.min(sFrame, reducedSpriteIDArrayFrames[pIndex] - 1)
       
  3125 	
       
  3126 		if (curWep == amGirder) or (curWep == amRubber) or (curWep == amAirAttack) then
       
  3127 			AddCaption(pMode[pIndex],0xffba00ff,capgrpMessage2)
       
  3128 		end
  3101 	end
  3129 	end
  3102 
  3130 
  3103 end
  3131 end
  3104 
  3132 
  3105 ---------------------------------------------------------
  3133 ---------------------------------------------------------