Page 1 of 1

MUL-ling around

Posted: Sun Aug 30, 2020 8:12 pm
by Mindless Automaton
I have an old 768x512 MUL I started messing around with.

UOX3 doesn't load the file, CEDServer & UOFiddler load the file.

There is a program called radmapcopy that will enlarge the file to 896x512 and then UOX3 loads the file, CEDServer & UOFiddler doesn't load the file.

Any thoughts on making everything happy with the same file?

Thanks!

Re: MUL-ling around

Posted: Sun Aug 30, 2020 8:32 pm
by Xuri
Try specifying the correct map size in DFNDATA\MAPS\maps.dfn! Correct size for your map would be X=6144 (768x8) and Y=4096 (512x8).
Alternatively, in the same folder, rename the file named maps.4xclients.old to maps.dfn (backup the original one), as that already has these sizes pre-defined.

Re: MUL-ling around

Posted: Mon Aug 31, 2020 4:14 pm
by Mindless Automaton
Xuri wrote:Try specifying the correct map size in DFNDATA\MAPS\maps.dfn! Correct size for your map would be X=6144 (768x8) and Y=4096 (512x8).
Alternatively, in the same folder, rename the file named maps.4xclients.old to maps.dfn (backup the original one), as that already has these sizes pre-defined.
Ok thanks, changing the size allowed the map to be used.

Do you know of any tools that would resize the MUL or do I need to export to BMP, resize, then MUL it again?

Might have to fire up the old WinXP laptop or something for some of these older tools. :o

Thanks!

Re: MUL-ling around

Posted: Mon Aug 31, 2020 5:05 pm
by Xuri
You could try your luck with one of punt's old tools, hosted here at Ryandor's site:
http://www.ryandor.com/files/punt/3%20-%20Other%20Files%20&%20Utilities/ML%20Map%20Extender/

Re: MUL-ling around

Posted: Wed Sep 09, 2020 2:20 am
by Mindless Automaton
Xuri wrote:You could try your luck with one of punt's old tools, hosted here at Ryandor's site:
http://www.ryandor.com/files/punt/3%20-%20Other%20Files%20&%20Utilities/ML%20Map%20Extender/
Ok, I added that stuff to my collection of tools. I will report back when I get motivated enough to try it.
Just been making a lot of swampland in CentrED, vacation without getting COVID, etc.

Re: MUL-ling around

Posted: Sat Sep 19, 2020 2:47 am
by Mindless Automaton
Mindless Automaton wrote:
Xuri wrote:You could try your luck with one of punt's old tools, hosted here at Ryandor's site:
http://www.ryandor.com/files/punt/3%20-%20Other%20Files%20&%20Utilities/ML%20Map%20Extender/
Ok, I added that stuff to my collection of tools. I will report back when I get motivated enough to try it.
Just been making a lot of swampland in CentrED, vacation without getting COVID, etc.
MLExtender says the map is not the correct size to extend.

Anyways, what would be the best way to build houses and stuff nowadays? I think I may be done with terrain editing for now.

Re: MUL-ling around

Posted: Sat Sep 19, 2020 5:00 pm
by Xuri
You could also check the "RadStar Edition" of WorldForge for the map increase part: https://uo.wzk.cz/worldforge/

From its changelog:
Enlarge map to ML (in EXTRA menu) - Create new map0.mul with
Mondain's Legacy size and copy other map into this

Re: MUL-ling around

Posted: Sun Sep 20, 2020 8:12 am
by punt
If you need something to change your map/staidx to a different size, I can offer you a command line program to do that.

basically it would need to know the original block size, and the new desired block size. It would need to know the map.mul file, and the staidx.mul file.
it would also need to know the land tile id and altitude to use for any new blocks it creates

so basically the command line would look like (assuming mapsize is the name of the program):

mapsize oldxblock oldyblock newxblock newyblock mappath stapath tileid alt.

Is that of interest ?

Re: MUL-ling around

