Raised This Month: $32 Target: $400
 8% 

Polymorph: Mod Manager


Post New Thread Reply   
 
Thread Tools Display Modes
Dote
Member
Join Date: Jan 2018
Old 05-03-2018 , 11:47   Re: Polymorph: Mod Manager
Reply With Quote #931

can u install galielo on polymorph?
Dote is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-03-2018 , 20:11   Re: Polymorph: Mod Manager
Reply With Quote #932

Quote:
Originally Posted by Dote View Post
can u install galielo on polymorph?
No because they serve the same purpose (map voting).
__________________
fysiks is offline
Aqua
Junior Member
Join Date: Aug 2018
Old 08-20-2018 , 04:34   Re: Polymorph: Mod Manager
Reply With Quote #933

Hello, how to remove the item "NONE".
I tried to delete the line
Code:
format(menu[pos], 511, "%d. %L", SELECTMODS+2, LANG_SERVER, "NONE")
The item disappears from the menu, but if I click on button 7 (this button does not have any items), then I close the menu ...

Also, when you select another mod, the option to extend the map disappears (in the vote for the map), but if you press the 6 button (this is the extender map button), the map is extended, although the button is not displayed in the menu. That is, as a matter of fact at change of a mode it is possible to extend a current map

Last edited by Aqua; 08-20-2018 at 04:36.
Aqua is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-20-2018 , 22:56   Re: Polymorph: Mod Manager
Reply With Quote #934

Quote:
Originally Posted by Aqua View Post
Hello, how to remove the item "NONE".
I tried to delete the line
Code:
format(menu[pos], 511, "%d. %L", SELECTMODS+2, LANG_SERVER, "NONE")
The item disappears from the menu, but if I click on button 7 (this button does not have any items), then I close the menu ...
To remove an item from the menu entirely, you have to remove the bit for that key in the variable mkeys. In this case, I set this bit on line 497. I.e.

Code:
	new menu[512], a = 0, mkeys = (1<<SELECTMODS + 1) // The "None" key


Code:
	new menu[512], a = 0, mkeys = 0

Quote:
Originally Posted by Aqua View Post
Also, when you select another mod, the option to extend the map disappears (in the vote for the map), but if you press the 6 button (this is the extender map button), the map is extended, although the button is not displayed in the menu. That is, as a matter of fact at change of a mode it is possible to extend a current map
I'm not seeing how this happens. The code looks fine to me. Have you modified anything else in the code?
__________________
fysiks is offline
Aqua
Junior Member
Join Date: Aug 2018
Old 08-22-2018 , 07:12   Re: Polymorph: Mod Manager
Reply With Quote #935

Quote:
Originally Posted by fysiks View Post
To remove an item from the menu entirely, you have to remove the bit for that key in the variable mkeys. In this case, I set this bit on line 497. I.e.

Code:
	new menu[512], a = 0, mkeys = (1<<SELECTMODS + 1) // The "None" key


Code:
	new menu[512], a = 0, mkeys = 0
This eliminated all my problems. I also did this operation to vote for the map. Thank you!
Aqua is offline
Aqua
Junior Member
Join Date: Aug 2018
Old 08-26-2018 , 21:15   Re: Polymorph: Mod Manager
Reply With Quote #936

Hello, how to remove the current map from the vote?
Aqua is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-27-2018 , 00:50   Re: Polymorph: Mod Manager
Reply With Quote #937

Quote:
Originally Posted by Aqua View Post
Hello, how to remove the current map from the vote?
You would need to add an OR'ed condition to the while loop in startMapVote().

Code:
while (isInMenu(a) || /* a == current map index */)
Unfortunately, it looks like I don't have a variable with the current map's index in it yet. You'd have to create a new variable and populate it with the current map's index. That means you'd probably need to loop through all the maps and look check to see which one is equal to the result of get_mapname().

I don't have time at the moment to do the code for finding the index. If you can't figure it out, PM me and I'll look into it more.
__________________
fysiks is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-28-2018 , 22:37   Re: Polymorph: Mod Manager
Reply With Quote #938

So, here are the changes I think will implement what you want (untested):

Add this variable declaration near the top with the others:
Code:
new g_iThisMap = -1			// Index of 'ThisMap'

Update the while loop condition like this:
Code:
		while (isInMenu(a) || g_iThisMap == a)
			if (++a >= mapNum) a = 0

Then replace the entire loadMaps() function with this new version:
Code:
stock bool:loadMaps(szConfigDir[], szMapFile[], iModIndex)
{
	new szFilepath[STRLEN_PATH], szData[STRLEN_MAP], szMapName[32], i = 0
	get_mapname(szMapName, charsmax(szMapName))

	g_iMapNums[iModIndex] = 0
	formatex(szFilepath, charsmax(szFilepath), "%s/%s", szConfigDir, szMapFile)

	new f = fopen(szFilepath, "rt")

	if(!f)
		return false

	while(!feof(f))
	{
		fgets(f, szData, charsmax(szData))
		trim(szData)
		if(!szData[0] || szData[0] == ';' || (szData[0] == '/' && szData[1] == '/'))
			continue
		if(is_map_valid(szData))
		{
			ArrayPushString(g_aModMaps[iModIndex], szData)
			
			if( g_iThisMod == iModIndex )
			{
				if( equal(szMapName, szData) )
				{
					g_iThisMap = i
				}
			}
			
			i++
			g_iMapNums[iModIndex]++
		}
	}
	fclose(f)
	return true
}

Let me know how it goes.
__________________
fysiks is offline
Aqua
Junior Member
Join Date: Aug 2018
Old 08-30-2018 , 12:23   Re: Polymorph: Mod Manager
Reply With Quote #939

Quote:
Originally Posted by fysiks View Post
So, here are the changes I think will implement what you want (untested):

Add this variable declaration near the top with the others:
Code:
new g_iThisMap = -1			// Index of 'ThisMap'

Update the while loop condition like this:
Code:
		while (isInMenu(a) || g_iThisMap == a)
			if (++a >= mapNum) a = 0

Then replace the entire loadMaps() function with this new version:
Code:
stock bool:loadMaps(szConfigDir[], szMapFile[], iModIndex)
{
	new szFilepath[STRLEN_PATH], szData[STRLEN_MAP], szMapName[32], i = 0
	get_mapname(szMapName, charsmax(szMapName))

	g_iMapNums[iModIndex] = 0
	formatex(szFilepath, charsmax(szFilepath), "%s/%s", szConfigDir, szMapFile)

	new f = fopen(szFilepath, "rt")

	if(!f)
		return false

	while(!feof(f))
	{
		fgets(f, szData, charsmax(szData))
		trim(szData)
		if(!szData[0] || szData[0] == ';' || (szData[0] == '/' && szData[1] == '/'))
			continue
		if(is_map_valid(szData))
		{
			ArrayPushString(g_aModMaps[iModIndex], szData)
			
			if( g_iThisMod == iModIndex )
			{
				if( equal(szMapName, szData) )
				{
					g_iThisMap = i
				}
			}
			
			i++
			g_iMapNums[iModIndex]++
		}
	}
	fclose(f)
	return true
}

Let me know how it goes.
So far, everything is working fine. And how to prohibit the extension of the mod? When the mod is renewed and the map is changed, the mod can be extended again, I suspect that it is also necessary to record the index of the previous mod and make a check on the previous mod?
Aqua is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-01-2018 , 13:40   Re: Polymorph: Mod Manager
Reply With Quote #940

The mod is already excluded from the normal vote options. Extending the mod is controlled by the cvar poly_extendmod.
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:45.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode