Page 1 of 1

Typemap Options

Posted: 23 Feb 2010, 12:47
by Google_Frog
A gadget that links in with modoptions to give players a lot of control over how much of the map's typemap they use.

Modoptions:

Code: Select all

{
    key='typemapsetting',
    name='Terrain Speed Boost',
    desc='Choose which map Speed Boost to use',
    type='list',
    section= 'mapsettings',        
    def='keepequal',
    items = {
      { key='mapdefault', name="Map Default", desc='Use map speed boost' },
	  { key='average', name="Average", desc='Each terrain types speed boost is averaged' },
	  { key='keepequal', name="Keep Equal", desc='Non-equal speedboost removed' },
	  { key='onlyimpassable', name="Only Impassable", desc='Override all speedboost except impassable terrain' },
	  { key='alloff', name="All Off", desc='Disable all speed boost' },
    },
  },
Edit: Updated for 256 max typemaps.

Re: Typemap Options

Posted: 23 Feb 2010, 13:12
by jK
I would prefer the option to just disable impassable terrain.

Re: Typemap Options

Posted: 23 Feb 2010, 13:16
by Argh
Er, why the 1,1600, instead of using map.maxsizeX / Z?

Moreover... you don't need to do any of that. Just:

Spring.SetTerrainTypeData(A,B,C,D,E)

Where A is the type, B == TANK, C == KBOT, D == HOVER, and E == SHIP

...voila, done, no need to reset them or change them all to the same things.

Re: Typemap Options

Posted: 23 Feb 2010, 14:15
by Google_Frog
I would prefer the option to just disable impassable terrain.
And leave all the other speed changes? Maps generally have impassable regions for a reason but that didn't stop me from adding the option to disable it.
Er, why the 1,1600, instead of using map.maxsizeX / Z?
Because it looked like I would need 1,32 to start with and discovered that some mappers like to use round, large numbers. 1,1600 is still smaller than (0,map.maxsizeX/8) * (0,map.maxsizeZ/8).
Moreover... you don't need to do any of that. Just:

Spring.SetTerrainTypeData(A,B,C,D,E)

Where A is the type, B == TANK, C == KBOT, D == HOVER, and E == SHIP

...voila, done, no need to reset them or change them all to the same things.
I have got no idea what this means though I can assure you that putting "Spring.SetTerrainTypeData(A,B,C,D,E)" in an empty lua file will not work.

Re: Typemap Options

Posted: 23 Feb 2010, 14:26
by Argh
I can assure you that putting "Spring.SetTerrainTypeData(A,B,C,D,E)" in an empty lua file will not work.

Code: Select all

if (gadgetHandler:IsSyncedCode()) then
function gadget:Initialize()
	--get number of movetypes from map file here
end

function gadget:GameFrame(f)
	if f == 1 then
		for 0,moveTypes do
			Spring.SetTerrainTypeData(moveType,B,C,D,E)
		end
	end
	if f == 61 then
		gadgetHandler:RemoveCallIn("GameFrame")
	end
end
end

Re: Typemap Options

Posted: 23 Feb 2010, 14:28
by jK
Google_Frog wrote:
I would prefer the option to just disable impassable terrain.
And leave all the other speed changes? Maps generally have impassable regions for a reason but that didn't stop me from adding the option to disable it.
On most maps it's just breaks them (Azure, BlackStar, ...).

Re: Typemap Options

Posted: 23 Feb 2010, 14:33
by Google_Frog
jK wrote:
Google_Frog wrote:
I would prefer the option to just disable impassable terrain.
And leave all the other speed changes? Maps generally have impassable regions for a reason but that didn't stop me from adding the option to disable it.
On most maps it's just breaks them (Azure, BlackStar, ...).
Hence "{ key='alloff', name="All Off", desc='Disable all speed boost' },"

Re: Typemap Options

Posted: 23 Feb 2010, 14:34
by Beherith
Google_Frog wrote:
Er, why the 1,1600, instead of using map.maxsizeX / Z?
Because it looked like I would need 1,32 to start with and discovered that some mappers like to use round, large numbers. 1,1600 is still smaller than (0,map.maxsizeX/8) * (0,map.maxsizeZ/8).
WTF?
Explain please where you got that 1600 number from.
The max amount of different terrain types is 256. Cant be more. Dont know what that has to do with mapsizex/8*mapsizeZ/8
Theoretically typemap dimensions are (at compile time and in the map format) texturex/16*texturey/16

Re: Typemap Options

Posted: 23 Feb 2010, 14:38
by Google_Frog
The max amount of different terrain types is 256.
Great, I saw some maps using typemap 0,50,100 ect.. and extrapolated. I started with 32 and found a few maps using every 50th typemap. 50*32 = 1600.

Re: Typemap Options

Posted: 23 Feb 2010, 14:58
by Beherith
They are using every 50th because its easier to visualize. The typemap is the red channel of a bmp image. The number is how much red there is.

Re: Typemap Options

Posted: 23 Feb 2010, 15:14
by Pxtl
I know you're talking about speed-boost, but I assume this also refers to speed-nerfs too, right?