Posted: Sun Sep 20, 2020 3:29 pm
by punt
This would be the program for what I described. Xuri could probably make you a windows exe If needed. Xuri is debugging, so if there is a problem, I will update this code with the fixed version.
This makes two files with the extension ".resized". It does not write to the two files you supply, so it won't corrupt.
//
//  main.cpp
//  mapsize
//
//  Created by Charles Kerr on 9/20/20.
//

#include <iostream>
#include <filesystem>
#include <fstream>
#include <cstring>
#include <string>
#include <exception>

// Forward declares
void fillMapBlock(std::ofstream& output, unsigned short tileid, char alt, int header);

int main(int argc, const char * argv[]) {
   
    if (argc < 9) {
        std::cerr <<"Insufficient arguments" << std::endl;
        std::cerr <<"Calling sequence is:"<<std::endl;
        std::cerr <<"'mapsize oldXblksize oldYblksize newXblksize newYblksize mapmulpath staidxpath tileid altitude'"<<std::endl;
        return 1;
    }
    int oldX = 0 ;
    int oldY = 0 ;
    int newX = 0 ;
    int newY = 0 ;
    std::string mapfile ;
    std::string stafile ;
    unsigned short tileid = 0  ;
    char alt = 0 ;
    try {
        oldX = std::stoi(std::string(argv[1]),0,0) ;
        oldY = std::stoi(std::string(argv[2]),0,0) ;
        newX = std::stoi(std::string(argv[3]),0,0) ;
        newY = std::stoi(std::string(argv[4]),0,0) ;
        mapfile = std::string(argv[5]) ;
        stafile = std::string(argv[6]) ;
        tileid = static_cast<unsigned short>(std::stoi(std::string(argv[7]),0,0));
        alt = static_cast<char>(std::stoi(std::string(argv[8]),0,0));
       
       
    }
    catch (const std::exception& e) {
        std::cerr <<"Error converting arguments: " << e.what() << std::endl;
        return 1 ;
    }
   
    auto nmapfile = mapfile + ".resized" ;
    auto nstafile = stafile + ".resized" ;
    auto mapsize = std::filesystem::file_size(std::filesystem::path(mapfile));
    if (mapsize < (oldX*oldY * 196)) {
        std::cerr << "Specified old x/y blocksize is larger then mapfile size"<< std::endl;
        return 1 ;
    }
    // We know the file size is at least big enough, so we can read it now
    std::ifstream mapinput(mapfile,std::ifstream::in | std::ifstream::binary) ;
    if (!mapinput.is_open()) {
        std::cerr <<"Unable to open file: "<< mapfile <<std::endl;
        return 1;
    }
    std::ifstream stainput(stafile,std::fstream::in | std::ifstream::binary);
   
    if (!stainput.is_open()){
        std::cerr <<"Unable to open file: "<< mapfile <<std::endl;
        return 1;
       
    }
   
    // Both files are open,now open the new ones
    std::ofstream mapoutput(nmapfile,std::ofstream::out|std::ofstream::binary) ;
    if (!mapoutput.is_open()){
        std::cerr <<"Unable to create file: "<< nmapfile <<std::endl;
        return 1;
       
    }
    std::ofstream staoutput(nstafile,std::ofstream::out|std::ofstream::binary) ;
    if (!staoutput.is_open()){
        std::cerr <<"Unable to create file: "<< nstafile <<std::endl;
        mapoutput.close();
        std::filesystem::remove(std::filesystem::path(nmapfile));
        return 1;
       
    }
   
    // Now we have all files opened!
    char mapblock[196];
    char idxblock[12];
    int invalid = -1;
    int zero = 0 ;
   
    for ( auto x = 0 ; x < oldX ; x++){
        if (x >= newX) {
            // we are DONE!
            break;
        }
        for (auto y = 0 ; y < oldY; y++) {
            mapinput.read(mapblock,196);
            stainput.read(idxblock,12);
            if (y < newY) {
                mapoutput.write(mapblock, 196);
                staoutput.write(idxblock,12);
            }
        }
        // Do we have any blank y blocks we need to add?
        auto addblock = newY - oldY ;
        if (addblock > 0) {
            for (auto y=0 ; y< addblock; y++) {
                fillMapBlock(mapoutput, tileid, alt, zero);
                staoutput.write(reinterpret_cast<char*>(&invalid),4);
                staoutput.write(reinterpret_cast<char*>(&zero),4);
                staoutput.write(reinterpret_cast<char*>(&zero),4);
               
            }
        }
       
       
    }
    auto addblock = newX - oldX ;
    for (auto x = 0 ; x<addblock;x++) {
        for (auto y = 0 ; y < newY; y++) {
            fillMapBlock(mapoutput, tileid, alt, zero);
            staoutput.write(reinterpret_cast<char*>(&invalid),4);
            staoutput.write(reinterpret_cast<char*>(&zero),4);
            staoutput.write(reinterpret_cast<char*>(&zero),4);
        }
    }
   
    staoutput.close();
    mapoutput.close();
    mapinput.close();
    stainput.close();
   
   
    return 0;
}

