Since there's no rotate function in the map editor...
Moderator: Forum Moderators
Since there's no rotate function in the map editor...
I had dacyn write a simple C++ program that will take a map and rotate it 60 degrees clockwise. The extra space is filled with shroud. Dacyn is still learning C++, so its not very good, but it is useable. Code (rotate.cpp) and executable (rotate) included in zip.
The algorithm for rotating the map will be useful to anyone who wants to write a patch adding a rotate function to the map editor.
Since Dacyn doesn't really know C++ / is lazy, it will not accept arguments on input. You have to copy your map to a file called "temp" and run the program in the same directory as that file. The output will go back to "temp".
Anyway, it would be cool if someone who is good with C++ could improve this program and/or use it as inspiration for adding a rotate function to the map editor.
The algorithm for rotating the map will be useful to anyone who wants to write a patch adding a rotate function to the map editor.
Since Dacyn doesn't really know C++ / is lazy, it will not accept arguments on input. You have to copy your map to a file called "temp" and run the program in the same directory as that file. The output will go back to "temp".
Anyway, it would be cool if someone who is good with C++ could improve this program and/or use it as inspiration for adding a rotate function to the map editor.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
- The zip file is empty, other than having one directory in it
- It'd be cool if the functionality was added to the map editor
- To access program arguments in C++, you just declare main like this:
and then 'argc' contains the number of arguments, and 'argv' contains the array of arguments. The first argument is actually the command used to run the program. For instance, a simple test program that shows you how to access arguments is this:
Run the program with some arguments, and it'll print them out.
David
- It'd be cool if the functionality was added to the map editor
- To access program arguments in C++, you just declare main like this:
Code: Select all
int main(int argc, char* argv[])
Code: Select all
#include <iostream>
int main(int argc, char* argv[])
{
for(int i = 0; i != argc; ++i) {
std::cout << "argument " << i << " is '" << argv[i] << "'\n";
}
}
David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
Sorry, here is actual file...
- Attachments
-
- rotate.tar.gz
- (1.64 KiB) Downloaded 733 times
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
-
- Inactive Developer
- Posts: 294
- Joined: March 30th, 2004, 4:45 pm
- Location: Nîmes, France
- Contact:
There already is a rotation algorithm implemented in the wesnoth code, although it is not in the editor. Look at the "builder.cpp" source code.
Cheers,
Ayin
Cheers,
Ayin
I would never talk to that person about boa constrictors, or primeval forests, or stars. I would bring myself down to his level. I would talk to him about bridge, and golf, and politics, and neckties. -- Antoine de Saint-Exupéry, in Le Petit Prince
- DEATH_is_undead
- Posts: 960
- Joined: March 4th, 2007, 3:00 pm
- Location: Northern United States
I think i'm interested, how does it work?
3P MP Scenario - Great Dwarves Escape
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.
- Eleazar
- Retired Terrain Art Director
- Posts: 2481
- Joined: July 16th, 2004, 1:47 am
- Location: US Midwest
- Contact:
It probably doesn't, since the map format has changed several times since 2005.DEATH_is_undead wrote:I think i'm interested, how does it work?
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
-> What i might be working on
Attempting Lucidity
- DEATH_is_undead
- Posts: 960
- Joined: March 4th, 2007, 3:00 pm
- Location: Northern United States
i still got 1.0.2. it'll probaly work on that.
3P MP Scenario - Great Dwarves Escape
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.