Kuribo64
Views: 23,105,686 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
12-06-24 08:22 PM
Guest:

0 users reading [Tutorial] How to Import Custom Minimaps | 1 bot

Main - General SM64DS hacking - [Tutorial] How to Import Custom Minimaps Hide post layouts | New reply


Fiachra
Posted on 06-15-15 11:05 AM Link | #61014
This tutorial will document the process of importing custom minimaps using SM64DSe.

There are 2 issues that need to be taken into consideration when replacing a level's minimap:
  • Minimap size (height and width)
  • Whether there's a portion of the minimap whose presence is hardcoded eg. the ship in J.R.B.
  • Whether the minimap is used for multiple layers within the level eg. top floor and bottom floor using different parts of minimap

Only the first two will be covered as the third is not implemented in the editor (although it may be n future, it wouldn't be too difficult).

This tutorial will go over three examples:
  • 128x128 minimap
  • 256x256 minimap
  • 128x128 minimap with a hardcoded extra portion

The first issue, the size is hardcoded for each level and cannot be changed (yet, I've never looked into where it's stored) and is either 128x128 or 256x256.

The Minimap and Image Editor:
First, open the "Minimap and Image Editor". This is done through opening the level whose minimap you want to edit and clicking on "Minimap" along the top.
You will see something like the following:
[thumbnail]

1 - "Is Minimap": This was added due to differences in how minimap ISC (NSC) files are arranged compared to the rest of the images in the game and needs to be set to true if you want to view the minimap using an ISC file eg. when a level has more than one ISC file.

Note: This will be discussed further in the examples.

2 - "Bits Per Pixel": For minimaps this is always 8. The setting "Palette Row" is not used for 8 BPP images.

3 - "Width and Heigth": Specifies the image's width and height both for viewing, importing and exporting. When "Is Minimap" is set to true, the width and height must match that of the minimap size ie. 128x128 or 256x256.

4 - "Graphic NCG": NCG or ICG for minimaps is the file that contains an image's data, giving for each pixel the index of its colour within the palette.

5 - "Palette NCL": NCL or ICL for minimaps holds the list of colours available in the image.

6 - "Screen NSC": NSC or ISC files are used to split an image into 8x8 tiles and specify the tile number of each 8x8 block. Eg. if a single NCG file is used for multiple areas of a level, an ISC file is used to hide unwanted parts of the image so that the whole level map is not visible at once.

7 - "Set Selected as Background": Allows specifying the colour that will be shown outside the border of the minimap during the game. The background colour is determined as the first palette colour. To change the background colour, select the colour you want within the palette by clicking on it and click on this button. This will re-arrange the palette's colours so that the selected colour comes first.

8 - "Co-ordinate Scale": Used to control the scale of the player's co-ordinates in relation to the minimap. Typically finding the correct value will be a matter of trial-and-error.

Custom Minimap File Formats
Images to be imported as custom minimaps MUST be:
  • In Bitmap (BMP) format
  • Indexed, between 1 and 256 colours
Your image will not work otherwise.

Tips for creating a minimap
Note: This assumes that you're using Blender.

You will need to make sure when creating a minimap that the centre of the image corresponds with the centre or origin of the model to ensure that Mario's position is shown correctly.
To shown the model's origin, enter Object Mode, select the model and press '7' to enter 'Top' view and depending on your version you amy need to press '5' to enter orthogonal view. The origin is shown with the red, green and blue arrows eg.:
[thumbnail]
Take a screenshot and hold on to that image.

For the minimap itself you can either take a screenshot in your 3D modelling program similar to above but without any axes indicators visible or you can use SM64DSe. To use SM64DSe, import your model and position the camera so that it's looking down on your model eg.:
[thumbnail]

Once positioned, click on the button "Orthogonal View" near the top right corner and position the camera so it's looking straight down (use known straight edges to help judge). Note: use 'Pg Up'/'Pg Dn' to zoom in/out and 'Home'/'End' to change the clipping level:
[thumbnail]
Take and save a screenshot.

Use the screenshot you took earlier to create a minimap with the centre of the model lining up with the centre of the image:
[thumbnail]
The image in the centre is correct; the centre of the image and the centre/origin of the model match whilst the second image is incorrect; the origin of the model doesn't line up with the image's centre.

If the map is incorrectly rotated upon importing, just keep rotating your image by 90 degrees until it's the right way around.

Examples:

Note: I have used Photoshop below but any that supports layers and indexing images eg. GIMP should be fine as well.

Example 1 - 128x128 minimap: Bob-Omb Battlefield
  • Open the minimap editor for B.O.B., leaving the settings as they are:
    [thumbnail]
  • For B.O.B. you will need a image with width and height of 128 pixels and meeting the stated requirements eg.:
    this image
  • Click "Import" in the top right-hand corner and select your custom minimap. Your custom minimap will then be imported:
    [thumbnail] [thumbnail]
  • To change the background colour to green, click on one of the green squares in the palette and click "Set Selected as Background":
    [thumbnail] [thumbnail]
  • That's it done.

Example 2 - 256x256 minimap: Playroom
  • Open the minimap editor for the Playroom, leaving the settings as they are:
    [thumbnail]
  • For the Playroom you will need a image with width and height of 256 pixels and meeting the stated requirements eg.:
    this image
  • Click "Import" in the top right-hand corner and select your custom minimap. Your custom minimap will then be imported:
    [thumbnail] [thumbnail]
  • Now the minimap's imported but its size looks a bit big. To change the scale, open the Level Editor and click on the "Misc" button along the top. Click on "Add Misc. Object" followed by "Minimap Scale":
    [thumbnail]
  • Set a value for the minimap scale with zero being zoomed in as far possible and gradually zooming out as you move away from zero:
    [thumbnail] [thumbnail]
  • Finally, we need to set the background colour; click on the colour within the palette you want as the background, here I've chosen a blue and click on "Set Selected as Background":
    [thumbnail] [thumbnail]
  • That's it done.

Example 3 - 128x128 minimap with hard-coded portion: Whomp's Fortress
  • Open the minimap editor for W.F.:
    [thumbnail]
    You'll notice that there's no tower visible in this minimap; change the settings as shown below and click on "Load Image":
    [thumbnail]
  • We need to be careful when importing our custom map to ensure that this is taken into account, whatever image data is in that square will be copied over the main image where the tower would be for star ID greater than 1.
  • Prepare a 128x128 custom minimap for the level, eg:
    this image
  • We want the minimap to always look like this so we need to copy the part of the minimap that would be replaced with the "tower" section into the lower right-hand corner at the same size as in the original map:
    • Export the original minimap:
      [thumbnail]
    • Open the exported minimap (EM) and your custom minimap (CM) in Photoshop and ensure that the Image Mode of the exported minimap is "RGB colour".
    • Within EM: "Layer > New > Background from layer"
    • Hit "OK"
    • Select all of and copy your custom minimap and paste it into the top left-hand corner of EM:
      [thumbnail]
    • Make the CM layer invisible and select the EM layer.
    • Use the Marquee tool to select the tower section in the bottom-right-hand corner and then use the Move tool to position it over the correct position on the minimap:
      [thumbnail]
    • Once it's positioned as shown above, select the Marquee tool, make the CM layer visible and select the CM layer.
      [thumbnail]
    • Select the Move tool and move the selected area of your CM map into the bottom right-hand corner:
      [thumbnail]
    • Go to: "Image > Mode > Indexed Colour". When prompted to merge layers, select OK.
    • You can then specify options for indexing the image, may as well allow 255 colours, select the "Palette" that looks best.
    • You'll end up with
      this image
  • With the modified settings in the minimap editor, select "Import" and select your custom minimap to import it:
    [thumbnail] [thumbnail]
  • Note: Your minimap may not appear correctly in the game yet; this is because not every tile map lists each tile sequentially. Check that the minimap looks fine using the default settings. In the case of W.F. it does but if it doesn't: make a note of the name and location of the ISC file eg. "data/stage/battan_king_map/battan_king_map_00_isc.bin" and replace it with another that is known to work fine. You can produce a correct ISC file by importing a 128x128 minimap eg. as shown in example 1 and exporting a copy of the generated ISC file.
  • As before, to change the background colour, select the colour you want from the palette and click on "Set Selected as Background":
    [thumbnail] [thumbnail]
  • That's it done.

Fiachra
Posted on 02-20-16 10:46 AM (rev. 2 of 02-20-16 10:50 AM) Link | #67899
Something which may come in handy:
If you want to disable all of the level-specific minimap changes eg. the ship in JRB or the Fortress in WF, add the following code to your hack:
// Disable all of the level-specific minimap changes eg. the ship in
// JRB or the fortress in WF.
void repl_020F99B4_ov_02()
{
asm
(
"mov r0, #0x00 \t\n"
);
}

If you want to override the minimap sizes used by the game:
// One bit for each of the 52 levels: 1 for 256x256, 0 for 128x128
unsigned int LEVEL_MINIMAP_SIZES[2] = { 0xFFFFFFFF, 0xFFFFFFFF };

unsigned int Map_c = 0xFFFFFFFF;
unsigned int DMA_Related = 0x0400100E;
void hook_020FB698_ov_02()
{
asm
(
"ldr r0, =Map_c \t\n"
"str r6, [r0] \t\n"
"ldr r0, =DMA_Related \t\n"
"str r2, [r0] \t\n"
);

byte currentLevelMinimapSize = ((byte)(LEVEL_MINIMAP_SIZES[CurrentLevelID >> 5] >> CurrentLevelID) & 0x01);

if (currentLevelMinimapSize == 0x00)
{
// 128x128
*((volatile unsigned int*)(Map_c + 0x1D8)) = 0x00000080;
*((volatile unsigned int*)(Map_c + 0x1DC)) = 0x00000040;
*((volatile unsigned int*)(Map_c + 0x1E0)) = 0x00000000;
*((volatile unsigned int*)(Map_c + 0x1E4)) = 0x00000000;
*((volatile unsigned int*)(Map_c + 0x1E8)) = 0x00000000;
*((volatile byte*)(Map_c + 0x251)) = 0x01;
*((volatile unsigned short int*)(DMA_Related)) = 0x1F12;
}
else if (currentLevelMinimapSize == 0x01)
{
// 256x256
*((volatile unsigned int*)(Map_c + 0x1D8)) = 0x00000100;
*((volatile unsigned int*)(Map_c + 0x1DC)) = 0x00000080;
*((volatile unsigned int*)(Map_c + 0x1E0)) = 0xFFD44000;
*((volatile unsigned int*)(Map_c + 0x1E4)) = 0x00000000;
*((volatile unsigned int*)(Map_c + 0x1E8)) = 0x00000000;
*((volatile byte*)(Map_c + 0x251)) = 0x02;
*((volatile unsigned short int*)(DMA_Related)) = 0x5F12;
}
}


Main - General SM64DS hacking - [Tutorial] How to Import Custom Minimaps Hide post layouts | New reply

Page rendered in 0.044 seconds. (2048KB of memory used)
MySQL - queries: 25, rows: 105/105, time: 0.008 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2018-07-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.