Since there's no rotate function in the map editor...

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

Post Reply
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Since there's no rotate function in the map editor...

Post by turin »

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.
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
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

- 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:

Code: Select all

int main(int argc, char* argv[])
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:

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";
    }
}
Run the program with some arguments, and it'll print them out.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

Sorry, here is actual file...
Attachments
rotate.tar.gz
(1.64 KiB) Downloaded 732 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
Ayin
Inactive Developer
Posts: 294
Joined: March 30th, 2004, 4:45 pm
Location: Nîmes, France
Contact:

Post by Ayin »

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
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
User avatar
DEATH_is_undead
Posts: 960
Joined: March 4th, 2007, 3:00 pm
Location: Northern United States

Post by DEATH_is_undead »

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.
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Post by Eleazar »

DEATH_is_undead wrote:I think i'm interested, how does it work?
It probably doesn't, since the map format has changed several times since 2005.
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
User avatar
DEATH_is_undead
Posts: 960
Joined: March 4th, 2007, 3:00 pm
Location: Northern United States

Post by DEATH_is_undead »

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.
Post Reply