Currently I am reworking the underground mode. The new mode has the following properties (features?)
== if switching to underground, the height of the tile under the cursor will be taken as underground-level
== everything under or on underground-level will be displayed as usual
== if the tile is above the underground-level, a currently black tile is displayed at the underground-level
== only tunnels that are on the underground-level are displayed, tunnels above / below the underground-level won't be displayed
== cursor movement on the displayed tiles not on the invisible landscape
-- it should be easier to develop multi-level underground editing with the new underground viewing mode
See the attached screenshots of the same spot of the map, in normal and in new underground mode.
Up to now, I modified the displaying routines. I plan to modify the tools such that 'overground' tools work on all the tiles that are overground, and tunnel tools on the underground-tools.
Any thoughts and comments are welcome.
Have you talked to Kieron? I think he started reworking underground a while ago, too...
Is there some way to move up/down? I understand that taking the current tile as base is simple for lack of GUI coding, but... ;)
Nevertheless, good work!
thank you :)
it should be easily possible to add tools for moving the underground level up/down.
Very nice! With such an approach, it would be easy to build several connected underground levels. "Underground artificial slopes" would suffice.
An idea: the overground ramps look strange to me. The grid can be present only at horizontal sides of tiles at the level chosen, to give 3D impression.
Changing the cursor tile alignment in itself would be a huge improvement. I should be very interested to see this.
Looks very much like locomotion. Is there a patch for testing?
These overground ramps are drawn to indicate the border between overground and underground terrain. Since internally the z-coordinate of the slopes is the z-coordinate of the tile below, these slopes are drawn naturally with my approach.
The cursor alignment is changed, it will move on the drawn tiles, and not on the regular surface of the ground. The cursor behaviour in the current underground mode was one motivation to develop this patch.
A patch file will follow soon.
Here is the patch file. Under Options -> Display one can toggle the underground-view and change the underground-level gradually.
Some impression.
- Number input box is a problem. Usually, water level is -2, but number input box can't select negative values.
- I want to use existing underground view, too. New underground view is useful in some cases but not always. It's a pain to select each level, and also I want to view all at once.
And one question. Is it intended that all level of monorail and elevated road and tracks will be hidden ?
Problem:
If I build a "High speed road tunnel" on snow, background slope tile was transparent.
[attachment deleted by admin]
thank you for testing. You found the following bugs:
== no ground tiles are displayed for tunnel entries
== grid lines are shown inside the tunnel despite being not in underground-mode
== elevated (monorail) tracks are not correctly displayed in underground-mode
== number input can be adapted easily, my test games did have water at 0
An easy keyboard shortcut to increase/decrease underground-level can be implemented too. Would that suffice for your purposes?
Go on, Dwachs. Your path is very usefull. I quite very often need to handle "multilevel tunnels".
Here is a new patch file. All issues indicated by z9999 are solved. The pak64-roadtunnel causes graphical glitches that are not due to my patch and appear in older versions already (tested in 2168).
Now, also a simple tool is implemented: increase / decrease the underground-level by special keys. The effect is only visible if underground-mode is active. One has to add the following lines to pakxx/config/menuconf.tab:
# WKZ_INC_UNDERGROUND_LEVEL = 20
# WKZ_DEC_UNDERGROUND_LEVEL = 21
simple_tool[20]=,HOME
simple_tool[21]=,END
this will increase / decrease the underground-level if the 'home' / 'end' keys are pressed. Ofcourse, different keys than 'home'/'end' can be defined.
edit: some more notes:
-- I ****umed '20' to be the maximal underground-level, I did not found an easy way to detect the maximal height in a map. One could add a visible indication what underground-level is currently chosen, for instance in the ticker etc.
-- Behaviour of tools and toolbars is similar as before. I did not touch it.
-- The standard image for grounds in underground-mode is black with gridlines for empty tiles and the sidewalk-image for tunnel ways. Here, one could modify the besch / pak-system to allow textures for the underground-tiles.
-- With this underground-mode, there is the possibility to add slopes in tunnels. Not implemented yet.
This looks very promising!
Thank you. It seems that everything is working properly.
It's very useful, thank you.
@z9999: What is your reason that you want to use also the 'old' underground view? quick finding of all tunnels? Or is it enough to change the displayed underground level with the keyboard?
I first thought it is difficult to positional awareness between each height.
But in fact it was not.
Other reasons are quick finding tunnels and for pleasure like "follow me" mode. These are not so important.
So, I will drop my demand. Changing level with the keyboard is enough.
Thank you.
Well, seeing things below current level, maybe with black transparency, might be nice... but it is a very minor detail.
Haven't heard anything... I've really not had the time for anything to do with simutrans recently. I was planning on dealing with multilevel tunnels by reusing the artificial slope buttons. Got as far as some logic being there for detecting clicks on ends of tunnels. I don't think I'm going to make much progress soon though - at the moment I don't even have an internet connection at home.
The next step for this patch would be to alter all the tools. In the way, that 'overground tool' work on the tiles that are normally shown, while underground-tools work on the underground tiles.
For multi-level tunnels I thought similarly about using the artificial slope tools: building a slope on a tunnel end gives an upward slope in the tunnel way. However, displaying will get complicated since an upward slope belongs programwise to the level below. And path-finding will be another difficulty I fear.
Any opinions on both issues?
Dwachs,
does altering the tools require work from coders or pakset authors or both?
One question.
In current your patch, we can build a stop and set schedule on the middle level of way. (see first picture) This was impossible in original simutrans.
I don't know this is intended or not, but I like this very much.
Will this remain in the future ?
[attachment deleted by admin]
@james petts: altering the tools means only coder work. I did not look into it. But I think a lot of checks like 'is mouse position over/under ground' have to be added.
@z9999: If I understand your right, you have three levels of streets above each other, and now you can select the middle level, if you choose the underground level right? I hope this behavior can be recovered, since I altered also the computation of mouse position in underground mode.
In the original underground mode one can build tunnel ways only from already existing ways, this condition can be relaxed now I think.
For the tools: to simplify things, why not keeping the underground tools while in underground mode and not allow to build overground?
For the ramps: why not marking them as if overground, or with a different color?
With some though, I do not think many tools require a change. Especially since most tools now take a 3d coordinate anyway. (Was one of the more recent changes.)
But I think it would better to enforce tunnels to be built in connection with overground ways.
What about underground metro systems?
You mean automatically placing tunnel entries, overground street and underground way if the player wants to build from an overground tile to an underground tile?
Hmm, any more progress on getting the tools sorted out for this? It'd be good to put this in Simutrans-Experimental if the tools were fixed.
Hi James, I did not work on that recently. Feel free to use this in your experimental build. You will have to translate the patch file (gib -> get ...). I will help sorting out bugs with respect to the tools.
Now, I the 'old' underground mode and the 'new' coexist friendly.
Pressing 'U' gives you the new mode, with the level where the landscape is cut according to cursor position. Pressing again 'U' toggles the 'old' mode. Another 'U' returns to normal mode.
The tools for changing the underground level are as described above.
Here is a windows binary, patch attached:
http://rapidshare.com/files/191721652/simutrans-ug.exe.html (http://rapidshare.com/files/191721652/simutrans-ug.exe.html)
Please test for bugs in displaying and in the build-tunnel tool. All other tools I did not touch/test, expect undocumented behaviour there ;)
I also ask for opinions about the toggling method. How should the different view modes be toggled?
tell me when it's implemented in nightly builds ;) I'm looking forward using that :D
Why do you use rapidshare for the file instead of the simutrans-germany sites?
EDIT:
Oh and by the way: the file doesn't work here.
EDIT2:
Here's the (german) error message:
Aha, this looks like good progress! I shall have a look at that when I get time.
I could make a Spezial Version on monday .....
compile with debug dll?
if compile with MS VC++ 2005/2008 EE then require .net-Framework
and upload to patches.simutrans-germany.com (http://patches.simutrans-germany.com), this page required not javascript
Problem is, if I used way tools or station building tools under ground, this will affect on the ground and build on ground.
This is not due to your patch but the problem of original simutrans.
But as the result of allowing to use them, this problems often happen.
This is very annoying for beginners.
I think in a final version dwachs will forbid this. He didn't touched any tools (simwerkz) yet.
yesterday evening, I was not able to reach *.simutrans-germany.com.
I compiled the exe with VS Express C++ etc. I think I used the 'Debug' configuration for compilation. Sorry for that. How should I compile under VS Express? Which setting generates a file that every windows user can start?
@z9999: yes, I did not touch the tools yet. This 'release' is just for testing the graphics. The only tools that should work right in all view modes is the 'build tunnel tool'.
@wernieman: thank you for your offer :)
subdomain not work, then directly links (http://forum.simutrans.com/index.php?topic=1264.msg12208#msg12208)
I make a spezial run, but don' t test!!
See at http://patches.simutrans-germany.com (http://patches.simutrans-germany.com)
Ahhh this I can run! Thanks Werner!
I like this one-level UG view! Is it planned/possible that one can switch levels while in that view, or do we always have to change back to surface, reposition cursor and swith back to UG view?
For testing purposes the stepping of normal/new UG/ old UG view, toggled by "U" is ok - but in the long term think it might get annoying (especially on large maps, where switching can take a few seconds anyway).
But for now, nice start! Still wondering about Kieron's work on UG (slopes and all) - hope you'll be able to combine all that into one big new underground mode one day!
This patch is very usefull.
Is it possible to have at start the undergrund patch activated? So I have not to press U.
@wernieman: thank you very much!!!elf11
@Dirk: add this to your menuconf.tab:
# WKZ_INC_UNDERGROUND_LEVEL = 20
# WKZ_DEC_UNDERGROUND_LEVEL = 21
simple_tool[20]=,HOME
simple_tool[21]=,END
Then home/end raises/lowers the underground level (has only effect if the leveled mode is on)
@sojo: how would you control this? in the savegame? in a *.tab file?
Oohhh brilliant! :D
Here is a new patch. Now, all tools should work correct in all underground views. That is, in underground view it is no longer possible to build something on invisible tiles. Have fun!
@wernieman: could you build a new special version with this patch? Thank you very matsch!
at next time .. could you make a patchfile in the trunk direktory?
With this I must delete the "trunk/" in the file bevor I could run the scripts .....
Just use 'patch -p1 < ...'??
O.K. I must edit the Script ;o)
O.K. I did it ..
Look at the patch-Server http://patches.simutrans-germany.com (http://patches.simutrans-germany.com)
Thank you! Now I am waiting for praises and .. bug reports ;D
http://simutrans-escala-real.blogspot.com/2009/02/echa-un-vistazo-debajo-de-la-alfombra.html (http://simutrans-escala-real.blogspot.com/2009/02/echa-un-vistazo-debajo-de-la-alfombra.html)... ::)
where are the bugs ??? :D
Nowhere. I've concentrated in praising and reporting.. ;)
Here is an updated version of the patch. It fixes a display bug and part of the marker bug, which was discovered by z9999 in the tunnel-slopes thread.
I mak a compilerrun
Look at patches.simutrans-germany.com
Edit: The Filename is 2305 .. the Version is 2302 ..
New version against 2316.
Where do I have to put this file, and what do I have to do to make it run probably?
This is a code file. To make it work you have to compile simutrans applying this patch.
****uming you won't do that, maybe you want to take a look at patches.simutrans-germany.com (http://patches.simutrans-germany.com), where you can find several compiled versions of the simutrans program. Beware, they are non-official (probably unstable) versions!
Ok thank you!
I downloaded the sim-wingdi-undergound-view-slopes-2310.zip and the new Underground mode is working!
But how do I build the slopes?
I cant find them anywhere!
go to http://forum.simutrans.com/index.php?topic=1089.msg13986#msg13986 (http://forum.simutrans.com/index.php?topic=1089.msg13986#msg13986) (It's a post from the previous page of this thread)
EDIT: To get the suitable solution, read next post from Dwachs.
No, for underground slopes, you must look here
http://forum.simutrans.com/index.php?topic=1444.msg14421#msg14421 (http://forum.simutrans.com/index.php?topic=1444.msg14421#msg14421)
You have to modify the pak*/menuconf.tab
Shout I make a Version with this PATCH?
Or should I whait for the next underground-sloop-patch?
You can wait for an update of the slope-patch. I updated my patch only since there appear some conflicts due to changes in trunk.
I think, I wouldn't make a new patch version as long as there are no new bug fixes or new features.
But the sloop patch did not work with the newest simutrans-versions ... ;o)
You're kidding me.. :)
wow :o
slopes now its possible yehey... hmmm gonna try that...
Off Topic!
This Thread is about the new Underground view not the slopes in tunnels.
Post here: http://forum.simutrans.com/index.php?topic=1444
I did the same mistake!
Updated the patch according to prissi's request.
@wernieman: Could you please compile a new version?
@all others: Please test :)
Compile: Yes
But at the moment is patches.simutrans-german.com offline ... so where I could but them?
Edit:
There will be a new Version on patches.simutrans-germany.com next week (I hope)
Sorry for the waiting, but there are personal reasons ...
Maybe use a free filesharer out there ?
updated to 2350
here is a updated and slightly reworked patch.
edit: patch removed
Windows GDI, compiled with MinGW, GCC
I tried, but simutrans quit without any error dialog. (****ert)
How to reproduce:
1. Change to underground mode
2. Build road to slope
3. Build tunnel on slope
Result:
Quit without any error dialog
simu.log
Another small problem.
In normal (overground) mode, when I build monorail track on vertical slope, it don't show.
But if I change to underground mode and change to normal mode again, it shows.
thanks for testing! I missed to apply changes to the tunnel building routines causing the ****ertion.
However, I could not reproduce your second report. Maybe the undergroundmode was on and the new built monorail was above the underground level, which makes it invisible?
Patch attached, but against 2381, since I dont have the possibility to update.
I can reproduce the monorail bug. Be sure to build elevated monorail tracks, not flat ones.
Crash when I remove a tunnel with romove tool in underground view.
I think monorail problem is some kind of initialize problem.
If I once changed to underground view and changend back to ground view. This problem don't happen.
new patch against 2381.
Hopefully the monorail-bug is gone. I could not reproduce it :(
I tried with both 2381 and 2391, monorail problem didn't happen.
Thank you.
Since several revisions, tool number 20 is used for toggling tooltips. Hence the menuconf.tab-entry must be changed to
# WKZ_INC_UNDERGROUND_LEVEL = 21
# WKZ_DEC_UNDERGROUND_LEVEL = 22
simple_tool[21]=,HOME
simple_tool[22]=,END
this will increase / decrease the underground-level if the 'home' / 'end' keys are pressed. Ofcourse, different keys than 'home'/'end' can be defined.
Will this patch go into the trunk?
Modified, yes, like some mouse interaction and so on. Otherwise it would not be in the considered category. However, there are some other stuff not finished, which must be finished before. I will not promise any date though
Ok. No problem.
Updated the patch :)
Do you have any suggestions on additional gui elements?
The underground view toggler can be activated by menuconf.tab
# WKZ_SHOW_UNDERGROUND=15
# WKZ_INC_UNDERGROUND_LEVEL = 21
# WKZ_DEC_UNDERGROUND_LEVEL = 22
simple_tool[15]=,U
simple_tool[21]=,HOME
simple_tool[22]=,END
Of course the decrease / increase level tool can be integrated in a single tool that takes an additional parameter. Suggestions / wishes?
Problems:
If I used way tools, powerline tool and bridge tool on under ground mode, this will affect on the ground and build on ground.
These tools should be removed from toolbars.
Another problem.
In normal (overground) mode, when I build monorail track on vertical slope, it don't show.
But if I change to underground mode and change to normal mode again, it shows.
Same as http://forum.simutrans.com/index.php?topic=1089.msg18145#msg18145
[EDIT]
Another problem:
On normal ground mode, we can see the cars on harbor tunnels.
But on underground mode, we can't see the ways and the cars on harbor tunnels.
[EDIT2]
I don't know which is better, but anyway, please use different text, containing "up" or "down", instead of "change underground level".
These text are shown in keyboard help window.
And one more thing. When it is on height-cut mode, I often forget that it is on height-cut mode now. Is there any good idea which to know it is not on normal overground mode ?
[EDIT3]
I can use terraforming tool on height-cut mode. But sometimes forbidden with this message, "Terraforming not possible here in underground view"
I'm not sure which is correct.
Thank you for testing! I am almost blind for all these bugs. In particular, when they were fixed but came back after porting the patch. Modified patch file attached.
I would rather opt for (and infact implemented) a correct check in all the routines.
fixed
These harbor tunnels spoil the logic in the display routines :( Why dont you build a bridge there? I see no easy fix to that problem.
Do you refer to the in-game help? I did not touch this.
Ideally, simutrans should work in height-cut and in overground mode identical for the visible parts. So that it does not matter for playing which mode is currently active.
This is intended: terraforming is possible up to and including the height cut. So that one can build slopes to extend the underground area, and such that this new underground area is immediately available for building more underground structures without changing view modes.
If the tools should be integrated in a toolbar then yes :)
My question was, whether I should implement a different dialogue for the underground modes, which (maybe) pops up if one presses 'U' etc. This is also connected to z9999's question 'how to determine which mode is currently active'.
Are there suggestions how to design such a dialogue?
As to the "harbour tunnel" issue, might I suggest that, when underground slopes are implemented, the building of any further harbour tunnels be disabled, as it would then be possible to tunnel under the water using a slope? It should still be possible, however, to load existing saved games containing them, so as not to break people's existing saved games. Harbour tunnels in their present form are an anomaly.
I have painted some buttons some times ago.
I have it already :)
I know Prissi will kill me but underground slopes could be implemented in the trunk now ?
No, tooltips thing.
For example, wkz_change_city_size_t has 2 different text, "Grow city" and "Shrink city". Thus, each button can have each tooltips.
cl**** wkz_change_city_size_t : public werkzeug_t {
const char *get_tooltip(spieler_t *) { return translator::translate( atoi(default_param)>=0 ? "Grow city" : "Shrink city" ); }
Dialogue pop-up is the hell.
You can also use 3 toggle tooltips like wkz_show_name_t.
I like the idea to add a new mode "Toggle height-cut mode" instead of 3 toggle mode.
- "U" toggles underground mode just as old simutrans.
- "v", (for example), toggles height-cut mode.
But I'm not sure what prissi want to do.
I like the buttons!
I am divided. Toggling three modes seem easier to a necomer, as it is used also for citybuildings and station names. Logically, a seperate mode will be more clean. I also dislike seperate commands for changing the height.
My Idea would be a small window opening (and closing it would retrun to normal mode) with two bars or even a scrollbar from lowest to highest height in the game. This could be moved by mousewheel or PAGTE_UP/PAGE_DOWN then when the mouse is over the dialoge. It would also give a visiual indication where one is.
I like Prissi's idea for the GUI - that seems as if it would be intuitive and easy to use both for new and experienced players.
As for harbor tunnels, why you need to change old code ?
Current simutrans can show well harbor tunnels both on overground mode and underground mode.
What you did is only adding new height-cut mode isn't it ? Why these behavior should be changed on overground mode and underground mode.
what about this:
- WKZ_SHOW_UNDERGROUND for toggling 'complete underground view' - press 'U' in pak64
- WKZ_SLICED_UNDERGROUND with one parameter:
- 0 - toggle this view with height taken from cursor
- 1 / -1 increase / decrease underground level
- a new dialogue doing all this stuff in a gui for newcomers etc
But then there should be a possibility to configure simutrans in such a way, that you can access the underground mode without the GUI. Therefore I totally agree with z9999:
If you look at the patch, it is not an addition to the already implemented modes, it is in fact a full replacement. And I dont feel like rewriting everything for these harbour tunnels :/
"Under ground view" button on display setting window doesn't have 3 mode.
So, I can't change to underground mode by clicking this button.
One question. Overground mode and height-cut mode of height=20 is exactly the same ?
If so, why we need to toggle with overground mode and height-cut mode ?
If overground mode can change height level of view directly, we don't need height-cut mode, don't we ?
In that case, toggle overground mode and underground mode is enough.
yes you are right. Normal mode is equivalent to sliced mode with height level = +infinity ;)
Thank you.
Then I like toggle 2 mode than toggle 3 mode like as attached image.
In this case, toggling height-cut view and underground mode keeps last used height value, so we can easily continue construction.
Toggling 3 mode really breaks the continuity of our though.
Maybe you can make it (from player perspective) one continuous mode - from +∞ (full overground) through slices to -∞ (full underground).
this will not work, since sliced mode shows underground structures only on
one height, whereas full underground mode shows all underground structures.
I dont know whether I understood you right. Do you mean something like this:
Toggling underground ('U') switches between overground and underground view (and does nothing to height-cut view).
Toggling height-cut switches between height cut view and overground or underground view, depending which of the latter two was active previously. If height-cut is activated by keyboard then the z-coordinate of the cursor is taken for the cut height otherwise the last used value.
I must say, this looks better to me than the now implemented 'cycling through all view'.
More comments?
Dwachs - just making sure, I did not mean program-wise, only the GUI. That would make it actually look like one mode, regardless of implementation...
I want to play around with the underground mode a little bit myself, before submitting it. I never did so far really test the usability and so on.
Switching between normal view and sliced view is not a bad idea. This would only add commands for slicingup/down and turning off would be automatic. But there needs to be and additional interface as visual indication. Maybe in the lower right border just above the ticker line in slice mode there will be two arrows and a number. Not a real popup.
This works well with keyboard shortcut and very useful, I like this.
But if we clicked on toolbar button to toggle height-cut view, height will be the height of behind toolbar button. In many cases, this height not what we wanted to see, and also up and down height one by one is very heavy for large map.
This is frustration about current UI.
in this case one can use the last selected height or the height of the tile in the middle of the screen.
what do you mean is frustrating?
I updated and uploaded the patch:
http://simutrans-germany.com/~patches/upload/underground-2497.patch
New version of the patch:
http://simutrans-germany.com/~patches/upload/underground-2518.patch
I modified the toggling of the different view. Now there is only one tool that does the job: general_tool[34] or simple_tool[15].
Both are identic, except that general tools can have cursors etc, which a simple-tool (the original underground toggle) does not have.
Here is my modification of the pak64 menuconf.tab, which explains the use of the tools and its parameters. All tools (except with parameter K) can be realized with buttons in a toolbar. All tools (except C) can be toggled by keyboard only.
# ****ign a cursor image to the underground tool
general_tool[34]=,7,,
# ...
# add underground tools as invisible tools to the main toolbar
# 0) with parameter U .. toggles complete undergroundview (key U here)
toolbar[0][27]=general_tool[34],,U,U
# 1) with parameter I .. increases slice height with key HOME
toolbar[0][27]=general_tool[34],,HOME,I
# 2) with parameter D .. decreases slice height with key END
toolbar[0][28]=general_tool[34],,END,D
# 3) with parameter K .. toggles sliced view with height taken from tile under cursor (key ctrl-u)
toolbar[0][29]=general_tool[34],,^U,K
# 4) with parameter K .. toggles sliced view with height taken from tile under cursor by an extra mouse click (key ctrl-c)
toolbar[0][30]=general_tool[34],,^C,C
I will have a look at it today. Not sure, if the one tool idea survives though.
I re-uploaded the patch.
The patch needs several strings to be translated:
two error messages:
Terraforming not possible\nhere in underground view
Cannot built this station/building\nin underground mode here.
tooltips:
sliced underground mode
decrease underground view level
increase underground view level
Submitted, but there is still an error, if I lower the slice below sealevel by the manual tools (even though this might be useful, if harbourtunnels will be forbidden to built in next versions).
Excellent - I am very glad to see this incorporated into the trunk. One or two questions and comments if I may:
1. Does this incorporate the underground slopes patch?
2. Is it possible to change the colour for the shading of the 3d cursor in pakset configuration files (rather than the code), and, if so, where?
3. Might I suggest that an option be added to be able to change heights by CTRL+scroll wheel instead of or as well as the HOME/END keys?
4. One somewhat unintuitive aspect of this feature is the fact that, at any given level of underground view, no lower layers are shown, even if there is nothing on top of them. Might I suggest that, in a future release, all layers under the surface of the ground are considered transparent so that it is possible to see multiple underground layers at once? This would be different from the old underground view, in that, whilst one would see all underground layers at or below the current view height level, one would not see the higher underground layers, if any. Nonetheless, such a feature, I think, would be more intuitive and ****ist with the design of underground networks.
Thank you all those who have worked on this excellent patch :-)
Does this imply that we will be able to tunnel under the ocean?
No, not yet. But in some future maybe. There is a patch around, which needs updating.
You can specify the cursor_overlay_color in simuconf.tab. Or what else do you mean?
You can at least change HOME/End to other keys in menuconf.tab. I dont know whether ctrl+scroll will work or not, or is wanted or not.
I corrected this, however a nice way to impose restrictions on the slice level is still missing...
Dwachs,
thank you for the replies :-) The cursor_overlay_color setting: does that require numbers or words? I.e., ought one set cursor_overlay_color=1024 (etc.) or cursor_overlay_color=yellow?
Look in here:
http://forum.simutrans.com/index.php?topic=1940.msg20840#msg20840
It is very nice to show height level on menu button. Thank you, I like this veru much.
BTW, does draw_after() could show images too ? For example, showing comp**** azimuth on WKZ_ROTATE90 button.
THis should be possible, if the required images are loaded. For instance if there is image 7,8,9,10 in simple tools, but only the first is used for the tool, then it could just display (icon+rotation) for the new image number. (They are registered consequtively.)
Problem:
1. Toggle slice mode
2. Up/Down slice mode
3. Toggle slice mode
Result:
It will be full undeerground mode instead of overground mode.
[edit]
Another problems
1. Toggle on slice mode
2. Toggle on underground mode
3. Toggle off underground mode
Result:
It will be overground mode instead of slice mode
Toggle mode with "K" key doesn't toggle mode.
Yes you are right, this has to be modified for true toggling. I will look into that tonight.
My patch for this.
http://simutrans-germany.com/files/upload/0008-slice-fixed.patch.txt
diff --git a/gui/colors.cc b/gui/colors.cc
index 949993c..1a63daa 100644
--- a/gui/colors.cc
+++ b/gui/colors.cc
@@ -22,44 +22,45 @@
#include "../utils/simstring.h"
-#define MAX_BUTTONS (20)
+#define MAX_BUTTONS (21)
// y coordinates
#define GRID_MODE (0*13+6)
#define UNDERGROUND (1*13+6)
-#define DAY_NIGHT (2*13+6)
-#define BRIGHTNESS (3*13+6)
-#define SCROLL_INVERS (4*13+6)
-#define SCROLL_SPEED (5*13+6)
+#define SLICE (2*13+6)
+#define DAY_NIGHT (3*13+6)
+#define BRIGHTNESS (4*13+6)
+#define SCROLL_INVERS (5*13+6)
+#define SCROLL_SPEED (6*13+6)
-#define SEPERATE1 (6*13+6)
+#define SEPERATE1 (7*13+6)
-#define USE_TRANSPARENCY (6*13+6+4)
-#define HIDE_TREES (7*13+6+4)
-#define HIDE_CITY_HOUSES (8*13+6+4)
+#define USE_TRANSPARENCY (7*13+6+4)
+#define HIDE_TREES (8*13+6+4)
+#define HIDE_CITY_HOUSES (9*13+6+4)
-#define SEPERATE2 (9*13+6+4)
+#define SEPERATE2 (10*13+6+4)
-#define USE_TRANSPARENCY_STATIONS (9*13+6+2*4)
-#define SHOW_STATION_COVERAGE (10*13+6+2*4)
-#define SHOW_STATION_SIGNS (11*13+6+2*4)
-#define SHOW_STATION_GOODS (12*13+6+2*4)
+#define USE_TRANSPARENCY_STATIONS (10*13+6+2*4)
+#define SHOW_STATION_COVERAGE (11*13+6+2*4)
+#define SHOW_STATION_SIGNS (12*13+6+2*4)
+#define SHOW_STATION_GOODS (13*13+6+2*4)
-#define SEPERATE3 (13*13+6+2*4)
+#define SEPERATE3 (14*13+6+2*4)
-#define CITY_WALKER (13*13+6+3*4)
-#define STOP_WALKER (14*13+6+3*4)
-#define DENS_TRAFFIC (15*13+6+3*4)
-#define CONVOI_TOOLTIPS (16*13+6+3*4)
+#define CITY_WALKER (14*13+6+3*4)
+#define STOP_WALKER (15*13+6+3*4)
+#define DENS_TRAFFIC (16*13+6+3*4)
+#define CONVOI_TOOLTIPS (17*13+6+3*4)
-#define SEPERATE4 (17*13+6+3*4)
+#define SEPERATE4 (18*13+6+3*4)
-#define FPS_DATA (17*13+6+4*4)
-#define IDLE_DATA (18*13+6+4*4)
-#define FRAME_DATA (19*13+6+4*4)
-#define LOOP_DATA (20*13+6+4*4)
+#define FPS_DATA (18*13+6+4*4)
+#define IDLE_DATA (19*13+6+4*4)
+#define FRAME_DATA (20*13+6+4*4)
+#define LOOP_DATA (21*13+6+4*4)
-#define BOTTOM (21*13+6+12+5*4)
+#define BOTTOM (22*13+6+12+5*4)
// x coordinates
#define RIGHT_WIDTH (220)
@@ -145,14 +146,6 @@ color_gui_t::color_gui_t(karte_t *welt) :
buttons[16].set_typ(button_t::square_state);
buttons[16].set_text("underground mode");
- inp_underground_level.set_pos(koord(NUMBER_INP, UNDERGROUND) );
- inp_underground_level.set_groesse( koord(50,12));
- inp_underground_level.set_value( grund_t::underground_level );
- inp_underground_level.set_limits(welt->get_grundw****er(), 20);
- add_komponente(&inp_underground_level);
- inp_underground_level.add_listener(this);
-
-
buttons[17].set_pos( koord(10,GRID_MODE) );
buttons[17].set_typ(button_t::square_state);
buttons[17].set_text("show grid");
@@ -167,6 +160,17 @@ color_gui_t::color_gui_t(karte_t *welt) :
buttons[19].set_text("show waiting bars");
buttons[19].pressed = umgebung_t::show_names&1;
+ buttons[20].set_pos( koord(10,SLICE) );
+ buttons[20].set_typ(button_t::square_state);
+ buttons[20].set_text("sliced underground mode");
+
+ inp_underground_level.set_pos(koord(NUMBER_INP, SLICE) );
+ inp_underground_level.set_groesse( koord(50,12));
+ inp_underground_level.set_limits(welt->get_grundw****er(), 20);
+ inp_underground_level.set_value( grund_t::underground_level );
+ add_komponente(&inp_underground_level);
+ inp_underground_level.add_listener(this);
+
// left/right for convoi tooltips
buttons[0].set_pos( koord(10,CONVOI_TOOLTIPS) );
buttons[0].set_typ(button_t::arrowleft);
@@ -226,8 +230,8 @@ color_gui_t::action_triggered( gui_action_creator_t *komp, value_t v)
umgebung_t::station_coverage_show = umgebung_t::station_coverage_show==0 ? 0xFF : 0;
} else if((buttons+16)==komp) {
// see simwerkz.cc::wkz_show_underground_t::init
- grund_t::set_underground_mode(grund_t::underground_mode ^ grund_t::ugm_level, inp_underground_level.get_value());
- buttons[16].pressed = grund_t::underground_mode == grund_t::ugm_level;
+ grund_t::set_underground_mode(buttons[16].pressed ? grund_t::ugm_none : grund_t::ugm_all, inp_underground_level.get_value());
+ buttons[16].pressed = grund_t::underground_mode == grund_t::ugm_all;
// calc new images
welt->update_map();
// renew toolbar
@@ -238,6 +242,14 @@ color_gui_t::action_triggered( gui_action_creator_t *komp, value_t v)
umgebung_t::show_names ^= 1;
} else if((buttons+19)==komp) {
umgebung_t::show_names ^= 2;
+ } else if((buttons+20)==komp) {
+ // see simwerkz.cc::wkz_show_underground_t::init
+ grund_t::set_underground_mode(buttons[20].pressed ? grund_t::ugm_none : grund_t::ugm_level, inp_underground_level.get_value());
+ buttons[20].pressed = grund_t::underground_mode == grund_t::ugm_level;
+ // calc new images
+ welt->update_map();
+ // renew toolbar
+ werkzeug_t::update_toolbars(welt);
} else if (komp == &inp_underground_level) {
if(grund_t::underground_mode==grund_t::ugm_level) {
grund_t::underground_level = inp_underground_level.get_value();
@@ -262,10 +274,11 @@ void color_gui_t::zeichnen(koord pos, koord gr)
// can be changed also with keys ...
buttons[11].pressed = umgebung_t::hide_trees;
buttons[15].pressed = umgebung_t::station_coverage_show;
- buttons[16].pressed = grund_t::underground_mode == grund_t::ugm_level;
+ buttons[16].pressed = grund_t::underground_mode == grund_t::ugm_all;
buttons[17].pressed = grund_t::show_grid;
buttons[18].pressed = umgebung_t::show_names&1;
buttons[19].pressed = (umgebung_t::show_names&2)!=0;
+ buttons[20].pressed = grund_t::underground_mode == grund_t::ugm_level;
gui_frame_t::zeichnen(pos, gr);
diff --git a/gui/colors.h b/gui/colors.h
index dfcf525..ea3e917 100644
--- a/gui/colors.h
+++ b/gui/colors.h
@@ -13,7 +13,7 @@ cl**** color_gui_t : public gui_frame_t, private action_listener_t
{
private:
karte_t *welt;
- button_t buttons[20];
+ button_t buttons[21];
gui_numberinput_t brightness, scrollspeed, traffic_density, inp_underground_level;
public:
diff --git a/simwerkz.cc b/simwerkz.cc
index 53b60e9..549e88a 100644
--- a/simwerkz.cc
+++ b/simwerkz.cc
@@ -3670,8 +3670,16 @@ bool wkz_show_underground_t::init( karte_t *welt, spieler_t * )
switch(default_param[0]) {
// toggle sliced view by toolbar - height taken from extra mouse click
case 'C':
- needs_click = true;
- ok = false;
+ if(grund_t::underground_mode==grund_t::ugm_level) {
+ grund_t::set_underground_mode( grund_t::ugm_none, 0);
+ }
+ else if(grund_t::underground_mode==grund_t::ugm_none) {
+ needs_click = true;
+ ok = false;
+ }
+ else {
+ ok = false;
+ }
break;
// decrease slice level
case 'D':
@@ -3696,18 +3704,22 @@ bool wkz_show_underground_t::init( karte_t *welt, spieler_t * )
case 'K':
if(grund_t::underground_mode==grund_t::ugm_level) {
// switch to normal or full-underground
- grund_t::set_underground_mode( save_underground_level==127 ? grund_t::ugm_none : grund_t::ugm_all, 0);
+ grund_t::set_underground_mode( grund_t::ugm_none, 0);
+
}
- else {
+ else if(grund_t::underground_mode==grund_t::ugm_none) {
grund_t::set_underground_mode( grund_t::ugm_level, zpos.z);
}
+ else {
+ ok = false;
+ }
break;
// switch between full underground or normal/sliced view
case 'U':
if (grund_t::underground_mode==grund_t::ugm_all) {
// switch back to normal or sliced view
- grund_t::set_underground_mode( grund_t::ugm_none, 0); // save_underground_level==127 ? grund_t::ugm_none : grund_t::ugm_level, save_underground_level);
+ grund_t::set_underground_mode( save_underground_level==127 ? grund_t::ugm_none : grund_t::ugm_level, save_underground_level);
}
else {
grund_t::set_underground_mode( grund_t::ugm_all, 0);
--
1.6.3.2.1299.gee46c
Might I ask - is it possible to have an underground mode button in the menu bar? If it is, how would one go about setting that up in menuconf.tab?
Looking at the sources of pak64 or simmenu.cc will tell you ...
I can't find any controls in the latest Pak64 nightly binary - has it made it there yet?
Here I described all underground tools and how to use them in menuconf.tab:
http://forum.simutrans.com/index.php?topic=1089.msg24655#msg24655
The second parameter here:
toolbar[I][J]=general_tool[34],ICON_NUMBER,KEY,U
may hold an icon number (once an icon exists). So numbers I and J, ICON_NUMBER and KEY, are up to the menuconf.tab writers
why did you remove the possibility to trigger sliced mode when in full underground mode?
You can change it if you don't like it.