void fillMapBlock(std::ofstream& output, unsigned short tileid, char alt, int header) {
    output.write(reinterpret_cast<char*>(&header),4);
    for (auto i=0 ; i < 64; i++){
        output.write(reinterpret_cast<char*>(&tileid),2);
        output.write(&alt,1);
    }
   
}

Re: MUL-ling around

Posted: Sun Sep 20, 2020 4:33 pm
by Xuri
I compiled a version for 64bit Windows users, but not sure if it works with Windows 7... it also includes the source punt posted above, as well as some instructions on how to use it, with explanation of parameters and a couple of working examples. See attached file!
mapsize_x64_with_source.zip
mapsize - a map resizer for Ultima Online (by punt)
(23.51 KiB) Downloaded 262 times

Re: MUL-ling around

Posted: Mon Sep 21, 2020 8:20 pm
by Xuri
Another tool by punt - Freeze:
A command line tool that can freeze items (and multis) with TYPE=255 from UOX3's 0.99.x .wsc worldfiles into staidx#/statics#.mul files based on the worldnumber of the items in question. At the same time, it will remove affected items from the wsc files. Updated files are saved with .frozen file extension, and original files are not modified.
freeze_x64_with_source.zip
Freeze - a tool to freeze items into statics (by punt)
(75.15 KiB) Downloaded 262 times

Re: MUL-ling around

Posted: Sat Sep 26, 2020 5:16 am
by Mindless Automaton
Xuri wrote: Sun Sep 20, 2020 4:33 pm I compiled a version for 64bit Windows users, but not sure if it works with Windows 7... it also includes the source punt posted above, as well as some instructions on how to use it, with explanation of parameters and a couple of working examples. See attached file!
mapsize_x64_with_source.zip
ok, resized, worked with all programs, thanks!

Next will be freeze, then convert to UOP to use with latest client i guess.

Re: MUL-ling around

Posted: Sat Sep 26, 2020 7:32 pm
by Mindless Automaton
Mindless Automaton wrote: Sat Sep 26, 2020 5:16 am ok, resized, worked with all programs, thanks!

Next will be freeze, then convert to UOP to use with latest client i guess.
Ok, i skipped freeze for now but I was able to use UOFiddler to convert MULs to UOP, drop them in UOX3 and Classic Client and then log in and run around the map a bit.

However CentrEd doesn't like the UOP for some reason. Not a big deal though, would just have to finalize everything as MUL and then convert.

Re: MUL-ling around

Posted: Sat Sep 26, 2020 7:39 pm
by Xuri
Does CentrEd usually work directly with uop files?

Re: MUL-ling around

Posted: Sun Sep 27, 2020 4:35 am
by Mindless Automaton
Xuri wrote: Sat Sep 26, 2020 7:39 pm Does CentrEd usually work directly with uop files?
http://dev.uoquint.ru/projects/centred/ ... rver_setup

They have format/prefix numbers for it. I thought I got it working once, but I can't seem to get it going again. :(